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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
EbusdSensor.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"
] | [
52,
4
] | [
54,
26
] | python | en | ['en', 'en', 'en'] | True |
EbusdSensor.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
if self._type == 1 and self._state is not None:
schedule = {
TIME_FRAME1_BEGIN: None,
TIME_FRAME1_END: None,
TIME_FRAME2_BEGIN: None,
TIME_FRAME2_END: ... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_type",
"==",
"1",
"and",
"self",
".",
"_state",
"is",
"not",
"None",
":",
"schedule",
"=",
"{",
"TIME_FRAME1_BEGIN",
":",
"None",
",",
"TIME_FRAME1_END",
":",
"None",
",",
"TIM... | [
57,
4
] | [
77,
19
] | python | en | ['en', 'en', 'en'] | True |
EbusdSensor.icon | (self) | Icon to use in the frontend, if any. | Icon to use in the frontend, if any. | def icon(self):
"""Icon to use in the frontend, if any."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
80,
4
] | [
82,
25
] | python | en | ['en', 'en', 'en'] | True |
EbusdSensor.unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def unit_of_measurement(self):
"""Return the unit of measurement."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
85,
4
] | [
87,
40
] | python | en | ['en', 'la', 'en'] | True |
EbusdSensor.update | (self) | Fetch new state data for the sensor. | Fetch new state data for the sensor. | def update(self):
"""Fetch new state data for the sensor."""
try:
self.data.update(self._name, self._type)
if self._name not in self.data.value:
return
self._state = self.data.value[self._name]
except RuntimeError:
_LOGGER.debug("E... | [
"def",
"update",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"data",
".",
"update",
"(",
"self",
".",
"_name",
",",
"self",
".",
"_type",
")",
"if",
"self",
".",
"_name",
"not",
"in",
"self",
".",
"data",
".",
"value",
":",
"return",
"self",
... | [
90,
4
] | [
99,
55
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Platform setup, do nothing. | Platform setup, do nothing. | async def async_setup(hass, config):
"""Platform setup, do nothing."""
if DOMAIN not in config:
return True
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=dict(config[DOMAIN])
)
)
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"if",
"DOMAIN",
"not",
"in",
"config",
":",
"return",
"True",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"... | [
24,
0
] | [
34,
15
] | python | en | ['en', 'zu', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Load the saved entities. | Load the saved entities. | async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Load the saved entities."""
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, "sensor")
)
return True | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"async_forward_entry_setup",
"(",
"entry",
",",
"\"sensor\"",
")",
... | [
37,
0
] | [
42,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Trafikverket sensor platform. | Set up the Trafikverket sensor platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Trafikverket sensor platform."""
sensor_name = config[CONF_NAME]
sensor_api = config[CONF_API_KEY]
sensor_station = config[CONF_STATION]
web_session = async_get_clientsession(hass)
weather_api... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"sensor_name",
"=",
"config",
"[",
"CONF_NAME",
"]",
"sensor_api",
"=",
"config",
"[",
"CONF_API_KEY",
"]",
"sensor_stati... | [
124,
0
] | [
144,
37
] | python | en | ['en', 'lv', 'en'] | True |
TrafikverketWeatherStation.__init__ | (self, weather_api, name, sensor_type, sensor_station) | Initialize the sensor. | Initialize the sensor. | def __init__(self, weather_api, name, sensor_type, sensor_station):
"""Initialize the sensor."""
self._client = name
self._name = SENSOR_TYPES[sensor_type][0]
self._type = sensor_type
self._state = None
self._unit = SENSOR_TYPES[sensor_type][1]
self._station = sen... | [
"def",
"__init__",
"(",
"self",
",",
"weather_api",
",",
"name",
",",
"sensor_type",
",",
"sensor_station",
")",
":",
"self",
".",
"_client",
"=",
"name",
"self",
".",
"_name",
"=",
"SENSOR_TYPES",
"[",
"sensor_type",
"]",
"[",
"0",
"]",
"self",
".",
"... | [
150,
4
] | [
161,
28
] | python | en | ['en', 'en', 'en'] | True |
TrafikverketWeatherStation.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return f"{self._client} {self._name}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self._client} {self._name}\""
] | [
164,
4
] | [
166,
45
] | python | en | ['en', 'mi', 'en'] | True |
TrafikverketWeatherStation.icon | (self) | Icon to use in the frontend. | Icon to use in the frontend. | def icon(self):
"""Icon to use in the frontend."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
169,
4
] | [
171,
25
] | python | en | ['en', 'en', 'en'] | True |
TrafikverketWeatherStation.device_state_attributes | (self) | Return the state attributes of Trafikverket Weatherstation. | Return the state attributes of Trafikverket Weatherstation. | def device_state_attributes(self):
"""Return the state attributes of Trafikverket Weatherstation."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_ACTIVE: self._weather.active,
ATTR_MEASURE_TIME: self._weather.measure_time,
} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
",",
"ATTR_ACTIVE",
":",
"self",
".",
"_weather",
".",
"active",
",",
"ATTR_MEASURE_TIME",
":",
"self",
".",
"_weather",
".",
"measure_time",
",",
"... | [
174,
4
] | [
180,
9
] | python | en | ['en', 'et', 'en'] | True |
TrafikverketWeatherStation.device_class | (self) | Return the device class of the sensor. | Return the device class of the sensor. | def device_class(self):
"""Return the device class of the sensor."""
return self._device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_class"
] | [
183,
4
] | [
185,
33
] | python | en | ['en', 'en', 'en'] | True |
TrafikverketWeatherStation.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
188,
4
] | [
190,
26
] | python | en | ['en', 'en', 'en'] | True |
TrafikverketWeatherStation.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 | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit"
] | [
193,
4
] | [
195,
25
] | python | en | ['en', 'en', 'en'] | True |
TrafikverketWeatherStation.async_update | (self) | Get the latest data from Trafikverket and updates the states. | Get the latest data from Trafikverket and updates the states. | async def async_update(self):
"""Get the latest data from Trafikverket and updates the states."""
try:
self._weather = await self._weather_api.async_get_weather(self._station)
self._state = getattr(self._weather, SENSOR_TYPES[self._type][2])
except (asyncio.TimeoutError, ... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_weather",
"=",
"await",
"self",
".",
"_weather_api",
".",
"async_get_weather",
"(",
"self",
".",
"_station",
")",
"self",
".",
"_state",
"=",
"getattr",
"(",
"self",
".",
... | [
198,
4
] | [
204,
68
] | python | en | ['en', 'en', 'en'] | True |
Compressor.set_wrappers_attribute | (self, name, value) |
Call ``setattr`` on all wrappers.
|
Call ``setattr`` on all wrappers.
| def set_wrappers_attribute(self, name, value):
"""
Call ``setattr`` on all wrappers.
"""
for wrapper in self.wrappers:
setattr(wrapper, name, value) | [
"def",
"set_wrappers_attribute",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"for",
"wrapper",
"in",
"self",
".",
"wrappers",
":",
"setattr",
"(",
"wrapper",
",",
"name",
",",
"value",
")"
] | [
56,
4
] | [
61,
41
] | python | en | ['en', 'error', 'th'] | False |
Compressor.validate_config | (self, model, config_list) |
Compression algorithm should overload this function to validate configuration.
|
Compression algorithm should overload this function to validate configuration.
| def validate_config(self, model, config_list):
"""
Compression algorithm should overload this function to validate configuration.
"""
pass | [
"def",
"validate_config",
"(",
"self",
",",
"model",
",",
"config_list",
")",
":",
"pass"
] | [
63,
4
] | [
67,
12
] | python | en | ['en', 'error', 'th'] | False |
Pruner.compress | (self) |
Apply compression on a pre-trained model.
If you want to prune the model during training, use callback API (WIP) instead.
Returns
-------
tf.keras.Model
The compressed model.
|
Apply compression on a pre-trained model. | def compress(self):
"""
Apply compression on a pre-trained model.
If you want to prune the model during training, use callback API (WIP) instead.
Returns
-------
tf.keras.Model
The compressed model.
"""
self._update_mask()
return self... | [
"def",
"compress",
"(",
"self",
")",
":",
"self",
".",
"_update_mask",
"(",
")",
"return",
"self",
".",
"compressed_model"
] | [
199,
4
] | [
211,
36
] | python | en | ['en', 'error', 'th'] | False |
Pruner.export_model | (self, model_path, mask_path=None) |
Export pruned model and optionally mask tensors.
Parameters
----------
model_path : path-like
The path passed to ``Model.save()``.
You can use ".h5" extension name to export HDF5 format.
mask_path : path-like or None
Export masks to the path ... |
Export pruned model and optionally mask tensors. | def export_model(self, model_path, mask_path=None):
"""
Export pruned model and optionally mask tensors.
Parameters
----------
model_path : path-like
The path passed to ``Model.save()``.
You can use ".h5" extension name to export HDF5 format.
mask... | [
"def",
"export_model",
"(",
"self",
",",
"model_path",
",",
"mask_path",
"=",
"None",
")",
":",
"_logger",
".",
"info",
"(",
"'Saving model to %s'",
",",
"model_path",
")",
"input_shape",
"=",
"self",
".",
"compressed_model",
".",
"_build_input_shape",
"# cannot... | [
213,
4
] | [
248,
28
] | python | en | ['en', 'error', 'th'] | False |
Pruner.calc_masks | (self, wrapper, **kwargs) |
Abstract method to be overridden by algorithm. End users should ignore it.
If the callback is set up, this method will be invoked at end of each training minibatch.
If not, it will only be called when end user invokes ``compress``.
Parameters
----------
wrapper : Prune... |
Abstract method to be overridden by algorithm. End users should ignore it. | def calc_masks(self, wrapper, **kwargs):
"""
Abstract method to be overridden by algorithm. End users should ignore it.
If the callback is set up, this method will be invoked at end of each training minibatch.
If not, it will only be called when end user invokes ``compress``.
P... | [
"def",
"calc_masks",
"(",
"self",
",",
"wrapper",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: maybe it should be able to calc on weight-granularity, beside from layer-granularity",
"raise",
"NotImplementedError",
"(",
"\"Pruners must overload calc_masks()\"",
")"
] | [
250,
4
] | [
273,
71
] | python | en | ['en', 'error', 'th'] | False |
async_setup | (hass, config) | Set up the logger component. | Set up the logger component. | async def async_setup(hass, config):
"""Set up the logger component."""
conf = config.get(DOMAIN)
if conf is None:
conf = CONFIG_SCHEMA({DOMAIN: {}})[DOMAIN]
simple_queue = queue.SimpleQueue()
queue_handler = LogErrorQueueHandler(simple_queue)
queue_handler.setLevel(logging.WARN)
lo... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
"if",
"conf",
"is",
"None",
":",
"conf",
"=",
"CONFIG_SCHEMA",
"(",
"{",
"DOMAIN",
":",
"{",
"}",
"}",
")",
"[",
"DOMAIN",
... | [
200,
0
] | [
258,
15
] | python | en | ['en', 'en', 'en'] | True |
LogEntry.__init__ | (self, record, stack, source) | Initialize a log entry. | Initialize a log entry. | def __init__(self, record, stack, source):
"""Initialize a log entry."""
self.first_occurred = self.timestamp = record.created
self.name = record.name
self.level = record.levelname
self.message = deque([record.getMessage()], maxlen=5)
self.exception = ""
self.root... | [
"def",
"__init__",
"(",
"self",
",",
"record",
",",
"stack",
",",
"source",
")",
":",
"self",
".",
"first_occurred",
"=",
"self",
".",
"timestamp",
"=",
"record",
".",
"created",
"self",
".",
"name",
"=",
"record",
".",
"name",
"self",
".",
"level",
... | [
94,
4
] | [
110,
67
] | python | en | ['en', 'en', 'en'] | True |
LogEntry.to_dict | (self) | Convert object into dict to maintain backward compatibility. | Convert object into dict to maintain backward compatibility. | def to_dict(self):
"""Convert object into dict to maintain backward compatibility."""
return {
"name": self.name,
"message": list(self.message),
"level": self.level,
"source": self.source,
"timestamp": self.timestamp,
"exception": s... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"return",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"message\"",
":",
"list",
"(",
"self",
".",
"message",
")",
",",
"\"level\"",
":",
"self",
".",
"level",
",",
"\"source\"",
":",
"self",
".",
"source... | [
112,
4
] | [
123,
9
] | python | en | ['it', 'en', 'en'] | True |
DedupStore.__init__ | (self, maxlen=50) | Initialize a new DedupStore. | Initialize a new DedupStore. | def __init__(self, maxlen=50):
"""Initialize a new DedupStore."""
super().__init__()
self.maxlen = maxlen | [
"def",
"__init__",
"(",
"self",
",",
"maxlen",
"=",
"50",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"maxlen",
"=",
"maxlen"
] | [
129,
4
] | [
132,
28
] | python | en | ['ro', 'en', 'en'] | True |
DedupStore.add_entry | (self, entry) | Add a new entry. | Add a new entry. | def add_entry(self, entry):
"""Add a new entry."""
key = entry.hash
if key in self:
# Update stored entry
existing = self[key]
existing.count += 1
existing.timestamp = entry.timestamp
if entry.message[0] not in existing.message:
... | [
"def",
"add_entry",
"(",
"self",
",",
"entry",
")",
":",
"key",
"=",
"entry",
".",
"hash",
"if",
"key",
"in",
"self",
":",
"# Update stored entry",
"existing",
"=",
"self",
"[",
"key",
"]",
"existing",
".",
"count",
"+=",
"1",
"existing",
".",
"timesta... | [
134,
4
] | [
153,
36
] | python | en | ['en', 'en', 'en'] | True |
DedupStore.to_list | (self) | Return reversed list of log entries - LIFO. | Return reversed list of log entries - LIFO. | def to_list(self):
"""Return reversed list of log entries - LIFO."""
return [value.to_dict() for value in reversed(self.values())] | [
"def",
"to_list",
"(",
"self",
")",
":",
"return",
"[",
"value",
".",
"to_dict",
"(",
")",
"for",
"value",
"in",
"reversed",
"(",
"self",
".",
"values",
"(",
")",
")",
"]"
] | [
155,
4
] | [
157,
69
] | python | en | ['en', 'hmn', 'en'] | True |
LogErrorQueueHandler.emit | (self, record) | Emit a log record. | Emit a log record. | def emit(self, record):
"""Emit a log record."""
try:
self.enqueue(record)
except asyncio.CancelledError:
raise
except Exception: # pylint: disable=broad-except
self.handleError(record) | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"try",
":",
"self",
".",
"enqueue",
"(",
"record",
")",
"except",
"asyncio",
".",
"CancelledError",
":",
"raise",
"except",
"Exception",
":",
"# pylint: disable=broad-except",
"self",
".",
"handleError",
"... | [
163,
4
] | [
170,
36
] | python | bg | ['en', 'bg', 'pt'] | False |
LogErrorHandler.__init__ | (self, hass, maxlen, fire_event) | Initialize a new LogErrorHandler. | Initialize a new LogErrorHandler. | def __init__(self, hass, maxlen, fire_event):
"""Initialize a new LogErrorHandler."""
super().__init__()
self.hass = hass
self.records = DedupStore(maxlen=maxlen)
self.fire_event = fire_event | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"maxlen",
",",
"fire_event",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"records",
"=",
"DedupStore",
"(",
"maxlen",
"=",
"maxlen",
")",
"... | [
176,
4
] | [
181,
36
] | python | en | ['en', 'lb', 'en'] | True |
LogErrorHandler.emit | (self, record) | Save error and warning logs.
Everything logged with error or warning is saved in local buffer. A
default upper limit is set to 50 (older entries are discarded) but can
be changed if needed.
| Save error and warning logs. | def emit(self, record):
"""Save error and warning logs.
Everything logged with error or warning is saved in local buffer. A
default upper limit is set to 50 (older entries are discarded) but can
be changed if needed.
"""
stack = []
if not record.exc_info:
... | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"stack",
"=",
"[",
"]",
"if",
"not",
"record",
".",
"exc_info",
":",
"stack",
"=",
"[",
"(",
"f",
"[",
"0",
"]",
",",
"f",
"[",
"1",
"]",
")",
"for",
"f",
"in",
"traceback",
".",
"extract_s... | [
183,
4
] | [
197,
65
] | python | en | ['en', 'en', 'en'] | True |
AllErrorsView.__init__ | (self, handler) | Initialize a new AllErrorsView. | Initialize a new AllErrorsView. | def __init__(self, handler):
"""Initialize a new AllErrorsView."""
self.handler = handler | [
"def",
"__init__",
"(",
"self",
",",
"handler",
")",
":",
"self",
".",
"handler",
"=",
"handler"
] | [
267,
4
] | [
269,
30
] | python | en | ['en', 'en', 'en'] | True |
AllErrorsView.get | (self, request) | Get all errors and warnings. | Get all errors and warnings. | async def get(self, request):
"""Get all errors and warnings."""
return self.json(self.handler.records.to_list()) | [
"async",
"def",
"get",
"(",
"self",
",",
"request",
")",
":",
"return",
"self",
".",
"json",
"(",
"self",
".",
"handler",
".",
"records",
".",
"to_list",
"(",
")",
")"
] | [
271,
4
] | [
273,
56
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Tellstick covers. | Set up the Tellstick covers. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Tellstick covers."""
if discovery_info is None or discovery_info[ATTR_DISCOVER_DEVICES] is None:
return
signal_repetitions = discovery_info.get(
ATTR_DISCOVER_CONFIG, DEFAULT_SIGNAL_REPETITIONS
)
add... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
"or",
"discovery_info",
"[",
"ATTR_DISCOVER_DEVICES",
"]",
"is",
"None",
":",
"return",
"signal_repetiti... | [
12,
0
] | [
27,
5
] | python | en | ['en', 'en', 'en'] | True |
TellstickCover.is_closed | (self) | Return the current position of the cover is not possible. | Return the current position of the cover is not possible. | def is_closed(self):
"""Return the current position of the cover is not possible."""
return None | [
"def",
"is_closed",
"(",
"self",
")",
":",
"return",
"None"
] | [
34,
4
] | [
36,
19
] | python | en | ['en', 'en', 'en'] | True |
TellstickCover.assumed_state | (self) | Return True if unable to access real state of the entity. | Return True if unable to access real state of the entity. | def assumed_state(self):
"""Return True if unable to access real state of the entity."""
return True | [
"def",
"assumed_state",
"(",
"self",
")",
":",
"return",
"True"
] | [
39,
4
] | [
41,
19
] | python | en | ['en', 'en', 'en'] | True |
TellstickCover.close_cover | (self, **kwargs) | Close the cover. | Close the cover. | def close_cover(self, **kwargs):
"""Close the cover."""
self._tellcore_device.down() | [
"def",
"close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_tellcore_device",
".",
"down",
"(",
")"
] | [
43,
4
] | [
45,
36
] | python | en | ['en', 'en', 'en'] | True |
TellstickCover.open_cover | (self, **kwargs) | Open the cover. | Open the cover. | def open_cover(self, **kwargs):
"""Open the cover."""
self._tellcore_device.up() | [
"def",
"open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_tellcore_device",
".",
"up",
"(",
")"
] | [
47,
4
] | [
49,
34
] | python | en | ['en', 'en', 'en'] | True |
TellstickCover.stop_cover | (self, **kwargs) | Stop the cover. | Stop the cover. | def stop_cover(self, **kwargs):
"""Stop the cover."""
self._tellcore_device.stop() | [
"def",
"stop_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_tellcore_device",
".",
"stop",
"(",
")"
] | [
51,
4
] | [
53,
36
] | python | en | ['en', 'en', 'en'] | True |
TellstickCover._parse_tellcore_data | (self, tellcore_data) | Turn the value received from tellcore into something useful. | Turn the value received from tellcore into something useful. | def _parse_tellcore_data(self, tellcore_data):
"""Turn the value received from tellcore into something useful.""" | [
"def",
"_parse_tellcore_data",
"(",
"self",
",",
"tellcore_data",
")",
":"
] | [
55,
4
] | [
56,
74
] | python | en | ['en', 'en', 'en'] | True |
TellstickCover._parse_ha_data | (self, kwargs) | Turn the value from HA into something useful. | Turn the value from HA into something useful. | def _parse_ha_data(self, kwargs):
"""Turn the value from HA into something useful.""" | [
"def",
"_parse_ha_data",
"(",
"self",
",",
"kwargs",
")",
":"
] | [
58,
4
] | [
59,
59
] | python | en | ['en', 'en', 'en'] | True |
TellstickCover._update_model | (self, new_state, data) | Update the device entity state to match the arguments. | Update the device entity state to match the arguments. | def _update_model(self, new_state, data):
"""Update the device entity state to match the arguments.""" | [
"def",
"_update_model",
"(",
"self",
",",
"new_state",
",",
"data",
")",
":"
] | [
61,
4
] | [
62,
68
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the GeoJSON Events platform. | Set up the GeoJSON Events platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the GeoJSON Events platform."""
url = config[CONF_URL]
scan_interval = config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL)
coordinates = (
config.get(CONF_LATITUDE, hass.config.latitude),
config.get(CONF_LONGITUDE, ... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"url",
"=",
"config",
"[",
"CONF_URL",
"]",
"scan_interval",
"=",
"config",
".",
"get",
"(",
"CONF_SCAN_INTERVAL",
",",
"SCAN_INTERVAL",
"... | [
43,
0
] | [
61,
71
] | python | en | ['en', 'lv', 'en'] | True |
GeoJsonFeedEntityManager.__init__ | (
self, hass, add_entities, scan_interval, coordinates, url, radius_in_km
) | Initialize the GeoJSON Feed Manager. | Initialize the GeoJSON Feed Manager. | def __init__(
self, hass, add_entities, scan_interval, coordinates, url, radius_in_km
):
"""Initialize the GeoJSON Feed Manager."""
self._hass = hass
self._feed_manager = GenericFeedManager(
self._generate_entity,
self._update_entity,
self._remove... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"add_entities",
",",
"scan_interval",
",",
"coordinates",
",",
"url",
",",
"radius_in_km",
")",
":",
"self",
".",
"_hass",
"=",
"hass",
"self",
".",
"_feed_manager",
"=",
"GenericFeedManager",
"(",
"self",
... | [
67,
4
] | [
82,
43
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonFeedEntityManager.startup | (self) | Start up this manager. | Start up this manager. | def startup(self):
"""Start up this manager."""
self._feed_manager.update()
self._init_regular_updates() | [
"def",
"startup",
"(",
"self",
")",
":",
"self",
".",
"_feed_manager",
".",
"update",
"(",
")",
"self",
".",
"_init_regular_updates",
"(",
")"
] | [
84,
4
] | [
87,
36
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonFeedEntityManager._init_regular_updates | (self) | Schedule regular updates at the specified interval. | Schedule regular updates at the specified interval. | def _init_regular_updates(self):
"""Schedule regular updates at the specified interval."""
track_time_interval(
self._hass, lambda now: self._feed_manager.update(), self._scan_interval
) | [
"def",
"_init_regular_updates",
"(",
"self",
")",
":",
"track_time_interval",
"(",
"self",
".",
"_hass",
",",
"lambda",
"now",
":",
"self",
".",
"_feed_manager",
".",
"update",
"(",
")",
",",
"self",
".",
"_scan_interval",
")"
] | [
89,
4
] | [
93,
9
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonFeedEntityManager.get_entry | (self, external_id) | Get feed entry by external id. | Get feed entry by external id. | def get_entry(self, external_id):
"""Get feed entry by external id."""
return self._feed_manager.feed_entries.get(external_id) | [
"def",
"get_entry",
"(",
"self",
",",
"external_id",
")",
":",
"return",
"self",
".",
"_feed_manager",
".",
"feed_entries",
".",
"get",
"(",
"external_id",
")"
] | [
95,
4
] | [
97,
63
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonFeedEntityManager._generate_entity | (self, external_id) | Generate new entity. | Generate new entity. | def _generate_entity(self, external_id):
"""Generate new entity."""
new_entity = GeoJsonLocationEvent(self, external_id)
# Add new entities to HA.
self._add_entities([new_entity], True) | [
"def",
"_generate_entity",
"(",
"self",
",",
"external_id",
")",
":",
"new_entity",
"=",
"GeoJsonLocationEvent",
"(",
"self",
",",
"external_id",
")",
"# Add new entities to HA.",
"self",
".",
"_add_entities",
"(",
"[",
"new_entity",
"]",
",",
"True",
")"
] | [
99,
4
] | [
103,
46
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonFeedEntityManager._update_entity | (self, external_id) | Update entity. | Update entity. | def _update_entity(self, external_id):
"""Update entity."""
dispatcher_send(self._hass, f"geo_json_events_update_{external_id}") | [
"def",
"_update_entity",
"(",
"self",
",",
"external_id",
")",
":",
"dispatcher_send",
"(",
"self",
".",
"_hass",
",",
"f\"geo_json_events_update_{external_id}\"",
")"
] | [
105,
4
] | [
107,
76
] | python | en | ['es', 'en', 'en'] | False |
GeoJsonFeedEntityManager._remove_entity | (self, external_id) | Remove entity. | Remove entity. | def _remove_entity(self, external_id):
"""Remove entity."""
dispatcher_send(self._hass, f"geo_json_events_delete_{external_id}") | [
"def",
"_remove_entity",
"(",
"self",
",",
"external_id",
")",
":",
"dispatcher_send",
"(",
"self",
".",
"_hass",
",",
"f\"geo_json_events_delete_{external_id}\"",
")"
] | [
109,
4
] | [
111,
76
] | python | en | ['es', 'it', 'en'] | False |
GeoJsonLocationEvent.__init__ | (self, feed_manager, external_id) | Initialize entity with data from feed entry. | Initialize entity with data from feed entry. | def __init__(self, feed_manager, external_id):
"""Initialize entity with data from feed entry."""
self._feed_manager = feed_manager
self._external_id = external_id
self._name = None
self._distance = None
self._latitude = None
self._longitude = None
self._r... | [
"def",
"__init__",
"(",
"self",
",",
"feed_manager",
",",
"external_id",
")",
":",
"self",
".",
"_feed_manager",
"=",
"feed_manager",
"self",
".",
"_external_id",
"=",
"external_id",
"self",
".",
"_name",
"=",
"None",
"self",
".",
"_distance",
"=",
"None",
... | [
117,
4
] | [
126,
41
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonLocationEvent.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self._remove_signal_delete = async_dispatcher_connect(
self.hass,
f"geo_json_events_delete_{self._external_id}",
self._delete_callback,
)
self._remove_signal_update = async_d... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_remove_signal_delete",
"=",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"geo_json_events_delete_{self._external_id}\"",
",",
"self",
".",
"_delete_callback",
",",
")",
"self... | [
128,
4
] | [
139,
9
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonLocationEvent._delete_callback | (self) | Remove this entity. | Remove this entity. | def _delete_callback(self):
"""Remove this entity."""
self._remove_signal_delete()
self._remove_signal_update()
self.hass.async_create_task(self.async_remove()) | [
"def",
"_delete_callback",
"(",
"self",
")",
":",
"self",
".",
"_remove_signal_delete",
"(",
")",
"self",
".",
"_remove_signal_update",
"(",
")",
"self",
".",
"hass",
".",
"async_create_task",
"(",
"self",
".",
"async_remove",
"(",
")",
")"
] | [
142,
4
] | [
146,
56
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonLocationEvent._update_callback | (self) | Call update method. | Call update method. | def _update_callback(self):
"""Call update method."""
self.async_schedule_update_ha_state(True) | [
"def",
"_update_callback",
"(",
"self",
")",
":",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")"
] | [
149,
4
] | [
151,
49
] | python | en | ['en', 'sn', 'en'] | True |
GeoJsonLocationEvent.should_poll | (self) | No polling needed for GeoJSON location events. | No polling needed for GeoJSON location events. | def should_poll(self):
"""No polling needed for GeoJSON location events."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
154,
4
] | [
156,
20
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonLocationEvent.async_update | (self) | Update this entity from the data held in the feed manager. | Update this entity from the data held in the feed manager. | async def async_update(self):
"""Update this entity from the data held in the feed manager."""
_LOGGER.debug("Updating %s", self._external_id)
feed_entry = self._feed_manager.get_entry(self._external_id)
if feed_entry:
self._update_from_feed(feed_entry) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating %s\"",
",",
"self",
".",
"_external_id",
")",
"feed_entry",
"=",
"self",
".",
"_feed_manager",
".",
"get_entry",
"(",
"self",
".",
"_external_id",
")",
"if",
"... | [
158,
4
] | [
163,
46
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonLocationEvent._update_from_feed | (self, feed_entry) | Update the internal state from the provided feed entry. | Update the internal state from the provided feed entry. | def _update_from_feed(self, feed_entry):
"""Update the internal state from the provided feed entry."""
self._name = feed_entry.title
self._distance = feed_entry.distance_to_home
self._latitude = feed_entry.coordinates[0]
self._longitude = feed_entry.coordinates[1] | [
"def",
"_update_from_feed",
"(",
"self",
",",
"feed_entry",
")",
":",
"self",
".",
"_name",
"=",
"feed_entry",
".",
"title",
"self",
".",
"_distance",
"=",
"feed_entry",
".",
"distance_to_home",
"self",
".",
"_latitude",
"=",
"feed_entry",
".",
"coordinates",
... | [
165,
4
] | [
170,
51
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonLocationEvent.source | (self) | Return source value of this external event. | Return source value of this external event. | def source(self) -> str:
"""Return source value of this external event."""
return SOURCE | [
"def",
"source",
"(",
"self",
")",
"->",
"str",
":",
"return",
"SOURCE"
] | [
173,
4
] | [
175,
21
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonLocationEvent.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> Optional[str]:
"""Return the name of the entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_name"
] | [
178,
4
] | [
180,
25
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonLocationEvent.distance | (self) | Return distance value of this external event. | Return distance value of this external event. | def distance(self) -> Optional[float]:
"""Return distance value of this external event."""
return self._distance | [
"def",
"distance",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"self",
".",
"_distance"
] | [
183,
4
] | [
185,
29
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonLocationEvent.latitude | (self) | Return latitude value of this external event. | Return latitude value of this external event. | def latitude(self) -> Optional[float]:
"""Return latitude value of this external event."""
return self._latitude | [
"def",
"latitude",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"self",
".",
"_latitude"
] | [
188,
4
] | [
190,
29
] | python | en | ['en', 'la', 'en'] | True |
GeoJsonLocationEvent.longitude | (self) | Return longitude value of this external event. | Return longitude value of this external event. | def longitude(self) -> Optional[float]:
"""Return longitude value of this external event."""
return self._longitude | [
"def",
"longitude",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"self",
".",
"_longitude"
] | [
193,
4
] | [
195,
30
] | python | en | ['en', 'en', 'en'] | True |
GeoJsonLocationEvent.unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def unit_of_measurement(self):
"""Return the unit of measurement."""
return LENGTH_KILOMETERS | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"LENGTH_KILOMETERS"
] | [
198,
4
] | [
200,
32
] | python | en | ['en', 'la', 'en'] | True |
GeoJsonLocationEvent.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
if not self._external_id:
return {}
return {ATTR_EXTERNAL_ID: self._external_id} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_external_id",
":",
"return",
"{",
"}",
"return",
"{",
"ATTR_EXTERNAL_ID",
":",
"self",
".",
"_external_id",
"}"
] | [
203,
4
] | [
207,
52
] | python | en | ['en', 'en', 'en'] | True |
_async_reproduce_state | (
hass: HomeAssistantType,
state: State,
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) | Reproduce a single state. | Reproduce a single state. | async def _async_reproduce_state(
hass: HomeAssistantType,
state: State,
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce a single state."""
cur_state = hass.states.get(state.entity_id)
if cur_state is None:
_LOGGE... | [
"async",
"def",
"_async_reproduce_state",
"(",
"hass",
":",
"HomeAssistantType",
",",
"state",
":",
"State",
",",
"*",
",",
"context",
":",
"Optional",
"[",
"Context",
"]",
"=",
"None",
",",
"reproduce_options",
":",
"Optional",
"[",
"Dict",
"[",
"str",
",... | [
23,
0
] | [
65,
5
] | python | en | ['en', 'en', 'en'] | True |
async_reproduce_states | (
hass: HomeAssistantType,
states: Iterable[State],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) | Reproduce NEW_NAME states. | Reproduce NEW_NAME states. | async def async_reproduce_states(
hass: HomeAssistantType,
states: Iterable[State],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce NEW_NAME states."""
# TODO pick one and remove other one
# Reproduce states in parallel.
... | [
"async",
"def",
"async_reproduce_states",
"(",
"hass",
":",
"HomeAssistantType",
",",
"states",
":",
"Iterable",
"[",
"State",
"]",
",",
"*",
",",
"context",
":",
"Optional",
"[",
"Context",
"]",
"=",
"None",
",",
"reproduce_options",
":",
"Optional",
"[",
... | [
68,
0
] | [
86,
5
] | python | en | ['en', 'en', 'en'] | True |
AsyncConfigEntryAuth.__init__ | (
self,
websession: ClientSession,
oauth_session: config_entry_oauth2_flow.OAuth2Session,
) | Initialize xbox auth. | Initialize xbox auth. | def __init__(
self,
websession: ClientSession,
oauth_session: config_entry_oauth2_flow.OAuth2Session,
):
"""Initialize xbox auth."""
# Leaving out client credentials as they are handled by Home Assistant
super().__init__(websession, "", "", "")
self._oauth_ses... | [
"def",
"__init__",
"(",
"self",
",",
"websession",
":",
"ClientSession",
",",
"oauth_session",
":",
"config_entry_oauth2_flow",
".",
"OAuth2Session",
",",
")",
":",
"# Leaving out client credentials as they are handled by Home Assistant",
"super",
"(",
")",
".",
"__init__... | [
12,
4
] | [
21,
44
] | python | de | ['de', 'pl', 'it'] | False |
AsyncConfigEntryAuth.refresh_tokens | (self) | Return a valid access token. | Return a valid access token. | async def refresh_tokens(self) -> None:
"""Return a valid access token."""
if not self._oauth_session.valid_token:
await self._oauth_session.async_ensure_token_valid()
self.oauth = self._get_oauth_token()
# This will skip the OAuth refresh and only refresh User and XSTS ... | [
"async",
"def",
"refresh_tokens",
"(",
"self",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"_oauth_session",
".",
"valid_token",
":",
"await",
"self",
".",
"_oauth_session",
".",
"async_ensure_token_valid",
"(",
")",
"self",
".",
"oauth",
"=",
"self",
... | [
23,
4
] | [
30,
38
] | python | en | ['en', 'lb', 'en'] | True |
setup_http | (hass) | Set up http. | Set up http. | async def setup_http(hass):
"""Set up http."""
assert await async_setup_component(hass, "http", {})
assert await async_setup_component(hass, "webhook", {})
await hass.async_block_till_done() | [
"async",
"def",
"setup_http",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"}",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"webhook\"",
",",
"{",
"}",
")",
"await",
"ha... | [
10,
0
] | [
14,
38
] | python | en | ['en', 'lb', 'en'] | True |
test_webhook_json | (hass, aiohttp_client) | Test triggering with a JSON webhook. | Test triggering with a JSON webhook. | async def test_webhook_json(hass, aiohttp_client):
"""Test triggering with a JSON webhook."""
events = []
@callback
def store_event(event):
"""Helepr to store events."""
events.append(event)
hass.bus.async_listen("test_success", store_event)
assert await async_setup_component(... | [
"async",
"def",
"test_webhook_json",
"(",
"hass",
",",
"aiohttp_client",
")",
":",
"events",
"=",
"[",
"]",
"@",
"callback",
"def",
"store_event",
"(",
"event",
")",
":",
"\"\"\"Helepr to store events.\"\"\"",
"events",
".",
"append",
"(",
"event",
")",
"hass"... | [
17,
0
] | [
49,
48
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_post | (hass, aiohttp_client) | Test triggering with a POST webhook. | Test triggering with a POST webhook. | async def test_webhook_post(hass, aiohttp_client):
"""Test triggering with a POST webhook."""
events = []
@callback
def store_event(event):
"""Helepr to store events."""
events.append(event)
hass.bus.async_listen("test_success", store_event)
assert await async_setup_component(... | [
"async",
"def",
"test_webhook_post",
"(",
"hass",
",",
"aiohttp_client",
")",
":",
"events",
"=",
"[",
"]",
"@",
"callback",
"def",
"store_event",
"(",
"event",
")",
":",
"\"\"\"Helepr to store events.\"\"\"",
"events",
".",
"append",
"(",
"event",
")",
"hass"... | [
52,
0
] | [
84,
48
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_query | (hass, aiohttp_client) | Test triggering with a query POST webhook. | Test triggering with a query POST webhook. | async def test_webhook_query(hass, aiohttp_client):
"""Test triggering with a query POST webhook."""
events = []
@callback
def store_event(event):
"""Helepr to store events."""
events.append(event)
hass.bus.async_listen("test_success", store_event)
assert await async_setup_com... | [
"async",
"def",
"test_webhook_query",
"(",
"hass",
",",
"aiohttp_client",
")",
":",
"events",
"=",
"[",
"]",
"@",
"callback",
"def",
"store_event",
"(",
"event",
")",
":",
"\"\"\"Helepr to store events.\"\"\"",
"events",
".",
"append",
"(",
"event",
")",
"hass... | [
87,
0
] | [
119,
48
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_reload | (hass, aiohttp_client) | Test reloading a webhook. | Test reloading a webhook. | async def test_webhook_reload(hass, aiohttp_client):
"""Test reloading a webhook."""
events = []
@callback
def store_event(event):
"""Helepr to store events."""
events.append(event)
hass.bus.async_listen("test_success", store_event)
assert await async_setup_component(
... | [
"async",
"def",
"test_webhook_reload",
"(",
"hass",
",",
"aiohttp_client",
")",
":",
"events",
"=",
"[",
"]",
"@",
"callback",
"def",
"store_event",
"(",
"event",
")",
":",
"\"\"\"Helepr to store events.\"\"\"",
"events",
".",
"append",
"(",
"event",
")",
"has... | [
122,
0
] | [
180,
49
] | python | en | ['en', 'da', 'en'] | True |
test_creating_entry_sets_up_climate | (hass, discovery, device, setup) | Test setting up Gree creates the climate components. | Test setting up Gree creates the climate components. | async def test_creating_entry_sets_up_climate(hass, discovery, device, setup):
"""Test setting up Gree creates the climate components."""
result = await hass.config_entries.flow.async_init(
GREE_DOMAIN, context={"source": config_entries.SOURCE_USER}
)
# Confirmation form
assert result["type... | [
"async",
"def",
"test_creating_entry_sets_up_climate",
"(",
"hass",
",",
"discovery",
",",
"device",
",",
"setup",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"GREE_DOMAIN",
",",
"context",
"=",
"{",
... | [
5,
0
] | [
19,
37
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Linode droplet sensor. | Set up the Linode droplet sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Linode droplet sensor."""
linode = hass.data.get(DATA_LINODE)
nodes = config.get(CONF_NODES)
dev = []
for node in nodes:
node_id = linode.get_node_id(node)
if node_id is None:
_LOGGER.erro... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"linode",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"DATA_LINODE",
")",
"nodes",
"=",
"config",
".",
"get",
"(",
"CONF_NODES",
")",
... | [
33,
0
] | [
46,
27
] | python | en | ['en', 'da', 'en'] | True |
LinodeBinarySensor.__init__ | (self, li, node_id) | Initialize a new Linode sensor. | Initialize a new Linode sensor. | def __init__(self, li, node_id):
"""Initialize a new Linode sensor."""
self._linode = li
self._node_id = node_id
self._state = None
self.data = None
self._attrs = {}
self._name = None | [
"def",
"__init__",
"(",
"self",
",",
"li",
",",
"node_id",
")",
":",
"self",
".",
"_linode",
"=",
"li",
"self",
".",
"_node_id",
"=",
"node_id",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"data",
"=",
"None",
"self",
".",
"_attrs",
"=",
"{",
... | [
52,
4
] | [
59,
25
] | python | en | ['en', 'pt', 'en'] | True |
LinodeBinarySensor.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"
] | [
62,
4
] | [
64,
25
] | python | en | ['en', 'mi', 'en'] | True |
LinodeBinarySensor.is_on | (self) | Return true if the binary sensor is on. | Return true if the binary sensor is on. | def is_on(self):
"""Return true if the binary sensor is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
67,
4
] | [
69,
26
] | python | en | ['en', 'fy', 'en'] | True |
LinodeBinarySensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self):
"""Return the class of this sensor."""
return DEVICE_CLASS_MOVING | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_MOVING"
] | [
72,
4
] | [
74,
34
] | python | en | ['en', 'en', 'en'] | True |
LinodeBinarySensor.device_state_attributes | (self) | Return the state attributes of the Linode Node. | Return the state attributes of the Linode Node. | def device_state_attributes(self):
"""Return the state attributes of the Linode Node."""
return self._attrs | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attrs"
] | [
77,
4
] | [
79,
26
] | python | en | ['en', 'en', 'en'] | True |
LinodeBinarySensor.update | (self) | Update state of sensor. | Update state of sensor. | def update(self):
"""Update state of sensor."""
self._linode.update()
if self._linode.data is not None:
for node in self._linode.data:
if node.id == self._node_id:
self.data = node
if self.data is not None:
self._state = self.da... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_linode",
".",
"update",
"(",
")",
"if",
"self",
".",
"_linode",
".",
"data",
"is",
"not",
"None",
":",
"for",
"node",
"in",
"self",
".",
"_linode",
".",
"data",
":",
"if",
"node",
".",
"id",
... | [
81,
4
] | [
100,
40
] | python | en | ['en', 'co', 'en'] | True |
hello | () | Return a friendly HTTP greeting. | Return a friendly HTTP greeting. | def hello():
"""Return a friendly HTTP greeting."""
return 'Hello World!' | [
"def",
"hello",
"(",
")",
":",
"return",
"'Hello World!'"
] | [
24,
0
] | [
26,
25
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType,
entry: ConfigEntry,
async_add_entities: Callable[[list], None],
) | Set up the ISY994 thermostat platform. | Set up the ISY994 thermostat platform. | async def async_setup_entry(
hass: HomeAssistantType,
entry: ConfigEntry,
async_add_entities: Callable[[list], None],
) -> bool:
"""Set up the ISY994 thermostat platform."""
entities = []
hass_isy_data = hass.data[ISY994_DOMAIN][entry.entry_id]
for node in hass_isy_data[ISY994_NODES][CLIMAT... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"Callable",
"[",
"[",
"list",
"]",
",",
"None",
"]",
",",
")",
"->",
"bool",
":",
"entities",
"=",
"[",
"]",
"ha... | [
60,
0
] | [
73,
32
] | python | en | ['en', 'cs', 'en'] | True |
ISYThermostatEntity.__init__ | (self, node) | Initialize the ISY Thermostat entity. | Initialize the ISY Thermostat entity. | def __init__(self, node) -> None:
"""Initialize the ISY Thermostat entity."""
super().__init__(node)
self._node = node
self._uom = self._node.uom
if isinstance(self._uom, list):
self._uom = self._node.uom[0]
self._hvac_action = None
self._hvac_mode = N... | [
"def",
"__init__",
"(",
"self",
",",
"node",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"node",
")",
"self",
".",
"_node",
"=",
"node",
"self",
".",
"_uom",
"=",
"self",
".",
"_node",
".",
"uom",
"if",
"isinstance",
"(",
"se... | [
79,
4
] | [
92,
34
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self) -> int:
"""Return the list of supported features."""
return ISY_SUPPORTED_FEATURES | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"ISY_SUPPORTED_FEATURES"
] | [
95,
4
] | [
97,
37
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.precision | (self) | Return the precision of the system. | Return the precision of the system. | def precision(self) -> str:
"""Return the precision of the system."""
return PRECISION_TENTHS | [
"def",
"precision",
"(",
"self",
")",
"->",
"str",
":",
"return",
"PRECISION_TENTHS"
] | [
100,
4
] | [
102,
31
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self) -> str:
"""Return the unit of measurement."""
uom = self._node.aux_properties.get(PROP_UOM)
if not uom:
return self.hass.config.units.temperature_unit
if uom.value == UOM_ISY_CELSIUS:
return TEMP_CELSIUS
if uom.value == UOM_ISY_F... | [
"def",
"temperature_unit",
"(",
"self",
")",
"->",
"str",
":",
"uom",
"=",
"self",
".",
"_node",
".",
"aux_properties",
".",
"get",
"(",
"PROP_UOM",
")",
"if",
"not",
"uom",
":",
"return",
"self",
".",
"hass",
".",
"config",
".",
"units",
".",
"tempe... | [
105,
4
] | [
113,
34
] | python | en | ['en', 'la', 'en'] | True |
ISYThermostatEntity.current_humidity | (self) | Return the current humidity. | Return the current humidity. | def current_humidity(self) -> Optional[int]:
"""Return the current humidity."""
humidity = self._node.aux_properties.get(PROP_HUMIDITY)
if not humidity:
return None
return int(humidity.value) | [
"def",
"current_humidity",
"(",
"self",
")",
"->",
"Optional",
"[",
"int",
"]",
":",
"humidity",
"=",
"self",
".",
"_node",
".",
"aux_properties",
".",
"get",
"(",
"PROP_HUMIDITY",
")",
"if",
"not",
"humidity",
":",
"return",
"None",
"return",
"int",
"("... | [
116,
4
] | [
121,
34
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.hvac_mode | (self) | Return hvac operation ie. heat, cool mode. | Return hvac operation ie. heat, cool mode. | def hvac_mode(self) -> Optional[str]:
"""Return hvac operation ie. heat, cool mode."""
hvac_mode = self._node.aux_properties.get(CMD_CLIMATE_MODE)
if not hvac_mode:
return None
# Which state values used depends on the mode property's UOM:
uom = hvac_mode.uom
... | [
"def",
"hvac_mode",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"hvac_mode",
"=",
"self",
".",
"_node",
".",
"aux_properties",
".",
"get",
"(",
"CMD_CLIMATE_MODE",
")",
"if",
"not",
"hvac_mode",
":",
"return",
"None",
"# Which state values used... | [
124,
4
] | [
139,
54
] | python | bg | ['en', 'bg', 'bg'] | True |
ISYThermostatEntity.hvac_modes | (self) | Return the list of available hvac operation modes. | Return the list of available hvac operation modes. | def hvac_modes(self) -> List[str]:
"""Return the list of available hvac operation modes."""
return ISY_HVAC_MODES | [
"def",
"hvac_modes",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"ISY_HVAC_MODES"
] | [
142,
4
] | [
144,
29
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.hvac_action | (self) | Return the current running hvac operation if supported. | Return the current running hvac operation if supported. | def hvac_action(self) -> Optional[str]:
"""Return the current running hvac operation if supported."""
hvac_action = self._node.aux_properties.get(PROP_HEAT_COOL_STATE)
if not hvac_action:
return None
return UOM_TO_STATES[UOM_HVAC_ACTIONS].get(hvac_action.value) | [
"def",
"hvac_action",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"hvac_action",
"=",
"self",
".",
"_node",
".",
"aux_properties",
".",
"get",
"(",
"PROP_HEAT_COOL_STATE",
")",
"if",
"not",
"hvac_action",
":",
"return",
"None",
"return",
"UOM... | [
147,
4
] | [
152,
69
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self) -> Optional[float]:
"""Return the current temperature."""
return convert_isy_value_to_hass(
self._node.status, self._uom, self._node.prec, 1
) | [
"def",
"current_temperature",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"convert_isy_value_to_hass",
"(",
"self",
".",
"_node",
".",
"status",
",",
"self",
".",
"_uom",
",",
"self",
".",
"_node",
".",
"prec",
",",
"1",
")"
] | [
155,
4
] | [
159,
9
] | python | en | ['en', 'la', 'en'] | True |
ISYThermostatEntity.target_temperature_step | (self) | Return the supported step of target temperature. | Return the supported step of target temperature. | def target_temperature_step(self) -> Optional[float]:
"""Return the supported step of target temperature."""
return 1.0 | [
"def",
"target_temperature_step",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"1.0"
] | [
162,
4
] | [
164,
18
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self) -> Optional[float]:
"""Return the temperature we try to reach."""
if self.hvac_mode == HVAC_MODE_COOL:
return self.target_temperature_high
if self.hvac_mode == HVAC_MODE_HEAT:
return self.target_temperature_low
return None | [
"def",
"target_temperature",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_COOL",
":",
"return",
"self",
".",
"target_temperature_high",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT",
":",... | [
167,
4
] | [
173,
19
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.target_temperature_high | (self) | Return the highbound target temperature we try to reach. | Return the highbound target temperature we try to reach. | def target_temperature_high(self) -> Optional[float]:
"""Return the highbound target temperature we try to reach."""
target = self._node.aux_properties.get(PROP_SETPOINT_COOL)
if not target:
return None
return convert_isy_value_to_hass(target.value, target.uom, target.prec, 1... | [
"def",
"target_temperature_high",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"target",
"=",
"self",
".",
"_node",
".",
"aux_properties",
".",
"get",
"(",
"PROP_SETPOINT_COOL",
")",
"if",
"not",
"target",
":",
"return",
"None",
"return",
"c... | [
176,
4
] | [
181,
82
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.target_temperature_low | (self) | Return the lowbound target temperature we try to reach. | Return the lowbound target temperature we try to reach. | def target_temperature_low(self) -> Optional[float]:
"""Return the lowbound target temperature we try to reach."""
target = self._node.aux_properties.get(PROP_SETPOINT_HEAT)
if not target:
return None
return convert_isy_value_to_hass(target.value, target.uom, target.prec, 1) | [
"def",
"target_temperature_low",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"target",
"=",
"self",
".",
"_node",
".",
"aux_properties",
".",
"get",
"(",
"PROP_SETPOINT_HEAT",
")",
"if",
"not",
"target",
":",
"return",
"None",
"return",
"co... | [
184,
4
] | [
189,
82
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.fan_modes | (self) | Return the list of available fan modes. | Return the list of available fan modes. | def fan_modes(self):
"""Return the list of available fan modes."""
return [FAN_AUTO, FAN_ON] | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"return",
"[",
"FAN_AUTO",
",",
"FAN_ON",
"]"
] | [
192,
4
] | [
194,
33
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.fan_mode | (self) | Return the current fan mode ie. auto, on. | Return the current fan mode ie. auto, on. | def fan_mode(self) -> str:
"""Return the current fan mode ie. auto, on."""
fan_mode = self._node.aux_properties.get(CMD_CLIMATE_FAN_SETTING)
if not fan_mode:
return None
return UOM_TO_STATES[UOM_FAN_MODES].get(fan_mode.value) | [
"def",
"fan_mode",
"(",
"self",
")",
"->",
"str",
":",
"fan_mode",
"=",
"self",
".",
"_node",
".",
"aux_properties",
".",
"get",
"(",
"CMD_CLIMATE_FAN_SETTING",
")",
"if",
"not",
"fan_mode",
":",
"return",
"None",
"return",
"UOM_TO_STATES",
"[",
"UOM_FAN_MOD... | [
197,
4
] | [
202,
63
] | python | en | ['en', 'en', 'en'] | True |
ISYThermostatEntity.set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | def set_temperature(self, **kwargs) -> None:
"""Set new target temperature."""
target_temp = kwargs.get(ATTR_TEMPERATURE)
target_temp_low = kwargs.get(ATTR_TARGET_TEMP_LOW)
target_temp_high = kwargs.get(ATTR_TARGET_TEMP_HIGH)
if target_temp is not None:
if self.hvac_m... | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"target_temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"target_temp_low",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TARGET_TEMP_LOW",
")",
"target_temp_high",
... | [
204,
4
] | [
222,
39
] | python | en | ['en', 'ca', 'en'] | True |
ISYThermostatEntity.set_fan_mode | (self, fan_mode: str) | Set new target fan mode. | Set new target fan mode. | def set_fan_mode(self, fan_mode: str) -> None:
"""Set new target fan mode."""
_LOGGER.debug("Requested fan mode %s", fan_mode)
self._node.set_fan_mode(HA_FAN_TO_ISY.get(fan_mode))
# Presumptive setting--event stream will correct if cmd fails:
self._fan_mode = fan_mode
sel... | [
"def",
"set_fan_mode",
"(",
"self",
",",
"fan_mode",
":",
"str",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Requested fan mode %s\"",
",",
"fan_mode",
")",
"self",
".",
"_node",
".",
"set_fan_mode",
"(",
"HA_FAN_TO_ISY",
".",
"get",
"(",
"fan... | [
224,
4
] | [
230,
39
] | python | en | ['sv', 'fy', 'en'] | False |
ISYThermostatEntity.set_hvac_mode | (self, hvac_mode: str) | Set new target hvac mode. | Set new target hvac mode. | def set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new target hvac mode."""
_LOGGER.debug("Requested operation mode %s", hvac_mode)
self._node.set_climate_mode(HA_HVAC_TO_ISY.get(hvac_mode))
# Presumptive setting--event stream will correct if cmd fails:
self._hvac_mode = hva... | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
":",
"str",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Requested operation mode %s\"",
",",
"hvac_mode",
")",
"self",
".",
"_node",
".",
"set_climate_mode",
"(",
"HA_HVAC_TO_ISY",
".",
"get",... | [
232,
4
] | [
238,
39
] | python | da | ['da', 'su', 'en'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.