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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
LutronCasetaFan.supported_features | (self) | Flag supported features. Speed Only. | Flag supported features. Speed Only. | def supported_features(self) -> int:
"""Flag supported features. Speed Only."""
return SUPPORT_SET_SPEED | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"SUPPORT_SET_SPEED"
] | [
70,
4
] | [
72,
32
] | python | en | ['en', 'en', 'en'] | True |
LutronCasetaFan.async_turn_on | (self, speed: str = None, **kwargs) | Turn the fan on. | Turn the fan on. | async def async_turn_on(self, speed: str = None, **kwargs):
"""Turn the fan on."""
if speed is None:
speed = SPEED_MEDIUM
await self.async_set_speed(speed) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"speed",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"speed",
"is",
"None",
":",
"speed",
"=",
"SPEED_MEDIUM",
"await",
"self",
".",
"async_set_speed",
"(",
"speed",
")"
] | [
74,
4
] | [
78,
41
] | python | en | ['en', 'fy', 'en'] | True |
LutronCasetaFan.async_turn_off | (self, **kwargs) | Turn the fan off. | Turn the fan off. | async def async_turn_off(self, **kwargs):
"""Turn the fan off."""
await self.async_set_speed(SPEED_OFF) | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"async_set_speed",
"(",
"SPEED_OFF",
")"
] | [
80,
4
] | [
82,
45
] | python | en | ['en', 'fy', 'en'] | True |
LutronCasetaFan.async_set_speed | (self, speed: str) | Set the speed of the fan. | Set the speed of the fan. | async def async_set_speed(self, speed: str) -> None:
"""Set the speed of the fan."""
await self._smartbridge.set_fan(self.device_id, SPEED_TO_VALUE[speed]) | [
"async",
"def",
"async_set_speed",
"(",
"self",
",",
"speed",
":",
"str",
")",
"->",
"None",
":",
"await",
"self",
".",
"_smartbridge",
".",
"set_fan",
"(",
"self",
".",
"device_id",
",",
"SPEED_TO_VALUE",
"[",
"speed",
"]",
")"
] | [
84,
4
] | [
86,
78
] | python | en | ['en', 'en', 'en'] | True |
LutronCasetaFan.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 VALUE_TO_SPEED[self._device["fan_speed"]] in [
SPEED_LOW,
SPEED_MEDIUM,
SPEED_HIGH,
] | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"VALUE_TO_SPEED",
"[",
"self",
".",
"_device",
"[",
"\"fan_speed\"",
"]",
"]",
"in",
"[",
"SPEED_LOW",
",",
"SPEED_MEDIUM",
",",
"SPEED_HIGH",
",",
"]"
] | [
89,
4
] | [
95,
9
] | python | en | ['en', 'fy', 'en'] | True |
LutronCasetaFan.async_update | (self) | Update when forcing a refresh of the device. | Update when forcing a refresh of the device. | async def async_update(self):
"""Update when forcing a refresh of the device."""
self._device = self._smartbridge.get_device_by_id(self.device_id)
_LOGGER.debug("State of this lutron fan device is %s", self._device) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"self",
".",
"_device",
"=",
"self",
".",
"_smartbridge",
".",
"get_device_by_id",
"(",
"self",
".",
"device_id",
")",
"_LOGGER",
".",
"debug",
"(",
"\"State of this lutron fan device is %s\"",
",",
"self",
... | [
97,
4
] | [
100,
76
] | python | en | ['en', 'en', 'en'] | True |
test_deprecated_base_class | (caplog) | Test deprecated base class. | Test deprecated base class. | def test_deprecated_base_class(caplog):
"""Test deprecated base class."""
class CustomVacuum(vacuum.VacuumDevice):
pass
class CustomStateVacuum(vacuum.StateVacuumDevice):
pass
CustomVacuum()
assert "VacuumDevice is deprecated, modify CustomVacuum" in caplog.text
CustomStateVa... | [
"def",
"test_deprecated_base_class",
"(",
"caplog",
")",
":",
"class",
"CustomVacuum",
"(",
"vacuum",
".",
"VacuumDevice",
")",
":",
"pass",
"class",
"CustomStateVacuum",
"(",
"vacuum",
".",
"StateVacuumDevice",
")",
":",
"pass",
"CustomVacuum",
"(",
")",
"asser... | [
4,
0
] | [
17,
85
] | python | en | ['en', 'en', 'en'] | True |
parse_model_http | (model_metadata, model_config) |
Check the configuration of a model to make sure it meets the
requirements for an image classification network (as expected by
this client)
|
Check the configuration of a model to make sure it meets the
requirements for an image classification network (as expected by
this client)
| def parse_model_http(model_metadata, model_config):
"""
Check the configuration of a model to make sure it meets the
requirements for an image classification network (as expected by
this client)
"""
if len(model_metadata['inputs']) != 1:
raise Exception("expecting 1 input, got {}".format... | [
"def",
"parse_model_http",
"(",
"model_metadata",
",",
"model_config",
")",
":",
"if",
"len",
"(",
"model_metadata",
"[",
"'inputs'",
"]",
")",
"!=",
"1",
":",
"raise",
"Exception",
"(",
"\"expecting 1 input, got {}\"",
".",
"format",
"(",
"len",
"(",
"model_m... | [
25,
0
] | [
69,
69
] | python | en | ['en', 'error', 'th'] | False |
async_setup_entity_legacy | (
config, async_add_entities, config_entry, discovery_data
) | Set up a MQTT Vacuum Legacy. | Set up a MQTT Vacuum Legacy. | async def async_setup_entity_legacy(
config, async_add_entities, config_entry, discovery_data
):
"""Set up a MQTT Vacuum Legacy."""
async_add_entities([MqttVacuum(config, config_entry, discovery_data)]) | [
"async",
"def",
"async_setup_entity_legacy",
"(",
"config",
",",
"async_add_entities",
",",
"config_entry",
",",
"discovery_data",
")",
":",
"async_add_entities",
"(",
"[",
"MqttVacuum",
"(",
"config",
",",
"config_entry",
",",
"discovery_data",
")",
"]",
")"
] | [
168,
0
] | [
172,
74
] | python | en | ['en', 'ca', 'en'] | True |
MqttVacuum.__init__ | (self, config, config_entry, discovery_info) | Initialize the vacuum. | Initialize the vacuum. | def __init__(self, config, config_entry, discovery_info):
"""Initialize the vacuum."""
self._cleaning = False
self._charging = False
self._docked = False
self._error = None
self._status = "Unknown"
self._battery_level = 0
self._fan_speed = "unknown"
... | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"config_entry",
",",
"discovery_info",
")",
":",
"self",
".",
"_cleaning",
"=",
"False",
"self",
".",
"_charging",
"=",
"False",
"self",
".",
"_docked",
"=",
"False",
"self",
".",
"_error",
"=",
"None",... | [
184,
4
] | [
205,
72
] | python | en | ['en', 'la', 'en'] | True |
MqttVacuum.discovery_update | (self, discovery_payload) | Handle updated discovery message. | Handle updated discovery message. | async def discovery_update(self, discovery_payload):
"""Handle updated discovery message."""
config = PLATFORM_SCHEMA_LEGACY(discovery_payload)
self._setup_from_config(config)
await self.attributes_discovery_update(config)
await self.availability_discovery_update(config)
... | [
"async",
"def",
"discovery_update",
"(",
"self",
",",
"discovery_payload",
")",
":",
"config",
"=",
"PLATFORM_SCHEMA_LEGACY",
"(",
"discovery_payload",
")",
"self",
".",
"_setup_from_config",
"(",
"config",
")",
"await",
"self",
".",
"attributes_discovery_update",
"... | [
256,
4
] | [
264,
35
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum.async_added_to_hass | (self) | Subscribe MQTT events. | Subscribe MQTT events. | async def async_added_to_hass(self):
"""Subscribe MQTT events."""
await super().async_added_to_hass()
await self._subscribe_topics() | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"await",
"self",
".",
"_subscribe_topics",
"(",
")"
] | [
266,
4
] | [
269,
38
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum.async_will_remove_from_hass | (self) | Unsubscribe when removed. | Unsubscribe when removed. | async def async_will_remove_from_hass(self):
"""Unsubscribe when removed."""
self._sub_state = await subscription.async_unsubscribe_topics(
self.hass, self._sub_state
)
await MqttAttributes.async_will_remove_from_hass(self)
await MqttAvailability.async_will_remove_fro... | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
":",
"self",
".",
"_sub_state",
"=",
"await",
"subscription",
".",
"async_unsubscribe_topics",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_sub_state",
")",
"await",
"MqttAttributes",
".",
"async_... | [
271,
4
] | [
278,
67
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum._subscribe_topics | (self) | (Re)Subscribe to topics. | (Re)Subscribe to topics. | async def _subscribe_topics(self):
"""(Re)Subscribe to topics."""
for tpl in self._templates.values():
if tpl is not None:
tpl.hass = self.hass
@callback
@log_messages(self.hass, self.entity_id)
def message_received(msg):
"""Handle new MQT... | [
"async",
"def",
"_subscribe_topics",
"(",
"self",
")",
":",
"for",
"tpl",
"in",
"self",
".",
"_templates",
".",
"values",
"(",
")",
":",
"if",
"tpl",
"is",
"not",
"None",
":",
"tpl",
".",
"hass",
"=",
"self",
".",
"hass",
"@",
"callback",
"@",
"log... | [
280,
4
] | [
376,
9
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum.name | (self) | Return the name of the vacuum. | Return the name of the vacuum. | def name(self):
"""Return the name of the vacuum."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
379,
4
] | [
381,
25
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum.should_poll | (self) | No polling needed for an MQTT vacuum. | No polling needed for an MQTT vacuum. | def should_poll(self):
"""No polling needed for an MQTT vacuum."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
384,
4
] | [
386,
20
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum.is_on | (self) | Return true if vacuum is on. | Return true if vacuum is on. | def is_on(self):
"""Return true if vacuum is on."""
return self._cleaning | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cleaning"
] | [
389,
4
] | [
391,
29
] | python | en | ['en', 'et', 'en'] | True |
MqttVacuum.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
394,
4
] | [
396,
30
] | python | ca | ['fr', 'ca', 'en'] | False |
MqttVacuum.status | (self) | Return a status string for the vacuum. | Return a status string for the vacuum. | def status(self):
"""Return a status string for the vacuum."""
return self._status | [
"def",
"status",
"(",
"self",
")",
":",
"return",
"self",
".",
"_status"
] | [
399,
4
] | [
401,
27
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum.fan_speed | (self) | Return the status of the vacuum. | Return the status of the vacuum. | def fan_speed(self):
"""Return the status of the vacuum."""
return self._fan_speed | [
"def",
"fan_speed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fan_speed"
] | [
404,
4
] | [
406,
30
] | python | en | ['en', 'la', 'en'] | True |
MqttVacuum.fan_speed_list | (self) | Return the status of the vacuum. | Return the status of the vacuum. | def fan_speed_list(self):
"""Return the status of the vacuum."""
return self._fan_speed_list | [
"def",
"fan_speed_list",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fan_speed_list"
] | [
409,
4
] | [
411,
35
] | python | en | ['en', 'la', 'en'] | True |
MqttVacuum.battery_level | (self) | Return the status of the vacuum. | Return the status of the vacuum. | def battery_level(self):
"""Return the status of the vacuum."""
return max(0, min(100, self._battery_level)) | [
"def",
"battery_level",
"(",
"self",
")",
":",
"return",
"max",
"(",
"0",
",",
"min",
"(",
"100",
",",
"self",
".",
"_battery_level",
")",
")"
] | [
414,
4
] | [
416,
52
] | python | en | ['en', 'la', 'en'] | True |
MqttVacuum.battery_icon | (self) | Return the battery icon for the vacuum cleaner.
No need to check SUPPORT_BATTERY, this won't be called if battery_level is None.
| Return the battery icon for the vacuum cleaner. | def battery_icon(self):
"""Return the battery icon for the vacuum cleaner.
No need to check SUPPORT_BATTERY, this won't be called if battery_level is None.
"""
return icon_for_battery_level(
battery_level=self.battery_level, charging=self._charging
) | [
"def",
"battery_icon",
"(",
"self",
")",
":",
"return",
"icon_for_battery_level",
"(",
"battery_level",
"=",
"self",
".",
"battery_level",
",",
"charging",
"=",
"self",
".",
"_charging",
")"
] | [
419,
4
] | [
427,
9
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return self._supported_features | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"self",
".",
"_supported_features"
] | [
430,
4
] | [
432,
39
] | python | en | ['da', 'en', 'en'] | True |
MqttVacuum.async_turn_on | (self, **kwargs) | Turn the vacuum on. | Turn the vacuum on. | async def async_turn_on(self, **kwargs):
"""Turn the vacuum on."""
if self.supported_features & SUPPORT_TURN_ON == 0:
return
mqtt.async_publish(
self.hass,
self._command_topic,
self._payloads[CONF_PAYLOAD_TURN_ON],
self._qos,
... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_TURN_ON",
"==",
"0",
":",
"return",
"mqtt",
".",
"async_publish",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_comman... | [
434,
4
] | [
447,
35
] | python | en | ['en', 'et', 'en'] | True |
MqttVacuum.async_turn_off | (self, **kwargs) | Turn the vacuum off. | Turn the vacuum off. | async def async_turn_off(self, **kwargs):
"""Turn the vacuum off."""
if self.supported_features & SUPPORT_TURN_OFF == 0:
return None
mqtt.async_publish(
self.hass,
self._command_topic,
self._payloads[CONF_PAYLOAD_TURN_OFF],
self._qos,
... | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_TURN_OFF",
"==",
"0",
":",
"return",
"None",
"mqtt",
".",
"async_publish",
"(",
"self",
".",
"hass",
",",
"self",
"."... | [
449,
4
] | [
462,
35
] | python | en | ['en', 'la', 'en'] | True |
MqttVacuum.async_stop | (self, **kwargs) | Stop the vacuum. | Stop the vacuum. | async def async_stop(self, **kwargs):
"""Stop the vacuum."""
if self.supported_features & SUPPORT_STOP == 0:
return None
mqtt.async_publish(
self.hass,
self._command_topic,
self._payloads[CONF_PAYLOAD_STOP],
self._qos,
self... | [
"async",
"def",
"async_stop",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_STOP",
"==",
"0",
":",
"return",
"None",
"mqtt",
".",
"async_publish",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_co... | [
464,
4
] | [
477,
35
] | python | en | ['en', 'la', 'en'] | True |
MqttVacuum.async_clean_spot | (self, **kwargs) | Perform a spot clean-up. | Perform a spot clean-up. | async def async_clean_spot(self, **kwargs):
"""Perform a spot clean-up."""
if self.supported_features & SUPPORT_CLEAN_SPOT == 0:
return None
mqtt.async_publish(
self.hass,
self._command_topic,
self._payloads[CONF_PAYLOAD_CLEAN_SPOT],
s... | [
"async",
"def",
"async_clean_spot",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_CLEAN_SPOT",
"==",
"0",
":",
"return",
"None",
"mqtt",
".",
"async_publish",
"(",
"self",
".",
"hass",
",",
"self",
... | [
479,
4
] | [
492,
35
] | python | en | ['pt', 'en', 'en'] | True |
MqttVacuum.async_locate | (self, **kwargs) | Locate the vacuum (usually by playing a song). | Locate the vacuum (usually by playing a song). | async def async_locate(self, **kwargs):
"""Locate the vacuum (usually by playing a song)."""
if self.supported_features & SUPPORT_LOCATE == 0:
return None
mqtt.async_publish(
self.hass,
self._command_topic,
self._payloads[CONF_PAYLOAD_LOCATE],
... | [
"async",
"def",
"async_locate",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_LOCATE",
"==",
"0",
":",
"return",
"None",
"mqtt",
".",
"async_publish",
"(",
"self",
".",
"hass",
",",
"self",
".",
... | [
494,
4
] | [
507,
35
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum.async_start_pause | (self, **kwargs) | Start, pause or resume the cleaning task. | Start, pause or resume the cleaning task. | async def async_start_pause(self, **kwargs):
"""Start, pause or resume the cleaning task."""
if self.supported_features & SUPPORT_PAUSE == 0:
return None
mqtt.async_publish(
self.hass,
self._command_topic,
self._payloads[CONF_PAYLOAD_START_PAUSE],... | [
"async",
"def",
"async_start_pause",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_PAUSE",
"==",
"0",
":",
"return",
"None",
"mqtt",
".",
"async_publish",
"(",
"self",
".",
"hass",
",",
"self",
"."... | [
509,
4
] | [
522,
35
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum.async_return_to_base | (self, **kwargs) | Tell the vacuum to return to its dock. | Tell the vacuum to return to its dock. | async def async_return_to_base(self, **kwargs):
"""Tell the vacuum to return to its dock."""
if self.supported_features & SUPPORT_RETURN_HOME == 0:
return None
mqtt.async_publish(
self.hass,
self._command_topic,
self._payloads[CONF_PAYLOAD_RETURN_... | [
"async",
"def",
"async_return_to_base",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_RETURN_HOME",
"==",
"0",
":",
"return",
"None",
"mqtt",
".",
"async_publish",
"(",
"self",
".",
"hass",
",",
"sel... | [
524,
4
] | [
537,
35
] | python | en | ['en', 'en', 'en'] | True |
MqttVacuum.async_set_fan_speed | (self, fan_speed, **kwargs) | Set fan speed. | Set fan speed. | async def async_set_fan_speed(self, fan_speed, **kwargs):
"""Set fan speed."""
if (
self.supported_features & SUPPORT_FAN_SPEED == 0
) or fan_speed not in self._fan_speed_list:
return None
mqtt.async_publish(
self.hass, self._set_fan_speed_topic, fan_... | [
"async",
"def",
"async_set_fan_speed",
"(",
"self",
",",
"fan_speed",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"self",
".",
"supported_features",
"&",
"SUPPORT_FAN_SPEED",
"==",
"0",
")",
"or",
"fan_speed",
"not",
"in",
"self",
".",
"_fan_speed_list",
... | [
539,
4
] | [
550,
35
] | python | fy | ['sv', 'fy', 'ur'] | False |
MqttVacuum.async_send_command | (self, command, params=None, **kwargs) | Send a command to a vacuum cleaner. | Send a command to a vacuum cleaner. | async def async_send_command(self, command, params=None, **kwargs):
"""Send a command to a vacuum cleaner."""
if self.supported_features & SUPPORT_SEND_COMMAND == 0:
return
if params:
message = {"command": command}
message.update(params)
message = ... | [
"async",
"def",
"async_send_command",
"(",
"self",
",",
"command",
",",
"params",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_SEND_COMMAND",
"==",
"0",
":",
"return",
"if",
"params",
":",
"message"... | [
552,
4
] | [
566,
35
] | python | en | ['en', 'en', 'en'] | True |
config_entry | (hass) | Config entry version 1 fixture. | Config entry version 1 fixture. | def config_entry(hass):
"""Config entry version 1 fixture."""
return MockConfigEntry(
domain=FLO_DOMAIN,
data={CONF_USERNAME: TEST_USER_ID, CONF_PASSWORD: TEST_PASSWORD},
version=1,
) | [
"def",
"config_entry",
"(",
"hass",
")",
":",
"return",
"MockConfigEntry",
"(",
"domain",
"=",
"FLO_DOMAIN",
",",
"data",
"=",
"{",
"CONF_USERNAME",
":",
"TEST_USER_ID",
",",
"CONF_PASSWORD",
":",
"TEST_PASSWORD",
"}",
",",
"version",
"=",
"1",
",",
")"
] | [
15,
0
] | [
21,
5
] | python | en | ['en', 'es', 'en'] | True |
aioclient_mock_fixture | (aioclient_mock) | Fixture to provide a aioclient mocker. | Fixture to provide a aioclient mocker. | def aioclient_mock_fixture(aioclient_mock):
"""Fixture to provide a aioclient mocker."""
now = round(time.time())
# Mocks the login response for flo.
aioclient_mock.post(
"https://api.meetflo.com/api/v1/users/auth",
text=json.dumps(
{
"token": TEST_TOKEN,
... | [
"def",
"aioclient_mock_fixture",
"(",
"aioclient_mock",
")",
":",
"now",
"=",
"round",
"(",
"time",
".",
"time",
"(",
")",
")",
"# Mocks the login response for flo.",
"aioclient_mock",
".",
"post",
"(",
"\"https://api.meetflo.com/api/v1/users/auth\"",
",",
"text",
"="... | [
25,
0
] | [
133,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the ComEd Hourly Pricing sensor. | Set up the ComEd Hourly Pricing sensor. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the ComEd Hourly Pricing sensor."""
websession = async_get_clientsession(hass)
dev = []
for variable in config[CONF_MONITORED_FEEDS]:
dev.append(
ComedHourlyPricingSensor(
... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"websession",
"=",
"async_get_clientsession",
"(",
"hass",
")",
"dev",
"=",
"[",
"]",
"for",
"variable",
"in",
"config"... | [
48,
0
] | [
64,
33
] | python | en | ['en', 'en', 'en'] | True |
ComedHourlyPricingSensor.__init__ | (self, loop, websession, sensor_type, offset, name) | Initialize the sensor. | Initialize the sensor. | def __init__(self, loop, websession, sensor_type, offset, name):
"""Initialize the sensor."""
self.loop = loop
self.websession = websession
if name:
self._name = name
else:
self._name = SENSOR_TYPES[sensor_type][0]
self.type = sensor_type
s... | [
"def",
"__init__",
"(",
"self",
",",
"loop",
",",
"websession",
",",
"sensor_type",
",",
"offset",
",",
"name",
")",
":",
"self",
".",
"loop",
"=",
"loop",
"self",
".",
"websession",
"=",
"websession",
"if",
"name",
":",
"self",
".",
"_name",
"=",
"n... | [
70,
4
] | [
81,
64
] | python | en | ['en', 'en', 'en'] | True |
ComedHourlyPricingSensor.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"
] | [
84,
4
] | [
86,
25
] | python | en | ['en', 'mi', 'en'] | True |
ComedHourlyPricingSensor.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"
] | [
89,
4
] | [
91,
26
] | python | en | ['en', 'en', 'en'] | True |
ComedHourlyPricingSensor.unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
94,
4
] | [
96,
40
] | python | en | ['en', 'en', 'en'] | True |
ComedHourlyPricingSensor.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
"}"
] | [
99,
4
] | [
101,
46
] | python | en | ['en', 'en', 'en'] | True |
ComedHourlyPricingSensor.async_update | (self) | Get the ComEd Hourly Pricing data from the web service. | Get the ComEd Hourly Pricing data from the web service. | async def async_update(self):
"""Get the ComEd Hourly Pricing data from the web service."""
try:
if self.type == CONF_FIVE_MINUTE or self.type == CONF_CURRENT_HOUR_AVERAGE:
url_string = _RESOURCE
if self.type == CONF_FIVE_MINUTE:
url_string... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"if",
"self",
".",
"type",
"==",
"CONF_FIVE_MINUTE",
"or",
"self",
".",
"type",
"==",
"CONF_CURRENT_HOUR_AVERAGE",
":",
"url_string",
"=",
"_RESOURCE",
"if",
"self",
".",
"type",
"==",
"CON... | [
103,
4
] | [
126,
72
] | python | en | ['en', 'en', 'en'] | True |
TestCommandSensorBinarySensor.setUp | (self) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setUp(self):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.addCleanup(self.hass.stop) | [
"def",
"setUp",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"self",
".",
"addCleanup",
"(",
"self",
".",
"hass",
".",
"stop",
")"
] | [
13,
4
] | [
16,
39
] | python | en | ['en', 'en', 'en'] | True |
TestCommandSensorBinarySensor.test_setup | (self) | Test sensor setup. | Test sensor setup. | def test_setup(self):
"""Test sensor setup."""
config = {
"name": "Test",
"command": "echo 1",
"payload_on": "1",
"payload_off": "0",
"command_timeout": 15,
}
devices = []
def add_dev_callback(devs, update):
... | [
"def",
"test_setup",
"(",
"self",
")",
":",
"config",
"=",
"{",
"\"name\"",
":",
"\"Test\"",
",",
"\"command\"",
":",
"\"echo 1\"",
",",
"\"payload_on\"",
":",
"\"1\"",
",",
"\"payload_off\"",
":",
"\"0\"",
",",
"\"command_timeout\"",
":",
"15",
",",
"}",
... | [
18,
4
] | [
41,
39
] | python | en | ['en', 'bs', 'en'] | True |
TestCommandSensorBinarySensor.test_template | (self) | Test setting the state with a template. | Test setting the state with a template. | def test_template(self):
"""Test setting the state with a template."""
data = command_line.CommandSensorData(self.hass, "echo 10", 15)
entity = command_line.CommandBinarySensor(
self.hass,
data,
"test",
None,
"1.0",
"0",
... | [
"def",
"test_template",
"(",
"self",
")",
":",
"data",
"=",
"command_line",
".",
"CommandSensorData",
"(",
"self",
".",
"hass",
",",
"\"echo 10\"",
",",
"15",
")",
"entity",
"=",
"command_line",
".",
"CommandBinarySensor",
"(",
"self",
".",
"hass",
",",
"d... | [
43,
4
] | [
57,
39
] | python | en | ['en', 'en', 'en'] | True |
TestCommandSensorBinarySensor.test_sensor_off | (self) | Test setting the state with a template. | Test setting the state with a template. | def test_sensor_off(self):
"""Test setting the state with a template."""
data = command_line.CommandSensorData(self.hass, "echo 0", 15)
entity = command_line.CommandBinarySensor(
self.hass, data, "test", None, "1", "0", None
)
entity.update()
assert STATE_OFF... | [
"def",
"test_sensor_off",
"(",
"self",
")",
":",
"data",
"=",
"command_line",
".",
"CommandSensorData",
"(",
"self",
".",
"hass",
",",
"\"echo 0\"",
",",
"15",
")",
"entity",
"=",
"command_line",
".",
"CommandBinarySensor",
"(",
"self",
".",
"hass",
",",
"... | [
59,
4
] | [
67,
40
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistantType, config: ConfigType) | Create a Genius Hub system. | Create a Genius Hub system. | async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Create a Genius Hub system."""
hass.data[DOMAIN] = {}
kwargs = dict(config[DOMAIN])
if CONF_HOST in kwargs:
args = (kwargs.pop(CONF_HOST),)
else:
args = (kwargs.pop(CONF_TOKEN),)
hub_uid = kwargs.pop(... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"kwargs",
"=",
"dict",
"(",
"config",
"[",
"DOMAIN",
"]",
")",
"if... | [
96,
0
] | [
125,
15
] | python | en | ['en', 'cy', 'en'] | True |
setup_service_functions | (hass: HomeAssistantType, broker) | Set up the service functions. | Set up the service functions. | def setup_service_functions(hass: HomeAssistantType, broker):
"""Set up the service functions."""
@verify_domain_control(hass, DOMAIN)
async def set_zone_mode(call) -> None:
"""Set the system mode."""
entity_id = call.data[ATTR_ENTITY_ID]
registry = await hass.helpers.entity_regist... | [
"def",
"setup_service_functions",
"(",
"hass",
":",
"HomeAssistantType",
",",
"broker",
")",
":",
"@",
"verify_domain_control",
"(",
"hass",
",",
"DOMAIN",
")",
"async",
"def",
"set_zone_mode",
"(",
"call",
")",
"->",
"None",
":",
"\"\"\"Set the system mode.\"\"\"... | [
129,
0
] | [
159,
5
] | python | en | ['en', 'en', 'en'] | True |
GeniusBroker.__init__ | (self, hass, client, hub_uid) | Initialize the geniushub client. | Initialize the geniushub client. | def __init__(self, hass, client, hub_uid) -> None:
"""Initialize the geniushub client."""
self.hass = hass
self.client = client
self._hub_uid = hub_uid
self._connect_error = False | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"client",
",",
"hub_uid",
")",
"->",
"None",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"client",
"=",
"client",
"self",
".",
"_hub_uid",
"=",
"hub_uid",
"self",
".",
"_connect_error",
"=",
"... | [
165,
4
] | [
170,
35
] | python | en | ['en', 'en', 'en'] | True |
GeniusBroker.hub_uid | (self) | Return the Hub UID (MAC address). | Return the Hub UID (MAC address). | def hub_uid(self) -> int:
"""Return the Hub UID (MAC address)."""
# pylint: disable=no-member
return self._hub_uid if self._hub_uid is not None else self.client.uid | [
"def",
"hub_uid",
"(",
"self",
")",
"->",
"int",
":",
"# pylint: disable=no-member",
"return",
"self",
".",
"_hub_uid",
"if",
"self",
".",
"_hub_uid",
"is",
"not",
"None",
"else",
"self",
".",
"client",
".",
"uid"
] | [
173,
4
] | [
176,
78
] | python | en | ['en', 'mt', 'en'] | True |
GeniusBroker.async_update | (self, now, **kwargs) | Update the geniushub client's data. | Update the geniushub client's data. | async def async_update(self, now, **kwargs) -> None:
"""Update the geniushub client's data."""
try:
await self.client.update()
if self._connect_error:
self._connect_error = False
_LOGGER.info("Connection to geniushub re-established")
except... | [
"async",
"def",
"async_update",
"(",
"self",
",",
"now",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"try",
":",
"await",
"self",
".",
"client",
".",
"update",
"(",
")",
"if",
"self",
".",
"_connect_error",
":",
"self",
".",
"_connect_error",
"=... | [
178,
4
] | [
198,
48
] | python | en | ['en', 'sn', 'en'] | True |
GeniusBroker.make_debug_log_entries | (self) | Make any useful debug log entries. | Make any useful debug log entries. | def make_debug_log_entries(self) -> None:
"""Make any useful debug log entries."""
# pylint: disable=protected-access
_LOGGER.debug(
"Raw JSON: \n\nclient._zones = %s \n\nclient._devices = %s",
self.client._zones,
self.client._devices,
) | [
"def",
"make_debug_log_entries",
"(",
"self",
")",
"->",
"None",
":",
"# pylint: disable=protected-access",
"_LOGGER",
".",
"debug",
"(",
"\"Raw JSON: \\n\\nclient._zones = %s \\n\\nclient._devices = %s\"",
",",
"self",
".",
"client",
".",
"_zones",
",",
"self",
".",
"c... | [
200,
4
] | [
207,
9
] | python | en | ['en', 'ceb', 'en'] | True |
GeniusEntity.__init__ | (self) | Initialize the entity. | Initialize the entity. | def __init__(self) -> None:
"""Initialize the entity."""
self._unique_id = self._name = None | [
"def",
"__init__",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_unique_id",
"=",
"self",
".",
"_name",
"=",
"None"
] | [
213,
4
] | [
215,
43
] | python | en | ['en', 'en', 'en'] | True |
GeniusEntity.async_added_to_hass | (self) | Set up a listener when this entity is added to HA. | Set up a listener when this entity is added to HA. | async def async_added_to_hass(self) -> None:
"""Set up a listener when this entity is added to HA."""
self.async_on_remove(async_dispatcher_connect(self.hass, DOMAIN, self._refresh)) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"DOMAIN",
",",
"self",
".",
"_refresh",
")",
")"
] | [
217,
4
] | [
219,
88
] | python | en | ['en', 'en', 'en'] | True |
GeniusEntity._refresh | (self, payload: Optional[dict] = None) | Process any signals. | Process any signals. | async def _refresh(self, payload: Optional[dict] = None) -> None:
"""Process any signals."""
self.async_schedule_update_ha_state(force_refresh=True) | [
"async",
"def",
"_refresh",
"(",
"self",
",",
"payload",
":",
"Optional",
"[",
"dict",
"]",
"=",
"None",
")",
"->",
"None",
":",
"self",
".",
"async_schedule_update_ha_state",
"(",
"force_refresh",
"=",
"True",
")"
] | [
221,
4
] | [
223,
63
] | python | en | ['en', 'en', 'en'] | True |
GeniusEntity.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self) -> Optional[str]:
"""Return a unique ID."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_unique_id"
] | [
226,
4
] | [
228,
30
] | python | ca | ['fr', 'ca', 'en'] | False |
GeniusEntity.name | (self) | Return the name of the geniushub entity. | Return the name of the geniushub entity. | def name(self) -> str:
"""Return the name of the geniushub entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
231,
4
] | [
233,
25
] | python | en | ['en', 'ig', 'en'] | True |
GeniusEntity.should_poll | (self) | Return False as geniushub entities should not be polled. | Return False as geniushub entities should not be polled. | def should_poll(self) -> bool:
"""Return False as geniushub entities should not be polled."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
236,
4
] | [
238,
20
] | python | en | ['en', 'af', 'en'] | True |
GeniusDevice.__init__ | (self, broker, device) | Initialize the Device. | Initialize the Device. | def __init__(self, broker, device) -> None:
"""Initialize the Device."""
super().__init__()
self._device = device
self._unique_id = f"{broker.hub_uid}_device_{device.id}"
self._last_comms = self._state_attr = None | [
"def",
"__init__",
"(",
"self",
",",
"broker",
",",
"device",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_device",
"=",
"device",
"self",
".",
"_unique_id",
"=",
"f\"{broker.hub_uid}_device_{device.id}\"",
"self",
"... | [
244,
4
] | [
250,
50
] | python | en | ['en', 'en', 'en'] | True |
GeniusDevice.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self) -> Dict[str, Any]:
"""Return the device state attributes."""
attrs = {}
attrs["assigned_zone"] = self._device.data["assignedZones"][0]["name"]
if self._last_comms:
attrs["last_comms"] = self._last_comms.isoformat()
state = dict(self.... | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"attrs",
"=",
"{",
"}",
"attrs",
"[",
"\"assigned_zone\"",
"]",
"=",
"self",
".",
"_device",
".",
"data",
"[",
"\"assignedZones\"",
"]",
"[",
"0",
"]",
... | [
253,
4
] | [
268,
20
] | python | en | ['en', 'en', 'en'] | True |
GeniusDevice.async_update | (self) | Update an entity's state data. | Update an entity's state data. | async def async_update(self) -> None:
"""Update an entity's state data."""
if "_state" in self._device.data: # only via v3 API
self._last_comms = dt_util.utc_from_timestamp(
self._device.data["_state"]["lastComms"]
) | [
"async",
"def",
"async_update",
"(",
"self",
")",
"->",
"None",
":",
"if",
"\"_state\"",
"in",
"self",
".",
"_device",
".",
"data",
":",
"# only via v3 API",
"self",
".",
"_last_comms",
"=",
"dt_util",
".",
"utc_from_timestamp",
"(",
"self",
".",
"_device",
... | [
270,
4
] | [
275,
13
] | python | en | ['en', 'en', 'en'] | True |
GeniusZone.__init__ | (self, broker, zone) | Initialize the Zone. | Initialize the Zone. | def __init__(self, broker, zone) -> None:
"""Initialize the Zone."""
super().__init__()
self._zone = zone
self._unique_id = f"{broker.hub_uid}_zone_{zone.id}" | [
"def",
"__init__",
"(",
"self",
",",
"broker",
",",
"zone",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_zone",
"=",
"zone",
"self",
".",
"_unique_id",
"=",
"f\"{broker.hub_uid}_zone_{zone.id}\""
] | [
281,
4
] | [
286,
60
] | python | en | ['en', 'en', 'en'] | True |
GeniusZone._refresh | (self, payload: Optional[dict] = None) | Process any signals. | Process any signals. | async def _refresh(self, payload: Optional[dict] = None) -> None:
"""Process any signals."""
if payload is None:
self.async_schedule_update_ha_state(force_refresh=True)
return
if payload["unique_id"] != self._unique_id:
return
if payload["service"] =... | [
"async",
"def",
"_refresh",
"(",
"self",
",",
"payload",
":",
"Optional",
"[",
"dict",
"]",
"=",
"None",
")",
"->",
"None",
":",
"if",
"payload",
"is",
"None",
":",
"self",
".",
"async_schedule_update_ha_state",
"(",
"force_refresh",
"=",
"True",
")",
"r... | [
288,
4
] | [
312,
39
] | python | en | ['en', 'en', 'en'] | True |
GeniusZone.name | (self) | Return the name of the climate device. | Return the name of the climate device. | def name(self) -> str:
"""Return the name of the climate device."""
return self._zone.name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_zone",
".",
"name"
] | [
315,
4
] | [
317,
30
] | python | en | ['en', 'en', 'en'] | True |
GeniusZone.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self) -> Dict[str, Any]:
"""Return the device state attributes."""
status = {k: v for k, v in self._zone.data.items() if k in GH_ZONE_ATTRS}
return {"status": status} | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"status",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_zone",
".",
"data",
".",
"items",
"(",
")",
"if",
"k",
"in",
"GH_Z... | [
320,
4
] | [
323,
33
] | python | en | ['en', 'en', 'en'] | True |
GeniusHeatingZone.__init__ | (self, broker, zone) | Initialize the Zone. | Initialize the Zone. | def __init__(self, broker, zone) -> None:
"""Initialize the Zone."""
super().__init__(broker, zone)
self._max_temp = self._min_temp = self._supported_features = None | [
"def",
"__init__",
"(",
"self",
",",
"broker",
",",
"zone",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"broker",
",",
"zone",
")",
"self",
".",
"_max_temp",
"=",
"self",
".",
"_min_temp",
"=",
"self",
".",
"_supported_features",
... | [
329,
4
] | [
333,
73
] | python | en | ['en', 'en', 'en'] | True |
GeniusHeatingZone.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self) -> Optional[float]:
"""Return the current temperature."""
return self._zone.data.get("temperature") | [
"def",
"current_temperature",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"self",
".",
"_zone",
".",
"data",
".",
"get",
"(",
"\"temperature\"",
")"
] | [
336,
4
] | [
338,
49
] | python | en | ['en', 'la', 'en'] | True |
GeniusHeatingZone.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self) -> float:
"""Return the temperature we try to reach."""
return self._zone.data["setpoint"] | [
"def",
"target_temperature",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_zone",
".",
"data",
"[",
"\"setpoint\"",
"]"
] | [
341,
4
] | [
343,
42
] | python | en | ['en', 'en', 'en'] | True |
GeniusHeatingZone.min_temp | (self) | Return max valid temperature that can be set. | Return max valid temperature that can be set. | def min_temp(self) -> float:
"""Return max valid temperature that can be set."""
return self._min_temp | [
"def",
"min_temp",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_min_temp"
] | [
346,
4
] | [
348,
29
] | python | en | ['en', 'en', 'en'] | True |
GeniusHeatingZone.max_temp | (self) | Return max valid temperature that can be set. | Return max valid temperature that can be set. | def max_temp(self) -> float:
"""Return max valid temperature that can be set."""
return self._max_temp | [
"def",
"max_temp",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_max_temp"
] | [
351,
4
] | [
353,
29
] | python | en | ['en', 'en', 'en'] | True |
GeniusHeatingZone.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self) -> str:
"""Return the unit of measurement."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
"->",
"str",
":",
"return",
"TEMP_CELSIUS"
] | [
356,
4
] | [
358,
27
] | python | en | ['en', 'la', 'en'] | True |
GeniusHeatingZone.supported_features | (self) | Return the bitmask of supported features. | Return the bitmask of supported features. | def supported_features(self) -> int:
"""Return the bitmask of supported features."""
return self._supported_features | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_supported_features"
] | [
361,
4
] | [
363,
39
] | python | en | ['en', 'en', 'en'] | True |
GeniusHeatingZone.async_set_temperature | (self, **kwargs) | Set a new target temperature for this zone. | Set a new target temperature for this zone. | async def async_set_temperature(self, **kwargs) -> None:
"""Set a new target temperature for this zone."""
await self._zone.set_override(
kwargs[ATTR_TEMPERATURE], kwargs.get(ATTR_DURATION, 3600)
) | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_zone",
".",
"set_override",
"(",
"kwargs",
"[",
"ATTR_TEMPERATURE",
"]",
",",
"kwargs",
".",
"get",
"(",
"ATTR_DURATION",
",",
... | [
365,
4
] | [
369,
9
] | python | en | ['en', 'en', 'en'] | True |
eval_data_dir | (
data_dir,
save_dir: str,
model_name: str,
bs: int = 8,
max_source_length: int = 1024,
type_path="val",
n_obs=None,
fp16=False,
task="summarization",
local_rank=None,
num_return_sequences=1,
dataset_kwargs: Dict = None,
prefix="",
**generate_kwargs,
) | Run evaluation on part of the data for one gpu and save to {save_dir}/rank_{rank}_output.json | Run evaluation on part of the data for one gpu and save to {save_dir}/rank_{rank}_output.json | def eval_data_dir(
data_dir,
save_dir: str,
model_name: str,
bs: int = 8,
max_source_length: int = 1024,
type_path="val",
n_obs=None,
fp16=False,
task="summarization",
local_rank=None,
num_return_sequences=1,
dataset_kwargs: Dict = None,
prefix="",
**generate_kwar... | [
"def",
"eval_data_dir",
"(",
"data_dir",
",",
"save_dir",
":",
"str",
",",
"model_name",
":",
"str",
",",
"bs",
":",
"int",
"=",
"8",
",",
"max_source_length",
":",
"int",
"=",
"1024",
",",
"type_path",
"=",
"\"val\"",
",",
"n_obs",
"=",
"None",
",",
... | [
45,
0
] | [
115,
40
] | python | en | ['en', 'en', 'en'] | True |
combine_partial_results | (partial_results) | Concatenate partial results into one file, then sort it by id. | Concatenate partial results into one file, then sort it by id. | def combine_partial_results(partial_results) -> List:
"""Concatenate partial results into one file, then sort it by id."""
records = []
for partial_result in partial_results:
records.extend(partial_result)
records = list(sorted(records, key=lambda x: x["id"]))
preds = [x["pred"] for x in rec... | [
"def",
"combine_partial_results",
"(",
"partial_results",
")",
"->",
"List",
":",
"records",
"=",
"[",
"]",
"for",
"partial_result",
"in",
"partial_results",
":",
"records",
".",
"extend",
"(",
"partial_result",
")",
"records",
"=",
"list",
"(",
"sorted",
"(",... | [
228,
0
] | [
235,
16
] | python | en | ['en', 'en', 'en'] | True |
is_on | (hass, entity_id: str) | Return if the fans are on based on the statemachine. | Return if the fans are on based on the statemachine. | def is_on(hass, entity_id: str) -> bool:
"""Return if the fans are on based on the statemachine."""
state = hass.states.get(entity_id)
if ATTR_SPEED in state.attributes:
return state.attributes[ATTR_SPEED] not in [SPEED_OFF, None]
return state.state == STATE_ON | [
"def",
"is_on",
"(",
"hass",
",",
"entity_id",
":",
"str",
")",
"->",
"bool",
":",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"entity_id",
")",
"if",
"ATTR_SPEED",
"in",
"state",
".",
"attributes",
":",
"return",
"state",
".",
"attributes",
... | [
54,
0
] | [
59,
34
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config: dict) | Expose fan control via statemachine and services. | Expose fan control via statemachine and services. | async def async_setup(hass, config: dict):
"""Expose fan control via statemachine and services."""
component = hass.data[DOMAIN] = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
)
await component.async_setup(config)
component.async_register_entity_service(
SERVICE_TURN_ON, {... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
":",
"dict",
")",
":",
"component",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
",",
"SCAN_INTERVAL",
")",
"await",
"componen... | [
62,
0
] | [
94,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry) | Set up a config entry. | Set up a config entry. | async def async_setup_entry(hass, entry):
"""Set up a config entry."""
return await hass.data[DOMAIN].async_setup_entry(entry) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"return",
"await",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"async_setup_entry",
"(",
"entry",
")"
] | [
97,
0
] | [
99,
59
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, entry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, entry):
"""Unload a config entry."""
return await hass.data[DOMAIN].async_unload_entry(entry) | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"return",
"await",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"async_unload_entry",
"(",
"entry",
")"
] | [
102,
0
] | [
104,
60
] | python | en | ['en', 'es', 'en'] | True |
FanEntity.set_speed | (self, speed: str) | Set the speed of the fan. | Set the speed of the fan. | def set_speed(self, speed: str) -> None:
"""Set the speed of the fan."""
raise NotImplementedError() | [
"def",
"set_speed",
"(",
"self",
",",
"speed",
":",
"str",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
110,
4
] | [
112,
35
] | python | en | ['en', 'en', 'en'] | True |
FanEntity.async_set_speed | (self, speed: str) | Set the speed of the fan. | Set the speed of the fan. | async def async_set_speed(self, speed: str):
"""Set the speed of the fan."""
if speed == SPEED_OFF:
await self.async_turn_off()
else:
await self.hass.async_add_executor_job(self.set_speed, speed) | [
"async",
"def",
"async_set_speed",
"(",
"self",
",",
"speed",
":",
"str",
")",
":",
"if",
"speed",
"==",
"SPEED_OFF",
":",
"await",
"self",
".",
"async_turn_off",
"(",
")",
"else",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"s... | [
114,
4
] | [
119,
73
] | python | en | ['en', 'en', 'en'] | True |
FanEntity.set_direction | (self, direction: str) | Set the direction of the fan. | Set the direction of the fan. | def set_direction(self, direction: str) -> None:
"""Set the direction of the fan."""
raise NotImplementedError() | [
"def",
"set_direction",
"(",
"self",
",",
"direction",
":",
"str",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
121,
4
] | [
123,
35
] | python | en | ['en', 'en', 'en'] | True |
FanEntity.async_set_direction | (self, direction: str) | Set the direction of the fan. | Set the direction of the fan. | async def async_set_direction(self, direction: str):
"""Set the direction of the fan."""
await self.hass.async_add_executor_job(self.set_direction, direction) | [
"async",
"def",
"async_set_direction",
"(",
"self",
",",
"direction",
":",
"str",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"set_direction",
",",
"direction",
")"
] | [
125,
4
] | [
127,
77
] | python | en | ['en', 'en', 'en'] | True |
FanEntity.turn_on | (self, speed: Optional[str] = None, **kwargs) | Turn on the fan. | Turn on the fan. | def turn_on(self, speed: Optional[str] = None, **kwargs) -> None:
"""Turn on the fan."""
raise NotImplementedError() | [
"def",
"turn_on",
"(",
"self",
",",
"speed",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
130,
4
] | [
132,
35
] | python | en | ['en', 'fy', 'en'] | True |
FanEntity.async_turn_on | (self, speed: Optional[str] = None, **kwargs) | Turn on the fan. | Turn on the fan. | async def async_turn_on(self, speed: Optional[str] = None, **kwargs):
"""Turn on the fan."""
if speed == SPEED_OFF:
await self.async_turn_off()
else:
await self.hass.async_add_executor_job(
ft.partial(self.turn_on, speed, **kwargs)
) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"speed",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"speed",
"==",
"SPEED_OFF",
":",
"await",
"self",
".",
"async_turn_off",
"(",
")",
"else",
":",
"await... | [
135,
4
] | [
142,
13
] | python | en | ['en', 'fy', 'en'] | True |
FanEntity.oscillate | (self, oscillating: bool) | Oscillate the fan. | Oscillate the fan. | def oscillate(self, oscillating: bool) -> None:
"""Oscillate the fan."""
raise NotImplementedError() | [
"def",
"oscillate",
"(",
"self",
",",
"oscillating",
":",
"bool",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
144,
4
] | [
146,
35
] | python | en | ['en', 'fy', 'en'] | True |
FanEntity.async_oscillate | (self, oscillating: bool) | Oscillate the fan. | Oscillate the fan. | async def async_oscillate(self, oscillating: bool):
"""Oscillate the fan."""
await self.hass.async_add_executor_job(self.oscillate, oscillating) | [
"async",
"def",
"async_oscillate",
"(",
"self",
",",
"oscillating",
":",
"bool",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"oscillate",
",",
"oscillating",
")"
] | [
148,
4
] | [
150,
75
] | python | en | ['en', 'fy', 'en'] | True |
FanEntity.is_on | (self) | Return true if the entity is on. | Return true if the entity is on. | def is_on(self):
"""Return true if the entity is on."""
return self.speed not in [SPEED_OFF, None] | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"speed",
"not",
"in",
"[",
"SPEED_OFF",
",",
"None",
"]"
] | [
153,
4
] | [
155,
50
] | python | en | ['en', 'en', 'en'] | True |
FanEntity.speed | (self) | Return the current speed. | Return the current speed. | def speed(self) -> Optional[str]:
"""Return the current speed."""
return None | [
"def",
"speed",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"None"
] | [
158,
4
] | [
160,
19
] | python | en | ['en', 'en', 'en'] | True |
FanEntity.speed_list | (self) | Get the list of available speeds. | Get the list of available speeds. | def speed_list(self) -> list:
"""Get the list of available speeds."""
return [] | [
"def",
"speed_list",
"(",
"self",
")",
"->",
"list",
":",
"return",
"[",
"]"
] | [
163,
4
] | [
165,
17
] | python | en | ['en', 'en', 'en'] | True |
FanEntity.current_direction | (self) | Return the current direction of the fan. | Return the current direction of the fan. | def current_direction(self) -> Optional[str]:
"""Return the current direction of the fan."""
return None | [
"def",
"current_direction",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"None"
] | [
168,
4
] | [
170,
19
] | python | en | ['en', 'en', 'en'] | True |
FanEntity.oscillating | (self) | Return whether or not the fan is currently oscillating. | Return whether or not the fan is currently oscillating. | def oscillating(self):
"""Return whether or not the fan is currently oscillating."""
return None | [
"def",
"oscillating",
"(",
"self",
")",
":",
"return",
"None"
] | [
173,
4
] | [
175,
19
] | python | en | ['en', 'en', 'en'] | True |
FanEntity.capability_attributes | (self) | Return capability attributes. | Return capability attributes. | def capability_attributes(self):
"""Return capability attributes."""
if self.supported_features & SUPPORT_SET_SPEED:
return {ATTR_SPEED_LIST: self.speed_list}
return {} | [
"def",
"capability_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_SET_SPEED",
":",
"return",
"{",
"ATTR_SPEED_LIST",
":",
"self",
".",
"speed_list",
"}",
"return",
"{",
"}"
] | [
178,
4
] | [
182,
17
] | python | en | ['en', 'la', 'en'] | True |
FanEntity.state_attributes | (self) | Return optional state attributes. | Return optional state attributes. | def state_attributes(self) -> dict:
"""Return optional state attributes."""
data = {}
supported_features = self.supported_features
if supported_features & SUPPORT_DIRECTION:
data[ATTR_DIRECTION] = self.current_direction
if supported_features & SUPPORT_OSCILLATE:
... | [
"def",
"state_attributes",
"(",
"self",
")",
"->",
"dict",
":",
"data",
"=",
"{",
"}",
"supported_features",
"=",
"self",
".",
"supported_features",
"if",
"supported_features",
"&",
"SUPPORT_DIRECTION",
":",
"data",
"[",
"ATTR_DIRECTION",
"]",
"=",
"self",
"."... | [
185,
4
] | [
199,
19
] | python | en | ['en', 'en', 'en'] | True |
FanEntity.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self) -> int:
"""Flag supported features."""
return 0 | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"0"
] | [
202,
4
] | [
204,
16
] | python | en | ['da', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up X10 dimmers over a mochad controller. | Set up X10 dimmers over a mochad controller. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up X10 dimmers over a mochad controller."""
mochad_controller = hass.data[DOMAIN]
devs = config.get(CONF_DEVICES)
add_entities([MochadLight(hass, mochad_controller.ctrl, dev) for dev in devs])
return True | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"mochad_controller",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"devs",
"=",
"config",
".",
"get",
"(",
"CONF_DEVICES",
")",
"add_ent... | [
34,
0
] | [
39,
15
] | python | en | ['en', 'en', 'en'] | True |
MochadLight.__init__ | (self, hass, ctrl, dev) | Initialize a Mochad Light Device. | Initialize a Mochad Light Device. | def __init__(self, hass, ctrl, dev):
"""Initialize a Mochad Light Device."""
self._controller = ctrl
self._address = dev[CONF_ADDRESS]
self._name = dev.get(CONF_NAME, f"x10_light_dev_{self._address}")
self._comm_type = dev.get(CONF_COMM_TYPE, "pl")
self.light = device.De... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"ctrl",
",",
"dev",
")",
":",
"self",
".",
"_controller",
"=",
"ctrl",
"self",
".",
"_address",
"=",
"dev",
"[",
"CONF_ADDRESS",
"]",
"self",
".",
"_name",
"=",
"dev",
".",
"get",
"(",
"CONF_NAME",
... | [
45,
4
] | [
55,
69
] | python | en | ['en', 'en', 'en'] | True |
MochadLight.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"
] | [
58,
4
] | [
60,
31
] | python | en | ['en', 'en', 'en'] | True |
MochadLight._get_device_status | (self) | Get the status of the light from mochad. | Get the status of the light from mochad. | def _get_device_status(self):
"""Get the status of the light from mochad."""
with REQ_LOCK:
status = self.light.get_status().rstrip()
return status == "on" | [
"def",
"_get_device_status",
"(",
"self",
")",
":",
"with",
"REQ_LOCK",
":",
"status",
"=",
"self",
".",
"light",
".",
"get_status",
"(",
")",
".",
"rstrip",
"(",
")",
"return",
"status",
"==",
"\"on\""
] | [
62,
4
] | [
66,
29
] | python | en | ['en', 'en', 'en'] | True |
MochadLight.name | (self) | Return the display name of this light. | Return the display name of this light. | def name(self):
"""Return the display name of this light."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
69,
4
] | [
71,
25
] | 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.