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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Vultr.start | (self, subscription) | Start a subscription. | Start a subscription. | def start(self, subscription):
"""Start a subscription."""
self.api.server_start(subscription)
self._force_update() | [
"def",
"start",
"(",
"self",
",",
"subscription",
")",
":",
"self",
".",
"api",
".",
"server_start",
"(",
"subscription",
")",
"self",
".",
"_force_update",
"(",
")"
] | [
91,
4
] | [
94,
28
] | python | en | ['en', 'lb', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up a ONVIF binary sensor. | Set up a ONVIF binary sensor. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up a ONVIF binary sensor."""
device = hass.data[DOMAIN][config_entry.unique_id]
entities = {
event.uid: ONVIFBinarySensor(event.uid, device)
for event in device.events.get_platform("binary_sensor")
}
async_... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"device",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"unique_id",
"]",
"entities",
"=",
"{",
"event",
".",
"uid",
":",
... | [
10,
0
] | [
33,
15
] | python | en | ['en', 'haw', 'en'] | True |
ONVIFBinarySensor.__init__ | (self, uid, device) | Initialize the ONVIF binary sensor. | Initialize the ONVIF binary sensor. | def __init__(self, uid, device):
"""Initialize the ONVIF binary sensor."""
ONVIFBaseEntity.__init__(self, device)
BinarySensorEntity.__init__(self)
self.uid = uid | [
"def",
"__init__",
"(",
"self",
",",
"uid",
",",
"device",
")",
":",
"ONVIFBaseEntity",
".",
"__init__",
"(",
"self",
",",
"device",
")",
"BinarySensorEntity",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"uid",
"=",
"uid"
] | [
39,
4
] | [
44,
22
] | python | en | ['en', 'haw', 'en'] | True |
ONVIFBinarySensor.is_on | (self) | Return true if event is active. | Return true if event is active. | def is_on(self) -> bool:
"""Return true if event is active."""
return self.device.events.get_uid(self.uid).value | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"device",
".",
"events",
".",
"get_uid",
"(",
"self",
".",
"uid",
")",
".",
"value"
] | [
47,
4
] | [
49,
57
] | python | en | ['en', 'nl', 'en'] | True |
ONVIFBinarySensor.name | (self) | Return the name of the event. | Return the name of the event. | def name(self) -> str:
"""Return the name of the event."""
return self.device.events.get_uid(self.uid).name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"device",
".",
"events",
".",
"get_uid",
"(",
"self",
".",
"uid",
")",
".",
"name"
] | [
52,
4
] | [
54,
56
] | python | en | ['en', 'en', 'en'] | True |
ONVIFBinarySensor.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self) -> Optional[str]:
"""Return the class of this device, from component DEVICE_CLASSES."""
return self.device.events.get_uid(self.uid).device_class | [
"def",
"device_class",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"device",
".",
"events",
".",
"get_uid",
"(",
"self",
".",
"uid",
")",
".",
"device_class"
] | [
57,
4
] | [
59,
64
] | python | en | ['en', 'en', 'en'] | True |
ONVIFBinarySensor.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self) -> str:
"""Return a unique ID."""
return self.uid | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"uid"
] | [
62,
4
] | [
64,
23
] | python | ca | ['fr', 'ca', 'en'] | False |
ONVIFBinarySensor.entity_registry_enabled_default | (self) | Return if the entity should be enabled when first added to the entity registry. | Return if the entity should be enabled when first added to the entity registry. | def entity_registry_enabled_default(self) -> bool:
"""Return if the entity should be enabled when first added to the entity registry."""
return self.device.events.get_uid(self.uid).entity_enabled | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"device",
".",
"events",
".",
"get_uid",
"(",
"self",
".",
"uid",
")",
".",
"entity_enabled"
] | [
67,
4
] | [
69,
66
] | python | en | ['en', 'en', 'en'] | True |
ONVIFBinarySensor.should_poll | (self) | Return True if entity has to be polled for state.
False if entity pushes its state to HA.
| Return True if entity has to be polled for state. | def should_poll(self) -> bool:
"""Return True if entity has to be polled for state.
False if entity pushes its state to HA.
"""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
72,
4
] | [
77,
20
] | python | en | ['en', 'en', 'en'] | True |
ONVIFBinarySensor.async_added_to_hass | (self) | Connect to dispatcher listening for entity data notifications. | Connect to dispatcher listening for entity data notifications. | async def async_added_to_hass(self):
"""Connect to dispatcher listening for entity data notifications."""
self.async_on_remove(
self.device.events.async_add_listener(self.async_write_ha_state)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"self",
".",
"device",
".",
"events",
".",
"async_add_listener",
"(",
"self",
".",
"async_write_ha_state",
")",
")"
] | [
79,
4
] | [
83,
9
] | python | en | ['en', 'en', 'en'] | True |
create_readable_names_for_imagenet_labels | () | Create a dict mapping label id to human readable string.
Returns:
labels_to_names: dictionary where keys are integers from to 1000
and values are human-readable names.
We retrieve a synset file, which contains a list of valid synset labels used
by ILSVRC competition. There is one synset one per line... | Create a dict mapping label id to human readable string. | def create_readable_names_for_imagenet_labels():
"""Create a dict mapping label id to human readable string.
Returns:
labels_to_names: dictionary where keys are integers from to 1000
and values are human-readable names.
We retrieve a synset file, which contains a list of valid synset labels used
b... | [
"def",
"create_readable_names_for_imagenet_labels",
"(",
")",
":",
"# pylint: disable=g-line-too-long",
"base_url",
"=",
"'https://raw.githubusercontent.com/tensorflow/models/master/research/inception/inception/data/'",
"synset_url",
"=",
"'{}/imagenet_lsvrc_2015_synsets.txt'",
".",
"forma... | [
66,
0
] | [
119,
24
] | python | en | ['en', 'en', 'en'] | True |
get_split | (split_name, dataset_dir, file_pattern=None, reader=None) | Gets a dataset tuple with instructions for reading ImageNet.
Args:
split_name: A train/test split name.
dataset_dir: The base directory of the dataset sources.
file_pattern: The file pattern to use when matching the dataset sources.
It is assumed that the pattern contains a '%s' string so that the ... | Gets a dataset tuple with instructions for reading ImageNet. | def get_split(split_name, dataset_dir, file_pattern=None, reader=None):
"""Gets a dataset tuple with instructions for reading ImageNet.
Args:
split_name: A train/test split name.
dataset_dir: The base directory of the dataset sources.
file_pattern: The file pattern to use when matching the dataset sour... | [
"def",
"get_split",
"(",
"split_name",
",",
"dataset_dir",
",",
"file_pattern",
"=",
"None",
",",
"reader",
"=",
"None",
")",
":",
"if",
"split_name",
"not",
"in",
"_SPLITS_TO_SIZES",
":",
"raise",
"ValueError",
"(",
"'split name %s was not recognized.'",
"%",
"... | [
122,
0
] | [
198,
38
] | python | en | ['en', 'en', 'en'] | True |
test_tracker_entity | () | Test tracker entity. | Test tracker entity. | def test_tracker_entity():
"""Test tracker entity."""
class TestEntry(config_entry.TrackerEntity):
"""Mock tracker class."""
should_poll = False
instance = TestEntry()
assert instance.force_update
instance.should_poll = True
assert not instance.force_update | [
"def",
"test_tracker_entity",
"(",
")",
":",
"class",
"TestEntry",
"(",
"config_entry",
".",
"TrackerEntity",
")",
":",
"\"\"\"Mock tracker class.\"\"\"",
"should_poll",
"=",
"False",
"instance",
"=",
"TestEntry",
"(",
")",
"assert",
"instance",
".",
"force_update",... | [
4,
0
] | [
18,
36
] | python | cy | ['da', 'cy', 'en'] | False |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Skybeacon sensor. | Set up the Skybeacon sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Skybeacon sensor."""
name = config.get(CONF_NAME)
mac = config.get(CONF_MAC)
_LOGGER.debug("Setting up...")
mon = Monitor(hass, mac, name)
add_entities([SkybeaconTemp(name, mon)])
add_entities([SkybeaconHumid... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"mac",
"=",
"config",
".",
"get",
"(",
"CONF_MAC",
")",
"_LOGGER",
".",
"d... | [
45,
0
] | [
61,
15
] | python | en | ['en', 'gl', 'en'] | True |
SkybeaconHumid.__init__ | (self, name, mon) | Initialize a sensor. | Initialize a sensor. | def __init__(self, name, mon):
"""Initialize a sensor."""
self.mon = mon
self._name = name | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"mon",
")",
":",
"self",
".",
"mon",
"=",
"mon",
"self",
".",
"_name",
"=",
"name"
] | [
67,
4
] | [
70,
25
] | python | en | ['en', 'pt', 'it'] | False |
SkybeaconHumid.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"
] | [
73,
4
] | [
75,
25
] | python | en | ['en', 'mi', 'en'] | True |
SkybeaconHumid.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
return self.mon.data["humid"] | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"mon",
".",
"data",
"[",
"\"humid\"",
"]"
] | [
78,
4
] | [
80,
37
] | python | en | ['en', 'en', 'en'] | True |
SkybeaconHumid.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."""
return PERCENTAGE | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"PERCENTAGE"
] | [
83,
4
] | [
85,
25
] | python | en | ['en', 'en', 'en'] | True |
SkybeaconHumid.device_state_attributes | (self) | Return the state attributes of the sensor. | Return the state attributes of the sensor. | def device_state_attributes(self):
"""Return the state attributes of the sensor."""
return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_DEVICE",
":",
"\"SKYBEACON\"",
",",
"ATTR_MODEL",
":",
"1",
"}"
] | [
88,
4
] | [
90,
56
] | python | en | ['en', 'en', 'en'] | True |
SkybeaconTemp.__init__ | (self, name, mon) | Initialize a sensor. | Initialize a sensor. | def __init__(self, name, mon):
"""Initialize a sensor."""
self.mon = mon
self._name = name | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"mon",
")",
":",
"self",
".",
"mon",
"=",
"mon",
"self",
".",
"_name",
"=",
"name"
] | [
96,
4
] | [
99,
25
] | python | en | ['en', 'pt', 'it'] | False |
SkybeaconTemp.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"
] | [
102,
4
] | [
104,
25
] | python | en | ['en', 'mi', 'en'] | True |
SkybeaconTemp.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
return self.mon.data["temp"] | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"mon",
".",
"data",
"[",
"\"temp\"",
"]"
] | [
107,
4
] | [
109,
36
] | python | en | ['en', 'en', 'en'] | True |
SkybeaconTemp.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."""
return TEMP_CELSIUS | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
112,
4
] | [
114,
27
] | python | en | ['en', 'en', 'en'] | True |
SkybeaconTemp.device_state_attributes | (self) | Return the state attributes of the sensor. | Return the state attributes of the sensor. | def device_state_attributes(self):
"""Return the state attributes of the sensor."""
return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_DEVICE",
":",
"\"SKYBEACON\"",
",",
"ATTR_MODEL",
":",
"1",
"}"
] | [
117,
4
] | [
119,
56
] | python | en | ['en', 'en', 'en'] | True |
Monitor.__init__ | (self, hass, mac, name) | Construct interface object. | Construct interface object. | def __init__(self, hass, mac, name):
"""Construct interface object."""
threading.Thread.__init__(self)
self.daemon = False
self.hass = hass
self.mac = mac
self.name = name
self.data = {"temp": STATE_UNKNOWN, "humid": STATE_UNKNOWN}
self.keep_going = True
... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"mac",
",",
"name",
")",
":",
"threading",
".",
"Thread",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"daemon",
"=",
"False",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"mac",
"=",
"mac",
... | [
125,
4
] | [
134,
38
] | python | en | ['en', 'en', 'en'] | True |
Monitor.run | (self) | Thread that keeps connection alive. | Thread that keeps connection alive. | def run(self):
"""Thread that keeps connection alive."""
cached_char = Characteristic(BLE_TEMP_UUID, BLE_TEMP_HANDLE)
adapter = GATTToolBackend()
while True:
try:
_LOGGER.debug("Connecting to %s", self.name)
# We need concurrent connect, so let... | [
"def",
"run",
"(",
"self",
")",
":",
"cached_char",
"=",
"Characteristic",
"(",
"BLE_TEMP_UUID",
",",
"BLE_TEMP_HANDLE",
")",
"adapter",
"=",
"GATTToolBackend",
"(",
")",
"while",
"True",
":",
"try",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Connecting to %s\"",
... | [
136,
4
] | [
166,
30
] | python | en | ['en', 'en', 'en'] | True |
Monitor._update | (self, handle, value) | Notification callback from pygatt. | Notification callback from pygatt. | def _update(self, handle, value):
"""Notification callback from pygatt."""
_LOGGER.debug(
"%s: %15s temperature = %-2d.%-2d, humidity = %3d",
handle,
self.name,
value[0],
value[2],
value[1],
)
self.data["temp"] = flo... | [
"def",
"_update",
"(",
"self",
",",
"handle",
",",
"value",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"%s: %15s temperature = %-2d.%-2d, humidity = %3d\"",
",",
"handle",
",",
"self",
".",
"name",
",",
"value",
"[",
"0",
"]",
",",
"value",
"[",
"2",
"]",
... | [
168,
4
] | [
179,
37
] | python | en | ['en', 'sv', 'en'] | True |
Monitor.terminate | (self) | Signal runner to stop and join thread. | Signal runner to stop and join thread. | def terminate(self):
"""Signal runner to stop and join thread."""
self.keep_going = False
self.event.set()
self.join() | [
"def",
"terminate",
"(",
"self",
")",
":",
"self",
".",
"keep_going",
"=",
"False",
"self",
".",
"event",
".",
"set",
"(",
")",
"self",
".",
"join",
"(",
")"
] | [
181,
4
] | [
185,
19
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry_attribute_entities | (
hass, config_entry, async_add_entities, sensors, sensor_class
) | Set up entities for block attributes. | Set up entities for block attributes. | async def async_setup_entry_attribute_entities(
hass, config_entry, async_add_entities, sensors, sensor_class
):
"""Set up entities for block attributes."""
wrapper: ShellyDeviceWrapper = hass.data[DOMAIN][DATA_CONFIG_ENTRY][
config_entry.entry_id
][COAP]
blocks = []
for block in wrappe... | [
"async",
"def",
"async_setup_entry_attribute_entities",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
",",
"sensors",
",",
"sensor_class",
")",
":",
"wrapper",
":",
"ShellyDeviceWrapper",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_CONF... | [
14,
0
] | [
53,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry_rest | (
hass, config_entry, async_add_entities, sensors, sensor_class
) | Set up entities for REST sensors. | Set up entities for REST sensors. | async def async_setup_entry_rest(
hass, config_entry, async_add_entities, sensors, sensor_class
):
"""Set up entities for REST sensors."""
wrapper: ShellyDeviceRestWrapper = hass.data[DOMAIN][DATA_CONFIG_ENTRY][
config_entry.entry_id
][REST]
entities = []
for sensor_id in sensors:
... | [
"async",
"def",
"async_setup_entry_rest",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
",",
"sensors",
",",
"sensor_class",
")",
":",
"wrapper",
":",
"ShellyDeviceRestWrapper",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_CONFIG_ENTRY",... | [
56,
0
] | [
74,
88
] | python | en | ['en', 'en', 'en'] | True |
ShellyBlockEntity.__init__ | (self, wrapper: ShellyDeviceWrapper, block) | Initialize Shelly entity. | Initialize Shelly entity. | def __init__(self, wrapper: ShellyDeviceWrapper, block):
"""Initialize Shelly entity."""
self.wrapper = wrapper
self.block = block
self._name = get_entity_name(wrapper, block) | [
"def",
"__init__",
"(",
"self",
",",
"wrapper",
":",
"ShellyDeviceWrapper",
",",
"block",
")",
":",
"self",
".",
"wrapper",
"=",
"wrapper",
"self",
".",
"block",
"=",
"block",
"self",
".",
"_name",
"=",
"get_entity_name",
"(",
"wrapper",
",",
"block",
")... | [
114,
4
] | [
118,
52
] | python | en | ['en', 'en', 'it'] | True |
ShellyBlockEntity.name | (self) | Name of entity. | Name of entity. | def name(self):
"""Name of entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
121,
4
] | [
123,
25
] | python | en | ['en', 'el-Latn', 'en'] | True |
ShellyBlockEntity.should_poll | (self) | If device should be polled. | If device should be polled. | def should_poll(self):
"""If device should be polled."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
126,
4
] | [
128,
20
] | python | en | ['en', 'en', 'en'] | True |
ShellyBlockEntity.device_info | (self) | Device info. | Device info. | def device_info(self):
"""Device info."""
return {
"connections": {(device_registry.CONNECTION_NETWORK_MAC, self.wrapper.mac)}
} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"connections\"",
":",
"{",
"(",
"device_registry",
".",
"CONNECTION_NETWORK_MAC",
",",
"self",
".",
"wrapper",
".",
"mac",
")",
"}",
"}"
] | [
131,
4
] | [
135,
9
] | python | en | ['en', 'pl', 'en'] | False |
ShellyBlockEntity.unique_id | (self) | Return unique ID of entity. | Return unique ID of entity. | def unique_id(self):
"""Return unique ID of entity."""
return f"{self.wrapper.mac}-{self.block.description}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self.wrapper.mac}-{self.block.description}\""
] | [
143,
4
] | [
145,
61
] | python | en | ['en', 'cy', 'en'] | True |
ShellyBlockEntity.async_added_to_hass | (self) | When entity is added to HASS. | When entity is added to HASS. | async def async_added_to_hass(self):
"""When entity is added to HASS."""
self.async_on_remove(self.wrapper.async_add_listener(self._update_callback)) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"self",
".",
"wrapper",
".",
"async_add_listener",
"(",
"self",
".",
"_update_callback",
")",
")"
] | [
147,
4
] | [
149,
84
] | python | en | ['en', 'en', 'en'] | True |
ShellyBlockEntity.async_update | (self) | Update entity with latest info. | Update entity with latest info. | async def async_update(self):
"""Update entity with latest info."""
await self.wrapper.async_request_refresh() | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"wrapper",
".",
"async_request_refresh",
"(",
")"
] | [
151,
4
] | [
153,
50
] | python | en | ['en', 'en', 'en'] | True |
ShellyBlockEntity._update_callback | (self) | Handle device update. | Handle device update. | def _update_callback(self):
"""Handle device update."""
self.async_write_ha_state() | [
"def",
"_update_callback",
"(",
"self",
")",
":",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
156,
4
] | [
158,
35
] | python | en | ['fr', 'en', 'en'] | True |
ShellyBlockAttributeEntity.__init__ | (
self,
wrapper: ShellyDeviceWrapper,
block: aioshelly.Block,
attribute: str,
description: BlockAttributeDescription,
) | Initialize sensor. | Initialize sensor. | def __init__(
self,
wrapper: ShellyDeviceWrapper,
block: aioshelly.Block,
attribute: str,
description: BlockAttributeDescription,
) -> None:
"""Initialize sensor."""
super().__init__(wrapper, block)
self.attribute = attribute
self.description =... | [
"def",
"__init__",
"(",
"self",
",",
"wrapper",
":",
"ShellyDeviceWrapper",
",",
"block",
":",
"aioshelly",
".",
"Block",
",",
"attribute",
":",
"str",
",",
"description",
":",
"BlockAttributeDescription",
",",
")",
"->",
"None",
":",
"super",
"(",
")",
".... | [
164,
4
] | [
184,
75
] | python | en | ['en', 'ro', 'it'] | False |
ShellyBlockAttributeEntity.unique_id | (self) | Return unique ID of entity. | Return unique ID of entity. | def unique_id(self):
"""Return unique ID of entity."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
187,
4
] | [
189,
30
] | python | en | ['en', 'cy', 'en'] | True |
ShellyBlockAttributeEntity.name | (self) | Name of sensor. | Name of sensor. | def name(self):
"""Name of sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
192,
4
] | [
194,
25
] | python | en | ['en', 'mi', 'en'] | True |
ShellyBlockAttributeEntity.entity_registry_enabled_default | (self) | Return if it should be enabled by default. | Return if it should be enabled by default. | def entity_registry_enabled_default(self) -> bool:
"""Return if it should be enabled by default."""
return self.description.default_enabled | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"description",
".",
"default_enabled"
] | [
197,
4
] | [
199,
47
] | python | en | ['en', 'en', 'en'] | True |
ShellyBlockAttributeEntity.attribute_value | (self) | Value of sensor. | Value of sensor. | def attribute_value(self):
"""Value of sensor."""
value = getattr(self.block, self.attribute)
if value is None:
return None
return self.description.value(value) | [
"def",
"attribute_value",
"(",
"self",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
".",
"block",
",",
"self",
".",
"attribute",
")",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"description",
".",
"value",
"(",
"value... | [
202,
4
] | [
209,
44
] | python | en | ['en', 'pt', 'en'] | True |
ShellyBlockAttributeEntity.unit_of_measurement | (self) | Return unit of sensor. | Return unit of sensor. | def unit_of_measurement(self):
"""Return unit of sensor."""
return self._unit | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit"
] | [
212,
4
] | [
214,
25
] | python | en | ['en', 'bg', 'en'] | True |
ShellyBlockAttributeEntity.device_class | (self) | Device class of sensor. | Device class of sensor. | def device_class(self):
"""Device class of sensor."""
return self.description.device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"description",
".",
"device_class"
] | [
217,
4
] | [
219,
44
] | python | en | ['en', 'ro', 'en'] | True |
ShellyBlockAttributeEntity.icon | (self) | Icon of sensor. | Icon of sensor. | def icon(self):
"""Icon of sensor."""
return self.description.icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"description",
".",
"icon"
] | [
222,
4
] | [
224,
36
] | python | en | ['en', 'fa', 'en'] | True |
ShellyBlockAttributeEntity.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
if self.description.device_state_attributes is None:
return None
return self.description.device_state_attributes(self.block) | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"description",
".",
"device_state_attributes",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"description",
".",
"device_state_attributes",
"(",
"self",
".",
"block",
")"
] | [
237,
4
] | [
242,
67
] | python | en | ['en', 'en', 'en'] | True |
ShellyRestAttributeEntity.__init__ | (
self, wrapper: ShellyDeviceWrapper, description: RestAttributeDescription
) | Initialize sensor. | Initialize sensor. | def __init__(
self, wrapper: ShellyDeviceWrapper, description: RestAttributeDescription
) -> None:
"""Initialize sensor."""
super().__init__(wrapper)
self.wrapper = wrapper
self.description = description
self._unit = self.description.unit
self._name = get_ent... | [
"def",
"__init__",
"(",
"self",
",",
"wrapper",
":",
"ShellyDeviceWrapper",
",",
"description",
":",
"RestAttributeDescription",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"wrapper",
")",
"self",
".",
"wrapper",
"=",
"wrapper",
"self",
... | [
248,
4
] | [
259,
54
] | python | en | ['en', 'ro', 'it'] | False |
ShellyRestAttributeEntity.name | (self) | Name of sensor. | Name of sensor. | def name(self):
"""Name of sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
262,
4
] | [
264,
25
] | python | en | ['en', 'mi', 'en'] | True |
ShellyRestAttributeEntity.device_info | (self) | Device info. | Device info. | def device_info(self):
"""Device info."""
return {
"connections": {(device_registry.CONNECTION_NETWORK_MAC, self.wrapper.mac)}
} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"connections\"",
":",
"{",
"(",
"device_registry",
".",
"CONNECTION_NETWORK_MAC",
",",
"self",
".",
"wrapper",
".",
"mac",
")",
"}",
"}"
] | [
267,
4
] | [
271,
9
] | python | en | ['en', 'pl', 'en'] | False |
ShellyRestAttributeEntity.entity_registry_enabled_default | (self) | Return if it should be enabled by default. | Return if it should be enabled by default. | def entity_registry_enabled_default(self) -> bool:
"""Return if it should be enabled by default."""
return self.description.default_enabled | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"description",
".",
"default_enabled"
] | [
274,
4
] | [
276,
47
] | python | en | ['en', 'en', 'en'] | True |
ShellyRestAttributeEntity.unit_of_measurement | (self) | Return unit of sensor. | Return unit of sensor. | def unit_of_measurement(self):
"""Return unit of sensor."""
return self.description.unit | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"description",
".",
"unit"
] | [
291,
4
] | [
293,
36
] | python | en | ['en', 'bg', 'en'] | True |
ShellyRestAttributeEntity.device_class | (self) | Device class of sensor. | Device class of sensor. | def device_class(self):
"""Device class of sensor."""
return self.description.device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"description",
".",
"device_class"
] | [
296,
4
] | [
298,
44
] | python | en | ['en', 'ro', 'en'] | True |
ShellyRestAttributeEntity.icon | (self) | Icon of sensor. | Icon of sensor. | def icon(self):
"""Icon of sensor."""
return self.description.icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"description",
".",
"icon"
] | [
301,
4
] | [
303,
36
] | python | en | ['en', 'fa', 'en'] | True |
ShellyRestAttributeEntity.unique_id | (self) | Return unique ID of entity. | Return unique ID of entity. | def unique_id(self):
"""Return unique ID of entity."""
return f"{self.wrapper.mac}-{self.description.path}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self.wrapper.mac}-{self.description.path}\""
] | [
306,
4
] | [
308,
60
] | python | en | ['en', 'cy', 'en'] | True |
ShellyRestAttributeEntity.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self) -> dict:
"""Return the state attributes."""
if self._attributes is None:
return None
attributes = dict()
for attrib in self._attributes:
description = attrib.get("description")
attribute_value = get_rest_value_from_p... | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"dict",
":",
"if",
"self",
".",
"_attributes",
"is",
"None",
":",
"return",
"None",
"attributes",
"=",
"dict",
"(",
")",
"for",
"attrib",
"in",
"self",
".",
"_attributes",
":",
"description",
"=",
... | [
311,
4
] | [
327,
25
] | python | en | ['en', 'en', 'en'] | True |
test_default_setup | (hass, aioclient_mock) | Test the default setup. | Test the default setup. | async def test_default_setup(hass, aioclient_mock):
"""Test the default setup."""
aioclient_mock.get(
re.compile("api.foobot.io/v2/owner/.*"),
text=load_fixture("foobot_devices.json"),
)
aioclient_mock.get(
re.compile("api.foobot.io/v2/device/.*"), text=load_fixture("foobot_data.... | [
"async",
"def",
"test_default_setup",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"re",
".",
"compile",
"(",
"\"api.foobot.io/v2/owner/.*\"",
")",
",",
"text",
"=",
"load_fixture",
"(",
"\"foobot_devices.json\"",
")",
",",
")... | [
31,
0
] | [
55,
70
] | python | en | ['en', 'da', 'en'] | True |
test_setup_timeout_error | (hass, aioclient_mock) | Expected failures caused by a timeout in API response. | Expected failures caused by a timeout in API response. | async def test_setup_timeout_error(hass, aioclient_mock):
"""Expected failures caused by a timeout in API response."""
fake_async_add_entities = MagicMock()
aioclient_mock.get(
re.compile("api.foobot.io/v2/owner/.*"), exc=asyncio.TimeoutError()
)
with pytest.raises(PlatformNotReady):
... | [
"async",
"def",
"test_setup_timeout_error",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"fake_async_add_entities",
"=",
"MagicMock",
"(",
")",
"aioclient_mock",
".",
"get",
"(",
"re",
".",
"compile",
"(",
"\"api.foobot.io/v2/owner/.*\"",
")",
",",
"exc",
"=",
... | [
58,
0
] | [
68,
9
] | python | en | ['en', 'en', 'en'] | True |
test_setup_permanent_error | (hass, aioclient_mock) | Expected failures caused by permanent errors in API response. | Expected failures caused by permanent errors in API response. | async def test_setup_permanent_error(hass, aioclient_mock):
"""Expected failures caused by permanent errors in API response."""
fake_async_add_entities = MagicMock()
errors = [400, 401, HTTP_FORBIDDEN]
for error in errors:
aioclient_mock.get(re.compile("api.foobot.io/v2/owner/.*"), status=error... | [
"async",
"def",
"test_setup_permanent_error",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"fake_async_add_entities",
"=",
"MagicMock",
"(",
")",
"errors",
"=",
"[",
"400",
",",
"401",
",",
"HTTP_FORBIDDEN",
"]",
"for",
"error",
"in",
"errors",
":",
"aioclien... | [
71,
0
] | [
81,
29
] | python | en | ['en', 'en', 'en'] | True |
test_setup_temporary_error | (hass, aioclient_mock) | Expected failures caused by temporary errors in API response. | Expected failures caused by temporary errors in API response. | async def test_setup_temporary_error(hass, aioclient_mock):
"""Expected failures caused by temporary errors in API response."""
fake_async_add_entities = MagicMock()
errors = [429, HTTP_INTERNAL_SERVER_ERROR]
for error in errors:
aioclient_mock.get(re.compile("api.foobot.io/v2/owner/.*"), statu... | [
"async",
"def",
"test_setup_temporary_error",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"fake_async_add_entities",
"=",
"MagicMock",
"(",
")",
"errors",
"=",
"[",
"429",
",",
"HTTP_INTERNAL_SERVER_ERROR",
"]",
"for",
"error",
"in",
"errors",
":",
"aioclient_mo... | [
84,
0
] | [
94,
13
] | python | en | ['en', 'en', 'en'] | True |
ModelContainerOptimize.__init__ | (self) | pyde/emcee variabless | pyde/emcee variabless | def __init__(self):
super(self.__class__, self).__init__()
""" pyde/emcee variabless """
self.optimize_dir_output = None
self.optimize_parameters = {'method': 'Nelder-Mead',
'maxiter': 1000000.0,
'adaptive': True,
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"self",
".",
"__class__",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"optimize_dir_output",
"=",
"None",
"self",
".",
"optimize_parameters",
"=",
"{",
"'method'",
":",
"'Nelder-Mead'",
... | [
6,
4
] | [
20,
11
] | python | en | ['en', 'en', 'en'] | False |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the LG platform. | Set up the LG platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the LG platform."""
if discovery_info is not None:
add_entities([LGDevice(discovery_info)]) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"not",
"None",
":",
"add_entities",
"(",
"[",
"LGDevice",
"(",
"discovery_info",
")",
"]",
")"
] | [
20,
0
] | [
23,
48
] | python | en | ['en', 'da', 'en'] | True |
LGDevice.__init__ | (self, discovery_info) | Initialize the LG speakers. | Initialize the LG speakers. | def __init__(self, discovery_info):
"""Initialize the LG speakers."""
self._host = discovery_info.get("host")
self._port = discovery_info.get("port")
properties = discovery_info.get("properties")
self._uuid = properties.get("UUID")
self._name = ""
self._volume = ... | [
"def",
"__init__",
"(",
"self",
",",
"discovery_info",
")",
":",
"self",
".",
"_host",
"=",
"discovery_info",
".",
"get",
"(",
"\"host\"",
")",
"self",
".",
"_port",
"=",
"discovery_info",
".",
"get",
"(",
"\"port\"",
")",
"properties",
"=",
"discovery_inf... | [
29,
4
] | [
53,
27
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.async_added_to_hass | (self) | Register the callback after hass is ready for it. | Register the callback after hass is ready for it. | async def async_added_to_hass(self):
"""Register the callback after hass is ready for it."""
await self.hass.async_add_executor_job(self._connect) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_connect",
")"
] | [
55,
4
] | [
57,
61
] | python | en | ['en', 'en', 'en'] | True |
LGDevice._connect | (self) | Perform the actual devices setup. | Perform the actual devices setup. | def _connect(self):
"""Perform the actual devices setup."""
self._device = temescal.temescal(
self._host, port=self._port, callback=self.handle_event
)
self.update() | [
"def",
"_connect",
"(",
"self",
")",
":",
"self",
".",
"_device",
"=",
"temescal",
".",
"temescal",
"(",
"self",
".",
"_host",
",",
"port",
"=",
"self",
".",
"_port",
",",
"callback",
"=",
"self",
".",
"handle_event",
")",
"self",
".",
"update",
"(",... | [
59,
4
] | [
64,
21
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.handle_event | (self, response) | Handle responses from the speakers. | Handle responses from the speakers. | def handle_event(self, response):
"""Handle responses from the speakers."""
data = response["data"]
if response["msg"] == "EQ_VIEW_INFO":
if "i_bass" in data:
self._bass = data["i_bass"]
if "i_treble" in data:
self._treble = data["i_treble"... | [
"def",
"handle_event",
"(",
"self",
",",
"response",
")",
":",
"data",
"=",
"response",
"[",
"\"data\"",
"]",
"if",
"response",
"[",
"\"msg\"",
"]",
"==",
"\"EQ_VIEW_INFO\"",
":",
"if",
"\"i_bass\"",
"in",
"data",
":",
"self",
".",
"_bass",
"=",
"data",
... | [
66,
4
] | [
113,
39
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.update | (self) | Trigger updates from the device. | Trigger updates from the device. | def update(self):
"""Trigger updates from the device."""
self._device.get_eq()
self._device.get_info()
self._device.get_func()
self._device.get_settings()
self._device.get_product_info()
# Temporary fix until handling of unknown equaliser settings is integrated i... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_device",
".",
"get_eq",
"(",
")",
"self",
".",
"_device",
".",
"get_info",
"(",
")",
"self",
".",
"_device",
".",
"get_func",
"(",
")",
"self",
".",
"_device",
".",
"get_settings",
"(",
")",
"s... | [
115,
4
] | [
126,
71
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.unique_id | (self) | Return the device's unique ID. | Return the device's unique ID. | def unique_id(self):
"""Return the device's unique ID."""
return self._uuid | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_uuid"
] | [
129,
4
] | [
131,
25
] | python | en | ['en', 'it', 'en'] | True |
LGDevice.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"
] | [
134,
4
] | [
136,
25
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.volume_level | (self) | Volume level of the media player (0..1). | Volume level of the media player (0..1). | def volume_level(self):
"""Volume level of the media player (0..1)."""
if self._volume_max != 0:
return self._volume / self._volume_max
return 0 | [
"def",
"volume_level",
"(",
"self",
")",
":",
"if",
"self",
".",
"_volume_max",
"!=",
"0",
":",
"return",
"self",
".",
"_volume",
"/",
"self",
".",
"_volume_max",
"return",
"0"
] | [
139,
4
] | [
143,
16
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.is_volume_muted | (self) | Boolean if volume is currently muted. | Boolean if volume is currently muted. | def is_volume_muted(self):
"""Boolean if volume is currently muted."""
return self._mute | [
"def",
"is_volume_muted",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mute"
] | [
146,
4
] | [
148,
25
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
return STATE_ON | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"STATE_ON"
] | [
151,
4
] | [
153,
23
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.sound_mode | (self) | Return the current sound mode. | Return the current sound mode. | def sound_mode(self):
"""Return the current sound mode."""
if self._equaliser == -1 or self._equaliser >= len(temescal.equalisers):
return None
return temescal.equalisers[self._equaliser] | [
"def",
"sound_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"_equaliser",
"==",
"-",
"1",
"or",
"self",
".",
"_equaliser",
">=",
"len",
"(",
"temescal",
".",
"equalisers",
")",
":",
"return",
"None",
"return",
"temescal",
".",
"equalisers",
"[",
"se... | [
156,
4
] | [
160,
51
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.sound_mode_list | (self) | Return the available sound modes. | Return the available sound modes. | def sound_mode_list(self):
"""Return the available sound modes."""
modes = []
for equaliser in self._equalisers:
modes.append(temescal.equalisers[equaliser])
return sorted(modes) | [
"def",
"sound_mode_list",
"(",
"self",
")",
":",
"modes",
"=",
"[",
"]",
"for",
"equaliser",
"in",
"self",
".",
"_equalisers",
":",
"modes",
".",
"append",
"(",
"temescal",
".",
"equalisers",
"[",
"equaliser",
"]",
")",
"return",
"sorted",
"(",
"modes",
... | [
163,
4
] | [
168,
28
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.source | (self) | Return the current input source. | Return the current input source. | def source(self):
"""Return the current input source."""
if self._function == -1:
return None
return temescal.functions[self._function] | [
"def",
"source",
"(",
"self",
")",
":",
"if",
"self",
".",
"_function",
"==",
"-",
"1",
":",
"return",
"None",
"return",
"temescal",
".",
"functions",
"[",
"self",
".",
"_function",
"]"
] | [
171,
4
] | [
175,
49
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.source_list | (self) | List of available input sources. | List of available input sources. | def source_list(self):
"""List of available input sources."""
sources = []
for function in self._functions:
sources.append(temescal.functions[function])
return sorted(sources) | [
"def",
"source_list",
"(",
"self",
")",
":",
"sources",
"=",
"[",
"]",
"for",
"function",
"in",
"self",
".",
"_functions",
":",
"sources",
".",
"append",
"(",
"temescal",
".",
"functions",
"[",
"function",
"]",
")",
"return",
"sorted",
"(",
"sources",
... | [
178,
4
] | [
183,
30
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.supported_features | (self) | Flag media player features that are supported. | Flag media player features that are supported. | def supported_features(self):
"""Flag media player features that are supported."""
return SUPPORT_LG | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_LG"
] | [
186,
4
] | [
188,
25
] | python | en | ['en', 'en', 'en'] | True |
LGDevice.set_volume_level | (self, volume) | Set volume level, range 0..1. | Set volume level, range 0..1. | def set_volume_level(self, volume):
"""Set volume level, range 0..1."""
volume = volume * self._volume_max
self._device.set_volume(int(volume)) | [
"def",
"set_volume_level",
"(",
"self",
",",
"volume",
")",
":",
"volume",
"=",
"volume",
"*",
"self",
".",
"_volume_max",
"self",
".",
"_device",
".",
"set_volume",
"(",
"int",
"(",
"volume",
")",
")"
] | [
190,
4
] | [
193,
44
] | python | en | ['fr', 'zu', 'en'] | False |
LGDevice.mute_volume | (self, mute) | Mute (true) or unmute (false) media player. | Mute (true) or unmute (false) media player. | def mute_volume(self, mute):
"""Mute (true) or unmute (false) media player."""
self._device.set_mute(mute) | [
"def",
"mute_volume",
"(",
"self",
",",
"mute",
")",
":",
"self",
".",
"_device",
".",
"set_mute",
"(",
"mute",
")"
] | [
195,
4
] | [
197,
35
] | python | en | ['en', 'la', 'it'] | False |
LGDevice.select_source | (self, source) | Select input source. | Select input source. | def select_source(self, source):
"""Select input source."""
self._device.set_func(temescal.functions.index(source)) | [
"def",
"select_source",
"(",
"self",
",",
"source",
")",
":",
"self",
".",
"_device",
".",
"set_func",
"(",
"temescal",
".",
"functions",
".",
"index",
"(",
"source",
")",
")"
] | [
199,
4
] | [
201,
63
] | python | en | ['fr', 'su', 'en'] | False |
LGDevice.select_sound_mode | (self, sound_mode) | Set Sound Mode for Receiver.. | Set Sound Mode for Receiver.. | def select_sound_mode(self, sound_mode):
"""Set Sound Mode for Receiver.."""
self._device.set_eq(temescal.equalisers.index(sound_mode)) | [
"def",
"select_sound_mode",
"(",
"self",
",",
"sound_mode",
")",
":",
"self",
".",
"_device",
".",
"set_eq",
"(",
"temescal",
".",
"equalisers",
".",
"index",
"(",
"sound_mode",
")",
")"
] | [
203,
4
] | [
205,
66
] | python | en | ['en', 'pt', 'en'] | True |
create_sms_gateway | (config, hass) | Create the sms gateway. | Create the sms gateway. | async def create_sms_gateway(config, hass):
"""Create the sms gateway."""
try:
worker = GammuAsyncWorker()
worker.configure(config)
await worker.init_async()
gateway = Gateway(worker, hass)
await gateway.init_async()
return gateway
except gammu.GSMError as exc... | [
"async",
"def",
"create_sms_gateway",
"(",
"config",
",",
"hass",
")",
":",
"try",
":",
"worker",
"=",
"GammuAsyncWorker",
"(",
")",
"worker",
".",
"configure",
"(",
"config",
")",
"await",
"worker",
".",
"init_async",
"(",
")",
"gateway",
"=",
"Gateway",
... | [
158,
0
] | [
169,
19
] | python | en | ['en', 'en', 'en'] | True |
Gateway.__init__ | (self, worker, hass) | Initialize the sms gateway. | Initialize the sms gateway. | def __init__(self, worker, hass):
"""Initialize the sms gateway."""
self._worker = worker
self._hass = hass | [
"def",
"__init__",
"(",
"self",
",",
"worker",
",",
"hass",
")",
":",
"self",
".",
"_worker",
"=",
"worker",
"self",
".",
"_hass",
"=",
"hass"
] | [
18,
4
] | [
21,
25
] | python | en | ['en', 'en', 'en'] | True |
Gateway.init_async | (self) | Initialize the sms gateway asynchronously. | Initialize the sms gateway asynchronously. | async def init_async(self):
"""Initialize the sms gateway asynchronously."""
try:
await self._worker.set_incoming_sms_async()
except gammu.ERR_NOTSUPPORTED:
_LOGGER.warning("Your phone does not support incoming SMS notifications!")
else:
await self._wo... | [
"async",
"def",
"init_async",
"(",
"self",
")",
":",
"try",
":",
"await",
"self",
".",
"_worker",
".",
"set_incoming_sms_async",
"(",
")",
"except",
"gammu",
".",
"ERR_NOTSUPPORTED",
":",
"_LOGGER",
".",
"warning",
"(",
"\"Your phone does not support incoming SMS ... | [
23,
4
] | [
30,
77
] | python | en | ['en', 'en', 'en'] | True |
Gateway.sms_callback | (self, state_machine, callback_type, callback_data) | Receive notification about incoming event.
@param state_machine: state machine which invoked action
@type state_machine: gammu.StateMachine
@param callback_type: type of action, one of Call, SMS, CB, USSD
@type callback_type: string
@param data: event data
@type data: ha... | Receive notification about incoming event. | def sms_callback(self, state_machine, callback_type, callback_data):
"""Receive notification about incoming event.
@param state_machine: state machine which invoked action
@type state_machine: gammu.StateMachine
@param callback_type: type of action, one of Call, SMS, CB, USSD
@t... | [
"def",
"sms_callback",
"(",
"self",
",",
"state_machine",
",",
"callback_type",
",",
"callback_data",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Received incoming event type:%s,data:%s\"",
",",
"callback_type",
",",
"callback_data",
")",
"entries",
"=",
"self",
".",... | [
32,
4
] | [
70,
59
] | python | en | ['en', 'en', 'en'] | True |
Gateway.get_and_delete_all_sms | (self, state_machine, force=False) | Read and delete all SMS in the modem. | Read and delete all SMS in the modem. | def get_and_delete_all_sms(self, state_machine, force=False):
"""Read and delete all SMS in the modem."""
# Read SMS memory status ...
memory = state_machine.GetSMSStatus()
# ... and calculate number of messages
remaining = memory["SIMUsed"] + memory["PhoneUsed"]
start_re... | [
"def",
"get_and_delete_all_sms",
"(",
"self",
",",
"state_machine",
",",
"force",
"=",
"False",
")",
":",
"# Read SMS memory status ...",
"memory",
"=",
"state_machine",
".",
"GetSMSStatus",
"(",
")",
"# ... and calculate number of messages",
"remaining",
"=",
"memory",... | [
73,
4
] | [
128,
22
] | python | en | ['en', 'en', 'en'] | True |
Gateway._notify_incoming_sms | (self, messages) | Notify hass when an incoming SMS message is received. | Notify hass when an incoming SMS message is received. | def _notify_incoming_sms(self, messages):
"""Notify hass when an incoming SMS message is received."""
for message in messages:
event_data = {
"phone": message["phone"],
"date": message["date"],
"text": message["message"],
}
... | [
"def",
"_notify_incoming_sms",
"(",
"self",
",",
"messages",
")",
":",
"for",
"message",
"in",
"messages",
":",
"event_data",
"=",
"{",
"\"phone\"",
":",
"message",
"[",
"\"phone\"",
"]",
",",
"\"date\"",
":",
"message",
"[",
"\"date\"",
"]",
",",
"\"text\... | [
131,
4
] | [
139,
75
] | python | en | ['en', 'en', 'en'] | True |
Gateway.send_sms_async | (self, message) | Send sms message via the worker. | Send sms message via the worker. | async def send_sms_async(self, message):
"""Send sms message via the worker."""
return await self._worker.send_sms_async(message) | [
"async",
"def",
"send_sms_async",
"(",
"self",
",",
"message",
")",
":",
"return",
"await",
"self",
".",
"_worker",
".",
"send_sms_async",
"(",
"message",
")"
] | [
141,
4
] | [
143,
57
] | python | en | ['en', 'en', 'en'] | True |
Gateway.get_imei_async | (self) | Get the IMEI of the device. | Get the IMEI of the device. | async def get_imei_async(self):
"""Get the IMEI of the device."""
return await self._worker.get_imei_async() | [
"async",
"def",
"get_imei_async",
"(",
"self",
")",
":",
"return",
"await",
"self",
".",
"_worker",
".",
"get_imei_async",
"(",
")"
] | [
145,
4
] | [
147,
50
] | python | en | ['en', 'en', 'en'] | True |
Gateway.get_signal_quality_async | (self) | Get the current signal level of the modem. | Get the current signal level of the modem. | async def get_signal_quality_async(self):
"""Get the current signal level of the modem."""
return await self._worker.get_signal_quality_async() | [
"async",
"def",
"get_signal_quality_async",
"(",
"self",
")",
":",
"return",
"await",
"self",
".",
"_worker",
".",
"get_signal_quality_async",
"(",
")"
] | [
149,
4
] | [
151,
60
] | python | en | ['en', 'en', 'en'] | True |
Gateway.terminate_async | (self) | Terminate modem connection. | Terminate modem connection. | async def terminate_async(self):
"""Terminate modem connection."""
return await self._worker.terminate_async() | [
"async",
"def",
"terminate_async",
"(",
"self",
")",
":",
"return",
"await",
"self",
".",
"_worker",
".",
"terminate_async",
"(",
")"
] | [
153,
4
] | [
155,
51
] | python | en | ['pt', 'fr', 'en'] | False |
calls | (hass) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
")",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
26,
0
] | [
28,
57
] | python | en | ['en', 'en', 'en'] | True |
test_template_state_text | (hass) | Test the state text of a template. | Test the state text of a template. | async def test_template_state_text(hass):
"""Test the state text of a template."""
with assert_setup_component(1, "switch"):
assert await async_setup_component(
hass,
"switch",
{
"switch": {
"platform": "template",
... | [
"async",
"def",
"test_template_state_text",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"switch\"",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"switch\"",
",",
"{",
"\"switch\"",
":",
"{",
"\"platform\... | [
31,
0
] | [
71,
35
] | python | en | ['en', 'en', 'en'] | True |
test_template_state_boolean_on | (hass) | Test the setting of the state with boolean on. | Test the setting of the state with boolean on. | async def test_template_state_boolean_on(hass):
"""Test the setting of the state with boolean on."""
with assert_setup_component(1, "switch"):
assert await async_setup_component(
hass,
"switch",
{
"switch": {
"platform": "template",... | [
"async",
"def",
"test_template_state_boolean_on",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"switch\"",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"switch\"",
",",
"{",
"\"switch\"",
":",
"{",
"\"pla... | [
74,
0
] | [
105,
34
] | python | en | ['en', 'en', 'en'] | True |
test_template_state_boolean_off | (hass) | Test the setting of the state with off. | Test the setting of the state with off. | async def test_template_state_boolean_off(hass):
"""Test the setting of the state with off."""
with assert_setup_component(1, "switch"):
assert await async_setup_component(
hass,
"switch",
{
"switch": {
"platform": "template",
... | [
"async",
"def",
"test_template_state_boolean_off",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"switch\"",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"switch\"",
",",
"{",
"\"switch\"",
":",
"{",
"\"pl... | [
108,
0
] | [
139,
35
] | python | en | ['en', 'en', 'en'] | True |
test_icon_template | (hass) | Test icon template. | Test icon template. | async def test_icon_template(hass):
"""Test icon template."""
with assert_setup_component(1, "switch"):
assert await async_setup_component(
hass,
"switch",
{
"switch": {
"platform": "template",
"switches": {
... | [
"async",
"def",
"test_icon_template",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"switch\"",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"switch\"",
",",
"{",
"\"switch\"",
":",
"{",
"\"platform\"",
... | [
142,
0
] | [
182,
50
] | python | en | ['en', 'en', 'en'] | True |
test_entity_picture_template | (hass) | Test entity_picture template. | Test entity_picture template. | async def test_entity_picture_template(hass):
"""Test entity_picture template."""
with assert_setup_component(1, "switch"):
assert await async_setup_component(
hass,
"switch",
{
"switch": {
"platform": "template",
... | [
"async",
"def",
"test_entity_picture_template",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"switch\"",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"switch\"",
",",
"{",
"\"switch\"",
":",
"{",
"\"platf... | [
185,
0
] | [
225,
68
] | python | en | ['fr', 'en', 'en'] | True |
test_template_syntax_error | (hass) | Test templating syntax error. | Test templating syntax error. | async def test_template_syntax_error(hass):
"""Test templating syntax error."""
with assert_setup_component(0, "switch"):
assert await async_setup_component(
hass,
"switch",
{
"switch": {
"platform": "template",
... | [
"async",
"def",
"test_template_syntax_error",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"\"switch\"",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"switch\"",
",",
"{",
"\"switch\"",
":",
"{",
"\"platfor... | [
228,
0
] | [
258,
40
] | python | ca | ['ca', 'de', 'en'] | False |
test_invalid_name_does_not_create | (hass) | Test invalid name. | Test invalid name. | async def test_invalid_name_does_not_create(hass):
"""Test invalid name."""
with assert_setup_component(0, "switch"):
assert await async_setup_component(
hass,
"switch",
{
"switch": {
"platform": "template",
"swi... | [
"async",
"def",
"test_invalid_name_does_not_create",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"\"switch\"",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"switch\"",
",",
"{",
"\"switch\"",
":",
"{",
"\"... | [
261,
0
] | [
291,
40
] | python | en | ['en', 'et', 'en'] | True |
test_invalid_switch_does_not_create | (hass) | Test invalid switch. | Test invalid switch. | async def test_invalid_switch_does_not_create(hass):
"""Test invalid switch."""
with assert_setup_component(0, "switch"):
assert await async_setup_component(
hass,
"switch",
{
"switch": {
"platform": "template",
... | [
"async",
"def",
"test_invalid_switch_does_not_create",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"\"switch\"",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"switch\"",
",",
"{",
"\"switch\"",
":",
"{",
"... | [
294,
0
] | [
312,
40
] | 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.