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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
HomeKitTemperatureSensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [CharacteristicsTypes.TEMPERATURE_CURRENT] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"TEMPERATURE_CURRENT",
"]"
] | [
60,
4
] | [
62,
57
] | python | en | ['en', 'en', 'en'] | True |
HomeKitTemperatureSensor.device_class | (self) | Return the device class of the sensor. | Return the device class of the sensor. | def device_class(self) -> str:
"""Return the device class of the sensor."""
return DEVICE_CLASS_TEMPERATURE | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_TEMPERATURE"
] | [
65,
4
] | [
67,
39
] | python | en | ['en', 'en', 'en'] | True |
HomeKitTemperatureSensor.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return f"{super().name} Temperature" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{super().name} Temperature\""
] | [
70,
4
] | [
72,
44
] | python | en | ['en', 'en', 'en'] | True |
HomeKitTemperatureSensor.icon | (self) | Return the sensor icon. | Return the sensor icon. | def icon(self):
"""Return the sensor icon."""
return TEMP_C_ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"TEMP_C_ICON"
] | [
75,
4
] | [
77,
26
] | python | en | ['en', 'fa', 'en'] | True |
HomeKitTemperatureSensor.unit_of_measurement | (self) | Return units for the sensor. | Return units for the sensor. | def unit_of_measurement(self):
"""Return units for the sensor."""
return TEMP_CELSIUS | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
80,
4
] | [
82,
27
] | python | en | ['en', 'sq', 'en'] | True |
HomeKitTemperatureSensor.state | (self) | Return the current temperature in Celsius. | Return the current temperature in Celsius. | def state(self):
"""Return the current temperature in Celsius."""
return self.service.value(CharacteristicsTypes.TEMPERATURE_CURRENT) | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"TEMPERATURE_CURRENT",
")"
] | [
85,
4
] | [
87,
75
] | python | en | ['en', 'la', 'en'] | True |
HomeKitLightSensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [CharacteristicsTypes.LIGHT_LEVEL_CURRENT] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"LIGHT_LEVEL_CURRENT",
"]"
] | [
93,
4
] | [
95,
57
] | python | en | ['en', 'en', 'en'] | True |
HomeKitLightSensor.device_class | (self) | Return the device class of the sensor. | Return the device class of the sensor. | def device_class(self) -> str:
"""Return the device class of the sensor."""
return DEVICE_CLASS_ILLUMINANCE | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_ILLUMINANCE"
] | [
98,
4
] | [
100,
39
] | python | en | ['en', 'en', 'en'] | True |
HomeKitLightSensor.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return f"{super().name} Light Level" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{super().name} Light Level\""
] | [
103,
4
] | [
105,
44
] | python | en | ['en', 'en', 'en'] | True |
HomeKitLightSensor.icon | (self) | Return the sensor icon. | Return the sensor icon. | def icon(self):
"""Return the sensor icon."""
return BRIGHTNESS_ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"BRIGHTNESS_ICON"
] | [
108,
4
] | [
110,
30
] | python | en | ['en', 'fa', 'en'] | True |
HomeKitLightSensor.unit_of_measurement | (self) | Return units for the sensor. | Return units for the sensor. | def unit_of_measurement(self):
"""Return units for the sensor."""
return LIGHT_LUX | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"LIGHT_LUX"
] | [
113,
4
] | [
115,
24
] | python | en | ['en', 'sq', 'en'] | True |
HomeKitLightSensor.state | (self) | Return the current light level in lux. | Return the current light level in lux. | def state(self):
"""Return the current light level in lux."""
return self.service.value(CharacteristicsTypes.LIGHT_LEVEL_CURRENT) | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"LIGHT_LEVEL_CURRENT",
")"
] | [
118,
4
] | [
120,
75
] | python | en | ['en', 'en', 'en'] | True |
HomeKitCarbonDioxideSensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [CharacteristicsTypes.CARBON_DIOXIDE_LEVEL] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"CARBON_DIOXIDE_LEVEL",
"]"
] | [
126,
4
] | [
128,
58
] | python | en | ['en', 'en', 'en'] | True |
HomeKitCarbonDioxideSensor.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return f"{super().name} CO2" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{super().name} CO2\""
] | [
131,
4
] | [
133,
36
] | python | en | ['en', 'en', 'en'] | True |
HomeKitCarbonDioxideSensor.icon | (self) | Return the sensor icon. | Return the sensor icon. | def icon(self):
"""Return the sensor icon."""
return CO2_ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"CO2_ICON"
] | [
136,
4
] | [
138,
23
] | python | en | ['en', 'fa', 'en'] | True |
HomeKitCarbonDioxideSensor.unit_of_measurement | (self) | Return units for the sensor. | Return units for the sensor. | def unit_of_measurement(self):
"""Return units for the sensor."""
return CONCENTRATION_PARTS_PER_MILLION | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"CONCENTRATION_PARTS_PER_MILLION"
] | [
141,
4
] | [
143,
46
] | python | en | ['en', 'sq', 'en'] | True |
HomeKitCarbonDioxideSensor.state | (self) | Return the current CO2 level in ppm. | Return the current CO2 level in ppm. | def state(self):
"""Return the current CO2 level in ppm."""
return self.service.value(CharacteristicsTypes.CARBON_DIOXIDE_LEVEL) | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"CARBON_DIOXIDE_LEVEL",
")"
] | [
146,
4
] | [
148,
76
] | python | en | ['en', 'en', 'en'] | True |
HomeKitBatterySensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [
CharacteristicsTypes.BATTERY_LEVEL,
CharacteristicsTypes.STATUS_LO_BATT,
CharacteristicsTypes.CHARGING_STATE,
] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"BATTERY_LEVEL",
",",
"CharacteristicsTypes",
".",
"STATUS_LO_BATT",
",",
"CharacteristicsTypes",
".",
"CHARGING_STATE",
",",
"]"
] | [
154,
4
] | [
160,
9
] | python | en | ['en', 'en', 'en'] | True |
HomeKitBatterySensor.device_class | (self) | Return the device class of the sensor. | Return the device class of the sensor. | def device_class(self) -> str:
"""Return the device class of the sensor."""
return DEVICE_CLASS_BATTERY | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_BATTERY"
] | [
163,
4
] | [
165,
35
] | python | en | ['en', 'en', 'en'] | True |
HomeKitBatterySensor.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return f"{super().name} Battery" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{super().name} Battery\""
] | [
168,
4
] | [
170,
40
] | python | en | ['en', 'en', 'en'] | True |
HomeKitBatterySensor.icon | (self) | Return the sensor icon. | Return the sensor icon. | def icon(self):
"""Return the sensor icon."""
if not self.available or self.state is None:
return "mdi:battery-unknown"
# This is similar to the logic in helpers.icon, but we have delegated the
# decision about what mdi:battery-alert is to the device.
icon = "mdi:bat... | [
"def",
"icon",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"available",
"or",
"self",
".",
"state",
"is",
"None",
":",
"return",
"\"mdi:battery-unknown\"",
"# This is similar to the logic in helpers.icon, but we have delegated the",
"# decision about what mdi:battery-a... | [
173,
4
] | [
192,
19
] | python | en | ['en', 'fa', 'en'] | True |
HomeKitBatterySensor.unit_of_measurement | (self) | Return units for the sensor. | Return units for the sensor. | def unit_of_measurement(self):
"""Return units for the sensor."""
return PERCENTAGE | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"PERCENTAGE"
] | [
195,
4
] | [
197,
25
] | python | en | ['en', 'sq', 'en'] | True |
HomeKitBatterySensor.is_low_battery | (self) | Return true if battery level is low. | Return true if battery level is low. | def is_low_battery(self):
"""Return true if battery level is low."""
return self.service.value(CharacteristicsTypes.STATUS_LO_BATT) == 1 | [
"def",
"is_low_battery",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"STATUS_LO_BATT",
")",
"==",
"1"
] | [
200,
4
] | [
202,
75
] | python | en | ['en', 'fy', 'en'] | True |
HomeKitBatterySensor.is_charging | (self) | Return true if currently charing. | Return true if currently charing. | def is_charging(self):
"""Return true if currently charing."""
# 0 = not charging
# 1 = charging
# 2 = not chargeable
return self.service.value(CharacteristicsTypes.CHARGING_STATE) == 1 | [
"def",
"is_charging",
"(",
"self",
")",
":",
"# 0 = not charging",
"# 1 = charging",
"# 2 = not chargeable",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"CHARGING_STATE",
")",
"==",
"1"
] | [
205,
4
] | [
210,
75
] | python | en | ['en', 'en', 'en'] | True |
HomeKitBatterySensor.state | (self) | Return the current battery level percentage. | Return the current battery level percentage. | def state(self):
"""Return the current battery level percentage."""
return self.service.value(CharacteristicsTypes.BATTERY_LEVEL) | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"BATTERY_LEVEL",
")"
] | [
213,
4
] | [
215,
69
] | python | en | ['en', 'en', 'en'] | True |
DevoloHomeControlFlowHandler.__init__ | (self) | Initialize devolo Home Control flow. | Initialize devolo Home Control flow. | def __init__(self):
"""Initialize devolo Home Control flow."""
self.data_schema = {
vol.Required(CONF_USERNAME): str,
vol.Required(CONF_PASSWORD): str,
} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"data_schema",
"=",
"{",
"vol",
".",
"Required",
"(",
"CONF_USERNAME",
")",
":",
"str",
",",
"vol",
".",
"Required",
"(",
"CONF_PASSWORD",
")",
":",
"str",
",",
"}"
] | [
25,
4
] | [
30,
9
] | python | it | ['it', 'fr', 'it'] | True |
DevoloHomeControlFlowHandler.async_step_user | (self, user_input=None) | Handle a flow initiated by the user. | Handle a flow initiated by the user. | async def async_step_user(self, user_input=None):
"""Handle a flow initiated by the user."""
if self.show_advanced_options:
self.data_schema = {
vol.Required(CONF_USERNAME): str,
vol.Required(CONF_PASSWORD): str,
vol.Required(CONF_MYDEVOLO, def... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"self",
".",
"show_advanced_options",
":",
"self",
".",
"data_schema",
"=",
"{",
"vol",
".",
"Required",
"(",
"CONF_USERNAME",
")",
":",
"str",
",",
"vol",
".... | [
32,
4
] | [
68,
9
] | python | en | ['en', 'en', 'en'] | True |
DevoloHomeControlFlowHandler._show_form | (self, errors=None) | Show the form to the user. | Show the form to the user. | def _show_form(self, errors=None):
"""Show the form to the user."""
return self.async_show_form(
step_id="user",
data_schema=vol.Schema(self.data_schema),
errors=errors if errors else {},
) | [
"def",
"_show_form",
"(",
"self",
",",
"errors",
"=",
"None",
")",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"user\"",
",",
"data_schema",
"=",
"vol",
".",
"Schema",
"(",
"self",
".",
"data_schema",
")",
",",
"errors",
"=",
... | [
71,
4
] | [
77,
9
] | python | en | ['en', 'en', 'en'] | True |
require_retrieval | (test_case) |
Decorator marking a test that requires a set of dependencies necessary for pefrorm retrieval with
:class:`~transformers.RagRetriever`.
These tests are skipped when respective libraries are not installed.
|
Decorator marking a test that requires a set of dependencies necessary for pefrorm retrieval with
:class:`~transformers.RagRetriever`. | def require_retrieval(test_case):
"""
Decorator marking a test that requires a set of dependencies necessary for pefrorm retrieval with
:class:`~transformers.RagRetriever`.
These tests are skipped when respective libraries are not installed.
"""
if not (is_tf_available() and is_datasets_availa... | [
"def",
"require_retrieval",
"(",
"test_case",
")",
":",
"if",
"not",
"(",
"is_tf_available",
"(",
")",
"and",
"is_datasets_available",
"(",
")",
"and",
"is_faiss_available",
"(",
")",
")",
":",
"test_case",
"=",
"unittest",
".",
"skip",
"(",
"\"test requires t... | [
43,
0
] | [
53,
20
] | python | en | ['en', 'error', 'th'] | False |
mock_light_profiles | () | Mock loading of profiles. | Mock loading of profiles. | def mock_light_profiles():
"""Mock loading of profiles."""
data = {}
def mock_profiles_class(hass):
profiles = Profiles(hass)
profiles.data = data
profiles.async_initialize = AsyncMock()
return profiles
with patch(
"homeassistant.components.light.Profiles",
... | [
"def",
"mock_light_profiles",
"(",
")",
":",
"data",
"=",
"{",
"}",
"def",
"mock_profiles_class",
"(",
"hass",
")",
":",
"profiles",
"=",
"Profiles",
"(",
"hass",
")",
"profiles",
".",
"data",
"=",
"data",
"profiles",
".",
"async_initialize",
"=",
"AsyncMo... | [
10,
0
] | [
25,
18
] | python | en | ['en', 'fy', 'en'] | True |
test_hue_bridge_setup | (hass) | Test that a Hue hub can be correctly setup in HA via HomeKit. | Test that a Hue hub can be correctly setup in HA via HomeKit. | async def test_hue_bridge_setup(hass):
"""Test that a Hue hub can be correctly setup in HA via HomeKit."""
accessories = await setup_accessories_from_file(hass, "hue_bridge.json")
config_entry, pairing = await setup_test_accessories(hass, accessories)
entity_registry = await hass.helpers.entity_registr... | [
"async",
"def",
"test_hue_bridge_setup",
"(",
"hass",
")",
":",
"accessories",
"=",
"await",
"setup_accessories_from_file",
"(",
"hass",
",",
"\"hue_bridge.json\"",
")",
"config_entry",
",",
"pairing",
"=",
"await",
"setup_test_accessories",
"(",
"hass",
",",
"acces... | [
10,
0
] | [
65,
41
] | python | en | ['en', 'ig', 'en'] | True |
_compute_global_attention_mask | (input_ids_shape, sep_token_indices, before_sep_token=True) |
Computes global attention mask by putting attention on all tokens before `sep_token_id` if `before_sep_token is
True` else after `sep_token_id`.
|
Computes global attention mask by putting attention on all tokens before `sep_token_id` if `before_sep_token is
True` else after `sep_token_id`.
| def _compute_global_attention_mask(input_ids_shape, sep_token_indices, before_sep_token=True):
"""
Computes global attention mask by putting attention on all tokens before `sep_token_id` if `before_sep_token is
True` else after `sep_token_id`.
"""
assert shape_list(sep_token_indices)[1] == 2, "`inp... | [
"def",
"_compute_global_attention_mask",
"(",
"input_ids_shape",
",",
"sep_token_indices",
",",
"before_sep_token",
"=",
"True",
")",
":",
"assert",
"shape_list",
"(",
"sep_token_indices",
")",
"[",
"1",
"]",
"==",
"2",
",",
"\"`input_ids` should have two dimensions\"",... | [
388,
0
] | [
413,
25
] | python | en | ['en', 'error', 'th'] | False |
TFLongformerEmbeddings.create_position_ids_from_input_ids | (self, input_ids) |
Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding
symbols are ignored. This is modified from fairseq's `utils.make_positions`.
Args:
input_ids: tf.Tensor
Returns: tf.Tensor
|
Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding
symbols are ignored. This is modified from fairseq's `utils.make_positions`. | def create_position_ids_from_input_ids(self, input_ids):
"""
Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding
symbols are ignored. This is modified from fairseq's `utils.make_positions`.
Args:
input_ids: tf.Tensor
... | [
"def",
"create_position_ids_from_input_ids",
"(",
"self",
",",
"input_ids",
")",
":",
"mask",
"=",
"tf",
".",
"cast",
"(",
"tf",
".",
"math",
".",
"not_equal",
"(",
"input_ids",
",",
"self",
".",
"padding_idx",
")",
",",
"dtype",
"=",
"input_ids",
".",
"... | [
512,
4
] | [
524,
53
] | python | en | ['en', 'error', 'th'] | False |
TFLongformerEmbeddings.call | (self, input_ids=None, position_ids=None, token_type_ids=None, inputs_embeds=None, training=False) |
Applies embedding based on inputs tensor.
Returns:
final_embeddings (:obj:`tf.Tensor`): output embedding tensor.
|
Applies embedding based on inputs tensor. | def call(self, input_ids=None, position_ids=None, token_type_ids=None, inputs_embeds=None, training=False):
"""
Applies embedding based on inputs tensor.
Returns:
final_embeddings (:obj:`tf.Tensor`): output embedding tensor.
"""
assert not (input_ids is None and inpu... | [
"def",
"call",
"(",
"self",
",",
"input_ids",
"=",
"None",
",",
"position_ids",
"=",
"None",
",",
"token_type_ids",
"=",
"None",
",",
"inputs_embeds",
"=",
"None",
",",
"training",
"=",
"False",
")",
":",
"assert",
"not",
"(",
"input_ids",
"is",
"None",
... | [
526,
4
] | [
559,
31
] | python | en | ['en', 'error', 'th'] | False |
TFLongformerSelfAttention.call | (
self,
inputs,
training=False,
) |
LongformerSelfAttention expects `len(hidden_states)` to be multiple of `attention_window`. Padding to
`attention_window` happens in LongformerModel.forward to avoid redoing the padding on each layer.
The `attention_mask` is changed in :meth:`LongformerModel.forward` from 0, 1, 2 to:
... |
LongformerSelfAttention expects `len(hidden_states)` to be multiple of `attention_window`. Padding to
`attention_window` happens in LongformerModel.forward to avoid redoing the padding on each layer. | def call(
self,
inputs,
training=False,
):
"""
LongformerSelfAttention expects `len(hidden_states)` to be multiple of `attention_window`. Padding to
`attention_window` happens in LongformerModel.forward to avoid redoing the padding on each layer.
The `attenti... | [
"def",
"call",
"(",
"self",
",",
"inputs",
",",
"training",
"=",
"False",
",",
")",
":",
"# retrieve input args",
"(",
"hidden_states",
",",
"attention_mask",
",",
"layer_head_mask",
",",
"is_index_masked",
",",
"is_index_global_attn",
",",
"is_global_attn",
",",
... | [
701,
4
] | [
890,
22
] | python | en | ['en', 'error', 'th'] | False |
TFLongformerSelfAttention._sliding_chunks_query_key_matmul | (self, query, key, window_overlap) |
Matrix multiplication of query and key tensors using with a sliding window attention pattern. This
implementation splits the input into overlapping chunks of size 2w (e.g. 512 for pretrained Longformer) with an
overlap of size window_overlap
|
Matrix multiplication of query and key tensors using with a sliding window attention pattern. This
implementation splits the input into overlapping chunks of size 2w (e.g. 512 for pretrained Longformer) with an
overlap of size window_overlap
| def _sliding_chunks_query_key_matmul(self, query, key, window_overlap):
"""
Matrix multiplication of query and key tensors using with a sliding window attention pattern. This
implementation splits the input into overlapping chunks of size 2w (e.g. 512 for pretrained Longformer) with an
o... | [
"def",
"_sliding_chunks_query_key_matmul",
"(",
"self",
",",
"query",
",",
"key",
",",
"window_overlap",
")",
":",
"batch_size",
",",
"seq_len",
",",
"num_heads",
",",
"head_dim",
"=",
"shape_list",
"(",
"query",
")",
"if",
"tf",
".",
"executing_eagerly",
"(",... | [
892,
4
] | [
1004,
40
] | python | en | ['en', 'error', 'th'] | False |
TFLongformerSelfAttention._sliding_chunks_matmul_attn_probs_value | (self, attn_probs, value, window_overlap) |
Same as _sliding_chunks_query_key_matmul but for attn_probs and value tensors. Returned tensor will be of the
same shape as `attn_probs`
|
Same as _sliding_chunks_query_key_matmul but for attn_probs and value tensors. Returned tensor will be of the
same shape as `attn_probs`
| def _sliding_chunks_matmul_attn_probs_value(self, attn_probs, value, window_overlap):
"""
Same as _sliding_chunks_query_key_matmul but for attn_probs and value tensors. Returned tensor will be of the
same shape as `attn_probs`
"""
batch_size, seq_len, num_heads, head_dim = shape... | [
"def",
"_sliding_chunks_matmul_attn_probs_value",
"(",
"self",
",",
"attn_probs",
",",
"value",
",",
"window_overlap",
")",
":",
"batch_size",
",",
"seq_len",
",",
"num_heads",
",",
"head_dim",
"=",
"shape_list",
"(",
"value",
")",
"if",
"tf",
".",
"executing_ea... | [
1036,
4
] | [
1111,
22
] | python | en | ['en', 'error', 'th'] | False |
TFLongformerSelfAttention._pad_and_transpose_last_two_dims | (hidden_states_padded, paddings) | pads rows and then flips rows and columns | pads rows and then flips rows and columns | def _pad_and_transpose_last_two_dims(hidden_states_padded, paddings):
"""pads rows and then flips rows and columns"""
hidden_states_padded = tf.pad(
hidden_states_padded, paddings
) # padding value is not important because it will be overwritten
batch_size, chunk_size, seq_l... | [
"def",
"_pad_and_transpose_last_two_dims",
"(",
"hidden_states_padded",
",",
"paddings",
")",
":",
"hidden_states_padded",
"=",
"tf",
".",
"pad",
"(",
"hidden_states_padded",
",",
"paddings",
")",
"# padding value is not important because it will be overwritten",
"batch_size",
... | [
1114,
4
] | [
1122,
35
] | python | en | ['en', 'en', 'en'] | True |
TFLongformerSelfAttention._pad_and_diagonalize | (chunked_hidden_states) |
shift every row 1 step right, converting columns into diagonals.
Example::
chunked_hidden_states: [ 0.4983, 2.6918, -0.0071, 1.0492,
-1.8348, 0.7672, 0.2986, 0.0285,
-0.7584, 0.4206, -0.0405, 0.1599,
... |
shift every row 1 step right, converting columns into diagonals. | def _pad_and_diagonalize(chunked_hidden_states):
"""
shift every row 1 step right, converting columns into diagonals.
Example::
chunked_hidden_states: [ 0.4983, 2.6918, -0.0071, 1.0492,
-1.8348, 0.7672, 0.2986, 0.0285,
... | [
"def",
"_pad_and_diagonalize",
"(",
"chunked_hidden_states",
")",
":",
"total_num_heads",
",",
"num_chunks",
",",
"window_overlap",
",",
"hidden_dim",
"=",
"shape_list",
"(",
"chunked_hidden_states",
")",
"paddings",
"=",
"tf",
".",
"convert_to_tensor",
"(",
"[",
"[... | [
1125,
4
] | [
1159,
36
] | python | en | ['en', 'error', 'th'] | False |
TFLongformerSelfAttention._chunk | (hidden_states, window_overlap) | convert into overlapping chunks. Chunk size = 2w, overlap size = w | convert into overlapping chunks. Chunk size = 2w, overlap size = w | def _chunk(hidden_states, window_overlap):
"""convert into overlapping chunks. Chunk size = 2w, overlap size = w"""
batch_size, seq_length, hidden_dim = shape_list(hidden_states)
num_output_chunks = 2 * (seq_length // (2 * window_overlap)) - 1
# define frame size and frame stride (simil... | [
"def",
"_chunk",
"(",
"hidden_states",
",",
"window_overlap",
")",
":",
"batch_size",
",",
"seq_length",
",",
"hidden_dim",
"=",
"shape_list",
"(",
"hidden_states",
")",
"num_output_chunks",
"=",
"2",
"*",
"(",
"seq_length",
"//",
"(",
"2",
"*",
"window_overla... | [
1162,
4
] | [
1187,
36
] | python | en | ['en', 'en', 'en'] | True |
TFLongformerSelfAttention._get_global_attn_indices | (is_index_global_attn) | compute global attn indices required throughout forward pass | compute global attn indices required throughout forward pass | def _get_global_attn_indices(is_index_global_attn):
""" compute global attn indices required throughout forward pass """
# helper variable
num_global_attn_indices = tf.math.count_nonzero(is_index_global_attn, axis=1)
num_global_attn_indices = tf.cast(num_global_attn_indices, dtype=tf.con... | [
"def",
"_get_global_attn_indices",
"(",
"is_index_global_attn",
")",
":",
"# helper variable",
"num_global_attn_indices",
"=",
"tf",
".",
"math",
".",
"count_nonzero",
"(",
"is_index_global_attn",
",",
"axis",
"=",
"1",
")",
"num_global_attn_indices",
"=",
"tf",
".",
... | [
1190,
4
] | [
1218,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Eight Sleep component. | Set up the Eight Sleep component. | async def async_setup(hass, config):
"""Set up the Eight Sleep component."""
conf = config.get(DOMAIN)
user = conf.get(CONF_USERNAME)
password = conf.get(CONF_PASSWORD)
partner = conf.get(CONF_PARTNER)
if hass.config.time_zone is None:
_LOGGER.error("Timezone is not set in Home Assista... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
"user",
"=",
"conf",
".",
"get",
"(",
"CONF_USERNAME",
")",
"password",
"=",
"conf",
".",
"get",
"(",
"CONF_PASSWORD",
")",
"p... | [
100,
0
] | [
198,
15
] | python | en | ['en', 'en', 'en'] | True |
EightSleepUserEntity.__init__ | (self, eight) | Initialize the data object. | Initialize the data object. | def __init__(self, eight):
"""Initialize the data object."""
self._eight = eight | [
"def",
"__init__",
"(",
"self",
",",
"eight",
")",
":",
"self",
".",
"_eight",
"=",
"eight"
] | [
204,
4
] | [
206,
27
] | python | en | ['en', 'en', 'en'] | True |
EightSleepUserEntity.async_added_to_hass | (self) | Register update dispatcher. | Register update dispatcher. | async def async_added_to_hass(self):
"""Register update dispatcher."""
@callback
def async_eight_user_update():
"""Update callback."""
self.async_schedule_update_ha_state(True)
self.async_on_remove(
async_dispatcher_connect(
self.hass... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"@",
"callback",
"def",
"async_eight_user_update",
"(",
")",
":",
"\"\"\"Update callback.\"\"\"",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")",
"self",
".",
"async_on_remove",
"(",
"asy... | [
208,
4
] | [
220,
9
] | python | de | ['it', 'de', 'en'] | False |
EightSleepUserEntity.should_poll | (self) | Return True if entity has to be polled for state. | Return True if entity has to be polled for state. | def should_poll(self):
"""Return True if entity has to be polled for state."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
223,
4
] | [
225,
20
] | python | en | ['en', 'en', 'en'] | True |
EightSleepHeatEntity.__init__ | (self, eight) | Initialize the data object. | Initialize the data object. | def __init__(self, eight):
"""Initialize the data object."""
self._eight = eight | [
"def",
"__init__",
"(",
"self",
",",
"eight",
")",
":",
"self",
".",
"_eight",
"=",
"eight"
] | [
231,
4
] | [
233,
27
] | python | en | ['en', 'en', 'en'] | True |
EightSleepHeatEntity.async_added_to_hass | (self) | Register update dispatcher. | Register update dispatcher. | async def async_added_to_hass(self):
"""Register update dispatcher."""
@callback
def async_eight_heat_update():
"""Update callback."""
self.async_schedule_update_ha_state(True)
self.async_on_remove(
async_dispatcher_connect(
self.hass... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"@",
"callback",
"def",
"async_eight_heat_update",
"(",
")",
":",
"\"\"\"Update callback.\"\"\"",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")",
"self",
".",
"async_on_remove",
"(",
"asy... | [
235,
4
] | [
247,
9
] | python | de | ['it', 'de', 'en'] | False |
EightSleepHeatEntity.should_poll | (self) | Return True if entity has to be polled for state. | Return True if entity has to be polled for state. | def should_poll(self):
"""Return True if entity has to be polled for state."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
250,
4
] | [
252,
20
] | python | en | ['en', 'en', 'en'] | True |
check_node_schema | (node, schema) | Check if node matches the passed node schema. | Check if node matches the passed node schema. | def check_node_schema(node, schema):
"""Check if node matches the passed node schema."""
if const.DISC_NODE_ID in schema and node.node_id not in schema[const.DISC_NODE_ID]:
return False
if const.DISC_GENERIC_DEVICE_CLASS in schema and not eq_or_in(
node.node_generic, schema[const.DISC_GENERI... | [
"def",
"check_node_schema",
"(",
"node",
",",
"schema",
")",
":",
"if",
"const",
".",
"DISC_NODE_ID",
"in",
"schema",
"and",
"node",
".",
"node_id",
"not",
"in",
"schema",
"[",
"const",
".",
"DISC_NODE_ID",
"]",
":",
"return",
"False",
"if",
"const",
"."... | [
314,
0
] | [
326,
15
] | python | en | ['en', 'en', 'en'] | True |
check_value_schema | (value, schema) | Check if the value matches the passed value schema. | Check if the value matches the passed value schema. | def check_value_schema(value, schema):
"""Check if the value matches the passed value schema."""
if const.DISC_COMMAND_CLASS in schema and not eq_or_in(
value.parent.command_class_id, schema[const.DISC_COMMAND_CLASS]
):
return False
if const.DISC_TYPE in schema and not eq_or_in(value.typ... | [
"def",
"check_value_schema",
"(",
"value",
",",
"schema",
")",
":",
"if",
"const",
".",
"DISC_COMMAND_CLASS",
"in",
"schema",
"and",
"not",
"eq_or_in",
"(",
"value",
".",
"parent",
".",
"command_class_id",
",",
"schema",
"[",
"const",
".",
"DISC_COMMAND_CLASS"... | [
329,
0
] | [
350,
15
] | python | en | ['en', 'en', 'en'] | True |
eq_or_in | (val, options) | Return True if options contains value or if value is equal to options. | Return True if options contains value or if value is equal to options. | def eq_or_in(val, options):
"""Return True if options contains value or if value is equal to options."""
return val in options if isinstance(options, tuple) else val == options | [
"def",
"eq_or_in",
"(",
"val",
",",
"options",
")",
":",
"return",
"val",
"in",
"options",
"if",
"isinstance",
"(",
"options",
",",
"tuple",
")",
"else",
"val",
"==",
"options"
] | [
353,
0
] | [
355,
75
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: dict) | Set up the Netatmo component. | Set up the Netatmo component. | async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Netatmo component."""
hass.data[DOMAIN] = {}
hass.data[DOMAIN][DATA_PERSONS] = {}
hass.data[DOMAIN][DATA_DEVICE_IDS] = {}
hass.data[DOMAIN][DATA_SCHEDULES] = {}
hass.data[DOMAIN][DATA_HOMES] = {}
hass.data[DOMAIN][DATA_E... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_PERSONS",
"]",
"=",
"{",
"}",
"hass"... | [
59,
0
] | [
84,
15
] | python | en | ['en', 'bg', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Netatmo from a config entry. | Set up Netatmo from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Netatmo from a config entry."""
implementation = (
await config_entry_oauth2_flow.async_get_config_entry_implementation(
hass, entry
)
)
# Set unique id if non was set (migration)
if not entr... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"implementation",
"=",
"(",
"await",
"config_entry_oauth2_flow",
".",
"async_get_config_entry_implementation",
"(",
"hass",
",",
"entry",
")",
")",
... | [
87,
0
] | [
170,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
if CONF_WEBHOOK_ID in entry.data:
await hass.async_add_executor_job(
hass.data[DOMAIN][entry.entry_id][AUTH].dropwebhook
)
_LOGGER.info("Unregister Netatmo webhook.")
awai... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"if",
"CONF_WEBHOOK_ID",
"in",
"entry",
".",
"data",
":",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"hass",
".",
"data",
"[",
"DOM... | [
173,
0
] | [
195,
20
] | python | en | ['en', 'es', 'en'] | True |
async_remove_entry | (hass: HomeAssistant, entry: ConfigEntry) | Cleanup when entry is removed. | Cleanup when entry is removed. | async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Cleanup when entry is removed."""
if (
CONF_WEBHOOK_ID in entry.data
and hass.components.cloud.async_active_subscription()
):
try:
_LOGGER.debug(
"Removing Netatmo cloudhook (%s)", e... | [
"async",
"def",
"async_remove_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"if",
"(",
"CONF_WEBHOOK_ID",
"in",
"entry",
".",
"data",
"and",
"hass",
".",
"components",
".",
"cloud",
".",
"async_active_subscription",
"("... | [
198,
0
] | [
210,
16
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry, async_add_entities) | Set up the Mill climate. | Set up the Mill climate. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the Mill climate."""
mill_data_connection = Mill(
entry.data[CONF_USERNAME],
entry.data[CONF_PASSWORD],
websession=async_get_clientsession(hass),
)
if not await mill_data_connection.connect():
raise C... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"mill_data_connection",
"=",
"Mill",
"(",
"entry",
".",
"data",
"[",
"CONF_USERNAME",
"]",
",",
"entry",
".",
"data",
"[",
"CONF_PASSWORD",
"]",
",",
"webses... | [
48,
0
] | [
77,
5
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.__init__ | (self, heater, mill_data_connection) | Initialize the thermostat. | Initialize the thermostat. | def __init__(self, heater, mill_data_connection):
"""Initialize the thermostat."""
self._heater = heater
self._conn = mill_data_connection | [
"def",
"__init__",
"(",
"self",
",",
"heater",
",",
"mill_data_connection",
")",
":",
"self",
".",
"_heater",
"=",
"heater",
"self",
".",
"_conn",
"=",
"mill_data_connection"
] | [
83,
4
] | [
86,
41
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_FLAGS | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_FLAGS"
] | [
89,
4
] | [
91,
28
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self):
"""Return True if entity is available."""
return self._heater.available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_heater",
".",
"available"
] | [
94,
4
] | [
96,
37
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return self._heater.device_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_heater",
".",
"device_id"
] | [
99,
4
] | [
101,
37
] | python | ca | ['fr', 'ca', 'en'] | False |
MillHeater.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self):
"""Return the name of the entity."""
return self._heater.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_heater",
".",
"name"
] | [
104,
4
] | [
106,
32
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
res = {
"open_window": self._heater.open_window,
"heating": self._heater.is_heating,
"controlled_by_tibber": self._heater.tibber_control,
"heater_generation": 1 if self._heater.is_gen1 e... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"res",
"=",
"{",
"\"open_window\"",
":",
"self",
".",
"_heater",
".",
"open_window",
",",
"\"heating\"",
":",
"self",
".",
"_heater",
".",
"is_heating",
",",
"\"controlled_by_tibber\"",
":",
"self",
".",... | [
109,
4
] | [
122,
18
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.temperature_unit | (self) | Return the unit of measurement which this thermostat uses. | Return the unit of measurement which this thermostat uses. | def temperature_unit(self):
"""Return the unit of measurement which this thermostat uses."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
125,
4
] | [
127,
27
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
return self._heater.set_temp | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_heater",
".",
"set_temp"
] | [
130,
4
] | [
132,
36
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.target_temperature_step | (self) | Return the supported step of target temperature. | Return the supported step of target temperature. | def target_temperature_step(self):
"""Return the supported step of target temperature."""
return 1 | [
"def",
"target_temperature_step",
"(",
"self",
")",
":",
"return",
"1"
] | [
135,
4
] | [
137,
16
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._heater.current_temp | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_heater",
".",
"current_temp"
] | [
140,
4
] | [
142,
40
] | python | en | ['en', 'la', 'en'] | True |
MillHeater.fan_mode | (self) | Return the fan setting. | Return the fan setting. | def fan_mode(self):
"""Return the fan setting."""
return FAN_ON if self._heater.fan_status == 1 else HVAC_MODE_OFF | [
"def",
"fan_mode",
"(",
"self",
")",
":",
"return",
"FAN_ON",
"if",
"self",
".",
"_heater",
".",
"fan_status",
"==",
"1",
"else",
"HVAC_MODE_OFF"
] | [
145,
4
] | [
147,
72
] | python | en | ['en', 'fy', 'en'] | True |
MillHeater.fan_modes | (self) | List of available fan modes. | List of available fan modes. | def fan_modes(self):
"""List of available fan modes."""
return [FAN_ON, HVAC_MODE_OFF] | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"return",
"[",
"FAN_ON",
",",
"HVAC_MODE_OFF",
"]"
] | [
150,
4
] | [
152,
38
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
return MIN_TEMP | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"MIN_TEMP"
] | [
155,
4
] | [
157,
23
] | python | en | ['en', 'la', 'en'] | True |
MillHeater.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
return MAX_TEMP | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"MAX_TEMP"
] | [
160,
4
] | [
162,
23
] | python | en | ['en', 'la', 'en'] | True |
MillHeater.hvac_action | (self) | Return current hvac i.e. heat, cool, idle. | Return current hvac i.e. heat, cool, idle. | def hvac_action(self):
"""Return current hvac i.e. heat, cool, idle."""
if self._heater.is_gen1 or self._heater.is_heating == 1:
return CURRENT_HVAC_HEAT
return CURRENT_HVAC_IDLE | [
"def",
"hvac_action",
"(",
"self",
")",
":",
"if",
"self",
".",
"_heater",
".",
"is_gen1",
"or",
"self",
".",
"_heater",
".",
"is_heating",
"==",
"1",
":",
"return",
"CURRENT_HVAC_HEAT",
"return",
"CURRENT_HVAC_IDLE"
] | [
165,
4
] | [
169,
32
] | python | en | ['en', 'bg', 'en'] | True |
MillHeater.hvac_mode | (self) | Return hvac operation ie. heat, cool mode.
Need to be one of HVAC_MODE_*.
| Return hvac operation ie. heat, cool mode. | def hvac_mode(self) -> str:
"""Return hvac operation ie. heat, cool mode.
Need to be one of HVAC_MODE_*.
"""
if self._heater.is_gen1 or self._heater.power_status == 1:
return HVAC_MODE_HEAT
return HVAC_MODE_OFF | [
"def",
"hvac_mode",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"_heater",
".",
"is_gen1",
"or",
"self",
".",
"_heater",
".",
"power_status",
"==",
"1",
":",
"return",
"HVAC_MODE_HEAT",
"return",
"HVAC_MODE_OFF"
] | [
172,
4
] | [
179,
28
] | python | bg | ['en', 'bg', 'bg'] | True |
MillHeater.hvac_modes | (self) | Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
| Return the list of available hvac operation modes. | def hvac_modes(self):
"""Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
"""
if self._heater.is_gen1:
return [HVAC_MODE_HEAT]
return [HVAC_MODE_HEAT, HVAC_MODE_OFF] | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_heater",
".",
"is_gen1",
":",
"return",
"[",
"HVAC_MODE_HEAT",
"]",
"return",
"[",
"HVAC_MODE_HEAT",
",",
"HVAC_MODE_OFF",
"]"
] | [
182,
4
] | [
189,
46
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
temperature = kwargs.get(ATTR_TEMPERATURE)
if temperature is None:
return
await self._conn.set_heater_temp(self._heater.device_id, int(temperature)) | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"temperature",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"if",
"temperature",
"is",
"None",
":",
"return",
"await",
"self",
".",
"_conn",
".",
"set_heat... | [
191,
4
] | [
196,
82
] | python | en | ['en', 'ca', 'en'] | True |
MillHeater.async_set_fan_mode | (self, fan_mode) | Set new target fan mode. | Set new target fan mode. | async def async_set_fan_mode(self, fan_mode):
"""Set new target fan mode."""
fan_status = 1 if fan_mode == FAN_ON else 0
await self._conn.heater_control(self._heater.device_id, fan_status=fan_status) | [
"async",
"def",
"async_set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
":",
"fan_status",
"=",
"1",
"if",
"fan_mode",
"==",
"FAN_ON",
"else",
"0",
"await",
"self",
".",
"_conn",
".",
"heater_control",
"(",
"self",
".",
"_heater",
".",
"device_id",
",",
... | [
198,
4
] | [
201,
86
] | python | en | ['sv', 'fy', 'en'] | False |
MillHeater.async_set_hvac_mode | (self, hvac_mode) | Set new target hvac mode. | Set new target hvac mode. | async def async_set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
if hvac_mode == HVAC_MODE_HEAT:
await self._conn.heater_control(self._heater.device_id, power_status=1)
elif hvac_mode == HVAC_MODE_OFF and not self._heater.is_gen1:
await self._conn.heater_co... | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"if",
"hvac_mode",
"==",
"HVAC_MODE_HEAT",
":",
"await",
"self",
".",
"_conn",
".",
"heater_control",
"(",
"self",
".",
"_heater",
".",
"device_id",
",",
"power_status",
"=",
"1"... | [
203,
4
] | [
208,
83
] | python | da | ['da', 'su', 'en'] | False |
MillHeater.async_update | (self) | Retrieve latest state. | Retrieve latest state. | async def async_update(self):
"""Retrieve latest state."""
self._heater = await self._conn.update_device(self._heater.device_id) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"self",
".",
"_heater",
"=",
"await",
"self",
".",
"_conn",
".",
"update_device",
"(",
"self",
".",
"_heater",
".",
"device_id",
")"
] | [
210,
4
] | [
212,
77
] | python | en | ['es', 'sk', 'en'] | False |
MillHeater.device_id | (self) | Return the ID of the physical device this sensor is part of. | Return the ID of the physical device this sensor is part of. | def device_id(self):
"""Return the ID of the physical device this sensor is part of."""
return self._heater.device_id | [
"def",
"device_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_heater",
".",
"device_id"
] | [
215,
4
] | [
217,
37
] | python | en | ['en', 'en', 'en'] | True |
MillHeater.device_info | (self) | Return the device_info of the device. | Return the device_info of the device. | def device_info(self):
"""Return the device_info of the device."""
device_info = {
"identifiers": {(DOMAIN, self.device_id)},
"name": self.name,
"manufacturer": MANUFACTURER,
"model": f"generation {1 if self._heater.is_gen1 else 2}",
}
retu... | [
"def",
"device_info",
"(",
"self",
")",
":",
"device_info",
"=",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"device_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"manufacturer\"",
":",
"MANUFACTURER",
",",
"\"mo... | [
220,
4
] | [
228,
26
] | python | en | ['en', 'en', 'en'] | True |
test_platform_manually_configured | (hass) | Test that we do not discover anything or try to set up a gateway. | Test that we do not discover anything or try to set up a gateway. | async def test_platform_manually_configured(hass):
"""Test that we do not discover anything or try to set up a gateway."""
assert (
await async_setup_component(
hass, FAN_DOMAIN, {"fan": {"platform": DECONZ_DOMAIN}}
)
is True
)
assert DECONZ_DOMAIN not in hass.data | [
"async",
"def",
"test_platform_manually_configured",
"(",
"hass",
")",
":",
"assert",
"(",
"await",
"async_setup_component",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"{",
"\"fan\"",
":",
"{",
"\"platform\"",
":",
"DECONZ_DOMAIN",
"}",
"}",
")",
"is",
"True",
")",
... | [
47,
0
] | [
55,
41
] | python | en | ['en', 'en', 'en'] | True |
test_no_fans | (hass) | Test that no fan entities are created. | Test that no fan entities are created. | async def test_no_fans(hass):
"""Test that no fan entities are created."""
await setup_deconz_integration(hass)
assert len(hass.states.async_all()) == 0 | [
"async",
"def",
"test_no_fans",
"(",
"hass",
")",
":",
"await",
"setup_deconz_integration",
"(",
"hass",
")",
"assert",
"len",
"(",
"hass",
".",
"states",
".",
"async_all",
"(",
")",
")",
"==",
"0"
] | [
58,
0
] | [
61,
44
] | python | en | ['en', 'en', 'en'] | True |
test_fans | (hass) | Test that all supported fan entities are created. | Test that all supported fan entities are created. | async def test_fans(hass):
"""Test that all supported fan entities are created."""
data = deepcopy(DECONZ_WEB_REQUEST)
data["lights"] = deepcopy(FANS)
config_entry = await setup_deconz_integration(hass, get_state_response=data)
gateway = get_gateway_from_config_entry(hass, config_entry)
assert ... | [
"async",
"def",
"test_fans",
"(",
"hass",
")",
":",
"data",
"=",
"deepcopy",
"(",
"DECONZ_WEB_REQUEST",
")",
"data",
"[",
"\"lights\"",
"]",
"=",
"deepcopy",
"(",
"FANS",
")",
"config_entry",
"=",
"await",
"setup_deconz_integration",
"(",
"hass",
",",
"get_s... | [
64,
0
] | [
210,
44
] | python | en | ['en', 'en', 'en'] | True |
test_ecobee_occupancy_setup | (hass) | Test that an Ecbobee occupancy sensor be correctly setup in HA. | Test that an Ecbobee occupancy sensor be correctly setup in HA. | async def test_ecobee_occupancy_setup(hass):
"""Test that an Ecbobee occupancy sensor be correctly setup in HA."""
accessories = await setup_accessories_from_file(hass, "ecobee_occupancy.json")
config_entry, pairing = await setup_test_accessories(hass, accessories)
entity_registry = await hass.helpers.... | [
"async",
"def",
"test_ecobee_occupancy_setup",
"(",
"hass",
")",
":",
"accessories",
"=",
"await",
"setup_accessories_from_file",
"(",
"hass",
",",
"\"ecobee_occupancy.json\"",
")",
"config_entry",
",",
"pairing",
"=",
"await",
"setup_test_accessories",
"(",
"hass",
"... | [
13,
0
] | [
36,
39
] | python | en | ['en', 'ig', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the ZhongHong HVAC platform. | Set up the ZhongHong HVAC platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the ZhongHong HVAC platform."""
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
gw_addr = config.get(CONF_GATEWAY_ADDRRESS)
hub = ZhongHongGateway(host, port, gw_addr)
devices = [
ZhongHongClimate(h... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"host",
"=",
"config",
".",
"get",
"(",
"CONF_HOST",
")",
"port",
"=",
"config",
".",
"get",
"(",
"CONF_PORT",
")",
"gw_addr",
"=",
... | [
73,
0
] | [
116,
63
] | python | en | ['en', 'lb', 'en'] | True |
ZhongHongClimate.__init__ | (self, hub, addr_out, addr_in) | Set up the ZhongHong climate devices. | Set up the ZhongHong climate devices. | def __init__(self, hub, addr_out, addr_in):
"""Set up the ZhongHong climate devices."""
self._device = ZhongHongHVAC(hub, addr_out, addr_in)
self._hub = hub
self._current_operation = None
self._current_temperature = None
self._target_temperature = None
self._curr... | [
"def",
"__init__",
"(",
"self",
",",
"hub",
",",
"addr_out",
",",
"addr_in",
")",
":",
"self",
".",
"_device",
"=",
"ZhongHongHVAC",
"(",
"hub",
",",
"addr_out",
",",
"addr_in",
")",
"self",
".",
"_hub",
"=",
"hub",
"self",
".",
"_current_operation",
"... | [
122,
4
] | [
131,
35
] | python | en | ['en', 'en', 'en'] | True |
ZhongHongClimate.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
self._device.register_update_callback(self._after_update)
self.is_initialized = True
async_dispatcher_send(self.hass, SIGNAL_DEVICE_ADDED) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_device",
".",
"register_update_callback",
"(",
"self",
".",
"_after_update",
")",
"self",
".",
"is_initialized",
"=",
"True",
"async_dispatcher_send",
"(",
"self",
".",
"hass",
",",
"... | [
133,
4
] | [
137,
61
] | python | en | ['en', 'no', 'en'] | False |
ZhongHongClimate._after_update | (self, climate) | Handle state update. | Handle state update. | def _after_update(self, climate):
"""Handle state update."""
_LOGGER.debug("async update ha state")
if self._device.current_operation:
self._current_operation = MODE_TO_STATE[
self._device.current_operation.lower()
]
if self._device.current_tempera... | [
"def",
"_after_update",
"(",
"self",
",",
"climate",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"async update ha state\"",
")",
"if",
"self",
".",
"_device",
".",
"current_operation",
":",
"self",
".",
"_current_operation",
"=",
"MODE_TO_STATE",
"[",
"self",
".... | [
139,
4
] | [
152,
39
] | python | en | ['en', 'en', 'en'] | True |
ZhongHongClimate.should_poll | (self) | Return the polling state. | Return the polling state. | def should_poll(self):
"""Return the polling state."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
155,
4
] | [
157,
20
] | python | en | ['en', 'en', 'en'] | True |
ZhongHongClimate.name | (self) | Return the name of the thermostat, if any. | Return the name of the thermostat, if any. | def name(self):
"""Return the name of the thermostat, if any."""
return self.unique_id | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"unique_id"
] | [
160,
4
] | [
162,
29
] | python | en | ['en', 'en', 'en'] | True |
ZhongHongClimate.unique_id | (self) | Return the unique ID of the HVAC. | Return the unique ID of the HVAC. | def unique_id(self):
"""Return the unique ID of the HVAC."""
return f"zhong_hong_hvac_{self._device.addr_out}_{self._device.addr_in}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"zhong_hong_hvac_{self._device.addr_out}_{self._device.addr_in}\""
] | [
165,
4
] | [
167,
80
] | python | en | ['en', 'la', 'en'] | True |
ZhongHongClimate.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_TARGET_TEMPERATURE",
"|",
"SUPPORT_FAN_MODE"
] | [
170,
4
] | [
172,
60
] | python | en | ['en', 'en', 'en'] | True |
ZhongHongClimate.temperature_unit | (self) | Return the unit of measurement used by the platform. | Return the unit of measurement used by the platform. | def temperature_unit(self):
"""Return the unit of measurement used by the platform."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
175,
4
] | [
177,
27
] | python | en | ['en', 'en', 'en'] | True |
ZhongHongClimate.hvac_mode | (self) | Return current operation ie. heat, cool, idle. | Return current operation ie. heat, cool, idle. | def hvac_mode(self):
"""Return current operation ie. heat, cool, idle."""
if self.is_on:
return self._current_operation
return HVAC_MODE_OFF | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_on",
":",
"return",
"self",
".",
"_current_operation",
"return",
"HVAC_MODE_OFF"
] | [
180,
4
] | [
184,
28
] | python | en | ['nl', 'en', 'en'] | True |
ZhongHongClimate.hvac_modes | (self) | Return the list of available operation modes. | Return the list of available operation modes. | def hvac_modes(self):
"""Return the list of available operation modes."""
return SUPPORT_HVAC | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"SUPPORT_HVAC"
] | [
187,
4
] | [
189,
27
] | python | en | ['en', 'en', 'en'] | True |
ZhongHongClimate.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._current_temperature | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_temperature"
] | [
192,
4
] | [
194,
40
] | python | en | ['en', 'la', 'en'] | True |
ZhongHongClimate.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
return self._target_temperature | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_target_temperature"
] | [
197,
4
] | [
199,
39
] | python | en | ['en', 'en', 'en'] | True |
ZhongHongClimate.target_temperature_step | (self) | Return the supported step of target temperature. | Return the supported step of target temperature. | def target_temperature_step(self):
"""Return the supported step of target temperature."""
return 1 | [
"def",
"target_temperature_step",
"(",
"self",
")",
":",
"return",
"1"
] | [
202,
4
] | [
204,
16
] | python | en | ['en', 'en', 'en'] | True |
ZhongHongClimate.is_on | (self) | Return true if on. | Return true if on. | def is_on(self):
"""Return true if on."""
return self._device.is_on | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"is_on"
] | [
207,
4
] | [
209,
33
] | python | en | ['en', 'mt', 'en'] | True |
ZhongHongClimate.fan_mode | (self) | Return the fan setting. | Return the fan setting. | def fan_mode(self):
"""Return the fan setting."""
return self._current_fan_mode | [
"def",
"fan_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_fan_mode"
] | [
212,
4
] | [
214,
37
] | python | en | ['en', 'fy', 'en'] | True |
ZhongHongClimate.fan_modes | (self) | Return the list of available fan modes. | Return the list of available fan modes. | def fan_modes(self):
"""Return the list of available fan modes."""
return self._device.fan_list | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"fan_list"
] | [
217,
4
] | [
219,
36
] | 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.