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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
OpenThermClimate.update_options | (self, entry) | Update climate entity options. | Update climate entity options. | def update_options(self, entry):
"""Update climate entity options."""
self.floor_temp = entry.options[CONF_FLOOR_TEMP]
self.temp_precision = entry.options[CONF_PRECISION]
self.async_write_ha_state() | [
"def",
"update_options",
"(",
"self",
",",
"entry",
")",
":",
"self",
".",
"floor_temp",
"=",
"entry",
".",
"options",
"[",
"CONF_FLOOR_TEMP",
"]",
"self",
".",
"temp_precision",
"=",
"entry",
".",
"options",
"[",
"CONF_PRECISION",
"]",
"self",
".",
"async... | [
78,
4
] | [
82,
35
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.async_added_to_hass | (self) | Connect to the OpenTherm Gateway device. | Connect to the OpenTherm Gateway device. | async def async_added_to_hass(self):
"""Connect to the OpenTherm Gateway device."""
_LOGGER.debug("Added OpenTherm Gateway climate device %s", self.friendly_name)
self._unsub_updates = async_dispatcher_connect(
self.hass, self._gateway.update_signal, self.receive_report
)
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Added OpenTherm Gateway climate device %s\"",
",",
"self",
".",
"friendly_name",
")",
"self",
".",
"_unsub_updates",
"=",
"async_dispatcher_connect",
"(",
"self",
".",
"ha... | [
84,
4
] | [
92,
9
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.async_will_remove_from_hass | (self) | Unsubscribe from updates from the component. | Unsubscribe from updates from the component. | async def async_will_remove_from_hass(self):
"""Unsubscribe from updates from the component."""
_LOGGER.debug("Removing OpenTherm Gateway climate %s", self.friendly_name)
self._unsub_options()
self._unsub_updates() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Removing OpenTherm Gateway climate %s\"",
",",
"self",
".",
"friendly_name",
")",
"self",
".",
"_unsub_options",
"(",
")",
"self",
".",
"_unsub_updates",
"(",
")... | [
94,
4
] | [
98,
29
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.receive_report | (self, status) | Receive and handle a new report from the Gateway. | Receive and handle a new report from the Gateway. | def receive_report(self, status):
"""Receive and handle a new report from the Gateway."""
self._available = bool(status)
ch_active = status.get(gw_vars.DATA_SLAVE_CH_ACTIVE)
flame_on = status.get(gw_vars.DATA_SLAVE_FLAME_ON)
cooling_active = status.get(gw_vars.DATA_SLAVE_COOLING_... | [
"def",
"receive_report",
"(",
"self",
",",
"status",
")",
":",
"self",
".",
"_available",
"=",
"bool",
"(",
"status",
")",
"ch_active",
"=",
"status",
".",
"get",
"(",
"gw_vars",
".",
"DATA_SLAVE_CH_ACTIVE",
")",
"flame_on",
"=",
"status",
".",
"get",
"(... | [
101,
4
] | [
147,
35
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.available | (self) | Return availability of the sensor. | Return availability of the sensor. | def available(self):
"""Return availability of the sensor."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
150,
4
] | [
152,
30
] | python | en | ['en', 'ga', 'en'] | True |
OpenThermClimate.name | (self) | Return the friendly name. | Return the friendly name. | def name(self):
"""Return the friendly name."""
return self.friendly_name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"friendly_name"
] | [
155,
4
] | [
157,
33
] | python | en | ['en', 'ig', 'en'] | True |
OpenThermClimate.device_info | (self) | Return device info. | Return device info. | def device_info(self):
"""Return device info."""
return {
"identifiers": {(DOMAIN, self._gateway.gw_id)},
"name": self._gateway.name,
"manufacturer": "Schelte Bron",
"model": "OpenTherm Gateway",
"sw_version": self._gateway.gw_version,
... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_gateway",
".",
"gw_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"_gateway",
".",
"name",
",",
"\"manufacturer\"",
":",
"\"S... | [
160,
4
] | [
168,
9
] | python | en | ['es', 'hr', 'en'] | False |
OpenThermClimate.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return self._gateway.gw_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_gateway",
".",
"gw_id"
] | [
171,
4
] | [
173,
34
] | python | ca | ['fr', 'ca', 'en'] | False |
OpenThermClimate.precision | (self) | Return the precision of the system. | Return the precision of the system. | def precision(self):
"""Return the precision of the system."""
if self.temp_precision is not None and self.temp_precision != 0:
return self.temp_precision
if self.hass.config.units.temperature_unit == TEMP_CELSIUS:
return PRECISION_HALVES
return PRECISION_WHOLE | [
"def",
"precision",
"(",
"self",
")",
":",
"if",
"self",
".",
"temp_precision",
"is",
"not",
"None",
"and",
"self",
".",
"temp_precision",
"!=",
"0",
":",
"return",
"self",
".",
"temp_precision",
"if",
"self",
".",
"hass",
".",
"config",
".",
"units",
... | [
176,
4
] | [
182,
30
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.should_poll | (self) | Disable polling for this entity. | Disable polling for this entity. | def should_poll(self):
"""Disable polling for this entity."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
185,
4
] | [
187,
20
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.temperature_unit | (self) | Return the unit of measurement used by the platform. | Return the unit of measurement used by the platform. | def temperature_unit(self):
"""Return the unit of measurement used by the platform."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
190,
4
] | [
192,
27
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.hvac_action | (self) | Return current HVAC operation. | Return current HVAC operation. | def hvac_action(self):
"""Return current HVAC operation."""
return self._current_operation | [
"def",
"hvac_action",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_operation"
] | [
195,
4
] | [
197,
38
] | python | en | ['en', 'bg', 'en'] | True |
OpenThermClimate.hvac_mode | (self) | Return current HVAC mode. | Return current HVAC mode. | def hvac_mode(self):
"""Return current HVAC mode."""
return self._hvac_mode | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_hvac_mode"
] | [
200,
4
] | [
202,
30
] | python | en | ['en', 'co', 'en'] | True |
OpenThermClimate.hvac_modes | (self) | Return available HVAC modes. | Return available HVAC modes. | def hvac_modes(self):
"""Return available HVAC modes."""
return [] | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"[",
"]"
] | [
205,
4
] | [
207,
17
] | python | en | ['fr', 'hi-Latn', 'en'] | False |
OpenThermClimate.set_hvac_mode | (self, hvac_mode) | Set the HVAC mode. | Set the HVAC mode. | def set_hvac_mode(self, hvac_mode):
"""Set the HVAC mode."""
_LOGGER.warning("Changing HVAC mode is not supported") | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"_LOGGER",
".",
"warning",
"(",
"\"Changing HVAC mode is not supported\"",
")"
] | [
209,
4
] | [
211,
62
] | python | en | ['en', 'pt', 'en'] | True |
OpenThermClimate.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
if self._current_temperature is None:
return
if self.floor_temp is True:
if self.precision == PRECISION_HALVES:
return int(2 * self._current_temperature) / 2
if self.precision... | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"if",
"self",
".",
"_current_temperature",
"is",
"None",
":",
"return",
"if",
"self",
".",
"floor_temp",
"is",
"True",
":",
"if",
"self",
".",
"precision",
"==",
"PRECISION_HALVES",
":",
"return",
"int",
... | [
214,
4
] | [
224,
40
] | python | en | ['en', 'la', 'en'] | True |
OpenThermClimate.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
return self._new_target_temperature or self._target_temperature | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_new_target_temperature",
"or",
"self",
".",
"_target_temperature"
] | [
227,
4
] | [
229,
71
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.target_temperature_step | (self) | Return the supported step of target temperature. | Return the supported step of target temperature. | def target_temperature_step(self):
"""Return the supported step of target temperature."""
return self.precision | [
"def",
"target_temperature_step",
"(",
"self",
")",
":",
"return",
"self",
".",
"precision"
] | [
232,
4
] | [
234,
29
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.preset_mode | (self) | Return current preset mode. | Return current preset mode. | def preset_mode(self):
"""Return current preset mode."""
if self._away_state_a or self._away_state_b:
return PRESET_AWAY
return PRESET_NONE | [
"def",
"preset_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"_away_state_a",
"or",
"self",
".",
"_away_state_b",
":",
"return",
"PRESET_AWAY",
"return",
"PRESET_NONE"
] | [
237,
4
] | [
241,
26
] | python | en | ['en', 'ca', 'en'] | True |
OpenThermClimate.preset_modes | (self) | Available preset modes to set. | Available preset modes to set. | def preset_modes(self):
"""Available preset modes to set."""
return [] | [
"def",
"preset_modes",
"(",
"self",
")",
":",
"return",
"[",
"]"
] | [
244,
4
] | [
246,
17
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.set_preset_mode | (self, preset_mode) | Set the preset mode. | Set the preset mode. | def set_preset_mode(self, preset_mode):
"""Set the preset mode."""
_LOGGER.warning("Changing preset mode is not supported") | [
"def",
"set_preset_mode",
"(",
"self",
",",
"preset_mode",
")",
":",
"_LOGGER",
".",
"warning",
"(",
"\"Changing preset mode is not supported\"",
")"
] | [
248,
4
] | [
250,
64
] | python | en | ['en', 'pt', 'en'] | True |
OpenThermClimate.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
if ATTR_TEMPERATURE in kwargs:
temp = float(kwargs[ATTR_TEMPERATURE])
if temp == self.target_temperature:
return
self._new_target_temperature = await self._gateway.gatew... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ATTR_TEMPERATURE",
"in",
"kwargs",
":",
"temp",
"=",
"float",
"(",
"kwargs",
"[",
"ATTR_TEMPERATURE",
"]",
")",
"if",
"temp",
"==",
"self",
".",
"target_tempera... | [
252,
4
] | [
261,
39
] | python | en | ['en', 'ca', 'en'] | True |
OpenThermClimate.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_FLAGS | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_FLAGS"
] | [
264,
4
] | [
266,
28
] | python | en | ['en', 'en', 'en'] | True |
OpenThermClimate.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
return 1 | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"1"
] | [
269,
4
] | [
271,
16
] | python | en | ['en', 'la', 'en'] | True |
OpenThermClimate.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
return 30 | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"30"
] | [
274,
4
] | [
276,
17
] | python | en | ['en', 'la', 'en'] | True |
mock_real_ip | (app) | Inject middleware to mock real IP.
Returns a function to set the real IP.
| Inject middleware to mock real IP. | def mock_real_ip(app):
"""Inject middleware to mock real IP.
Returns a function to set the real IP.
"""
ip_to_mock = None
def set_ip_to_mock(value):
nonlocal ip_to_mock
ip_to_mock = value
@web.middleware
async def mock_real_ip(request, handler):
"""Mock Real IP mid... | [
"def",
"mock_real_ip",
"(",
"app",
")",
":",
"ip_to_mock",
"=",
"None",
"def",
"set_ip_to_mock",
"(",
"value",
")",
":",
"nonlocal",
"ip_to_mock",
"ip_to_mock",
"=",
"value",
"@",
"web",
".",
"middleware",
"async",
"def",
"mock_real_ip",
"(",
"request",
",",... | [
7,
0
] | [
33,
25
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the XS1 thermostat platform. | Set up the XS1 thermostat platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the XS1 thermostat platform."""
actuators = hass.data[COMPONENT_DOMAIN][ACTUATORS]
sensors = hass.data[COMPONENT_DOMAIN][SENSORS]
thermostat_entities = []
for actuator in actuators:
if actuator.type() == Actuator... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"actuators",
"=",
"hass",
".",
"data",
"[",
"COMPONENT_DOMAIN",
"]",
"[",
"ACTUATORS",
"]",
"sensors",
"=",
"hass",
".",
"data",
"[",
... | [
18,
0
] | [
37,
37
] | python | en | ['en', 'cs', 'en'] | True |
XS1ThermostatEntity.__init__ | (self, device, sensor) | Initialize the actuator. | Initialize the actuator. | def __init__(self, device, sensor):
"""Initialize the actuator."""
super().__init__(device)
self.sensor = sensor | [
"def",
"__init__",
"(",
"self",
",",
"device",
",",
"sensor",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
")",
"self",
".",
"sensor",
"=",
"sensor"
] | [
43,
4
] | [
46,
28
] | python | en | ['en', 'en', 'en'] | True |
XS1ThermostatEntity.name | (self) | Return the name of the device if any. | Return the name of the device if any. | def name(self):
"""Return the name of the device if any."""
return self.device.name() | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
".",
"name",
"(",
")"
] | [
49,
4
] | [
51,
33
] | python | en | ['en', 'en', 'en'] | True |
XS1ThermostatEntity.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_TARGET_TEMPERATURE | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_TARGET_TEMPERATURE"
] | [
54,
4
] | [
56,
41
] | python | en | ['da', 'en', 'en'] | True |
XS1ThermostatEntity.hvac_mode | (self) | Return hvac operation ie. heat, cool mode.
Need to be one of HVAC_MODE_*.
| Return hvac operation ie. heat, cool mode. | def hvac_mode(self):
"""Return hvac operation ie. heat, cool mode.
Need to be one of HVAC_MODE_*.
"""
return HVAC_MODE_HEAT | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"return",
"HVAC_MODE_HEAT"
] | [
59,
4
] | [
64,
29
] | python | bg | ['en', 'bg', 'bg'] | True |
XS1ThermostatEntity.hvac_modes | (self) | Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
| Return the list of available hvac operation modes. | def hvac_modes(self):
"""Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
"""
return SUPPORT_HVAC | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"SUPPORT_HVAC"
] | [
67,
4
] | [
72,
27
] | python | en | ['en', 'en', 'en'] | True |
XS1ThermostatEntity.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
if self.sensor is None:
return None
return self.sensor.value() | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"if",
"self",
".",
"sensor",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"sensor",
".",
"value",
"(",
")"
] | [
75,
4
] | [
80,
34
] | python | en | ['en', 'la', 'en'] | True |
XS1ThermostatEntity.temperature_unit | (self) | Return the unit of measurement used by the platform. | Return the unit of measurement used by the platform. | def temperature_unit(self):
"""Return the unit of measurement used by the platform."""
return self.device.unit() | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
".",
"unit",
"(",
")"
] | [
83,
4
] | [
85,
33
] | python | en | ['en', 'en', 'en'] | True |
XS1ThermostatEntity.target_temperature | (self) | Return the current target temperature. | Return the current target temperature. | def target_temperature(self):
"""Return the current target temperature."""
return self.device.new_value() | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
".",
"new_value",
"(",
")"
] | [
88,
4
] | [
90,
38
] | python | en | ['en', 'la', 'en'] | True |
XS1ThermostatEntity.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
return MIN_TEMP | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"MIN_TEMP"
] | [
93,
4
] | [
95,
23
] | python | en | ['en', 'la', 'en'] | True |
XS1ThermostatEntity.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
return MAX_TEMP | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"MAX_TEMP"
] | [
98,
4
] | [
100,
23
] | python | en | ['en', 'la', 'en'] | True |
XS1ThermostatEntity.set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | def set_temperature(self, **kwargs):
"""Set new target temperature."""
temp = kwargs.get(ATTR_TEMPERATURE)
self.device.set_value(temp)
if self.sensor is not None:
self.schedule_update_ha_state() | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"self",
".",
"device",
".",
"set_value",
"(",
"temp",
")",
"if",
"self",
".",
"sensor",
"is",
"not",
"None",
":... | [
102,
4
] | [
109,
43
] | python | en | ['en', 'ca', 'en'] | True |
XS1ThermostatEntity.set_hvac_mode | (self, hvac_mode) | Set new target hvac mode. | Set new target hvac mode. | def set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode.""" | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":"
] | [
111,
4
] | [
112,
39
] | python | da | ['da', 'su', 'en'] | False |
XS1ThermostatEntity.async_update | (self) | Also update the sensor when available. | Also update the sensor when available. | async def async_update(self):
"""Also update the sensor when available."""
await super().async_update()
if self.sensor is not None:
await self.hass.async_add_executor_job(self.sensor.update) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_update",
"(",
")",
"if",
"self",
".",
"sensor",
"is",
"not",
"None",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"sen... | [
114,
4
] | [
118,
70
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Verisure platform. | Set up the Verisure platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Verisure platform."""
alarms = []
if int(hub.config.get(CONF_ALARM, 1)):
hub.update_overview()
alarms.append(VerisureAlarm())
add_entities(alarms) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"alarms",
"=",
"[",
"]",
"if",
"int",
"(",
"hub",
".",
"config",
".",
"get",
"(",
"CONF_ALARM",
",",
"1",
")",
")",
":",
"hub",
... | [
20,
0
] | [
26,
24
] | python | en | ['en', 'lv', 'en'] | True |
set_arm_state | (state, code=None) | Send set arm state command. | Send set arm state command. | def set_arm_state(state, code=None):
"""Send set arm state command."""
transaction_id = hub.session.set_arm_state(code, state)[
"armStateChangeTransactionId"
]
_LOGGER.info("verisure set arm state %s", state)
transaction = {}
while "result" not in transaction:
sleep(0.5)
... | [
"def",
"set_arm_state",
"(",
"state",
",",
"code",
"=",
"None",
")",
":",
"transaction_id",
"=",
"hub",
".",
"session",
".",
"set_arm_state",
"(",
"code",
",",
"state",
")",
"[",
"\"armStateChangeTransactionId\"",
"]",
"_LOGGER",
".",
"info",
"(",
"\"verisur... | [
29,
0
] | [
39,
41
] | python | en | ['en', 'en', 'en'] | True |
VerisureAlarm.__init__ | (self) | Initialize the Verisure alarm panel. | Initialize the Verisure alarm panel. | def __init__(self):
"""Initialize the Verisure alarm panel."""
self._state = None
self._digits = hub.config.get(CONF_CODE_DIGITS)
self._changed_by = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_digits",
"=",
"hub",
".",
"config",
".",
"get",
"(",
"CONF_CODE_DIGITS",
")",
"self",
".",
"_changed_by",
"=",
"None"
] | [
45,
4
] | [
49,
31
] | python | en | ['en', 'ro', 'en'] | True |
VerisureAlarm.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
giid = hub.config.get(CONF_GIID)
if giid is not None:
aliass = {i["giid"]: i["alias"] for i in hub.session.installations}
if giid in aliass:
return "{} alarm".format(aliass[giid])
_LOGGER.er... | [
"def",
"name",
"(",
"self",
")",
":",
"giid",
"=",
"hub",
".",
"config",
".",
"get",
"(",
"CONF_GIID",
")",
"if",
"giid",
"is",
"not",
"None",
":",
"aliass",
"=",
"{",
"i",
"[",
"\"giid\"",
"]",
":",
"i",
"[",
"\"alias\"",
"]",
"for",
"i",
"in"... | [
52,
4
] | [
62,
71
] | python | en | ['en', 'en', 'en'] | True |
VerisureAlarm.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
65,
4
] | [
67,
26
] | python | en | ['en', 'en', 'en'] | True |
VerisureAlarm.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self) -> int:
"""Return the list of supported features."""
return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"SUPPORT_ALARM_ARM_HOME",
"|",
"SUPPORT_ALARM_ARM_AWAY"
] | [
70,
4
] | [
72,
62
] | python | en | ['en', 'en', 'en'] | True |
VerisureAlarm.code_format | (self) | Return one or more digits/characters. | Return one or more digits/characters. | def code_format(self):
"""Return one or more digits/characters."""
return alarm.FORMAT_NUMBER | [
"def",
"code_format",
"(",
"self",
")",
":",
"return",
"alarm",
".",
"FORMAT_NUMBER"
] | [
75,
4
] | [
77,
34
] | python | en | ['en', 'en', 'en'] | True |
VerisureAlarm.changed_by | (self) | Return the last change triggered by. | Return the last change triggered by. | def changed_by(self):
"""Return the last change triggered by."""
return self._changed_by | [
"def",
"changed_by",
"(",
"self",
")",
":",
"return",
"self",
".",
"_changed_by"
] | [
80,
4
] | [
82,
31
] | python | en | ['en', 'en', 'en'] | True |
VerisureAlarm.update | (self) | Update alarm status. | Update alarm status. | def update(self):
"""Update alarm status."""
hub.update_overview()
status = hub.get_first("$.armState.statusType")
if status == "DISARMED":
self._state = STATE_ALARM_DISARMED
elif status == "ARMED_HOME":
self._state = STATE_ALARM_ARMED_HOME
elif st... | [
"def",
"update",
"(",
"self",
")",
":",
"hub",
".",
"update_overview",
"(",
")",
"status",
"=",
"hub",
".",
"get_first",
"(",
"\"$.armState.statusType\"",
")",
"if",
"status",
"==",
"\"DISARMED\"",
":",
"self",
".",
"_state",
"=",
"STATE_ALARM_DISARMED",
"el... | [
84,
4
] | [
96,
59
] | python | en | ['tr', 'la', 'en'] | False |
VerisureAlarm.alarm_disarm | (self, code=None) | Send disarm command. | Send disarm command. | def alarm_disarm(self, code=None):
"""Send disarm command."""
set_arm_state("DISARMED", code) | [
"def",
"alarm_disarm",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"set_arm_state",
"(",
"\"DISARMED\"",
",",
"code",
")"
] | [
98,
4
] | [
100,
39
] | python | en | ['en', 'pt', 'en'] | True |
VerisureAlarm.alarm_arm_home | (self, code=None) | Send arm home command. | Send arm home command. | def alarm_arm_home(self, code=None):
"""Send arm home command."""
set_arm_state("ARMED_HOME", code) | [
"def",
"alarm_arm_home",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"set_arm_state",
"(",
"\"ARMED_HOME\"",
",",
"code",
")"
] | [
102,
4
] | [
104,
41
] | python | en | ['en', 'pt', 'en'] | True |
VerisureAlarm.alarm_arm_away | (self, code=None) | Send arm away command. | Send arm away command. | def alarm_arm_away(self, code=None):
"""Send arm away command."""
set_arm_state("ARMED_AWAY", code) | [
"def",
"alarm_arm_away",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"set_arm_state",
"(",
"\"ARMED_AWAY\"",
",",
"code",
")"
] | [
106,
4
] | [
108,
41
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the AEH-W4A1 climate platform. | Set up the AEH-W4A1 climate platform. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the AEH-W4A1 climate platform."""
# Priority 1: manual config
if hass.data[DOMAIN].get(CONF_IP_ADDRESS):
devices = hass.data[DOMAIN][CONF_IP_ADDRESS]
else:
# Priority 2: scanned interfaces
devices = aw... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"# Priority 1: manual config",
"if",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"get",
"(",
"CONF_IP_ADDRESS",
")",
":",
"devices",
"=",
"hass",
".",... | [
133,
0
] | [
143,
38
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.__init__ | (self, device) | Initialize the climate device. | Initialize the climate device. | def __init__(self, device):
"""Initialize the climate device."""
self._unique_id = device
self._device = AehW4a1(device)
self._hvac_modes = HVAC_MODES
self._fan_modes = FAN_MODES
self._swing_modes = SWING_MODES
self._preset_modes = PRESET_MODES
self._avail... | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"self",
".",
"_unique_id",
"=",
"device",
"self",
".",
"_device",
"=",
"AehW4a1",
"(",
"device",
")",
"self",
".",
"_hvac_modes",
"=",
"HVAC_MODES",
"self",
".",
"_fan_modes",
"=",
"FAN_MODES",
"se... | [
149,
4
] | [
166,
35
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.async_update | (self) | Pull state from AEH-W4A1. | Pull state from AEH-W4A1. | async def async_update(self):
"""Pull state from AEH-W4A1."""
try:
status = await self._device.command("status_102_0")
except pyaehw4a1.exceptions.ConnectionError as library_error:
_LOGGER.warning(
"Unexpected error of %s: %s", self._unique_id, library_err... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"status",
"=",
"await",
"self",
".",
"_device",
".",
"command",
"(",
"\"status_102_0\"",
")",
"except",
"pyaehw4a1",
".",
"exceptions",
".",
"ConnectionError",
"as",
"library_error",
":",
"_L... | [
168,
4
] | [
224,
36
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self):
"""Return True if entity is available."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
227,
4
] | [
229,
30
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.name | (self) | Return the name of the climate device. | Return the name of the climate device. | def name(self):
"""Return the name of the climate device."""
return self._unique_id | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
232,
4
] | [
234,
30
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
return self._temperature_unit | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"self",
".",
"_temperature_unit"
] | [
237,
4
] | [
239,
37
] | python | en | ['en', 'la', 'en'] | True |
ClimateAehW4a1.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._current_temperature | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_temperature"
] | [
242,
4
] | [
244,
40
] | python | en | ['en', 'la', 'en'] | True |
ClimateAehW4a1.target_temperature | (self) | Return the temperature we are trying to reach. | Return the temperature we are trying to reach. | def target_temperature(self):
"""Return the temperature we are trying to reach."""
return self._target_temperature | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_target_temperature"
] | [
247,
4
] | [
249,
39
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.hvac_mode | (self) | Return hvac target hvac state. | Return hvac target hvac state. | def hvac_mode(self):
"""Return hvac target hvac state."""
return self._hvac_mode | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_hvac_mode"
] | [
252,
4
] | [
254,
30
] | python | en | ['en', 'hi-Latn', 'ru'] | False |
ClimateAehW4a1.hvac_modes | (self) | Return the list of available operation modes. | Return the list of available operation modes. | def hvac_modes(self):
"""Return the list of available operation modes."""
return self._hvac_modes | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_hvac_modes"
] | [
257,
4
] | [
259,
31
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.fan_mode | (self) | Return the fan setting. | Return the fan setting. | def fan_mode(self):
"""Return the fan setting."""
return self._fan_mode | [
"def",
"fan_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fan_mode"
] | [
262,
4
] | [
264,
29
] | python | en | ['en', 'fy', 'en'] | True |
ClimateAehW4a1.fan_modes | (self) | Return the list of available fan modes. | Return the list of available fan modes. | def fan_modes(self):
"""Return the list of available fan modes."""
return self._fan_modes | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fan_modes"
] | [
267,
4
] | [
269,
30
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.preset_mode | (self) | Return the preset mode if on. | Return the preset mode if on. | def preset_mode(self):
"""Return the preset mode if on."""
return self._preset_mode | [
"def",
"preset_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_preset_mode"
] | [
272,
4
] | [
274,
32
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.preset_modes | (self) | Return the list of available preset modes. | Return the list of available preset modes. | def preset_modes(self):
"""Return the list of available preset modes."""
return self._preset_modes | [
"def",
"preset_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_preset_modes"
] | [
277,
4
] | [
279,
33
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.swing_mode | (self) | Return swing operation. | Return swing operation. | def swing_mode(self):
"""Return swing operation."""
return self._swing_mode | [
"def",
"swing_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_swing_mode"
] | [
282,
4
] | [
284,
31
] | python | en | ['en', 'ja', 'en'] | True |
ClimateAehW4a1.swing_modes | (self) | Return the list of available fan modes. | Return the list of available fan modes. | def swing_modes(self):
"""Return the list of available fan modes."""
return self._swing_modes | [
"def",
"swing_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_swing_modes"
] | [
287,
4
] | [
289,
32
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
if self._temperature_unit == TEMP_CELSIUS:
return MIN_TEMP_C
return MIN_TEMP_F | [
"def",
"min_temp",
"(",
"self",
")",
":",
"if",
"self",
".",
"_temperature_unit",
"==",
"TEMP_CELSIUS",
":",
"return",
"MIN_TEMP_C",
"return",
"MIN_TEMP_F"
] | [
292,
4
] | [
296,
25
] | python | en | ['en', 'la', 'en'] | True |
ClimateAehW4a1.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
if self._temperature_unit == TEMP_CELSIUS:
return MAX_TEMP_C
return MAX_TEMP_F | [
"def",
"max_temp",
"(",
"self",
")",
":",
"if",
"self",
".",
"_temperature_unit",
"==",
"TEMP_CELSIUS",
":",
"return",
"MAX_TEMP_C",
"return",
"MAX_TEMP_F"
] | [
299,
4
] | [
303,
25
] | python | en | ['en', 'la', 'en'] | True |
ClimateAehW4a1.precision | (self) | Return the precision of the system. | Return the precision of the system. | def precision(self):
"""Return the precision of the system."""
return PRECISION_WHOLE | [
"def",
"precision",
"(",
"self",
")",
":",
"return",
"PRECISION_WHOLE"
] | [
306,
4
] | [
308,
30
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.target_temperature_step | (self) | Return the supported step of target temperature. | Return the supported step of target temperature. | def target_temperature_step(self):
"""Return the supported step of target temperature."""
return 1 | [
"def",
"target_temperature_step",
"(",
"self",
")",
":",
"return",
"1"
] | [
311,
4
] | [
313,
16
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_FLAGS | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_FLAGS"
] | [
316,
4
] | [
318,
28
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.async_set_temperature | (self, **kwargs) | Set new target temperatures. | Set new target temperatures. | async def async_set_temperature(self, **kwargs):
"""Set new target temperatures."""
if self._on != "1":
_LOGGER.warning(
"AC at %s is off, could not set temperature", self._unique_id
)
return
temp = kwargs.get(ATTR_TEMPERATURE)
if temp ... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_on",
"!=",
"\"1\"",
":",
"_LOGGER",
".",
"warning",
"(",
"\"AC at %s is off, could not set temperature\"",
",",
"self",
".",
"_unique_id",
")",
"retur... | [
320,
4
] | [
335,
65
] | python | en | ['en', 'ca', 'en'] | True |
ClimateAehW4a1.async_set_fan_mode | (self, fan_mode) | Set new fan mode. | Set new fan mode. | async def async_set_fan_mode(self, fan_mode):
"""Set new fan mode."""
if self._on != "1":
_LOGGER.warning("AC at %s is off, could not set fan mode", self._unique_id)
return
if self._hvac_mode in (HVAC_MODE_COOL, HVAC_MODE_FAN_ONLY) and (
self._hvac_mode != HVA... | [
"async",
"def",
"async_set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
":",
"if",
"self",
".",
"_on",
"!=",
"\"1\"",
":",
"_LOGGER",
".",
"warning",
"(",
"\"AC at %s is off, could not set fan mode\"",
",",
"self",
".",
"_unique_id",
")",
"return",
"if",
"sel... | [
337,
4
] | [
346,
68
] | python | en | ['id', 'fy', 'en'] | False |
ClimateAehW4a1.async_set_swing_mode | (self, swing_mode) | Set new target swing operation. | Set new target swing operation. | async def async_set_swing_mode(self, swing_mode):
"""Set new target swing operation."""
if self._on != "1":
_LOGGER.warning(
"AC at %s is off, could not set swing mode", self._unique_id
)
return
_LOGGER.debug("Setting swing mode of %s to %s", ... | [
"async",
"def",
"async_set_swing_mode",
"(",
"self",
",",
"swing_mode",
")",
":",
"if",
"self",
".",
"_on",
"!=",
"\"1\"",
":",
"_LOGGER",
".",
"warning",
"(",
"\"AC at %s is off, could not set swing mode\"",
",",
"self",
".",
"_unique_id",
")",
"return",
"_LOGG... | [
348,
4
] | [
381,
55
] | python | en | ['en', 'en', 'en'] | True |
ClimateAehW4a1.async_set_preset_mode | (self, preset_mode) | Set new preset mode. | Set new preset mode. | async def async_set_preset_mode(self, preset_mode):
"""Set new preset mode."""
if self._on != "1":
if preset_mode == PRESET_NONE:
return
await self.async_turn_on()
_LOGGER.debug("Setting preset mode of %s to %s", self._unique_id, preset_mode)
if ... | [
"async",
"def",
"async_set_preset_mode",
"(",
"self",
",",
"preset_mode",
")",
":",
"if",
"self",
".",
"_on",
"!=",
"\"1\"",
":",
"if",
"preset_mode",
"==",
"PRESET_NONE",
":",
"return",
"await",
"self",
".",
"async_turn_on",
"(",
")",
"_LOGGER",
".",
"deb... | [
383,
4
] | [
417,
39
] | python | en | ['en', 'sr', 'en'] | True |
ClimateAehW4a1.async_set_hvac_mode | (self, hvac_mode) | Set new operation mode. | Set new operation mode. | async def async_set_hvac_mode(self, hvac_mode):
"""Set new operation mode."""
_LOGGER.debug("Setting operation mode of %s to %s", self._unique_id, hvac_mode)
if hvac_mode == HVAC_MODE_OFF:
await self.async_turn_off()
else:
await self._device.command(HA_STATE_TO_AC... | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Setting operation mode of %s to %s\"",
",",
"self",
".",
"_unique_id",
",",
"hvac_mode",
")",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"await",
... | [
419,
4
] | [
427,
42
] | python | en | ['en', 'ny', 'en'] | True |
setup_request_context | (app, context) | Create request context middleware for the app. | Create request context middleware for the app. | def setup_request_context(app, context):
"""Create request context middleware for the app."""
@middleware
async def request_context_middleware(request, handler):
"""Request context middleware."""
context.set(request)
return await handler(request)
app.middlewares.append(request_... | [
"def",
"setup_request_context",
"(",
"app",
",",
"context",
")",
":",
"@",
"middleware",
"async",
"def",
"request_context_middleware",
"(",
"request",
",",
"handler",
")",
":",
"\"\"\"Request context middleware.\"\"\"",
"context",
".",
"set",
"(",
"request",
")",
... | [
10,
0
] | [
19,
54
] | python | en | ['en', 'en', 'en'] | True |
hass_recorder | () | Home Assistant fixture with in-memory recorder. | Home Assistant fixture with in-memory recorder. | def hass_recorder():
"""Home Assistant fixture with in-memory recorder."""
hass = get_test_home_assistant()
def setup_recorder(config=None):
"""Set up with params."""
init_recorder_component(hass, config)
hass.start()
hass.block_till_done()
hass.data[DATA_INSTANCE].b... | [
"def",
"hass_recorder",
"(",
")",
":",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"def",
"setup_recorder",
"(",
"config",
"=",
"None",
")",
":",
"\"\"\"Set up with params.\"\"\"",
"init_recorder_component",
"(",
"hass",
",",
"config",
")",
"hass",
".",
"s... | [
18,
0
] | [
31,
15
] | python | en | ['en', 'en', 'en'] | True |
test_recorder_bad_commit | (hass_recorder) | Bad _commit should retry 3 times. | Bad _commit should retry 3 times. | def test_recorder_bad_commit(hass_recorder):
"""Bad _commit should retry 3 times."""
hass = hass_recorder()
def work(session):
"""Bad work."""
session.execute("select * from notthere")
with patch(
"homeassistant.components.recorder.time.sleep"
) as e_mock, util.session_scop... | [
"def",
"test_recorder_bad_commit",
"(",
"hass_recorder",
")",
":",
"hass",
"=",
"hass_recorder",
"(",
")",
"def",
"work",
"(",
"session",
")",
":",
"\"\"\"Bad work.\"\"\"",
"session",
".",
"execute",
"(",
"\"select * from notthere\"",
")",
"with",
"patch",
"(",
... | [
34,
0
] | [
47,
33
] | python | en | ['en', 'en', 'en'] | True |
test_recorder_bad_execute | (hass_recorder) | Bad execute, retry 3 times. | Bad execute, retry 3 times. | def test_recorder_bad_execute(hass_recorder):
"""Bad execute, retry 3 times."""
from sqlalchemy.exc import SQLAlchemyError
hass_recorder()
def to_native(validate_entity_id=True):
"""Raise exception."""
raise SQLAlchemyError()
mck1 = MagicMock()
mck1.to_native = to_native
... | [
"def",
"test_recorder_bad_execute",
"(",
"hass_recorder",
")",
":",
"from",
"sqlalchemy",
".",
"exc",
"import",
"SQLAlchemyError",
"hass_recorder",
"(",
")",
"def",
"to_native",
"(",
"validate_entity_id",
"=",
"True",
")",
":",
"\"\"\"Raise exception.\"\"\"",
"raise",... | [
50,
0
] | [
68,
33
] | python | en | ['en', 'en', 'en'] | True |
test_validate_or_move_away_sqlite_database_with_integrity_check | (
hass, tmpdir, caplog
) | Ensure a malformed sqlite database is moved away.
A quick_check is run here
| Ensure a malformed sqlite database is moved away. | def test_validate_or_move_away_sqlite_database_with_integrity_check(
hass, tmpdir, caplog
):
"""Ensure a malformed sqlite database is moved away.
A quick_check is run here
"""
db_integrity_check = True
test_dir = tmpdir.mkdir("test_validate_or_move_away_sqlite_database")
test_db_file = f"... | [
"def",
"test_validate_or_move_away_sqlite_database_with_integrity_check",
"(",
"hass",
",",
"tmpdir",
",",
"caplog",
")",
":",
"db_integrity_check",
"=",
"True",
"test_dir",
"=",
"tmpdir",
".",
"mkdir",
"(",
"\"test_validate_or_move_away_sqlite_database\"",
")",
"test_db_fi... | [
71,
0
] | [
104,
88
] | python | en | ['en', 'en', 'en'] | True |
test_validate_or_move_away_sqlite_database_without_integrity_check | (
hass, tmpdir, caplog
) | Ensure a malformed sqlite database is moved away.
The quick_check is skipped, but we can still find
corruption if the whole database is unreadable
| Ensure a malformed sqlite database is moved away. | def test_validate_or_move_away_sqlite_database_without_integrity_check(
hass, tmpdir, caplog
):
"""Ensure a malformed sqlite database is moved away.
The quick_check is skipped, but we can still find
corruption if the whole database is unreadable
"""
db_integrity_check = False
test_dir = t... | [
"def",
"test_validate_or_move_away_sqlite_database_without_integrity_check",
"(",
"hass",
",",
"tmpdir",
",",
"caplog",
")",
":",
"db_integrity_check",
"=",
"False",
"test_dir",
"=",
"tmpdir",
".",
"mkdir",
"(",
"\"test_validate_or_move_away_sqlite_database\"",
")",
"test_d... | [
107,
0
] | [
141,
88
] | python | en | ['en', 'en', 'en'] | True |
test_last_run_was_recently_clean | (hass_recorder) | Test we can check if the last recorder run was recently clean. | Test we can check if the last recorder run was recently clean. | def test_last_run_was_recently_clean(hass_recorder):
"""Test we can check if the last recorder run was recently clean."""
hass = hass_recorder()
cursor = hass.data[DATA_INSTANCE].engine.raw_connection().cursor()
assert util.last_run_was_recently_clean(cursor) is False
hass.data[DATA_INSTANCE]._cl... | [
"def",
"test_last_run_was_recently_clean",
"(",
"hass_recorder",
")",
":",
"hass",
"=",
"hass_recorder",
"(",
")",
"cursor",
"=",
"hass",
".",
"data",
"[",
"DATA_INSTANCE",
"]",
".",
"engine",
".",
"raw_connection",
"(",
")",
".",
"cursor",
"(",
")",
"assert... | [
144,
0
] | [
163,
64
] | python | en | ['en', 'en', 'en'] | True |
test_basic_sanity_check | (hass_recorder) | Test the basic sanity checks with a missing table. | Test the basic sanity checks with a missing table. | def test_basic_sanity_check(hass_recorder):
"""Test the basic sanity checks with a missing table."""
hass = hass_recorder()
cursor = hass.data[DATA_INSTANCE].engine.raw_connection().cursor()
assert util.basic_sanity_check(cursor) is True
cursor.execute("DROP TABLE states;")
with pytest.raise... | [
"def",
"test_basic_sanity_check",
"(",
"hass_recorder",
")",
":",
"hass",
"=",
"hass_recorder",
"(",
")",
"cursor",
"=",
"hass",
".",
"data",
"[",
"DATA_INSTANCE",
"]",
".",
"engine",
".",
"raw_connection",
"(",
")",
".",
"cursor",
"(",
")",
"assert",
"uti... | [
166,
0
] | [
177,
39
] | python | en | ['en', 'en', 'en'] | True |
test_combined_checks | (hass_recorder) | Run Checks on the open database. | Run Checks on the open database. | def test_combined_checks(hass_recorder):
"""Run Checks on the open database."""
hass = hass_recorder()
db_integrity_check = False
cursor = hass.data[DATA_INSTANCE].engine.raw_connection().cursor()
assert (
util.run_checks_on_open_db("fake_db_path", cursor, db_integrity_check) is None
... | [
"def",
"test_combined_checks",
"(",
"hass_recorder",
")",
":",
"hass",
"=",
"hass_recorder",
"(",
")",
"db_integrity_check",
"=",
"False",
"cursor",
"=",
"hass",
".",
"data",
"[",
"DATA_INSTANCE",
"]",
".",
"engine",
".",
"raw_connection",
"(",
")",
".",
"cu... | [
180,
0
] | [
209,
78
] | python | en | ['en', 'no', 'en'] | True |
_corrupt_db_file | (test_db_file) | Corrupt an sqlite3 database file. | Corrupt an sqlite3 database file. | def _corrupt_db_file(test_db_file):
"""Corrupt an sqlite3 database file."""
f = open(test_db_file, "a")
f.write("I am a corrupt db")
f.close() | [
"def",
"_corrupt_db_file",
"(",
"test_db_file",
")",
":",
"f",
"=",
"open",
"(",
"test_db_file",
",",
"\"a\"",
")",
"f",
".",
"write",
"(",
"\"I am a corrupt db\"",
")",
"f",
".",
"close",
"(",
")"
] | [
212,
0
] | [
216,
13
] | python | da | ['en', 'da', 'it'] | False |
_validate_edit_permission | (
hass: HomeAssistantType, context: ContextType, entity_id: str
) | Use for validating user control permissions. | Use for validating user control permissions. | async def _validate_edit_permission(
hass: HomeAssistantType, context: ContextType, entity_id: str
) -> None:
"""Use for validating user control permissions."""
splited = split_entity_id(entity_id)
if splited[0] != SWITCH_DOMAIN or not splited[1].startswith(DOMAIN):
raise Unauthorized(context=co... | [
"async",
"def",
"_validate_edit_permission",
"(",
"hass",
":",
"HomeAssistantType",
",",
"context",
":",
"ContextType",
",",
"entity_id",
":",
"str",
")",
"->",
"None",
":",
"splited",
"=",
"split_entity_id",
"(",
"entity_id",
")",
"if",
"splited",
"[",
"0",
... | [
80,
0
] | [
91,
88
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistantType, config: Dict) | Set up the switcher component. | Set up the switcher component. | async def async_setup(hass: HomeAssistantType, config: Dict) -> bool:
"""Set up the switcher component."""
phone_id = config[DOMAIN][CONF_PHONE_ID]
device_id = config[DOMAIN][CONF_DEVICE_ID]
device_password = config[DOMAIN][CONF_DEVICE_PASSWORD]
v2bridge = SwitcherV2Bridge(hass.loop, phone_id, dev... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"Dict",
")",
"->",
"bool",
":",
"phone_id",
"=",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_PHONE_ID",
"]",
"device_id",
"=",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF... | [
94,
0
] | [
183,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_auth_view | (hass: HomeAssistantType, user: User) | Auth setup. | Auth setup. | def async_setup_auth_view(hass: HomeAssistantType, user: User):
"""Auth setup."""
hassio_auth = HassIOAuth(hass, user)
hassio_password_reset = HassIOPasswordReset(hass, user)
hass.http.register_view(hassio_auth)
hass.http.register_view(hassio_password_reset) | [
"def",
"async_setup_auth_view",
"(",
"hass",
":",
"HomeAssistantType",
",",
"user",
":",
"User",
")",
":",
"hassio_auth",
"=",
"HassIOAuth",
"(",
"hass",
",",
"user",
")",
"hassio_password_reset",
"=",
"HassIOPasswordReset",
"(",
"hass",
",",
"user",
")",
"has... | [
25,
0
] | [
31,
50
] | python | en | ['en', 'haw', 'en'] | False |
HassIOBaseAuth.__init__ | (self, hass: HomeAssistantType, user: User) | Initialize WebView. | Initialize WebView. | def __init__(self, hass: HomeAssistantType, user: User):
"""Initialize WebView."""
self.hass = hass
self.user = user | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
",",
"user",
":",
"User",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"user",
"=",
"user"
] | [
37,
4
] | [
40,
24
] | python | en | ['en', 'en', 'it'] | False |
HassIOBaseAuth._check_access | (self, request: web.Request) | Check if this call is from Supervisor. | Check if this call is from Supervisor. | def _check_access(self, request: web.Request):
"""Check if this call is from Supervisor."""
# Check caller IP
hassio_ip = os.environ["HASSIO"].split(":")[0]
if ip_address(request.transport.get_extra_info("peername")[0]) != ip_address(
hassio_ip
):
_LOGGER.... | [
"def",
"_check_access",
"(",
"self",
",",
"request",
":",
"web",
".",
"Request",
")",
":",
"# Check caller IP",
"hassio_ip",
"=",
"os",
".",
"environ",
"[",
"\"HASSIO\"",
"]",
".",
"split",
"(",
"\":\"",
")",
"[",
"0",
"]",
"if",
"ip_address",
"(",
"re... | [
42,
4
] | [
55,
36
] | python | en | ['en', 'en', 'en'] | True |
HassIOAuth.post | (self, request, data) | Handle auth requests. | Handle auth requests. | async def post(self, request, data):
"""Handle auth requests."""
self._check_access(request)
provider = auth_ha.async_get_provider(request.app["hass"])
try:
await provider.async_validate_login(
data[ATTR_USERNAME], data[ATTR_PASSWORD]
)
ex... | [
"async",
"def",
"post",
"(",
"self",
",",
"request",
",",
"data",
")",
":",
"self",
".",
"_check_access",
"(",
"request",
")",
"provider",
"=",
"auth_ha",
".",
"async_get_provider",
"(",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
")",
"try",
":",
"aw... | [
74,
4
] | [
86,
43
] | python | en | ['de', 'en', 'en'] | True |
HassIOPasswordReset.post | (self, request, data) | Handle password reset requests. | Handle password reset requests. | async def post(self, request, data):
"""Handle password reset requests."""
self._check_access(request)
provider = auth_ha.async_get_provider(request.app["hass"])
try:
await provider.async_change_password(
data[ATTR_USERNAME], data[ATTR_PASSWORD]
)... | [
"async",
"def",
"post",
"(",
"self",
",",
"request",
",",
"data",
")",
":",
"self",
".",
"_check_access",
"(",
"request",
")",
"provider",
"=",
"auth_ha",
".",
"async_get_provider",
"(",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
")",
"try",
":",
"aw... | [
104,
4
] | [
116,
43
] | python | en | ['fr', 'nl', 'en'] | False |
test_setup | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test setup with basic config. | Test setup with basic config. | async def test_setup(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test setup with basic config."""
await setup_integration(hass, aioclient_mock)
entity_registry = await hass.helpers.entity_registry.async_get_registry()
main = entity_registry.async_get(MAIN_ENTITY_ID)
... | [
"async",
"def",
"test_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
")",
"entity_registry",
"=",
"await",
"hass",
".",
"... | [
76,
0
] | [
88,
40
] | python | en | ['en', 'zu', 'en'] | True |
test_idle_setup | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test setup with idle device. | Test setup with idle device. | async def test_idle_setup(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test setup with idle device."""
await setup_integration(hass, aioclient_mock, power=False)
state = hass.states.get(MAIN_ENTITY_ID)
assert state.state == STATE_STANDBY | [
"async",
"def",
"test_idle_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
",",
"power",
"=",
"False",
")",
"state",
"=",
... | [
91,
0
] | [
98,
39
] | python | en | ['en', 'haw', 'en'] | True |
test_tv_setup | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test Roku TV setup. | Test Roku TV setup. | async def test_tv_setup(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test Roku TV setup."""
await setup_integration(
hass,
aioclient_mock,
device="rokutv",
app="tvinput-dtv",
host=TV_HOST,
unique_id=TV_SERIAL,
)
entity_r... | [
"async",
"def",
"test_tv_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
",",
"device",
"=",
"\"rokutv\"",
",",
"app",
"="... | [
101,
0
] | [
120,
36
] | python | en | ['en', 'haw', 'en'] | True |
test_availability | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test entity availability. | Test entity availability. | async def test_availability(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test entity availability."""
now = dt_util.utcnow()
future = now + timedelta(minutes=1)
with patch("homeassistant.util.dt.utcnow", return_value=now):
await setup_integration(hass, aioclie... | [
"async",
"def",
"test_availability",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"future",
"=",
"now",
"+",
"timedelta",
"(",
"minutes",
"="... | [
123,
0
] | [
145,
66
] | python | en | ['en', 'ga', 'en'] | True |
test_supported_features | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test supported features. | Test supported features. | async def test_supported_features(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test supported features."""
await setup_integration(hass, aioclient_mock)
# Features supported for Rokus
state = hass.states.get(MAIN_ENTITY_ID)
assert (
SUPPORT_PREVIOUS_TRACK
... | [
"async",
"def",
"test_supported_features",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
")",
"# Features supported for Rokus",
"state",... | [
148,
0
] | [
169,
5
] | 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.