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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
NetatmoThermostat.async_set_hvac_mode | (self, hvac_mode: str) | Set new target hvac mode. | Set new target hvac mode. | async def async_set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new target hvac mode."""
if hvac_mode == HVAC_MODE_OFF:
await self.async_turn_off()
elif hvac_mode == HVAC_MODE_AUTO:
if self.hvac_mode == HVAC_MODE_OFF:
await self.async_turn_on()
... | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
":",
"str",
")",
"->",
"None",
":",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"await",
"self",
".",
"async_turn_off",
"(",
")",
"elif",
"hvac_mode",
"==",
"HVAC_MODE_AUTO",
":",
"if",... | [
374,
4
] | [
383,
58
] | python | da | ['da', 'su', 'en'] | False |
NetatmoThermostat.async_set_preset_mode | (self, preset_mode: str) | Set new preset mode. | Set new preset mode. | async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set new preset mode."""
if self.hvac_mode == HVAC_MODE_OFF:
await self.async_turn_on()
if self.target_temperature == 0:
await self._home_status.async_set_room_thermpoint(
self._id,
... | [
"async",
"def",
"async_set_preset_mode",
"(",
"self",
",",
"preset_mode",
":",
"str",
")",
"->",
"None",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"await",
"self",
".",
"async_turn_on",
"(",
")",
"if",
"self",
".",
"target_temperature"... | [
385,
4
] | [
429,
35
] | python | en | ['en', 'sr', 'en'] | True |
NetatmoThermostat.preset_mode | (self) | Return the current preset mode, e.g., home, away, temp. | Return the current preset mode, e.g., home, away, temp. | def preset_mode(self) -> str | None:
"""Return the current preset mode, e.g., home, away, temp."""
return self._preset | [
"def",
"preset_mode",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"self",
".",
"_preset"
] | [
432,
4
] | [
434,
27
] | python | en | ['en', 'pt', 'en'] | True |
NetatmoThermostat.preset_modes | (self) | Return a list of available preset modes. | Return a list of available preset modes. | def preset_modes(self) -> list[str] | None:
"""Return a list of available preset modes."""
return SUPPORT_PRESET | [
"def",
"preset_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
"|",
"None",
":",
"return",
"SUPPORT_PRESET"
] | [
437,
4
] | [
439,
29
] | python | en | ['en', 'en', 'en'] | True |
NetatmoThermostat.async_set_temperature | (self, **kwargs: Any) | Set new target temperature for 2 hours. | Set new target temperature for 2 hours. | async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperature for 2 hours."""
temp = kwargs.get(ATTR_TEMPERATURE)
if temp is None:
return
await self._home_status.async_set_room_thermpoint(
self._id, STATE_NETATMO_MANUAL, temp
... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"if",
"temp",
"is",
"None",
":",
"return",
"await",
"self",
".",
"_home_... | [
441,
4
] | [
450,
35
] | python | en | ['en', 'en', 'en'] | True |
NetatmoThermostat.async_turn_off | (self) | Turn the entity off. | Turn the entity off. | async def async_turn_off(self) -> None:
"""Turn the entity off."""
if self._model == NA_VALVE:
await self._home_status.async_set_room_thermpoint(
self._id,
STATE_NETATMO_MANUAL,
DEFAULT_MIN_TEMP,
)
elif self.hvac_mode != HVA... | [
"async",
"def",
"async_turn_off",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_model",
"==",
"NA_VALVE",
":",
"await",
"self",
".",
"_home_status",
".",
"async_set_room_thermpoint",
"(",
"self",
".",
"_id",
",",
"STATE_NETATMO_MANUAL",
",",
"DEF... | [
452,
4
] | [
464,
35
] | python | en | ['en', 'en', 'en'] | True |
NetatmoThermostat.async_turn_on | (self) | Turn the entity on. | Turn the entity on. | async def async_turn_on(self) -> None:
"""Turn the entity on."""
await self._home_status.async_set_room_thermpoint(self._id, STATE_NETATMO_HOME)
self.async_write_ha_state() | [
"async",
"def",
"async_turn_on",
"(",
"self",
")",
"->",
"None",
":",
"await",
"self",
".",
"_home_status",
".",
"async_set_room_thermpoint",
"(",
"self",
".",
"_id",
",",
"STATE_NETATMO_HOME",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
466,
4
] | [
469,
35
] | python | en | ['en', 'en', 'en'] | True |
NetatmoThermostat.available | (self) | If the device hasn't been able to connect, mark as unavailable. | If the device hasn't been able to connect, mark as unavailable. | def available(self) -> bool:
"""If the device hasn't been able to connect, mark as unavailable."""
return bool(self._connected) | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"_connected",
")"
] | [
472,
4
] | [
474,
36
] | python | en | ['en', 'en', 'en'] | True |
NetatmoThermostat.async_update_callback | (self) | Update the entity's state. | Update the entity's state. | def async_update_callback(self) -> None:
"""Update the entity's state."""
self._home_status = self.data_handler.data[self._home_status_class]
if self._home_status is None:
if self.available:
self._connected = False
return
self._room_status = self.... | [
"def",
"async_update_callback",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_home_status",
"=",
"self",
".",
"data_handler",
".",
"data",
"[",
"self",
".",
"_home_status_class",
"]",
"if",
"self",
".",
"_home_status",
"is",
"None",
":",
"if",
"self"... | [
477,
4
] | [
530,
39
] | python | en | ['en', 'en', 'en'] | True |
NetatmoThermostat._build_room_status | (self) | Construct room status. | Construct room status. | def _build_room_status(self) -> dict:
"""Construct room status."""
try:
roomstatus = {
"roomname": self._room_data["name"],
"target_temperature": self._room_status["therm_setpoint_temperature"],
"setpoint_mode": self._room_status["therm_setpoin... | [
"def",
"_build_room_status",
"(",
"self",
")",
"->",
"dict",
":",
"try",
":",
"roomstatus",
"=",
"{",
"\"roomname\"",
":",
"self",
".",
"_room_data",
"[",
"\"name\"",
"]",
",",
"\"target_temperature\"",
":",
"self",
".",
"_room_status",
"[",
"\"therm_setpoint_... | [
532,
4
] | [
589,
17
] | python | en | ['sv', 'la', 'en'] | False |
NetatmoThermostat.device_info | (self) | Return the device info for the thermostat. | Return the device info for the thermostat. | def device_info(self) -> DeviceInfo:
"""Return the device info for the thermostat."""
device_info: DeviceInfo = super().device_info
device_info["suggested_area"] = self._room_data["name"]
return device_info | [
"def",
"device_info",
"(",
"self",
")",
"->",
"DeviceInfo",
":",
"device_info",
":",
"DeviceInfo",
"=",
"super",
"(",
")",
".",
"device_info",
"device_info",
"[",
"\"suggested_area\"",
"]",
"=",
"self",
".",
"_room_data",
"[",
"\"name\"",
"]",
"return",
"dev... | [
613,
4
] | [
617,
26
] | python | en | ['en', 'en', 'en'] | True |
mock_weather | () | Mock weather data. | Mock weather data. | def mock_weather():
"""Mock weather data."""
with patch("meteireann.WeatherData") as mock_data:
mock_data = mock_data.return_value
mock_data.fetching_data = AsyncMock(return_value=True)
mock_data.get_current_weather.return_value = {
"condition": "Cloud",
"temperat... | [
"def",
"mock_weather",
"(",
")",
":",
"with",
"patch",
"(",
"\"meteireann.WeatherData\"",
")",
"as",
"mock_data",
":",
"mock_data",
"=",
"mock_data",
".",
"return_value",
"mock_data",
".",
"fetching_data",
"=",
"AsyncMock",
"(",
"return_value",
"=",
"True",
")",... | [
7,
0
] | [
21,
23
] | python | en | ['en', 'xh', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Dark Sky sensor. | Set up the Dark Sky sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Dark Sky sensor."""
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
longitude = config.get(CONF_LONGITUDE, hass.config.longitude)
language = config.get(CONF_LANGUAGE)
interval = config.get(CONF_SCAN_INTERVA... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"latitude",
"=",
"config",
".",
"get",
"(",
"CONF_LATITUDE",
",",
"hass",
".",
"config",
".",
"latitude",
")",
"longitude",
"=",
"config... | [
488,
0
] | [
546,
31
] | python | en | ['en', 'bs', 'en'] | True |
convert_to_camel | (data) |
Convert snake case (foo_bar_bat) to camel case (fooBarBat).
This is not pythonic, but needed for certain situations.
|
Convert snake case (foo_bar_bat) to camel case (fooBarBat). | def convert_to_camel(data):
"""
Convert snake case (foo_bar_bat) to camel case (fooBarBat).
This is not pythonic, but needed for certain situations.
"""
components = data.split("_")
capital_components = "".join(x.title() for x in components[1:])
return f"{components[0]}{capital_components}" | [
"def",
"convert_to_camel",
"(",
"data",
")",
":",
"components",
"=",
"data",
".",
"split",
"(",
"\"_\"",
")",
"capital_components",
"=",
"\"\"",
".",
"join",
"(",
"x",
".",
"title",
"(",
")",
"for",
"x",
"in",
"components",
"[",
"1",
":",
"]",
")",
... | [
783,
0
] | [
791,
49
] | python | en | ['en', 'error', 'th'] | False |
DarkSkySensor.__init__ | (
self, forecast_data, sensor_type, name, forecast_day=None, forecast_hour=None
) | Initialize the sensor. | Initialize the sensor. | def __init__(
self, forecast_data, sensor_type, name, forecast_day=None, forecast_hour=None
):
"""Initialize the sensor."""
self.client_name = name
self._name = SENSOR_TYPES[sensor_type][0]
self.forecast_data = forecast_data
self.type = sensor_type
self.foreca... | [
"def",
"__init__",
"(",
"self",
",",
"forecast_data",
",",
"sensor_type",
",",
"name",
",",
"forecast_day",
"=",
"None",
",",
"forecast_hour",
"=",
"None",
")",
":",
"self",
".",
"client_name",
"=",
"name",
"self",
".",
"_name",
"=",
"SENSOR_TYPES",
"[",
... | [
552,
4
] | [
564,
40
] | python | en | ['en', 'en', 'en'] | True |
DarkSkySensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
if self.forecast_day is not None:
return f"{self.client_name} {self._name} {self.forecast_day}d"
if self.forecast_hour is not None:
return f"{self.client_name} {self._name} {self.forecast_hour}h"
return f"{self.... | [
"def",
"name",
"(",
"self",
")",
":",
"if",
"self",
".",
"forecast_day",
"is",
"not",
"None",
":",
"return",
"f\"{self.client_name} {self._name} {self.forecast_day}d\"",
"if",
"self",
".",
"forecast_hour",
"is",
"not",
"None",
":",
"return",
"f\"{self.client_name} {... | [
567,
4
] | [
573,
49
] | python | en | ['en', 'mi', 'en'] | True |
DarkSkySensor.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"
] | [
576,
4
] | [
578,
26
] | python | en | ['en', 'en', 'en'] | True |
DarkSkySensor.native_unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def native_unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
581,
4
] | [
583,
40
] | python | en | ['en', 'en', 'en'] | True |
DarkSkySensor.unit_system | (self) | Return the unit system of this entity. | Return the unit system of this entity. | def unit_system(self):
"""Return the unit system of this entity."""
return self.forecast_data.unit_system | [
"def",
"unit_system",
"(",
"self",
")",
":",
"return",
"self",
".",
"forecast_data",
".",
"unit_system"
] | [
586,
4
] | [
588,
45
] | python | en | ['en', 'en', 'en'] | True |
DarkSkySensor.entity_picture | (self) | Return the entity picture to use in the frontend, if any. | Return the entity picture to use in the frontend, if any. | def entity_picture(self):
"""Return the entity picture to use in the frontend, if any."""
if self._icon is None or "summary" not in self.type:
return None
if self._icon in CONDITION_PICTURES:
return CONDITION_PICTURES[self._icon][0]
return None | [
"def",
"entity_picture",
"(",
"self",
")",
":",
"if",
"self",
".",
"_icon",
"is",
"None",
"or",
"\"summary\"",
"not",
"in",
"self",
".",
"type",
":",
"return",
"None",
"if",
"self",
".",
"_icon",
"in",
"CONDITION_PICTURES",
":",
"return",
"CONDITION_PICTUR... | [
591,
4
] | [
599,
19
] | python | en | ['en', 'en', 'en'] | True |
DarkSkySensor.update_unit_of_measurement | (self) | Update units based on unit system. | Update units based on unit system. | def update_unit_of_measurement(self):
"""Update units based on unit system."""
unit_index = {"si": 1, "us": 2, "ca": 3, "uk": 4, "uk2": 5}.get(
self.unit_system, 1
)
self._unit_of_measurement = SENSOR_TYPES[self.type][unit_index] | [
"def",
"update_unit_of_measurement",
"(",
"self",
")",
":",
"unit_index",
"=",
"{",
"\"si\"",
":",
"1",
",",
"\"us\"",
":",
"2",
",",
"\"ca\"",
":",
"3",
",",
"\"uk\"",
":",
"4",
",",
"\"uk2\"",
":",
"5",
"}",
".",
"get",
"(",
"self",
".",
"unit_sy... | [
601,
4
] | [
606,
71
] | python | en | ['en', 'en', 'en'] | True |
DarkSkySensor.icon | (self) | Icon to use in the frontend, if any. | Icon to use in the frontend, if any. | def icon(self):
"""Icon to use in the frontend, if any."""
if "summary" in self.type and self._icon in CONDITION_PICTURES:
return CONDITION_PICTURES[self._icon][1]
return SENSOR_TYPES[self.type][6] | [
"def",
"icon",
"(",
"self",
")",
":",
"if",
"\"summary\"",
"in",
"self",
".",
"type",
"and",
"self",
".",
"_icon",
"in",
"CONDITION_PICTURES",
":",
"return",
"CONDITION_PICTURES",
"[",
"self",
".",
"_icon",
"]",
"[",
"1",
"]",
"return",
"SENSOR_TYPES",
"... | [
609,
4
] | [
614,
41
] | python | en | ['en', 'en', 'en'] | True |
DarkSkySensor.device_class | (self) | Device class of the entity. | Device class of the entity. | def device_class(self):
"""Device class of the entity."""
if SENSOR_TYPES[self.type][1] == TEMP_CELSIUS:
return DEVICE_CLASS_TEMPERATURE
return None | [
"def",
"device_class",
"(",
"self",
")",
":",
"if",
"SENSOR_TYPES",
"[",
"self",
".",
"type",
"]",
"[",
"1",
"]",
"==",
"TEMP_CELSIUS",
":",
"return",
"DEVICE_CLASS_TEMPERATURE",
"return",
"None"
] | [
617,
4
] | [
622,
19
] | python | en | ['en', 'en', 'en'] | True |
DarkSkySensor.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",
"}"
] | [
625,
4
] | [
627,
46
] | python | en | ['en', 'en', 'en'] | True |
DarkSkySensor.update | (self) | Get the latest data from Dark Sky and updates the states. | Get the latest data from Dark Sky and updates the states. | def update(self):
"""Get the latest data from Dark Sky and updates the states."""
# Call the API for new forecast data. Each sensor will re-trigger this
# same exact call, but that's fine. We cache results for a short period
# of time to prevent hitting API limits. Note that Dark Sky wil... | [
"def",
"update",
"(",
"self",
")",
":",
"# Call the API for new forecast data. Each sensor will re-trigger this",
"# same exact call, but that's fine. We cache results for a short period",
"# of time to prevent hitting API limits. Note that Dark Sky will",
"# charge users for too many calls in 1 d... | [
629,
4
] | [
670,
51
] | python | en | ['en', 'en', 'en'] | True |
DarkSkySensor.get_state | (self, data) |
Return a new state based on the type.
If the sensor type is unknown, the current state is returned.
|
Return a new state based on the type. | def get_state(self, data):
"""
Return a new state based on the type.
If the sensor type is unknown, the current state is returned.
"""
lookup_type = convert_to_camel(self.type)
state = getattr(data, lookup_type, None)
if state is None:
return state
... | [
"def",
"get_state",
"(",
"self",
",",
"data",
")",
":",
"lookup_type",
"=",
"convert_to_camel",
"(",
"self",
".",
"type",
")",
"state",
"=",
"getattr",
"(",
"data",
",",
"lookup_type",
",",
"None",
")",
"if",
"state",
"is",
"None",
":",
"return",
"stat... | [
672,
4
] | [
710,
20
] | python | en | ['en', 'error', 'th'] | False |
DarkSkyAlertSensor.__init__ | (self, forecast_data, sensor_type, name) | Initialize the sensor. | Initialize the sensor. | def __init__(self, forecast_data, sensor_type, name):
"""Initialize the sensor."""
self.client_name = name
self._name = SENSOR_TYPES[sensor_type][0]
self.forecast_data = forecast_data
self.type = sensor_type
self._state = None
self._icon = None
self._alert... | [
"def",
"__init__",
"(",
"self",
",",
"forecast_data",
",",
"sensor_type",
",",
"name",
")",
":",
"self",
".",
"client_name",
"=",
"name",
"self",
".",
"_name",
"=",
"SENSOR_TYPES",
"[",
"sensor_type",
"]",
"[",
"0",
"]",
"self",
".",
"forecast_data",
"="... | [
716,
4
] | [
724,
27
] | python | en | ['en', 'en', 'en'] | True |
DarkSkyAlertSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return f"{self.client_name} {self._name}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self.client_name} {self._name}\""
] | [
727,
4
] | [
729,
49
] | python | en | ['en', 'mi', 'en'] | True |
DarkSkyAlertSensor.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"
] | [
732,
4
] | [
734,
26
] | python | en | ['en', 'en', 'en'] | True |
DarkSkyAlertSensor.icon | (self) | Icon to use in the frontend, if any. | Icon to use in the frontend, if any. | def icon(self):
"""Icon to use in the frontend, if any."""
if self._state is not None and self._state > 0:
return "mdi:alert-circle"
return "mdi:alert-circle-outline" | [
"def",
"icon",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
"is",
"not",
"None",
"and",
"self",
".",
"_state",
">",
"0",
":",
"return",
"\"mdi:alert-circle\"",
"return",
"\"mdi:alert-circle-outline\""
] | [
737,
4
] | [
741,
41
] | python | en | ['en', 'en', 'en'] | True |
DarkSkyAlertSensor.extra_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def extra_state_attributes(self):
"""Return the state attributes."""
return self._alerts | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_alerts"
] | [
744,
4
] | [
746,
27
] | python | en | ['en', 'en', 'en'] | True |
DarkSkyAlertSensor.update | (self) | Get the latest data from Dark Sky and updates the states. | Get the latest data from Dark Sky and updates the states. | def update(self):
"""Get the latest data from Dark Sky and updates the states."""
# Call the API for new forecast data. Each sensor will re-trigger this
# same exact call, but that's fine. We cache results for a short period
# of time to prevent hitting API limits. Note that Dark Sky wil... | [
"def",
"update",
"(",
"self",
")",
":",
"# Call the API for new forecast data. Each sensor will re-trigger this",
"# same exact call, but that's fine. We cache results for a short period",
"# of time to prevent hitting API limits. Note that Dark Sky will",
"# charge users for too many calls in 1 d... | [
748,
4
] | [
757,
44
] | python | en | ['en', 'en', 'en'] | True |
DarkSkyAlertSensor.get_state | (self, data) |
Return a new state based on the type.
If the sensor type is unknown, the current state is returned.
|
Return a new state based on the type. | def get_state(self, data):
"""
Return a new state based on the type.
If the sensor type is unknown, the current state is returned.
"""
alerts = {}
if data is None:
self._alerts = alerts
return data
multiple_alerts = len(data) > 1
... | [
"def",
"get_state",
"(",
"self",
",",
"data",
")",
":",
"alerts",
"=",
"{",
"}",
"if",
"data",
"is",
"None",
":",
"self",
".",
"_alerts",
"=",
"alerts",
"return",
"data",
"multiple_alerts",
"=",
"len",
"(",
"data",
")",
">",
"1",
"for",
"i",
",",
... | [
759,
4
] | [
780,
24
] | python | en | ['en', 'error', 'th'] | False |
DarkSkyData.__init__ | (self, api_key, latitude, longitude, units, language, interval) | Initialize the data object. | Initialize the data object. | def __init__(self, api_key, latitude, longitude, units, language, interval):
"""Initialize the data object."""
self._api_key = api_key
self.latitude = latitude
self.longitude = longitude
self.units = units
self.language = language
self._connect_error = False
... | [
"def",
"__init__",
"(",
"self",
",",
"api_key",
",",
"latitude",
",",
"longitude",
",",
"units",
",",
"language",
",",
"interval",
")",
":",
"self",
".",
"_api_key",
"=",
"api_key",
"self",
".",
"latitude",
"=",
"latitude",
"self",
".",
"longitude",
"=",... | [
797,
4
] | [
820,
68
] | python | en | ['en', 'en', 'en'] | True |
DarkSkyData._update | (self) | Get the latest data from Dark Sky. | Get the latest data from Dark Sky. | def _update(self):
"""Get the latest data from Dark Sky."""
try:
self.data = forecastio.load_forecast(
self._api_key,
self.latitude,
self.longitude,
units=self.units,
lang=self.language,
)
... | [
"def",
"_update",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"data",
"=",
"forecastio",
".",
"load_forecast",
"(",
"self",
".",
"_api_key",
",",
"self",
".",
"latitude",
",",
"self",
".",
"longitude",
",",
"units",
"=",
"self",
".",
"units",
","... | [
822,
4
] | [
840,
73
] | python | en | ['en', 'en', 'en'] | True |
DarkSkyData._update_currently | (self) | Update currently data. | Update currently data. | def _update_currently(self):
"""Update currently data."""
self.data_currently = self.data and self.data.currently() | [
"def",
"_update_currently",
"(",
"self",
")",
":",
"self",
".",
"data_currently",
"=",
"self",
".",
"data",
"and",
"self",
".",
"data",
".",
"currently",
"(",
")"
] | [
842,
4
] | [
844,
65
] | python | en | ['en', 'en', 'en'] | True |
DarkSkyData._update_minutely | (self) | Update minutely data. | Update minutely data. | def _update_minutely(self):
"""Update minutely data."""
self.data_minutely = self.data and self.data.minutely() | [
"def",
"_update_minutely",
"(",
"self",
")",
":",
"self",
".",
"data_minutely",
"=",
"self",
".",
"data",
"and",
"self",
".",
"data",
".",
"minutely",
"(",
")"
] | [
846,
4
] | [
848,
63
] | python | en | ['en', 'en', 'en'] | True |
DarkSkyData._update_hourly | (self) | Update hourly data. | Update hourly data. | def _update_hourly(self):
"""Update hourly data."""
self.data_hourly = self.data and self.data.hourly() | [
"def",
"_update_hourly",
"(",
"self",
")",
":",
"self",
".",
"data_hourly",
"=",
"self",
".",
"data",
"and",
"self",
".",
"data",
".",
"hourly",
"(",
")"
] | [
850,
4
] | [
852,
59
] | python | en | ['en', 'sn', 'en'] | True |
DarkSkyData._update_daily | (self) | Update daily data. | Update daily data. | def _update_daily(self):
"""Update daily data."""
self.data_daily = self.data and self.data.daily() | [
"def",
"_update_daily",
"(",
"self",
")",
":",
"self",
".",
"data_daily",
"=",
"self",
".",
"data",
"and",
"self",
".",
"data",
".",
"daily",
"(",
")"
] | [
854,
4
] | [
856,
57
] | python | en | ['en', 'sn', 'en'] | True |
DarkSkyData._update_alerts | (self) | Update alerts data. | Update alerts data. | def _update_alerts(self):
"""Update alerts data."""
self.data_alerts = self.data and self.data.alerts() | [
"def",
"_update_alerts",
"(",
"self",
")",
":",
"self",
".",
"data_alerts",
"=",
"self",
".",
"data",
"and",
"self",
".",
"data",
".",
"alerts",
"(",
")"
] | [
858,
4
] | [
860,
59
] | python | co | ['fr', 'co', 'en'] | False |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Satel Integra switch devices. | Set up the Satel Integra switch devices. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Satel Integra switch devices."""
if not discovery_info:
return
configured_zones = discovery_info[CONF_SWITCHABLE_OUTPUTS]
controller = hass.data[DATA_SATEL]
devices = []
for zone_num, ... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"not",
"discovery_info",
":",
"return",
"configured_zones",
"=",
"discovery_info",
"[",
"CONF_SWITCHABLE_OUTPUTS",
"]",... | [
20,
0
] | [
38,
31
] | python | en | ['en', 'en', 'en'] | True |
SatelIntegraSwitch.__init__ | (self, controller, device_number, device_name, code) | Initialize the binary_sensor. | Initialize the binary_sensor. | def __init__(self, controller, device_number, device_name, code):
"""Initialize the binary_sensor."""
self._device_number = device_number
self._name = device_name
self._state = False
self._code = code
self._satel = controller | [
"def",
"__init__",
"(",
"self",
",",
"controller",
",",
"device_number",
",",
"device_name",
",",
"code",
")",
":",
"self",
".",
"_device_number",
"=",
"device_number",
"self",
".",
"_name",
"=",
"device_name",
"self",
".",
"_state",
"=",
"False",
"self",
... | [
44,
4
] | [
50,
32
] | python | en | ['en', 'haw', 'en'] | True |
SatelIntegraSwitch.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
async_dispatcher_connect(
self.hass, SIGNAL_OUTPUTS_UPDATED, self._devices_updated
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"SIGNAL_OUTPUTS_UPDATED",
",",
"self",
".",
"_devices_updated",
")"
] | [
52,
4
] | [
56,
9
] | python | en | ['en', 'no', 'en'] | False |
SatelIntegraSwitch._devices_updated | (self, zones) | Update switch state, if needed. | Update switch state, if needed. | def _devices_updated(self, zones):
"""Update switch state, if needed."""
_LOGGER.debug("Update switch name: %s zones: %s", self._name, zones)
if self._device_number in zones:
new_state = self._read_state()
_LOGGER.debug("New state: %s", new_state)
if new_state... | [
"def",
"_devices_updated",
"(",
"self",
",",
"zones",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Update switch name: %s zones: %s\"",
",",
"self",
".",
"_name",
",",
"zones",
")",
"if",
"self",
".",
"_device_number",
"in",
"zones",
":",
"new_state",
"=",
"se... | [
59,
4
] | [
67,
43
] | python | en | ['en', 'en', 'en'] | True |
SatelIntegraSwitch.async_turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | async def async_turn_on(self, **kwargs):
"""Turn the device on."""
_LOGGER.debug("Switch: %s status: %s, turning on", self._name, self._state)
await self._satel.set_output(self._code, self._device_number, True)
self.async_write_ha_state() | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Switch: %s status: %s, turning on\"",
",",
"self",
".",
"_name",
",",
"self",
".",
"_state",
")",
"await",
"self",
".",
"_satel",
".",
"set_ou... | [
69,
4
] | [
73,
35
] | python | en | ['en', 'en', 'en'] | True |
SatelIntegraSwitch.async_turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | async def async_turn_off(self, **kwargs):
"""Turn the device off."""
_LOGGER.debug(
"Switch name: %s status: %s, turning off", self._name, self._state
)
await self._satel.set_output(self._code, self._device_number, False)
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Switch name: %s status: %s, turning off\"",
",",
"self",
".",
"_name",
",",
"self",
".",
"_state",
")",
"await",
"self",
".",
"_satel",
".",
... | [
75,
4
] | [
81,
35
] | python | en | ['en', 'en', 'en'] | True |
SatelIntegraSwitch.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
self._state = self._read_state()
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"self",
".",
"_read_state",
"(",
")",
"return",
"self",
".",
"_state"
] | [
84,
4
] | [
87,
26
] | python | en | ['en', 'fy', 'en'] | True |
SatelIntegraSwitch._read_state | (self) | Read state of the device. | Read state of the device. | def _read_state(self):
"""Read state of the device."""
return self._device_number in self._satel.violated_outputs | [
"def",
"_read_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_number",
"in",
"self",
".",
"_satel",
".",
"violated_outputs"
] | [
89,
4
] | [
91,
66
] | python | en | ['en', 'en', 'en'] | True |
SatelIntegraSwitch.name | (self) | Return the name of the switch. | Return the name of the switch. | def name(self):
"""Return the name of the switch."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
94,
4
] | [
96,
25
] | python | en | ['en', 'en', 'en'] | True |
SatelIntegraSwitch.should_poll | (self) | Don't poll. | Don't poll. | def should_poll(self):
"""Don't poll."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
99,
4
] | [
101,
20
] | python | en | ['en', 'en', 'en'] | False |
fetch_site | (connection: datapoint.Manager, latitude, longitude) | Fetch site information from Datapoint API. | Fetch site information from Datapoint API. | def fetch_site(connection: datapoint.Manager, latitude, longitude):
"""Fetch site information from Datapoint API."""
try:
return connection.get_nearest_forecast_site(
latitude=latitude, longitude=longitude
)
except datapoint.exceptions.APIException as err:
_LOGGER.error("... | [
"def",
"fetch_site",
"(",
"connection",
":",
"datapoint",
".",
"Manager",
",",
"latitude",
",",
"longitude",
")",
":",
"try",
":",
"return",
"connection",
".",
"get_nearest_forecast_site",
"(",
"latitude",
"=",
"latitude",
",",
"longitude",
"=",
"longitude",
"... | [
14,
0
] | [
22,
19
] | python | en | ['en', 'en', 'en'] | True |
fetch_data | (connection: datapoint.Manager, site, mode) | Fetch weather and forecast from Datapoint API. | Fetch weather and forecast from Datapoint API. | def fetch_data(connection: datapoint.Manager, site, mode) -> MetOfficeData:
"""Fetch weather and forecast from Datapoint API."""
try:
forecast = connection.get_forecast_for_site(site.id, mode)
except (ValueError, datapoint.exceptions.APIException) as err:
_LOGGER.error("Check Met Office conn... | [
"def",
"fetch_data",
"(",
"connection",
":",
"datapoint",
".",
"Manager",
",",
"site",
",",
"mode",
")",
"->",
"MetOfficeData",
":",
"try",
":",
"forecast",
"=",
"connection",
".",
"get_forecast_for_site",
"(",
"site",
".",
"id",
",",
"mode",
")",
"except"... | [
25,
0
] | [
43,
9
] | python | en | ['en', 'en', 'en'] | True |
TestIntegerEnumWithDefaultValue.testIntegerEnumWithDefaultValue | (self) | Test IntegerEnumWithDefaultValue | Test IntegerEnumWithDefaultValue | def testIntegerEnumWithDefaultValue(self):
"""Test IntegerEnumWithDefaultValue"""
# FIXME: construct object with mandatory attributes with example values
# model = IntegerEnumWithDefaultValue() # noqa: E501
pass | [
"def",
"testIntegerEnumWithDefaultValue",
"(",
"self",
")",
":",
"# FIXME: construct object with mandatory attributes with example values",
"# model = IntegerEnumWithDefaultValue() # noqa: E501",
"pass"
] | [
28,
4
] | [
32,
12
] | python | en | ['en', 'et', 'en'] | False |
DescriptionManager.__init__ | (self, hass: HomeAssistant) | Init the manager. | Init the manager. | def __init__(self, hass: HomeAssistant) -> None:
"""Init the manager."""
self.hass = hass
self._description_cache: dict[str, None | dict[str, str]] = {} | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"_description_cache",
":",
"dict",
"[",
"str",
",",
"None",
"|",
"dict",
"[",
"str",
",",
"str",
"]",
"]",
"="... | [
19,
4
] | [
22,
70
] | python | en | ['en', 'en', 'en'] | True |
DescriptionManager.fetch_description | (
self, xml_location: str | None
) | Fetch the location or get it from the cache. | Fetch the location or get it from the cache. | async def fetch_description(
self, xml_location: str | None
) -> None | dict[str, str]:
"""Fetch the location or get it from the cache."""
if xml_location is None:
return None
if xml_location not in self._description_cache:
try:
self._descripti... | [
"async",
"def",
"fetch_description",
"(",
"self",
",",
"xml_location",
":",
"str",
"|",
"None",
")",
"->",
"None",
"|",
"dict",
"[",
"str",
",",
"str",
"]",
":",
"if",
"xml_location",
"is",
"None",
":",
"return",
"None",
"if",
"xml_location",
"not",
"i... | [
24,
4
] | [
40,
52
] | python | en | ['en', 'en', 'en'] | True |
DescriptionManager.async_cached_description | (self, xml_location: str) | Fetch the description from the cache. | Fetch the description from the cache. | def async_cached_description(self, xml_location: str) -> None | dict[str, str]:
"""Fetch the description from the cache."""
return self._description_cache.get(xml_location) | [
"def",
"async_cached_description",
"(",
"self",
",",
"xml_location",
":",
"str",
")",
"->",
"None",
"|",
"dict",
"[",
"str",
",",
"str",
"]",
":",
"return",
"self",
".",
"_description_cache",
".",
"get",
"(",
"xml_location",
")"
] | [
43,
4
] | [
45,
56
] | python | en | ['en', 'en', 'en'] | True |
DescriptionManager._fetch_description | (self, xml_location: str) | Fetch an XML description. | Fetch an XML description. | async def _fetch_description(self, xml_location: str) -> None | dict[str, str]:
"""Fetch an XML description."""
session = self.hass.helpers.aiohttp_client.async_get_clientsession()
try:
for _ in range(2):
resp = await session.get(xml_location, timeout=5)
... | [
"async",
"def",
"_fetch_description",
"(",
"self",
",",
"xml_location",
":",
"str",
")",
"->",
"None",
"|",
"dict",
"[",
"str",
",",
"str",
"]",
":",
"session",
"=",
"self",
".",
"hass",
".",
"helpers",
".",
"aiohttp_client",
".",
"async_get_clientsession"... | [
47,
4
] | [
68,
39
] | python | en | ['en', 'fr', 'en'] | True |
pywemo_model | () | Pywemo Dimmer models use the light platform (WemoDimmer class). | Pywemo Dimmer models use the light platform (WemoDimmer class). | def pywemo_model():
"""Pywemo Dimmer models use the light platform (WemoDimmer class)."""
return "Dimmer" | [
"def",
"pywemo_model",
"(",
")",
":",
"return",
"\"Dimmer\""
] | [
27,
0
] | [
29,
19
] | python | en | ['en', 'no', 'en'] | True |
test_async_register_device_longpress_fails | (hass, pywemo_device) | Device is still registered if ensure_long_press_virtual_device fails. | Device is still registered if ensure_long_press_virtual_device fails. | async def test_async_register_device_longpress_fails(hass, pywemo_device):
"""Device is still registered if ensure_long_press_virtual_device fails."""
with patch.object(pywemo_device, "ensure_long_press_virtual_device") as elp:
elp.side_effect = PyWeMoException
assert await async_setup_component... | [
"async",
"def",
"test_async_register_device_longpress_fails",
"(",
"hass",
",",
"pywemo_device",
")",
":",
"with",
"patch",
".",
"object",
"(",
"pywemo_device",
",",
"\"ensure_long_press_virtual_device\"",
")",
"as",
"elp",
":",
"elp",
".",
"side_effect",
"=",
"PyWe... | [
32,
0
] | [
51,
46
] | python | en | ['en', 'en', 'en'] | True |
test_long_press_event | (hass, pywemo_registry, wemo_entity) | Device fires a long press event. | Device fires a long press event. | async def test_long_press_event(hass, pywemo_registry, wemo_entity):
"""Device fires a long press event."""
device = wemo_device.async_get_coordinator(hass, wemo_entity.device_id)
got_event = asyncio.Event()
event_data = {}
@callback
def async_event_received(event):
nonlocal event_data
... | [
"async",
"def",
"test_long_press_event",
"(",
"hass",
",",
"pywemo_registry",
",",
"wemo_entity",
")",
":",
"device",
"=",
"wemo_device",
".",
"async_get_coordinator",
"(",
"hass",
",",
"wemo_entity",
".",
"device_id",
")",
"got_event",
"=",
"asyncio",
".",
"Eve... | [
54,
0
] | [
84,
5
] | python | en | ['en', 'en', 'en'] | True |
test_subscription_callback | (hass, pywemo_registry, wemo_entity) | Device processes a registry subscription callback. | Device processes a registry subscription callback. | async def test_subscription_callback(hass, pywemo_registry, wemo_entity):
"""Device processes a registry subscription callback."""
device = wemo_device.async_get_coordinator(hass, wemo_entity.device_id)
device.last_update_success = False
got_callback = asyncio.Event()
@callback
def async_recei... | [
"async",
"def",
"test_subscription_callback",
"(",
"hass",
",",
"pywemo_registry",
",",
"wemo_entity",
")",
":",
"device",
"=",
"wemo_device",
".",
"async_get_coordinator",
"(",
"hass",
",",
"wemo_entity",
".",
"device_id",
")",
"device",
".",
"last_update_success",... | [
87,
0
] | [
106,
37
] | python | en | ['en', 'en', 'en'] | True |
test_subscription_update_action_exception | (hass, pywemo_device, wemo_entity) | Device handles ActionException on get_state properly. | Device handles ActionException on get_state properly. | async def test_subscription_update_action_exception(hass, pywemo_device, wemo_entity):
"""Device handles ActionException on get_state properly."""
device = wemo_device.async_get_coordinator(hass, wemo_entity.device_id)
device.last_update_success = True
pywemo_device.subscription_update.return_value = F... | [
"async",
"def",
"test_subscription_update_action_exception",
"(",
"hass",
",",
"pywemo_device",
",",
"wemo_entity",
")",
":",
"device",
"=",
"wemo_device",
".",
"async_get_coordinator",
"(",
"hass",
",",
"wemo_entity",
".",
"device_id",
")",
"device",
".",
"last_upd... | [
109,
0
] | [
124,
58
] | python | en | ['en', 'en', 'en'] | True |
test_subscription_update_exception | (hass, pywemo_device, wemo_entity) | Device handles Exception on get_state properly. | Device handles Exception on get_state properly. | async def test_subscription_update_exception(hass, pywemo_device, wemo_entity):
"""Device handles Exception on get_state properly."""
device = wemo_device.async_get_coordinator(hass, wemo_entity.device_id)
device.last_update_success = True
pywemo_device.subscription_update.return_value = False
pywe... | [
"async",
"def",
"test_subscription_update_exception",
"(",
"hass",
",",
"pywemo_device",
",",
"wemo_entity",
")",
":",
"device",
"=",
"wemo_device",
".",
"async_get_coordinator",
"(",
"hass",
",",
"wemo_entity",
".",
"device_id",
")",
"device",
".",
"last_update_suc... | [
127,
0
] | [
142,
55
] | python | en | ['en', 'en', 'en'] | True |
test_async_update_data_subscribed | (
hass, pywemo_registry, pywemo_device, wemo_entity
) | No update happens when the device is subscribed. | No update happens when the device is subscribed. | async def test_async_update_data_subscribed(
hass, pywemo_registry, pywemo_device, wemo_entity
):
"""No update happens when the device is subscribed."""
device = wemo_device.async_get_coordinator(hass, wemo_entity.device_id)
pywemo_registry.is_subscribed.return_value = True
pywemo_device.get_state.r... | [
"async",
"def",
"test_async_update_data_subscribed",
"(",
"hass",
",",
"pywemo_registry",
",",
"pywemo_device",
",",
"wemo_entity",
")",
":",
"device",
"=",
"wemo_device",
".",
"async_get_coordinator",
"(",
"hass",
",",
"wemo_entity",
".",
"device_id",
")",
"pywemo_... | [
145,
0
] | [
153,
47
] | python | en | ['en', 'en', 'en'] | True |
TestInsight.pywemo_model | (self) | Pywemo Dimmer models use the light platform (WemoDimmer class). | Pywemo Dimmer models use the light platform (WemoDimmer class). | def pywemo_model(self):
"""Pywemo Dimmer models use the light platform (WemoDimmer class)."""
return "Insight" | [
"def",
"pywemo_model",
"(",
"self",
")",
":",
"return",
"\"Insight\""
] | [
160,
4
] | [
162,
24
] | python | en | ['en', 'no', 'en'] | True |
TestInsight.pywemo_device_fixture | (self, pywemo_device) | Fixture for WeMoDevice instances. | Fixture for WeMoDevice instances. | def pywemo_device_fixture(self, pywemo_device):
"""Fixture for WeMoDevice instances."""
pywemo_device.insight_params = {
"currentpower": 1.0,
"todaymw": 200000000.0,
"state": 0,
"onfor": 0,
"ontoday": 0,
"ontotal": 0,
"p... | [
"def",
"pywemo_device_fixture",
"(",
"self",
",",
"pywemo_device",
")",
":",
"pywemo_device",
".",
"insight_params",
"=",
"{",
"\"currentpower\"",
":",
"1.0",
",",
"\"todaymw\"",
":",
"200000000.0",
",",
"\"state\"",
":",
"0",
",",
"\"onfor\"",
":",
"0",
",",
... | [
165,
4
] | [
176,
27
] | python | en | ['en', 'en', 'en'] | True |
TestInsight.test_should_poll | (
self,
hass,
subscribed,
state,
expected_calls,
wemo_entity,
pywemo_device,
pywemo_registry,
) | Validate the should_poll returns the correct value. | Validate the should_poll returns the correct value. | async def test_should_poll(
self,
hass,
subscribed,
state,
expected_calls,
wemo_entity,
pywemo_device,
pywemo_registry,
):
"""Validate the should_poll returns the correct value."""
pywemo_registry.is_subscribed.return_value = subscribed... | [
"async",
"def",
"test_should_poll",
"(",
"self",
",",
"hass",
",",
"subscribed",
",",
"state",
",",
"expected_calls",
",",
"wemo_entity",
",",
"pywemo_device",
",",
"pywemo_registry",
",",
")",
":",
"pywemo_registry",
".",
"is_subscribed",
".",
"return_value",
"... | [
187,
4
] | [
203,
64
] | python | en | ['en', 'en', 'en'] | True |
test_default_state | (hass) | Test light group default state. | Test light group default state. | async def test_default_state(hass):
"""Test light group default state."""
hass.states.async_set("light.kitchen", "on")
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: {
"platform": DOMAIN,
"entities": ["light.kitchen", "lig... | [
"async",
"def",
"test_default_state",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.kitchen\"",
",",
"\"on\"",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"{",
"\"platf... | [
52,
0
] | [
86,
49
] | python | da | ['nl', 'da', 'en'] | False |
test_state_reporting | (hass) | Test the state reporting. | Test the state reporting. | async def test_state_reporting(hass):
"""Test the state reporting."""
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: {
"platform": DOMAIN,
"entities": ["light.test1", "light.test2"],
}
},
)
await ha... | [
"async",
"def",
"test_state_reporting",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"{",
"\"platform\"",
":",
"DOMAIN",
",",
"\"entities\"",
":",
"[",
"\"light.test1\"",
",",
"\"light.... | [
89,
0
] | [
123,
74
] | python | en | ['en', 'en', 'en'] | True |
test_brightness | (hass, enable_custom_integrations) | Test brightness reporting. | Test brightness reporting. | async def test_brightness(hass, enable_custom_integrations):
"""Test brightness reporting."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE_ON))
platform.ENTITIES.append(platform.MockLight("test2", STATE_OFF))
... | [
"async",
"def",
"test_brightness",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
".",
"EN... | [
126,
0
] | [
192,
73
] | python | en | ['en', 'sn', 'en'] | True |
test_color_hs | (hass, enable_custom_integrations) | Test hs color reporting. | Test hs color reporting. | async def test_color_hs(hass, enable_custom_integrations):
"""Test hs color reporting."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE_ON))
platform.ENTITIES.append(platform.MockLight("test2", STATE_OFF))
... | [
"async",
"def",
"test_color_hs",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
".",
"ENTI... | [
195,
0
] | [
260,
57
] | python | en | ['ro', 'en', 'en'] | True |
test_color_rgbw | (hass, enable_custom_integrations) | Test rgbw color reporting. | Test rgbw color reporting. | async def test_color_rgbw(hass, enable_custom_integrations):
"""Test rgbw color reporting."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE_ON))
platform.ENTITIES.append(platform.MockLight("test2", STATE_OFF))
... | [
"async",
"def",
"test_color_rgbw",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
".",
"EN... | [
263,
0
] | [
331,
57
] | python | en | ['en', 'en', 'en'] | True |
test_color_rgbww | (hass, enable_custom_integrations) | Test rgbww color reporting. | Test rgbww color reporting. | async def test_color_rgbww(hass, enable_custom_integrations):
"""Test rgbww color reporting."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE_ON))
platform.ENTITIES.append(platform.MockLight("test2", STATE_OFF)... | [
"async",
"def",
"test_color_rgbww",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
".",
"E... | [
334,
0
] | [
402,
57
] | python | en | ['en', 'en', 'en'] | True |
test_white_value | (hass) | Test white value reporting. | Test white value reporting. | async def test_white_value(hass):
"""Test white value reporting."""
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: {
"platform": DOMAIN,
"entities": ["light.test1", "light.test2"],
}
},
)
await hass... | [
"async",
"def",
"test_white_value",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"{",
"\"platform\"",
":",
"DOMAIN",
",",
"\"entities\"",
":",
"[",
"\"light.test1\"",
",",
"\"light.test... | [
405,
0
] | [
443,
52
] | python | en | ['en', 'en', 'en'] | True |
test_white | (hass, enable_custom_integrations) | Test white reporting. | Test white reporting. | async def test_white(hass, enable_custom_integrations):
"""Test white reporting."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE_ON))
platform.ENTITIES.append(platform.MockLight("test2", STATE_ON))
entity... | [
"async",
"def",
"test_white",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
".",
"ENTITIE... | [
446,
0
] | [
499,
74
] | python | en | ['en', 'en', 'en'] | True |
test_color_temp | (hass, enable_custom_integrations) | Test color temp reporting. | Test color temp reporting. | async def test_color_temp(hass, enable_custom_integrations):
"""Test color temp reporting."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE_ON))
platform.ENTITIES.append(platform.MockLight("test2", STATE_OFF))
... | [
"async",
"def",
"test_color_temp",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
".",
"EN... | [
502,
0
] | [
566,
73
] | python | en | ['en', 'en', 'en'] | True |
test_emulated_color_temp_group | (hass, enable_custom_integrations) | Test emulated color temperature in a group. | Test emulated color temperature in a group. | async def test_emulated_color_temp_group(hass, enable_custom_integrations):
"""Test emulated color temperature in a group."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE_ON))
platform.ENTITIES.append(platform... | [
"async",
"def",
"test_emulated_color_temp_group",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform... | [
569,
0
] | [
629,
62
] | python | en | ['en', 'en', 'en'] | True |
test_min_max_mireds | (hass, enable_custom_integrations) | Test min/max mireds reporting.
min/max mireds is reported both when light is on and off
| Test min/max mireds reporting. | async def test_min_max_mireds(hass, enable_custom_integrations):
"""Test min/max mireds reporting.
min/max mireds is reported both when light is on and off
"""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE... | [
"async",
"def",
"test_min_max_mireds",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
".",
... | [
632,
0
] | [
697,
58
] | python | en | ['mt', 'en', 'it'] | False |
test_effect_list | (hass) | Test effect_list reporting. | Test effect_list reporting. | async def test_effect_list(hass):
"""Test effect_list reporting."""
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: {
"platform": DOMAIN,
"entities": ["light.test1", "light.test2"],
}
},
)
await hass... | [
"async",
"def",
"test_effect_list",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"{",
"\"platform\"",
":",
"DOMAIN",
",",
"\"entities\"",
":",
"[",
"\"light.test1\"",
",",
"\"light.test... | [
700,
0
] | [
756,
5
] | python | en | ['de', 'en', 'en'] | True |
test_effect | (hass) | Test effect reporting. | Test effect reporting. | async def test_effect(hass):
"""Test effect reporting."""
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: {
"platform": DOMAIN,
"entities": ["light.test1", "light.test2", "light.test3"],
}
},
)
await... | [
"async",
"def",
"test_effect",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"{",
"\"platform\"",
":",
"DOMAIN",
",",
"\"entities\"",
":",
"[",
"\"light.test1\"",
",",
"\"light.test2\"",... | [
759,
0
] | [
804,
52
] | python | en | ['de', 'en', 'en'] | True |
test_supported_color_modes | (hass, enable_custom_integrations) | Test supported_color_modes reporting. | Test supported_color_modes reporting. | async def test_supported_color_modes(hass, enable_custom_integrations):
"""Test supported_color_modes reporting."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE_ON))
platform.ENTITIES.append(platform.MockLight... | [
"async",
"def",
"test_supported_color_modes",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
... | [
807,
0
] | [
849,
5
] | python | en | ['de', 'en', 'en'] | True |
test_color_mode | (hass, enable_custom_integrations) | Test color_mode reporting. | Test color_mode reporting. | async def test_color_mode(hass, enable_custom_integrations):
"""Test color_mode reporting."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE_ON))
platform.ENTITIES.append(platform.MockLight("test2", STATE_OFF))
... | [
"async",
"def",
"test_color_mode",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
".",
"EN... | [
852,
0
] | [
921,
61
] | python | en | ['en', 'en', 'en'] | True |
test_color_mode2 | (hass, enable_custom_integrations) | Test onoff color_mode and brightness are given lowest priority. | Test onoff color_mode and brightness are given lowest priority. | async def test_color_mode2(hass, enable_custom_integrations):
"""Test onoff color_mode and brightness are given lowest priority."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("test1", STATE_ON))
platform.ENTITIES.append(pl... | [
"async",
"def",
"test_color_mode2",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
".",
"E... | [
924,
0
] | [
995,
69
] | python | en | ['en', 'en', 'en'] | True |
test_supported_features | (hass) | Test supported features reporting. | Test supported features reporting. | async def test_supported_features(hass):
"""Test supported features reporting."""
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: {
"platform": DOMAIN,
"entities": ["light.test1", "light.test2"],
}
},
)
... | [
"async",
"def",
"test_supported_features",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"{",
"\"platform\"",
":",
"DOMAIN",
",",
"\"entities\"",
":",
"[",
"\"light.test1\"",
",",
"\"lig... | [
998,
0
] | [
1038,
58
] | python | en | ['en', 'en', 'en'] | True |
test_service_calls | (hass) | Test service calls. | Test service calls. | async def test_service_calls(hass):
"""Test service calls."""
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: [
{"platform": "demo"},
{
"platform": DOMAIN,
"entities": [
... | [
"async",
"def",
"test_service_calls",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
",",
"{",
"\"platform\"",
":",
"DOMAIN",
",",
"\"e... | [
1041,
0
] | [
1124,
61
] | python | en | ['en', 'ca', 'en'] | True |
test_invalid_service_calls | (hass) | Test invalid service call arguments get discarded. | Test invalid service call arguments get discarded. | async def test_invalid_service_calls(hass):
"""Test invalid service call arguments get discarded."""
add_entities = MagicMock()
await group.async_setup_platform(
hass, {"name": "test", "entities": ["light.test1", "light.test2"]}, add_entities
)
await hass.async_block_till_done()
await ha... | [
"async",
"def",
"test_invalid_service_calls",
"(",
"hass",
")",
":",
"add_entities",
"=",
"MagicMock",
"(",
")",
"await",
"group",
".",
"async_setup_platform",
"(",
"hass",
",",
"{",
"\"name\"",
":",
"\"test\"",
",",
"\"entities\"",
":",
"[",
"\"light.test1\"",
... | [
1127,
0
] | [
1170,
9
] | python | en | ['en', 'en', 'en'] | True |
test_reload | (hass) | Test the ability to reload lights. | Test the ability to reload lights. | async def test_reload(hass):
"""Test the ability to reload lights."""
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: [
{"platform": "demo"},
{
"platform": DOMAIN,
"entities": [
... | [
"async",
"def",
"test_reload",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
",",
"{",
"\"platform\"",
":",
"DOMAIN",
",",
"\"entities... | [
1173,
0
] | [
1216,
70
] | python | en | ['en', 'en', 'en'] | True |
test_reload_with_platform_not_setup | (hass) | Test the ability to reload lights. | Test the ability to reload lights. | async def test_reload_with_platform_not_setup(hass):
"""Test the ability to reload lights."""
hass.states.async_set("light.bowl", STATE_ON)
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: [
{"platform": "demo"},
]
},
... | [
"async",
"def",
"test_reload_with_platform_not_setup",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.bowl\"",
",",
"STATE_ON",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
... | [
1219,
0
] | [
1258,
70
] | python | en | ['en', 'en', 'en'] | True |
test_reload_with_base_integration_platform_not_setup | (hass) | Test the ability to reload lights. | Test the ability to reload lights. | async def test_reload_with_base_integration_platform_not_setup(hass):
"""Test the ability to reload lights."""
assert await async_setup_component(
hass,
"group",
{
"group": {
"group_zero": {"entities": "light.Bowl", "icon": "mdi:work"},
}
}... | [
"async",
"def",
"test_reload_with_base_integration_platform_not_setup",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"group\"",
",",
"{",
"\"group\"",
":",
"{",
"\"group_zero\"",
":",
"{",
"\"entities\"",
":",
"\"light.Bowl\""... | [
1261,
0
] | [
1297,
77
] | python | en | ['en', 'en', 'en'] | True |
test_nested_group | (hass) | Test nested light group. | Test nested light group. | async def test_nested_group(hass):
"""Test nested light group."""
hass.states.async_set("light.kitchen", "on")
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: [
{
"platform": DOMAIN,
"entities": ["li... | [
"async",
"def",
"test_nested_group",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.kitchen\"",
",",
"\"on\"",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"[",
"{",
"\... | [
1300,
0
] | [
1333,
74
] | python | da | ['da', 'no', 'en'] | False |
GTestJsonOutputUnitTest.testEmptyJsonOutput | (self) | Verifies JSON output for a Google Test binary without actual tests.
Runs a test program that generates an empty JSON output, and
tests that the JSON output is expected.
| Verifies JSON output for a Google Test binary without actual tests. | def testEmptyJsonOutput(self):
"""Verifies JSON output for a Google Test binary without actual tests.
Runs a test program that generates an empty JSON output, and
tests that the JSON output is expected.
"""
self._TestJsonOutput('gtest_no_test_unittest', EXPECTED_EMPTY, 0) | [
"def",
"testEmptyJsonOutput",
"(",
"self",
")",
":",
"self",
".",
"_TestJsonOutput",
"(",
"'gtest_no_test_unittest'",
",",
"EXPECTED_EMPTY",
",",
"0",
")"
] | [
647,
2
] | [
654,
69
] | python | en | ['en', 'en', 'en'] | True |
GTestJsonOutputUnitTest.testTimestampValue | (self) | Checks whether the timestamp attribute in the JSON output is valid.
Runs a test program that generates an empty JSON output, and checks if
the timestamp attribute in the testsuites tag is valid.
| Checks whether the timestamp attribute in the JSON output is valid. | def testTimestampValue(self):
"""Checks whether the timestamp attribute in the JSON output is valid.
Runs a test program that generates an empty JSON output, and checks if
the timestamp attribute in the testsuites tag is valid.
"""
actual = self._GetJsonOutput('gtest_no_test_unittest', [], 0)
d... | [
"def",
"testTimestampValue",
"(",
"self",
")",
":",
"actual",
"=",
"self",
".",
"_GetJsonOutput",
"(",
"'gtest_no_test_unittest'",
",",
"[",
"]",
",",
"0",
")",
"date_time_str",
"=",
"actual",
"[",
"'timestamp'",
"]",
"# datetime.strptime() is only available in Pyth... | [
656,
2
] | [
678,
52
] | python | en | ['en', 'en', 'en'] | True |
GTestJsonOutputUnitTest.testDefaultOutputFile | (self) | Verifies the default output file name.
Confirms that Google Test produces an JSON output file with the expected
default name if no name is explicitly specified.
| Verifies the default output file name. | def testDefaultOutputFile(self):
"""Verifies the default output file name.
Confirms that Google Test produces an JSON output file with the expected
default name if no name is explicitly specified.
"""
output_file = os.path.join(gtest_test_utils.GetTempDir(),
GTEST_DEF... | [
"def",
"testDefaultOutputFile",
"(",
"self",
")",
":",
"output_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"gtest_test_utils",
".",
"GetTempDir",
"(",
")",
",",
"GTEST_DEFAULT_OUTPUT_FILE",
")",
"gtest_prog_path",
"=",
"gtest_test_utils",
".",
"GetTestExecuta... | [
680,
2
] | [
702,
45
] | python | en | ['en', 'en', 'en'] | True |
GTestJsonOutputUnitTest.testSuppressedJsonOutput | (self) | Verifies that no JSON output is generated.
Tests that no JSON file is generated if the default JSON listener is
shut down before RUN_ALL_TESTS is invoked.
| Verifies that no JSON output is generated. | def testSuppressedJsonOutput(self):
"""Verifies that no JSON output is generated.
Tests that no JSON file is generated if the default JSON listener is
shut down before RUN_ALL_TESTS is invoked.
"""
json_path = os.path.join(gtest_test_utils.GetTempDir(),
GTEST_PROGRAM_N... | [
"def",
"testSuppressedJsonOutput",
"(",
"self",
")",
":",
"json_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"gtest_test_utils",
".",
"GetTempDir",
"(",
")",
",",
"GTEST_PROGRAM_NAME",
"+",
"'out.json'",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"("... | [
704,
2
] | [
732,
47
] | python | en | ['en', 'en', 'en'] | True |
GTestJsonOutputUnitTest.testFilteredTestJsonOutput | (self) | Verifies JSON output when a filter is applied.
Runs a test program that executes only some tests and verifies that
non-selected tests do not show up in the JSON output.
| Verifies JSON output when a filter is applied. | def testFilteredTestJsonOutput(self):
"""Verifies JSON output when a filter is applied.
Runs a test program that executes only some tests and verifies that
non-selected tests do not show up in the JSON output.
"""
self._TestJsonOutput(GTEST_PROGRAM_NAME, EXPECTED_FILTERED, 0,
... | [
"def",
"testFilteredTestJsonOutput",
"(",
"self",
")",
":",
"self",
".",
"_TestJsonOutput",
"(",
"GTEST_PROGRAM_NAME",
",",
"EXPECTED_FILTERED",
",",
"0",
",",
"extra_args",
"=",
"[",
"'%s=SuccessfulTest.*'",
"%",
"GTEST_FILTER_FLAG",
"]",
")"
] | [
734,
2
] | [
742,
80
] | python | en | ['en', 'en', 'en'] | True |
GTestJsonOutputUnitTest._GetJsonOutput | (self, gtest_prog_name, extra_args, expected_exit_code) | Returns the JSON output generated by running the program gtest_prog_name.
Furthermore, the program's exit code must be expected_exit_code.
Args:
gtest_prog_name: Google Test binary name.
extra_args: extra arguments to binary invocation.
expected_exit_code: program's exit code.
| Returns the JSON output generated by running the program gtest_prog_name. | def _GetJsonOutput(self, gtest_prog_name, extra_args, expected_exit_code):
"""Returns the JSON output generated by running the program gtest_prog_name.
Furthermore, the program's exit code must be expected_exit_code.
Args:
gtest_prog_name: Google Test binary name.
extra_args: extra arguments t... | [
"def",
"_GetJsonOutput",
"(",
"self",
",",
"gtest_prog_name",
",",
"extra_args",
",",
"expected_exit_code",
")",
":",
"json_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"gtest_test_utils",
".",
"GetTempDir",
"(",
")",
",",
"gtest_prog_name",
"+",
"'out.jso... | [
744,
2
] | [
774,
17
] | python | en | ['en', 'en', 'en'] | True |
GTestJsonOutputUnitTest._TestJsonOutput | (self, gtest_prog_name, expected,
expected_exit_code, extra_args=None) | Checks the JSON output generated by the Google Test binary.
Asserts that the JSON document generated by running the program
gtest_prog_name matches expected_json, a string containing another
JSON document. Furthermore, the program's exit code must be
expected_exit_code.
Args:
gtest_prog_nam... | Checks the JSON output generated by the Google Test binary. | def _TestJsonOutput(self, gtest_prog_name, expected,
expected_exit_code, extra_args=None):
"""Checks the JSON output generated by the Google Test binary.
Asserts that the JSON document generated by running the program
gtest_prog_name matches expected_json, a string containing another
... | [
"def",
"_TestJsonOutput",
"(",
"self",
",",
"gtest_prog_name",
",",
"expected",
",",
"expected_exit_code",
",",
"extra_args",
"=",
"None",
")",
":",
"actual",
"=",
"self",
".",
"_GetJsonOutput",
"(",
"gtest_prog_name",
",",
"extra_args",
"or",
"[",
"]",
",",
... | [
776,
2
] | [
794,
71
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Defer sensor setup to the shared sensor module. | Defer sensor setup to the shared sensor module. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Defer sensor setup to the shared sensor module."""
coordinator = hass.data[DOMAIN][config_entry.entry_id]
sensors = [FliprSensor(coordinator, description) for description in SENSOR_TYPES]
async_add_entities(sensors) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"coordinator",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"sensors",
"=",
"[",
"FliprSensor",
"(",
"coor... | [
48,
0
] | [
53,
31
] | python | en | ['en', 'pt', 'en'] | True |
FliprSensor.native_value | (self) | State of the sensor. | State of the sensor. | def native_value(self):
"""State of the sensor."""
state = self.coordinator.data[self.entity_description.key]
if isinstance(state, datetime):
return state.isoformat()
return state | [
"def",
"native_value",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"coordinator",
".",
"data",
"[",
"self",
".",
"entity_description",
".",
"key",
"]",
"if",
"isinstance",
"(",
"state",
",",
"datetime",
")",
":",
"return",
"state",
".",
"isoformat"... | [
60,
4
] | [
65,
20
] | python | en | ['en', 'en', 'en'] | True |
ntp_sha256 | (ntp) | datasource object: Datasource for the ntp.conf spec | datasource object: Datasource for the ntp.conf spec | def ntp_sha256(ntp):
""" datasource object: Datasource for the ntp.conf spec """
return {"sha": sha256(ntp.path)} | [
"def",
"ntp_sha256",
"(",
"ntp",
")",
":",
"return",
"{",
"\"sha\"",
":",
"sha256",
"(",
"ntp",
".",
"path",
")",
"}"
] | [
43,
0
] | [
45,
36
] | 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.