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
GenericHygrostat._is_device_active
(self)
If the toggleable device is currently active.
If the toggleable device is currently active.
def _is_device_active(self): """If the toggleable device is currently active.""" return self.hass.states.is_state(self._switch_entity_id, STATE_ON)
[ "def", "_is_device_active", "(", "self", ")", ":", "return", "self", ".", "hass", ".", "states", ".", "is_state", "(", "self", ".", "_switch_entity_id", ",", "STATE_ON", ")" ]
[ 421, 4 ]
[ 423, 74 ]
python
en
['en', 'en', 'en']
True
GenericHygrostat.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 self._support_flags
[ "def", "supported_features", "(", "self", ")", ":", "return", "self", ".", "_support_flags" ]
[ 426, 4 ]
[ 428, 34 ]
python
en
['en', 'en', 'en']
True
GenericHygrostat._async_device_turn_on
(self)
Turn humidifier toggleable device on.
Turn humidifier toggleable device on.
async def _async_device_turn_on(self): """Turn humidifier toggleable device on.""" data = {ATTR_ENTITY_ID: self._switch_entity_id} await self.hass.services.async_call(HA_DOMAIN, SERVICE_TURN_ON, data)
[ "async", "def", "_async_device_turn_on", "(", "self", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "self", ".", "_switch_entity_id", "}", "await", "self", ".", "hass", ".", "services", ".", "async_call", "(", "HA_DOMAIN", ",", "SERVICE_TURN_ON", ",", "...
[ 430, 4 ]
[ 433, 77 ]
python
en
['fr', 'en', 'en']
True
GenericHygrostat._async_device_turn_off
(self)
Turn humidifier toggleable device off.
Turn humidifier toggleable device off.
async def _async_device_turn_off(self): """Turn humidifier toggleable device off.""" data = {ATTR_ENTITY_ID: self._switch_entity_id} await self.hass.services.async_call(HA_DOMAIN, SERVICE_TURN_OFF, data)
[ "async", "def", "_async_device_turn_off", "(", "self", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "self", ".", "_switch_entity_id", "}", "await", "self", ".", "hass", ".", "services", ".", "async_call", "(", "HA_DOMAIN", ",", "SERVICE_TURN_OFF", ",", ...
[ 435, 4 ]
[ 438, 78 ]
python
en
['fr', 'en', 'en']
True
GenericHygrostat.async_set_mode
(self, mode: str)
Set new mode. This method must be run in the event loop and returns a coroutine.
Set new mode.
async def async_set_mode(self, mode: str): """Set new mode. This method must be run in the event loop and returns a coroutine. """ if self._away_humidity is None: return if mode == MODE_AWAY and not self._is_away: self._is_away = True if not s...
[ "async", "def", "async_set_mode", "(", "self", ",", "mode", ":", "str", ")", ":", "if", "self", ".", "_away_humidity", "is", "None", ":", "return", "if", "mode", "==", "MODE_AWAY", "and", "not", "self", ".", "_is_away", ":", "self", ".", "_is_away", "=...
[ 440, 4 ]
[ 464, 42 ]
python
en
['en', 'yi', 'en']
True
interpret
(marker, execution_context=None)
Interpret a marker and return a result depending on environment. :param marker: The marker to interpret. :type marker: str :param execution_context: The context used for name lookup. :type execution_context: mapping
Interpret a marker and return a result depending on environment.
def interpret(marker, execution_context=None): """ Interpret a marker and return a result depending on environment. :param marker: The marker to interpret. :type marker: str :param execution_context: The context used for name lookup. :type execution_context: mapping """ try: exp...
[ "def", "interpret", "(", "marker", ",", "execution_context", "=", "None", ")", ":", "try", ":", "expr", ",", "rest", "=", "parse_marker", "(", "marker", ")", "except", "Exception", "as", "e", ":", "raise", "SyntaxError", "(", "'Unable to interpret marker synta...
[ 112, 0 ]
[ 130, 44 ]
python
en
['en', 'error', 'th']
False
Evaluator.evaluate
(self, expr, context)
Evaluate a marker expression returned by the :func:`parse_requirement` function in the specified context.
Evaluate a marker expression returned by the :func:`parse_requirement` function in the specified context.
def evaluate(self, expr, context): """ Evaluate a marker expression returned by the :func:`parse_requirement` function in the specified context. """ if isinstance(expr, string_types): if expr[0] in '\'"': result = expr[1:-1] else: ...
[ "def", "evaluate", "(", "self", ",", "expr", ",", "context", ")", ":", "if", "isinstance", "(", "expr", ",", "string_types", ")", ":", "if", "expr", "[", "0", "]", "in", "'\\'\"'", ":", "result", "=", "expr", "[", "1", ":", "-", "1", "]", "else",...
[ 49, 4 ]
[ 74, 21 ]
python
en
['en', 'error', 'th']
False
setup_platform
( hass: HomeAssistant, config: ConfigType, add_entities: AddEntitiesCallback, discovery_info: dict[str, Any] | None = None, )
Set up the TCP binary sensor.
Set up the TCP binary sensor.
def setup_platform( hass: HomeAssistant, config: ConfigType, add_entities: AddEntitiesCallback, discovery_info: dict[str, Any] | None = None, ) -> None: """Set up the TCP binary sensor.""" add_entities([TcpBinarySensor(hass, config)])
[ "def", "setup_platform", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "add_entities", ":", "AddEntitiesCallback", ",", "discovery_info", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ",", ")", "->", "None"...
[ 19, 0 ]
[ 26, 49 ]
python
en
['en', 'haw', 'en']
True
TcpBinarySensor.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self) -> bool: """Return true if the binary sensor is on.""" return self._state == self._config[CONF_VALUE_ON]
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_state", "==", "self", ".", "_config", "[", "CONF_VALUE_ON", "]" ]
[ 33, 4 ]
[ 35, 57 ]
python
en
['en', 'fy', 'en']
True
Retry.from_int
(cls, retries, redirect=True, default=None)
Backwards-compatibility for the old retries format.
Backwards-compatibility for the old retries format.
def from_int(cls, retries, redirect=True, default=None): """ Backwards-compatibility for the old retries format.""" if retries is None: retries = default if default is not None else cls.DEFAULT if isinstance(retries, Retry): return retries redirect = bool(redire...
[ "def", "from_int", "(", "cls", ",", "retries", ",", "redirect", "=", "True", ",", "default", "=", "None", ")", ":", "if", "retries", "is", "None", ":", "retries", "=", "default", "if", "default", "is", "not", "None", "else", "cls", ".", "DEFAULT", "i...
[ 219, 4 ]
[ 230, 26 ]
python
en
['en', 'en', 'en']
True
Retry.get_backoff_time
(self)
Formula for computing the current backoff :rtype: float
Formula for computing the current backoff
def get_backoff_time(self): """ Formula for computing the current backoff :rtype: float """ # We want to consider only the last consecutive errors sequence (Ignore redirects). consecutive_errors_len = len( list( takewhile(lambda x: x.redirect_location...
[ "def", "get_backoff_time", "(", "self", ")", ":", "# We want to consider only the last consecutive errors sequence (Ignore redirects).", "consecutive_errors_len", "=", "len", "(", "list", "(", "takewhile", "(", "lambda", "x", ":", "x", ".", "redirect_location", "is", "Non...
[ 232, 4 ]
[ 247, 51 ]
python
en
['en', 'en', 'en']
True
Retry.get_retry_after
(self, response)
Get the value of Retry-After in seconds.
Get the value of Retry-After in seconds.
def get_retry_after(self, response): """ Get the value of Retry-After in seconds. """ retry_after = response.getheader("Retry-After") if retry_after is None: return None return self.parse_retry_after(retry_after)
[ "def", "get_retry_after", "(", "self", ",", "response", ")", ":", "retry_after", "=", "response", ".", "getheader", "(", "\"Retry-After\"", ")", "if", "retry_after", "is", "None", ":", "return", "None", "return", "self", ".", "parse_retry_after", "(", "retry_a...
[ 265, 4 ]
[ 273, 50 ]
python
en
['en', 'en', 'en']
True
Retry.sleep
(self, response=None)
Sleep between retry attempts. This method will respect a server's ``Retry-After`` response header and sleep the duration of the time requested. If that is not present, it will use an exponential backoff. By default, the backoff factor is 0 and this method will return immediately. ...
Sleep between retry attempts.
def sleep(self, response=None): """ Sleep between retry attempts. This method will respect a server's ``Retry-After`` response header and sleep the duration of the time requested. If that is not present, it will use an exponential backoff. By default, the backoff factor is 0 and ...
[ "def", "sleep", "(", "self", ",", "response", "=", "None", ")", ":", "if", "self", ".", "respect_retry_after_header", "and", "response", ":", "slept", "=", "self", ".", "sleep_for_retry", "(", "response", ")", "if", "slept", ":", "return", "self", ".", "...
[ 289, 4 ]
[ 303, 29 ]
python
en
['en', 'nl', 'en']
True
Retry._is_connection_error
(self, err)
Errors when we're fairly sure that the server did not receive the request, so it should be safe to retry.
Errors when we're fairly sure that the server did not receive the request, so it should be safe to retry.
def _is_connection_error(self, err): """ Errors when we're fairly sure that the server did not receive the request, so it should be safe to retry. """ if isinstance(err, ProxyError): err = err.original_error return isinstance(err, ConnectTimeoutError)
[ "def", "_is_connection_error", "(", "self", ",", "err", ")", ":", "if", "isinstance", "(", "err", ",", "ProxyError", ")", ":", "err", "=", "err", ".", "original_error", "return", "isinstance", "(", "err", ",", "ConnectTimeoutError", ")" ]
[ 305, 4 ]
[ 311, 51 ]
python
en
['en', 'en', 'en']
True
Retry._is_read_error
(self, err)
Errors that occur after the request has been started, so we should assume that the server began processing it.
Errors that occur after the request has been started, so we should assume that the server began processing it.
def _is_read_error(self, err): """ Errors that occur after the request has been started, so we should assume that the server began processing it. """ return isinstance(err, (ReadTimeoutError, ProtocolError))
[ "def", "_is_read_error", "(", "self", ",", "err", ")", ":", "return", "isinstance", "(", "err", ",", "(", "ReadTimeoutError", ",", "ProtocolError", ")", ")" ]
[ 313, 4 ]
[ 317, 65 ]
python
en
['en', 'en', 'en']
True
Retry._is_method_retryable
(self, method)
Checks if a given HTTP method should be retried upon, depending if it is included on the method whitelist.
Checks if a given HTTP method should be retried upon, depending if it is included on the method whitelist.
def _is_method_retryable(self, method): """ Checks if a given HTTP method should be retried upon, depending if it is included on the method whitelist. """ if self.method_whitelist and method.upper() not in self.method_whitelist: return False return True
[ "def", "_is_method_retryable", "(", "self", ",", "method", ")", ":", "if", "self", ".", "method_whitelist", "and", "method", ".", "upper", "(", ")", "not", "in", "self", ".", "method_whitelist", ":", "return", "False", "return", "True" ]
[ 319, 4 ]
[ 326, 19 ]
python
en
['en', 'en', 'en']
True
Retry.is_retry
(self, method, status_code, has_retry_after=False)
Is this method/status code retryable? (Based on whitelists and control variables such as the number of total retries to allow, whether to respect the Retry-After header, whether this header is present, and whether the returned status code is on the list of status codes to be retried upo...
Is this method/status code retryable? (Based on whitelists and control variables such as the number of total retries to allow, whether to respect the Retry-After header, whether this header is present, and whether the returned status code is on the list of status codes to be retried upo...
def is_retry(self, method, status_code, has_retry_after=False): """ Is this method/status code retryable? (Based on whitelists and control variables such as the number of total retries to allow, whether to respect the Retry-After header, whether this header is present, and whether the re...
[ "def", "is_retry", "(", "self", ",", "method", ",", "status_code", ",", "has_retry_after", "=", "False", ")", ":", "if", "not", "self", ".", "_is_method_retryable", "(", "method", ")", ":", "return", "False", "if", "self", ".", "status_forcelist", "and", "...
[ 328, 4 ]
[ 346, 9 ]
python
en
['en', 'en', 'en']
True
Retry.is_exhausted
(self)
Are we out of retries?
Are we out of retries?
def is_exhausted(self): """ Are we out of retries? """ retry_counts = (self.total, self.connect, self.read, self.redirect, self.status) retry_counts = list(filter(None, retry_counts)) if not retry_counts: return False return min(retry_counts) < 0
[ "def", "is_exhausted", "(", "self", ")", ":", "retry_counts", "=", "(", "self", ".", "total", ",", "self", ".", "connect", ",", "self", ".", "read", ",", "self", ".", "redirect", ",", "self", ".", "status", ")", "retry_counts", "=", "list", "(", "fil...
[ 348, 4 ]
[ 355, 36 ]
python
en
['en', 'en', 'en']
True
Retry.increment
( self, method=None, url=None, response=None, error=None, _pool=None, _stacktrace=None, )
Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.HTTPResponse` :param Exception error: An error encountered during the request, or N...
Return a new Retry object with incremented retry counters.
def increment( self, method=None, url=None, response=None, error=None, _pool=None, _stacktrace=None, ): """ Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not ...
[ "def", "increment", "(", "self", ",", "method", "=", "None", ",", "url", "=", "None", ",", "response", "=", "None", ",", "error", "=", "None", ",", "_pool", "=", "None", ",", "_stacktrace", "=", "None", ",", ")", ":", "if", "self", ".", "total", ...
[ 357, 4 ]
[ 442, 24 ]
python
en
['en', 'en', 'en']
True
valid_speed_range_configuration
(config)
Validate that the fan speed_range configuration is valid, throws if it isn't.
Validate that the fan speed_range configuration is valid, throws if it isn't.
def valid_speed_range_configuration(config): """Validate that the fan speed_range configuration is valid, throws if it isn't.""" if config.get(CONF_SPEED_RANGE_MIN) == 0: raise ValueError("speed_range_min must be > 0") if config.get(CONF_SPEED_RANGE_MIN) >= config.get(CONF_SPEED_RANGE_MAX): ...
[ "def", "valid_speed_range_configuration", "(", "config", ")", ":", "if", "config", ".", "get", "(", "CONF_SPEED_RANGE_MIN", ")", "==", "0", ":", "raise", "ValueError", "(", "\"speed_range_min must be > 0\"", ")", "if", "config", ".", "get", "(", "CONF_SPEED_RANGE_...
[ 106, 0 ]
[ 112, 17 ]
python
en
['en', 'en', 'en']
True
valid_preset_mode_configuration
(config)
Validate that the preset mode reset payload is not one of the preset modes.
Validate that the preset mode reset payload is not one of the preset modes.
def valid_preset_mode_configuration(config): """Validate that the preset mode reset payload is not one of the preset modes.""" if config.get(CONF_PAYLOAD_RESET_PRESET_MODE) in config.get(CONF_PRESET_MODES_LIST): raise ValueError("preset_modes must not contain payload_reset_preset_mode") return confi...
[ "def", "valid_preset_mode_configuration", "(", "config", ")", ":", "if", "config", ".", "get", "(", "CONF_PAYLOAD_RESET_PRESET_MODE", ")", "in", "config", ".", "get", "(", "CONF_PRESET_MODES_LIST", ")", ":", "raise", "ValueError", "(", "\"preset_modes must not contain...
[ 115, 0 ]
[ 119, 17 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
( hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None )
Set up MQTT fan through configuration.yaml.
Set up MQTT fan through configuration.yaml.
async def async_setup_platform( hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None ): """Set up MQTT fan through configuration.yaml.""" await async_setup_reload_service(hass, DOMAIN, PLATFORMS) await _async_setup_entity(hass, async_add_entities, config)
[ "async", "def", "async_setup_platform", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "await", "async_setup_reload_service", "(", "hass", ",", "DOMAIN", ",", "PLATFORMS...
[ 195, 0 ]
[ 200, 63 ]
python
en
['en', 'ny', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up MQTT fan dynamically through MQTT discovery.
Set up MQTT fan dynamically through MQTT discovery.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT fan dynamically through MQTT discovery.""" setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) await async_setup_entry_helper(hass, fan.DOMAIN, setup, PLATFORM_SC...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "setup", "=", "functools", ".", "partial", "(", "_async_setup_entity", ",", "hass", ",", "async_add_entities", ",", "config_entry", "=", "config_entry", ")"...
[ 203, 0 ]
[ 208, 76 ]
python
en
['en', 'lb', 'en']
True
_async_setup_entity
( hass, async_add_entities, config, config_entry=None, discovery_data=None )
Set up the MQTT fan.
Set up the MQTT fan.
async def _async_setup_entity( hass, async_add_entities, config, config_entry=None, discovery_data=None ): """Set up the MQTT fan.""" async_add_entities([MqttFan(hass, config, config_entry, discovery_data)])
[ "async", "def", "_async_setup_entity", "(", "hass", ",", "async_add_entities", ",", "config", ",", "config_entry", "=", "None", ",", "discovery_data", "=", "None", ")", ":", "async_add_entities", "(", "[", "MqttFan", "(", "hass", ",", "config", ",", "config_en...
[ 211, 0 ]
[ 215, 77 ]
python
en
['en', 'fy', 'en']
True
MqttFan.__init__
(self, hass, config, config_entry, discovery_data)
Initialize the MQTT fan.
Initialize the MQTT fan.
def __init__(self, hass, config, config_entry, discovery_data): """Initialize the MQTT fan.""" self._state = False self._percentage = None self._preset_mode = None self._oscillation = None self._supported_features = 0 self._topic = None self._payload = No...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config", ",", "config_entry", ",", "discovery_data", ")", ":", "self", ".", "_state", "=", "False", "self", ".", "_percentage", "=", "None", "self", ".", "_preset_mode", "=", "None", "self", ".", "_oscil...
[ 223, 4 ]
[ 240, 77 ]
python
en
['en', 'fy', 'en']
True
MqttFan.config_schema
()
Return the config schema.
Return the config schema.
def config_schema(): """Return the config schema.""" return PLATFORM_SCHEMA
[ "def", "config_schema", "(", ")", ":", "return", "PLATFORM_SCHEMA" ]
[ 243, 4 ]
[ 245, 30 ]
python
en
['en', 'de', 'en']
True
MqttFan._setup_from_config
(self, config)
(Re)Setup the entity.
(Re)Setup the entity.
def _setup_from_config(self, config): """(Re)Setup the entity.""" self._speed_range = ( config.get(CONF_SPEED_RANGE_MIN), config.get(CONF_SPEED_RANGE_MAX), ) self._topic = { key: config.get(key) for key in ( CONF_STATE_TOPIC...
[ "def", "_setup_from_config", "(", "self", ",", "config", ")", ":", "self", ".", "_speed_range", "=", "(", "config", ".", "get", "(", "CONF_SPEED_RANGE_MIN", ")", ",", "config", ".", "get", "(", "CONF_SPEED_RANGE_MAX", ")", ",", ")", "self", ".", "_topic", ...
[ 247, 4 ]
[ 328, 77 ]
python
en
['en', 'haw', 'en']
True
MqttFan._subscribe_topics
(self)
(Re)Subscribe to topics.
(Re)Subscribe to topics.
async def _subscribe_topics(self): """(Re)Subscribe to topics.""" topics = {} @callback @log_messages(self.hass, self.entity_id) def state_received(msg): """Handle new received MQTT message.""" payload = self._value_templates[CONF_STATE](msg.payload) ...
[ "async", "def", "_subscribe_topics", "(", "self", ")", ":", "topics", "=", "{", "}", "@", "callback", "@", "log_messages", "(", "self", ".", "hass", ",", "self", ".", "entity_id", ")", "def", "state_received", "(", "msg", ")", ":", "\"\"\"Handle new receiv...
[ 330, 4 ]
[ 456, 9 ]
python
en
['en', 'en', 'en']
True
MqttFan.assumed_state
(self)
Return true if we do optimistic updates.
Return true if we do optimistic updates.
def assumed_state(self): """Return true if we do optimistic updates.""" return self._optimistic
[ "def", "assumed_state", "(", "self", ")", ":", "return", "self", ".", "_optimistic" ]
[ 459, 4 ]
[ 461, 31 ]
python
en
['pt', 'la', 'en']
False
MqttFan.is_on
(self)
Return true if device is on.
Return true if device is on.
def is_on(self): """Return true if device is on.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 464, 4 ]
[ 466, 26 ]
python
en
['en', 'fy', 'en']
True
MqttFan.percentage
(self)
Return the current percentage.
Return the current percentage.
def percentage(self): """Return the current percentage.""" return self._percentage
[ "def", "percentage", "(", "self", ")", ":", "return", "self", ".", "_percentage" ]
[ 469, 4 ]
[ 471, 31 ]
python
en
['en', 'en', 'en']
True
MqttFan.preset_mode
(self)
Return the current preset _mode.
Return the current preset _mode.
def preset_mode(self): """Return the current preset _mode.""" return self._preset_mode
[ "def", "preset_mode", "(", "self", ")", ":", "return", "self", ".", "_preset_mode" ]
[ 474, 4 ]
[ 476, 32 ]
python
en
['en', 'en', 'en']
True
MqttFan.preset_modes
(self)
Get the list of available preset modes.
Get the list of available preset modes.
def preset_modes(self) -> list: """Get the list of available preset modes.""" return self._preset_modes
[ "def", "preset_modes", "(", "self", ")", "->", "list", ":", "return", "self", ".", "_preset_modes" ]
[ 479, 4 ]
[ 481, 33 ]
python
en
['en', 'en', 'en']
True
MqttFan.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self) -> int: """Flag supported features.""" return self._supported_features
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_supported_features" ]
[ 484, 4 ]
[ 486, 39 ]
python
en
['da', 'en', 'en']
True
MqttFan.speed_count
(self)
Return the number of speeds the fan supports.
Return the number of speeds the fan supports.
def speed_count(self) -> int: """Return the number of speeds the fan supports.""" return self._speed_count
[ "def", "speed_count", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_speed_count" ]
[ 489, 4 ]
[ 491, 32 ]
python
en
['en', 'en', 'en']
True
MqttFan.oscillating
(self)
Return the oscillation state.
Return the oscillation state.
def oscillating(self): """Return the oscillation state.""" return self._oscillation
[ "def", "oscillating", "(", "self", ")", ":", "return", "self", ".", "_oscillation" ]
[ 494, 4 ]
[ 496, 32 ]
python
en
['en', 'en', 'en']
True
MqttFan.async_turn_on
( self, speed: str = None, percentage: int = None, preset_mode: str = None, **kwargs, )
Turn on the entity. This method is a coroutine.
Turn on the entity.
async def async_turn_on( self, speed: str = None, percentage: int = None, preset_mode: str = None, **kwargs, ) -> None: """Turn on the entity. This method is a coroutine. """ mqtt_payload = self._command_templates[CONF_STATE](self._payload["ST...
[ "async", "def", "async_turn_on", "(", "self", ",", "speed", ":", "str", "=", "None", ",", "percentage", ":", "int", "=", "None", ",", "preset_mode", ":", "str", "=", "None", ",", "*", "*", "kwargs", ",", ")", "->", "None", ":", "mqtt_payload", "=", ...
[ 499, 4 ]
[ 524, 39 ]
python
en
['en', 'en', 'en']
True
MqttFan.async_turn_off
(self, **kwargs)
Turn off the entity. This method is a coroutine.
Turn off the entity.
async def async_turn_off(self, **kwargs) -> None: """Turn off the entity. This method is a coroutine. """ mqtt_payload = self._command_templates[CONF_STATE](self._payload["STATE_OFF"]) mqtt.async_publish( self.hass, self._topic[CONF_COMMAND_TOPIC], ...
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "mqtt_payload", "=", "self", ".", "_command_templates", "[", "CONF_STATE", "]", "(", "self", ".", "_payload", "[", "\"STATE_OFF\"", "]", ")", "mqtt", ".", "as...
[ 526, 4 ]
[ 541, 39 ]
python
en
['en', 'en', 'en']
True
MqttFan.async_set_percentage
(self, percentage: int)
Set the percentage of the fan. This method is a coroutine.
Set the percentage of the fan.
async def async_set_percentage(self, percentage: int) -> None: """Set the percentage of the fan. This method is a coroutine. """ percentage_payload = math.ceil( percentage_to_ranged_value(self._speed_range, percentage) ) mqtt_payload = self._command_templates...
[ "async", "def", "async_set_percentage", "(", "self", ",", "percentage", ":", "int", ")", "->", "None", ":", "percentage_payload", "=", "math", ".", "ceil", "(", "percentage_to_ranged_value", "(", "self", ".", "_speed_range", ",", "percentage", ")", ")", "mqtt_...
[ 543, 4 ]
[ 562, 39 ]
python
en
['en', 'en', 'en']
True
MqttFan.async_set_preset_mode
(self, preset_mode: str)
Set the preset mode of the fan. This method is a coroutine.
Set the preset mode of the fan.
async def async_set_preset_mode(self, preset_mode: str) -> None: """Set the preset mode of the fan. This method is a coroutine. """ if preset_mode not in self.preset_modes: _LOGGER.warning("'%s'is not a valid preset mode", preset_mode) return mqtt_payloa...
[ "async", "def", "async_set_preset_mode", "(", "self", ",", "preset_mode", ":", "str", ")", "->", "None", ":", "if", "preset_mode", "not", "in", "self", ".", "preset_modes", ":", "_LOGGER", ".", "warning", "(", "\"'%s'is not a valid preset mode\"", ",", "preset_m...
[ 564, 4 ]
[ 585, 39 ]
python
en
['en', 'en', 'en']
True
MqttFan.async_oscillate
(self, oscillating: bool)
Set oscillation. This method is a coroutine.
Set oscillation.
async def async_oscillate(self, oscillating: bool) -> None: """Set oscillation. This method is a coroutine. """ if oscillating: mqtt_payload = self._command_templates[ATTR_OSCILLATING]( self._payload["OSCILLATE_ON_PAYLOAD"] ) else: ...
[ "async", "def", "async_oscillate", "(", "self", ",", "oscillating", ":", "bool", ")", "->", "None", ":", "if", "oscillating", ":", "mqtt_payload", "=", "self", ".", "_command_templates", "[", "ATTR_OSCILLATING", "]", "(", "self", ".", "_payload", "[", "\"OSC...
[ 587, 4 ]
[ 611, 39 ]
python
en
['it', 'ru', 'en']
False
TestMammal.testMammal
(self)
Test Mammal
Test Mammal
def testMammal(self): """Test Mammal""" # FIXME: construct object with mandatory attributes with example values # model = Mammal() # noqa: E501 pass
[ "def", "testMammal", "(", "self", ")", ":", "# FIXME: construct object with mandatory attributes with example values", "# model = Mammal() # noqa: E501", "pass" ]
[ 34, 4 ]
[ 38, 12 ]
python
it
['sv', 'ko', 'it']
False
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Import the platform into a config entry.
Import the platform into a config entry.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Import the platform into a config entry.""" hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=config ) )
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "hass", ".", "async_create_task", "(", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",...
[ 55, 0 ]
[ 61, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Flume sensor.
Set up the Flume sensor.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Flume sensor.""" flume_domain_data = hass.data[DOMAIN][config_entry.entry_id] flume_auth = flume_domain_data[FLUME_AUTH] http_session = flume_domain_data[FLUME_HTTP_SESSION] flume_devices = flume_domain_data[FLUME_DE...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "flume_domain_data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "flume_auth", "=", "flume_domain_data", "[",...
[ 64, 0 ]
[ 107, 45 ]
python
en
['en', 'da', 'en']
True
_create_flume_device_coordinator
(hass, flume_device)
Create a data coordinator for the flume device.
Create a data coordinator for the flume device.
def _create_flume_device_coordinator(hass, flume_device): """Create a data coordinator for the flume device.""" async def _async_update_data(): """Get the latest data from the Flume.""" _LOGGER.debug("Updating Flume data") try: await hass.async_add_executor_job(flume_device....
[ "def", "_create_flume_device_coordinator", "(", "hass", ",", "flume_device", ")", ":", "async", "def", "_async_update_data", "(", ")", ":", "\"\"\"Get the latest data from the Flume.\"\"\"", "_LOGGER", ".", "debug", "(", "\"Updating Flume data\"", ")", "try", ":", "awai...
[ 169, 0 ]
[ 195, 5 ]
python
en
['en', 'en', 'en']
True
FlumeSensor.__init__
(self, coordinator, flume_device, flume_query_sensor, name, device_id)
Initialize the Flume sensor.
Initialize the Flume sensor.
def __init__(self, coordinator, flume_device, flume_query_sensor, name, device_id): """Initialize the Flume sensor.""" super().__init__(coordinator) self._flume_device = flume_device self._flume_query_sensor = flume_query_sensor self._name = name self._device_id = device_...
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "flume_device", ",", "flume_query_sensor", ",", "name", ",", "device_id", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_flume_device", "=", "flume_device", "self...
[ 113, 4 ]
[ 120, 26 ]
python
en
['en', 'sq', 'en']
True
FlumeSensor.device_info
(self)
Device info for the flume sensor.
Device info for the flume sensor.
def device_info(self): """Device info for the flume sensor.""" return { "name": self._name, "identifiers": {(DOMAIN, self._device_id)}, "manufacturer": "Flume, Inc.", "model": "Flume Smart Water Monitor", }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"name\"", ":", "self", ".", "_name", ",", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_device_id", ")", "}", ",", "\"manufacturer\"", ":", "\"Flume, Inc.\"", ",", "\"model\"",...
[ 123, 4 ]
[ 130, 9 ]
python
en
['en', 'no', 'en']
True
FlumeSensor.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" ]
[ 133, 4 ]
[ 135, 25 ]
python
en
['en', 'mi', 'en']
True
FlumeSensor.native_value
(self)
Return the state of the sensor.
Return the state of the sensor.
def native_value(self): """Return the state of the sensor.""" sensor_key = self._flume_query_sensor[0] if sensor_key not in self._flume_device.values: return None return _format_state_value(self._flume_device.values[sensor_key])
[ "def", "native_value", "(", "self", ")", ":", "sensor_key", "=", "self", ".", "_flume_query_sensor", "[", "0", "]", "if", "sensor_key", "not", "in", "self", ".", "_flume_device", ".", "values", ":", "return", "None", "return", "_format_state_value", "(", "se...
[ 138, 4 ]
[ 144, 73 ]
python
en
['en', 'en', 'en']
True
FlumeSensor.native_unit_of_measurement
(self)
Return the unit the value is expressed in.
Return the unit the value is expressed in.
def native_unit_of_measurement(self): """Return the unit the value is expressed in.""" # This is in gallons per SCAN_INTERVAL return self._flume_query_sensor[1]["unit_of_measurement"]
[ "def", "native_unit_of_measurement", "(", "self", ")", ":", "# This is in gallons per SCAN_INTERVAL", "return", "self", ".", "_flume_query_sensor", "[", "1", "]", "[", "\"unit_of_measurement\"", "]" ]
[ 147, 4 ]
[ 150, 65 ]
python
en
['en', 'en', 'en']
True
FlumeSensor.unique_id
(self)
Flume query and Device unique ID.
Flume query and Device unique ID.
def unique_id(self): """Flume query and Device unique ID.""" return f"{self._flume_query_sensor[0]}_{self._device_id}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._flume_query_sensor[0]}_{self._device_id}\"" ]
[ 153, 4 ]
[ 155, 65 ]
python
en
['en', 'en', 'en']
True
FlumeSensor.async_added_to_hass
(self)
Request an update when added.
Request an update when added.
async def async_added_to_hass(self): """Request an update when added.""" await super().async_added_to_hass() # We do not ask for an update with async_add_entities() # because it will update disabled entities await self.coordinator.async_request_refresh()
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "# We do not ask for an update with async_add_entities()", "# because it will update disabled entities", "await", "self", ".", "coordinator", ".",...
[ 157, 4 ]
[ 162, 54 ]
python
en
['en', 'en', 'en']
True
test_activity_remote
(hass, hk_driver, events, caplog)
Test if remote accessory and HA are updated accordingly.
Test if remote accessory and HA are updated accordingly.
async def test_activity_remote(hass, hk_driver, events, caplog): """Test if remote accessory and HA are updated accordingly.""" entity_id = "remote.harmony" hass.states.async_set( entity_id, None, { ATTR_SUPPORTED_FEATURES: SUPPORT_ACTIVITY, ATTR_CURRENT_ACTIV...
[ "async", "def", "test_activity_remote", "(", "hass", ",", "hk_driver", ",", "events", ",", "caplog", ")", ":", "entity_id", "=", "\"remote.harmony\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "None", ",", "{", "ATTR_SUPPORTED_FEATURES", ...
[ 29, 0 ]
[ 165, 68 ]
python
en
['en', 'en', 'en']
True
TestPlayer.testPlayer
(self)
Test Player
Test Player
def testPlayer(self): """Test Player""" # we can make a player without an enemy_player property jane = Player(name="Jane") # we can make a player with an enemy_player sally = Player(name="Sally", enemy_player=jane) # we can make a player with an inline enemy_player ...
[ "def", "testPlayer", "(", "self", ")", ":", "# we can make a player without an enemy_player property", "jane", "=", "Player", "(", "name", "=", "\"Jane\"", ")", "# we can make a player with an enemy_player", "sally", "=", "Player", "(", "name", "=", "\"Sally\"", ",", ...
[ 29, 4 ]
[ 39, 9 ]
python
en
['en', 'en', 'en']
False
_get_image_diff_pairs
( base_collection, base_unmatched, target_collection, target_unmatched )
Returns three lists of pair tuples. Each pair tuple is base ix, target ix, difference value. If the number of base and target differ, some are paired with '-1' and for these the difference will also be -1. The first list is the 'primary pairing', chosen to generate the lowest overall difference a...
Returns three lists of pair tuples. Each pair tuple is base ix, target ix, difference value. If the number of base and target differ, some are paired with '-1' and for these the difference will also be -1.
def _get_image_diff_pairs( base_collection, base_unmatched, target_collection, target_unmatched ): """Returns three lists of pair tuples. Each pair tuple is base ix, target ix, difference value. If the number of base and target differ, some are paired with '-1' and for these the difference will also b...
[ "def", "_get_image_diff_pairs", "(", "base_collection", ",", "base_unmatched", ",", "target_collection", ",", "target_unmatched", ")", ":", "# We determine the common frame, and render each unmatched image", "# into that frame. We reduce this to a 'fingerprint' and employ a", "# distanc...
[ 360, 0 ]
[ 568, 54 ]
python
en
['en', 'et', 'en']
True
_get_cp_pairs
(base_font, target_font)
Return a list of tuples of base glyph ix, target glyph ix, codepoint for all codepoints in either font. When a codepoint is in only one font, the id for the other glyph is -1.
Return a list of tuples of base glyph ix, target glyph ix, codepoint for all codepoints in either font. When a codepoint is in only one font, the id for the other glyph is -1.
def _get_cp_pairs(base_font, target_font): """Return a list of tuples of base glyph ix, target glyph ix, codepoint for all codepoints in either font. When a codepoint is in only one font, the id for the other glyph is -1.""" base_cp_map = _get_cp_to_glyphix(base_font) target_cp_map = _get_cp_to_gl...
[ "def", "_get_cp_pairs", "(", "base_font", ",", "target_font", ")", ":", "base_cp_map", "=", "_get_cp_to_glyphix", "(", "base_font", ")", "target_cp_map", "=", "_get_cp_to_glyphix", "(", "target_font", ")", "pairs", "=", "[", "]", "base_keys", "=", "set", "(", ...
[ 571, 0 ]
[ 589, 16 ]
python
en
['en', 'bg', 'en']
True
get_collection_pairs
(base_collection, target_collection)
Returns a PairInfo representing a pairing of the two collections. This requires that the fonts referenced in the collections exist at their respective paths, since it reads codepoint information from those fonts. It first calculates which pairs correspond due to codepoint, and removes them from the set...
Returns a PairInfo representing a pairing of the two collections. This requires that the fonts referenced in the collections exist at their respective paths, since it reads codepoint information from those fonts. It first calculates which pairs correspond due to codepoint, and removes them from the set...
def get_collection_pairs(base_collection, target_collection): """Returns a PairInfo representing a pairing of the two collections. This requires that the fonts referenced in the collections exist at their respective paths, since it reads codepoint information from those fonts. It first calculates which...
[ "def", "get_collection_pairs", "(", "base_collection", ",", "target_collection", ")", ":", "base_font_path", "=", "base_collection", ".", "file_header", ".", "file", "target_font_path", "=", "target_collection", ".", "file_header", ".", "file", "base_font", "=", "ttLi...
[ 592, 0 ]
[ 630, 5 ]
python
en
['en', 'en', 'en']
True
write_pair_info
(pair_info, output_file)
Write pair_info to a file.
Write pair_info to a file.
def write_pair_info(pair_info, output_file): """Write pair_info to a file.""" def _write_data(fd): fd.write("# %s\n" % date_str()) fd.write("> base: %s\n" % pair_info.base_path) fd.write("> base_hash: %s\n" % pair_info.base_hash) fd.write("> target: %s\n" % pair_info.target_path...
[ "def", "write_pair_info", "(", "pair_info", ",", "output_file", ")", ":", "def", "_write_data", "(", "fd", ")", ":", "fd", ".", "write", "(", "\"# %s\\n\"", "%", "date_str", "(", ")", ")", "fd", ".", "write", "(", "\"> base: %s\\n\"", "%", "pair_info", "...
[ 661, 0 ]
[ 691, 31 ]
python
en
['en', 'en', 'en']
True
_generate_mock_feed_entry
( external_id, title, distance_to_home, coordinates, place=None, attribution=None, time=None, updated=None, magnitude=None, status=None, entry_type=None, alert=None, )
Construct a mock feed entry for testing purposes.
Construct a mock feed entry for testing purposes.
def _generate_mock_feed_entry( external_id, title, distance_to_home, coordinates, place=None, attribution=None, time=None, updated=None, magnitude=None, status=None, entry_type=None, alert=None, ): """Construct a mock feed entry for testing purposes.""" feed_entry...
[ "def", "_generate_mock_feed_entry", "(", "external_id", ",", "title", ",", "distance_to_home", ",", "coordinates", ",", "place", "=", "None", ",", "attribution", "=", "None", ",", "time", "=", "None", ",", "updated", "=", "None", ",", "magnitude", "=", "None...
[ 59, 0 ]
[ 87, 21 ]
python
en
['en', 'en', 'en']
True
test_setup
(hass)
Test the general setup of the platform.
Test the general setup of the platform.
async def test_setup(hass): """Test the general setup of the platform.""" # Set up some mock feed entries for this test. mock_entry_1 = _generate_mock_feed_entry( "1234", "Title 1", 15.5, (-31.0, 150.0), place="Location 1", attribution="Attribution 1", ...
[ "async", "def", "test_setup", "(", "hass", ")", ":", "# Set up some mock feed entries for this test.", "mock_entry_1", "=", "_generate_mock_feed_entry", "(", "\"1234\"", ",", "\"Title 1\"", ",", "15.5", ",", "(", "-", "31.0", ",", "150.0", ")", ",", "place", "=", ...
[ 90, 0 ]
[ 213, 39 ]
python
en
['en', 'da', 'en']
True
test_setup_with_custom_location
(hass)
Test the setup with a custom location.
Test the setup with a custom location.
async def test_setup_with_custom_location(hass): """Test the setup with a custom location.""" # Set up some mock feed entries for this test. mock_entry_1 = _generate_mock_feed_entry("1234", "Title 1", 20.5, (-31.1, 150.1)) with patch( "geojson_client.usgs_earthquake_hazards_program_feed." ...
[ "async", "def", "test_setup_with_custom_location", "(", "hass", ")", ":", "# Set up some mock feed entries for this test.", "mock_entry_1", "=", "_generate_mock_feed_entry", "(", "\"1234\"", ",", "\"Title 1\"", ",", "20.5", ",", "(", "-", "31.1", ",", "150.1", ")", ")...
[ 216, 0 ]
[ 246, 13 ]
python
en
['en', 'en', 'en']
True
AdditionalPropertiesString.__init__
(self, name=None, local_vars_configuration=None)
AdditionalPropertiesString - a model defined in OpenAPI
AdditionalPropertiesString - a model defined in OpenAPI
def __init__(self, name=None, local_vars_configuration=None): # noqa: E501 """AdditionalPropertiesString - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration.get_default_copy() self.local_vars_configuration = loc...
[ "def", "__init__", "(", "self", ",", "name", "=", "None", ",", "local_vars_configuration", "=", "None", ")", ":", "# noqa: E501", "# noqa: E501", "if", "local_vars_configuration", "is", "None", ":", "local_vars_configuration", "=", "Configuration", ".", "get_default...
[ 42, 4 ]
[ 52, 28 ]
python
en
['en', 'en', 'en']
True
AdditionalPropertiesString.name
(self)
Gets the name of this AdditionalPropertiesString. # noqa: E501 :return: The name of this AdditionalPropertiesString. # noqa: E501 :rtype: str
Gets the name of this AdditionalPropertiesString. # noqa: E501
def name(self): """Gets the name of this AdditionalPropertiesString. # noqa: E501 :return: The name of this AdditionalPropertiesString. # noqa: E501 :rtype: str """ return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 55, 4 ]
[ 62, 25 ]
python
en
['en', 'en', 'en']
True
AdditionalPropertiesString.name
(self, name)
Sets the name of this AdditionalPropertiesString. :param name: The name of this AdditionalPropertiesString. # noqa: E501 :type name: str
Sets the name of this AdditionalPropertiesString.
def name(self, name): """Sets the name of this AdditionalPropertiesString. :param name: The name of this AdditionalPropertiesString. # noqa: E501 :type name: str """ self._name = name
[ "def", "name", "(", "self", ",", "name", ")", ":", "self", ".", "_name", "=", "name" ]
[ 65, 4 ]
[ 73, 25 ]
python
en
['en', 'en', 'en']
True
AdditionalPropertiesString.to_dict
(self, serialize=False)
Returns the model properties as a dict
Returns the model properties as a dict
def to_dict(self, serialize=False): """Returns the model properties as a dict""" result = {} def convert(x): if hasattr(x, "to_dict"): args = inspect.getargspec(x.to_dict).args if len(args) == 1: return x.to_dict() ...
[ "def", "to_dict", "(", "self", ",", "serialize", "=", "False", ")", ":", "result", "=", "{", "}", "def", "convert", "(", "x", ")", ":", "if", "hasattr", "(", "x", ",", "\"to_dict\"", ")", ":", "args", "=", "inspect", ".", "getargspec", "(", "x", ...
[ 75, 4 ]
[ 105, 21 ]
python
en
['en', 'en', 'en']
True
AdditionalPropertiesString.to_str
(self)
Returns the string representation of the model
Returns the string representation of the model
def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict())
[ "def", "to_str", "(", "self", ")", ":", "return", "pprint", ".", "pformat", "(", "self", ".", "to_dict", "(", ")", ")" ]
[ 107, 4 ]
[ 109, 45 ]
python
en
['en', 'en', 'en']
True
AdditionalPropertiesString.__repr__
(self)
For `print` and `pprint`
For `print` and `pprint`
def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "to_str", "(", ")" ]
[ 111, 4 ]
[ 113, 28 ]
python
en
['en', 'en', 'en']
True
AdditionalPropertiesString.__eq__
(self, other)
Returns true if both objects are equal
Returns true if both objects are equal
def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, AdditionalPropertiesString): return False return self.to_dict() == other.to_dict()
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "AdditionalPropertiesString", ")", ":", "return", "False", "return", "self", ".", "to_dict", "(", ")", "==", "other", ".", "to_dict", "(", ")" ]
[ 115, 4 ]
[ 120, 48 ]
python
en
['en', 'en', 'en']
True
AdditionalPropertiesString.__ne__
(self, other)
Returns true if both objects are not equal
Returns true if both objects are not equal
def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, AdditionalPropertiesString): return True return self.to_dict() != other.to_dict()
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "AdditionalPropertiesString", ")", ":", "return", "True", "return", "self", ".", "to_dict", "(", ")", "!=", "other", ".", "to_dict", "(", ")" ]
[ 122, 4 ]
[ 127, 48 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, )
Record the async_add_entities function to add them later when received from Dynalite.
Record the async_add_entities function to add them later when received from Dynalite.
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Record the async_add_entities function to add them later when received from Dynalite.""" async_setup_entry_base( hass, config_entry, async_add_entities, "light"...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", ")", "->", "None", ":", "async_setup_entry_base", "(", "hass", ",", "config_entry", ",", "a...
[ 10, 0 ]
[ 18, 5 ]
python
en
['en', 'en', 'en']
True
DynaliteLight.brightness
(self)
Return the brightness of this light between 0..255.
Return the brightness of this light between 0..255.
def brightness(self) -> int: """Return the brightness of this light between 0..255.""" return self._device.brightness
[ "def", "brightness", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_device", ".", "brightness" ]
[ 25, 4 ]
[ 27, 38 ]
python
en
['en', 'en', 'en']
True
DynaliteLight.is_on
(self)
Return true if device is on.
Return true if device is on.
def is_on(self) -> bool: """Return true if device is on.""" return self._device.is_on
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_device", ".", "is_on" ]
[ 30, 4 ]
[ 32, 33 ]
python
en
['en', 'fy', 'en']
True
DynaliteLight.async_turn_on
(self, **kwargs)
Turn the light on.
Turn the light on.
async def async_turn_on(self, **kwargs) -> None: """Turn the light on.""" await self._device.async_turn_on(**kwargs)
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "await", "self", ".", "_device", ".", "async_turn_on", "(", "*", "*", "kwargs", ")" ]
[ 34, 4 ]
[ 36, 50 ]
python
en
['en', 'et', 'en']
True
DynaliteLight.async_turn_off
(self, **kwargs)
Turn the light off.
Turn the light off.
async def async_turn_off(self, **kwargs) -> None: """Turn the light off.""" await self._device.async_turn_off(**kwargs)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "await", "self", ".", "_device", ".", "async_turn_off", "(", "*", "*", "kwargs", ")" ]
[ 38, 4 ]
[ 40, 51 ]
python
en
['en', 'zh', 'en']
True
DynaliteLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self) -> int: """Flag supported features.""" return SUPPORT_BRIGHTNESS
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_BRIGHTNESS" ]
[ 43, 4 ]
[ 45, 33 ]
python
en
['da', 'en', 'en']
True
async_setup
(hass, config)
Qwiskswitch component setup.
Qwiskswitch component setup.
async def async_setup(hass, config): """Qwiskswitch component setup.""" # Add cmd's to in /&listen packets will fire events # By default only buttons of type [TOGGLE,SCENE EXE,LEVEL] cmd_buttons = set(CMD_BUTTONS) for btn in config[DOMAIN][CONF_BUTTON_EVENTS]: cmd_buttons.add(btn) url ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "# Add cmd's to in /&listen packets will fire events", "# By default only buttons of type [TOGGLE,SCENE EXE,LEVEL]", "cmd_buttons", "=", "set", "(", "CMD_BUTTONS", ")", "for", "btn", "in", "config", "[", ...
[ 132, 0 ]
[ 234, 15 ]
python
en
['en', 'en', 'en']
True
QSEntity.__init__
(self, qsid, name)
Initialize the QSEntity.
Initialize the QSEntity.
def __init__(self, qsid, name): """Initialize the QSEntity.""" self._name = name self.qsid = qsid
[ "def", "__init__", "(", "self", ",", "qsid", ",", "name", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "qsid", "=", "qsid" ]
[ 66, 4 ]
[ 69, 24 ]
python
en
['en', 'en', 'en']
True
QSEntity.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" ]
[ 72, 4 ]
[ 74, 25 ]
python
en
['en', 'mi', 'en']
True
QSEntity.should_poll
(self)
QS sensors gets packets in update_packet.
QS sensors gets packets in update_packet.
def should_poll(self): """QS sensors gets packets in update_packet.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 77, 4 ]
[ 79, 20 ]
python
en
['en', 'en', 'en']
True
QSEntity.unique_id
(self)
Return a unique identifier for this sensor.
Return a unique identifier for this sensor.
def unique_id(self): """Return a unique identifier for this sensor.""" return f"qs{self.qsid}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"qs{self.qsid}\"" ]
[ 82, 4 ]
[ 84, 31 ]
python
en
['en', 'fr', 'en']
True
QSEntity.update_packet
(self, packet)
Receive update packet from QSUSB. Match dispather_send signature.
Receive update packet from QSUSB. Match dispather_send signature.
def update_packet(self, packet): """Receive update packet from QSUSB. Match dispather_send signature.""" self.async_write_ha_state()
[ "def", "update_packet", "(", "self", ",", "packet", ")", ":", "self", ".", "async_write_ha_state", "(", ")" ]
[ 87, 4 ]
[ 89, 35 ]
python
en
['en', 'en', 'en']
True
QSEntity.async_added_to_hass
(self)
Listen for updates from QSUSb via dispatcher.
Listen for updates from QSUSb via dispatcher.
async def async_added_to_hass(self): """Listen for updates from QSUSb via dispatcher.""" self.async_on_remove( self.hass.helpers.dispatcher.async_dispatcher_connect( self.qsid, self.update_packet ) )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "async_on_remove", "(", "self", ".", "hass", ".", "helpers", ".", "dispatcher", ".", "async_dispatcher_connect", "(", "self", ".", "qsid", ",", "self", ".", "update_packet", ")", ")" ...
[ 91, 4 ]
[ 97, 9 ]
python
en
['en', 'en', 'en']
True
QSToggleEntity.__init__
(self, qsid, qsusb)
Initialize the ToggleEntity.
Initialize the ToggleEntity.
def __init__(self, qsid, qsusb): """Initialize the ToggleEntity.""" self.device = qsusb.devices[qsid] super().__init__(qsid, self.device.name)
[ "def", "__init__", "(", "self", ",", "qsid", ",", "qsusb", ")", ":", "self", ".", "device", "=", "qsusb", ".", "devices", "[", "qsid", "]", "super", "(", ")", ".", "__init__", "(", "qsid", ",", "self", ".", "device", ".", "name", ")" ]
[ 112, 4 ]
[ 115, 48 ]
python
en
['en', 'en', 'en']
True
QSToggleEntity.is_on
(self)
Check if device is on (non-zero).
Check if device is on (non-zero).
def is_on(self): """Check if device is on (non-zero).""" return self.device.value > 0
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "device", ".", "value", ">", "0" ]
[ 118, 4 ]
[ 120, 36 ]
python
en
['en', 'en', 'en']
True
QSToggleEntity.async_turn_on
(self, **kwargs)
Turn the device on.
Turn the device on.
async def async_turn_on(self, **kwargs): """Turn the device on.""" new = kwargs.get(ATTR_BRIGHTNESS, 255) self.hass.data[DOMAIN].devices.set_value(self.qsid, new)
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "new", "=", "kwargs", ".", "get", "(", "ATTR_BRIGHTNESS", ",", "255", ")", "self", ".", "hass", ".", "data", "[", "DOMAIN", "]", ".", "devices", ".", "set_value", "(", ...
[ 122, 4 ]
[ 125, 64 ]
python
en
['en', 'en', 'en']
True
QSToggleEntity.async_turn_off
(self, **_)
Turn the device off.
Turn the device off.
async def async_turn_off(self, **_): """Turn the device off.""" self.hass.data[DOMAIN].devices.set_value(self.qsid, 0)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "_", ")", ":", "self", ".", "hass", ".", "data", "[", "DOMAIN", "]", ".", "devices", ".", "set_value", "(", "self", ".", "qsid", ",", "0", ")" ]
[ 127, 4 ]
[ 129, 62 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the ecobee thermostat.
Set up the ecobee thermostat.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the ecobee thermostat.""" data = hass.data[DOMAIN] entities = [] for index in range(len(data.ecobee.thermostats)): thermostat = data.ecobee.get_thermostat(index) if not thermostat["modelNumber"] in ECOBEE_MO...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "entities", "=", "[", "]", "for", "index", "in", "range", "(", "len", "(", "data", ".", "e...
[ 174, 0 ]
[ 300, 5 ]
python
en
['en', 'en', 'en']
True
Thermostat.__init__
(self, data, thermostat_index, thermostat)
Initialize the thermostat.
Initialize the thermostat.
def __init__(self, data, thermostat_index, thermostat): """Initialize the thermostat.""" self.data = data self.thermostat_index = thermostat_index self.thermostat = thermostat self._name = self.thermostat["name"] self.vacation = None self._last_active_hvac_mode = ...
[ "def", "__init__", "(", "self", ",", "data", ",", "thermostat_index", ",", "thermostat", ")", ":", "self", ".", "data", "=", "data", "self", ".", "thermostat_index", "=", "thermostat_index", "self", ".", "thermostat", "=", "thermostat", "self", ".", "_name",...
[ 306, 4 ]
[ 332, 44 ]
python
en
['en', 'en', 'en']
True
Thermostat.async_update
(self)
Get the latest state from the thermostat.
Get the latest state from the thermostat.
async def async_update(self): """Get the latest state from the thermostat.""" if self.update_without_throttle: await self.data.update(no_throttle=True) self.update_without_throttle = False else: await self.data.update() self.thermostat = self.data.ecob...
[ "async", "def", "async_update", "(", "self", ")", ":", "if", "self", ".", "update_without_throttle", ":", "await", "self", ".", "data", ".", "update", "(", "no_throttle", "=", "True", ")", "self", ".", "update_without_throttle", "=", "False", "else", ":", ...
[ 334, 4 ]
[ 343, 56 ]
python
en
['en', 'en', 'en']
True
Thermostat.available
(self)
Return if device is available.
Return if device is available.
def available(self): """Return if device is available.""" return self.thermostat["runtime"]["connected"]
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "thermostat", "[", "\"runtime\"", "]", "[", "\"connected\"", "]" ]
[ 346, 4 ]
[ 348, 54 ]
python
en
['en', 'en', 'en']
True
Thermostat.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.""" if self.has_humidifier_control: return SUPPORT_FLAGS | SUPPORT_TARGET_HUMIDITY return SUPPORT_FLAGS
[ "def", "supported_features", "(", "self", ")", ":", "if", "self", ".", "has_humidifier_control", ":", "return", "SUPPORT_FLAGS", "|", "SUPPORT_TARGET_HUMIDITY", "return", "SUPPORT_FLAGS" ]
[ 351, 4 ]
[ 355, 28 ]
python
en
['en', 'en', 'en']
True
Thermostat.name
(self)
Return the name of the Ecobee Thermostat.
Return the name of the Ecobee Thermostat.
def name(self): """Return the name of the Ecobee Thermostat.""" return self.thermostat["name"]
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "thermostat", "[", "\"name\"", "]" ]
[ 358, 4 ]
[ 360, 38 ]
python
en
['en', 'en', 'en']
True
Thermostat.unique_id
(self)
Return a unique identifier for this ecobee thermostat.
Return a unique identifier for this ecobee thermostat.
def unique_id(self): """Return a unique identifier for this ecobee thermostat.""" return self.thermostat["identifier"]
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "thermostat", "[", "\"identifier\"", "]" ]
[ 363, 4 ]
[ 365, 44 ]
python
en
['en', 'en', 'en']
True
Thermostat.device_info
(self)
Return device information for this ecobee thermostat.
Return device information for this ecobee thermostat.
def device_info(self): """Return device information for this ecobee thermostat.""" try: model = f"{ECOBEE_MODEL_TO_NAME[self.thermostat['modelNumber']]} Thermostat" except KeyError: # Ecobee model is not in our list model = None return { "...
[ "def", "device_info", "(", "self", ")", ":", "try", ":", "model", "=", "f\"{ECOBEE_MODEL_TO_NAME[self.thermostat['modelNumber']]} Thermostat\"", "except", "KeyError", ":", "# Ecobee model is not in our list", "model", "=", "None", "return", "{", "\"identifiers\"", ":", "{...
[ 368, 4 ]
[ 381, 9 ]
python
en
['en', 'en', 'en']
True
Thermostat.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return TEMP_FAHRENHEIT
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_FAHRENHEIT" ]
[ 384, 4 ]
[ 386, 30 ]
python
en
['en', 'la', 'en']
True
Thermostat.precision
(self)
Return the precision of the system.
Return the precision of the system.
def precision(self) -> float: """Return the precision of the system.""" return PRECISION_TENTHS
[ "def", "precision", "(", "self", ")", "->", "float", ":", "return", "PRECISION_TENTHS" ]
[ 389, 4 ]
[ 391, 31 ]
python
en
['en', 'en', 'en']
True
Thermostat.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self.thermostat["runtime"]["actualTemperature"] / 10.0
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "thermostat", "[", "\"runtime\"", "]", "[", "\"actualTemperature\"", "]", "/", "10.0" ]
[ 394, 4 ]
[ 396, 69 ]
python
en
['en', 'la', 'en']
True
Thermostat.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_HEAT_COOL: return round(self.thermostat["runtime"]["desiredHeat"] / 10.0) return None
[ "def", "target_temperature_low", "(", "self", ")", ":", "if", "self", ".", "hvac_mode", "==", "HVAC_MODE_HEAT_COOL", ":", "return", "round", "(", "self", ".", "thermostat", "[", "\"runtime\"", "]", "[", "\"desiredHeat\"", "]", "/", "10.0", ")", "return", "No...
[ 399, 4 ]
[ 403, 19 ]
python
en
['en', 'en', 'en']
True
Thermostat.target_temperature_high
(self)
Return the upper bound temperature we try to reach.
Return the upper bound temperature we try to reach.
def target_temperature_high(self): """Return the upper bound temperature we try to reach.""" if self.hvac_mode == HVAC_MODE_HEAT_COOL: return round(self.thermostat["runtime"]["desiredCool"] / 10.0) return None
[ "def", "target_temperature_high", "(", "self", ")", ":", "if", "self", ".", "hvac_mode", "==", "HVAC_MODE_HEAT_COOL", ":", "return", "round", "(", "self", ".", "thermostat", "[", "\"runtime\"", "]", "[", "\"desiredCool\"", "]", "/", "10.0", ")", "return", "N...
[ 406, 4 ]
[ 410, 19 ]
python
en
['en', 'en', 'en']
True
Thermostat.has_humidifier_control
(self)
Return true if humidifier connected to thermostat and set to manual/on mode.
Return true if humidifier connected to thermostat and set to manual/on mode.
def has_humidifier_control(self): """Return true if humidifier connected to thermostat and set to manual/on mode.""" return ( self.thermostat["settings"]["hasHumidifier"] and self.thermostat["settings"]["humidifierMode"] == HUMIDIFIER_MANUAL_MODE )
[ "def", "has_humidifier_control", "(", "self", ")", ":", "return", "(", "self", ".", "thermostat", "[", "\"settings\"", "]", "[", "\"hasHumidifier\"", "]", "and", "self", ".", "thermostat", "[", "\"settings\"", "]", "[", "\"humidifierMode\"", "]", "==", "HUMIDI...
[ 413, 4 ]
[ 418, 9 ]
python
en
['en', 'en', 'en']
True