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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
MeteoFranceSensor.native_value | (self) | Return the state. | Return the state. | def native_value(self):
"""Return the state."""
path = SENSOR_TYPES[self._type][ENTITY_API_DATA_PATH].split(":")
data = getattr(self.coordinator.data, path[0])
# Specific case for probability forecast
if path[0] == "probability_forecast":
if len(path) == 3:
... | [
"def",
"native_value",
"(",
"self",
")",
":",
"path",
"=",
"SENSOR_TYPES",
"[",
"self",
".",
"_type",
"]",
"[",
"ENTITY_API_DATA_PATH",
"]",
".",
"split",
"(",
"\":\"",
")",
"data",
"=",
"getattr",
"(",
"self",
".",
"coordinator",
".",
"data",
",",
"pa... | [
111,
4
] | [
134,
20
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceSensor.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 SENSOR_TYPES[self._type][ENTITY_UNIT] | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"_type",
"]",
"[",
"ENTITY_UNIT",
"]"
] | [
137,
4
] | [
139,
52
] | python | en | ['en', 'la', 'en'] | True |
MeteoFranceSensor.icon | (self) | Return the icon. | Return the icon. | def icon(self):
"""Return the icon."""
return SENSOR_TYPES[self._type][ENTITY_ICON] | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"_type",
"]",
"[",
"ENTITY_ICON",
"]"
] | [
142,
4
] | [
144,
52
] | python | en | ['en', 'sr', 'en'] | True |
MeteoFranceSensor.device_class | (self) | Return the device class. | Return the device class. | def device_class(self):
"""Return the device class."""
return SENSOR_TYPES[self._type][ENTITY_DEVICE_CLASS] | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"_type",
"]",
"[",
"ENTITY_DEVICE_CLASS",
"]"
] | [
147,
4
] | [
149,
60
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceSensor.entity_registry_enabled_default | (self) | Return if the entity should be enabled when first added to the entity registry. | Return if the entity should be enabled when first added to the entity registry. | def entity_registry_enabled_default(self) -> bool:
"""Return if the entity should be enabled when first added to the entity registry."""
return SENSOR_TYPES[self._type][ENTITY_ENABLE] | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"_type",
"]",
"[",
"ENTITY_ENABLE",
"]"
] | [
152,
4
] | [
154,
54
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceSensor.extra_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def extra_state_attributes(self):
"""Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
"}"
] | [
157,
4
] | [
159,
46
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceRainSensor.native_value | (self) | Return the state. | Return the state. | def native_value(self):
"""Return the state."""
# search first cadran with rain
next_rain = next(
(cadran for cadran in self.coordinator.data.forecast if cadran["rain"] > 1),
None,
)
return (
dt_util.utc_from_timestamp(next_rain["dt"]).isoforma... | [
"def",
"native_value",
"(",
"self",
")",
":",
"# search first cadran with rain",
"next_rain",
"=",
"next",
"(",
"(",
"cadran",
"for",
"cadran",
"in",
"self",
".",
"coordinator",
".",
"data",
".",
"forecast",
"if",
"cadran",
"[",
"\"rain\"",
"]",
">",
"1",
... | [
166,
4
] | [
177,
9
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceRainSensor.extra_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def extra_state_attributes(self):
"""Return the state attributes."""
reference_dt = self.coordinator.data.forecast[0]["dt"]
return {
ATTR_NEXT_RAIN_DT_REF: dt_util.utc_from_timestamp(reference_dt).isoformat(),
ATTR_NEXT_RAIN_1_HOUR_FORECAST: {
f"{int((item... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"reference_dt",
"=",
"self",
".",
"coordinator",
".",
"data",
".",
"forecast",
"[",
"0",
"]",
"[",
"\"dt\"",
"]",
"return",
"{",
"ATTR_NEXT_RAIN_DT_REF",
":",
"dt_util",
".",
"utc_from_timestamp",
"(",
... | [
180,
4
] | [
190,
9
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceAlertSensor.__init__ | (self, sensor_type: str, coordinator: DataUpdateCoordinator) | Initialize the Meteo-France sensor. | Initialize the Meteo-France sensor. | def __init__(self, sensor_type: str, coordinator: DataUpdateCoordinator) -> None:
"""Initialize the Meteo-France sensor."""
super().__init__(sensor_type, coordinator)
dept_code = self.coordinator.data.domain_id
self._name = f"{dept_code} {SENSOR_TYPES[self._type][ENTITY_NAME]}"
s... | [
"def",
"__init__",
"(",
"self",
",",
"sensor_type",
":",
"str",
",",
"coordinator",
":",
"DataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"sensor_type",
",",
"coordinator",
")",
"dept_code",
"=",
"self",
".",
"coord... | [
196,
4
] | [
201,
36
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceAlertSensor.native_value | (self) | Return the state. | Return the state. | def native_value(self):
"""Return the state."""
return get_warning_text_status_from_indice_color(
self.coordinator.data.get_domain_max_color()
) | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"get_warning_text_status_from_indice_color",
"(",
"self",
".",
"coordinator",
".",
"data",
".",
"get_domain_max_color",
"(",
")",
")"
] | [
204,
4
] | [
208,
9
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceAlertSensor.extra_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def extra_state_attributes(self):
"""Return the state attributes."""
return {
**readeable_phenomenoms_dict(self.coordinator.data.phenomenons_max_colors),
ATTR_ATTRIBUTION: ATTRIBUTION,
} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"*",
"*",
"readeable_phenomenoms_dict",
"(",
"self",
".",
"coordinator",
".",
"data",
".",
"phenomenons_max_colors",
")",
",",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
",",
"}"
] | [
211,
4
] | [
216,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the eight sleep sensors. | Set up the eight sleep sensors. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the eight sleep sensors."""
if discovery_info is None:
return
name = "Eight"
sensors = discovery_info[CONF_SENSORS]
eight = hass.data[DATA_EIGHT]
if hass.config.units.is_metric:
uni... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"name",
"=",
"\"Eight\"",
"sensors",
"=",
"discovery_info",
"[",
"... | [
47,
0
] | [
71,
41
] | python | en | ['en', 'et', 'en'] | True |
EightHeatSensor.__init__ | (self, name, eight, sensor) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, eight, sensor):
"""Initialize the sensor."""
super().__init__(eight)
self._sensor = sensor
self._mapped_name = NAME_MAP.get(self._sensor, self._sensor)
self._name = f"{name} {self._mapped_name}"
self._state = None
self._side = self._sens... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"eight",
",",
"sensor",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"eight",
")",
"self",
".",
"_sensor",
"=",
"sensor",
"self",
".",
"_mapped_name",
"=",
"NAME_MAP",
".",
"get",
"(",
"self",
... | [
77,
4
] | [
95,
9
] | python | en | ['en', 'en', 'en'] | True |
EightHeatSensor.name | (self) | Return the name of the sensor, if any. | Return the name of the sensor, if any. | def name(self):
"""Return the name of the sensor, if any."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
98,
4
] | [
100,
25
] | python | en | ['en', 'en', 'en'] | True |
EightHeatSensor.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
103,
4
] | [
105,
26
] | python | en | ['en', 'en', 'en'] | True |
EightHeatSensor.native_unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def native_unit_of_measurement(self):
"""Return the unit the value is expressed in."""
return PERCENTAGE | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"PERCENTAGE"
] | [
108,
4
] | [
110,
25
] | python | en | ['en', 'en', 'en'] | True |
EightHeatSensor.async_update | (self) | Retrieve latest state. | Retrieve latest state. | async def async_update(self):
"""Retrieve latest state."""
_LOGGER.debug("Updating Heat sensor: %s", self._sensor)
self._state = self._usrobj.heating_level | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating Heat sensor: %s\"",
",",
"self",
".",
"_sensor",
")",
"self",
".",
"_state",
"=",
"self",
".",
"_usrobj",
".",
"heating_level"
] | [
112,
4
] | [
115,
48
] | python | en | ['es', 'sk', 'en'] | False |
EightHeatSensor.extra_state_attributes | (self) | Return device state attributes. | Return device state attributes. | def extra_state_attributes(self):
"""Return device state attributes."""
return {
ATTR_TARGET_HEAT: self._usrobj.target_heating_level,
ATTR_ACTIVE_HEAT: self._usrobj.now_heating,
ATTR_DURATION_HEAT: self._usrobj.heating_remaining,
} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_TARGET_HEAT",
":",
"self",
".",
"_usrobj",
".",
"target_heating_level",
",",
"ATTR_ACTIVE_HEAT",
":",
"self",
".",
"_usrobj",
".",
"now_heating",
",",
"ATTR_DURATION_HEAT",
":",
"self",
... | [
118,
4
] | [
124,
9
] | python | en | ['es', 'en', 'en'] | True |
EightUserSensor.__init__ | (self, name, eight, sensor, units) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, eight, sensor, units):
"""Initialize the sensor."""
super().__init__(eight)
self._sensor = sensor
self._sensor_root = self._sensor.split("_", 1)[1]
self._mapped_name = NAME_MAP.get(self._sensor, self._sensor)
self._name = f"{name} {self._mapped_n... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"eight",
",",
"sensor",
",",
"units",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"eight",
")",
"self",
".",
"_sensor",
"=",
"sensor",
"self",
".",
"_sensor_root",
"=",
"self",
".",
"_sensor",
... | [
130,
4
] | [
151,
9
] | python | en | ['en', 'en', 'en'] | True |
EightUserSensor.name | (self) | Return the name of the sensor, if any. | Return the name of the sensor, if any. | def name(self):
"""Return the name of the sensor, if any."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
154,
4
] | [
156,
25
] | python | en | ['en', 'en', 'en'] | True |
EightUserSensor.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
159,
4
] | [
161,
26
] | python | en | ['en', 'en', 'en'] | True |
EightUserSensor.native_unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def native_unit_of_measurement(self):
"""Return the unit the value is expressed in."""
if (
"current_sleep" in self._sensor
or "last_sleep" in self._sensor
or "current_sleep_fitness" in self._sensor
):
return "Score"
if "bed_temp" in self._... | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"if",
"(",
"\"current_sleep\"",
"in",
"self",
".",
"_sensor",
"or",
"\"last_sleep\"",
"in",
"self",
".",
"_sensor",
"or",
"\"current_sleep_fitness\"",
"in",
"self",
".",
"_sensor",
")",
":",
"return",
... | [
164,
4
] | [
176,
19
] | python | en | ['en', 'en', 'en'] | True |
EightUserSensor.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
if "bed_temp" in self._sensor:
return DEVICE_CLASS_TEMPERATURE
return None | [
"def",
"device_class",
"(",
"self",
")",
":",
"if",
"\"bed_temp\"",
"in",
"self",
".",
"_sensor",
":",
"return",
"DEVICE_CLASS_TEMPERATURE",
"return",
"None"
] | [
179,
4
] | [
183,
19
] | python | en | ['en', 'en', 'en'] | True |
EightUserSensor.async_update | (self) | Retrieve latest state. | Retrieve latest state. | async def async_update(self):
"""Retrieve latest state."""
_LOGGER.debug("Updating User sensor: %s", self._sensor)
if "current" in self._sensor:
if "fitness" in self._sensor:
self._state = self._usrobj.current_sleep_fitness_score
self._attr = self._usr... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating User sensor: %s\"",
",",
"self",
".",
"_sensor",
")",
"if",
"\"current\"",
"in",
"self",
".",
"_sensor",
":",
"if",
"\"fitness\"",
"in",
"self",
".",
"_sensor",
... | [
185,
4
] | [
208,
62
] | python | en | ['es', 'sk', 'en'] | False |
EightUserSensor.extra_state_attributes | (self) | Return device state attributes. | Return device state attributes. | def extra_state_attributes(self):
"""Return device state attributes."""
if self._attr is None:
# Skip attributes if sensor type doesn't support
return None
if "fitness" in self._sensor_root:
state_attr = {
ATTR_FIT_DATE: self._attr["date"],
... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_attr",
"is",
"None",
":",
"# Skip attributes if sensor type doesn't support",
"return",
"None",
"if",
"\"fitness\"",
"in",
"self",
".",
"_sensor_root",
":",
"state_attr",
"=",
"{",
"ATTR_... | [
211,
4
] | [
295,
25
] | python | en | ['es', 'en', 'en'] | True |
EightRoomSensor.__init__ | (self, name, eight, sensor, units) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, eight, sensor, units):
"""Initialize the sensor."""
super().__init__(eight)
self._sensor = sensor
self._mapped_name = NAME_MAP.get(self._sensor, self._sensor)
self._name = f"{name} {self._mapped_name}"
self._state = None
self._attr = None... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"eight",
",",
"sensor",
",",
"units",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"eight",
")",
"self",
".",
"_sensor",
"=",
"sensor",
"self",
".",
"_mapped_name",
"=",
"NAME_MAP",
".",
"get",
... | [
301,
4
] | [
310,
27
] | python | en | ['en', 'en', 'en'] | True |
EightRoomSensor.name | (self) | Return the name of the sensor, if any. | Return the name of the sensor, if any. | def name(self):
"""Return the name of the sensor, if any."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
313,
4
] | [
315,
25
] | python | en | ['en', 'en', 'en'] | True |
EightRoomSensor.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
318,
4
] | [
320,
26
] | python | en | ['en', 'en', 'en'] | True |
EightRoomSensor.async_update | (self) | Retrieve latest state. | Retrieve latest state. | async def async_update(self):
"""Retrieve latest state."""
_LOGGER.debug("Updating Room sensor: %s", self._sensor)
temp = self._eight.room_temperature()
try:
if self._units == "si":
self._state = round(temp, 2)
else:
self._state = r... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating Room sensor: %s\"",
",",
"self",
".",
"_sensor",
")",
"temp",
"=",
"self",
".",
"_eight",
".",
"room_temperature",
"(",
")",
"try",
":",
"if",
"self",
".",
"... | [
322,
4
] | [
332,
30
] | python | en | ['es', 'sk', 'en'] | False |
EightRoomSensor.native_unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def native_unit_of_measurement(self):
"""Return the unit the value is expressed in."""
if self._units == "si":
return TEMP_CELSIUS
return TEMP_FAHRENHEIT | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"if",
"self",
".",
"_units",
"==",
"\"si\"",
":",
"return",
"TEMP_CELSIUS",
"return",
"TEMP_FAHRENHEIT"
] | [
335,
4
] | [
339,
30
] | python | en | ['en', 'en', 'en'] | True |
EightRoomSensor.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_TEMPERATURE | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_TEMPERATURE"
] | [
342,
4
] | [
344,
39
] | python | en | ['en', 'en', 'en'] | True |
async_register | (
hass: HomeAssistant, register: system_health.SystemHealthRegistration
) | Register system health callbacks. | Register system health callbacks. | def async_register(
hass: HomeAssistant, register: system_health.SystemHealthRegistration
) -> None:
"""Register system health callbacks."""
register.async_register_info(system_health_info) | [
"def",
"async_register",
"(",
"hass",
":",
"HomeAssistant",
",",
"register",
":",
"system_health",
".",
"SystemHealthRegistration",
")",
"->",
"None",
":",
"register",
".",
"async_register_info",
"(",
"system_health_info",
")"
] | [
14,
0
] | [
18,
52
] | python | en | ['en', 'sv', 'en'] | True |
system_health_info | (hass: HomeAssistant) | Get info for the info page. | Get info for the info page. | async def system_health_info(hass: HomeAssistant) -> dict[str, Any]:
"""Get info for the info page."""
remaining_requests = list(hass.data[DOMAIN].values())[
0
].accuweather.requests_remaining
return {
"can_reach_server": system_health.async_check_can_reach_url(hass, ENDPOINT),
... | [
"async",
"def",
"system_health_info",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
":",
"remaining_requests",
"=",
"list",
"(",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"values",
"(",
")",
")",
"[",
"0",
"]"... | [
21,
0
] | [
30,
5
] | python | en | ['en', 'en', 'en'] | True |
get_hub | (hass: HomeAssistant, name: str) | Return modbus hub with name. | Return modbus hub with name. | def get_hub(hass: HomeAssistant, name: str) -> ModbusHub:
"""Return modbus hub with name."""
return hass.data[DOMAIN][name] | [
"def",
"get_hub",
"(",
"hass",
":",
"HomeAssistant",
",",
"name",
":",
"str",
")",
"->",
"ModbusHub",
":",
"return",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"name",
"]"
] | [
373,
0
] | [
375,
34
] | python | en | ['en', 'mi', 'en'] | True |
async_setup | (hass, config) | Set up Modbus component. | Set up Modbus component. | async def async_setup(hass, config):
"""Set up Modbus component."""
return await async_modbus_setup(
hass, config, SERVICE_WRITE_REGISTER_SCHEMA, SERVICE_WRITE_COIL_SCHEMA
) | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"return",
"await",
"async_modbus_setup",
"(",
"hass",
",",
"config",
",",
"SERVICE_WRITE_REGISTER_SCHEMA",
",",
"SERVICE_WRITE_COIL_SCHEMA",
")"
] | [
378,
0
] | [
382,
5
] | python | en | ['en', 'pt', 'en'] | True |
TestUserApi.test_create_user | (self) | Test case for create_user
Create user # noqa: E501
| Test case for create_user | def test_create_user(self):
"""Test case for create_user
Create user # noqa: E501
"""
pass | [
"def",
"test_create_user",
"(",
"self",
")",
":",
"pass"
] | [
29,
4
] | [
34,
12
] | python | en | ['en', 'en', 'en'] | True |
TestUserApi.test_create_users_with_array_input | (self) | Test case for create_users_with_array_input
Creates list of users with given input array # noqa: E501
| Test case for create_users_with_array_input | def test_create_users_with_array_input(self):
"""Test case for create_users_with_array_input
Creates list of users with given input array # noqa: E501
"""
pass | [
"def",
"test_create_users_with_array_input",
"(",
"self",
")",
":",
"pass"
] | [
36,
4
] | [
41,
12
] | python | en | ['en', 'en', 'en'] | True |
TestUserApi.test_create_users_with_list_input | (self) | Test case for create_users_with_list_input
Creates list of users with given input array # noqa: E501
| Test case for create_users_with_list_input | def test_create_users_with_list_input(self):
"""Test case for create_users_with_list_input
Creates list of users with given input array # noqa: E501
"""
pass | [
"def",
"test_create_users_with_list_input",
"(",
"self",
")",
":",
"pass"
] | [
43,
4
] | [
48,
12
] | python | en | ['en', 'en', 'en'] | True |
TestUserApi.test_delete_user | (self) | Test case for delete_user
Delete user # noqa: E501
| Test case for delete_user | def test_delete_user(self):
"""Test case for delete_user
Delete user # noqa: E501
"""
pass | [
"def",
"test_delete_user",
"(",
"self",
")",
":",
"pass"
] | [
50,
4
] | [
55,
12
] | python | da | ['da', 'no', 'en'] | False |
TestUserApi.test_get_user_by_name | (self) | Test case for get_user_by_name
Get user by user name # noqa: E501
| Test case for get_user_by_name | def test_get_user_by_name(self):
"""Test case for get_user_by_name
Get user by user name # noqa: E501
"""
pass | [
"def",
"test_get_user_by_name",
"(",
"self",
")",
":",
"pass"
] | [
57,
4
] | [
62,
12
] | python | en | ['da', 'en', 'en'] | True |
TestUserApi.test_login_user | (self) | Test case for login_user
Logs user into the system # noqa: E501
| Test case for login_user | def test_login_user(self):
"""Test case for login_user
Logs user into the system # noqa: E501
"""
pass | [
"def",
"test_login_user",
"(",
"self",
")",
":",
"pass"
] | [
64,
4
] | [
69,
12
] | python | en | ['en', 'da', 'en'] | True |
TestUserApi.test_logout_user | (self) | Test case for logout_user
Logs out current logged in user session # noqa: E501
| Test case for logout_user | def test_logout_user(self):
"""Test case for logout_user
Logs out current logged in user session # noqa: E501
"""
pass | [
"def",
"test_logout_user",
"(",
"self",
")",
":",
"pass"
] | [
71,
4
] | [
76,
12
] | python | en | ['en', 'da', 'en'] | True |
TestUserApi.test_update_user | (self) | Test case for update_user
Updated user # noqa: E501
| Test case for update_user | def test_update_user(self):
"""Test case for update_user
Updated user # noqa: E501
"""
pass | [
"def",
"test_update_user",
"(",
"self",
")",
":",
"pass"
] | [
78,
4
] | [
83,
12
] | python | en | ['en', 'en', 'en'] | True |
test_form | (hass) | Test we get the form. | Test we get the form. | async def test_form(hass):
"""Test we get the form."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["errors"] is None
with patch(
"homeassistant.components.rituals_perfu... | [
"async",
"def",
"test_form",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")",
"assert",... | [
23,
0
] | [
50,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_invalid_auth | (hass) | Test we handle invalid auth. | Test we handle invalid auth. | async def test_form_invalid_auth(hass):
"""Test we handle invalid auth."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.rituals_perfume_genie.config_flow.Account.authenticate",
... | [
"async",
"def",
"test_form_invalid_auth",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")"... | [
53,
0
] | [
72,
56
] | python | en | ['en', 'en', 'en'] | True |
test_form_auth_exception | (hass) | Test we handle auth exception. | Test we handle auth exception. | async def test_form_auth_exception(hass):
"""Test we handle auth exception."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.rituals_perfume_genie.config_flow.Account.authenticate",
... | [
"async",
"def",
"test_form_auth_exception",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
"... | [
75,
0
] | [
94,
51
] | python | en | ['de', 'en', 'en'] | True |
test_form_cannot_connect | (hass) | Test we handle cannot connect error. | Test we handle cannot connect error. | async def test_form_cannot_connect(hass):
"""Test we handle cannot connect error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.rituals_perfume_genie.config_flow.Account.authenticate"... | [
"async",
"def",
"test_form_cannot_connect",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
"... | [
97,
0
] | [
116,
58
] | python | en | ['en', 'en', 'en'] | True |
async_setup_devices | (hass, device_type, traits={}) | Set up the platform and prerequisites. | Set up the platform and prerequisites. | async def async_setup_devices(hass, device_type, traits={}):
"""Set up the platform and prerequisites."""
devices = {
DEVICE_ID: Device.MakeDevice(
{
"name": DEVICE_ID,
"type": device_type,
"traits": traits,
},
auth=None... | [
"async",
"def",
"async_setup_devices",
"(",
"hass",
",",
"device_type",
",",
"traits",
"=",
"{",
"}",
")",
":",
"devices",
"=",
"{",
"DEVICE_ID",
":",
"Device",
".",
"MakeDevice",
"(",
"{",
"\"name\"",
":",
"DEVICE_ID",
",",
"\"type\"",
":",
"device_type",... | [
24,
0
] | [
36,
74
] | python | en | ['en', 'en', 'en'] | True |
create_device_traits | (event_trait) | Create fake traits for a device. | Create fake traits for a device. | def create_device_traits(event_trait):
"""Create fake traits for a device."""
return {
"sdm.devices.traits.Info": {
"customName": "Front",
},
event_trait: {},
"sdm.devices.traits.CameraLiveStream": {
"maxVideoResolution": {
"width": 640,
... | [
"def",
"create_device_traits",
"(",
"event_trait",
")",
":",
"return",
"{",
"\"sdm.devices.traits.Info\"",
":",
"{",
"\"customName\"",
":",
"\"Front\"",
",",
"}",
",",
"event_trait",
":",
"{",
"}",
",",
"\"sdm.devices.traits.CameraLiveStream\"",
":",
"{",
"\"maxVide... | [
39,
0
] | [
54,
5
] | python | en | ['en', 'en', 'en'] | True |
create_event | (event_type, device_id=DEVICE_ID, timestamp=None) | Create an EventMessage for a single event type. | Create an EventMessage for a single event type. | def create_event(event_type, device_id=DEVICE_ID, timestamp=None):
"""Create an EventMessage for a single event type."""
events = {
event_type: {
"eventSessionId": EVENT_SESSION_ID,
"eventId": EVENT_ID,
},
}
return create_events(events=events, device_id=device_id) | [
"def",
"create_event",
"(",
"event_type",
",",
"device_id",
"=",
"DEVICE_ID",
",",
"timestamp",
"=",
"None",
")",
":",
"events",
"=",
"{",
"event_type",
":",
"{",
"\"eventSessionId\"",
":",
"EVENT_SESSION_ID",
",",
"\"eventId\"",
":",
"EVENT_ID",
",",
"}",
"... | [
57,
0
] | [
65,
60
] | python | en | ['en', 'en', 'en'] | True |
create_events | (events, device_id=DEVICE_ID, timestamp=None) | Create an EventMessage for events. | Create an EventMessage for events. | def create_events(events, device_id=DEVICE_ID, timestamp=None):
"""Create an EventMessage for events."""
if not timestamp:
timestamp = utcnow()
return EventMessage(
{
"eventId": "some-event-id",
"timestamp": timestamp.isoformat(timespec="seconds"),
"resour... | [
"def",
"create_events",
"(",
"events",
",",
"device_id",
"=",
"DEVICE_ID",
",",
"timestamp",
"=",
"None",
")",
":",
"if",
"not",
"timestamp",
":",
"timestamp",
"=",
"utcnow",
"(",
")",
"return",
"EventMessage",
"(",
"{",
"\"eventId\"",
":",
"\"some-event-id\... | [
68,
0
] | [
82,
5
] | python | en | ['en', 'en', 'en'] | True |
test_doorbell_chime_event | (hass) | Test a pubsub message for a doorbell event. | Test a pubsub message for a doorbell event. | async def test_doorbell_chime_event(hass):
"""Test a pubsub message for a doorbell event."""
events = async_capture_events(hass, NEST_EVENT)
subscriber = await async_setup_devices(
hass,
"sdm.devices.types.DOORBELL",
create_device_traits("sdm.devices.traits.DoorbellChime"),
)
... | [
"async",
"def",
"test_doorbell_chime_event",
"(",
"hass",
")",
":",
"events",
"=",
"async_capture_events",
"(",
"hass",
",",
"NEST_EVENT",
")",
"subscriber",
"=",
"await",
"async_setup_devices",
"(",
"hass",
",",
"\"sdm.devices.types.DOORBELL\"",
",",
"create_device_t... | [
85,
0
] | [
119,
5
] | python | en | ['en', 'en', 'en'] | True |
test_camera_motion_event | (hass) | Test a pubsub message for a camera motion event. | Test a pubsub message for a camera motion event. | async def test_camera_motion_event(hass):
"""Test a pubsub message for a camera motion event."""
events = async_capture_events(hass, NEST_EVENT)
subscriber = await async_setup_devices(
hass,
"sdm.devices.types.CAMERA",
create_device_traits("sdm.devices.traits.CameraMotion"),
)
... | [
"async",
"def",
"test_camera_motion_event",
"(",
"hass",
")",
":",
"events",
"=",
"async_capture_events",
"(",
"hass",
",",
"NEST_EVENT",
")",
"subscriber",
"=",
"await",
"async_setup_devices",
"(",
"hass",
",",
"\"sdm.devices.types.CAMERA\"",
",",
"create_device_trai... | [
122,
0
] | [
146,
5
] | python | en | ['en', 'en', 'en'] | True |
test_camera_sound_event | (hass) | Test a pubsub message for a camera sound event. | Test a pubsub message for a camera sound event. | async def test_camera_sound_event(hass):
"""Test a pubsub message for a camera sound event."""
events = async_capture_events(hass, NEST_EVENT)
subscriber = await async_setup_devices(
hass,
"sdm.devices.types.CAMERA",
create_device_traits("sdm.devices.traits.CameraSound"),
)
r... | [
"async",
"def",
"test_camera_sound_event",
"(",
"hass",
")",
":",
"events",
"=",
"async_capture_events",
"(",
"hass",
",",
"NEST_EVENT",
")",
"subscriber",
"=",
"await",
"async_setup_devices",
"(",
"hass",
",",
"\"sdm.devices.types.CAMERA\"",
",",
"create_device_trait... | [
149,
0
] | [
173,
5
] | python | en | ['en', 'en', 'en'] | True |
test_camera_person_event | (hass) | Test a pubsub message for a camera person event. | Test a pubsub message for a camera person event. | async def test_camera_person_event(hass):
"""Test a pubsub message for a camera person event."""
events = async_capture_events(hass, NEST_EVENT)
subscriber = await async_setup_devices(
hass,
"sdm.devices.types.DOORBELL",
create_device_traits("sdm.devices.traits.CameraEventImage"),
... | [
"async",
"def",
"test_camera_person_event",
"(",
"hass",
")",
":",
"events",
"=",
"async_capture_events",
"(",
"hass",
",",
"NEST_EVENT",
")",
"subscriber",
"=",
"await",
"async_setup_devices",
"(",
"hass",
",",
"\"sdm.devices.types.DOORBELL\"",
",",
"create_device_tr... | [
176,
0
] | [
200,
5
] | python | en | ['en', 'en', 'en'] | True |
test_camera_multiple_event | (hass) | Test a pubsub message for a camera person event. | Test a pubsub message for a camera person event. | async def test_camera_multiple_event(hass):
"""Test a pubsub message for a camera person event."""
events = async_capture_events(hass, NEST_EVENT)
subscriber = await async_setup_devices(
hass,
"sdm.devices.types.DOORBELL",
create_device_traits("sdm.devices.traits.CameraEventImage"),
... | [
"async",
"def",
"test_camera_multiple_event",
"(",
"hass",
")",
":",
"events",
"=",
"async_capture_events",
"(",
"hass",
",",
"NEST_EVENT",
")",
"subscriber",
"=",
"await",
"async_setup_devices",
"(",
"hass",
",",
"\"sdm.devices.types.DOORBELL\"",
",",
"create_device_... | [
203,
0
] | [
241,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unknown_event | (hass) | Test a pubsub message for an unknown event type. | Test a pubsub message for an unknown event type. | async def test_unknown_event(hass):
"""Test a pubsub message for an unknown event type."""
events = async_capture_events(hass, NEST_EVENT)
subscriber = await async_setup_devices(
hass,
"sdm.devices.types.DOORBELL",
create_device_traits("sdm.devices.traits.DoorbellChime"),
)
a... | [
"async",
"def",
"test_unknown_event",
"(",
"hass",
")",
":",
"events",
"=",
"async_capture_events",
"(",
"hass",
",",
"NEST_EVENT",
")",
"subscriber",
"=",
"await",
"async_setup_devices",
"(",
"hass",
",",
"\"sdm.devices.types.DOORBELL\"",
",",
"create_device_traits",... | [
244,
0
] | [
255,
27
] | python | en | ['en', 'en', 'en'] | True |
test_unknown_device_id | (hass) | Test a pubsub message for an unknown event type. | Test a pubsub message for an unknown event type. | async def test_unknown_device_id(hass):
"""Test a pubsub message for an unknown event type."""
events = async_capture_events(hass, NEST_EVENT)
subscriber = await async_setup_devices(
hass,
"sdm.devices.types.DOORBELL",
create_device_traits("sdm.devices.traits.DoorbellChime"),
)
... | [
"async",
"def",
"test_unknown_device_id",
"(",
"hass",
")",
":",
"events",
"=",
"async_capture_events",
"(",
"hass",
",",
"NEST_EVENT",
")",
"subscriber",
"=",
"await",
"async_setup_devices",
"(",
"hass",
",",
"\"sdm.devices.types.DOORBELL\"",
",",
"create_device_trai... | [
258,
0
] | [
271,
27
] | python | en | ['en', 'en', 'en'] | True |
test_event_message_without_device_event | (hass) | Test a pubsub message for an unknown event type. | Test a pubsub message for an unknown event type. | async def test_event_message_without_device_event(hass):
"""Test a pubsub message for an unknown event type."""
events = async_capture_events(hass, NEST_EVENT)
subscriber = await async_setup_devices(
hass,
"sdm.devices.types.DOORBELL",
create_device_traits("sdm.devices.traits.Doorbel... | [
"async",
"def",
"test_event_message_without_device_event",
"(",
"hass",
")",
":",
"events",
"=",
"async_capture_events",
"(",
"hass",
",",
"NEST_EVENT",
")",
"subscriber",
"=",
"await",
"async_setup_devices",
"(",
"hass",
",",
"\"sdm.devices.types.DOORBELL\"",
",",
"c... | [
274,
0
] | [
293,
27
] | python | en | ['en', 'en', 'en'] | True |
mock_camera_fixture | (hass) | Initialize a demo camera platform. | Initialize a demo camera platform. | async def mock_camera_fixture(hass):
"""Initialize a demo camera platform."""
assert await async_setup_component(
hass, "camera", {camera.DOMAIN: {"platform": "demo"}}
)
await hass.async_block_till_done()
with patch(
"homeassistant.components.demo.camera.Path.read_bytes",
re... | [
"async",
"def",
"mock_camera_fixture",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"camera\"",
",",
"{",
"camera",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
"}",
")",
"await",
"hass",
".",
"as... | [
28,
0
] | [
39,
13
] | python | en | ['es', 'pt', 'en'] | False |
mock_stream_fixture | (hass) | Initialize a demo camera platform with streaming. | Initialize a demo camera platform with streaming. | def mock_stream_fixture(hass):
"""Initialize a demo camera platform with streaming."""
assert hass.loop.run_until_complete(
async_setup_component(hass, "stream", {"stream": {}})
) | [
"def",
"mock_stream_fixture",
"(",
"hass",
")",
":",
"assert",
"hass",
".",
"loop",
".",
"run_until_complete",
"(",
"async_setup_component",
"(",
"hass",
",",
"\"stream\"",
",",
"{",
"\"stream\"",
":",
"{",
"}",
"}",
")",
")"
] | [
43,
0
] | [
47,
5
] | python | en | ['en', 'en', 'en'] | True |
setup_camera_prefs_fixture | (hass) | Initialize HTTP API. | Initialize HTTP API. | def setup_camera_prefs_fixture(hass):
"""Initialize HTTP API."""
return common.mock_camera_prefs(hass, "camera.demo_camera") | [
"def",
"setup_camera_prefs_fixture",
"(",
"hass",
")",
":",
"return",
"common",
".",
"mock_camera_prefs",
"(",
"hass",
",",
"\"camera.demo_camera\"",
")"
] | [
51,
0
] | [
53,
63
] | python | en | ['en', 'en', 'it'] | True |
image_mock_url_fixture | (hass) | Fixture for get_image tests. | Fixture for get_image tests. | async def image_mock_url_fixture(hass):
"""Fixture for get_image tests."""
await async_setup_component(
hass, camera.DOMAIN, {camera.DOMAIN: {"platform": "demo"}}
)
await hass.async_block_till_done() | [
"async",
"def",
"image_mock_url_fixture",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"camera",
".",
"DOMAIN",
",",
"{",
"camera",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
"}",
")",
"await",
"hass",
".",... | [
57,
0
] | [
62,
38
] | python | en | ['da', 'en', 'en'] | True |
test_get_image_from_camera | (hass, image_mock_url) | Grab an image from camera entity. | Grab an image from camera entity. | async def test_get_image_from_camera(hass, image_mock_url):
"""Grab an image from camera entity."""
with patch(
"homeassistant.components.demo.camera.Path.read_bytes",
autospec=True,
return_value=b"Test",
) as mock_camera:
image = await camera.async_get_image(hass, "camera.d... | [
"async",
"def",
"test_get_image_from_camera",
"(",
"hass",
",",
"image_mock_url",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.demo.camera.Path.read_bytes\"",
",",
"autospec",
"=",
"True",
",",
"return_value",
"=",
"b\"Test\"",
",",
")",
"as",
"mock_cam... | [
65,
0
] | [
76,
35
] | python | en | ['en', 'en', 'en'] | True |
test_legacy_async_get_image_signature_warns_only_once | (
hass, image_mock_url, caplog
) | Test that we only warn once when we encounter a legacy async_get_image function signature. | Test that we only warn once when we encounter a legacy async_get_image function signature. | async def test_legacy_async_get_image_signature_warns_only_once(
hass, image_mock_url, caplog
):
"""Test that we only warn once when we encounter a legacy async_get_image function signature."""
async def _legacy_async_camera_image(self):
return b"Image"
with patch(
"homeassistant.compo... | [
"async",
"def",
"test_legacy_async_get_image_signature_warns_only_once",
"(",
"hass",
",",
"image_mock_url",
",",
"caplog",
")",
":",
"async",
"def",
"_legacy_async_camera_image",
"(",
"self",
")",
":",
"return",
"b\"Image\"",
"with",
"patch",
"(",
"\"homeassistant.comp... | [
79,
0
] | [
98,
80
] | python | en | ['en', 'en', 'en'] | True |
test_get_image_from_camera_with_width_height | (hass, image_mock_url) | Grab an image from camera entity with width and height. | Grab an image from camera entity with width and height. | async def test_get_image_from_camera_with_width_height(hass, image_mock_url):
"""Grab an image from camera entity with width and height."""
turbo_jpeg = mock_turbo_jpeg(
first_width=16, first_height=12, second_width=300, second_height=200
)
with patch(
"homeassistant.components.camera.i... | [
"async",
"def",
"test_get_image_from_camera_with_width_height",
"(",
"hass",
",",
"image_mock_url",
")",
":",
"turbo_jpeg",
"=",
"mock_turbo_jpeg",
"(",
"first_width",
"=",
"16",
",",
"first_height",
"=",
"12",
",",
"second_width",
"=",
"300",
",",
"second_height",
... | [
101,
0
] | [
120,
35
] | python | en | ['en', 'en', 'en'] | True |
test_get_image_from_camera_with_width_height_scaled | (hass, image_mock_url) | Grab an image from camera entity with width and height and scale it. | Grab an image from camera entity with width and height and scale it. | async def test_get_image_from_camera_with_width_height_scaled(hass, image_mock_url):
"""Grab an image from camera entity with width and height and scale it."""
turbo_jpeg = mock_turbo_jpeg(
first_width=16, first_height=12, second_width=300, second_height=200
)
with patch(
"homeassistant... | [
"async",
"def",
"test_get_image_from_camera_with_width_height_scaled",
"(",
"hass",
",",
"image_mock_url",
")",
":",
"turbo_jpeg",
"=",
"mock_turbo_jpeg",
"(",
"first_width",
"=",
"16",
",",
"first_height",
"=",
"12",
",",
"second_width",
"=",
"300",
",",
"second_he... | [
123,
0
] | [
143,
42
] | python | en | ['en', 'en', 'en'] | True |
test_get_image_from_camera_not_jpeg | (hass, image_mock_url) | Grab an image from camera entity that we cannot scale. | Grab an image from camera entity that we cannot scale. | async def test_get_image_from_camera_not_jpeg(hass, image_mock_url):
"""Grab an image from camera entity that we cannot scale."""
turbo_jpeg = mock_turbo_jpeg(
first_width=16, first_height=12, second_width=300, second_height=200
)
with patch(
"homeassistant.components.camera.img_util.Tu... | [
"async",
"def",
"test_get_image_from_camera_not_jpeg",
"(",
"hass",
",",
"image_mock_url",
")",
":",
"turbo_jpeg",
"=",
"mock_turbo_jpeg",
"(",
"first_width",
"=",
"16",
",",
"first_height",
"=",
"12",
",",
"second_width",
"=",
"300",
",",
"second_height",
"=",
... | [
146,
0
] | [
166,
34
] | python | en | ['en', 'en', 'en'] | True |
test_get_stream_source_from_camera | (hass, mock_camera) | Fetch stream source from camera entity. | Fetch stream source from camera entity. | async def test_get_stream_source_from_camera(hass, mock_camera):
"""Fetch stream source from camera entity."""
with patch(
"homeassistant.components.camera.Camera.stream_source",
return_value="rtsp://127.0.0.1/stream",
) as mock_camera_stream_source:
stream_source = await camera.asy... | [
"async",
"def",
"test_get_stream_source_from_camera",
"(",
"hass",
",",
"mock_camera",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.camera.Camera.stream_source\"",
",",
"return_value",
"=",
"\"rtsp://127.0.0.1/stream\"",
",",
")",
"as",
"mock_camera_stream_sour... | [
169,
0
] | [
179,
53
] | python | en | ['en', 'en', 'en'] | True |
test_get_image_without_exists_camera | (hass, image_mock_url) | Try to get image without exists camera. | Try to get image without exists camera. | async def test_get_image_without_exists_camera(hass, image_mock_url):
"""Try to get image without exists camera."""
with patch(
"homeassistant.helpers.entity_component.EntityComponent.get_entity",
return_value=None,
), pytest.raises(HomeAssistantError):
await camera.async_get_image(h... | [
"async",
"def",
"test_get_image_without_exists_camera",
"(",
"hass",
",",
"image_mock_url",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.helpers.entity_component.EntityComponent.get_entity\"",
",",
"return_value",
"=",
"None",
",",
")",
",",
"pytest",
".",
"raises",
... | [
182,
0
] | [
188,
64
] | python | en | ['en', 'en', 'en'] | True |
test_get_image_with_timeout | (hass, image_mock_url) | Try to get image with timeout. | Try to get image with timeout. | async def test_get_image_with_timeout(hass, image_mock_url):
"""Try to get image with timeout."""
with patch(
"homeassistant.components.demo.camera.DemoCamera.async_camera_image",
side_effect=asyncio.TimeoutError,
), pytest.raises(HomeAssistantError):
await camera.async_get_image(has... | [
"async",
"def",
"test_get_image_with_timeout",
"(",
"hass",
",",
"image_mock_url",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.demo.camera.DemoCamera.async_camera_image\"",
",",
"side_effect",
"=",
"asyncio",
".",
"TimeoutError",
",",
")",
",",
"pytest",
... | [
191,
0
] | [
197,
64
] | python | en | ['en', 'en', 'en'] | True |
test_get_image_fails | (hass, image_mock_url) | Try to get image with timeout. | Try to get image with timeout. | async def test_get_image_fails(hass, image_mock_url):
"""Try to get image with timeout."""
with patch(
"homeassistant.components.demo.camera.DemoCamera.async_camera_image",
return_value=None,
), pytest.raises(HomeAssistantError):
await camera.async_get_image(hass, "camera.demo_camera... | [
"async",
"def",
"test_get_image_fails",
"(",
"hass",
",",
"image_mock_url",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.demo.camera.DemoCamera.async_camera_image\"",
",",
"return_value",
"=",
"None",
",",
")",
",",
"pytest",
".",
"raises",
"(",
"HomeAs... | [
200,
0
] | [
206,
64
] | python | en | ['en', 'en', 'en'] | True |
test_snapshot_service | (hass, mock_camera) | Test snapshot service. | Test snapshot service. | async def test_snapshot_service(hass, mock_camera):
"""Test snapshot service."""
mopen = mock_open()
with patch("homeassistant.components.camera.open", mopen, create=True), patch(
"homeassistant.components.camera.os.path.exists",
Mock(spec="os.path.exists", return_value=True),
), patch.... | [
"async",
"def",
"test_snapshot_service",
"(",
"hass",
",",
"mock_camera",
")",
":",
"mopen",
"=",
"mock_open",
"(",
")",
"with",
"patch",
"(",
"\"homeassistant.components.camera.open\"",
",",
"mopen",
",",
"create",
"=",
"True",
")",
",",
"patch",
"(",
"\"home... | [
209,
0
] | [
230,
56
] | python | en | ['en', 'de', 'en'] | True |
test_websocket_camera_thumbnail | (hass, hass_ws_client, mock_camera) | Test camera_thumbnail websocket command. | Test camera_thumbnail websocket command. | async def test_websocket_camera_thumbnail(hass, hass_ws_client, mock_camera):
"""Test camera_thumbnail websocket command."""
await async_setup_component(hass, "camera", {})
client = await hass_ws_client(hass)
await client.send_json(
{"id": 5, "type": "camera_thumbnail", "entity_id": "camera.dem... | [
"async",
"def",
"test_websocket_camera_thumbnail",
"(",
"hass",
",",
"hass_ws_client",
",",
"mock_camera",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"camera\"",
",",
"{",
"}",
")",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",... | [
233,
0
] | [
248,
80
] | python | en | ['en', 'hu', 'sw'] | False |
test_websocket_stream_no_source | (
hass, hass_ws_client, mock_camera, mock_stream
) | Test camera/stream websocket command with camera with no source. | Test camera/stream websocket command with camera with no source. | async def test_websocket_stream_no_source(
hass, hass_ws_client, mock_camera, mock_stream
):
"""Test camera/stream websocket command with camera with no source."""
await async_setup_component(hass, "camera", {})
# Request playlist through WebSocket
client = await hass_ws_client(hass)
await clie... | [
"async",
"def",
"test_websocket_stream_no_source",
"(",
"hass",
",",
"hass_ws_client",
",",
"mock_camera",
",",
"mock_stream",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"camera\"",
",",
"{",
"}",
")",
"# Request playlist through WebSocket",
"clie... | [
251,
0
] | [
267,
29
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_camera_stream | (hass, hass_ws_client, mock_camera, mock_stream) | Test camera/stream websocket command. | Test camera/stream websocket command. | async def test_websocket_camera_stream(hass, hass_ws_client, mock_camera, mock_stream):
"""Test camera/stream websocket command."""
await async_setup_component(hass, "camera", {})
with patch(
"homeassistant.components.camera.Stream.endpoint_url",
return_value="http://home.assistant/playlist... | [
"async",
"def",
"test_websocket_camera_stream",
"(",
"hass",
",",
"hass_ws_client",
",",
"mock_camera",
",",
"mock_stream",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"camera\"",
",",
"{",
"}",
")",
"with",
"patch",
"(",
"\"homeassistant.compo... | [
270,
0
] | [
293,
60
] | python | en | ['en', 'sv', 'en'] | True |
test_websocket_get_prefs | (hass, hass_ws_client, mock_camera) | Test get camera preferences websocket command. | Test get camera preferences websocket command. | async def test_websocket_get_prefs(hass, hass_ws_client, mock_camera):
"""Test get camera preferences websocket command."""
await async_setup_component(hass, "camera", {})
# Request preferences through websocket
client = await hass_ws_client(hass)
await client.send_json(
{"id": 7, "type": "... | [
"async",
"def",
"test_websocket_get_prefs",
"(",
"hass",
",",
"hass_ws_client",
",",
"mock_camera",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"camera\"",
",",
"{",
"}",
")",
"# Request preferences through websocket",
"client",
"=",
"await",
"ha... | [
296,
0
] | [
308,
25
] | python | da | ['nl', 'da', 'en'] | False |
test_websocket_update_prefs | (
hass, hass_ws_client, mock_camera, setup_camera_prefs
) | Test updating preference. | Test updating preference. | async def test_websocket_update_prefs(
hass, hass_ws_client, mock_camera, setup_camera_prefs
):
"""Test updating preference."""
await async_setup_component(hass, "camera", {})
assert setup_camera_prefs[PREF_PRELOAD_STREAM]
client = await hass_ws_client(hass)
await client.send_json(
{
... | [
"async",
"def",
"test_websocket_update_prefs",
"(",
"hass",
",",
"hass_ws_client",
",",
"mock_camera",
",",
"setup_camera_prefs",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"camera\"",
",",
"{",
"}",
")",
"assert",
"setup_camera_prefs",
"[",
"... | [
311,
0
] | [
333,
5
] | python | en | ['en', 'en', 'en'] | True |
test_play_stream_service_no_source | (hass, mock_camera, mock_stream) | Test camera play_stream service. | Test camera play_stream service. | async def test_play_stream_service_no_source(hass, mock_camera, mock_stream):
"""Test camera play_stream service."""
data = {
ATTR_ENTITY_ID: "camera.demo_camera",
camera.ATTR_MEDIA_PLAYER: "media_player.test",
}
with pytest.raises(HomeAssistantError):
# Call service
awai... | [
"async",
"def",
"test_play_stream_service_no_source",
"(",
"hass",
",",
"mock_camera",
",",
"mock_stream",
")",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"\"camera.demo_camera\"",
",",
"camera",
".",
"ATTR_MEDIA_PLAYER",
":",
"\"media_player.test\"",
",",
"}",
"... | [
336,
0
] | [
346,
9
] | python | en | ['es', 'zh', 'en'] | False |
test_handle_play_stream_service | (hass, mock_camera, mock_stream) | Test camera play_stream service. | Test camera play_stream service. | async def test_handle_play_stream_service(hass, mock_camera, mock_stream):
"""Test camera play_stream service."""
await async_process_ha_core_config(
hass,
{"external_url": "https://example.com"},
)
await async_setup_component(hass, "media_player", {})
with patch(
"homeassist... | [
"async",
"def",
"test_handle_play_stream_service",
"(",
"hass",
",",
"mock_camera",
",",
"mock_stream",
")",
":",
"await",
"async_process_ha_core_config",
"(",
"hass",
",",
"{",
"\"external_url\"",
":",
"\"https://example.com\"",
"}",
",",
")",
"await",
"async_setup_c... | [
349,
0
] | [
374,
41
] | python | en | ['es', 'zh', 'en'] | False |
test_no_preload_stream | (hass, mock_stream) | Test camera preload preference. | Test camera preload preference. | async def test_no_preload_stream(hass, mock_stream):
"""Test camera preload preference."""
demo_prefs = CameraEntityPreferences({PREF_PRELOAD_STREAM: False})
with patch(
"homeassistant.components.camera.Stream.endpoint_url",
) as mock_request_stream, patch(
"homeassistant.components.came... | [
"async",
"def",
"test_no_preload_stream",
"(",
"hass",
",",
"mock_stream",
")",
":",
"demo_prefs",
"=",
"CameraEntityPreferences",
"(",
"{",
"PREF_PRELOAD_STREAM",
":",
"False",
"}",
")",
"with",
"patch",
"(",
"\"homeassistant.components.camera.Stream.endpoint_url\"",
"... | [
377,
0
] | [
393,
45
] | python | en | ['es', 'sl', 'en'] | False |
test_preload_stream | (hass, mock_stream) | Test camera preload preference. | Test camera preload preference. | async def test_preload_stream(hass, mock_stream):
"""Test camera preload preference."""
demo_prefs = CameraEntityPreferences({PREF_PRELOAD_STREAM: True})
with patch(
"homeassistant.components.camera.create_stream"
) as mock_create_stream, patch(
"homeassistant.components.camera.prefs.Cam... | [
"async",
"def",
"test_preload_stream",
"(",
"hass",
",",
"mock_stream",
")",
":",
"demo_prefs",
"=",
"CameraEntityPreferences",
"(",
"{",
"PREF_PRELOAD_STREAM",
":",
"True",
"}",
")",
"with",
"patch",
"(",
"\"homeassistant.components.camera.create_stream\"",
")",
"as"... | [
396,
0
] | [
414,
40
] | python | en | ['es', 'sl', 'en'] | False |
test_record_service_invalid_path | (hass, mock_camera) | Test record service with invalid path. | Test record service with invalid path. | async def test_record_service_invalid_path(hass, mock_camera):
"""Test record service with invalid path."""
with patch.object(
hass.config, "is_allowed_path", return_value=False
), pytest.raises(HomeAssistantError):
# Call service
await hass.services.async_call(
camera.DO... | [
"async",
"def",
"test_record_service_invalid_path",
"(",
"hass",
",",
"mock_camera",
")",
":",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"config",
",",
"\"is_allowed_path\"",
",",
"return_value",
"=",
"False",
")",
",",
"pytest",
".",
"raises",
"(",
... | [
417,
0
] | [
431,
9
] | python | en | ['en', 'en', 'en'] | True |
test_record_service | (hass, mock_camera, mock_stream) | Test record service. | Test record service. | async def test_record_service(hass, mock_camera, mock_stream):
"""Test record service."""
with patch(
"homeassistant.components.demo.camera.DemoCamera.stream_source",
return_value="http://example.com",
), patch(
"homeassistant.components.stream.Stream.async_record",
autospec=... | [
"async",
"def",
"test_record_service",
"(",
"hass",
",",
"mock_camera",
",",
"mock_stream",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.demo.camera.DemoCamera.stream_source\"",
",",
"return_value",
"=",
"\"http://example.com\"",
",",
")",
",",
"patch",
"... | [
434,
0
] | [
452,
33
] | python | en | ['en', 'en', 'en'] | True |
test_camera_proxy_stream | (hass, mock_camera, hass_client) | Test record service. | Test record service. | async def test_camera_proxy_stream(hass, mock_camera, hass_client):
"""Test record service."""
client = await hass_client()
response = await client.get("/api/camera_proxy_stream/camera.demo_camera")
assert response.status == HTTP_OK
with patch(
"homeassistant.components.demo.camera.DemoCa... | [
"async",
"def",
"test_camera_proxy_stream",
"(",
"hass",
",",
"mock_camera",
",",
"hass_client",
")",
":",
"client",
"=",
"await",
"hass_client",
"(",
")",
"response",
"=",
"await",
"client",
".",
"get",
"(",
"\"/api/camera_proxy_stream/camera.demo_camera\"",
")",
... | [
455,
0
] | [
468,
50
] | python | en | ['en', 'en', 'en'] | True |
struct_validator | (config) | Sensor schema validator. | Sensor schema validator. | def struct_validator(config):
"""Sensor schema validator."""
data_type = config[CONF_DATA_TYPE]
count = config.get(CONF_COUNT, 1)
name = config[CONF_NAME]
structure = config.get(CONF_STRUCTURE)
swap_type = config.get(CONF_SWAP)
if data_type in (DATA_TYPE_INT, DATA_TYPE_UINT, DATA_TYPE_FLOAT... | [
"def",
"struct_validator",
"(",
"config",
")",
":",
"data_type",
"=",
"config",
"[",
"CONF_DATA_TYPE",
"]",
"count",
"=",
"config",
".",
"get",
"(",
"CONF_COUNT",
",",
"1",
")",
"name",
"=",
"config",
"[",
"CONF_NAME",
"]",
"structure",
"=",
"config",
".... | [
86,
0
] | [
145,
5
] | python | bs | ['de', 'bs', 'it'] | False |
number_validator | (value: Any) | Coerce a value to number without losing precision. | Coerce a value to number without losing precision. | def number_validator(value: Any) -> int | float:
"""Coerce a value to number without losing precision."""
if isinstance(value, int):
return value
if isinstance(value, float):
return value
try:
value = int(value)
return value
except (TypeError, ValueError):
pa... | [
"def",
"number_validator",
"(",
"value",
":",
"Any",
")",
"->",
"int",
"|",
"float",
":",
"if",
"isinstance",
"(",
"value",
",",
"int",
")",
":",
"return",
"value",
"if",
"isinstance",
"(",
"value",
",",
"float",
")",
":",
"return",
"value",
"try",
"... | [
148,
0
] | [
164,
61
] | python | en | ['en', 'en', 'en'] | True |
scan_interval_validator | (config: dict) | Control scan_interval. | Control scan_interval. | def scan_interval_validator(config: dict) -> dict:
"""Control scan_interval."""
for hub in config:
minimum_scan_interval = DEFAULT_SCAN_INTERVAL
for component, conf_key in PLATFORMS:
if conf_key not in hub:
continue
for entry in hub[conf_key]:
... | [
"def",
"scan_interval_validator",
"(",
"config",
":",
"dict",
")",
"->",
"dict",
":",
"for",
"hub",
"in",
"config",
":",
"minimum_scan_interval",
"=",
"DEFAULT_SCAN_INTERVAL",
"for",
"component",
",",
"conf_key",
"in",
"PLATFORMS",
":",
"if",
"conf_key",
"not",
... | [
167,
0
] | [
201,
17
] | python | en | ['en', 'en', 'en'] | False |
duplicate_entity_validator | (config: dict) | Control scan_interval. | Control scan_interval. | def duplicate_entity_validator(config: dict) -> dict:
"""Control scan_interval."""
for hub_index, hub in enumerate(config):
for component, conf_key in PLATFORMS:
if conf_key not in hub:
continue
names: set[str] = set()
errors: list[int] = []
... | [
"def",
"duplicate_entity_validator",
"(",
"config",
":",
"dict",
")",
"->",
"dict",
":",
"for",
"hub_index",
",",
"hub",
"in",
"enumerate",
"(",
"config",
")",
":",
"for",
"component",
",",
"conf_key",
"in",
"PLATFORMS",
":",
"if",
"conf_key",
"not",
"in",... | [
204,
0
] | [
240,
17
] | python | en | ['en', 'en', 'en'] | False |
duplicate_modbus_validator | (config: list) | Control modbus connection for duplicates. | Control modbus connection for duplicates. | def duplicate_modbus_validator(config: list) -> list:
"""Control modbus connection for duplicates."""
hosts: set[str] = set()
names: set[str] = set()
errors = []
for index, hub in enumerate(config):
name = hub.get(CONF_NAME, DEFAULT_HUB)
if hub[CONF_TYPE] == SERIAL:
host ... | [
"def",
"duplicate_modbus_validator",
"(",
"config",
":",
"list",
")",
"->",
"list",
":",
"hosts",
":",
"set",
"[",
"str",
"]",
"=",
"set",
"(",
")",
"names",
":",
"set",
"[",
"str",
"]",
"=",
"set",
"(",
")",
"errors",
"=",
"[",
"]",
"for",
"inde... | [
243,
0
] | [
268,
17
] | python | en | ['nb', 'en', 'en'] | True |
asarray | (a, dtype=None, order=None) | Convert the input to an array.
Parameters
----------
a : array_like
Input data, in any form that can be converted to an array. This
includes lists, lists of tuples, tuples, tuples of tuples, tuples
of lists and ndarrays.
dtype : data-type, optional
By default, the data-... | Convert the input to an array. | def asarray(a, dtype=None, order=None):
"""Convert the input to an array.
Parameters
----------
a : array_like
Input data, in any form that can be converted to an array. This
includes lists, lists of tuples, tuples, tuples of tuples, tuples
of lists and ndarrays.
dtype : da... | [
"def",
"asarray",
"(",
"a",
",",
"dtype",
"=",
"None",
",",
"order",
"=",
"None",
")",
":",
"return",
"array",
"(",
"a",
",",
"dtype",
",",
"copy",
"=",
"False",
",",
"order",
"=",
"order",
")"
] | [
14,
0
] | [
82,
51
] | python | en | ['en', 'lb', 'en'] | True |
asanyarray | (a, dtype=None, order=None) | Convert the input to an ndarray, but pass ndarray subclasses through.
Parameters
----------
a : array_like
Input data, in any form that can be converted to an array. This
includes scalars, lists, lists of tuples, tuples, tuples of tuples,
tuples of lists, and ndarrays.
dtype : ... | Convert the input to an ndarray, but pass ndarray subclasses through. | def asanyarray(a, dtype=None, order=None):
"""Convert the input to an ndarray, but pass ndarray subclasses through.
Parameters
----------
a : array_like
Input data, in any form that can be converted to an array. This
includes scalars, lists, lists of tuples, tuples, tuples of tuples,
... | [
"def",
"asanyarray",
"(",
"a",
",",
"dtype",
"=",
"None",
",",
"order",
"=",
"None",
")",
":",
"return",
"array",
"(",
"a",
",",
"dtype",
",",
"copy",
"=",
"False",
",",
"order",
"=",
"order",
",",
"subok",
"=",
"True",
")"
] | [
86,
0
] | [
135,
63
] | python | en | ['en', 'lb', 'en'] | True |
ascontiguousarray | (a, dtype=None) |
Return a contiguous array (ndim >= 1) in memory (C order).
Parameters
----------
a : array_like
Input array.
dtype : str or dtype object, optional
Data-type of returned array.
Returns
-------
out : ndarray
Contiguous array of same shape and content as `a`, with... |
Return a contiguous array (ndim >= 1) in memory (C order). | def ascontiguousarray(a, dtype=None):
"""
Return a contiguous array (ndim >= 1) in memory (C order).
Parameters
----------
a : array_like
Input array.
dtype : str or dtype object, optional
Data-type of returned array.
Returns
-------
out : ndarray
Contiguous... | [
"def",
"ascontiguousarray",
"(",
"a",
",",
"dtype",
"=",
"None",
")",
":",
"return",
"array",
"(",
"a",
",",
"dtype",
",",
"copy",
"=",
"False",
",",
"order",
"=",
"'C'",
",",
"ndmin",
"=",
"1",
")"
] | [
139,
0
] | [
176,
58
] | python | en | ['en', 'error', 'th'] | False |
asfortranarray | (a, dtype=None) |
Return an array (ndim >= 1) laid out in Fortran order in memory.
Parameters
----------
a : array_like
Input array.
dtype : str or dtype object, optional
By default, the data-type is inferred from the input data.
Returns
-------
out : ndarray
The input `a` in Fo... |
Return an array (ndim >= 1) laid out in Fortran order in memory. | def asfortranarray(a, dtype=None):
"""
Return an array (ndim >= 1) laid out in Fortran order in memory.
Parameters
----------
a : array_like
Input array.
dtype : str or dtype object, optional
By default, the data-type is inferred from the input data.
Returns
-------
... | [
"def",
"asfortranarray",
"(",
"a",
",",
"dtype",
"=",
"None",
")",
":",
"return",
"array",
"(",
"a",
",",
"dtype",
",",
"copy",
"=",
"False",
",",
"order",
"=",
"'F'",
",",
"ndmin",
"=",
"1",
")"
] | [
180,
0
] | [
217,
58
] | python | en | ['en', 'error', 'th'] | False |
require | (a, dtype=None, requirements=None) |
Return an ndarray of the provided type that satisfies requirements.
This function is useful to be sure that an array with the correct flags
is returned for passing to compiled code (perhaps through ctypes).
Parameters
----------
a : array_like
The object to be converted to a type-and-r... |
Return an ndarray of the provided type that satisfies requirements. | def require(a, dtype=None, requirements=None):
"""
Return an ndarray of the provided type that satisfies requirements.
This function is useful to be sure that an array with the correct flags
is returned for passing to compiled code (perhaps through ctypes).
Parameters
----------
a : array_... | [
"def",
"require",
"(",
"a",
",",
"dtype",
"=",
"None",
",",
"requirements",
"=",
"None",
")",
":",
"possible_flags",
"=",
"{",
"'C'",
":",
"'C'",
",",
"'C_CONTIGUOUS'",
":",
"'C'",
",",
"'CONTIGUOUS'",
":",
"'C'",
",",
"'F'",
":",
"'F'",
",",
"'F_CON... | [
221,
0
] | [
321,
14
] | python | en | ['en', 'error', 'th'] | False |
mock_valid_airport | (self, *args, **kwargs) | Return a valid airport. | Return a valid airport. | async def mock_valid_airport(self, *args, **kwargs):
"""Return a valid airport."""
self.name = "Test airport" | [
"async",
"def",
"mock_valid_airport",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"name",
"=",
"\"Test airport\""
] | [
14,
0
] | [
16,
30
] | python | en | ['en', 'en', 'en'] | True |
test_form | (hass) | Test we get the form. | Test we get the form. | async def test_form(hass):
"""Test we get the form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["errors... | [
"async",
"def",
"test_form",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(... | [
19,
0
] | [
45,
48
] | python | en | ['en', 'en', 'en'] | True |
test_duplicate_error | (hass) | Test that we handle a duplicate configuration. | Test that we handle a duplicate configuration. | async def test_duplicate_error(hass):
"""Test that we handle a duplicate configuration."""
conf = {CONF_ID: "test"}
MockConfigEntry(domain=DOMAIN, unique_id="test", data=conf).add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE... | [
"async",
"def",
"test_duplicate_error",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_ID",
":",
"\"test\"",
"}",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"\"test\"",
",",
"data",
"=",
"conf",
")",
".",
"add_to_hass",
"(",
... | [
48,
0
] | [
59,
51
] | python | en | ['en', 'en', 'en'] | True |
test_form_invalid_airport | (hass) | Test we handle invalid airport. | Test we handle invalid airport. | async def test_form_invalid_airport(hass):
"""Test we handle invalid airport."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"faadelays.Airport.update",
side_effect=faadelays.InvalidAirport,
):
... | [
"async",
"def",
"test_form_invalid_airport",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
... | [
62,
0
] | [
80,
60
] | python | en | ['en', 'en', 'en'] | True |
test_form_cannot_connect | (hass) | Test we handle a connection error. | Test we handle a connection error. | async def test_form_cannot_connect(hass):
"""Test we handle a connection error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch("faadelays.Airport.update", side_effect=ClientConnectionError):
result2 = await hass... | [
"async",
"def",
"test_form_cannot_connect",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
"... | [
83,
0
] | [
98,
58
] | 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.