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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
EcovacsVacuum.is_on | (self) | Return true if vacuum is currently cleaning. | Return true if vacuum is currently cleaning. | def is_on(self):
"""Return true if vacuum is currently cleaning."""
return self.device.is_cleaning | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
".",
"is_cleaning"
] | [
101,
4
] | [
103,
38
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.is_charging | (self) | Return true if vacuum is currently charging. | Return true if vacuum is currently charging. | def is_charging(self):
"""Return true if vacuum is currently charging."""
return self.device.is_charging | [
"def",
"is_charging",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
".",
"is_charging"
] | [
106,
4
] | [
108,
38
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
111,
4
] | [
113,
25
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.supported_features | (self) | Flag vacuum cleaner robot features that are supported. | Flag vacuum cleaner robot features that are supported. | def supported_features(self):
"""Flag vacuum cleaner robot features that are supported."""
return SUPPORT_ECOVACS | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_ECOVACS"
] | [
116,
4
] | [
118,
30
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.status | (self) | Return the status of the vacuum cleaner. | Return the status of the vacuum cleaner. | def status(self):
"""Return the status of the vacuum cleaner."""
return self.device.vacuum_status | [
"def",
"status",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
".",
"vacuum_status"
] | [
121,
4
] | [
123,
40
] | python | en | ['en', 'la', 'en'] | True |
EcovacsVacuum.return_to_base | (self, **kwargs) | Set the vacuum cleaner to return to the dock. | Set the vacuum cleaner to return to the dock. | def return_to_base(self, **kwargs):
"""Set the vacuum cleaner to return to the dock."""
self.device.run(sucks.Charge()) | [
"def",
"return_to_base",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"device",
".",
"run",
"(",
"sucks",
".",
"Charge",
"(",
")",
")"
] | [
125,
4
] | [
128,
39
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.battery_icon | (self) | Return the battery icon for the vacuum cleaner. | Return the battery icon for the vacuum cleaner. | def battery_icon(self):
"""Return the battery icon for the vacuum cleaner."""
return icon_for_battery_level(
battery_level=self.battery_level, charging=self.is_charging
) | [
"def",
"battery_icon",
"(",
"self",
")",
":",
"return",
"icon_for_battery_level",
"(",
"battery_level",
"=",
"self",
".",
"battery_level",
",",
"charging",
"=",
"self",
".",
"is_charging",
")"
] | [
131,
4
] | [
135,
9
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.battery_level | (self) | Return the battery level of the vacuum cleaner. | Return the battery level of the vacuum cleaner. | def battery_level(self):
"""Return the battery level of the vacuum cleaner."""
if self.device.battery_status is not None:
return self.device.battery_status * 100
return super().battery_level | [
"def",
"battery_level",
"(",
"self",
")",
":",
"if",
"self",
".",
"device",
".",
"battery_status",
"is",
"not",
"None",
":",
"return",
"self",
".",
"device",
".",
"battery_status",
"*",
"100",
"return",
"super",
"(",
")",
".",
"battery_level"
] | [
138,
4
] | [
143,
36
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.fan_speed | (self) | Return the fan speed of the vacuum cleaner. | Return the fan speed of the vacuum cleaner. | def fan_speed(self):
"""Return the fan speed of the vacuum cleaner."""
return self.device.fan_speed | [
"def",
"fan_speed",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
".",
"fan_speed"
] | [
146,
4
] | [
148,
36
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.fan_speed_list | (self) | Get the list of available fan speed steps of the vacuum cleaner. | Get the list of available fan speed steps of the vacuum cleaner. | def fan_speed_list(self):
"""Get the list of available fan speed steps of the vacuum cleaner."""
return [sucks.FAN_SPEED_NORMAL, sucks.FAN_SPEED_HIGH] | [
"def",
"fan_speed_list",
"(",
"self",
")",
":",
"return",
"[",
"sucks",
".",
"FAN_SPEED_NORMAL",
",",
"sucks",
".",
"FAN_SPEED_HIGH",
"]"
] | [
151,
4
] | [
154,
61
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.turn_on | (self, **kwargs) | Turn the vacuum on and start cleaning. | Turn the vacuum on and start cleaning. | def turn_on(self, **kwargs):
"""Turn the vacuum on and start cleaning."""
self.device.run(sucks.Clean()) | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"device",
".",
"run",
"(",
"sucks",
".",
"Clean",
"(",
")",
")"
] | [
156,
4
] | [
159,
38
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.turn_off | (self, **kwargs) | Turn the vacuum off stopping the cleaning and returning home. | Turn the vacuum off stopping the cleaning and returning home. | def turn_off(self, **kwargs):
"""Turn the vacuum off stopping the cleaning and returning home."""
self.return_to_base() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"return_to_base",
"(",
")"
] | [
161,
4
] | [
163,
29
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.stop | (self, **kwargs) | Stop the vacuum cleaner. | Stop the vacuum cleaner. | def stop(self, **kwargs):
"""Stop the vacuum cleaner."""
self.device.run(sucks.Stop()) | [
"def",
"stop",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"device",
".",
"run",
"(",
"sucks",
".",
"Stop",
"(",
")",
")"
] | [
165,
4
] | [
168,
37
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.clean_spot | (self, **kwargs) | Perform a spot clean-up. | Perform a spot clean-up. | def clean_spot(self, **kwargs):
"""Perform a spot clean-up."""
self.device.run(sucks.Spot()) | [
"def",
"clean_spot",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"device",
".",
"run",
"(",
"sucks",
".",
"Spot",
"(",
")",
")"
] | [
170,
4
] | [
173,
37
] | python | en | ['pt', 'en', 'en'] | True |
EcovacsVacuum.locate | (self, **kwargs) | Locate the vacuum cleaner. | Locate the vacuum cleaner. | def locate(self, **kwargs):
"""Locate the vacuum cleaner."""
self.device.run(sucks.PlaySound()) | [
"def",
"locate",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"device",
".",
"run",
"(",
"sucks",
".",
"PlaySound",
"(",
")",
")"
] | [
175,
4
] | [
178,
42
] | python | en | ['en', 'la', 'en'] | True |
EcovacsVacuum.set_fan_speed | (self, fan_speed, **kwargs) | Set fan speed. | Set fan speed. | def set_fan_speed(self, fan_speed, **kwargs):
"""Set fan speed."""
if self.is_on:
self.device.run(sucks.Clean(mode=self.device.clean_status, speed=fan_speed)) | [
"def",
"set_fan_speed",
"(",
"self",
",",
"fan_speed",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"is_on",
":",
"self",
".",
"device",
".",
"run",
"(",
"sucks",
".",
"Clean",
"(",
"mode",
"=",
"self",
".",
"device",
".",
"clean_status",
... | [
180,
4
] | [
184,
88
] | python | fy | ['sv', 'fy', 'ur'] | False |
EcovacsVacuum.send_command | (self, command, params=None, **kwargs) | Send a command to a vacuum cleaner. | Send a command to a vacuum cleaner. | def send_command(self, command, params=None, **kwargs):
"""Send a command to a vacuum cleaner."""
self.device.run(sucks.VacBotCommand(command, params)) | [
"def",
"send_command",
"(",
"self",
",",
"command",
",",
"params",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"device",
".",
"run",
"(",
"sucks",
".",
"VacBotCommand",
"(",
"command",
",",
"params",
")",
")"
] | [
186,
4
] | [
188,
61
] | python | en | ['en', 'en', 'en'] | True |
EcovacsVacuum.device_state_attributes | (self) | Return the device-specific state attributes of this vacuum. | Return the device-specific state attributes of this vacuum. | def device_state_attributes(self):
"""Return the device-specific state attributes of this vacuum."""
data = {}
data[ATTR_ERROR] = self._error
for key, val in self.device.components.items():
attr_name = ATTR_COMPONENT_PREFIX + key
data[attr_name] = int(val * 100)
... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"data",
"=",
"{",
"}",
"data",
"[",
"ATTR_ERROR",
"]",
"=",
"self",
".",
"_error",
"for",
"key",
",",
"val",
"in",
"self",
".",
"device",
".",
"components",
".",
"items",
"(",
")",
":",
"attr_n... | [
191,
4
] | [
200,
19
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up a FFmpeg camera. | Set up a FFmpeg camera. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up a FFmpeg camera."""
async_add_entities([FFmpegCamera(hass, config)]) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"async_add_entities",
"(",
"[",
"FFmpegCamera",
"(",
"hass",
",",
"config",
")",
"]",
")"
] | [
25,
0
] | [
27,
52
] | python | en | ['en', 'lb', 'en'] | True |
FFmpegCamera.__init__ | (self, hass, config) | Initialize a FFmpeg camera. | Initialize a FFmpeg camera. | def __init__(self, hass, config):
"""Initialize a FFmpeg camera."""
super().__init__()
self._manager = hass.data[DATA_FFMPEG]
self._name = config.get(CONF_NAME)
self._input = config.get(CONF_INPUT)
self._extra_arguments = config.get(CONF_EXTRA_ARGUMENTS) | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"config",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_manager",
"=",
"hass",
".",
"data",
"[",
"DATA_FFMPEG",
"]",
"self",
".",
"_name",
"=",
"config",
".",
"get",
"(",
... | [
33,
4
] | [
40,
64
] | python | co | ['hu', 'co', 'it'] | False |
FFmpegCamera.supported_features | (self) | Return supported features. | Return supported features. | def supported_features(self):
"""Return supported features."""
return SUPPORT_STREAM | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_STREAM"
] | [
43,
4
] | [
45,
29
] | python | en | ['en', 'en', 'en'] | True |
FFmpegCamera.stream_source | (self) | Return the stream source. | Return the stream source. | async def stream_source(self):
"""Return the stream source."""
return self._input.split(" ")[-1] | [
"async",
"def",
"stream_source",
"(",
"self",
")",
":",
"return",
"self",
".",
"_input",
".",
"split",
"(",
"\" \"",
")",
"[",
"-",
"1",
"]"
] | [
47,
4
] | [
49,
41
] | python | en | ['en', 'ig', 'en'] | True |
FFmpegCamera.async_camera_image | (self) | Return a still image response from the camera. | Return a still image response from the camera. | async def async_camera_image(self):
"""Return a still image response from the camera."""
return await async_get_image(
self.hass,
self._input,
output_format=IMAGE_JPEG,
extra_cmd=self._extra_arguments,
) | [
"async",
"def",
"async_camera_image",
"(",
"self",
")",
":",
"return",
"await",
"async_get_image",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_input",
",",
"output_format",
"=",
"IMAGE_JPEG",
",",
"extra_cmd",
"=",
"self",
".",
"_extra_arguments",
",",
")"... | [
51,
4
] | [
58,
9
] | python | en | ['en', 'en', 'en'] | True |
FFmpegCamera.handle_async_mjpeg_stream | (self, request) | Generate an HTTP MJPEG stream from the camera. | Generate an HTTP MJPEG stream from the camera. | async def handle_async_mjpeg_stream(self, request):
"""Generate an HTTP MJPEG stream from the camera."""
stream = CameraMjpeg(self._manager.binary, loop=self.hass.loop)
await stream.open_camera(self._input, extra_cmd=self._extra_arguments)
try:
stream_reader = await stream.... | [
"async",
"def",
"handle_async_mjpeg_stream",
"(",
"self",
",",
"request",
")",
":",
"stream",
"=",
"CameraMjpeg",
"(",
"self",
".",
"_manager",
".",
"binary",
",",
"loop",
"=",
"self",
".",
"hass",
".",
"loop",
")",
"await",
"stream",
".",
"open_camera",
... | [
60,
4
] | [
75,
32
] | python | en | ['en', 'en', 'en'] | True |
FFmpegCamera.name | (self) | Return the name of this camera. | Return the name of this camera. | def name(self):
"""Return the name of this camera."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
78,
4
] | [
80,
25
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the light platform for each FutureNow unit. | Set up the light platform for each FutureNow unit. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the light platform for each FutureNow unit."""
lights = []
for channel, device_config in config[CONF_DEVICES].items():
device = {}
device["name"] = device_config[CONF_NAME]
device["dimmable"] = device_conf... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"lights",
"=",
"[",
"]",
"for",
"channel",
",",
"device_config",
"in",
"config",
"[",
"CONF_DEVICES",
"]",
".",
"items",
"(",
")",
":"... | [
35,
0
] | [
48,
30
] | python | en | ['en', 'fr', 'en'] | True |
to_futurenow_level | (level) | Convert the given Home Assistant light level (0-255) to FutureNow (0-100). | Convert the given Home Assistant light level (0-255) to FutureNow (0-100). | def to_futurenow_level(level):
"""Convert the given Home Assistant light level (0-255) to FutureNow (0-100)."""
return int((level * 100) / 255) | [
"def",
"to_futurenow_level",
"(",
"level",
")",
":",
"return",
"int",
"(",
"(",
"level",
"*",
"100",
")",
"/",
"255",
")"
] | [
51,
0
] | [
53,
35
] | python | en | ['en', 'en', 'en'] | True |
to_hass_level | (level) | Convert the given FutureNow (0-100) light level to Home Assistant (0-255). | Convert the given FutureNow (0-100) light level to Home Assistant (0-255). | def to_hass_level(level):
"""Convert the given FutureNow (0-100) light level to Home Assistant (0-255)."""
return int((level * 255) / 100) | [
"def",
"to_hass_level",
"(",
"level",
")",
":",
"return",
"int",
"(",
"(",
"level",
"*",
"255",
")",
"/",
"100",
")"
] | [
56,
0
] | [
58,
35
] | python | en | ['en', 'en', 'en'] | True |
FutureNowLight.__init__ | (self, device) | Initialize the light. | Initialize the light. | def __init__(self, device):
"""Initialize the light."""
self._name = device["name"]
self._dimmable = device["dimmable"]
self._channel = device["channel"]
self._brightness = None
self._last_brightness = 255
self._state = None
if device["driver"] == CONF_DR... | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"self",
".",
"_name",
"=",
"device",
"[",
"\"name\"",
"]",
"self",
".",
"_dimmable",
"=",
"device",
"[",
"\"dimmable\"",
"]",
"self",
".",
"_channel",
"=",
"device",
"[",
"\"channel\"",
"]",
"sel... | [
64,
4
] | [
80,
13
] | python | en | ['en', 'en', 'en'] | True |
FutureNowLight.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._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
83,
4
] | [
85,
25
] | python | en | ['en', 'en', 'en'] | True |
FutureNowLight.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
88,
4
] | [
90,
26
] | python | en | ['en', 'fy', 'en'] | True |
FutureNowLight.brightness | (self) | Return the brightness of this light between 0..255. | Return the brightness of this light between 0..255. | def brightness(self):
"""Return the brightness of this light between 0..255."""
return self._brightness | [
"def",
"brightness",
"(",
"self",
")",
":",
"return",
"self",
".",
"_brightness"
] | [
93,
4
] | [
95,
31
] | python | en | ['en', 'en', 'en'] | True |
FutureNowLight.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
if self._dimmable:
return SUPPORT_BRIGHTNESS
return 0 | [
"def",
"supported_features",
"(",
"self",
")",
":",
"if",
"self",
".",
"_dimmable",
":",
"return",
"SUPPORT_BRIGHTNESS",
"return",
"0"
] | [
98,
4
] | [
102,
16
] | python | en | ['da', 'en', 'en'] | True |
FutureNowLight.turn_on | (self, **kwargs) | Turn the light on. | Turn the light on. | def turn_on(self, **kwargs):
"""Turn the light on."""
if self._dimmable:
level = kwargs.get(ATTR_BRIGHTNESS, self._last_brightness)
else:
level = 255
self._light.turn_on(to_futurenow_level(level)) | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_dimmable",
":",
"level",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_BRIGHTNESS",
",",
"self",
".",
"_last_brightness",
")",
"else",
":",
"level",
"=",
"255",
"self",
".... | [
104,
4
] | [
110,
54
] | python | en | ['en', 'et', 'en'] | True |
FutureNowLight.turn_off | (self, **kwargs) | Turn the light off. | Turn the light off. | def turn_off(self, **kwargs):
"""Turn the light off."""
self._light.turn_off()
if self._brightness:
self._last_brightness = self._brightness | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_light",
".",
"turn_off",
"(",
")",
"if",
"self",
".",
"_brightness",
":",
"self",
".",
"_last_brightness",
"=",
"self",
".",
"_brightness"
] | [
112,
4
] | [
116,
52
] | python | en | ['en', 'zh', 'en'] | True |
FutureNowLight.update | (self) | Fetch new state data for this light. | Fetch new state data for this light. | def update(self):
"""Fetch new state data for this light."""
state = int(self._light.is_on())
self._state = bool(state)
self._brightness = to_hass_level(state) | [
"def",
"update",
"(",
"self",
")",
":",
"state",
"=",
"int",
"(",
"self",
".",
"_light",
".",
"is_on",
"(",
")",
")",
"self",
".",
"_state",
"=",
"bool",
"(",
"state",
")",
"self",
".",
"_brightness",
"=",
"to_hass_level",
"(",
"state",
")"
] | [
118,
4
] | [
122,
47
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the MeteoAlarm binary sensor platform. | Set up the MeteoAlarm binary sensor platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the MeteoAlarm binary sensor platform."""
country = config[CONF_COUNTRY]
province = config[CONF_PROVINCE]
language = config[CONF_LANGUAGE]
name = config[CONF_NAME]
try:
api = Meteoalert(country, province, la... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"country",
"=",
"config",
"[",
"CONF_COUNTRY",
"]",
"province",
"=",
"config",
"[",
"CONF_PROVINCE",
"]",
"language",
"=",
"config",
"[",
... | [
37,
0
] | [
51,
59
] | python | en | ['en', 'ru', 'en'] | True |
MeteoAlertBinarySensor.__init__ | (self, api, name) | Initialize the MeteoAlert binary sensor. | Initialize the MeteoAlert binary sensor. | def __init__(self, api, name):
"""Initialize the MeteoAlert binary sensor."""
self._name = name
self._attributes = {}
self._state = None
self._api = api | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"name",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_attributes",
"=",
"{",
"}",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_api",
"=",
"api"
] | [
57,
4
] | [
62,
23
] | python | en | ['en', 'fy', 'en'] | True |
MeteoAlertBinarySensor.name | (self) | Return the name of the binary sensor. | Return the name of the binary sensor. | def name(self):
"""Return the name of the binary sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
65,
4
] | [
67,
25
] | python | en | ['en', 'mi', 'en'] | True |
MeteoAlertBinarySensor.is_on | (self) | Return the status of the binary sensor. | Return the status of the binary sensor. | def is_on(self):
"""Return the status of the binary sensor."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
70,
4
] | [
72,
26
] | python | en | ['en', 'mi', 'en'] | True |
MeteoAlertBinarySensor.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
self._attributes[ATTR_ATTRIBUTION] = ATTRIBUTION
return self._attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"self",
".",
"_attributes",
"[",
"ATTR_ATTRIBUTION",
"]",
"=",
"ATTRIBUTION",
"return",
"self",
".",
"_attributes"
] | [
75,
4
] | [
78,
31
] | python | en | ['en', 'en', 'en'] | True |
MeteoAlertBinarySensor.device_class | (self) | Return the device class of this binary sensor. | Return the device class of this binary sensor. | def device_class(self):
"""Return the device class of this binary sensor."""
return DEVICE_CLASS_SAFETY | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_SAFETY"
] | [
81,
4
] | [
83,
34
] | python | en | ['en', 'en', 'en'] | True |
MeteoAlertBinarySensor.update | (self) | Update device state. | Update device state. | def update(self):
"""Update device state."""
alert = self._api.get_alert()
if alert:
self._attributes = alert
self._state = True
else:
self._attributes = {}
self._state = False | [
"def",
"update",
"(",
"self",
")",
":",
"alert",
"=",
"self",
".",
"_api",
".",
"get_alert",
"(",
")",
"if",
"alert",
":",
"self",
".",
"_attributes",
"=",
"alert",
"self",
".",
"_state",
"=",
"True",
"else",
":",
"self",
".",
"_attributes",
"=",
"... | [
85,
4
] | [
93,
31
] | python | en | ['fr', 'en', 'en'] | True |
evaluate | (values: list, poly: Polynomial) | Evaluate a polynomial using the provided values. | Evaluate a polynomial using the provided values. | def evaluate(values: list, poly: Polynomial):
"""Evaluate a polynomial using the provided values."""
pt = type(poly)
if pt == Sum:
return sum(evaluate(values, i) for i in poly)
elif pt == Prod:
res = 1
for item in poly:
res *= evaluate(values, item)
return r... | [
"def",
"evaluate",
"(",
"values",
":",
"list",
",",
"poly",
":",
"Polynomial",
")",
":",
"pt",
"=",
"type",
"(",
"poly",
")",
"if",
"pt",
"==",
"Sum",
":",
"return",
"sum",
"(",
"evaluate",
"(",
"values",
",",
"i",
")",
"for",
"i",
"in",
"poly",
... | [
56,
0
] | [
67,
27
] | python | en | ['en', 'en', 'en'] | True |
elementary_symmetric | (size: int, degree: int) | Return the elementary symmetric polynomial of specified size and degree. | Return the elementary symmetric polynomial of specified size and degree. | def elementary_symmetric(size: int, degree: int):
"""Return the elementary symmetric polynomial of specified size and degree."""
c = list(combinations(range(size), degree))
products = [Prod(*i) if len(i) > 1 else i[0] for i in c]
return Sum(*products) if len(products) > 1 else products[0] | [
"def",
"elementary_symmetric",
"(",
"size",
":",
"int",
",",
"degree",
":",
"int",
")",
":",
"c",
"=",
"list",
"(",
"combinations",
"(",
"range",
"(",
"size",
")",
",",
"degree",
")",
")",
"products",
"=",
"[",
"Prod",
"(",
"*",
"i",
")",
"if",
"... | [
70,
0
] | [
74,
63
] | python | en | ['en', 'en', 'en'] | True |
normalize | (poly: Polynomial) | Unroll equivalent nested operations. | Unroll equivalent nested operations. | def normalize(poly: Polynomial):
"""Unroll equivalent nested operations."""
new = _normalize(poly)
while hash(poly) != hash(new):
poly = new
new = _normalize(poly)
return poly | [
"def",
"normalize",
"(",
"poly",
":",
"Polynomial",
")",
":",
"new",
"=",
"_normalize",
"(",
"poly",
")",
"while",
"hash",
"(",
"poly",
")",
"!=",
"hash",
"(",
"new",
")",
":",
"poly",
"=",
"new",
"new",
"=",
"_normalize",
"(",
"poly",
")",
"return... | [
77,
0
] | [
83,
15
] | python | en | ['en', 'en', 'en'] | True |
_normalize | (poly: Polynomial) | Unroll equivalent nested operations once. | Unroll equivalent nested operations once. | def _normalize(poly: Polynomial):
"""Unroll equivalent nested operations once."""
pt = type(poly)
if issubclass(pt, Polynomial):
if len(poly.elements()) == 1:
return _normalize(poly[0])
new_elements = []
for p in poly:
if type(p) == pt:
new_ele... | [
"def",
"_normalize",
"(",
"poly",
":",
"Polynomial",
")",
":",
"pt",
"=",
"type",
"(",
"poly",
")",
"if",
"issubclass",
"(",
"pt",
",",
"Polynomial",
")",
":",
"if",
"len",
"(",
"poly",
".",
"elements",
"(",
")",
")",
"==",
"1",
":",
"return",
"_... | [
86,
0
] | [
100,
19
] | python | en | ['en', 'en', 'en'] | True |
flatten | (poly: Polynomial) | Flatten and normalize a polynomial to the minimal depth. | Flatten and normalize a polynomial to the minimal depth. | def flatten(poly: Polynomial):
"""Flatten and normalize a polynomial to the minimal depth."""
return normalize(_flatten(poly)) | [
"def",
"flatten",
"(",
"poly",
":",
"Polynomial",
")",
":",
"return",
"normalize",
"(",
"_flatten",
"(",
"poly",
")",
")"
] | [
103,
0
] | [
105,
36
] | python | en | ['en', 'en', 'en'] | True |
_flatten | (poly: Polynomial) | Flatten a polynomial to the minimal depth (unnormalized). | Flatten a polynomial to the minimal depth (unnormalized). | def _flatten(poly: Polynomial):
"""Flatten a polynomial to the minimal depth (unnormalized)."""
pt = type(poly)
if issubclass(pt, Polynomial):
if pt == Prod:
prod_elements = []
for sumOrInt in poly:
if type(sumOrInt) == Sum:
prod_elements.a... | [
"def",
"_flatten",
"(",
"poly",
":",
"Polynomial",
")",
":",
"pt",
"=",
"type",
"(",
"poly",
")",
"if",
"issubclass",
"(",
"pt",
",",
"Polynomial",
")",
":",
"if",
"pt",
"==",
"Prod",
":",
"prod_elements",
"=",
"[",
"]",
"for",
"sumOrInt",
"in",
"p... | [
108,
0
] | [
126,
19
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Import the platform into a config entry. | Import the platform into a config entry. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Import the platform into a config entry."""
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=config
)
) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",... | [
55,
0
] | [
61,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Flume sensor. | Set up the Flume sensor. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Flume sensor."""
flume_domain_data = hass.data[DOMAIN][config_entry.entry_id]
flume_auth = flume_domain_data[FLUME_AUTH]
http_session = flume_domain_data[FLUME_HTTP_SESSION]
flume_devices = flume_domain_data[FLUME_DE... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"flume_domain_data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"flume_auth",
"=",
"flume_domain_data",
"[",... | [
64,
0
] | [
107,
45
] | python | en | ['en', 'da', 'en'] | True |
_create_flume_device_coordinator | (hass, flume_device) | Create a data coordinator for the flume device. | Create a data coordinator for the flume device. | def _create_flume_device_coordinator(hass, flume_device):
"""Create a data coordinator for the flume device."""
async def _async_update_data():
"""Get the latest data from the Flume."""
_LOGGER.debug("Updating Flume data")
try:
await hass.async_add_executor_job(flume_device.... | [
"def",
"_create_flume_device_coordinator",
"(",
"hass",
",",
"flume_device",
")",
":",
"async",
"def",
"_async_update_data",
"(",
")",
":",
"\"\"\"Get the latest data from the Flume.\"\"\"",
"_LOGGER",
".",
"debug",
"(",
"\"Updating Flume data\"",
")",
"try",
":",
"awai... | [
169,
0
] | [
195,
5
] | python | en | ['en', 'en', 'en'] | True |
FlumeSensor.__init__ | (self, coordinator, flume_device, flume_query_sensor, name, device_id) | Initialize the Flume sensor. | Initialize the Flume sensor. | def __init__(self, coordinator, flume_device, flume_query_sensor, name, device_id):
"""Initialize the Flume sensor."""
super().__init__(coordinator)
self._flume_device = flume_device
self._flume_query_sensor = flume_query_sensor
self._name = name
self._device_id = device_... | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"flume_device",
",",
"flume_query_sensor",
",",
"name",
",",
"device_id",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_flume_device",
"=",
"flume_device",
"self... | [
113,
4
] | [
120,
26
] | python | en | ['en', 'sq', 'en'] | True |
FlumeSensor.device_info | (self) | Device info for the flume sensor. | Device info for the flume sensor. | def device_info(self):
"""Device info for the flume sensor."""
return {
"name": self._name,
"identifiers": {(DOMAIN, self._device_id)},
"manufacturer": "Flume, Inc.",
"model": "Flume Smart Water Monitor",
} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"name\"",
":",
"self",
".",
"_name",
",",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_device_id",
")",
"}",
",",
"\"manufacturer\"",
":",
"\"Flume, Inc.\"",
",",
"\"model\"",... | [
123,
4
] | [
130,
9
] | python | en | ['en', 'no', 'en'] | True |
FlumeSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
133,
4
] | [
135,
25
] | python | en | ['en', 'mi', 'en'] | True |
FlumeSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
sensor_key = self._flume_query_sensor[0]
if sensor_key not in self._flume_device.values:
return None
return _format_state_value(self._flume_device.values[sensor_key]) | [
"def",
"state",
"(",
"self",
")",
":",
"sensor_key",
"=",
"self",
".",
"_flume_query_sensor",
"[",
"0",
"]",
"if",
"sensor_key",
"not",
"in",
"self",
".",
"_flume_device",
".",
"values",
":",
"return",
"None",
"return",
"_format_state_value",
"(",
"self",
... | [
138,
4
] | [
144,
73
] | python | en | ['en', 'en', 'en'] | True |
FlumeSensor.unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def unit_of_measurement(self):
"""Return the unit the value is expressed in."""
# This is in gallons per SCAN_INTERVAL
return self._flume_query_sensor[1]["unit_of_measurement"] | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"# This is in gallons per SCAN_INTERVAL",
"return",
"self",
".",
"_flume_query_sensor",
"[",
"1",
"]",
"[",
"\"unit_of_measurement\"",
"]"
] | [
147,
4
] | [
150,
65
] | python | en | ['en', 'en', 'en'] | True |
FlumeSensor.unique_id | (self) | Flume query and Device unique ID. | Flume query and Device unique ID. | def unique_id(self):
"""Flume query and Device unique ID."""
return f"{self._flume_query_sensor[0]}_{self._device_id}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._flume_query_sensor[0]}_{self._device_id}\""
] | [
153,
4
] | [
155,
65
] | python | en | ['en', 'en', 'en'] | True |
FlumeSensor.async_added_to_hass | (self) | Request an update when added. | Request an update when added. | async def async_added_to_hass(self):
"""Request an update when added."""
await super().async_added_to_hass()
# We do not ask for an update with async_add_entities()
# because it will update disabled entities
await self.coordinator.async_request_refresh() | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"# We do not ask for an update with async_add_entities()",
"# because it will update disabled entities",
"await",
"self",
".",
"coordinator",
".",... | [
157,
4
] | [
162,
54
] | python | en | ['en', 'en', 'en'] | True |
configured_instances | (hass) | Return a set of configured SimpliSafe instances. | Return a set of configured SimpliSafe instances. | def configured_instances(hass):
"""Return a set of configured SimpliSafe instances."""
entries = []
for entry in hass.config_entries.async_entries(DOMAIN):
if entry.data.get("track_home"):
entries.append("home")
continue
entries.append(
f"{entry.data.get(C... | [
"def",
"configured_instances",
"(",
"hass",
")",
":",
"entries",
"=",
"[",
"]",
"for",
"entry",
"in",
"hass",
".",
"config_entries",
".",
"async_entries",
"(",
"DOMAIN",
")",
":",
"if",
"entry",
".",
"data",
".",
"get",
"(",
"\"track_home\"",
")",
":",
... | [
14,
0
] | [
24,
23
] | python | en | ['en', 'da', 'en'] | True |
MetFlowHandler.__init__ | (self) | Init MetFlowHandler. | Init MetFlowHandler. | def __init__(self):
"""Init MetFlowHandler."""
self._errors = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_errors",
"=",
"{",
"}"
] | [
33,
4
] | [
35,
25
] | python | en | ['en', 'id', 'nl'] | False |
MetFlowHandler.async_step_user | (self, user_input=None) | Handle a flow initialized by the user. | Handle a flow initialized by the user. | async def async_step_user(self, user_input=None):
"""Handle a flow initialized by the user."""
self._errors = {}
if user_input is not None:
if (
f"{user_input.get(CONF_LATITUDE)}-{user_input.get(CONF_LONGITUDE)}"
not in configured_instances(self.hass)... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"self",
".",
"_errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"if",
"(",
"f\"{user_input.get(CONF_LATITUDE)}-{user_input.get(CONF_LONGITUDE)}\"",
"not"... | [
37,
4
] | [
56,
9
] | python | en | ['en', 'en', 'en'] | True |
MetFlowHandler._show_config_form | (
self, name=None, latitude=None, longitude=None, elevation=None
) | Show the configuration form to edit location data. | Show the configuration form to edit location data. | async def _show_config_form(
self, name=None, latitude=None, longitude=None, elevation=None
):
"""Show the configuration form to edit location data."""
return self.async_show_form(
step_id="user",
data_schema=vol.Schema(
{
vol.Requi... | [
"async",
"def",
"_show_config_form",
"(",
"self",
",",
"name",
"=",
"None",
",",
"latitude",
"=",
"None",
",",
"longitude",
"=",
"None",
",",
"elevation",
"=",
"None",
")",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"user\"",
"... | [
58,
4
] | [
73,
9
] | python | en | ['en', 'en', 'en'] | True |
MetFlowHandler.async_step_import | (
self, user_input: Optional[Dict] = None
) | Handle configuration by yaml file. | Handle configuration by yaml file. | async def async_step_import(
self, user_input: Optional[Dict] = None
) -> Dict[str, Any]:
"""Handle configuration by yaml file."""
return await self.async_step_user(user_input) | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"user_input",
":",
"Optional",
"[",
"Dict",
"]",
"=",
"None",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"await",
"self",
".",
"async_step_user",
"(",
"user_input",
")"
] | [
75,
4
] | [
79,
53
] | python | en | ['en', 'en', 'en'] | True |
MetFlowHandler.async_step_onboarding | (self, data=None) | Handle a flow initialized by onboarding. | Handle a flow initialized by onboarding. | async def async_step_onboarding(self, data=None):
"""Handle a flow initialized by onboarding."""
return self.async_create_entry(
title=HOME_LOCATION_NAME, data={CONF_TRACK_HOME: True}
) | [
"async",
"def",
"async_step_onboarding",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"return",
"self",
".",
"async_create_entry",
"(",
"title",
"=",
"HOME_LOCATION_NAME",
",",
"data",
"=",
"{",
"CONF_TRACK_HOME",
":",
"True",
"}",
")"
] | [
81,
4
] | [
85,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Tile component. | Set up the Tile component. | async def async_setup(hass, config):
"""Set up the Tile component."""
hass.data[DOMAIN] = {DATA_COORDINATOR: {}}
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"DATA_COORDINATOR",
":",
"{",
"}",
"}",
"return",
"True"
] | [
28,
0
] | [
32,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry) | Set up Tile as config entry. | Set up Tile as config entry. | async def async_setup_entry(hass, config_entry):
"""Set up Tile as config entry."""
websession = aiohttp_client.async_get_clientsession(hass)
client = await async_login(
config_entry.data[CONF_USERNAME],
config_entry.data[CONF_PASSWORD],
session=websession,
)
async def asyn... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"websession",
"=",
"aiohttp_client",
".",
"async_get_clientsession",
"(",
"hass",
")",
"client",
"=",
"await",
"async_login",
"(",
"config_entry",
".",
"data",
"[",
"CONF_USERNAME",
... | [
35,
0
] | [
71,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, config_entry) | Unload a Tile config entry. | Unload a Tile config entry. | async def async_unload_entry(hass, config_entry):
"""Unload a Tile config entry."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
]
)
)
i... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"config_entry",
",",
"compo... | [
74,
0
] | [
87,
20
] | python | en | ['en', 'fr', 'en'] | True |
TileEntity.__init__ | (self, coordinator) | Initialize. | Initialize. | def __init__(self, coordinator):
"""Initialize."""
super().__init__(coordinator)
self._attrs = {ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION}
self._name = None
self._unique_id = None | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_attrs",
"=",
"{",
"ATTR_ATTRIBUTION",
":",
"DEFAULT_ATTRIBUTION",
"}",
"self",
".",
"_name",
"=",
"None",
"self",
".... | [
93,
4
] | [
98,
30
] | python | en | ['en', 'en', 'it'] | False |
TileEntity.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
return self._attrs | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attrs"
] | [
101,
4
] | [
103,
26
] | python | en | ['en', 'en', 'en'] | True |
TileEntity.icon | (self) | Return the icon. | Return the icon. | def icon(self):
"""Return the icon."""
return DEFAULT_ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"DEFAULT_ICON"
] | [
106,
4
] | [
108,
27
] | python | en | ['en', 'sr', 'en'] | True |
TileEntity.name | (self) | Return the name. | Return the name. | def name(self):
"""Return the name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
111,
4
] | [
113,
25
] | python | en | ['en', 'ig', 'en'] | True |
TileEntity.unique_id | (self) | Return the unique ID of the entity. | Return the unique ID of the entity. | def unique_id(self):
"""Return the unique ID of the entity."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
116,
4
] | [
118,
30
] | python | en | ['en', 'en', 'en'] | True |
TileEntity._handle_coordinator_update | (self) | Respond to a DataUpdateCoordinator update. | Respond to a DataUpdateCoordinator update. | def _handle_coordinator_update(self):
"""Respond to a DataUpdateCoordinator update."""
self._update_from_latest_data()
self.async_write_ha_state() | [
"def",
"_handle_coordinator_update",
"(",
"self",
")",
":",
"self",
".",
"_update_from_latest_data",
"(",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
121,
4
] | [
124,
35
] | python | en | ['en', 'de', 'en'] | True |
TileEntity._update_from_latest_data | (self) | Update the entity from the latest data. | Update the entity from the latest data. | def _update_from_latest_data(self):
"""Update the entity from the latest data."""
raise NotImplementedError | [
"def",
"_update_from_latest_data",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | [
127,
4
] | [
129,
33
] | python | en | ['en', 'en', 'en'] | True |
TileEntity.async_added_to_hass | (self) | Handle entity which will be added. | Handle entity which will be added. | async def async_added_to_hass(self):
"""Handle entity which will be added."""
await super().async_added_to_hass()
self._update_from_latest_data() | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"self",
".",
"_update_from_latest_data",
"(",
")"
] | [
131,
4
] | [
134,
39
] | python | en | ['en', 'en', 'en'] | True |
test_unsupported_domain | (hass) | Discovery ignores entities of unknown domains. | Discovery ignores entities of unknown domains. | async def test_unsupported_domain(hass):
"""Discovery ignores entities of unknown domains."""
request = get_new_request("Alexa.Discovery", "Discover")
hass.states.async_set("woz.boop", "on", {"friendly_name": "Boop Woz"})
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
... | [
"async",
"def",
"test_unsupported_domain",
"(",
"hass",
")",
":",
"request",
"=",
"get_new_request",
"(",
"\"Alexa.Discovery\"",
",",
"\"Discover\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"woz.boop\"",
",",
"\"on\"",
",",
"{",
"\"friendly_name\"",
... | [
8,
0
] | [
19,
42
] | python | en | ['en', 'en', 'en'] | True |
test_serialize_discovery_recovers | (hass, caplog) | Test we handle an interface raising unexpectedly during serialize discovery. | Test we handle an interface raising unexpectedly during serialize discovery. | async def test_serialize_discovery_recovers(hass, caplog):
"""Test we handle an interface raising unexpectedly during serialize discovery."""
request = get_new_request("Alexa.Discovery", "Discover")
hass.states.async_set("switch.bla", "on", {"friendly_name": "Boop Woz"})
with patch(
"homeassis... | [
"async",
"def",
"test_serialize_discovery_recovers",
"(",
"hass",
",",
"caplog",
")",
":",
"request",
"=",
"get_new_request",
"(",
"\"Alexa.Discovery\"",
",",
"\"Discover\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"switch.bla\"",
",",
"\"on\"",
",",
... | [
22,
0
] | [
45,
5
] | python | en | ['en', 'en', 'en'] | True |
storage_setup | (hass, hass_storage) | Storage setup. | Storage setup. | def storage_setup(hass, hass_storage):
"""Storage setup."""
async def _storage(items=None, config=None):
if items is None:
hass_storage[DOMAIN] = {
"key": DOMAIN,
"version": 1,
"data": {
"items": [
{... | [
"def",
"storage_setup",
"(",
"hass",
",",
"hass_storage",
")",
":",
"async",
"def",
"_storage",
"(",
"items",
"=",
"None",
",",
"config",
"=",
"None",
")",
":",
"if",
"items",
"is",
"None",
":",
"hass_storage",
"[",
"DOMAIN",
"]",
"=",
"{",
"\"key\"",
... | [
51,
0
] | [
79,
19
] | python | en | ['en', 'bs', 'en'] | False |
test_config | (hass) | Test config. | Test config. | async def test_config(hass):
"""Test config."""
invalid_configs = [None, 1, {}, {"name with space": None}]
for cfg in invalid_configs:
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg}) | [
"async",
"def",
"test_config",
"(",
"hass",
")",
":",
"invalid_configs",
"=",
"[",
"None",
",",
"1",
",",
"{",
"}",
",",
"{",
"\"name with space\"",
":",
"None",
"}",
"]",
"for",
"cfg",
"in",
"invalid_configs",
":",
"assert",
"not",
"await",
"async_setup... | [
82,
0
] | [
87,
75
] | python | en | ['en', 'en', 'en'] | False |
test_config_options | (hass) | Test configuration options. | Test configuration options. | async def test_config_options(hass):
"""Test configuration options."""
count_start = len(hass.states.async_entity_ids())
_LOGGER.debug("ENTITIES @ start: %s", hass.states.async_entity_ids())
config = {
DOMAIN: {
"test_1": {},
"test_2": {
CONF_NAME: "Hell... | [
"async",
"def",
"test_config_options",
"(",
"hass",
")",
":",
"count_start",
"=",
"len",
"(",
"hass",
".",
"states",
".",
"async_entity_ids",
"(",
")",
")",
"_LOGGER",
".",
"debug",
"(",
"\"ENTITIES @ start: %s\"",
",",
"hass",
".",
"states",
".",
"async_ent... | [
90,
0
] | [
134,
5
] | python | en | ['en', 'fr', 'en'] | True |
test_methods_and_events | (hass) | Test methods and events. | Test methods and events. | async def test_methods_and_events(hass):
"""Test methods and events."""
hass.state = CoreState.starting
await async_setup_component(hass, DOMAIN, {DOMAIN: {"test1": {CONF_DURATION: 10}}})
state = hass.states.get("timer.test1")
assert state
assert state.state == STATUS_IDLE
results = []
... | [
"async",
"def",
"test_methods_and_events",
"(",
"hass",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"starting",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"\"test1\"",
":",
"{",
"CONF_DURATION",
":"... | [
137,
0
] | [
189,
49
] | python | en | ['en', 'en', 'en'] | True |
test_wait_till_timer_expires | (hass) | Test for a timer to end. | Test for a timer to end. | async def test_wait_till_timer_expires(hass):
"""Test for a timer to end."""
hass.state = CoreState.starting
await async_setup_component(hass, DOMAIN, {DOMAIN: {"test1": {CONF_DURATION: 10}}})
state = hass.states.get("timer.test1")
assert state
assert state.state == STATUS_IDLE
results = ... | [
"async",
"def",
"test_wait_till_timer_expires",
"(",
"hass",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"starting",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"\"test1\"",
":",
"{",
"CONF_DURATION",
... | [
192,
0
] | [
233,
28
] | python | en | ['en', 'en', 'en'] | True |
test_no_initial_state_and_no_restore_state | (hass) | Ensure that entity is create without initial and restore feature. | Ensure that entity is create without initial and restore feature. | async def test_no_initial_state_and_no_restore_state(hass):
"""Ensure that entity is create without initial and restore feature."""
hass.state = CoreState.starting
await async_setup_component(hass, DOMAIN, {DOMAIN: {"test1": {CONF_DURATION: 10}}})
state = hass.states.get("timer.test1")
assert stat... | [
"async",
"def",
"test_no_initial_state_and_no_restore_state",
"(",
"hass",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"starting",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"\"test1\"",
":",
"{",
"CO... | [
236,
0
] | [
244,
37
] | python | en | ['en', 'en', 'en'] | True |
test_config_reload | (hass, hass_admin_user, hass_read_only_user) | Test reload service. | Test reload service. | async def test_config_reload(hass, hass_admin_user, hass_read_only_user):
"""Test reload service."""
count_start = len(hass.states.async_entity_ids())
ent_reg = await entity_registry.async_get_registry(hass)
_LOGGER.debug("ENTITIES @ start: %s", hass.states.async_entity_ids())
config = {
D... | [
"async",
"def",
"test_config_reload",
"(",
"hass",
",",
"hass_admin_user",
",",
"hass_read_only_user",
")",
":",
"count_start",
"=",
"len",
"(",
"hass",
".",
"states",
".",
"async_entity_ids",
"(",
")",
")",
"ent_reg",
"=",
"await",
"entity_registry",
".",
"as... | [
247,
0
] | [
340,
55
] | python | en | ['en', 'da', 'en'] | True |
test_timer_restarted_event | (hass) | Ensure restarted event is called after starting a paused or running timer. | Ensure restarted event is called after starting a paused or running timer. | async def test_timer_restarted_event(hass):
"""Ensure restarted event is called after starting a paused or running timer."""
hass.state = CoreState.starting
await async_setup_component(hass, DOMAIN, {DOMAIN: {"test1": {CONF_DURATION: 10}}})
state = hass.states.get("timer.test1")
assert state
a... | [
"async",
"def",
"test_timer_restarted_event",
"(",
"hass",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"starting",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"\"test1\"",
":",
"{",
"CONF_DURATION",
... | [
343,
0
] | [
407,
28
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_when_timer_restarted | (hass) | Ensure timer's state changes when it restarted. | Ensure timer's state changes when it restarted. | async def test_state_changed_when_timer_restarted(hass):
"""Ensure timer's state changes when it restarted."""
hass.state = CoreState.starting
await async_setup_component(hass, DOMAIN, {DOMAIN: {"test1": {CONF_DURATION: 10}}})
state = hass.states.get("timer.test1")
assert state
assert state.st... | [
"async",
"def",
"test_state_changed_when_timer_restarted",
"(",
"hass",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"starting",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"\"test1\"",
":",
"{",
"CONF_... | [
410,
0
] | [
448,
28
] | python | en | ['en', 'en', 'en'] | True |
test_load_from_storage | (hass, storage_setup) | Test set up from storage. | Test set up from storage. | async def test_load_from_storage(hass, storage_setup):
"""Test set up from storage."""
assert await storage_setup()
state = hass.states.get(f"{DOMAIN}.timer_from_storage")
assert state.state == STATUS_IDLE
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "timer from storage"
assert state.attri... | [
"async",
"def",
"test_load_from_storage",
"(",
"hass",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"f\"{DOMAIN}.timer_from_storage\"",
")",
"assert",
"state",
".",
"state",
... | [
451,
0
] | [
457,
46
] | python | en | ['en', 'en', 'en'] | True |
test_editable_state_attribute | (hass, storage_setup) | Test editable attribute. | Test editable attribute. | async def test_editable_state_attribute(hass, storage_setup):
"""Test editable attribute."""
assert await storage_setup(config={DOMAIN: {"from_yaml": None}})
state = hass.states.get(f"{DOMAIN}.{DOMAIN}_from_storage")
assert state.state == STATUS_IDLE
assert state.attributes.get(ATTR_FRIENDLY_NAME) ... | [
"async",
"def",
"test_editable_state_attribute",
"(",
"hass",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"from_yaml\"",
":",
"None",
"}",
"}",
")",
"state",
"=",
"hass",
".",
"states",
... | [
460,
0
] | [
471,
37
] | python | de | ['de', 'et', 'en'] | False |
test_ws_list | (hass, hass_ws_client, storage_setup) | Test listing via WS. | Test listing via WS. | async def test_ws_list(hass, hass_ws_client, storage_setup):
"""Test listing via WS."""
assert await storage_setup(config={DOMAIN: {"from_yaml": None}})
client = await hass_ws_client(hass)
await client.send_json({"id": 6, "type": f"{DOMAIN}/list"})
resp = await client.receive_json()
assert res... | [
"async",
"def",
"test_ws_list",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"from_yaml\"",
":",
"None",
"}",
"}",
")",
"client",
"=",
"await",
"hass_... | [
474,
0
] | [
491,
65
] | python | hmn | ['nl', 'hmn', 'it'] | False |
test_ws_delete | (hass, hass_ws_client, storage_setup) | Test WS delete cleans up entity registry. | Test WS delete cleans up entity registry. | async def test_ws_delete(hass, hass_ws_client, storage_setup):
"""Test WS delete cleans up entity registry."""
assert await storage_setup()
timer_id = "from_storage"
timer_entity_id = f"{DOMAIN}.{DOMAIN}_{timer_id}"
ent_reg = await entity_registry.async_get_registry(hass)
state = hass.states.g... | [
"async",
"def",
"test_ws_delete",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
")",
"timer_id",
"=",
"\"from_storage\"",
"timer_entity_id",
"=",
"f\"{DOMAIN}.{DOMAIN}_{timer_id}\"",
"ent_reg",
"=",
"await... | [
494,
0
] | [
517,
72
] | python | en | ['en', 'en', 'en'] | True |
test_update | (hass, hass_ws_client, storage_setup) | Test updating timer entity. | Test updating timer entity. | async def test_update(hass, hass_ws_client, storage_setup):
"""Test updating timer entity."""
assert await storage_setup()
timer_id = "from_storage"
timer_entity_id = f"{DOMAIN}.{DOMAIN}_{timer_id}"
ent_reg = await entity_registry.async_get_registry(hass)
state = hass.states.get(timer_entity_... | [
"async",
"def",
"test_update",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
")",
"timer_id",
"=",
"\"from_storage\"",
"timer_entity_id",
"=",
"f\"{DOMAIN}.{DOMAIN}_{timer_id}\"",
"ent_reg",
"=",
"await",
... | [
520,
0
] | [
547,
83
] | python | en | ['da', 'en', 'en'] | True |
test_ws_create | (hass, hass_ws_client, storage_setup) | Test create WS. | Test create WS. | async def test_ws_create(hass, hass_ws_client, storage_setup):
"""Test create WS."""
assert await storage_setup(items=[])
timer_id = "new_timer"
timer_entity_id = f"{DOMAIN}.{timer_id}"
ent_reg = await entity_registry.async_get_registry(hass)
state = hass.states.get(timer_entity_id)
assert... | [
"async",
"def",
"test_ws_create",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
"items",
"=",
"[",
"]",
")",
"timer_id",
"=",
"\"new_timer\"",
"timer_entity_id",
"=",
"f\"{DOMAIN}.{timer_id}\"",
"ent_r... | [
550,
0
] | [
578,
83
] | python | en | ['en', 'gd', 'en'] | True |
test_setup_no_config | (hass, hass_admin_user) | Test component setup with no config. | Test component setup with no config. | async def test_setup_no_config(hass, hass_admin_user):
"""Test component setup with no config."""
count_start = len(hass.states.async_entity_ids())
assert await async_setup_component(hass, DOMAIN, {})
with patch(
"homeassistant.config.load_yaml_config_file", autospec=True, return_value={}
)... | [
"async",
"def",
"test_setup_no_config",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"count_start",
"=",
"len",
"(",
"hass",
".",
"states",
".",
"async_entity_ids",
"(",
")",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
... | [
581,
0
] | [
597,
61
] | python | en | ['en', 'pt', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the MiTempBt sensor. | Set up the MiTempBt sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the MiTempBt sensor."""
backend = BACKEND
_LOGGER.debug("MiTempBt is using %s backend", backend.__name__)
cache = config.get(CONF_CACHE)
poller = mitemp_bt_poller.MiTempBtPoller(
config.get(CONF_MAC),
cac... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"backend",
"=",
"BACKEND",
"_LOGGER",
".",
"debug",
"(",
"\"MiTempBt is using %s backend\"",
",",
"backend",
".",
"__name__",
")",
"cache",
... | [
71,
0
] | [
103,
22
] | python | en | ['en', 'ca', 'en'] | True |
MiTempBtSensor.__init__ | (self, poller, parameter, device, name, unit, force_update, median) | Initialize the sensor. | Initialize the sensor. | def __init__(self, poller, parameter, device, name, unit, force_update, median):
"""Initialize the sensor."""
self.poller = poller
self.parameter = parameter
self._device = device
self._unit = unit
self._name = name
self._state = None
self.data = []
... | [
"def",
"__init__",
"(",
"self",
",",
"poller",
",",
"parameter",
",",
"device",
",",
"name",
",",
"unit",
",",
"force_update",
",",
"median",
")",
":",
"self",
".",
"poller",
"=",
"poller",
"self",
".",
"parameter",
"=",
"parameter",
"self",
".",
"_dev... | [
109,
4
] | [
122,
34
] | python | en | ['en', 'en', 'en'] | True |
MiTempBtSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
125,
4
] | [
127,
25
] | python | en | ['en', 'mi', 'en'] | True |
MiTempBtSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
130,
4
] | [
132,
26
] | python | en | ['en', 'en', 'en'] | True |
MiTempBtSensor.unit_of_measurement | (self) | Return the units of measurement. | Return the units of measurement. | def unit_of_measurement(self):
"""Return the units of measurement."""
return self._unit | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit"
] | [
135,
4
] | [
137,
25
] | python | en | ['en', 'bg', 'en'] | True |
MiTempBtSensor.device_class | (self) | Device class of this entity. | Device class of this entity. | def device_class(self):
"""Device class of this entity."""
return self._device | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device"
] | [
140,
4
] | [
142,
27
] | 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.