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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ZhongHongClimate.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
return self._device.min_temp | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"min_temp"
] | [
222,
4
] | [
224,
36
] | python | en | ['en', 'la', 'en'] | True |
ZhongHongClimate.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
return self._device.max_temp | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"max_temp"
] | [
227,
4
] | [
229,
36
] | python | en | ['en', 'la', 'en'] | True |
ZhongHongClimate.turn_on | (self) | Turn on ac. | Turn on ac. | def turn_on(self):
"""Turn on ac."""
return self._device.turn_on() | [
"def",
"turn_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"turn_on",
"(",
")"
] | [
231,
4
] | [
233,
37
] | python | en | ['en', 'et', 'en'] | True |
ZhongHongClimate.turn_off | (self) | Turn off ac. | Turn off ac. | def turn_off(self):
"""Turn off ac."""
return self._device.turn_off() | [
"def",
"turn_off",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"turn_off",
"(",
")"
] | [
235,
4
] | [
237,
38
] | python | en | ['en', 'cy', 'en'] | True |
ZhongHongClimate.set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | def set_temperature(self, **kwargs):
"""Set new target temperature."""
temperature = kwargs.get(ATTR_TEMPERATURE)
if temperature is not None:
self._device.set_temperature(temperature)
operation_mode = kwargs.get(ATTR_HVAC_MODE)
if operation_mode is not None:
... | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"temperature",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"if",
"temperature",
"is",
"not",
"None",
":",
"self",
".",
"_device",
".",
"set_temperature",
"(",
"temperatu... | [
239,
4
] | [
247,
46
] | python | en | ['en', 'ca', 'en'] | True |
ZhongHongClimate.set_hvac_mode | (self, hvac_mode) | Set new target operation mode. | Set new target operation mode. | def set_hvac_mode(self, hvac_mode):
"""Set new target operation mode."""
if hvac_mode == HVAC_MODE_OFF:
if self.is_on:
self.turn_off()
return
if not self.is_on:
self.turn_on()
self._device.set_operation_mode(hvac_mode.upper()) | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"if",
"self",
".",
"is_on",
":",
"self",
".",
"turn_off",
"(",
")",
"return",
"if",
"not",
"self",
".",
"is_on",
":",
"self",
".",
"turn_on"... | [
249,
4
] | [
259,
58
] | python | en | ['nl', 'en', 'en'] | True |
ZhongHongClimate.set_fan_mode | (self, fan_mode) | Set new target fan mode. | Set new target fan mode. | def set_fan_mode(self, fan_mode):
"""Set new target fan mode."""
self._device.set_fan_mode(fan_mode) | [
"def",
"set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
":",
"self",
".",
"_device",
".",
"set_fan_mode",
"(",
"fan_mode",
")"
] | [
261,
4
] | [
263,
43
] | python | en | ['sv', 'fy', 'en'] | False |
async_get_instance | (hass) | Zeroconf instance to be shared with other integrations that use it. | Zeroconf instance to be shared with other integrations that use it. | async def async_get_instance(hass):
"""Zeroconf instance to be shared with other integrations that use it."""
return await _async_get_instance(hass) | [
"async",
"def",
"async_get_instance",
"(",
"hass",
")",
":",
"return",
"await",
"_async_get_instance",
"(",
"hass",
")"
] | [
81,
0
] | [
83,
42
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up Zeroconf and make Home Assistant discoverable. | Set up Zeroconf and make Home Assistant discoverable. | async def async_setup(hass, config):
"""Set up Zeroconf and make Home Assistant discoverable."""
zc_config = config.get(DOMAIN, {})
zc_args = {}
if zc_config.get(CONF_DEFAULT_INTERFACE, DEFAULT_DEFAULT_INTERFACE):
zc_args["interfaces"] = InterfaceChoice.Default
if not zc_config.get(CONF_IPV6... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"zc_config",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"zc_args",
"=",
"{",
"}",
"if",
"zc_config",
".",
"get",
"(",
"CONF_DEFAULT_INTERFACE",
",",
"DEFAULT_DEFAULT_... | [
132,
0
] | [
163,
15
] | python | en | ['en', 'en', 'en'] | True |
_async_start_zeroconf_browser | (hass, zeroconf) | Start the zeroconf browser. | Start the zeroconf browser. | async def _async_start_zeroconf_browser(hass, zeroconf):
"""Start the zeroconf browser."""
zeroconf_types = await async_get_zeroconf(hass)
homekit_models = await async_get_homekit(hass)
types = list(zeroconf_types)
if HOMEKIT_TYPE not in zeroconf_types:
types.append(HOMEKIT_TYPE)
def... | [
"async",
"def",
"_async_start_zeroconf_browser",
"(",
"hass",
",",
"zeroconf",
")",
":",
"zeroconf_types",
"=",
"await",
"async_get_zeroconf",
"(",
"hass",
")",
"homekit_models",
"=",
"await",
"async_get_homekit",
"(",
"hass",
")",
"types",
"=",
"list",
"(",
"ze... | [
223,
0
] | [
310,
64
] | python | en | ['en', 'de', 'en'] | True |
handle_homekit | (hass, homekit_models, info) | Handle a HomeKit discovery.
Return if discovery was forwarded.
| Handle a HomeKit discovery. | def handle_homekit(hass, homekit_models, info) -> bool:
"""Handle a HomeKit discovery.
Return if discovery was forwarded.
"""
model = None
props = info.get(HOMEKIT_PROPERTIES, {})
for key in props:
if key.lower() == HOMEKIT_MODEL:
model = props[key]
break
i... | [
"def",
"handle_homekit",
"(",
"hass",
",",
"homekit_models",
",",
"info",
")",
"->",
"bool",
":",
"model",
"=",
"None",
"props",
"=",
"info",
".",
"get",
"(",
"HOMEKIT_PROPERTIES",
",",
"{",
"}",
")",
"for",
"key",
"in",
"props",
":",
"if",
"key",
".... | [
313,
0
] | [
344,
16
] | python | en | ['en', 'haw', 'en'] | True |
info_from_service | (service) | Return prepared info from mDNS entries. | Return prepared info from mDNS entries. | def info_from_service(service):
"""Return prepared info from mDNS entries."""
properties = {"_raw": {}}
for key, value in service.properties.items():
# See https://ietf.org/rfc/rfc6763.html#section-6.4 and
# https://ietf.org/rfc/rfc6763.html#section-6.5 for expected encodings
# for ... | [
"def",
"info_from_service",
"(",
"service",
")",
":",
"properties",
"=",
"{",
"\"_raw\"",
":",
"{",
"}",
"}",
"for",
"key",
",",
"value",
"in",
"service",
".",
"properties",
".",
"items",
"(",
")",
":",
"# See https://ietf.org/rfc/rfc6763.html#section-6.4 and",
... | [
347,
0
] | [
385,
15
] | python | en | ['en', 'en', 'en'] | True |
_suppress_invalid_properties | (properties) | Suppress any properties that will cause zeroconf to fail to startup. | Suppress any properties that will cause zeroconf to fail to startup. | def _suppress_invalid_properties(properties):
"""Suppress any properties that will cause zeroconf to fail to startup."""
for prop, prop_value in properties.items():
if not isinstance(prop_value, str):
continue
if len(prop_value.encode("utf-8")) > MAX_PROPERTY_VALUE_LEN:
... | [
"def",
"_suppress_invalid_properties",
"(",
"properties",
")",
":",
"for",
"prop",
",",
"prop_value",
"in",
"properties",
".",
"items",
"(",
")",
":",
"if",
"not",
"isinstance",
"(",
"prop_value",
",",
"str",
")",
":",
"continue",
"if",
"len",
"(",
"prop_v... | [
388,
0
] | [
402,
33
] | python | en | ['en', 'en', 'en'] | True |
_truncate_location_name_to_valid | (location_name) | Truncate or return the location name usable for zeroconf. | Truncate or return the location name usable for zeroconf. | def _truncate_location_name_to_valid(location_name):
"""Truncate or return the location name usable for zeroconf."""
if len(location_name.encode("utf-8")) < MAX_NAME_LEN:
return location_name
_LOGGER.warning(
"The location name was truncated because it is longer than the maximum length of %... | [
"def",
"_truncate_location_name_to_valid",
"(",
"location_name",
")",
":",
"if",
"len",
"(",
"location_name",
".",
"encode",
"(",
"\"utf-8\"",
")",
")",
"<",
"MAX_NAME_LEN",
":",
"return",
"location_name",
"_LOGGER",
".",
"warning",
"(",
"\"The location name was tru... | [
405,
0
] | [
415,
81
] | python | en | ['en', 'en', 'en'] | True |
HaServiceBrowser.update_record | (self, zc: "Zeroconf", now: float, record: DNSRecord) | Pre-Filter update_record to DNSPointers for the configured type. | Pre-Filter update_record to DNSPointers for the configured type. | def update_record(self, zc: "Zeroconf", now: float, record: DNSRecord) -> None:
"""Pre-Filter update_record to DNSPointers for the configured type."""
#
# Each ServerBrowser currently runs in its own thread which
# processes every A or AAAA record update per instance.
#
... | [
"def",
"update_record",
"(",
"self",
",",
"zc",
":",
"\"Zeroconf\"",
",",
"now",
":",
"float",
",",
"record",
":",
"DNSRecord",
")",
"->",
"None",
":",
"#",
"# Each ServerBrowser currently runs in its own thread which",
"# processes every A or AAAA record update per insta... | [
105,
4
] | [
120,
46
] | python | en | ['en', 'en', 'en'] | True |
HaZeroconf.close | (self) | Fake method to avoid integrations closing it. | Fake method to avoid integrations closing it. | def close(self):
"""Fake method to avoid integrations closing it.""" | [
"def",
"close",
"(",
"self",
")",
":"
] | [
126,
4
] | [
127,
59
] | python | en | ['en', 'en', 'en'] | True |
dump | (_dict: dict) | Dump YAML to a string and remove null. | Dump YAML to a string and remove null. | def dump(_dict: dict) -> str:
"""Dump YAML to a string and remove null."""
return yaml.safe_dump(
_dict, default_flow_style=False, allow_unicode=True, sort_keys=False
).replace(": null\n", ":\n") | [
"def",
"dump",
"(",
"_dict",
":",
"dict",
")",
"->",
"str",
":",
"return",
"yaml",
".",
"safe_dump",
"(",
"_dict",
",",
"default_flow_style",
"=",
"False",
",",
"allow_unicode",
"=",
"True",
",",
"sort_keys",
"=",
"False",
")",
".",
"replace",
"(",
"\"... | [
10,
0
] | [
14,
32
] | python | en | ['en', 'en', 'en'] | True |
save_yaml | (path: str, data: dict) | Save YAML to a file. | Save YAML to a file. | def save_yaml(path: str, data: dict) -> None:
"""Save YAML to a file."""
# Dump before writing to not truncate the file if dumping fails
str_data = dump(data)
with open(path, "w", encoding="utf-8") as outfile:
outfile.write(str_data) | [
"def",
"save_yaml",
"(",
"path",
":",
"str",
",",
"data",
":",
"dict",
")",
"->",
"None",
":",
"# Dump before writing to not truncate the file if dumping fails",
"str_data",
"=",
"dump",
"(",
"data",
")",
"with",
"open",
"(",
"path",
",",
"\"w\"",
",",
"encodi... | [
17,
0
] | [
22,
31
] | python | en | ['en', 'ny', 'en'] | True |
represent_odict | ( # type: ignore
dumper, tag, mapping, flow_style=None
) | Like BaseRepresenter.represent_mapping but does not issue the sort(). | Like BaseRepresenter.represent_mapping but does not issue the sort(). | def represent_odict( # type: ignore
dumper, tag, mapping, flow_style=None
) -> yaml.MappingNode:
"""Like BaseRepresenter.represent_mapping but does not issue the sort()."""
value: list = []
node = yaml.MappingNode(tag, value, flow_style=flow_style)
if dumper.alias_key is not None:
dumper.re... | [
"def",
"represent_odict",
"(",
"# type: ignore",
"dumper",
",",
"tag",
",",
"mapping",
",",
"flow_style",
"=",
"None",
")",
"->",
"yaml",
".",
"MappingNode",
":",
"value",
":",
"list",
"=",
"[",
"]",
"node",
"=",
"yaml",
".",
"MappingNode",
"(",
"tag",
... | [
26,
0
] | [
50,
15
] | python | en | ['en', 'en', 'en'] | True |
selection_r | (acquisition_function,
samples_y_aggregation,
x_bounds,
x_types,
regressor_gp,
num_starting_points=100,
minimize_constraints_fun=None) |
Selecte R value
|
Selecte R value
| def selection_r(acquisition_function,
samples_y_aggregation,
x_bounds,
x_types,
regressor_gp,
num_starting_points=100,
minimize_constraints_fun=None):
'''
Selecte R value
'''
minimize_starting_points = [lib_d... | [
"def",
"selection_r",
"(",
"acquisition_function",
",",
"samples_y_aggregation",
",",
"x_bounds",
",",
"x_types",
",",
"regressor_gp",
",",
"num_starting_points",
"=",
"100",
",",
"minimize_constraints_fun",
"=",
"None",
")",
":",
"minimize_starting_points",
"=",
"[",... | [
19,
0
] | [
36,
18
] | python | en | ['en', 'error', 'th'] | False |
selection | (acquisition_function,
samples_y_aggregation,
x_bounds, x_types,
regressor_gp,
minimize_starting_points,
minimize_constraints_fun=None) |
selection
|
selection
| def selection(acquisition_function,
samples_y_aggregation,
x_bounds, x_types,
regressor_gp,
minimize_starting_points,
minimize_constraints_fun=None):
'''
selection
'''
outputs = None
sys.stderr.write("[%s] Exercise \"%s\" acquisi... | [
"def",
"selection",
"(",
"acquisition_function",
",",
"samples_y_aggregation",
",",
"x_bounds",
",",
"x_types",
",",
"regressor_gp",
",",
"minimize_starting_points",
",",
"minimize_constraints_fun",
"=",
"None",
")",
":",
"outputs",
"=",
"None",
"sys",
".",
"stderr"... | [
38,
0
] | [
65,
18
] | python | en | ['en', 'error', 'th'] | False |
_rand_with_constraints | (x_bounds, x_types) |
Random generate with constraints
|
Random generate with constraints
| def _rand_with_constraints(x_bounds, x_types):
'''
Random generate with constraints
'''
outputs = None
x_bounds_withconstraints = [x_bounds[i] for i in CONSTRAINT_PARAMS_IDX]
x_types_withconstraints = [x_types[i] for i in CONSTRAINT_PARAMS_IDX]
x_val_withconstraints = lib_constraint_summati... | [
"def",
"_rand_with_constraints",
"(",
"x_bounds",
",",
"x_types",
")",
":",
"outputs",
"=",
"None",
"x_bounds_withconstraints",
"=",
"[",
"x_bounds",
"[",
"i",
"]",
"for",
"i",
"in",
"CONSTRAINT_PARAMS_IDX",
"]",
"x_types_withconstraints",
"=",
"[",
"x_types",
"... | [
67,
0
] | [
88,
18
] | python | en | ['en', 'error', 'th'] | False |
_minimize_constraints_fun_summation | (x) |
Minimize the constraints fun summation
|
Minimize the constraints fun summation
| def _minimize_constraints_fun_summation(x):
'''
Minimize the constraints fun summation
'''
summation = sum([x[i] for i in CONSTRAINT_PARAMS_IDX])
return CONSTRAINT_UPPERBOUND >= summation >= CONSTRAINT_LOWERBOUND | [
"def",
"_minimize_constraints_fun_summation",
"(",
"x",
")",
":",
"summation",
"=",
"sum",
"(",
"[",
"x",
"[",
"i",
"]",
"for",
"i",
"in",
"CONSTRAINT_PARAMS_IDX",
"]",
")",
"return",
"CONSTRAINT_UPPERBOUND",
">=",
"summation",
">=",
"CONSTRAINT_LOWERBOUND"
] | [
91,
0
] | [
96,
70
] | python | en | ['en', 'error', 'th'] | False |
get_pairs | (word) |
Return set of symbol pairs in a word.
Word is represented as tuple of symbols (symbols being variable-length strings).
|
Return set of symbol pairs in a word. | def get_pairs(word):
"""
Return set of symbol pairs in a word.
Word is represented as tuple of symbols (symbols being variable-length strings).
"""
pairs = set()
prev_char = word[0]
for char in word[1:]:
pairs.add((prev_char, char))
prev_char = char
pairs = set(pairs)
... | [
"def",
"get_pairs",
"(",
"word",
")",
":",
"pairs",
"=",
"set",
"(",
")",
"prev_char",
"=",
"word",
"[",
"0",
"]",
"for",
"char",
"in",
"word",
"[",
"1",
":",
"]",
":",
"pairs",
".",
"add",
"(",
"(",
"prev_char",
",",
"char",
")",
")",
"prev_ch... | [
51,
0
] | [
64,
16
] | python | en | ['en', 'error', 'th'] | False |
PhobertTokenizer.build_inputs_with_special_tokens | (
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
) |
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A PhoBERT sequence has the following format:
- single sequence: ``<s> X </s>``
- pair of sequences: ``<s> A </s></s> B </s>``
Args:
... |
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A PhoBERT sequence has the following format: | def build_inputs_with_special_tokens(
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
) -> List[int]:
"""
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A PhoBERT sequence ha... | [
"def",
"build_inputs_with_special_tokens",
"(",
"self",
",",
"token_ids_0",
":",
"List",
"[",
"int",
"]",
",",
"token_ids_1",
":",
"Optional",
"[",
"List",
"[",
"int",
"]",
"]",
"=",
"None",
")",
"->",
"List",
"[",
"int",
"]",
":",
"if",
"token_ids_1",
... | [
157,
4
] | [
181,
64
] | python | en | ['en', 'error', 'th'] | False |
PhobertTokenizer.get_special_tokens_mask | (
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False
) |
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer ``prepare_for_model`` method.
Args:
token_ids_0 (:obj:`List[int]`):
List of IDs.
token_ids_1 (:obj:`List[int]`,... |
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer ``prepare_for_model`` method. | def get_special_tokens_mask(
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False
) -> List[int]:
"""
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens ... | [
"def",
"get_special_tokens_mask",
"(",
"self",
",",
"token_ids_0",
":",
"List",
"[",
"int",
"]",
",",
"token_ids_1",
":",
"Optional",
"[",
"List",
"[",
"int",
"]",
"]",
"=",
"None",
",",
"already_has_special_tokens",
":",
"bool",
"=",
"False",
")",
"->",
... | [
183,
4
] | [
212,
87
] | python | en | ['en', 'error', 'th'] | False |
PhobertTokenizer.create_token_type_ids_from_sequences | (
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
) |
Create a mask from the two sequences passed to be used in a sequence-pair classification task. PhoBERT does not
make use of token type ids, therefore a list of zeros is returned.
Args:
token_ids_0 (:obj:`List[int]`):
List of IDs.
token_ids_1 (:obj:`List[... |
Create a mask from the two sequences passed to be used in a sequence-pair classification task. PhoBERT does not
make use of token type ids, therefore a list of zeros is returned. | def create_token_type_ids_from_sequences(
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
) -> List[int]:
"""
Create a mask from the two sequences passed to be used in a sequence-pair classification task. PhoBERT does not
make use of token type ids, therefore a ... | [
"def",
"create_token_type_ids_from_sequences",
"(",
"self",
",",
"token_ids_0",
":",
"List",
"[",
"int",
"]",
",",
"token_ids_1",
":",
"Optional",
"[",
"List",
"[",
"int",
"]",
"]",
"=",
"None",
")",
"->",
"List",
"[",
"int",
"]",
":",
"sep",
"=",
"[",... | [
214,
4
] | [
236,
75
] | python | en | ['en', 'error', 'th'] | False |
PhobertTokenizer._tokenize | (self, text) | Tokenize a string. | Tokenize a string. | def _tokenize(self, text):
"""Tokenize a string."""
split_tokens = []
words = re.findall(r"\S+\n?", text)
for token in words:
split_tokens.extend([t for t in self.bpe(token).split(" ")])
return split_tokens | [
"def",
"_tokenize",
"(",
"self",
",",
"text",
")",
":",
"split_tokens",
"=",
"[",
"]",
"words",
"=",
"re",
".",
"findall",
"(",
"r\"\\S+\\n?\"",
",",
"text",
")",
"for",
"token",
"in",
"words",
":",
"split_tokens",
".",
"extend",
"(",
"[",
"t",
"for"... | [
289,
4
] | [
297,
27
] | python | en | ['en', 'gl', 'en'] | True |
PhobertTokenizer._convert_token_to_id | (self, token) | Converts a token (str) in an id using the vocab. | Converts a token (str) in an id using the vocab. | def _convert_token_to_id(self, token):
""" Converts a token (str) in an id using the vocab. """
return self.encoder.get(token, self.encoder.get(self.unk_token)) | [
"def",
"_convert_token_to_id",
"(",
"self",
",",
"token",
")",
":",
"return",
"self",
".",
"encoder",
".",
"get",
"(",
"token",
",",
"self",
".",
"encoder",
".",
"get",
"(",
"self",
".",
"unk_token",
")",
")"
] | [
299,
4
] | [
301,
72
] | python | en | ['en', 'en', 'en'] | True |
PhobertTokenizer._convert_id_to_token | (self, index) | Converts an index (integer) in a token (str) using the vocab. | Converts an index (integer) in a token (str) using the vocab. | def _convert_id_to_token(self, index):
"""Converts an index (integer) in a token (str) using the vocab."""
return self.decoder.get(index, self.unk_token) | [
"def",
"_convert_id_to_token",
"(",
"self",
",",
"index",
")",
":",
"return",
"self",
".",
"decoder",
".",
"get",
"(",
"index",
",",
"self",
".",
"unk_token",
")"
] | [
303,
4
] | [
305,
54
] | python | en | ['en', 'en', 'en'] | True |
PhobertTokenizer.convert_tokens_to_string | (self, tokens) | Converts a sequence of tokens (string) in a single string. | Converts a sequence of tokens (string) in a single string. | def convert_tokens_to_string(self, tokens):
""" Converts a sequence of tokens (string) in a single string. """
out_string = " ".join(tokens).replace("@@ ", "").strip()
return out_string | [
"def",
"convert_tokens_to_string",
"(",
"self",
",",
"tokens",
")",
":",
"out_string",
"=",
"\" \"",
".",
"join",
"(",
"tokens",
")",
".",
"replace",
"(",
"\"@@ \"",
",",
"\"\"",
")",
".",
"strip",
"(",
")",
"return",
"out_string"
] | [
307,
4
] | [
310,
25
] | python | en | ['en', 'en', 'en'] | True |
PhobertTokenizer.add_from_file | (self, f) |
Loads a pre-existing dictionary from a text file and adds its symbols to this instance.
|
Loads a pre-existing dictionary from a text file and adds its symbols to this instance.
| def add_from_file(self, f):
"""
Loads a pre-existing dictionary from a text file and adds its symbols to this instance.
"""
if isinstance(f, str):
try:
with open(f, "r", encoding="utf-8") as fd:
self.add_from_file(fd)
except Fil... | [
"def",
"add_from_file",
"(",
"self",
",",
"f",
")",
":",
"if",
"isinstance",
"(",
"f",
",",
"str",
")",
":",
"try",
":",
"with",
"open",
"(",
"f",
",",
"\"r\"",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"fd",
":",
"self",
".",
"add_from_file",
... | [
337,
4
] | [
358,
50
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader.__init__ | (self, root, fileids=PKL_PATTERN, **kwargs) |
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining arguments
are passed to the ``CorpusReader`` constructor.
|
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining arguments
are passed to the ``CorpusReader`` constructor.
| def __init__(self, root, fileids=PKL_PATTERN, **kwargs):
"""
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining arguments
are passed to the ``CorpusRead... | [
"def",
"__init__",
"(",
"self",
",",
"root",
",",
"fileids",
"=",
"PKL_PATTERN",
",",
"*",
"*",
"kwargs",
")",
":",
"# Add the default category pattern if not passed into the class.",
"if",
"not",
"any",
"(",
"key",
".",
"startswith",
"(",
"'cat_'",
")",
"for",
... | [
18,
4
] | [
34,
46
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader._resolve | (self, fileids, categories) |
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. This primarily bubbles up to
the high level ``docs`` method, but is implemented here similar to
the nltk ``CategorizedPlaintextCorpusReader``.
|
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. This primarily bubbles up to
the high level ``docs`` method, but is implemented here similar to
the nltk ``CategorizedPlaintextCorpusReader``.
| def _resolve(self, fileids, categories):
"""
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. This primarily bubbles up to
the high level ``docs`` method, but is implemented here similar to
the nltk ``CategorizedPlaintex... | [
"def",
"_resolve",
"(",
"self",
",",
"fileids",
",",
"categories",
")",
":",
"if",
"fileids",
"is",
"not",
"None",
"and",
"categories",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"Specify fileids or categories, not both\"",
")",
"if",
"categories",
... | [
36,
4
] | [
48,
22
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader.docs | (self, fileids=None, categories=None) |
Returns the document loaded from a pickled object for every file in
the corpus. Similar to the BaleenCorpusReader, this uses a generator
to acheive memory safe iteration.
|
Returns the document loaded from a pickled object for every file in
the corpus. Similar to the BaleenCorpusReader, this uses a generator
to acheive memory safe iteration.
| def docs(self, fileids=None, categories=None):
"""
Returns the document loaded from a pickled object for every file in
the corpus. Similar to the BaleenCorpusReader, this uses a generator
to acheive memory safe iteration.
"""
# Resolve the fileids and the categories
... | [
"def",
"docs",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"# Resolve the fileids and the categories",
"fileids",
"=",
"self",
".",
"_resolve",
"(",
"fileids",
",",
"categories",
")",
"# Create a generator, loading one documen... | [
54,
4
] | [
66,
36
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader.paras | (self, fileids=None, categories=None) |
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
|
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
| def paras(self, fileids=None, categories=None):
"""
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
"""
for doc in self.docs(fileids, categories):
for paragraph in doc:
yiel... | [
"def",
"paras",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"doc",
"in",
"self",
".",
"docs",
"(",
"fileids",
",",
"categories",
")",
":",
"for",
"paragraph",
"in",
"doc",
":",
"yield",
"paragraph"
] | [
68,
4
] | [
75,
31
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader.sents | (self, fileids=None, categories=None) |
Returns a generator of sentences where each sentence is a list of
(token, tag) tuples.
|
Returns a generator of sentences where each sentence is a list of
(token, tag) tuples.
| def sents(self, fileids=None, categories=None):
"""
Returns a generator of sentences where each sentence is a list of
(token, tag) tuples.
"""
for paragraph in self.paras(fileids, categories):
for sentence in paragraph:
yield sentence | [
"def",
"sents",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"paragraph",
"in",
"self",
".",
"paras",
"(",
"fileids",
",",
"categories",
")",
":",
"for",
"sentence",
"in",
"paragraph",
":",
"yield",
"senten... | [
77,
4
] | [
84,
30
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader.words | (self, fileids=None, categories=None) |
Returns a generator of (token, tag) tuples.
|
Returns a generator of (token, tag) tuples.
| def words(self, fileids=None, categories=None):
"""
Returns a generator of (token, tag) tuples.
"""
for sentence in self.sents(fileids, categories):
for token, tag in sentence:
yield token | [
"def",
"words",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"sentence",
"in",
"self",
".",
"sents",
"(",
"fileids",
",",
"categories",
")",
":",
"for",
"token",
",",
"tag",
"in",
"sentence",
":",
"yield"... | [
91,
4
] | [
97,
27
] | python | en | ['en', 'error', 'th'] | False |
test_entity_registry | (hass) | Tests that the devices are registered in the entity registry. | Tests that the devices are registered in the entity registry. | async def test_entity_registry(hass):
"""Tests that the devices are registered in the entity registry."""
await setup_platform(hass, LOCK_DOMAIN)
entity_registry = await hass.helpers.entity_registry.async_get_registry()
entry = entity_registry.async_get(DEVICE_ID)
assert entry.unique_id == "51cab3b... | [
"async",
"def",
"test_entity_registry",
"(",
"hass",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"LOCK_DOMAIN",
")",
"entity_registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",
"async_get_registry",
"(",
")",
"entry",
"=",
... | [
18,
0
] | [
24,
64
] | python | en | ['en', 'en', 'en'] | True |
test_attributes | (hass) | Test the lock attributes are correct. | Test the lock attributes are correct. | async def test_attributes(hass):
"""Test the lock attributes are correct."""
await setup_platform(hass, LOCK_DOMAIN)
state = hass.states.get(DEVICE_ID)
assert state.state == STATE_LOCKED
assert state.attributes.get(ATTR_DEVICE_ID) == "ZW:00000004"
assert not state.attributes.get("battery_low")
... | [
"async",
"def",
"test_attributes",
"(",
"hass",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"LOCK_DOMAIN",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"DEVICE_ID",
")",
"assert",
"state",
".",
"state",
"==",
"STATE_LOCKED",
"asser... | [
27,
0
] | [
37,
66
] | python | en | ['en', 'en', 'en'] | True |
test_lock | (hass) | Test the lock can be locked. | Test the lock can be locked. | async def test_lock(hass):
"""Test the lock can be locked."""
await setup_platform(hass, LOCK_DOMAIN)
with patch("abodepy.AbodeLock.lock") as mock_lock:
await hass.services.async_call(
LOCK_DOMAIN, SERVICE_LOCK, {ATTR_ENTITY_ID: DEVICE_ID}, blocking=True
)
await hass.asy... | [
"async",
"def",
"test_lock",
"(",
"hass",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"LOCK_DOMAIN",
")",
"with",
"patch",
"(",
"\"abodepy.AbodeLock.lock\"",
")",
"as",
"mock_lock",
":",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"L... | [
40,
0
] | [
49,
38
] | python | en | ['en', 'en', 'en'] | True |
test_unlock | (hass) | Test the lock can be unlocked. | Test the lock can be unlocked. | async def test_unlock(hass):
"""Test the lock can be unlocked."""
await setup_platform(hass, LOCK_DOMAIN)
with patch("abodepy.AbodeLock.unlock") as mock_unlock:
await hass.services.async_call(
LOCK_DOMAIN, SERVICE_UNLOCK, {ATTR_ENTITY_ID: DEVICE_ID}, blocking=True
)
awai... | [
"async",
"def",
"test_unlock",
"(",
"hass",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"LOCK_DOMAIN",
")",
"with",
"patch",
"(",
"\"abodepy.AbodeLock.unlock\"",
")",
"as",
"mock_unlock",
":",
"await",
"hass",
".",
"services",
".",
"async_call",
"("... | [
52,
0
] | [
61,
40
] | python | en | ['en', 'en', 'en'] | True |
AutoCompressionExperiment.__init__ | (self, auto_compress_module: AbstractAutoCompressionModule, config: ExperimentConfig) |
Prepare an experiment.
Use `Experiment.run()` to launch it.
Parameters
----------
auto_compress_module
The module provided by the user implements the `AbstractAutoCompressionModule` interfaces.
Remember put the module file under `trial_code_directory`.
... |
Prepare an experiment. | def __init__(self, auto_compress_module: AbstractAutoCompressionModule, config: ExperimentConfig) -> None:
"""
Prepare an experiment.
Use `Experiment.run()` to launch it.
Parameters
----------
auto_compress_module
The module provided by the user implements t... | [
"def",
"__init__",
"(",
"self",
",",
"auto_compress_module",
":",
"AbstractAutoCompressionModule",
",",
"config",
":",
"ExperimentConfig",
")",
"->",
"None",
":",
"..."
] | [
16,
4
] | [
30,
11
] | python | en | ['en', 'error', 'th'] | False |
AutoCompressionExperiment.__init__ | (self, auto_compress_module: AbstractAutoCompressionModule, training_service: Union[str, List[str]]) |
Prepare an experiment, leaving configuration fields to be set later.
Example usage::
experiment = Experiment(auto_compress_module, 'remote')
experiment.config.trial_command = 'python3 trial.py'
experiment.config.machines.append(RemoteMachineConfig(ip=..., user_name... |
Prepare an experiment, leaving configuration fields to be set later. | def __init__(self, auto_compress_module: AbstractAutoCompressionModule, training_service: Union[str, List[str]]) -> None:
"""
Prepare an experiment, leaving configuration fields to be set later.
Example usage::
experiment = Experiment(auto_compress_module, 'remote')
exp... | [
"def",
"__init__",
"(",
"self",
",",
"auto_compress_module",
":",
"AbstractAutoCompressionModule",
",",
"training_service",
":",
"Union",
"[",
"str",
",",
"List",
"[",
"str",
"]",
"]",
")",
"->",
"None",
":",
"..."
] | [
33,
4
] | [
54,
11
] | python | en | ['en', 'error', 'th'] | False |
convert_command_factory | (args: Namespace) |
Factory function used to convert a model TF 1.0 checkpoint in a PyTorch checkpoint.
Returns: ServeCommand
|
Factory function used to convert a model TF 1.0 checkpoint in a PyTorch checkpoint. | def convert_command_factory(args: Namespace):
"""
Factory function used to convert a model TF 1.0 checkpoint in a PyTorch checkpoint.
Returns: ServeCommand
"""
return ConvertCommand(
args.model_type, args.tf_checkpoint, args.pytorch_dump_output, args.config, args.finetuning_task_name
) | [
"def",
"convert_command_factory",
"(",
"args",
":",
"Namespace",
")",
":",
"return",
"ConvertCommand",
"(",
"args",
".",
"model_type",
",",
"args",
".",
"tf_checkpoint",
",",
"args",
".",
"pytorch_dump_output",
",",
"args",
".",
"config",
",",
"args",
".",
"... | [
20,
0
] | [
28,
5
] | python | en | ['en', 'error', 'th'] | False |
ConvertCommand.register_subcommand | (parser: ArgumentParser) |
Register this command to argparse so it's available for the transformer-cli
Args:
parser: Root parser to register command-specific arguments
|
Register this command to argparse so it's available for the transformer-cli | def register_subcommand(parser: ArgumentParser):
"""
Register this command to argparse so it's available for the transformer-cli
Args:
parser: Root parser to register command-specific arguments
"""
train_parser = parser.add_parser(
"convert",
... | [
"def",
"register_subcommand",
"(",
"parser",
":",
"ArgumentParser",
")",
":",
"train_parser",
"=",
"parser",
".",
"add_parser",
"(",
"\"convert\"",
",",
"help",
"=",
"\"CLI tool to run convert model from original \"",
"\"author checkpoints to Transformers PyTorch checkpoints.\"... | [
39,
4
] | [
65,
63
] | python | en | ['en', 'error', 'th'] | False |
test_reproducing_states | (hass, caplog) | Test reproducing Alarm control panel states. | Test reproducing Alarm control panel states. | async def test_reproducing_states(hass, caplog):
"""Test reproducing Alarm control panel states."""
hass.states.async_set(
"alarm_control_panel.entity_armed_away", STATE_ALARM_ARMED_AWAY, {}
)
hass.states.async_set(
"alarm_control_panel.entity_armed_custom_bypass",
STATE_ALARM_AR... | [
"async",
"def",
"test_reproducing_states",
"(",
"hass",
",",
"caplog",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"alarm_control_panel.entity_armed_away\"",
",",
"STATE_ALARM_ARMED_AWAY",
",",
"{",
"}",
")",
"hass",
".",
"states",
".",
"async_set",
... | [
20,
0
] | [
145,
5
] | python | en | ['it', 'en', 'en'] | True |
PickledCorpusReader.__init__ | (self, root, fileids=PKL_PATTERN, **kwargs) |
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining arguments
are passed to the ``CorpusReader`` constructor.
|
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining arguments
are passed to the ``CorpusReader`` constructor.
| def __init__(self, root, fileids=PKL_PATTERN, **kwargs):
"""
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining arguments
are passed to the ``CorpusRead... | [
"def",
"__init__",
"(",
"self",
",",
"root",
",",
"fileids",
"=",
"PKL_PATTERN",
",",
"*",
"*",
"kwargs",
")",
":",
"# Add the default category pattern if not passed into the class.",
"if",
"not",
"any",
"(",
"key",
".",
"startswith",
"(",
"'cat_'",
")",
"for",
... | [
15,
4
] | [
27,
50
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader._resolve | (self, fileids, categories) |
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. This primarily bubbles up to
the high level ``docs`` method, but is implemented here similar to
the nltk ``CategorizedPlaintextCorpusReader``.
|
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. This primarily bubbles up to
the high level ``docs`` method, but is implemented here similar to
the nltk ``CategorizedPlaintextCorpusReader``.
| def _resolve(self, fileids, categories):
"""
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. This primarily bubbles up to
the high level ``docs`` method, but is implemented here similar to
the nltk ``CategorizedPlaintex... | [
"def",
"_resolve",
"(",
"self",
",",
"fileids",
",",
"categories",
")",
":",
"if",
"fileids",
"is",
"not",
"None",
"and",
"categories",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"Specify fileids or categories, not both\"",
")",
"if",
"categories",
... | [
29,
4
] | [
41,
22
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader.docs | (self, fileids=None, categories=None) |
Returns the document loaded from a pickled object for every file in
the corpus. Similar to the BaleenCorpusReader, this uses a generator
to acheive memory safe iteration.
|
Returns the document loaded from a pickled object for every file in
the corpus. Similar to the BaleenCorpusReader, this uses a generator
to acheive memory safe iteration.
| def docs(self, fileids=None, categories=None):
"""
Returns the document loaded from a pickled object for every file in
the corpus. Similar to the BaleenCorpusReader, this uses a generator
to acheive memory safe iteration.
"""
# Resolve the fileids and the categories
... | [
"def",
"docs",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"# Resolve the fileids and the categories",
"fileids",
"=",
"self",
".",
"_resolve",
"(",
"fileids",
",",
"categories",
")",
"# Create a generator, loading one documen... | [
43,
4
] | [
55,
36
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader.paras | (self, fileids=None, categories=None) |
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
|
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
| def paras(self, fileids=None, categories=None):
"""
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
"""
for doc in self.docs(fileids, categories):
for paragraph in doc:
yiel... | [
"def",
"paras",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"doc",
"in",
"self",
".",
"docs",
"(",
"fileids",
",",
"categories",
")",
":",
"for",
"paragraph",
"in",
"doc",
":",
"yield",
"paragraph"
] | [
57,
4
] | [
64,
31
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader.sents | (self, fileids=None, categories=None) |
Returns a generator of sentences where each sentence is a list of
(token, tag) tuples.
|
Returns a generator of sentences where each sentence is a list of
(token, tag) tuples.
| def sents(self, fileids=None, categories=None):
"""
Returns a generator of sentences where each sentence is a list of
(token, tag) tuples.
"""
for paragraph in self.paras(fileids, categories):
for sentence in paragraph:
yield sentence | [
"def",
"sents",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"paragraph",
"in",
"self",
".",
"paras",
"(",
"fileids",
",",
"categories",
")",
":",
"for",
"sentence",
"in",
"paragraph",
":",
"yield",
"senten... | [
66,
4
] | [
73,
30
] | python | en | ['en', 'error', 'th'] | False |
PickledCorpusReader.words | (self, fileids=None, categories=None) |
Returns a generator of (token, tag) tuples.
|
Returns a generator of (token, tag) tuples.
| def words(self, fileids=None, categories=None):
"""
Returns a generator of (token, tag) tuples.
"""
for sentence in self.sents(fileids, categories):
for token in sentence:
yield token | [
"def",
"words",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"sentence",
"in",
"self",
".",
"sents",
"(",
"fileids",
",",
"categories",
")",
":",
"for",
"token",
"in",
"sentence",
":",
"yield",
"token"
] | [
75,
4
] | [
81,
27
] | python | en | ['en', 'error', 'th'] | False |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Xiaomi Gateway Alarm from a config entry. | Set up the Xiaomi Gateway Alarm from a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Xiaomi Gateway Alarm from a config entry."""
entities = []
gateway = hass.data[DOMAIN][config_entry.entry_id]
entity = XiaomiGatewayAlarm(
gateway,
f"{config_entry.title} Alarm",
config_entry.data[... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"entities",
"=",
"[",
"]",
"gateway",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"entity",
"=",
"Xiaom... | [
26,
0
] | [
38,
56
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGatewayAlarm.__init__ | (
self, gateway_device, gateway_name, model, mac_address, gateway_device_id
) | Initialize the entity. | Initialize the entity. | def __init__(
self, gateway_device, gateway_name, model, mac_address, gateway_device_id
):
"""Initialize the entity."""
self._gateway = gateway_device
self._name = gateway_name
self._gateway_device_id = gateway_device_id
self._unique_id = f"{model}-{mac_address}"
... | [
"def",
"__init__",
"(",
"self",
",",
"gateway_device",
",",
"gateway_name",
",",
"model",
",",
"mac_address",
",",
"gateway_device_id",
")",
":",
"self",
".",
"_gateway",
"=",
"gateway_device",
"self",
".",
"_name",
"=",
"gateway_name",
"self",
".",
"_gateway_... | [
44,
4
] | [
54,
26
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGatewayAlarm.unique_id | (self) | Return an unique ID. | Return an unique ID. | def unique_id(self):
"""Return an unique ID."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
57,
4
] | [
59,
30
] | python | fr | ['fr', 'fr', 'en'] | True |
XiaomiGatewayAlarm.device_id | (self) | Return the device id of the gateway. | Return the device id of the gateway. | def device_id(self):
"""Return the device id of the gateway."""
return self._gateway_device_id | [
"def",
"device_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_gateway_device_id"
] | [
62,
4
] | [
64,
38
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGatewayAlarm.device_info | (self) | Return the device info of the gateway. | Return the device info of the gateway. | def device_info(self):
"""Return the device info of the gateway."""
return {
"identifiers": {(DOMAIN, self._gateway_device_id)},
} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_gateway_device_id",
")",
"}",
",",
"}"
] | [
67,
4
] | [
71,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGatewayAlarm.name | (self) | Return the name of this entity, if any. | Return the name of this entity, if any. | def name(self):
"""Return the name of this entity, if any."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
74,
4
] | [
76,
25
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGatewayAlarm.icon | (self) | Return the icon to use for device if any. | Return the icon to use for device if any. | def icon(self):
"""Return the icon to use for device if any."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
79,
4
] | [
81,
25
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGatewayAlarm.available | (self) | Return true when state is known. | Return true when state is known. | def available(self):
"""Return true when state is known."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
84,
4
] | [
86,
30
] | python | en | ['en', 'de', 'en'] | True |
XiaomiGatewayAlarm.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"
] | [
89,
4
] | [
91,
26
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGatewayAlarm.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 SUPPORT_ALARM_ARM_AWAY | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"SUPPORT_ALARM_ARM_AWAY"
] | [
94,
4
] | [
96,
37
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGatewayAlarm._try_command | (self, mask_error, func, *args, **kwargs) | Call a device command handling error messages. | Call a device command handling error messages. | async def _try_command(self, mask_error, func, *args, **kwargs):
"""Call a device command handling error messages."""
try:
result = await self.hass.async_add_executor_job(
partial(func, *args, **kwargs)
)
_LOGGER.debug("Response received from miio devi... | [
"async",
"def",
"_try_command",
"(",
"self",
",",
"mask_error",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"result",
"=",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"func",
",",
... | [
98,
4
] | [
106,
42
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGatewayAlarm.async_update | (self) | Fetch state from the device. | Fetch state from the device. | async def async_update(self):
"""Fetch state from the device."""
try:
state = await self.hass.async_add_executor_job(self._gateway.alarm.status)
except DeviceException as ex:
if self._available:
self._available = False
_LOGGER.error("Got ex... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"state",
"=",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_gateway",
".",
"alarm",
".",
"status",
")",
"except",
"DeviceException",
"as",
"ex",
":",
"i... | [
120,
4
] | [
151,
53
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Jewish calendar sensor platform. | Set up the Jewish calendar sensor platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Jewish calendar sensor platform."""
if discovery_info is None:
return
sensors = [
JewishCalendarSensor(hass.data[DOMAIN], sensor, sensor_info)
for sensor, sensor_info in SENSOR_TYPES... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"sensors",
"=",
"[",
"JewishCalendarSensor",
"(",
"hass",
".",
"da... | [
15,
0
] | [
29,
31
] | python | en | ['en', 'lv', 'en'] | True |
JewishCalendarSensor.__init__ | (self, data, sensor, sensor_info) | Initialize the Jewish calendar sensor. | Initialize the Jewish calendar sensor. | def __init__(self, data, sensor, sensor_info):
"""Initialize the Jewish calendar sensor."""
self._location = data["location"]
self._type = sensor
self._name = f"{data['name']} {sensor_info[0]}"
self._icon = sensor_info[1]
self._hebrew = data["language"] == "hebrew"
... | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"sensor",
",",
"sensor_info",
")",
":",
"self",
".",
"_location",
"=",
"data",
"[",
"\"location\"",
"]",
"self",
".",
"_type",
"=",
"sensor",
"self",
".",
"_name",
"=",
"f\"{data['name']} {sensor_info[0]}\"",... | [
35,
4
] | [
47,
32
] | python | en | ['en', 'ro', 'en'] | True |
JewishCalendarSensor.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"
] | [
50,
4
] | [
52,
25
] | python | en | ['en', 'mi', 'en'] | True |
JewishCalendarSensor.unique_id | (self) | Generate a unique id. | Generate a unique id. | def unique_id(self) -> str:
"""Generate a unique id."""
return f"{self._prefix}_{self._type}" | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{self._prefix}_{self._type}\""
] | [
55,
4
] | [
57,
45
] | python | co | ['fr', 'co', 'it'] | False |
JewishCalendarSensor.icon | (self) | Icon to display in the front end. | Icon to display in the front end. | def icon(self):
"""Icon to display in the front end."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
60,
4
] | [
62,
25
] | python | en | ['en', 'en', 'en'] | True |
JewishCalendarSensor.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"
] | [
65,
4
] | [
67,
26
] | python | en | ['en', 'en', 'en'] | True |
JewishCalendarSensor.async_update | (self) | Update the state of the sensor. | Update the state of the sensor. | async def async_update(self):
"""Update the state of the sensor."""
now = dt_util.now()
_LOGGER.debug("Now: %s Location: %r", now, self._location)
today = now.date()
sunset = dt_util.as_local(
get_astral_event_date(self.hass, SUN_EVENT_SUNSET, today)
)
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"now",
"=",
"dt_util",
".",
"now",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Now: %s Location: %r\"",
",",
"now",
",",
"self",
".",
"_location",
")",
"today",
"=",
"now",
".",
"date",
"(",
")",
... | [
69,
4
] | [
100,
70
] | python | en | ['en', 'en', 'en'] | True |
JewishCalendarSensor.make_zmanim | (self, date) | Create a Zmanim object. | Create a Zmanim object. | def make_zmanim(self, date):
"""Create a Zmanim object."""
return hdate.Zmanim(
date=date,
location=self._location,
candle_lighting_offset=self._candle_lighting_offset,
havdalah_offset=self._havdalah_offset,
hebrew=self._hebrew,
) | [
"def",
"make_zmanim",
"(",
"self",
",",
"date",
")",
":",
"return",
"hdate",
".",
"Zmanim",
"(",
"date",
"=",
"date",
",",
"location",
"=",
"self",
".",
"_location",
",",
"candle_lighting_offset",
"=",
"self",
".",
"_candle_lighting_offset",
",",
"havdalah_o... | [
102,
4
] | [
110,
9
] | python | en | ['en', 'ro', 'en'] | True |
JewishCalendarSensor.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
if self._type != "holiday":
return {}
return self._holiday_attrs | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_type",
"!=",
"\"holiday\"",
":",
"return",
"{",
"}",
"return",
"self",
".",
"_holiday_attrs"
] | [
113,
4
] | [
117,
34
] | python | en | ['en', 'en', 'en'] | True |
JewishCalendarSensor.get_state | (self, daytime_date, after_shkia_date, after_tzais_date) | For a given type of sensor, return the state. | For a given type of sensor, return the state. | def get_state(self, daytime_date, after_shkia_date, after_tzais_date):
"""For a given type of sensor, return the state."""
# Terminology note: by convention in py-libhdate library, "upcoming"
# refers to "current" or "upcoming" dates.
if self._type == "date":
return after_shk... | [
"def",
"get_state",
"(",
"self",
",",
"daytime_date",
",",
"after_shkia_date",
",",
"after_tzais_date",
")",
":",
"# Terminology note: by convention in py-libhdate library, \"upcoming\"",
"# refers to \"current\" or \"upcoming\" dates.",
"if",
"self",
".",
"_type",
"==",
"\"dat... | [
119,
4
] | [
138,
19
] | python | en | ['en', 'en', 'en'] | True |
JewishCalendarTimeSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return dt_util.as_utc(self._state) if self._state is not None else None | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"dt_util",
".",
"as_utc",
"(",
"self",
".",
"_state",
")",
"if",
"self",
".",
"_state",
"is",
"not",
"None",
"else",
"None"
] | [
145,
4
] | [
147,
79
] | python | en | ['en', 'en', 'en'] | True |
JewishCalendarTimeSensor.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_TIMESTAMP | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_TIMESTAMP"
] | [
150,
4
] | [
152,
37
] | python | en | ['en', 'en', 'en'] | True |
JewishCalendarTimeSensor.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
attrs = {}
if self._state is None:
return attrs
return attrs | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"attrs",
"=",
"{",
"}",
"if",
"self",
".",
"_state",
"is",
"None",
":",
"return",
"attrs",
"return",
"attrs"
] | [
155,
4
] | [
162,
20
] | python | en | ['en', 'en', 'en'] | True |
JewishCalendarTimeSensor.get_state | (self, daytime_date, after_shkia_date, after_tzais_date) | For a given type of sensor, return the state. | For a given type of sensor, return the state. | def get_state(self, daytime_date, after_shkia_date, after_tzais_date):
"""For a given type of sensor, return the state."""
if self._type == "upcoming_shabbat_candle_lighting":
times = self.make_zmanim(
after_tzais_date.upcoming_shabbat.previous_day.gdate
)
... | [
"def",
"get_state",
"(",
"self",
",",
"daytime_date",
",",
"after_shkia_date",
",",
"after_tzais_date",
")",
":",
"if",
"self",
".",
"_type",
"==",
"\"upcoming_shabbat_candle_lighting\"",
":",
"times",
"=",
"self",
".",
"make_zmanim",
"(",
"after_tzais_date",
".",... | [
164,
4
] | [
186,
32
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up Z-Wave Cover from Config Entry. | Set up Z-Wave Cover from Config Entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Z-Wave Cover from Config Entry."""
@callback
def async_add_cover(cover):
"""Add Z-Wave Cover."""
async_add_entities([cover])
async_dispatcher_connect(hass, "zwave_new_cover", async_add_cover) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"@",
"callback",
"def",
"async_add_cover",
"(",
"cover",
")",
":",
"\"\"\"Add Z-Wave Cover.\"\"\"",
"async_add_entities",
"(",
"[",
"cover",
"]",
")",
"asyn... | [
31,
0
] | [
39,
70
] | python | en | ['en', 'en', 'en'] | True |
get_device | (hass, values, node_config, **kwargs) | Create Z-Wave entity device. | Create Z-Wave entity device. | def get_device(hass, values, node_config, **kwargs):
"""Create Z-Wave entity device."""
invert_buttons = node_config.get(CONF_INVERT_OPENCLOSE_BUTTONS)
invert_percent = node_config.get(CONF_INVERT_PERCENT)
if (
values.primary.command_class == COMMAND_CLASS_SWITCH_MULTILEVEL
and values.pr... | [
"def",
"get_device",
"(",
"hass",
",",
"values",
",",
"node_config",
",",
"*",
"*",
"kwargs",
")",
":",
"invert_buttons",
"=",
"node_config",
".",
"get",
"(",
"CONF_INVERT_OPENCLOSE_BUTTONS",
")",
"invert_percent",
"=",
"node_config",
".",
"get",
"(",
"CONF_IN... | [
42,
0
] | [
55,
15
] | python | en | ['en', 'pl', 'en'] | True |
ZwaveRollershutter.__init__ | (self, hass, values, invert_buttons, invert_percent) | Initialize the Z-Wave rollershutter. | Initialize the Z-Wave rollershutter. | def __init__(self, hass, values, invert_buttons, invert_percent):
"""Initialize the Z-Wave rollershutter."""
ZWaveDeviceEntity.__init__(self, values, DOMAIN)
self._network = hass.data[DATA_NETWORK]
self._open_id = None
self._close_id = None
self._current_position = None
... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"values",
",",
"invert_buttons",
",",
"invert_percent",
")",
":",
"ZWaveDeviceEntity",
".",
"__init__",
"(",
"self",
",",
"values",
",",
"DOMAIN",
")",
"self",
".",
"_network",
"=",
"hass",
".",
"data",
"... | [
61,
4
] | [
74,
32
] | python | en | ['en', 'en', 'en'] | True |
ZwaveRollershutter.update_properties | (self) | Handle data changes for node values. | Handle data changes for node values. | def update_properties(self):
"""Handle data changes for node values."""
# Position value
self._current_position = self.values.primary.data
if (
self.values.open
and self.values.close
and self._open_id is None
and self._close_id is None
... | [
"def",
"update_properties",
"(",
"self",
")",
":",
"# Position value",
"self",
".",
"_current_position",
"=",
"self",
".",
"values",
".",
"primary",
".",
"data",
"if",
"(",
"self",
".",
"values",
".",
"open",
"and",
"self",
".",
"values",
".",
"close",
"... | [
76,
4
] | [
92,
59
] | python | en | ['fr', 'en', 'en'] | True |
ZwaveRollershutter.is_closed | (self) | Return if the cover is closed. | Return if the cover is closed. | def is_closed(self):
"""Return if the cover is closed."""
if self.current_cover_position is None:
return None
if self.current_cover_position > 0:
return False
return True | [
"def",
"is_closed",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_cover_position",
"is",
"None",
":",
"return",
"None",
"if",
"self",
".",
"current_cover_position",
">",
"0",
":",
"return",
"False",
"return",
"True"
] | [
95,
4
] | [
101,
19
] | python | en | ['en', 'en', 'en'] | True |
ZwaveRollershutter.current_cover_position | (self) | Return the current position of Zwave roller shutter. | Return the current position of Zwave roller shutter. | def current_cover_position(self):
"""Return the current position of Zwave roller shutter."""
if self._workaround == workaround.WORKAROUND_NO_POSITION:
return None
if self._current_position is not None:
if self._current_position <= 5:
return 100 if self._i... | [
"def",
"current_cover_position",
"(",
"self",
")",
":",
"if",
"self",
".",
"_workaround",
"==",
"workaround",
".",
"WORKAROUND_NO_POSITION",
":",
"return",
"None",
"if",
"self",
".",
"_current_position",
"is",
"not",
"None",
":",
"if",
"self",
".",
"_current_p... | [
104,
4
] | [
118,
13
] | python | en | ['en', 'da', 'en'] | True |
ZwaveRollershutter.open_cover | (self, **kwargs) | Move the roller shutter up. | Move the roller shutter up. | def open_cover(self, **kwargs):
"""Move the roller shutter up."""
self._network.manager.pressButton(self._open_id) | [
"def",
"open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_network",
".",
"manager",
".",
"pressButton",
"(",
"self",
".",
"_open_id",
")"
] | [
120,
4
] | [
122,
56
] | python | en | ['en', 'en', 'en'] | True |
ZwaveRollershutter.close_cover | (self, **kwargs) | Move the roller shutter down. | Move the roller shutter down. | def close_cover(self, **kwargs):
"""Move the roller shutter down."""
self._network.manager.pressButton(self._close_id) | [
"def",
"close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_network",
".",
"manager",
".",
"pressButton",
"(",
"self",
".",
"_close_id",
")"
] | [
124,
4
] | [
126,
57
] | python | en | ['en', 'en', 'en'] | True |
ZwaveRollershutter.set_cover_position | (self, **kwargs) | Move the roller shutter to a specific position. | Move the roller shutter to a specific position. | def set_cover_position(self, **kwargs):
"""Move the roller shutter to a specific position."""
self.node.set_dimmer(
self.values.primary.value_id,
(100 - kwargs.get(ATTR_POSITION))
if self._invert_percent
else kwargs.get(ATTR_POSITION),
) | [
"def",
"set_cover_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"node",
".",
"set_dimmer",
"(",
"self",
".",
"values",
".",
"primary",
".",
"value_id",
",",
"(",
"100",
"-",
"kwargs",
".",
"get",
"(",
"ATTR_POSITION",
")",
"... | [
128,
4
] | [
135,
9
] | python | en | ['en', 'en', 'en'] | True |
ZwaveRollershutter.stop_cover | (self, **kwargs) | Stop the roller shutter. | Stop the roller shutter. | def stop_cover(self, **kwargs):
"""Stop the roller shutter."""
self._network.manager.releaseButton(self._open_id) | [
"def",
"stop_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_network",
".",
"manager",
".",
"releaseButton",
"(",
"self",
".",
"_open_id",
")"
] | [
137,
4
] | [
139,
58
] | python | en | ['en', 'no', 'en'] | True |
ZwaveGarageDoorBase.__init__ | (self, values) | Initialize the zwave garage door. | Initialize the zwave garage door. | def __init__(self, values):
"""Initialize the zwave garage door."""
ZWaveDeviceEntity.__init__(self, values, DOMAIN)
self._state = None
self.update_properties() | [
"def",
"__init__",
"(",
"self",
",",
"values",
")",
":",
"ZWaveDeviceEntity",
".",
"__init__",
"(",
"self",
",",
"values",
",",
"DOMAIN",
")",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"update_properties",
"(",
")"
] | [
145,
4
] | [
149,
32
] | python | en | ['en', 'nl', 'en'] | True |
ZwaveGarageDoorBase.update_properties | (self) | Handle data changes for node values. | Handle data changes for node values. | def update_properties(self):
"""Handle data changes for node values."""
self._state = self.values.primary.data
_LOGGER.debug("self._state=%s", self._state) | [
"def",
"update_properties",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"self",
".",
"values",
".",
"primary",
".",
"data",
"_LOGGER",
".",
"debug",
"(",
"\"self._state=%s\"",
",",
"self",
".",
"_state",
")"
] | [
151,
4
] | [
154,
52
] | python | en | ['fr', 'en', 'en'] | True |
ZwaveGarageDoorBase.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return "garage" | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"\"garage\""
] | [
157,
4
] | [
159,
23
] | python | en | ['en', 'en', 'en'] | True |
ZwaveGarageDoorBase.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_GARAGE | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_GARAGE"
] | [
162,
4
] | [
164,
29
] | python | en | ['da', 'en', 'en'] | True |
ZwaveGarageDoorSwitch.is_closed | (self) | Return the current position of Zwave garage door. | Return the current position of Zwave garage door. | def is_closed(self):
"""Return the current position of Zwave garage door."""
return not self._state | [
"def",
"is_closed",
"(",
"self",
")",
":",
"return",
"not",
"self",
".",
"_state"
] | [
171,
4
] | [
173,
30
] | python | en | ['en', 'nl', 'en'] | True |
ZwaveGarageDoorSwitch.close_cover | (self, **kwargs) | Close the garage door. | Close the garage door. | def close_cover(self, **kwargs):
"""Close the garage door."""
self.values.primary.data = False | [
"def",
"close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"values",
".",
"primary",
".",
"data",
"=",
"False"
] | [
175,
4
] | [
177,
40
] | python | en | ['en', 'nl', 'en'] | True |
ZwaveGarageDoorSwitch.open_cover | (self, **kwargs) | Open the garage door. | Open the garage door. | def open_cover(self, **kwargs):
"""Open the garage door."""
self.values.primary.data = True | [
"def",
"open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"values",
".",
"primary",
".",
"data",
"=",
"True"
] | [
179,
4
] | [
181,
39
] | python | en | ['en', 'nl', 'en'] | True |
ZwaveGarageDoorBarrier.is_opening | (self) | Return true if cover is in an opening state. | Return true if cover is in an opening state. | def is_opening(self):
"""Return true if cover is in an opening state."""
return self._state == "Opening" | [
"def",
"is_opening",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"==",
"\"Opening\""
] | [
188,
4
] | [
190,
39
] | python | en | ['en', 'en', 'en'] | True |
ZwaveGarageDoorBarrier.is_closing | (self) | Return true if cover is in a closing state. | Return true if cover is in a closing state. | def is_closing(self):
"""Return true if cover is in a closing state."""
return self._state == "Closing" | [
"def",
"is_closing",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"==",
"\"Closing\""
] | [
193,
4
] | [
195,
39
] | python | en | ['en', 'en', 'en'] | True |
ZwaveGarageDoorBarrier.is_closed | (self) | Return the current position of Zwave garage door. | Return the current position of Zwave garage door. | def is_closed(self):
"""Return the current position of Zwave garage door."""
return self._state == "Closed" | [
"def",
"is_closed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"==",
"\"Closed\""
] | [
198,
4
] | [
200,
38
] | python | en | ['en', 'nl', 'en'] | True |
ZwaveGarageDoorBarrier.close_cover | (self, **kwargs) | Close the garage door. | Close the garage door. | def close_cover(self, **kwargs):
"""Close the garage door."""
self.values.primary.data = "Closed" | [
"def",
"close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"values",
".",
"primary",
".",
"data",
"=",
"\"Closed\""
] | [
202,
4
] | [
204,
43
] | python | en | ['en', 'nl', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.