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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
SmartThingsThermostat.hvac_action | (self) | Return the current running hvac operation if supported. | Return the current running hvac operation if supported. | def hvac_action(self) -> str | None:
"""Return the current running hvac operation if supported."""
return OPERATING_STATE_TO_ACTION.get(
self._device.status.thermostat_operating_state
) | [
"def",
"hvac_action",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"OPERATING_STATE_TO_ACTION",
".",
"get",
"(",
"self",
".",
"_device",
".",
"status",
".",
"thermostat_operating_state",
")"
] | [
277,
4
] | [
281,
9
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.hvac_mode | (self) | Return current operation ie. heat, cool, idle. | Return current operation ie. heat, cool, idle. | def hvac_mode(self):
"""Return current operation ie. heat, cool, idle."""
return self._hvac_mode | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_hvac_mode"
] | [
284,
4
] | [
286,
30
] | python | en | ['nl', 'en', 'en'] | True |
SmartThingsThermostat.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"
] | [
289,
4
] | [
291,
31
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.supported_features | (self) | Return the supported features. | Return the supported features. | def supported_features(self):
"""Return the supported features."""
return self._supported_features | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"self",
".",
"_supported_features"
] | [
294,
4
] | [
296,
39
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.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."""
if self.hvac_mode == HVAC_MODE_COOL:
return self._device.status.cooling_setpoint
if self.hvac_mode == HVAC_MODE_HEAT:
return self._device.status.heating_setpoint
return None | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_COOL",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"cooling_setpoint",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT",
":",
"return",
... | [
299,
4
] | [
305,
19
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.target_temperature_high | (self) | Return the highbound target temperature we try to reach. | Return the highbound target temperature we try to reach. | def target_temperature_high(self):
"""Return the highbound target temperature we try to reach."""
if self.hvac_mode == HVAC_MODE_HEAT_COOL:
return self._device.status.cooling_setpoint
return None | [
"def",
"target_temperature_high",
"(",
"self",
")",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT_COOL",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"cooling_setpoint",
"return",
"None"
] | [
308,
4
] | [
312,
19
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.target_temperature_low | (self) | Return the lowbound target temperature we try to reach. | Return the lowbound target temperature we try to reach. | def target_temperature_low(self):
"""Return the lowbound target temperature we try to reach."""
if self.hvac_mode == HVAC_MODE_HEAT_COOL:
return self._device.status.heating_setpoint
return None | [
"def",
"target_temperature_low",
"(",
"self",
")",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT_COOL",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"heating_setpoint",
"return",
"None"
] | [
315,
4
] | [
319,
19
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsThermostat.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
return UNIT_MAP.get(self._device.status.attributes[Attribute.temperature].unit) | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"UNIT_MAP",
".",
"get",
"(",
"self",
".",
"_device",
".",
"status",
".",
"attributes",
"[",
"Attribute",
".",
"temperature",
"]",
".",
"unit",
")"
] | [
322,
4
] | [
324,
87
] | python | en | ['en', 'la', 'en'] | True |
SmartThingsAirConditioner.__init__ | (self, device) | Init the class. | Init the class. | def __init__(self, device):
"""Init the class."""
super().__init__(device)
self._hvac_modes = None | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
")",
"self",
".",
"_hvac_modes",
"=",
"None"
] | [
330,
4
] | [
333,
31
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsAirConditioner.async_set_fan_mode | (self, fan_mode) | Set new target fan mode. | Set new target fan mode. | async def async_set_fan_mode(self, fan_mode):
"""Set new target fan mode."""
await self._device.set_fan_mode(fan_mode, set_status=True)
# State is set optimistically in the command above, therefore update
# the entity state ahead of receiving the confirming push updates
self.asyn... | [
"async",
"def",
"async_set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
":",
"await",
"self",
".",
"_device",
".",
"set_fan_mode",
"(",
"fan_mode",
",",
"set_status",
"=",
"True",
")",
"# State is set optimistically in the command above, therefore update",
"# the entit... | [
335,
4
] | [
340,
35
] | python | en | ['sv', 'fy', 'en'] | False |
SmartThingsAirConditioner.async_set_hvac_mode | (self, hvac_mode) | Set new target operation mode. | Set new target operation mode. | async def async_set_hvac_mode(self, hvac_mode):
"""Set new target operation mode."""
if hvac_mode == HVAC_MODE_OFF:
await self.async_turn_off()
return
tasks = []
# Turn on the device if it's off before setting mode.
if not self._device.status.switch:
... | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"await",
"self",
".",
"async_turn_off",
"(",
")",
"return",
"tasks",
"=",
"[",
"]",
"# Turn on the device if it's off before setting mode."... | [
342,
4
] | [
359,
35
] | python | en | ['nl', 'en', 'en'] | True |
SmartThingsAirConditioner.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
tasks = []
# operation mode
operation_mode = kwargs.get(ATTR_HVAC_MODE)
if operation_mode:
if operation_mode == HVAC_MODE_OFF:
tasks.append(self._device.switch_off(set_s... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"tasks",
"=",
"[",
"]",
"# operation mode",
"operation_mode",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_HVAC_MODE",
")",
"if",
"operation_mode",
":",
"if",
"operation_mode",
... | [
361,
4
] | [
380,
35
] | python | en | ['en', 'ca', 'en'] | True |
SmartThingsAirConditioner.async_turn_on | (self) | Turn device on. | Turn device on. | async def async_turn_on(self):
"""Turn device on."""
await self._device.switch_on(set_status=True)
# State is set optimistically in the command above, therefore update
# the entity state ahead of receiving the confirming push updates
self.async_write_ha_state() | [
"async",
"def",
"async_turn_on",
"(",
"self",
")",
":",
"await",
"self",
".",
"_device",
".",
"switch_on",
"(",
"set_status",
"=",
"True",
")",
"# State is set optimistically in the command above, therefore update",
"# the entity state ahead of receiving the confirming push upd... | [
382,
4
] | [
387,
35
] | python | en | ['es', 'en', 'en'] | True |
SmartThingsAirConditioner.async_turn_off | (self) | Turn device off. | Turn device off. | async def async_turn_off(self):
"""Turn device off."""
await self._device.switch_off(set_status=True)
# State is set optimistically in the command above, therefore update
# the entity state ahead of receiving the confirming push updates
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
")",
":",
"await",
"self",
".",
"_device",
".",
"switch_off",
"(",
"set_status",
"=",
"True",
")",
"# State is set optimistically in the command above, therefore update",
"# the entity state ahead of receiving the confirming push u... | [
389,
4
] | [
394,
35
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsAirConditioner.async_update | (self) | Update the calculated fields of the AC. | Update the calculated fields of the AC. | async def async_update(self):
"""Update the calculated fields of the AC."""
modes = {HVAC_MODE_OFF}
for mode in self._device.status.supported_ac_modes:
state = AC_MODE_TO_STATE.get(mode)
if state is not None:
modes.add(state)
else:
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"modes",
"=",
"{",
"HVAC_MODE_OFF",
"}",
"for",
"mode",
"in",
"self",
".",
"_device",
".",
"status",
".",
"supported_ac_modes",
":",
"state",
"=",
"AC_MODE_TO_STATE",
".",
"get",
"(",
"mode",
")",
"i... | [
396,
4
] | [
410,
38
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsAirConditioner.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._device.status.temperature | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"temperature"
] | [
413,
4
] | [
415,
46
] | python | en | ['en', 'la', 'en'] | True |
SmartThingsAirConditioner.extra_state_attributes | (self) |
Return device specific state attributes.
Include attributes from the Demand Response Load Control (drlc)
and Power Consumption capabilities.
|
Return device specific state attributes. | def extra_state_attributes(self):
"""
Return device specific state attributes.
Include attributes from the Demand Response Load Control (drlc)
and Power Consumption capabilities.
"""
attributes = [
"drlc_status_duration",
"drlc_status_level",
... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"attributes",
"=",
"[",
"\"drlc_status_duration\"",
",",
"\"drlc_status_level\"",
",",
"\"drlc_status_start\"",
",",
"\"drlc_status_override\"",
",",
"\"power_consumption_start\"",
",",
"\"power_consumption_power\"",
","... | [
418,
4
] | [
440,
31
] | python | en | ['en', 'error', 'th'] | False |
SmartThingsAirConditioner.fan_mode | (self) | Return the fan setting. | Return the fan setting. | def fan_mode(self):
"""Return the fan setting."""
return self._device.status.fan_mode | [
"def",
"fan_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"fan_mode"
] | [
443,
4
] | [
445,
43
] | python | en | ['en', 'fy', 'en'] | True |
SmartThingsAirConditioner.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._device.status.supported_ac_fan_modes | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"supported_ac_fan_modes"
] | [
448,
4
] | [
450,
57
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsAirConditioner.hvac_mode | (self) | Return current operation ie. heat, cool, idle. | Return current operation ie. heat, cool, idle. | def hvac_mode(self):
"""Return current operation ie. heat, cool, idle."""
if not self._device.status.switch:
return HVAC_MODE_OFF
return AC_MODE_TO_STATE.get(self._device.status.air_conditioner_mode) | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_device",
".",
"status",
".",
"switch",
":",
"return",
"HVAC_MODE_OFF",
"return",
"AC_MODE_TO_STATE",
".",
"get",
"(",
"self",
".",
"_device",
".",
"status",
".",
"air_conditioner_mode",
... | [
453,
4
] | [
457,
77
] | python | en | ['nl', 'en', 'en'] | True |
SmartThingsAirConditioner.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"
] | [
460,
4
] | [
462,
31
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsAirConditioner.supported_features | (self) | Return the supported features. | Return the supported features. | def supported_features(self):
"""Return the supported features."""
return SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_TARGET_TEMPERATURE",
"|",
"SUPPORT_FAN_MODE"
] | [
465,
4
] | [
467,
60
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsAirConditioner.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._device.status.cooling_setpoint | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"status",
".",
"cooling_setpoint"
] | [
470,
4
] | [
472,
51
] | python | en | ['en', 'en', 'en'] | True |
SmartThingsAirConditioner.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
return UNIT_MAP.get(self._device.status.attributes[Attribute.temperature].unit) | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"UNIT_MAP",
".",
"get",
"(",
"self",
".",
"_device",
".",
"status",
".",
"attributes",
"[",
"Attribute",
".",
"temperature",
"]",
".",
"unit",
")"
] | [
475,
4
] | [
477,
87
] | python | en | ['en', 'la', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Selectors from a config entry. | Set up the Selectors from a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Selectors from a config entry."""
if not config_entry.data[CONF_FLOW_TYPE] == CONF_DEVICE:
return
entities = []
model = config_entry.data[CONF_MODEL]
device = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVI... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"if",
"not",
"config_entry",
".",
"data",
"[",
"CONF_FLOW_TYPE",
"]",
"==",
"CONF_DEVICE",
":",
"return",
"entities",
"=",
"[",
"]",
"model",
"=",
"co... | [
69,
0
] | [
114,
32
] | python | en | ['en', 'en', 'en'] | True |
XiaomiSelector.__init__ | (self, name, device, entry, unique_id, coordinator, description) | Initialize the generic Xiaomi attribute selector. | Initialize the generic Xiaomi attribute selector. | def __init__(self, name, device, entry, unique_id, coordinator, description):
"""Initialize the generic Xiaomi attribute selector."""
super().__init__(name, device, entry, unique_id, coordinator)
self._attr_options = list(description.options)
self.entity_description = description | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"device",
",",
"entry",
",",
"unique_id",
",",
"coordinator",
",",
"description",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"name",
",",
"device",
",",
"entry",
",",
"unique_id",
",",
"coordina... | [
120,
4
] | [
124,
45
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifierSelector.__init__ | (self, name, device, entry, unique_id, coordinator, description) | Initialize the plug switch. | Initialize the plug switch. | def __init__(self, name, device, entry, unique_id, coordinator, description):
"""Initialize the plug switch."""
super().__init__(name, device, entry, unique_id, coordinator, description)
self._current_led_brightness = self._extract_value_from_attribute(
self.coordinator.data, self.en... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"device",
",",
"entry",
",",
"unique_id",
",",
"coordinator",
",",
"description",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"name",
",",
"device",
",",
"entry",
",",
"unique_id",
",",
"coordina... | [
138,
4
] | [
143,
9
] | python | en | ['en', 'pl', 'en'] | True |
XiaomiAirHumidifierSelector._handle_coordinator_update | (self) | Fetch state from the device. | Fetch state from the device. | def _handle_coordinator_update(self):
"""Fetch state from the device."""
self._current_led_brightness = self._extract_value_from_attribute(
self.coordinator.data, self.entity_description.key
)
self.async_write_ha_state() | [
"def",
"_handle_coordinator_update",
"(",
"self",
")",
":",
"self",
".",
"_current_led_brightness",
"=",
"self",
".",
"_extract_value_from_attribute",
"(",
"self",
".",
"coordinator",
".",
"data",
",",
"self",
".",
"entity_description",
".",
"key",
")",
"self",
... | [
146,
4
] | [
151,
35
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifierSelector.current_option | (self) | Return the current option. | Return the current option. | def current_option(self):
"""Return the current option."""
return self.led_brightness.lower() | [
"def",
"current_option",
"(",
"self",
")",
":",
"return",
"self",
".",
"led_brightness",
".",
"lower",
"(",
")"
] | [
154,
4
] | [
156,
42
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifierSelector.async_select_option | (self, option: str) | Set an option of the miio device. | Set an option of the miio device. | async def async_select_option(self, option: str) -> None:
"""Set an option of the miio device."""
await self.async_set_led_brightness(option.title()) | [
"async",
"def",
"async_select_option",
"(",
"self",
",",
"option",
":",
"str",
")",
"->",
"None",
":",
"await",
"self",
".",
"async_set_led_brightness",
"(",
"option",
".",
"title",
"(",
")",
")"
] | [
158,
4
] | [
160,
59
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifierSelector.led_brightness | (self) | Return the current led brightness. | Return the current led brightness. | def led_brightness(self):
"""Return the current led brightness."""
return LED_BRIGHTNESS_REVERSE_MAP.get(self._current_led_brightness) | [
"def",
"led_brightness",
"(",
"self",
")",
":",
"return",
"LED_BRIGHTNESS_REVERSE_MAP",
".",
"get",
"(",
"self",
".",
"_current_led_brightness",
")"
] | [
163,
4
] | [
165,
75
] | python | en | ['en', 'bg', 'en'] | True |
XiaomiAirHumidifierSelector.async_set_led_brightness | (self, brightness: str) | Set the led brightness. | Set the led brightness. | async def async_set_led_brightness(self, brightness: str):
"""Set the led brightness."""
if await self._try_command(
"Setting the led brightness of the miio device failed.",
self._device.set_led_brightness,
AirhumidifierLedBrightness(LED_BRIGHTNESS_MAP[brightness]),
... | [
"async",
"def",
"async_set_led_brightness",
"(",
"self",
",",
"brightness",
":",
"str",
")",
":",
"if",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting the led brightness of the miio device failed.\"",
",",
"self",
".",
"_device",
".",
"set_led_brightness",
",",... | [
167,
4
] | [
175,
39
] | python | en | ['en', 'zu', 'en'] | True |
XiaomiAirHumidifierMiotSelector.led_brightness | (self) | Return the current led brightness. | Return the current led brightness. | def led_brightness(self):
"""Return the current led brightness."""
return LED_BRIGHTNESS_REVERSE_MAP_HUMIDIFIER_MIOT.get(
self._current_led_brightness
) | [
"def",
"led_brightness",
"(",
"self",
")",
":",
"return",
"LED_BRIGHTNESS_REVERSE_MAP_HUMIDIFIER_MIOT",
".",
"get",
"(",
"self",
".",
"_current_led_brightness",
")"
] | [
182,
4
] | [
186,
9
] | python | en | ['en', 'bg', 'en'] | True |
XiaomiAirHumidifierMiotSelector.async_set_led_brightness | (self, brightness: str) | Set the led brightness. | Set the led brightness. | async def async_set_led_brightness(self, brightness: str) -> None:
"""Set the led brightness."""
if await self._try_command(
"Setting the led brightness of the miio device failed.",
self._device.set_led_brightness,
AirhumidifierMiotLedBrightness(
LED_B... | [
"async",
"def",
"async_set_led_brightness",
"(",
"self",
",",
"brightness",
":",
"str",
")",
"->",
"None",
":",
"if",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting the led brightness of the miio device failed.\"",
",",
"self",
".",
"_device",
".",
"set_led_b... | [
188,
4
] | [
200,
39
] | python | en | ['en', 'zu', 'en'] | True |
XiaomiAirPurifierSelector.async_set_led_brightness | (self, brightness: str) | Set the led brightness. | Set the led brightness. | async def async_set_led_brightness(self, brightness: str) -> None:
"""Set the led brightness."""
if await self._try_command(
"Setting the led brightness of the miio device failed.",
self._device.set_led_brightness,
AirpurifierLedBrightness(LED_BRIGHTNESS_MAP[brightnes... | [
"async",
"def",
"async_set_led_brightness",
"(",
"self",
",",
"brightness",
":",
"str",
")",
"->",
"None",
":",
"if",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting the led brightness of the miio device failed.\"",
",",
"self",
".",
"_device",
".",
"set_led_b... | [
206,
4
] | [
214,
39
] | python | en | ['en', 'zu', 'en'] | True |
XiaomiAirPurifierMiotSelector.async_set_led_brightness | (self, brightness: str) | Set the led brightness. | Set the led brightness. | async def async_set_led_brightness(self, brightness: str) -> None:
"""Set the led brightness."""
if await self._try_command(
"Setting the led brightness of the miio device failed.",
self._device.set_led_brightness,
AirpurifierMiotLedBrightness(LED_BRIGHTNESS_MAP[brigh... | [
"async",
"def",
"async_set_led_brightness",
"(",
"self",
",",
"brightness",
":",
"str",
")",
"->",
"None",
":",
"if",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting the led brightness of the miio device failed.\"",
",",
"self",
".",
"_device",
".",
"set_led_b... | [
220,
4
] | [
228,
39
] | python | en | ['en', 'zu', 'en'] | True |
XiaomiFanSelector.async_set_led_brightness | (self, brightness: str) | Set the led brightness. | Set the led brightness. | async def async_set_led_brightness(self, brightness: str) -> None:
"""Set the led brightness."""
if await self._try_command(
"Setting the led brightness of the miio device failed.",
self._device.set_led_brightness,
FanLedBrightness(LED_BRIGHTNESS_MAP[brightness]),
... | [
"async",
"def",
"async_set_led_brightness",
"(",
"self",
",",
"brightness",
":",
"str",
")",
"->",
"None",
":",
"if",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting the led brightness of the miio device failed.\"",
",",
"self",
".",
"_device",
".",
"set_led_b... | [
234,
4
] | [
242,
39
] | python | en | ['en', 'zu', 'en'] | True |
XiaomiAirFreshSelector.async_set_led_brightness | (self, brightness: str) | Set the led brightness. | Set the led brightness. | async def async_set_led_brightness(self, brightness: str) -> None:
"""Set the led brightness."""
if await self._try_command(
"Setting the led brightness of the miio device failed.",
self._device.set_led_brightness,
AirfreshLedBrightness(LED_BRIGHTNESS_MAP[brightness])... | [
"async",
"def",
"async_set_led_brightness",
"(",
"self",
",",
"brightness",
":",
"str",
")",
"->",
"None",
":",
"if",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting the led brightness of the miio device failed.\"",
",",
"self",
".",
"_device",
".",
"set_led_b... | [
248,
4
] | [
256,
39
] | python | en | ['en', 'zu', 'en'] | True |
Factory.get_wheel_cache_entry | (self, link, name) | Look up the link in the wheel cache.
If ``preparer.require_hashes`` is True, don't use the wheel cache,
because cached wheels, always built locally, have different hashes
than the files downloaded from the index server and thus throw false
hash mismatches. Furthermore, cached wheels at ... | Look up the link in the wheel cache. | def get_wheel_cache_entry(self, link, name):
# type: (Link, Optional[str]) -> Optional[CacheEntry]
"""Look up the link in the wheel cache.
If ``preparer.require_hashes`` is True, don't use the wheel cache,
because cached wheels, always built locally, have different hashes
than t... | [
"def",
"get_wheel_cache_entry",
"(",
"self",
",",
"link",
",",
"name",
")",
":",
"# type: (Link, Optional[str]) -> Optional[CacheEntry]",
"if",
"self",
".",
"_wheel_cache",
"is",
"None",
"or",
"self",
".",
"preparer",
".",
"require_hashes",
":",
"return",
"None",
... | [
295,
4
] | [
311,
9
] | python | en | ['en', 'en', 'en'] | True |
async_describe_on_off_states | (
hass: HomeAssistant, registry: GroupIntegrationRegistry
) | Describe group on off states. | Describe group on off states. | def async_describe_on_off_states(
hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None:
"""Describe group on off states."""
registry.on_off_states(
{
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_CUSTOM_BYPASS,
STATE_ALARM_ARMED_HOME,
STATE_AL... | [
"def",
"async_describe_on_off_states",
"(",
"hass",
":",
"HomeAssistant",
",",
"registry",
":",
"GroupIntegrationRegistry",
")",
"->",
"None",
":",
"registry",
".",
"on_off_states",
"(",
"{",
"STATE_ALARM_ARMED_AWAY",
",",
"STATE_ALARM_ARMED_CUSTOM_BYPASS",
",",
"STATE_... | [
17,
0
] | [
31,
5
] | python | en | ['en', 'en', 'en'] | True |
player | (hass, request) | Return a media player. | Return a media player. | def player(hass, request):
"""Return a media player."""
return request.param(hass) | [
"def",
"player",
"(",
"hass",
",",
"request",
")",
":",
"return",
"request",
".",
"param",
"(",
"hass",
")"
] | [
142,
0
] | [
144,
30
] | python | en | ['en', 'cy', 'en'] | True |
test_volume_up | (player) | Test the volume_up and set volume methods. | Test the volume_up and set volume methods. | async def test_volume_up(player):
"""Test the volume_up and set volume methods."""
assert player.volume_level == 0
await player.async_set_volume_level(0.5)
assert player.volume_level == 0.5
await player.async_volume_up()
assert player.volume_level == 0.6 | [
"async",
"def",
"test_volume_up",
"(",
"player",
")",
":",
"assert",
"player",
".",
"volume_level",
"==",
"0",
"await",
"player",
".",
"async_set_volume_level",
"(",
"0.5",
")",
"assert",
"player",
".",
"volume_level",
"==",
"0.5",
"await",
"player",
".",
"a... | [
147,
0
] | [
153,
37
] | python | en | ['en', 'en', 'en'] | True |
test_volume_down | (player) | Test the volume_down and set volume methods. | Test the volume_down and set volume methods. | async def test_volume_down(player):
"""Test the volume_down and set volume methods."""
assert player.volume_level == 0
await player.async_set_volume_level(0.5)
assert player.volume_level == 0.5
await player.async_volume_down()
assert player.volume_level == 0.4 | [
"async",
"def",
"test_volume_down",
"(",
"player",
")",
":",
"assert",
"player",
".",
"volume_level",
"==",
"0",
"await",
"player",
".",
"async_set_volume_level",
"(",
"0.5",
")",
"assert",
"player",
".",
"volume_level",
"==",
"0.5",
"await",
"player",
".",
... | [
156,
0
] | [
162,
37
] | python | en | ['en', 'en', 'en'] | True |
test_media_play_pause | (player) | Test the media_play_pause method. | Test the media_play_pause method. | async def test_media_play_pause(player):
"""Test the media_play_pause method."""
assert player.state == STATE_OFF
await player.async_media_play_pause()
assert player.state == STATE_PLAYING
await player.async_media_play_pause()
assert player.state == STATE_PAUSED | [
"async",
"def",
"test_media_play_pause",
"(",
"player",
")",
":",
"assert",
"player",
".",
"state",
"==",
"STATE_OFF",
"await",
"player",
".",
"async_media_play_pause",
"(",
")",
"assert",
"player",
".",
"state",
"==",
"STATE_PLAYING",
"await",
"player",
".",
... | [
165,
0
] | [
171,
39
] | python | en | ['en', 'et', 'en'] | True |
test_turn_on_off | (player) | Test the turn on and turn off methods. | Test the turn on and turn off methods. | async def test_turn_on_off(player):
"""Test the turn on and turn off methods."""
assert player.state == STATE_OFF
await player.async_turn_on()
assert player.state == STATE_ON
await player.async_turn_off()
assert player.state == STATE_OFF | [
"async",
"def",
"test_turn_on_off",
"(",
"player",
")",
":",
"assert",
"player",
".",
"state",
"==",
"STATE_OFF",
"await",
"player",
".",
"async_turn_on",
"(",
")",
"assert",
"player",
".",
"state",
"==",
"STATE_ON",
"await",
"player",
".",
"async_turn_off",
... | [
174,
0
] | [
180,
36
] | python | en | ['en', 'en', 'en'] | True |
test_toggle | (player) | Test the toggle method. | Test the toggle method. | async def test_toggle(player):
"""Test the toggle method."""
assert player.state == STATE_OFF
await player.async_toggle()
assert player.state == STATE_ON
await player.async_toggle()
assert player.state == STATE_OFF | [
"async",
"def",
"test_toggle",
"(",
"player",
")",
":",
"assert",
"player",
".",
"state",
"==",
"STATE_OFF",
"await",
"player",
".",
"async_toggle",
"(",
")",
"assert",
"player",
".",
"state",
"==",
"STATE_ON",
"await",
"player",
".",
"async_toggle",
"(",
... | [
183,
0
] | [
189,
36
] | python | en | ['en', 'et', 'en'] | True |
ExtendedMediaPlayer.__init__ | (self, hass) | Initialize the test media player. | Initialize the test media player. | def __init__(self, hass):
"""Initialize the test media player."""
self.hass = hass
self._volume = 0
self._state = STATE_OFF | [
"def",
"__init__",
"(",
"self",
",",
"hass",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"_volume",
"=",
"0",
"self",
".",
"_state",
"=",
"STATE_OFF"
] | [
16,
4
] | [
20,
31
] | python | en | ['en', 'en', 'en'] | True |
ExtendedMediaPlayer.state | (self) | State of the player. | State of the player. | def state(self):
"""State of the player."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
23,
4
] | [
25,
26
] | python | en | ['en', 'en', 'en'] | True |
ExtendedMediaPlayer.volume_level | (self) | Volume level of the media player (0..1). | Volume level of the media player (0..1). | def volume_level(self):
"""Volume level of the media player (0..1)."""
return self._volume | [
"def",
"volume_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_volume"
] | [
28,
4
] | [
30,
27
] | python | en | ['en', 'en', 'en'] | True |
ExtendedMediaPlayer.supported_features | (self) | Flag media player features that are supported. | Flag media player features that are supported. | def supported_features(self):
"""Flag media player features that are supported."""
return (
mp.const.SUPPORT_VOLUME_SET
| mp.const.SUPPORT_VOLUME_STEP
| mp.const.SUPPORT_PLAY
| mp.const.SUPPORT_PAUSE
| mp.const.SUPPORT_TURN_OFF
| mp... | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"(",
"mp",
".",
"const",
".",
"SUPPORT_VOLUME_SET",
"|",
"mp",
".",
"const",
".",
"SUPPORT_VOLUME_STEP",
"|",
"mp",
".",
"const",
".",
"SUPPORT_PLAY",
"|",
"mp",
".",
"const",
".",
"SUPPORT_PAUS... | [
33,
4
] | [
42,
9
] | python | en | ['en', 'en', 'en'] | True |
ExtendedMediaPlayer.set_volume_level | (self, volume) | Set volume level, range 0..1. | Set volume level, range 0..1. | def set_volume_level(self, volume):
"""Set volume level, range 0..1."""
self._volume = volume | [
"def",
"set_volume_level",
"(",
"self",
",",
"volume",
")",
":",
"self",
".",
"_volume",
"=",
"volume"
] | [
44,
4
] | [
46,
29
] | python | en | ['fr', 'zu', 'en'] | False |
ExtendedMediaPlayer.volume_up | (self) | Turn volume up for media player. | Turn volume up for media player. | def volume_up(self):
"""Turn volume up for media player."""
if self.volume_level < 1:
self.set_volume_level(min(1, self.volume_level + 0.1)) | [
"def",
"volume_up",
"(",
"self",
")",
":",
"if",
"self",
".",
"volume_level",
"<",
"1",
":",
"self",
".",
"set_volume_level",
"(",
"min",
"(",
"1",
",",
"self",
".",
"volume_level",
"+",
"0.1",
")",
")"
] | [
48,
4
] | [
51,
66
] | python | en | ['en', 'no', 'en'] | True |
ExtendedMediaPlayer.volume_down | (self) | Turn volume down for media player. | Turn volume down for media player. | def volume_down(self):
"""Turn volume down for media player."""
if self.volume_level > 0:
self.set_volume_level(max(0, self.volume_level - 0.1)) | [
"def",
"volume_down",
"(",
"self",
")",
":",
"if",
"self",
".",
"volume_level",
">",
"0",
":",
"self",
".",
"set_volume_level",
"(",
"max",
"(",
"0",
",",
"self",
".",
"volume_level",
"-",
"0.1",
")",
")"
] | [
53,
4
] | [
56,
66
] | python | en | ['en', 'en', 'en'] | True |
ExtendedMediaPlayer.media_play | (self) | Play the media player. | Play the media player. | def media_play(self):
"""Play the media player."""
self._state = STATE_PLAYING | [
"def",
"media_play",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"STATE_PLAYING"
] | [
58,
4
] | [
60,
35
] | python | en | ['en', 'en', 'en'] | True |
ExtendedMediaPlayer.media_pause | (self) | Plause the media player. | Plause the media player. | def media_pause(self):
"""Plause the media player."""
self._state = STATE_PAUSED | [
"def",
"media_pause",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"STATE_PAUSED"
] | [
62,
4
] | [
64,
34
] | python | en | ['en', 'en', 'en'] | True |
ExtendedMediaPlayer.media_play_pause | (self) | Play or pause the media player. | Play or pause the media player. | def media_play_pause(self):
"""Play or pause the media player."""
if self._state == STATE_PLAYING:
self._state = STATE_PAUSED
else:
self._state = STATE_PLAYING | [
"def",
"media_play_pause",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
"==",
"STATE_PLAYING",
":",
"self",
".",
"_state",
"=",
"STATE_PAUSED",
"else",
":",
"self",
".",
"_state",
"=",
"STATE_PLAYING"
] | [
66,
4
] | [
71,
39
] | python | en | ['en', 'en', 'en'] | True |
ExtendedMediaPlayer.turn_on | (self) | Turn on state. | Turn on state. | def turn_on(self):
"""Turn on state."""
self._state = STATE_ON | [
"def",
"turn_on",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"STATE_ON"
] | [
73,
4
] | [
75,
30
] | python | en | ['en', 'en', 'en'] | True |
ExtendedMediaPlayer.turn_off | (self) | Turn off state. | Turn off state. | def turn_off(self):
"""Turn off state."""
self._state = STATE_OFF | [
"def",
"turn_off",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"STATE_OFF"
] | [
77,
4
] | [
79,
31
] | python | en | ['en', 'en', 'en'] | True |
ExtendedMediaPlayer.toggle | (self) | Toggle the power on the media player. | Toggle the power on the media player. | def toggle(self):
"""Toggle the power on the media player."""
if self._state in [STATE_OFF, STATE_IDLE]:
self._state = STATE_ON
else:
self._state = STATE_OFF | [
"def",
"toggle",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
"in",
"[",
"STATE_OFF",
",",
"STATE_IDLE",
"]",
":",
"self",
".",
"_state",
"=",
"STATE_ON",
"else",
":",
"self",
".",
"_state",
"=",
"STATE_OFF"
] | [
81,
4
] | [
86,
35
] | python | en | ['en', 'en', 'en'] | True |
SimpleMediaPlayer.__init__ | (self, hass) | Initialize the test media player. | Initialize the test media player. | def __init__(self, hass):
"""Initialize the test media player."""
self.hass = hass
self._volume = 0
self._state = STATE_OFF | [
"def",
"__init__",
"(",
"self",
",",
"hass",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"_volume",
"=",
"0",
"self",
".",
"_state",
"=",
"STATE_OFF"
] | [
92,
4
] | [
96,
31
] | python | en | ['en', 'en', 'en'] | True |
SimpleMediaPlayer.state | (self) | State of the player. | State of the player. | def state(self):
"""State of the player."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
99,
4
] | [
101,
26
] | python | en | ['en', 'en', 'en'] | True |
SimpleMediaPlayer.volume_level | (self) | Volume level of the media player (0..1). | Volume level of the media player (0..1). | def volume_level(self):
"""Volume level of the media player (0..1)."""
return self._volume | [
"def",
"volume_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_volume"
] | [
104,
4
] | [
106,
27
] | python | en | ['en', 'en', 'en'] | True |
SimpleMediaPlayer.supported_features | (self) | Flag media player features that are supported. | Flag media player features that are supported. | def supported_features(self):
"""Flag media player features that are supported."""
return (
mp.const.SUPPORT_VOLUME_SET
| mp.const.SUPPORT_VOLUME_STEP
| mp.const.SUPPORT_PLAY
| mp.const.SUPPORT_PAUSE
| mp.const.SUPPORT_TURN_OFF
| mp... | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"(",
"mp",
".",
"const",
".",
"SUPPORT_VOLUME_SET",
"|",
"mp",
".",
"const",
".",
"SUPPORT_VOLUME_STEP",
"|",
"mp",
".",
"const",
".",
"SUPPORT_PLAY",
"|",
"mp",
".",
"const",
".",
"SUPPORT_PAUS... | [
109,
4
] | [
118,
9
] | python | en | ['en', 'en', 'en'] | True |
SimpleMediaPlayer.set_volume_level | (self, volume) | Set volume level, range 0..1. | Set volume level, range 0..1. | def set_volume_level(self, volume):
"""Set volume level, range 0..1."""
self._volume = volume | [
"def",
"set_volume_level",
"(",
"self",
",",
"volume",
")",
":",
"self",
".",
"_volume",
"=",
"volume"
] | [
120,
4
] | [
122,
29
] | python | en | ['fr', 'zu', 'en'] | False |
SimpleMediaPlayer.media_play | (self) | Play the media player. | Play the media player. | def media_play(self):
"""Play the media player."""
self._state = STATE_PLAYING | [
"def",
"media_play",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"STATE_PLAYING"
] | [
124,
4
] | [
126,
35
] | python | en | ['en', 'en', 'en'] | True |
SimpleMediaPlayer.media_pause | (self) | Plause the media player. | Plause the media player. | def media_pause(self):
"""Plause the media player."""
self._state = STATE_PAUSED | [
"def",
"media_pause",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"STATE_PAUSED"
] | [
128,
4
] | [
130,
34
] | python | en | ['en', 'en', 'en'] | True |
SimpleMediaPlayer.turn_on | (self) | Turn on state. | Turn on state. | def turn_on(self):
"""Turn on state."""
self._state = STATE_ON | [
"def",
"turn_on",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"STATE_ON"
] | [
132,
4
] | [
134,
30
] | python | en | ['en', 'en', 'en'] | True |
SimpleMediaPlayer.turn_off | (self) | Turn off state. | Turn off state. | def turn_off(self):
"""Turn off state."""
self._state = STATE_OFF | [
"def",
"turn_off",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"STATE_OFF"
] | [
136,
4
] | [
138,
31
] | python | en | ['en', 'en', 'en'] | True |
HasOnlyReadOnly.__init__ | (self, bar=None, foo=None, local_vars_configuration=None) | HasOnlyReadOnly - a model defined in OpenAPI | HasOnlyReadOnly - a model defined in OpenAPI | def __init__(self, bar=None, foo=None, local_vars_configuration=None): # noqa: E501
"""HasOnlyReadOnly - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration.get_default_copy()
self.local_vars_configuration = local... | [
"def",
"__init__",
"(",
"self",
",",
"bar",
"=",
"None",
",",
"foo",
"=",
"None",
",",
"local_vars_configuration",
"=",
"None",
")",
":",
"# noqa: E501",
"# noqa: E501",
"if",
"local_vars_configuration",
"is",
"None",
":",
"local_vars_configuration",
"=",
"Confi... | [
44,
4
] | [
57,
26
] | python | en | ['en', 'fy', 'en'] | True |
HasOnlyReadOnly.bar | (self) | Gets the bar of this HasOnlyReadOnly. # noqa: E501
:return: The bar of this HasOnlyReadOnly. # noqa: E501
:rtype: str
| Gets the bar of this HasOnlyReadOnly. # noqa: E501 | def bar(self):
"""Gets the bar of this HasOnlyReadOnly. # noqa: E501
:return: The bar of this HasOnlyReadOnly. # noqa: E501
:rtype: str
"""
return self._bar | [
"def",
"bar",
"(",
"self",
")",
":",
"return",
"self",
".",
"_bar"
] | [
60,
4
] | [
67,
24
] | python | en | ['en', 'en', 'en'] | True |
HasOnlyReadOnly.bar | (self, bar) | Sets the bar of this HasOnlyReadOnly.
:param bar: The bar of this HasOnlyReadOnly. # noqa: E501
:type bar: str
| Sets the bar of this HasOnlyReadOnly. | def bar(self, bar):
"""Sets the bar of this HasOnlyReadOnly.
:param bar: The bar of this HasOnlyReadOnly. # noqa: E501
:type bar: str
"""
self._bar = bar | [
"def",
"bar",
"(",
"self",
",",
"bar",
")",
":",
"self",
".",
"_bar",
"=",
"bar"
] | [
70,
4
] | [
78,
23
] | python | en | ['en', 'en', 'en'] | True |
HasOnlyReadOnly.foo | (self) | Gets the foo of this HasOnlyReadOnly. # noqa: E501
:return: The foo of this HasOnlyReadOnly. # noqa: E501
:rtype: str
| Gets the foo of this HasOnlyReadOnly. # noqa: E501 | def foo(self):
"""Gets the foo of this HasOnlyReadOnly. # noqa: E501
:return: The foo of this HasOnlyReadOnly. # noqa: E501
:rtype: str
"""
return self._foo | [
"def",
"foo",
"(",
"self",
")",
":",
"return",
"self",
".",
"_foo"
] | [
81,
4
] | [
88,
24
] | python | en | ['en', 'en', 'en'] | True |
HasOnlyReadOnly.foo | (self, foo) | Sets the foo of this HasOnlyReadOnly.
:param foo: The foo of this HasOnlyReadOnly. # noqa: E501
:type foo: str
| Sets the foo of this HasOnlyReadOnly. | def foo(self, foo):
"""Sets the foo of this HasOnlyReadOnly.
:param foo: The foo of this HasOnlyReadOnly. # noqa: E501
:type foo: str
"""
self._foo = foo | [
"def",
"foo",
"(",
"self",
",",
"foo",
")",
":",
"self",
".",
"_foo",
"=",
"foo"
] | [
91,
4
] | [
99,
23
] | python | en | ['en', 'en', 'en'] | True |
HasOnlyReadOnly.to_dict | (self, serialize=False) | Returns the model properties as a dict | Returns the model properties as a dict | def to_dict(self, serialize=False):
"""Returns the model properties as a dict"""
result = {}
def convert(x):
if hasattr(x, "to_dict"):
args = inspect.getargspec(x.to_dict).args
if len(args) == 1:
return x.to_dict()
... | [
"def",
"to_dict",
"(",
"self",
",",
"serialize",
"=",
"False",
")",
":",
"result",
"=",
"{",
"}",
"def",
"convert",
"(",
"x",
")",
":",
"if",
"hasattr",
"(",
"x",
",",
"\"to_dict\"",
")",
":",
"args",
"=",
"inspect",
".",
"getargspec",
"(",
"x",
... | [
101,
4
] | [
131,
21
] | python | en | ['en', 'en', 'en'] | True |
HasOnlyReadOnly.to_str | (self) | Returns the string representation of the model | Returns the string representation of the model | def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | [
133,
4
] | [
135,
45
] | python | en | ['en', 'en', 'en'] | True |
HasOnlyReadOnly.__repr__ | (self) | For `print` and `pprint` | For `print` and `pprint` | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | [
137,
4
] | [
139,
28
] | python | en | ['en', 'en', 'en'] | True |
HasOnlyReadOnly.__eq__ | (self, other) | Returns true if both objects are equal | Returns true if both objects are equal | def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, HasOnlyReadOnly):
return False
return self.to_dict() == other.to_dict() | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"HasOnlyReadOnly",
")",
":",
"return",
"False",
"return",
"self",
".",
"to_dict",
"(",
")",
"==",
"other",
".",
"to_dict",
"(",
")"
] | [
141,
4
] | [
146,
48
] | python | en | ['en', 'en', 'en'] | True |
HasOnlyReadOnly.__ne__ | (self, other) | Returns true if both objects are not equal | Returns true if both objects are not equal | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, HasOnlyReadOnly):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"HasOnlyReadOnly",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | [
148,
4
] | [
153,
48
] | python | en | ['en', 'en', 'en'] | True |
TestDanishPig.testDanishPig | (self) | Test DanishPig | Test DanishPig | def testDanishPig(self):
"""Test DanishPig"""
# FIXME: construct object with mandatory attributes with example values
# model = DanishPig() # noqa: E501
pass | [
"def",
"testDanishPig",
"(",
"self",
")",
":",
"# FIXME: construct object with mandatory attributes with example values",
"# model = DanishPig() # noqa: E501",
"pass"
] | [
28,
4
] | [
32,
12
] | python | bg | ['mt', 'bg', 'en'] | False |
SonosEntity.__init__ | (self, speaker: SonosSpeaker) | Initialize a SonosEntity. | Initialize a SonosEntity. | def __init__(self, speaker: SonosSpeaker) -> None:
"""Initialize a SonosEntity."""
self.speaker = speaker | [
"def",
"__init__",
"(",
"self",
",",
"speaker",
":",
"SonosSpeaker",
")",
"->",
"None",
":",
"self",
".",
"speaker",
"=",
"speaker"
] | [
32,
4
] | [
34,
30
] | python | it | ['it', 'pl', 'it'] | True |
SonosEntity.async_added_to_hass | (self) | Handle common setup when added to hass. | Handle common setup when added to hass. | async def async_added_to_hass(self) -> None:
"""Handle common setup when added to hass."""
await self.speaker.async_seen()
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{SONOS_POLL_UPDATE}-{self.soco.uid}",
self.async_po... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"await",
"self",
".",
"speaker",
".",
"async_seen",
"(",
")",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"{SONOS_POLL_UPDATE}-{sel... | [
36,
4
] | [
63,
9
] | python | en | ['en', 'en', 'en'] | True |
SonosEntity.async_poll | (self, now: datetime.datetime) | Poll the entity if subscriptions fail. | Poll the entity if subscriptions fail. | async def async_poll(self, now: datetime.datetime) -> None:
"""Poll the entity if subscriptions fail."""
if not self.speaker.subscriptions_failed:
if soco_config.EVENT_ADVERTISE_IP:
listener_msg = f"{self.speaker.subscription_address} (advertising as {soco_config.EVENT_ADVERT... | [
"async",
"def",
"async_poll",
"(",
"self",
",",
"now",
":",
"datetime",
".",
"datetime",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"speaker",
".",
"subscriptions_failed",
":",
"if",
"soco_config",
".",
"EVENT_ADVERTISE_IP",
":",
"listener_msg",
"=",
... | [
65,
4
] | [
82,
75
] | python | en | ['en', 'en', 'en'] | True |
SonosEntity.soco | (self) | Return the speaker SoCo instance. | Return the speaker SoCo instance. | def soco(self) -> SoCo:
"""Return the speaker SoCo instance."""
return self.speaker.soco | [
"def",
"soco",
"(",
"self",
")",
"->",
"SoCo",
":",
"return",
"self",
".",
"speaker",
".",
"soco"
] | [
85,
4
] | [
87,
32
] | python | en | ['en', 'no', 'en'] | True |
SonosEntity.device_info | (self) | Return information about the device. | Return information about the device. | def device_info(self) -> DeviceInfo:
"""Return information about the device."""
return {
"identifiers": {(DOMAIN, self.soco.uid)},
"name": self.speaker.zone_name,
"model": self.speaker.model_name.replace("Sonos ", ""),
"sw_version": self.speaker.version,
... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"DeviceInfo",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"soco",
".",
"uid",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"speaker",
".",
"zone_name",
",",
"\"model\""... | [
90,
4
] | [
100,
9
] | python | en | ['en', 'en', 'en'] | True |
SonosEntity.available | (self) | Return whether this device is available. | Return whether this device is available. | def available(self) -> bool:
"""Return whether this device is available."""
return self.speaker.available | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"speaker",
".",
"available"
] | [
103,
4
] | [
105,
37
] | python | en | ['en', 'en', 'en'] | True |
SonosEntity.should_poll | (self) | Return that we should not be polled (we handle that internally). | Return that we should not be polled (we handle that internally). | def should_poll(self) -> bool:
"""Return that we should not be polled (we handle that internally)."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
108,
4
] | [
110,
20
] | python | en | ['en', 'en', 'en'] | True |
test_import_flow | (hass) | Check import flow. | Check import flow. | async def test_import_flow(hass):
"""Check import flow."""
with patch(
"homeassistant.components.hive.config_flow.Auth.login",
return_value={
"ChallengeName": "SUCCESS",
"AuthenticationResult": {
"RefreshToken": "mock-refresh-token",
"Acce... | [
"async",
"def",
"test_import_flow",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.hive.config_flow.Auth.login\"",
",",
"return_value",
"=",
"{",
"\"ChallengeName\"",
":",
"\"SUCCESS\"",
",",
"\"AuthenticationResult\"",
":",
"{",
"\"RefreshToken\... | [
23,
0
] | [
62,
48
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow | (hass) | Test the user flow. | Test the user flow. | async def test_user_flow(hass):
"""Test the user flow."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {}
with patch(
"homeassist... | [
"async",
"def",
"test_user_flow",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")",
"ass... | [
65,
0
] | [
111,
62
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_2fa | (hass) | Test user flow with 2FA. | Test user flow with 2FA. | async def test_user_flow_2fa(hass):
"""Test user flow with 2FA."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {}
with patch(
"h... | [
"async",
"def",
"test_user_flow_2fa",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")",
... | [
114,
0
] | [
177,
62
] | python | en | ['en', 'en', 'en'] | True |
test_reauth_flow | (hass) | Test the reauth flow. | Test the reauth flow. | async def test_reauth_flow(hass):
"""Test the reauth flow."""
await setup.async_setup_component(hass, "persistent_notification", {})
mock_config = MockConfigEntry(
domain=DOMAIN,
unique_id=USERNAME,
data={
CONF_USERNAME: USERNAME,
CONF_PASSWORD: INCORRECT_PAS... | [
"async",
"def",
"test_reauth_flow",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"mock_config",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",... | [
180,
0
] | [
237,
62
] | python | en | ['en', 'en', 'en'] | True |
test_option_flow | (hass) | Test config flow options. | Test config flow options. | async def test_option_flow(hass):
"""Test config flow options."""
entry = MockConfigEntry(
domain=DOMAIN,
title=USERNAME,
data={CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD},
)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.... | [
"async",
"def",
"test_option_flow",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"title",
"=",
"USERNAME",
",",
"data",
"=",
"{",
"CONF_USERNAME",
":",
"USERNAME",
",",
"CONF_PASSWORD",
":",
"PASSWORD",
"}",
",... | [
240,
0
] | [
266,
70
] | python | en | ['en', 'fr', 'en'] | True |
test_user_flow_2fa_send_new_code | (hass) | Resend a 2FA code if it didn't arrive. | Resend a 2FA code if it didn't arrive. | async def test_user_flow_2fa_send_new_code(hass):
"""Resend a 2FA code if it didn't arrive."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {}... | [
"async",
"def",
"test_user_flow_2fa_send_new_code",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
... | [
269,
0
] | [
346,
62
] | python | en | ['en', 'co', 'en'] | True |
test_abort_if_existing_entry | (hass) | Check flow abort when an entry already exist. | Check flow abort when an entry already exist. | async def test_abort_if_existing_entry(hass):
"""Check flow abort when an entry already exist."""
config_entry = MockConfigEntry(
domain=DOMAIN,
unique_id=USERNAME,
data={CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD},
options={CONF_SCAN_INTERVAL: SCAN_INTERVAL},
)
con... | [
"async",
"def",
"test_abort_if_existing_entry",
"(",
"hass",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"USERNAME",
",",
"data",
"=",
"{",
"CONF_USERNAME",
":",
"USERNAME",
",",
"CONF_PASSWORD",
":",
... | [
349,
0
] | [
369,
51
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_invalid_username | (hass) | Test user flow with invalid username. | Test user flow with invalid username. | async def test_user_flow_invalid_username(hass):
"""Test user flow with invalid username."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {}
... | [
"async",
"def",
"test_user_flow_invalid_username",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"... | [
372,
0
] | [
392,
60
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_invalid_password | (hass) | Test user flow with invalid password. | Test user flow with invalid password. | async def test_user_flow_invalid_password(hass):
"""Test user flow with invalid password."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {}
... | [
"async",
"def",
"test_user_flow_invalid_password",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"... | [
395,
0
] | [
415,
60
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_no_internet_connection | (hass) | Test user flow with no internet connection. | Test user flow with no internet connection. | async def test_user_flow_no_internet_connection(hass):
"""Test user flow with no internet connection."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["err... | [
"async",
"def",
"test_user_flow_no_internet_connection",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER... | [
418,
0
] | [
439,
65
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_2fa_no_internet_connection | (hass) | Test user flow with no internet connection. | Test user flow with no internet connection. | async def test_user_flow_2fa_no_internet_connection(hass):
"""Test user flow with no internet connection."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result[... | [
"async",
"def",
"test_user_flow_2fa_no_internet_connection",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_... | [
442,
0
] | [
478,
65
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_2fa_invalid_code | (hass) | Test user flow with 2FA. | Test user flow with 2FA. | async def test_user_flow_2fa_invalid_code(hass):
"""Test user flow with 2FA."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {}
with patc... | [
"async",
"def",
"test_user_flow_2fa_invalid_code",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"... | [
481,
0
] | [
515,
56
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_unknown_error | (hass) | Test user flow when unknown error occurs. | Test user flow when unknown error occurs. | async def test_user_flow_unknown_error(hass):
"""Test user flow when unknown error occurs."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {}
... | [
"async",
"def",
"test_user_flow_unknown_error",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",... | [
518,
0
] | [
538,
51
] | python | en | ['en', 'de', 'en'] | True |
test_user_flow_2fa_unknown_error | (hass) | Test 2fa flow when unknown error occurs. | Test 2fa flow when unknown error occurs. | async def test_user_flow_2fa_unknown_error(hass):
"""Test 2fa flow when unknown error occurs."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == ... | [
"async",
"def",
"test_user_flow_2fa_unknown_error",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
... | [
541,
0
] | [
575,
51
] | python | en | ['en', 'de', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.