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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
WinkThermostat.preset_mode | (self) | Return the current preset mode, e.g., home, away, temp. | Return the current preset mode, e.g., home, away, temp. | def preset_mode(self):
"""Return the current preset mode, e.g., home, away, temp."""
mode = self.wink.current_hvac_mode()
if mode == "eco":
return PRESET_ECO
if self.wink.away():
return PRESET_AWAY
return None | [
"def",
"preset_mode",
"(",
"self",
")",
":",
"mode",
"=",
"self",
".",
"wink",
".",
"current_hvac_mode",
"(",
")",
"if",
"mode",
"==",
"\"eco\"",
":",
"return",
"PRESET_ECO",
"if",
"self",
".",
"wink",
".",
"away",
"(",
")",
":",
"return",
"PRESET_AWAY... | [
161,
4
] | [
168,
19
] | python | en | ['en', 'pt', 'en'] | True |
WinkThermostat.preset_modes | (self) | Return a list of available preset modes. | Return a list of available preset modes. | def preset_modes(self):
"""Return a list of available preset modes."""
return SUPPORT_PRESET_THERMOSTAT | [
"def",
"preset_modes",
"(",
"self",
")",
":",
"return",
"SUPPORT_PRESET_THERMOSTAT"
] | [
171,
4
] | [
173,
40
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.target_humidity | (self) | Return the humidity we try to reach. | Return the humidity we try to reach. | def target_humidity(self):
"""Return the humidity we try to reach."""
target_hum = None
if self.wink.current_humidifier_mode() == "on":
if self.wink.current_humidifier_set_point() is not None:
target_hum = self.wink.current_humidifier_set_point() * 100
elif se... | [
"def",
"target_humidity",
"(",
"self",
")",
":",
"target_hum",
"=",
"None",
"if",
"self",
".",
"wink",
".",
"current_humidifier_mode",
"(",
")",
"==",
"\"on\"",
":",
"if",
"self",
".",
"wink",
".",
"current_humidifier_set_point",
"(",
")",
"is",
"not",
"No... | [
176,
4
] | [
187,
25
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.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."""
if self.hvac_mode != HVAC_MODE_AUTO and not self.wink.away():
if self.hvac_mode == HVAC_MODE_COOL:
return self.wink.current_max_set_point()
if self.hvac_mode == HVAC_MODE_HEAT:
... | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"if",
"self",
".",
"hvac_mode",
"!=",
"HVAC_MODE_AUTO",
"and",
"not",
"self",
".",
"wink",
".",
"away",
"(",
")",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_COOL",
":",
"return",
"self",
".",... | [
190,
4
] | [
197,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.target_temperature_low | (self) | Return the lower bound temperature we try to reach. | Return the lower bound temperature we try to reach. | def target_temperature_low(self):
"""Return the lower bound temperature we try to reach."""
if self.hvac_mode == HVAC_MODE_AUTO:
return self.wink.current_min_set_point()
return None | [
"def",
"target_temperature_low",
"(",
"self",
")",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_AUTO",
":",
"return",
"self",
".",
"wink",
".",
"current_min_set_point",
"(",
")",
"return",
"None"
] | [
200,
4
] | [
204,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.target_temperature_high | (self) | Return the higher bound temperature we try to reach. | Return the higher bound temperature we try to reach. | def target_temperature_high(self):
"""Return the higher bound temperature we try to reach."""
if self.hvac_mode == HVAC_MODE_AUTO:
return self.wink.current_max_set_point()
return None | [
"def",
"target_temperature_high",
"(",
"self",
")",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_AUTO",
":",
"return",
"self",
".",
"wink",
".",
"current_max_set_point",
"(",
")",
"return",
"None"
] | [
207,
4
] | [
211,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.is_aux_heat | (self) | Return true if aux heater. | Return true if aux heater. | def is_aux_heat(self):
"""Return true if aux heater."""
if "aux" not in self.wink.hvac_modes():
return None
if self.wink.current_hvac_mode() == "aux":
return True
return False | [
"def",
"is_aux_heat",
"(",
"self",
")",
":",
"if",
"\"aux\"",
"not",
"in",
"self",
".",
"wink",
".",
"hvac_modes",
"(",
")",
":",
"return",
"None",
"if",
"self",
".",
"wink",
".",
"current_hvac_mode",
"(",
")",
"==",
"\"aux\"",
":",
"return",
"True",
... | [
214,
4
] | [
220,
20
] | python | fr | ['fr', 'co', 'fr'] | True |
WinkThermostat.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 not self.wink.is_on():
return HVAC_MODE_OFF
wink_mode = self.wink.current_hvac_mode()
if wink_mode == "aux":
return HVAC_MODE_HEAT
... | [
"def",
"hvac_mode",
"(",
"self",
")",
"->",
"str",
":",
"if",
"not",
"self",
".",
"wink",
".",
"is_on",
"(",
")",
":",
"return",
"HVAC_MODE_OFF",
"wink_mode",
"=",
"self",
".",
"wink",
".",
"current_hvac_mode",
"(",
")",
"if",
"wink_mode",
"==",
"\"aux... | [
223,
4
] | [
236,
45
] | python | bg | ['en', 'bg', 'bg'] | True |
WinkThermostat.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.
"""
hvac_list = [HVAC_MODE_OFF]
modes = self.wink.hvac_modes()
for mode in modes:
if mode in ("eco", "aux"):
continue
t... | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"hvac_list",
"=",
"[",
"HVAC_MODE_OFF",
"]",
"modes",
"=",
"self",
".",
"wink",
".",
"hvac_modes",
"(",
")",
"for",
"mode",
"in",
"modes",
":",
"if",
"mode",
"in",
"(",
"\"eco\"",
",",
"\"aux\"",
")",
":",
... | [
239,
4
] | [
259,
24
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.hvac_action | (self) | Return the current running hvac operation if supported.
Need to be one of CURRENT_HVAC_*.
| Return the current running hvac operation if supported. | def hvac_action(self):
"""Return the current running hvac operation if supported.
Need to be one of CURRENT_HVAC_*.
"""
if not self.wink.is_on():
return CURRENT_HVAC_OFF
if self.wink.cool_on():
return CURRENT_HVAC_COOL
if self.wink.heat_on():
... | [
"def",
"hvac_action",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"wink",
".",
"is_on",
"(",
")",
":",
"return",
"CURRENT_HVAC_OFF",
"if",
"self",
".",
"wink",
".",
"cool_on",
"(",
")",
":",
"return",
"CURRENT_HVAC_COOL",
"if",
"self",
".",
"wink"... | [
262,
4
] | [
273,
32
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | def set_temperature(self, **kwargs):
"""Set new target temperature."""
target_temp = kwargs.get(ATTR_TEMPERATURE)
target_temp_low = kwargs.get(ATTR_TARGET_TEMP_LOW)
target_temp_high = kwargs.get(ATTR_TARGET_TEMP_HIGH)
if target_temp is not None:
if self.hvac_mode == H... | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"target_temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"target_temp_low",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TARGET_TEMP_LOW",
")",
"target_temp_high",
"=",
"kwargs",... | [
275,
4
] | [
285,
68
] | python | en | ['en', 'ca', 'en'] | True |
WinkThermostat.set_hvac_mode | (self, hvac_mode) | Set new target hvac mode. | Set new target hvac mode. | def set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
hvac_mode_to_set = HA_HVAC_TO_WINK.get(hvac_mode)
self.wink.set_operation_mode(hvac_mode_to_set) | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"hvac_mode_to_set",
"=",
"HA_HVAC_TO_WINK",
".",
"get",
"(",
"hvac_mode",
")",
"self",
".",
"wink",
".",
"set_operation_mode",
"(",
"hvac_mode_to_set",
")"
] | [
287,
4
] | [
290,
54
] | python | da | ['da', 'su', 'en'] | False |
WinkThermostat.set_preset_mode | (self, preset_mode) | Set new preset mode. | Set new preset mode. | def set_preset_mode(self, preset_mode):
"""Set new preset mode."""
# Away
if preset_mode != PRESET_AWAY and self.wink.away():
self.wink.set_away_mode(False)
elif preset_mode == PRESET_AWAY:
self.wink.set_away_mode()
if preset_mode == PRESET_ECO:
... | [
"def",
"set_preset_mode",
"(",
"self",
",",
"preset_mode",
")",
":",
"# Away",
"if",
"preset_mode",
"!=",
"PRESET_AWAY",
"and",
"self",
".",
"wink",
".",
"away",
"(",
")",
":",
"self",
".",
"wink",
".",
"set_away_mode",
"(",
"False",
")",
"elif",
"preset... | [
292,
4
] | [
301,
47
] | python | en | ['en', 'sr', 'en'] | True |
WinkThermostat.fan_mode | (self) | Return whether the fan is on. | Return whether the fan is on. | def fan_mode(self):
"""Return whether the fan is on."""
if self.wink.current_fan_mode() == "on":
return FAN_ON
if self.wink.current_fan_mode() == "auto":
return FAN_AUTO
# No Fan available so disable slider
return None | [
"def",
"fan_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"wink",
".",
"current_fan_mode",
"(",
")",
"==",
"\"on\"",
":",
"return",
"FAN_ON",
"if",
"self",
".",
"wink",
".",
"current_fan_mode",
"(",
")",
"==",
"\"auto\"",
":",
"return",
"FAN_AUTO",
... | [
304,
4
] | [
311,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.fan_modes | (self) | List of available fan modes. | List of available fan modes. | def fan_modes(self):
"""List of available fan modes."""
if self.wink.has_fan():
return SUPPORT_FAN_THERMOSTAT
return None | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"if",
"self",
".",
"wink",
".",
"has_fan",
"(",
")",
":",
"return",
"SUPPORT_FAN_THERMOSTAT",
"return",
"None"
] | [
314,
4
] | [
318,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.set_fan_mode | (self, fan_mode) | Turn fan on/off. | Turn fan on/off. | def set_fan_mode(self, fan_mode):
"""Turn fan on/off."""
self.wink.set_fan_mode(fan_mode.lower()) | [
"def",
"set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
":",
"self",
".",
"wink",
".",
"set_fan_mode",
"(",
"fan_mode",
".",
"lower",
"(",
")",
")"
] | [
320,
4
] | [
322,
48
] | python | en | ['en', 'fy', 'en'] | True |
WinkThermostat.turn_aux_heat_on | (self) | Turn auxiliary heater on. | Turn auxiliary heater on. | def turn_aux_heat_on(self):
"""Turn auxiliary heater on."""
self.wink.set_operation_mode("aux") | [
"def",
"turn_aux_heat_on",
"(",
"self",
")",
":",
"self",
".",
"wink",
".",
"set_operation_mode",
"(",
"\"aux\"",
")"
] | [
324,
4
] | [
326,
43
] | python | en | ['fr', 'fi', 'en'] | False |
WinkThermostat.turn_aux_heat_off | (self) | Turn auxiliary heater off. | Turn auxiliary heater off. | def turn_aux_heat_off(self):
"""Turn auxiliary heater off."""
self.wink.set_operation_mode("heat_only") | [
"def",
"turn_aux_heat_off",
"(",
"self",
")",
":",
"self",
".",
"wink",
".",
"set_operation_mode",
"(",
"\"heat_only\"",
")"
] | [
328,
4
] | [
330,
49
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
minimum = 7 # Default minimum
min_min = self.wink.min_min_set_point()
min_max = self.wink.min_max_set_point()
if self.hvac_mode == HVAC_MODE_HEAT:
if min_min:
return_value = min_min
... | [
"def",
"min_temp",
"(",
"self",
")",
":",
"minimum",
"=",
"7",
"# Default minimum",
"min_min",
"=",
"self",
".",
"wink",
".",
"min_min_set_point",
"(",
")",
"min_max",
"=",
"self",
".",
"wink",
".",
"min_max_set_point",
"(",
")",
"if",
"self",
".",
"hvac... | [
333,
4
] | [
355,
27
] | python | en | ['en', 'la', 'en'] | True |
WinkThermostat.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
maximum = 35 # Default maximum
max_min = self.wink.max_min_set_point()
max_max = self.wink.max_max_set_point()
if self.hvac_mode == HVAC_MODE_HEAT:
if max_min:
return_value = max_min
... | [
"def",
"max_temp",
"(",
"self",
")",
":",
"maximum",
"=",
"35",
"# Default maximum",
"max_min",
"=",
"self",
".",
"wink",
".",
"max_min_set_point",
"(",
")",
"max_max",
"=",
"self",
".",
"wink",
".",
"max_max_set_point",
"(",
")",
"if",
"self",
".",
"hva... | [
358,
4
] | [
380,
27
] | python | en | ['en', 'la', 'en'] | True |
WinkAC.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_AC | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_FLAGS_AC"
] | [
387,
4
] | [
389,
31
] | python | en | ['en', 'en', 'en'] | True |
WinkAC.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
# The Wink API always returns temp in Celsius
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"# The Wink API always returns temp in Celsius",
"return",
"TEMP_CELSIUS"
] | [
392,
4
] | [
395,
27
] | python | en | ['en', 'la', 'en'] | True |
WinkAC.device_state_attributes | (self) | Return the optional device state attributes. | Return the optional device state attributes. | def device_state_attributes(self):
"""Return the optional device state attributes."""
data = {}
data[ATTR_TOTAL_CONSUMPTION] = self.wink.total_consumption()
data[ATTR_SCHEDULE_ENABLED] = self.wink.schedule_enabled()
return data | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"data",
"=",
"{",
"}",
"data",
"[",
"ATTR_TOTAL_CONSUMPTION",
"]",
"=",
"self",
".",
"wink",
".",
"total_consumption",
"(",
")",
"data",
"[",
"ATTR_SCHEDULE_ENABLED",
"]",
"=",
"self",
".",
"wink",
"... | [
398,
4
] | [
404,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkAC.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self.wink.current_temperature() | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"current_temperature",
"(",
")"
] | [
407,
4
] | [
409,
46
] | python | en | ['en', 'la', 'en'] | True |
WinkAC.preset_mode | (self) | Return the current preset mode, e.g., home, away, temp. | Return the current preset mode, e.g., home, away, temp. | def preset_mode(self):
"""Return the current preset mode, e.g., home, away, temp."""
if not self.wink.is_on():
return PRESET_NONE
mode = self.wink.current_mode()
if mode == "auto_eco":
return PRESET_ECO
return PRESET_NONE | [
"def",
"preset_mode",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"wink",
".",
"is_on",
"(",
")",
":",
"return",
"PRESET_NONE",
"mode",
"=",
"self",
".",
"wink",
".",
"current_mode",
"(",
")",
"if",
"mode",
"==",
"\"auto_eco\"",
":",
"return",
"... | [
412,
4
] | [
420,
26
] | python | en | ['en', 'pt', 'en'] | True |
WinkAC.preset_modes | (self) | Return a list of available preset modes. | Return a list of available preset modes. | def preset_modes(self):
"""Return a list of available preset modes."""
return SUPPORT_PRESET_AC | [
"def",
"preset_modes",
"(",
"self",
")",
":",
"return",
"SUPPORT_PRESET_AC"
] | [
423,
4
] | [
425,
32
] | python | en | ['en', 'en', 'en'] | True |
WinkAC.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 not self.wink.is_on():
return HVAC_MODE_OFF
wink_mode = self.wink.current_mode()
if wink_mode == "auto_eco":
return HVAC_MODE_COOL
... | [
"def",
"hvac_mode",
"(",
"self",
")",
"->",
"str",
":",
"if",
"not",
"self",
".",
"wink",
".",
"is_on",
"(",
")",
":",
"return",
"HVAC_MODE_OFF",
"wink_mode",
"=",
"self",
".",
"wink",
".",
"current_mode",
"(",
")",
"if",
"wink_mode",
"==",
"\"auto_eco... | [
428,
4
] | [
439,
45
] | python | bg | ['en', 'bg', 'bg'] | True |
WinkAC.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.
"""
hvac_list = [HVAC_MODE_OFF]
modes = self.wink.modes()
for mode in modes:
if mode == "auto_eco":
continue
try:
... | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"hvac_list",
"=",
"[",
"HVAC_MODE_OFF",
"]",
"modes",
"=",
"self",
".",
"wink",
".",
"modes",
"(",
")",
"for",
"mode",
"in",
"modes",
":",
"if",
"mode",
"==",
"\"auto_eco\"",
":",
"continue",
"try",
":",
"h... | [
442,
4
] | [
462,
24
] | python | en | ['en', 'en', 'en'] | True |
WinkAC.set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | def set_temperature(self, **kwargs):
"""Set new target temperature."""
target_temp = kwargs.get(ATTR_TEMPERATURE)
self.wink.set_temperature(target_temp) | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"target_temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"self",
".",
"wink",
".",
"set_temperature",
"(",
"target_temp",
")"
] | [
464,
4
] | [
467,
46
] | python | en | ['en', 'ca', 'en'] | True |
WinkAC.set_hvac_mode | (self, hvac_mode) | Set new target hvac mode. | Set new target hvac mode. | def set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
hvac_mode_to_set = HA_HVAC_TO_WINK.get(hvac_mode)
self.wink.set_operation_mode(hvac_mode_to_set) | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"hvac_mode_to_set",
"=",
"HA_HVAC_TO_WINK",
".",
"get",
"(",
"hvac_mode",
")",
"self",
".",
"wink",
".",
"set_operation_mode",
"(",
"hvac_mode_to_set",
")"
] | [
469,
4
] | [
472,
54
] | python | da | ['da', 'su', 'en'] | False |
WinkAC.set_preset_mode | (self, preset_mode) | Set new preset mode. | Set new preset mode. | def set_preset_mode(self, preset_mode):
"""Set new preset mode."""
if preset_mode == PRESET_ECO:
self.wink.set_operation_mode("auto_eco")
elif self.hvac_mode == HVAC_MODE_COOL and preset_mode == PRESET_NONE:
self.set_hvac_mode(HVAC_MODE_COOL) | [
"def",
"set_preset_mode",
"(",
"self",
",",
"preset_mode",
")",
":",
"if",
"preset_mode",
"==",
"PRESET_ECO",
":",
"self",
".",
"wink",
".",
"set_operation_mode",
"(",
"\"auto_eco\"",
")",
"elif",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_COOL",
"and",
"prese... | [
474,
4
] | [
479,
46
] | python | en | ['en', 'sr', 'en'] | True |
WinkAC.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.wink.current_max_set_point() | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"current_max_set_point",
"(",
")"
] | [
482,
4
] | [
484,
48
] | python | en | ['en', 'en', 'en'] | True |
WinkAC.fan_mode | (self) |
Return the current fan mode.
The official Wink app only supports 3 modes [low, medium, high]
which are equal to [0.33, 0.66, 1.0] respectively.
|
Return the current fan mode. | def fan_mode(self):
"""
Return the current fan mode.
The official Wink app only supports 3 modes [low, medium, high]
which are equal to [0.33, 0.66, 1.0] respectively.
"""
speed = self.wink.current_fan_speed()
if speed <= 0.33:
return FAN_LOW
... | [
"def",
"fan_mode",
"(",
"self",
")",
":",
"speed",
"=",
"self",
".",
"wink",
".",
"current_fan_speed",
"(",
")",
"if",
"speed",
"<=",
"0.33",
":",
"return",
"FAN_LOW",
"if",
"speed",
"<=",
"0.66",
":",
"return",
"FAN_MEDIUM",
"return",
"FAN_HIGH"
] | [
487,
4
] | [
499,
23
] | python | en | ['en', 'error', 'th'] | False |
WinkAC.fan_modes | (self) | Return a list of available fan modes. | Return a list of available fan modes. | def fan_modes(self):
"""Return a list of available fan modes."""
return SUPPORT_FAN_AC | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"return",
"SUPPORT_FAN_AC"
] | [
502,
4
] | [
504,
29
] | python | en | ['en', 'en', 'en'] | True |
WinkAC.set_fan_mode | (self, fan_mode) |
Set fan speed.
The official Wink app only supports 3 modes [low, medium, high]
which are equal to [0.33, 0.66, 1.0] respectively.
|
Set fan speed. | def set_fan_mode(self, fan_mode):
"""
Set fan speed.
The official Wink app only supports 3 modes [low, medium, high]
which are equal to [0.33, 0.66, 1.0] respectively.
"""
if fan_mode == FAN_LOW:
speed = 0.33
elif fan_mode == FAN_MEDIUM:
s... | [
"def",
"set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
":",
"if",
"fan_mode",
"==",
"FAN_LOW",
":",
"speed",
"=",
"0.33",
"elif",
"fan_mode",
"==",
"FAN_MEDIUM",
":",
"speed",
"=",
"0.66",
"elif",
"fan_mode",
"==",
"FAN_HIGH",
":",
"speed",
"=",
"1.0"... | [
506,
4
] | [
519,
41
] | python | en | ['en', 'error', 'th'] | False |
_hashable | (params) |
Transform list params to tuple format. Ensure that an point is hashable by a python dict.
Parameters
----------
params : numpy array
array format of parameters
Returns
-------
tuple
tuple format of parameters
|
Transform list params to tuple format. Ensure that an point is hashable by a python dict. | def _hashable(params):
"""
Transform list params to tuple format. Ensure that an point is hashable by a python dict.
Parameters
----------
params : numpy array
array format of parameters
Returns
-------
tuple
tuple format of parameters
"""
return tuple(map(float... | [
"def",
"_hashable",
"(",
"params",
")",
":",
"return",
"tuple",
"(",
"map",
"(",
"float",
",",
"params",
")",
")"
] | [
11,
0
] | [
25,
36
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.__contains__ | (self, params) |
check if a parameter is already registered
Parameters
----------
params : numpy array
Returns
-------
bool
True if the parameter is already registered, else false
|
check if a parameter is already registered | def __contains__(self, params):
"""
check if a parameter is already registered
Parameters
----------
params : numpy array
Returns
-------
bool
True if the parameter is already registered, else false
"""
return _hashable(params... | [
"def",
"__contains__",
"(",
"self",
",",
"params",
")",
":",
"return",
"_hashable",
"(",
"params",
")",
"in",
"self",
".",
"_cache"
] | [
67,
4
] | [
80,
47
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.len | (self) |
length of registered params and targets
Returns
-------
int
|
length of registered params and targets | def len(self):
"""
length of registered params and targets
Returns
-------
int
"""
assert len(self._params) == len(self._target)
return len(self._target) | [
"def",
"len",
"(",
"self",
")",
":",
"assert",
"len",
"(",
"self",
".",
"_params",
")",
"==",
"len",
"(",
"self",
".",
"_target",
")",
"return",
"len",
"(",
"self",
".",
"_target",
")"
] | [
82,
4
] | [
91,
32
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.params | (self) |
registered parameters
Returns
-------
numpy array
|
registered parameters | def params(self):
"""
registered parameters
Returns
-------
numpy array
"""
return self._params | [
"def",
"params",
"(",
"self",
")",
":",
"return",
"self",
".",
"_params"
] | [
94,
4
] | [
102,
27
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.target | (self) |
registered target values
Returns
-------
numpy array
|
registered target values | def target(self):
"""
registered target values
Returns
-------
numpy array
"""
return self._target | [
"def",
"target",
"(",
"self",
")",
":",
"return",
"self",
".",
"_target"
] | [
105,
4
] | [
113,
27
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.dim | (self) |
dimension of parameters
Returns
-------
int
|
dimension of parameters | def dim(self):
"""
dimension of parameters
Returns
-------
int
"""
return len(self._keys) | [
"def",
"dim",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_keys",
")"
] | [
116,
4
] | [
124,
30
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.keys | (self) |
keys of parameters
Returns
-------
numpy array
|
keys of parameters | def keys(self):
"""
keys of parameters
Returns
-------
numpy array
"""
return self._keys | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"self",
".",
"_keys"
] | [
127,
4
] | [
135,
25
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.bounds | (self) |
bounds of parameters
Returns
-------
numpy array
|
bounds of parameters | def bounds(self):
"""
bounds of parameters
Returns
-------
numpy array
"""
return self._bounds | [
"def",
"bounds",
"(",
"self",
")",
":",
"return",
"self",
".",
"_bounds"
] | [
138,
4
] | [
146,
27
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.params_to_array | (self, params) |
dict to array
Parameters
----------
params : dict
dict format of parameters
Returns
-------
numpy array
array format of parameters
|
dict to array | def params_to_array(self, params):
"""
dict to array
Parameters
----------
params : dict
dict format of parameters
Returns
-------
numpy array
array format of parameters
"""
try:
assert set(params) == s... | [
"def",
"params_to_array",
"(",
"self",
",",
"params",
")",
":",
"try",
":",
"assert",
"set",
"(",
"params",
")",
"==",
"set",
"(",
"self",
".",
"keys",
")",
"except",
"AssertionError",
":",
"raise",
"ValueError",
"(",
"\"Parameters' keys ({}) do \"",
".",
... | [
148,
4
] | [
169,
61
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.array_to_params | (self, x) |
array to dict
maintain int type if the paramters is defined as int in search_space.json
Parameters
----------
x : numpy array
array format of parameters
Returns
-------
dict
dict format of parameters
|
array to dict | def array_to_params(self, x):
"""
array to dict
maintain int type if the paramters is defined as int in search_space.json
Parameters
----------
x : numpy array
array format of parameters
Returns
-------
dict
dict format of... | [
"def",
"array_to_params",
"(",
"self",
",",
"x",
")",
":",
"try",
":",
"assert",
"len",
"(",
"x",
")",
"==",
"len",
"(",
"self",
".",
"keys",
")",
"except",
"AssertionError",
":",
"raise",
"ValueError",
"(",
"\"Size of array ({}) is different than the \"",
"... | [
171,
4
] | [
203,
21
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.register | (self, params, target) |
Append a point and its target value to the known data.
Parameters
----------
params : dict
parameters
target : float
target function value
|
Append a point and its target value to the known data. | def register(self, params, target):
"""
Append a point and its target value to the known data.
Parameters
----------
params : dict
parameters
target : float
target function value
"""
x = self.params_to_array(params)
if x ... | [
"def",
"register",
"(",
"self",
",",
"params",
",",
"target",
")",
":",
"x",
"=",
"self",
".",
"params_to_array",
"(",
"params",
")",
"if",
"x",
"in",
"self",
":",
"print",
"(",
"'Data point {} is not unique'",
".",
"format",
"(",
"x",
")",
")",
"# Ins... | [
205,
4
] | [
226,
63
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.random_sample | (self) |
Creates a random point within the bounds of the space.
Returns
-------
numpy array
one groupe of parameter
|
Creates a random point within the bounds of the space. | def random_sample(self):
"""
Creates a random point within the bounds of the space.
Returns
-------
numpy array
one groupe of parameter
"""
params = np.empty(self.dim)
for col, _bound in enumerate(self._bounds):
if _bound['_type'] ... | [
"def",
"random_sample",
"(",
"self",
")",
":",
"params",
"=",
"np",
".",
"empty",
"(",
"self",
".",
"dim",
")",
"for",
"col",
",",
"_bound",
"in",
"enumerate",
"(",
"self",
".",
"_bounds",
")",
":",
"if",
"_bound",
"[",
"'_type'",
"]",
"==",
"'choi... | [
228,
4
] | [
258,
21
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.max | (self) |
Get maximum target value found and its corresponding parameters.
Returns
-------
dict
target value and parameters, empty dict if nothing registered
|
Get maximum target value found and its corresponding parameters. | def max(self):
"""
Get maximum target value found and its corresponding parameters.
Returns
-------
dict
target value and parameters, empty dict if nothing registered
"""
try:
res = {
'target': self.target.max(),
... | [
"def",
"max",
"(",
"self",
")",
":",
"try",
":",
"res",
"=",
"{",
"'target'",
":",
"self",
".",
"target",
".",
"max",
"(",
")",
",",
"'params'",
":",
"dict",
"(",
"zip",
"(",
"self",
".",
"keys",
",",
"self",
".",
"params",
"[",
"self",
".",
... | [
260,
4
] | [
278,
18
] | python | en | ['en', 'error', 'th'] | False |
TargetSpace.res | (self) |
Get all target values found and corresponding parameters.
Returns
-------
list
a list of target values and their corresponding parameters
|
Get all target values found and corresponding parameters. | def res(self):
"""
Get all target values found and corresponding parameters.
Returns
-------
list
a list of target values and their corresponding parameters
"""
params = [dict(zip(self.keys, p)) for p in self.params]
return [
{"ta... | [
"def",
"res",
"(",
"self",
")",
":",
"params",
"=",
"[",
"dict",
"(",
"zip",
"(",
"self",
".",
"keys",
",",
"p",
")",
")",
"for",
"p",
"in",
"self",
".",
"params",
"]",
"return",
"[",
"{",
"\"target\"",
":",
"target",
",",
"\"params\"",
":",
"p... | [
280,
4
] | [
294,
9
] | python | en | ['en', 'error', 'th'] | False |
test_temperature | (hass, hk_driver) | Test if accessory is updated after state change. | Test if accessory is updated after state change. | async def test_temperature(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = "sensor.temperature"
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = TemperatureSensor(hass, hk_driver, "Temperature", entity_id, 2, None)
await acc.ru... | [
"async",
"def",
"test_temperature",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"sensor.temperature\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"None",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"acc"... | [
35,
0
] | [
66,
36
] | python | en | ['en', 'en', 'en'] | True |
test_humidity | (hass, hk_driver) | Test if accessory is updated after state change. | Test if accessory is updated after state change. | async def test_humidity(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = "sensor.humidity"
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = HumiditySensor(hass, hk_driver, "Humidity", entity_id, 2, None)
await acc.run_handler()
... | [
"async",
"def",
"test_humidity",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"sensor.humidity\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"None",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"acc",
"=... | [
69,
0
] | [
90,
40
] | python | en | ['en', 'en', 'en'] | True |
test_air_quality | (hass, hk_driver) | Test if accessory is updated after state change. | Test if accessory is updated after state change. | async def test_air_quality(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = "sensor.air_quality"
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = AirQualitySensor(hass, hk_driver, "Air Quality", entity_id, 2, None)
await acc.run... | [
"async",
"def",
"test_air_quality",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"sensor.air_quality\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"None",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"acc"... | [
93,
0
] | [
122,
38
] | python | en | ['en', 'en', 'en'] | True |
test_co | (hass, hk_driver) | Test if accessory is updated after state change. | Test if accessory is updated after state change. | async def test_co(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = "sensor.co"
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = CarbonMonoxideSensor(hass, hk_driver, "CO", entity_id, 2, None)
await acc.run_handler()
await ha... | [
"async",
"def",
"test_co",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"sensor.co\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"None",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"acc",
"=",
"Carbon... | [
125,
0
] | [
162,
39
] | python | en | ['en', 'en', 'en'] | True |
test_co2 | (hass, hk_driver) | Test if accessory is updated after state change. | Test if accessory is updated after state change. | async def test_co2(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = "sensor.co2"
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = CarbonDioxideSensor(hass, hk_driver, "CO2", entity_id, 2, None)
await acc.run_handler()
await ... | [
"async",
"def",
"test_co2",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"sensor.co2\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"None",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"acc",
"=",
"Carb... | [
165,
0
] | [
202,
39
] | python | en | ['en', 'en', 'en'] | True |
test_light | (hass, hk_driver) | Test if accessory is updated after state change. | Test if accessory is updated after state change. | async def test_light(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = "sensor.light"
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = LightSensor(hass, hk_driver, "Light", entity_id, 2, None)
await acc.run_handler()
await ha... | [
"async",
"def",
"test_light",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"sensor.light\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"None",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"acc",
"=",
"... | [
205,
0
] | [
226,
38
] | python | en | ['en', 'en', 'en'] | True |
test_binary | (hass, hk_driver) | Test if accessory is updated after state change. | Test if accessory is updated after state change. | async def test_binary(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = "binary_sensor.opening"
hass.states.async_set(entity_id, STATE_UNKNOWN, {ATTR_DEVICE_CLASS: "opening"})
await hass.async_block_till_done()
acc = BinarySensor(hass, hk_driver, "Window Opening"... | [
"async",
"def",
"test_binary",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"binary_sensor.opening\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"STATE_UNKNOWN",
",",
"{",
"ATTR_DEVICE_CLASS",
":",
"\"opening\"",
"}",
")",
... | [
229,
0
] | [
263,
39
] | python | en | ['en', 'en', 'en'] | True |
test_motion_uses_bool | (hass, hk_driver) | Test if accessory is updated after state change. | Test if accessory is updated after state change. | async def test_motion_uses_bool(hass, hk_driver):
"""Test if accessory is updated after state change."""
entity_id = "binary_sensor.motion"
hass.states.async_set(
entity_id, STATE_UNKNOWN, {ATTR_DEVICE_CLASS: DEVICE_CLASS_MOTION}
)
await hass.async_block_till_done()
acc = BinarySensor(... | [
"async",
"def",
"test_motion_uses_bool",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"binary_sensor.motion\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"STATE_UNKNOWN",
",",
"{",
"ATTR_DEVICE_CLASS",
":",
"DEVICE_CLASS_MOTION"... | [
266,
0
] | [
308,
43
] | python | en | ['en', 'en', 'en'] | True |
test_binary_device_classes | (hass, hk_driver) | Test if services and characteristics are assigned correctly. | Test if services and characteristics are assigned correctly. | async def test_binary_device_classes(hass, hk_driver):
"""Test if services and characteristics are assigned correctly."""
entity_id = "binary_sensor.demo"
for device_class, (service, char, _) in BINARY_SENSOR_SERVICE_MAP.items():
hass.states.async_set(entity_id, STATE_OFF, {ATTR_DEVICE_CLASS: devic... | [
"async",
"def",
"test_binary_device_classes",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"binary_sensor.demo\"",
"for",
"device_class",
",",
"(",
"service",
",",
"char",
",",
"_",
")",
"in",
"BINARY_SENSOR_SERVICE_MAP",
".",
"items",
"(",
")",
... | [
311,
0
] | [
321,
53
] | python | en | ['en', 'en', 'en'] | True |
test_sensor_restore | (hass, hk_driver, events) | Test setting up an entity from state in the event registry. | Test setting up an entity from state in the event registry. | async def test_sensor_restore(hass, hk_driver, events):
"""Test setting up an entity from state in the event registry."""
hass.state = CoreState.not_running
registry = await entity_registry.async_get_registry(hass)
registry.async_get_or_create(
"sensor",
"generic",
"1234",
... | [
"async",
"def",
"test_sensor_restore",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"not_running",
"registry",
"=",
"await",
"entity_registry",
".",
"async_get_registry",
"(",
"hass",
")",
"registry",
"."... | [
324,
0
] | [
352,
29
] | python | en | ['en', 'en', 'en'] | True |
test_manually_configured_platform | (hass) | Test that we do not set up an access point. | Test that we do not set up an access point. | async def test_manually_configured_platform(hass):
"""Test that we do not set up an access point."""
assert await async_setup_component(
hass, COVER_DOMAIN, {COVER_DOMAIN: {"platform": HMIPC_DOMAIN}}
)
assert not hass.data.get(HMIPC_DOMAIN) | [
"async",
"def",
"test_manually_configured_platform",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"COVER_DOMAIN",
",",
"{",
"COVER_DOMAIN",
":",
"{",
"\"platform\"",
":",
"HMIPC_DOMAIN",
"}",
"}",
")",
"assert",
"not",
"ha... | [
15,
0
] | [
20,
42
] | python | en | ['en', 'en', 'en'] | True |
test_hmip_cover_shutter | (hass, default_mock_hap_factory) | Test HomematicipCoverShutte. | Test HomematicipCoverShutte. | async def test_hmip_cover_shutter(hass, default_mock_hap_factory):
"""Test HomematicipCoverShutte."""
entity_id = "cover.broll_1"
entity_name = "BROLL_1"
device_model = "HmIP-BROLL"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[entity_name]
)
ha_state, ... | [
"async",
"def",
"test_hmip_cover_shutter",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"cover.broll_1\"",
"entity_name",
"=",
"\"BROLL_1\"",
"device_model",
"=",
"\"HmIP-BROLL\"",
"mock_hap",
"=",
"await",
"default_mock_hap_factory",
".",
... | [
23,
0
] | [
85,
42
] | python | en | ['es', 'lb', 'en'] | False |
test_hmip_cover_slats | (hass, default_mock_hap_factory) | Test HomematicipCoverSlats. | Test HomematicipCoverSlats. | async def test_hmip_cover_slats(hass, default_mock_hap_factory):
"""Test HomematicipCoverSlats."""
entity_id = "cover.sofa_links"
entity_name = "Sofa links"
device_model = "HmIP-FBL"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[entity_name]
)
ha_state,... | [
"async",
"def",
"test_hmip_cover_slats",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"cover.sofa_links\"",
"entity_name",
"=",
"\"Sofa links\"",
"device_model",
"=",
"\"HmIP-FBL\"",
"mock_hap",
"=",
"await",
"default_mock_hap_factory",
".",... | [
88,
0
] | [
159,
42
] | python | bg | ['es', 'bg', 'en'] | False |
test_hmip_garage_door_tormatic | (hass, default_mock_hap_factory) | Test HomematicipCoverShutte. | Test HomematicipCoverShutte. | async def test_hmip_garage_door_tormatic(hass, default_mock_hap_factory):
"""Test HomematicipCoverShutte."""
entity_id = "cover.garage_door_module"
entity_name = "Garage Door Module"
device_model = "HmIP-MOD-TM"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[enti... | [
"async",
"def",
"test_hmip_garage_door_tormatic",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"cover.garage_door_module\"",
"entity_name",
"=",
"\"Garage Door Module\"",
"device_model",
"=",
"\"HmIP-MOD-TM\"",
"mock_hap",
"=",
"await",
"defau... | [
162,
0
] | [
206,
63
] | python | en | ['es', 'lb', 'en'] | False |
test_hmip_garage_door_hoermann | (hass, default_mock_hap_factory) | Test HomematicipCoverShutte. | Test HomematicipCoverShutte. | async def test_hmip_garage_door_hoermann(hass, default_mock_hap_factory):
"""Test HomematicipCoverShutte."""
entity_id = "cover.garage_door"
entity_name = "Garage door"
device_model = "HmIP-MOD-HO"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=[entity_name]
)... | [
"async",
"def",
"test_hmip_garage_door_hoermann",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"cover.garage_door\"",
"entity_name",
"=",
"\"Garage door\"",
"device_model",
"=",
"\"HmIP-MOD-HO\"",
"mock_hap",
"=",
"await",
"default_mock_hap_fa... | [
209,
0
] | [
253,
63
] | python | en | ['es', 'lb', 'en'] | False |
test_hmip_cover_shutter_group | (hass, default_mock_hap_factory) | Test HomematicipCoverShutteGroup. | Test HomematicipCoverShutteGroup. | async def test_hmip_cover_shutter_group(hass, default_mock_hap_factory):
"""Test HomematicipCoverShutteGroup."""
entity_id = "cover.rollos_shuttergroup"
entity_name = "Rollos ShutterGroup"
device_model = None
mock_hap = await default_mock_hap_factory.async_get_mock_hap(test_groups=["Rollos"])
h... | [
"async",
"def",
"test_hmip_cover_shutter_group",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"cover.rollos_shuttergroup\"",
"entity_name",
"=",
"\"Rollos ShutterGroup\"",
"device_model",
"=",
"None",
"mock_hap",
"=",
"await",
"default_mock_ha... | [
256,
0
] | [
316,
42
] | python | en | ['es', 'en', 'en'] | False |
test_hmip_cover_slats_group | (hass, default_mock_hap_factory) | Test slats with HomematicipCoverShutteGroup. | Test slats with HomematicipCoverShutteGroup. | async def test_hmip_cover_slats_group(hass, default_mock_hap_factory):
"""Test slats with HomematicipCoverShutteGroup."""
entity_id = "cover.rollos_shuttergroup"
entity_name = "Rollos ShutterGroup"
device_model = None
mock_hap = await default_mock_hap_factory.async_get_mock_hap(test_groups=["Rollos"... | [
"async",
"def",
"test_hmip_cover_slats_group",
"(",
"hass",
",",
"default_mock_hap_factory",
")",
":",
"entity_id",
"=",
"\"cover.rollos_shuttergroup\"",
"entity_name",
"=",
"\"Rollos ShutterGroup\"",
"device_model",
"=",
"None",
"mock_hap",
"=",
"await",
"default_mock_hap_... | [
319,
0
] | [
389,
46
] | python | en | ['en', 'en', 'en'] | True |
get_experiment_time | (port) | get the startTime and endTime of an experiment | get the startTime and endTime of an experiment | def get_experiment_time(port):
'''get the startTime and endTime of an experiment'''
response = rest_get(experiment_url(port), REST_TIME_OUT)
if response and check_response(response):
content = json.loads(response.text)
return content.get('startTime'), content.get('endTime')
return None, ... | [
"def",
"get_experiment_time",
"(",
"port",
")",
":",
"response",
"=",
"rest_get",
"(",
"experiment_url",
"(",
"port",
")",
",",
"REST_TIME_OUT",
")",
"if",
"response",
"and",
"check_response",
"(",
"response",
")",
":",
"content",
"=",
"json",
".",
"loads",
... | [
26,
0
] | [
32,
21
] | python | en | ['en', 'en', 'en'] | True |
get_experiment_status | (port) | get the status of an experiment | get the status of an experiment | def get_experiment_status(port):
'''get the status of an experiment'''
result, response = check_rest_server_quick(port)
if result:
return json.loads(response.text).get('status')
return None | [
"def",
"get_experiment_status",
"(",
"port",
")",
":",
"result",
",",
"response",
"=",
"check_rest_server_quick",
"(",
"port",
")",
"if",
"result",
":",
"return",
"json",
".",
"loads",
"(",
"response",
".",
"text",
")",
".",
"get",
"(",
"'status'",
")",
... | [
34,
0
] | [
39,
15
] | python | en | ['en', 'en', 'en'] | True |
update_experiment | () | Update the experiment status in config file | Update the experiment status in config file | def update_experiment():
'''Update the experiment status in config file'''
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
if not experiments_dict:
return None
for key in experiments_dict.keys():
if isinstance(experiments_dict[key], dict... | [
"def",
"update_experiment",
"(",
")",
":",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",
")",
"if",
"not",
"experiments_dict",
":",
"return",
"None",
"for",
"key",
"in",
"experim... | [
41,
0
] | [
53,
28
] | python | en | ['en', 'en', 'en'] | True |
check_experiment_id | (args, update=True) | check if the id is valid
| check if the id is valid
| def check_experiment_id(args, update=True):
'''check if the id is valid
'''
if update:
update_experiment()
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
if not experiments_dict:
print_normal('There is no experiment running...')
... | [
"def",
"check_experiment_id",
"(",
"args",
",",
"update",
"=",
"True",
")",
":",
"if",
"update",
":",
"update_experiment",
"(",
")",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",... | [
55,
0
] | [
96,
19
] | python | en | ['en', 'en', 'en'] | True |
parse_ids | (args) | Parse the arguments for nnictl stop
1.If port is provided and id is not specified, return the id who owns the port
2.If both port and id are provided, return the id if it owns the port, otherwise fail
3.If there is an id specified, return the corresponding id
4.If there is no id specified, and there is ... | Parse the arguments for nnictl stop
1.If port is provided and id is not specified, return the id who owns the port
2.If both port and id are provided, return the id if it owns the port, otherwise fail
3.If there is an id specified, return the corresponding id
4.If there is no id specified, and there is ... | def parse_ids(args):
'''Parse the arguments for nnictl stop
1.If port is provided and id is not specified, return the id who owns the port
2.If both port and id are provided, return the id if it owns the port, otherwise fail
3.If there is an id specified, return the corresponding id
4.If there is no... | [
"def",
"parse_ids",
"(",
"args",
")",
":",
"update_experiment",
"(",
")",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",
")",
"if",
"not",
"experiments_dict",
":",
"print_normal",
... | [
98,
0
] | [
166,
22
] | python | en | ['en', 'en', 'en'] | True |
get_config_filename | (args) | get the file name of config file | get the file name of config file | def get_config_filename(args):
'''get the file name of config file'''
experiment_id = check_experiment_id(args)
if experiment_id is None:
print_error('Please set correct experiment id.')
exit(1)
return experiment_id | [
"def",
"get_config_filename",
"(",
"args",
")",
":",
"experiment_id",
"=",
"check_experiment_id",
"(",
"args",
")",
"if",
"experiment_id",
"is",
"None",
":",
"print_error",
"(",
"'Please set correct experiment id.'",
")",
"exit",
"(",
"1",
")",
"return",
"experime... | [
168,
0
] | [
174,
24
] | python | en | ['en', 'en', 'en'] | True |
get_experiment_port | (args) | get the port of experiment | get the port of experiment | def get_experiment_port(args):
'''get the port of experiment'''
experiment_id = check_experiment_id(args)
if experiment_id is None:
print_error('Please set correct experiment id.')
exit(1)
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
... | [
"def",
"get_experiment_port",
"(",
"args",
")",
":",
"experiment_id",
"=",
"check_experiment_id",
"(",
"args",
")",
"if",
"experiment_id",
"is",
"None",
":",
"print_error",
"(",
"'Please set correct experiment id.'",
")",
"exit",
"(",
"1",
")",
"experiments_config",... | [
176,
0
] | [
184,
54
] | python | en | ['en', 'en', 'en'] | True |
convert_time_stamp_to_date | (content) | Convert time stamp to date time format | Convert time stamp to date time format | def convert_time_stamp_to_date(content):
'''Convert time stamp to date time format'''
start_time_stamp = content.get('startTime')
end_time_stamp = content.get('endTime')
if start_time_stamp:
start_time = datetime.fromtimestamp(start_time_stamp // 1000, timezone.utc).astimezone().strftime("%Y/%m/... | [
"def",
"convert_time_stamp_to_date",
"(",
"content",
")",
":",
"start_time_stamp",
"=",
"content",
".",
"get",
"(",
"'startTime'",
")",
"end_time_stamp",
"=",
"content",
".",
"get",
"(",
"'endTime'",
")",
"if",
"start_time_stamp",
":",
"start_time",
"=",
"dateti... | [
186,
0
] | [
196,
18
] | python | en | ['it', 'en', 'en'] | True |
check_rest | (args) | check if restful server is running | check if restful server is running | def check_rest(args):
'''check if restful server is running'''
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
rest_port = experiments_dict.get(get_config_filename(args)).get('port')
running, _ = check_rest_server_quick(rest_port)
if running:
... | [
"def",
"check_rest",
"(",
"args",
")",
":",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",
")",
"rest_port",
"=",
"experiments_dict",
".",
"get",
"(",
"get_config_filename",
"(",
... | [
198,
0
] | [
208,
18
] | python | en | ['en', 'en', 'en'] | True |
stop_experiment | (args) | Stop the experiment which is running | Stop the experiment which is running | def stop_experiment(args):
'''Stop the experiment which is running'''
if args.id and args.id == 'all':
print_warning('\'nnictl stop all\' is abolished, please use \'nnictl stop --all\' to stop all of experiments!')
exit(1)
experiment_id_list = parse_ids(args)
if experiment_id_list:
... | [
"def",
"stop_experiment",
"(",
"args",
")",
":",
"if",
"args",
".",
"id",
"and",
"args",
".",
"id",
"==",
"'all'",
":",
"print_warning",
"(",
"'\\'nnictl stop all\\' is abolished, please use \\'nnictl stop --all\\' to stop all of experiments!'",
")",
"exit",
"(",
"1",
... | [
210,
0
] | [
224,
52
] | python | en | ['en', 'en', 'en'] | True |
trial_codegen | (args) | Generate code for a specific trial | Generate code for a specific trial | def trial_codegen(args):
'''Generate code for a specific trial'''
print_warning('Currently, this command is only for nni nas programming interface.')
exp_id = get_config_filename(args)
experiment_config = Config(exp_id, Experiments().get_all_experiments()[exp_id]['logDir']).get_config()
if not exper... | [
"def",
"trial_codegen",
"(",
"args",
")",
":",
"print_warning",
"(",
"'Currently, this command is only for nni nas programming interface.'",
")",
"exp_id",
"=",
"get_config_filename",
"(",
"args",
")",
"experiment_config",
"=",
"Config",
"(",
"exp_id",
",",
"Experiments",... | [
295,
0
] | [
304,
105
] | python | en | ['en', 'en', 'en'] | True |
list_experiment | (args) | Get experiment information | Get experiment information | def list_experiment(args):
'''Get experiment information'''
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
experiment_id = get_config_filename(args)
rest_port = experiments_dict.get(experiment_id).get('port')
rest_pid = experiments_dict.get(experim... | [
"def",
"list_experiment",
"(",
"args",
")",
":",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",
")",
"experiment_id",
"=",
"get_config_filename",
"(",
"args",
")",
"rest_port",
"=",... | [
306,
0
] | [
327,
15
] | python | en | ['sq', 'en', 'en'] | True |
experiment_status | (args) | Show the status of experiment | Show the status of experiment | def experiment_status(args):
'''Show the status of experiment'''
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
rest_port = experiments_dict.get(get_config_filename(args)).get('port')
result, response = check_rest_server_quick(rest_port)
if not res... | [
"def",
"experiment_status",
"(",
"args",
")",
":",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",
")",
"rest_port",
"=",
"experiments_dict",
".",
"get",
"(",
"get_config_filename",
... | [
329,
0
] | [
339,
17
] | python | en | ['en', 'en', 'en'] | True |
log_internal | (args, filetype) | internal function to call get_log_content | internal function to call get_log_content | def log_internal(args, filetype):
'''internal function to call get_log_content'''
file_name = get_config_filename(args)
if filetype == 'stdout':
file_full_path = os.path.join(NNI_HOME_DIR, file_name, 'log', 'nnictl_stdout.log')
else:
file_full_path = os.path.join(NNI_HOME_DIR, file_name,... | [
"def",
"log_internal",
"(",
"args",
",",
"filetype",
")",
":",
"file_name",
"=",
"get_config_filename",
"(",
"args",
")",
"if",
"filetype",
"==",
"'stdout'",
":",
"file_full_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"NNI_HOME_DIR",
",",
"file_name",
... | [
341,
0
] | [
348,
79
] | python | en | ['en', 'en', 'en'] | True |
log_stdout | (args) | get stdout log | get stdout log | def log_stdout(args):
'''get stdout log'''
log_internal(args, 'stdout') | [
"def",
"log_stdout",
"(",
"args",
")",
":",
"log_internal",
"(",
"args",
",",
"'stdout'",
")"
] | [
350,
0
] | [
352,
32
] | python | en | ['en', 'lb', 'ur'] | False |
log_stderr | (args) | get stderr log | get stderr log | def log_stderr(args):
'''get stderr log'''
log_internal(args, 'stderr') | [
"def",
"log_stderr",
"(",
"args",
")",
":",
"log_internal",
"(",
"args",
",",
"'stderr'",
")"
] | [
354,
0
] | [
356,
32
] | python | be | ['fr', 'be', 'hi'] | False |
log_trial | (args) | get trial log path | get trial log path | def log_trial(args):
''''get trial log path'''
trial_id_path_dict = {}
trial_id_list = []
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
experiment_id = get_config_filename(args)
rest_port = experiments_dict.get(experiment_id).get('port')
r... | [
"def",
"log_trial",
"(",
"args",
")",
":",
"trial_id_path_dict",
"=",
"{",
"}",
"trial_id_list",
"=",
"[",
"]",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",
")",
"experiment_id"... | [
392,
0
] | [
439,
32
] | python | af | ['da', 'af', 'en'] | False |
get_config | (args) | get config info | get config info | def get_config(args):
'''get config info'''
experiment_id = get_config_filename(args)
experiment_config = Config(experiment_id, Experiments().get_all_experiments()[experiment_id]['logDir']).get_config()
print(json.dumps(experiment_config, indent=4)) | [
"def",
"get_config",
"(",
"args",
")",
":",
"experiment_id",
"=",
"get_config_filename",
"(",
"args",
")",
"experiment_config",
"=",
"Config",
"(",
"experiment_id",
",",
"Experiments",
"(",
")",
".",
"get_all_experiments",
"(",
")",
"[",
"experiment_id",
"]",
... | [
441,
0
] | [
445,
50
] | python | de | ['de', 'pt', 'en'] | False |
webui_url | (args) | show the url of web ui | show the url of web ui | def webui_url(args):
'''show the url of web ui'''
experiment_id = get_config_filename(args)
experiments_dict = Experiments().get_all_experiments()
print_normal('{0} {1}'.format('Web UI url:', ' '.join(experiments_dict[experiment_id].get('webuiUrl')))) | [
"def",
"webui_url",
"(",
"args",
")",
":",
"experiment_id",
"=",
"get_config_filename",
"(",
"args",
")",
"experiments_dict",
"=",
"Experiments",
"(",
")",
".",
"get_all_experiments",
"(",
")",
"print_normal",
"(",
"'{0} {1}'",
".",
"format",
"(",
"'Web UI url:'... | [
447,
0
] | [
451,
108
] | python | en | ['en', 'pt', 'en'] | True |
webui_nas | (args) | launch nas ui | launch nas ui | def webui_nas(args):
'''launch nas ui'''
print_normal('Starting NAS UI...')
try:
entry_dir = nni_node.__path__[0]
entry_file = os.path.join(entry_dir, 'nasui', 'server.js')
if sys.platform == 'win32':
node_command = os.path.join(entry_dir, 'node.exe')
else:
... | [
"def",
"webui_nas",
"(",
"args",
")",
":",
"print_normal",
"(",
"'Starting NAS UI...'",
")",
"try",
":",
"entry_dir",
"=",
"nni_node",
".",
"__path__",
"[",
"0",
"]",
"entry_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"entry_dir",
",",
"'nasui'",
",... | [
453,
0
] | [
466,
12
] | python | lv | ['lv', 'zh-Latn', 'sw'] | False |
local_clean | (directory) | clean up local data | clean up local data | def local_clean(directory):
'''clean up local data'''
print_normal('removing folder {0}'.format(directory))
try:
shutil.rmtree(directory)
except FileNotFoundError:
print_error('{0} does not exist.'.format(directory)) | [
"def",
"local_clean",
"(",
"directory",
")",
":",
"print_normal",
"(",
"'removing folder {0}'",
".",
"format",
"(",
"directory",
")",
")",
"try",
":",
"shutil",
".",
"rmtree",
"(",
"directory",
")",
"except",
"FileNotFoundError",
":",
"print_error",
"(",
"'{0}... | [
468,
0
] | [
474,
60
] | python | en | ['en', 'en', 'en'] | True |
remote_clean | (machine_list, experiment_id=None) | clean up remote data | clean up remote data | def remote_clean(machine_list, experiment_id=None):
'''clean up remote data'''
for machine in machine_list:
passwd = machine.get('passwd')
userName = machine.get('username')
host = machine.get('ip')
port = machine.get('port')
sshKeyPath = machine.get('sshKeyPath')
... | [
"def",
"remote_clean",
"(",
"machine_list",
",",
"experiment_id",
"=",
"None",
")",
":",
"for",
"machine",
"in",
"machine_list",
":",
"passwd",
"=",
"machine",
".",
"get",
"(",
"'passwd'",
")",
"userName",
"=",
"machine",
".",
"get",
"(",
"'username'",
")"... | [
476,
0
] | [
491,
49
] | python | en | ['en', 'en', 'en'] | True |
experiment_clean | (args) | clean up the experiment data | clean up the experiment data | def experiment_clean(args):
'''clean up the experiment data'''
experiment_id_list = []
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
if args.all:
experiment_id_list = list(experiments_dict.keys())
else:
if args.id is None:
... | [
"def",
"experiment_clean",
"(",
"args",
")",
":",
"experiment_id_list",
"=",
"[",
"]",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",
")",
"if",
"args",
".",
"all",
":",
"experi... | [
493,
0
] | [
540,
29
] | python | en | ['en', 'en', 'en'] | True |
get_platform_dir | (config_content) | get the dir list to be deleted | get the dir list to be deleted | def get_platform_dir(config_content):
'''get the dir list to be deleted'''
platform = config_content.get('trainingServicePlatform')
dir_list = []
if platform == 'remote':
machine_list = config_content.get('machineList')
for machine in machine_list:
host = machine.get('ip')
... | [
"def",
"get_platform_dir",
"(",
"config_content",
")",
":",
"platform",
"=",
"config_content",
".",
"get",
"(",
"'trainingServicePlatform'",
")",
"dir_list",
"=",
"[",
"]",
"if",
"platform",
"==",
"'remote'",
":",
"machine_list",
"=",
"config_content",
".",
"get... | [
542,
0
] | [
559,
19
] | python | en | ['en', 'en', 'en'] | True |
platform_clean | (args) | clean up the experiment data | clean up the experiment data | def platform_clean(args):
'''clean up the experiment data'''
config_path = os.path.abspath(args.config)
if not os.path.exists(config_path):
print_error('Please set correct config path.')
exit(1)
config_content = get_yml_content(config_path)
platform = config_content.get('trainingServ... | [
"def",
"platform_clean",
"(",
"args",
")",
":",
"config_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"args",
".",
"config",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"config_path",
")",
":",
"print_error",
"(",
"'Please set correct ... | [
561,
0
] | [
595,
25
] | python | en | ['en', 'en', 'en'] | True |
experiment_list | (args) | get the information of all experiments | get the information of all experiments | def experiment_list(args):
'''get the information of all experiments'''
update_experiment()
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
if not experiments_dict:
print_normal('Cannot find experiments.')
exit(1)
experiment_id_list ... | [
"def",
"experiment_list",
"(",
"args",
")",
":",
"update_experiment",
"(",
")",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",
")",
"if",
"not",
"experiments_dict",
":",
"print_norm... | [
597,
0
] | [
625,
29
] | python | en | ['en', 'en', 'en'] | True |
get_time_interval | (time1, time2) | get the interval of two times | get the interval of two times | def get_time_interval(time1, time2):
'''get the interval of two times'''
try:
seconds = int((time2 - time1) / 1000)
#convert seconds to day:hour:minute:second
days = seconds / 86400
seconds %= 86400
hours = seconds / 3600
seconds %= 3600
minutes = seconds ... | [
"def",
"get_time_interval",
"(",
"time1",
",",
"time2",
")",
":",
"try",
":",
"seconds",
"=",
"int",
"(",
"(",
"time2",
"-",
"time1",
")",
"/",
"1000",
")",
"#convert seconds to day:hour:minute:second",
"days",
"=",
"seconds",
"/",
"86400",
"seconds",
"%=",
... | [
627,
0
] | [
640,
20
] | python | en | ['en', 'en', 'en'] | True |
show_experiment_info | () | show experiment information in monitor | show experiment information in monitor | def show_experiment_info():
'''show experiment information in monitor'''
update_experiment()
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
if not experiments_dict:
print('There is no experiment running...')
exit(1)
experiment_id_li... | [
"def",
"show_experiment_info",
"(",
")",
":",
"update_experiment",
"(",
")",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",
")",
"if",
"not",
"experiments_dict",
":",
"print",
"(",
... | [
642,
0
] | [
671,
33
] | python | en | ['en', 'en', 'en'] | True |
set_monitor | (auto_exit, time_interval, port=None, pid=None) | set the experiment monitor engine | set the experiment monitor engine | def set_monitor(auto_exit, time_interval, port=None, pid=None):
'''set the experiment monitor engine'''
while True:
try:
if sys.platform == 'win32':
os.system('cls')
else:
os.system('clear')
update_experiment()
show_experime... | [
"def",
"set_monitor",
"(",
"auto_exit",
",",
"time_interval",
",",
"port",
"=",
"None",
",",
"pid",
"=",
"None",
")",
":",
"while",
"True",
":",
"try",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"os",
".",
"system",
"(",
"'cls'",
")",
... | [
673,
0
] | [
702,
19
] | python | en | ['en', 'en', 'en'] | True |
monitor_experiment | (args) | monitor the experiment | monitor the experiment | def monitor_experiment(args):
'''monitor the experiment'''
if args.time <= 0:
print_error('please input a positive integer as time interval, the unit is second.')
exit(1)
set_monitor(False, args.time) | [
"def",
"monitor_experiment",
"(",
"args",
")",
":",
"if",
"args",
".",
"time",
"<=",
"0",
":",
"print_error",
"(",
"'please input a positive integer as time interval, the unit is second.'",
")",
"exit",
"(",
"1",
")",
"set_monitor",
"(",
"False",
",",
"args",
".",... | [
704,
0
] | [
709,
33
] | python | en | ['en', 'en', 'en'] | True |
export_trials_data | (args) | export experiment metadata and intermediate results to json or csv
| export experiment metadata and intermediate results to json or csv
| def export_trials_data(args):
'''export experiment metadata and intermediate results to json or csv
'''
def groupby_trial_id(intermediate_results):
sorted(intermediate_results, key=lambda x: x['timestamp'])
groupby = dict()
for content in intermediate_results:
groupby.set... | [
"def",
"export_trials_data",
"(",
"args",
")",
":",
"def",
"groupby_trial_id",
"(",
"intermediate_results",
")",
":",
"sorted",
"(",
"intermediate_results",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"'timestamp'",
"]",
")",
"groupby",
"=",
"dict",
"(",
... | [
711,
0
] | [
771,
39
] | python | en | ['en', 'en', 'en'] | True |
search_space_auto_gen | (args) | dry run trial code to generate search space file | dry run trial code to generate search space file | def search_space_auto_gen(args):
'''dry run trial code to generate search space file'''
trial_dir = os.path.expanduser(args.trial_dir)
file_path = os.path.expanduser(args.file)
if not os.path.isabs(file_path):
file_path = os.path.join(os.getcwd(), file_path)
assert os.path.exists(trial_dir)
... | [
"def",
"search_space_auto_gen",
"(",
"args",
")",
":",
"trial_dir",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"args",
".",
"trial_dir",
")",
"file_path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"args",
".",
"file",
")",
"if",
"not",
"os",... | [
773,
0
] | [
787,
77
] | python | en | ['en', 'en', 'en'] | True |
save_experiment | (args) | save experiment data to a zip file | save experiment data to a zip file | def save_experiment(args):
'''save experiment data to a zip file'''
experiments_config = Experiments()
experiments_dict = experiments_config.get_all_experiments()
if args.id is None:
print_error('Please set experiment id.')
exit(1)
if args.id not in experiments_dict:
print_er... | [
"def",
"save_experiment",
"(",
"args",
")",
":",
"experiments_config",
"=",
"Experiments",
"(",
")",
"experiments_dict",
"=",
"experiments_config",
".",
"get_all_experiments",
"(",
")",
"if",
"args",
".",
"id",
"is",
"None",
":",
"print_error",
"(",
"'Please set... | [
789,
0
] | [
852,
32
] | python | en | ['en', 'en', 'en'] | True |
load_experiment | (args) | load experiment data | load experiment data | def load_experiment(args):
'''load experiment data'''
package_path = os.path.expanduser(args.path)
if not os.path.exists(args.path):
print_error('file path %s does not exist!' % args.path)
exit(1)
if args.searchSpacePath and os.path.isdir(args.searchSpacePath):
print_error('searc... | [
"def",
"load_experiment",
"(",
"args",
")",
":",
"package_path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"args",
".",
"path",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"args",
".",
"path",
")",
":",
"print_error",
"(",
"'file p... | [
854,
0
] | [
963,
32
] | python | ca | ['ca', 'ca', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.