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
ChadoInstance.get_cvterm_name
(self, cv_id)
get_cvterm_name allows lookup of CV terms by their ID. This method caches the result in order to not hit the DB for every query. Maybe should investigate pre-loading popular terms? (E.g. gene, mRNA, etc)
get_cvterm_name allows lookup of CV terms by their ID. This method caches the result in order to not hit the DB for every query. Maybe should investigate pre-loading popular terms? (E.g. gene, mRNA, etc)
def get_cvterm_name(self, cv_id): """ get_cvterm_name allows lookup of CV terms by their ID. This method caches the result in order to not hit the DB for every query. Maybe should investigate pre-loading popular terms? (E.g. gene, mRNA, etc) """ if cv_id in self._...
[ "def", "get_cvterm_name", "(", "self", ",", "cv_id", ")", ":", "if", "cv_id", "in", "self", ".", "_cv_id_cache", ":", "if", "self", ".", "_cv_id_cache", "[", "cv_id", "]", "is", "not", "None", ":", "return", "self", ".", "_cv_id_cache", "[", "cv_id", "...
[ 245, 4 ]
[ 264, 46 ]
python
en
['en', 'error', 'th']
False
ChadoInstance.get_cvterm_id
(self, name, cv, allow_synonyms=False)
get_cvterm_id allows lookup of CV terms by their name. This method caches the result in order to not hit the DB for every query. Maybe should investigate pre-loading popular terms? (E.g. gene, mRNA, etc)
get_cvterm_id allows lookup of CV terms by their name. This method caches the result in order to not hit the DB for every query. Maybe should investigate pre-loading popular terms? (E.g. gene, mRNA, etc)
def get_cvterm_id(self, name, cv, allow_synonyms=False): """ get_cvterm_id allows lookup of CV terms by their name. This method caches the result in order to not hit the DB for every query. Maybe should investigate pre-loading popular terms? (E.g. gene, mRNA, etc) """ ...
[ "def", "get_cvterm_id", "(", "self", ",", "name", ",", "cv", ",", "allow_synonyms", "=", "False", ")", ":", "cvhash", "=", "cv", "+", "'____'", "+", "name", "if", "allow_synonyms", ":", "cvhash_ini", "=", "cvhash", "cvhash", "+=", "'____'", "+", "'syn'",...
[ 266, 4 ]
[ 304, 63 ]
python
en
['en', 'error', 'th']
False
ChadoInstance._preload_dbxref2cvterms
(self, cv)
This method caches all cvterms from a db in order to not hit the DB for every query.
This method caches all cvterms from a db in order to not hit the DB for every query.
def _preload_dbxref2cvterms(self, cv): """ This method caches all cvterms from a db in order to not hit the DB for every query. """ res = self.session.query(self.model.cvterm.cvterm_id, self.model.dbxref.accession) \ .join(self.model.dbxref, self.model....
[ "def", "_preload_dbxref2cvterms", "(", "self", ",", "cv", ")", ":", "res", "=", "self", ".", "session", ".", "query", "(", "self", ".", "model", ".", "cvterm", ".", "cvterm_id", ",", "self", ".", "model", ".", "dbxref", ".", "accession", ")", ".", "j...
[ 306, 4 ]
[ 320, 56 ]
python
en
['en', 'error', 'th']
False
ChadoInstance.get_pub_id
(self, name)
Allows lookup of publication by their uniquename. This method caches the result in order to not hit the DB for every query.
Allows lookup of publication by their uniquename. This method caches the result in order to not hit the DB for every query.
def get_pub_id(self, name): """ Allows lookup of publication by their uniquename. This method caches the result in order to not hit the DB for every query. """ if name in self._pub_id_cache: if self._pub_id_cache[name] is not None: return self....
[ "def", "get_pub_id", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "_pub_id_cache", ":", "if", "self", ".", "_pub_id_cache", "[", "name", "]", "is", "not", "None", ":", "return", "self", ".", "_pub_id_cache", "[", "name", "]", ...
[ 322, 4 ]
[ 342, 40 ]
python
en
['en', 'error', 'th']
False
ZwaveFlowHandler.__init__
(self)
Initialize the Z-Wave config flow.
Initialize the Z-Wave config flow.
def __init__(self): """Initialize the Z-Wave config flow.""" self.usb_path = CONF_USB_STICK_PATH
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "usb_path", "=", "CONF_USB_STICK_PATH" ]
[ 21, 4 ]
[ 23, 43 ]
python
en
['en', 'en', 'en']
True
ZwaveFlowHandler.async_step_user
(self, user_input=None)
Handle a flow start.
Handle a flow start.
async def async_step_user(self, user_input=None): """Handle a flow start.""" if self._async_current_entries(): return self.async_abort(reason="single_instance_allowed") errors = {} fields = OrderedDict() fields[ vol.Required(CONF_USB_STICK_PATH, default=...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "self", ".", "_async_current_entries", "(", ")", ":", "return", "self", ".", "async_abort", "(", "reason", "=", "\"single_instance_allowed\"", ")", "errors", "=", ...
[ 25, 4 ]
[ 80, 83 ]
python
en
['en', 'lb', 'en']
True
ZwaveFlowHandler.async_step_import
(self, info)
Import existing configuration from Z-Wave.
Import existing configuration from Z-Wave.
async def async_step_import(self, info): """Import existing configuration from Z-Wave.""" if self._async_current_entries(): return self.async_abort(reason="already_setup") return self.async_create_entry( title="Z-Wave (import from configuration.yaml)", data={...
[ "async", "def", "async_step_import", "(", "self", ",", "info", ")", ":", "if", "self", ".", "_async_current_entries", "(", ")", ":", "return", "self", ".", "async_abort", "(", "reason", "=", "\"already_setup\"", ")", "return", "self", ".", "async_create_entry"...
[ 82, 4 ]
[ 93, 9 ]
python
en
['en', 'en', 'en']
True
find_comma_decimal_point_locale
()
See if platform has a decimal point as comma locale. Find a locale that uses a comma instead of a period as the decimal point. Returns ------- old_locale: str Locale when the function was called. new_locale: {str, None) First French locale found, None if none found.
See if platform has a decimal point as comma locale.
def find_comma_decimal_point_locale(): """See if platform has a decimal point as comma locale. Find a locale that uses a comma instead of a period as the decimal point. Returns ------- old_locale: str Locale when the function was called. new_locale: {str, None) First French...
[ "def", "find_comma_decimal_point_locale", "(", ")", ":", "if", "sys", ".", "platform", "==", "'win32'", ":", "locales", "=", "[", "'FRENCH'", "]", "else", ":", "locales", "=", "[", "'fr_FR'", ",", "'fr_FR.UTF-8'", ",", "'fi_FI'", ",", "'fi_FI.UTF-8'", "]", ...
[ 11, 0 ]
[ 42, 33 ]
python
en
['en', 'en', 'en']
True
async_get_service
(hass, config, discovery_info=None)
Return the notify service.
Return the notify service.
async def async_get_service(hass, config, discovery_info=None): """Return the notify service.""" return TTSNotificationService(config)
[ "async", "def", "async_get_service", "(", "hass", ",", "config", ",", "discovery_info", "=", "None", ")", ":", "return", "TTSNotificationService", "(", "config", ")" ]
[ 29, 0 ]
[ 32, 41 ]
python
en
['en', 'en', 'en']
True
TTSNotificationService.__init__
(self, config)
Initialize the service.
Initialize the service.
def __init__(self, config): """Initialize the service.""" _, self._tts_service = split_entity_id(config[CONF_TTS_SERVICE]) self._media_player = config[CONF_MEDIA_PLAYER] self._language = config.get(ATTR_LANGUAGE)
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "_", ",", "self", ".", "_tts_service", "=", "split_entity_id", "(", "config", "[", "CONF_TTS_SERVICE", "]", ")", "self", ".", "_media_player", "=", "config", "[", "CONF_MEDIA_PLAYER", "]", "self", "....
[ 38, 4 ]
[ 42, 50 ]
python
en
['en', 'en', 'en']
True
TTSNotificationService.async_send_message
(self, message="", **kwargs)
Call TTS service to speak the notification.
Call TTS service to speak the notification.
async def async_send_message(self, message="", **kwargs): """Call TTS service to speak the notification.""" _LOGGER.debug("%s '%s' on %s", self._tts_service, message, self._media_player) data = { ATTR_MESSAGE: message, ATTR_ENTITY_ID: self._media_player, } ...
[ "async", "def", "async_send_message", "(", "self", ",", "message", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "_LOGGER", ".", "debug", "(", "\"%s '%s' on %s\"", ",", "self", ".", "_tts_service", ",", "message", ",", "self", ".", "_media_player", ")", ...
[ 44, 4 ]
[ 59, 9 ]
python
en
['en', 'en', 'en']
True
TestAdditionalPropertiesAnyType.testAdditionalPropertiesAnyType
(self)
Test AdditionalPropertiesAnyType
Test AdditionalPropertiesAnyType
def testAdditionalPropertiesAnyType(self): """Test AdditionalPropertiesAnyType""" # FIXME: construct object with mandatory attributes with example values # model = AdditionalPropertiesAnyType() # noqa: E501 pass
[ "def", "testAdditionalPropertiesAnyType", "(", "self", ")", ":", "# FIXME: construct object with mandatory attributes with example values", "# model = AdditionalPropertiesAnyType() # noqa: E501", "pass" ]
[ 29, 4 ]
[ 33, 12 ]
python
en
['en', 'ny', 'en']
False
test_sensor
(hass)
Test states of the air_quality.
Test states of the air_quality.
async def test_sensor(hass): """Test states of the air_quality.""" registry = er.async_get(hass) registry.async_get_or_create( SENSOR_DOMAIN, DOMAIN, "aa:bb:cc:dd:ee:ff-signal", suggested_object_id="nettigo_air_monitor_signal_strength", disabled_by=None, ) r...
[ "async", "def", "test_sensor", "(", "hass", ")", ":", "registry", "=", "er", ".", "async_get", "(", "hass", ")", "registry", ".", "async_get_or_create", "(", "SENSOR_DOMAIN", ",", "DOMAIN", ",", "\"aa:bb:cc:dd:ee:ff-signal\"", ",", "suggested_object_id", "=", "\...
[ 44, 0 ]
[ 319, 71 ]
python
en
['en', 'en', 'en']
True
test_sensor_disabled
(hass)
Test sensor disabled by default.
Test sensor disabled by default.
async def test_sensor_disabled(hass): """Test sensor disabled by default.""" await init_integration(hass) registry = er.async_get(hass) entry = registry.async_get("sensor.nettigo_air_monitor_signal_strength") assert entry assert entry.unique_id == "aa:bb:cc:dd:ee:ff-signal" assert entry.dis...
[ "async", "def", "test_sensor_disabled", "(", "hass", ")", ":", "await", "init_integration", "(", "hass", ")", "registry", "=", "er", ".", "async_get", "(", "hass", ")", "entry", "=", "registry", ".", "async_get", "(", "\"sensor.nettigo_air_monitor_signal_strength\...
[ 322, 0 ]
[ 339, 42 ]
python
en
['en', 'da', 'en']
True
test_incompleta_data_after_device_restart
(hass)
Test states of the air_quality after device restart.
Test states of the air_quality after device restart.
async def test_incompleta_data_after_device_restart(hass): """Test states of the air_quality after device restart.""" await init_integration(hass) state = hass.states.get("sensor.nettigo_air_monitor_heca_temperature") assert state assert state.state == "8.0" assert state.attributes.get(ATTR_DEV...
[ "async", "def", "test_incompleta_data_after_device_restart", "(", "hass", ")", ":", "await", "init_integration", "(", "hass", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "\"sensor.nettigo_air_monitor_heca_temperature\"", ")", "assert", "state", "assert"...
[ 342, 0 ]
[ 362, 43 ]
python
en
['en', 'en', 'en']
True
test_availability
(hass)
Ensure that we mark the entities unavailable correctly when device causes an error.
Ensure that we mark the entities unavailable correctly when device causes an error.
async def test_availability(hass): """Ensure that we mark the entities unavailable correctly when device causes an error.""" await init_integration(hass) state = hass.states.get("sensor.nettigo_air_monitor_bme280_temperature") assert state assert state.state != STATE_UNAVAILABLE assert state.st...
[ "async", "def", "test_availability", "(", "hass", ")", ":", "await", "init_integration", "(", "hass", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "\"sensor.nettigo_air_monitor_bme280_temperature\"", ")", "assert", "state", "assert", "state", ".", ...
[ 365, 0 ]
[ 397, 31 ]
python
en
['en', 'en', 'en']
True
test_manual_update_entity
(hass)
Test manual update entity via service homeasasistant/update_entity.
Test manual update entity via service homeasasistant/update_entity.
async def test_manual_update_entity(hass): """Test manual update entity via service homeasasistant/update_entity.""" await init_integration(hass) await async_setup_component(hass, "homeassistant", {}) with patch( "homeassistant.components.nam.NettigoAirMonitor._async_get_data", return_...
[ "async", "def", "test_manual_update_entity", "(", "hass", ")", ":", "await", "init_integration", "(", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"homeassistant\"", ",", "{", "}", ")", "with", "patch", "(", "\"homeassistant.components.nam.Nett...
[ 400, 0 ]
[ 417, 40 ]
python
en
['en', 'en', 'en']
True
test_unique_id_migration
(hass)
Test states of the unique_id migration.
Test states of the unique_id migration.
async def test_unique_id_migration(hass): """Test states of the unique_id migration.""" registry = er.async_get(hass) registry.async_get_or_create( SENSOR_DOMAIN, DOMAIN, "aa:bb:cc:dd:ee:ff-temperature", suggested_object_id="nettigo_air_monitor_dht22_temperature", di...
[ "async", "def", "test_unique_id_migration", "(", "hass", ")", ":", "registry", "=", "er", ".", "async_get", "(", "hass", ")", "registry", ".", "async_get_or_create", "(", "SENSOR_DOMAIN", ",", "DOMAIN", ",", "\"aa:bb:cc:dd:ee:ff-temperature\"", ",", "suggested_objec...
[ 420, 0 ]
[ 448, 64 ]
python
en
['en', 'en', 'en']
True
get_controller
( hass, host, username, password, port, site, verify_ssl, async_callback=None )
Create a controller object and verify authentication.
Create a controller object and verify authentication.
async def get_controller( hass, host, username, password, port, site, verify_ssl, async_callback=None ): """Create a controller object and verify authentication.""" sslcontext = None if verify_ssl: session = aiohttp_client.async_get_clientsession(hass) if isinstance(verify_ssl, str): ...
[ "async", "def", "get_controller", "(", "hass", ",", "host", ",", "username", ",", "password", ",", "port", ",", "site", ",", "verify_ssl", ",", "async_callback", "=", "None", ")", ":", "sslcontext", "=", "None", "if", "verify_ssl", ":", "session", "=", "...
[ 463, 0 ]
[ 514, 45 ]
python
en
['en', 'en', 'en']
True
UniFiController.__init__
(self, hass, config_entry)
Initialize the system.
Initialize the system.
def __init__(self, hass, config_entry): """Initialize the system.""" self.hass = hass self.config_entry = config_entry self.available = True self.api = None self.progress = None self.wireless_clients = None self.site_id: str = "" self._site_name =...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config_entry", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "config_entry", "=", "config_entry", "self", ".", "available", "=", "True", "self", ".", "api", "=", "None", "self", ".", "progre...
[ 94, 4 ]
[ 113, 26 ]
python
en
['en', 'en', 'en']
True
UniFiController.load_config_entry_options
(self)
Store attributes to avoid property call overhead since they are called frequently.
Store attributes to avoid property call overhead since they are called frequently.
def load_config_entry_options(self): """Store attributes to avoid property call overhead since they are called frequently.""" options = self.config_entry.options # Device tracker options # Config entry option to not track clients. self.option_track_clients = options.get( ...
[ "def", "load_config_entry_options", "(", "self", ")", ":", "options", "=", "self", ".", "config_entry", ".", "options", "# Device tracker options", "# Config entry option to not track clients.", "self", ".", "option_track_clients", "=", "options", ".", "get", "(", "CONF...
[ 115, 4 ]
[ 164, 9 ]
python
en
['en', 'en', 'en']
True
UniFiController.host
(self)
Return the host of this controller.
Return the host of this controller.
def host(self): """Return the host of this controller.""" return self.config_entry.data[CONF_HOST]
[ "def", "host", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "data", "[", "CONF_HOST", "]" ]
[ 167, 4 ]
[ 169, 48 ]
python
en
['en', 'en', 'en']
True
UniFiController.site
(self)
Return the site of this config entry.
Return the site of this config entry.
def site(self): """Return the site of this config entry.""" return self.config_entry.data[CONF_SITE_ID]
[ "def", "site", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "data", "[", "CONF_SITE_ID", "]" ]
[ 172, 4 ]
[ 174, 51 ]
python
en
['en', 'en', 'en']
True
UniFiController.site_name
(self)
Return the nice name of site.
Return the nice name of site.
def site_name(self): """Return the nice name of site.""" return self._site_name
[ "def", "site_name", "(", "self", ")", ":", "return", "self", ".", "_site_name" ]
[ 177, 4 ]
[ 179, 30 ]
python
en
['en', 'en', 'en']
True
UniFiController.site_role
(self)
Return the site user role of this controller.
Return the site user role of this controller.
def site_role(self): """Return the site user role of this controller.""" return self._site_role
[ "def", "site_role", "(", "self", ")", ":", "return", "self", ".", "_site_role" ]
[ 182, 4 ]
[ 184, 30 ]
python
en
['en', 'en', 'en']
True
UniFiController.mac
(self)
Return the mac address of this controller.
Return the mac address of this controller.
def mac(self): """Return the mac address of this controller.""" for client in self.api.clients.values(): if self.host == client.ip: return client.mac return None
[ "def", "mac", "(", "self", ")", ":", "for", "client", "in", "self", ".", "api", ".", "clients", ".", "values", "(", ")", ":", "if", "self", ".", "host", "==", "client", ".", "ip", ":", "return", "client", ".", "mac", "return", "None" ]
[ 187, 4 ]
[ 192, 19 ]
python
en
['en', 'en', 'en']
True
UniFiController.async_unifi_signalling_callback
(self, signal, data)
Handle messages back from UniFi library.
Handle messages back from UniFi library.
def async_unifi_signalling_callback(self, signal, data): """Handle messages back from UniFi library.""" if signal == SIGNAL_CONNECTION_STATE: if data == STATE_DISCONNECTED and self.available: LOGGER.warning("Lost connection to UniFi controller") if (data == STAT...
[ "def", "async_unifi_signalling_callback", "(", "self", ",", "signal", ",", "data", ")", ":", "if", "signal", "==", "SIGNAL_CONNECTION_STATE", ":", "if", "data", "==", "STATE_DISCONNECTED", "and", "self", ".", "available", ":", "LOGGER", ".", "warning", "(", "\...
[ 195, 4 ]
[ 259, 17 ]
python
en
['en', 'en', 'en']
True
UniFiController.signal_reachable
(self)
Integration specific event to signal a change in connection status.
Integration specific event to signal a change in connection status.
def signal_reachable(self) -> str: """Integration specific event to signal a change in connection status.""" return f"unifi-reachable-{self.config_entry.entry_id}"
[ "def", "signal_reachable", "(", "self", ")", "->", "str", ":", "return", "f\"unifi-reachable-{self.config_entry.entry_id}\"" ]
[ 262, 4 ]
[ 264, 62 ]
python
en
['en', 'en', 'en']
True
UniFiController.signal_update
(self)
Event specific per UniFi entry to signal new data.
Event specific per UniFi entry to signal new data.
def signal_update(self) -> str: """Event specific per UniFi entry to signal new data.""" return f"unifi-update-{self.config_entry.entry_id}"
[ "def", "signal_update", "(", "self", ")", "->", "str", ":", "return", "f\"unifi-update-{self.config_entry.entry_id}\"" ]
[ 267, 4 ]
[ 269, 59 ]
python
en
['en', 'en', 'it']
True
UniFiController.signal_remove
(self)
Event specific per UniFi entry to signal removal of entities.
Event specific per UniFi entry to signal removal of entities.
def signal_remove(self) -> str: """Event specific per UniFi entry to signal removal of entities.""" return f"unifi-remove-{self.config_entry.entry_id}"
[ "def", "signal_remove", "(", "self", ")", "->", "str", ":", "return", "f\"unifi-remove-{self.config_entry.entry_id}\"" ]
[ 272, 4 ]
[ 274, 59 ]
python
en
['en', 'en', 'en']
True
UniFiController.signal_options_update
(self)
Event specific per UniFi entry to signal new options.
Event specific per UniFi entry to signal new options.
def signal_options_update(self) -> str: """Event specific per UniFi entry to signal new options.""" return f"unifi-options-{self.config_entry.entry_id}"
[ "def", "signal_options_update", "(", "self", ")", "->", "str", ":", "return", "f\"unifi-options-{self.config_entry.entry_id}\"" ]
[ 277, 4 ]
[ 279, 60 ]
python
en
['en', 'en', 'en']
True
UniFiController.signal_heartbeat_missed
(self)
Event specific per UniFi device tracker to signal new heartbeat missed.
Event specific per UniFi device tracker to signal new heartbeat missed.
def signal_heartbeat_missed(self) -> str: """Event specific per UniFi device tracker to signal new heartbeat missed.""" return "unifi-heartbeat-missed"
[ "def", "signal_heartbeat_missed", "(", "self", ")", "->", "str", ":", "return", "\"unifi-heartbeat-missed\"" ]
[ 282, 4 ]
[ 284, 39 ]
python
en
['en', 'en', 'en']
True
UniFiController.update_wireless_clients
(self)
Update set of known to be wireless clients.
Update set of known to be wireless clients.
def update_wireless_clients(self): """Update set of known to be wireless clients.""" new_wireless_clients = set() for client_id in self.api.clients: if ( client_id not in self.wireless_clients and not self.api.clients[client_id].is_wired )...
[ "def", "update_wireless_clients", "(", "self", ")", ":", "new_wireless_clients", "=", "set", "(", ")", "for", "client_id", "in", "self", ".", "api", ".", "clients", ":", "if", "(", "client_id", "not", "in", "self", ".", "wireless_clients", "and", "not", "s...
[ 286, 4 ]
[ 300, 88 ]
python
en
['en', 'en', 'en']
True
UniFiController.async_setup
(self)
Set up a UniFi controller.
Set up a UniFi controller.
async def async_setup(self): """Set up a UniFi controller.""" try: self.api = await get_controller( self.hass, host=self.config_entry.data[CONF_HOST], username=self.config_entry.data[CONF_USERNAME], password=self.config_entry.da...
[ "async", "def", "async_setup", "(", "self", ")", ":", "try", ":", "self", ".", "api", "=", "await", "get_controller", "(", "self", ".", "hass", ",", "host", "=", "self", ".", "config_entry", ".", "data", "[", "CONF_HOST", "]", ",", "username", "=", "...
[ 302, 4 ]
[ 374, 19 ]
python
en
['en', 'su', 'en']
True
UniFiController.async_heartbeat
( self, unique_id: str, heartbeat_expire_time: datetime | None = None )
Signal when a device has fresh home state.
Signal when a device has fresh home state.
def async_heartbeat( self, unique_id: str, heartbeat_expire_time: datetime | None = None ) -> None: """Signal when a device has fresh home state.""" if heartbeat_expire_time is not None: self._heartbeat_time[unique_id] = heartbeat_expire_time return if unique...
[ "def", "async_heartbeat", "(", "self", ",", "unique_id", ":", "str", ",", "heartbeat_expire_time", ":", "datetime", "|", "None", "=", "None", ")", "->", "None", ":", "if", "heartbeat_expire_time", "is", "not", "None", ":", "self", ".", "_heartbeat_time", "["...
[ 377, 4 ]
[ 386, 47 ]
python
en
['en', 'en', 'en']
True
UniFiController._async_check_for_stale
(self, *_)
Check for any devices scheduled to be marked disconnected.
Check for any devices scheduled to be marked disconnected.
def _async_check_for_stale(self, *_) -> None: """Check for any devices scheduled to be marked disconnected.""" now = dt_util.utcnow() for unique_id, heartbeat_expire_time in self._heartbeat_time.items(): if now > heartbeat_expire_time: async_dispatcher_send( ...
[ "def", "_async_check_for_stale", "(", "self", ",", "*", "_", ")", "->", "None", ":", "now", "=", "dt_util", ".", "utcnow", "(", ")", "for", "unique_id", ",", "heartbeat_expire_time", "in", "self", ".", "_heartbeat_time", ".", "items", "(", ")", ":", "if"...
[ 389, 4 ]
[ 397, 17 ]
python
en
['en', 'en', 'en']
True
UniFiController.async_config_entry_updated
(hass, config_entry)
Handle signals of config entry being updated. If config entry is updated due to reauth flow the entry might already have been reset and thus is not available.
Handle signals of config entry being updated.
async def async_config_entry_updated(hass, config_entry) -> None: """Handle signals of config entry being updated. If config entry is updated due to reauth flow the entry might already have been reset and thus is not available. """ if not (controller := hass.data[UNIFI_DOMAIN].g...
[ "async", "def", "async_config_entry_updated", "(", "hass", ",", "config_entry", ")", "->", "None", ":", "if", "not", "(", "controller", ":=", "hass", ".", "data", "[", "UNIFI_DOMAIN", "]", ".", "get", "(", "config_entry", ".", "entry_id", ")", ")", ":", ...
[ 400, 4 ]
[ 409, 69 ]
python
en
['en', 'en', 'en']
True
UniFiController.reconnect
(self, log=False)
Prepare to reconnect UniFi session.
Prepare to reconnect UniFi session.
def reconnect(self, log=False) -> None: """Prepare to reconnect UniFi session.""" if log: LOGGER.info("Will try to reconnect to UniFi controller") self.hass.loop.create_task(self.async_reconnect())
[ "def", "reconnect", "(", "self", ",", "log", "=", "False", ")", "->", "None", ":", "if", "log", ":", "LOGGER", ".", "info", "(", "\"Will try to reconnect to UniFi controller\"", ")", "self", ".", "hass", ".", "loop", ".", "create_task", "(", "self", ".", ...
[ 412, 4 ]
[ 416, 58 ]
python
en
['en', 'it', 'en']
True
UniFiController.async_reconnect
(self)
Try to reconnect UniFi session.
Try to reconnect UniFi session.
async def async_reconnect(self) -> None: """Try to reconnect UniFi session.""" try: with async_timeout.timeout(5): await self.api.login() self.api.start_websocket() except ( asyncio.TimeoutError, aiounifi.BadGateway, ...
[ "async", "def", "async_reconnect", "(", "self", ")", "->", "None", ":", "try", ":", "with", "async_timeout", ".", "timeout", "(", "5", ")", ":", "await", "self", ".", "api", ".", "login", "(", ")", "self", ".", "api", ".", "start_websocket", "(", ")"...
[ 418, 4 ]
[ 431, 66 ]
python
en
['en', 'en', 'en']
True
UniFiController.shutdown
(self, event)
Wrap the call to unifi.close. Used as an argument to EventBus.async_listen_once.
Wrap the call to unifi.close.
def shutdown(self, event) -> None: """Wrap the call to unifi.close. Used as an argument to EventBus.async_listen_once. """ self.api.stop_websocket()
[ "def", "shutdown", "(", "self", ",", "event", ")", "->", "None", ":", "self", ".", "api", ".", "stop_websocket", "(", ")" ]
[ 434, 4 ]
[ 439, 33 ]
python
en
['en', 'pt', 'en']
True
UniFiController.async_reset
(self)
Reset this controller to default state. Will cancel any scheduled setup retry and will unload the config entry.
Reset this controller to default state.
async def async_reset(self): """Reset this controller to default state. Will cancel any scheduled setup retry and will unload the config entry. """ self.api.stop_websocket() unload_ok = await self.hass.config_entries.async_unload_platforms( self.config_entry...
[ "async", "def", "async_reset", "(", "self", ")", ":", "self", ".", "api", ".", "stop_websocket", "(", ")", "unload_ok", "=", "await", "self", ".", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "self", ".", "config_entry", ",", "PLATFORMS...
[ 441, 4 ]
[ 460, 19 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config, async_add_entities)
Initialize a Spider Power Plug.
Initialize a Spider Power Plug.
async def async_setup_entry(hass, config, async_add_entities): """Initialize a Spider Power Plug.""" api = hass.data[DOMAIN][config.entry_id] async_add_entities( [ SpiderPowerPlug(api, entity) for entity in await hass.async_add_executor_job(api.get_power_plugs) ] ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config", ",", "async_add_entities", ")", ":", "api", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config", ".", "entry_id", "]", "async_add_entities", "(", "[", "SpiderPowerPlug", "(", "api", "...
[ 6, 0 ]
[ 14, 5 ]
python
en
['en', 'en', 'en']
True
SpiderPowerPlug.__init__
(self, api, power_plug)
Initialize the Spider Power Plug.
Initialize the Spider Power Plug.
def __init__(self, api, power_plug): """Initialize the Spider Power Plug.""" self.api = api self.power_plug = power_plug
[ "def", "__init__", "(", "self", ",", "api", ",", "power_plug", ")", ":", "self", ".", "api", "=", "api", "self", ".", "power_plug", "=", "power_plug" ]
[ 20, 4 ]
[ 23, 36 ]
python
en
['en', 'en', 'en']
True
SpiderPowerPlug.device_info
(self)
Return the device_info of the device.
Return the device_info of the device.
def device_info(self): """Return the device_info of the device.""" return { "identifiers": {(DOMAIN, self.power_plug.id)}, "name": self.power_plug.name, "manufacturer": self.power_plug.manufacturer, "model": self.power_plug.model, }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "power_plug", ".", "id", ")", "}", ",", "\"name\"", ":", "self", ".", "power_plug", ".", "name", ",", "\"manufacturer\"", ":", "se...
[ 26, 4 ]
[ 33, 9 ]
python
en
['en', 'en', 'en']
True
SpiderPowerPlug.unique_id
(self)
Return the ID of this switch.
Return the ID of this switch.
def unique_id(self): """Return the ID of this switch.""" return self.power_plug.id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "power_plug", ".", "id" ]
[ 36, 4 ]
[ 38, 33 ]
python
en
['en', 'en', 'en']
True
SpiderPowerPlug.name
(self)
Return the name of the switch if any.
Return the name of the switch if any.
def name(self): """Return the name of the switch if any.""" return self.power_plug.name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "power_plug", ".", "name" ]
[ 41, 4 ]
[ 43, 35 ]
python
en
['en', 'en', 'en']
True
SpiderPowerPlug.is_on
(self)
Return true if switch is on. Standby is on.
Return true if switch is on. Standby is on.
def is_on(self): """Return true if switch is on. Standby is on.""" return self.power_plug.is_on
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "power_plug", ".", "is_on" ]
[ 46, 4 ]
[ 48, 36 ]
python
en
['en', 'en', 'en']
True
SpiderPowerPlug.available
(self)
Return true if switch is available.
Return true if switch is available.
def available(self): """Return true if switch is available.""" return self.power_plug.is_available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "power_plug", ".", "is_available" ]
[ 51, 4 ]
[ 53, 43 ]
python
en
['en', 'en', 'en']
True
SpiderPowerPlug.turn_on
(self, **kwargs)
Turn device on.
Turn device on.
def turn_on(self, **kwargs): """Turn device on.""" self.power_plug.turn_on()
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "power_plug", ".", "turn_on", "(", ")" ]
[ 55, 4 ]
[ 57, 33 ]
python
en
['es', 'en', 'en']
True
SpiderPowerPlug.turn_off
(self, **kwargs)
Turn device off.
Turn device off.
def turn_off(self, **kwargs): """Turn device off.""" self.power_plug.turn_off()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "power_plug", ".", "turn_off", "(", ")" ]
[ 59, 4 ]
[ 61, 34 ]
python
en
['en', 'en', 'en']
True
SpiderPowerPlug.update
(self)
Get the latest data.
Get the latest data.
def update(self): """Get the latest data.""" self.power_plug = self.api.get_power_plug(self.power_plug.id)
[ "def", "update", "(", "self", ")", ":", "self", ".", "power_plug", "=", "self", ".", "api", ".", "get_power_plug", "(", "self", ".", "power_plug", ".", "id", ")" ]
[ 63, 4 ]
[ 65, 69 ]
python
en
['en', 'en', 'en']
True
convert_until
(status_dict: dict, until_key: str)
Reformat a dt str from "%Y-%m-%dT%H:%M:%SZ" as local/aware/isoformat.
Reformat a dt str from "%Y-%m-%dT%H:%M:%SZ" as local/aware/isoformat.
def convert_until(status_dict: dict, until_key: str) -> None: """Reformat a dt str from "%Y-%m-%dT%H:%M:%SZ" as local/aware/isoformat.""" if until_key in status_dict: # only present for certain modes dt_utc_naive = dt_util.parse_datetime(status_dict[until_key]) status_dict[until_key] = dt_util....
[ "def", "convert_until", "(", "status_dict", ":", "dict", ",", "until_key", ":", "str", ")", "->", "None", ":", "if", "until_key", "in", "status_dict", ":", "# only present for certain modes", "dt_utc_naive", "=", "dt_util", ".", "parse_datetime", "(", "status_dict...
[ 111, 0 ]
[ 115, 75 ]
python
en
['en', 'sr', 'en']
True
convert_dict
(dictionary: dict[str, Any])
Recursively convert a dict's keys to snake_case.
Recursively convert a dict's keys to snake_case.
def convert_dict(dictionary: dict[str, Any]) -> dict[str, Any]: """Recursively convert a dict's keys to snake_case.""" def convert_key(key: str) -> str: """Convert a string to snake_case.""" string = re.sub(r"[\-\.\s]", "_", str(key)) return (string[0]).lower() + re.sub( r"[...
[ "def", "convert_dict", "(", "dictionary", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "dict", "[", "str", ",", "Any", "]", ":", "def", "convert_key", "(", "key", ":", "str", ")", "->", "str", ":", "\"\"\"Convert a string to snake_case.\"\"\"", "...
[ 118, 0 ]
[ 133, 5 ]
python
en
['en', 'en', 'en']
True
_handle_exception
(err)
Return False if the exception can't be ignored.
Return False if the exception can't be ignored.
def _handle_exception(err) -> bool: """Return False if the exception can't be ignored.""" try: raise err except evohomeasync2.AuthenticationError: _LOGGER.error( "Failed to authenticate with the vendor's server. " "Check your username and password. NB: Some special p...
[ "def", "_handle_exception", "(", "err", ")", "->", "bool", ":", "try", ":", "raise", "err", "except", "evohomeasync2", ".", "AuthenticationError", ":", "_LOGGER", ".", "error", "(", "\"Failed to authenticate with the vendor's server. \"", "\"Check your username and passwo...
[ 136, 0 ]
[ 174, 17 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: ConfigType)
Create a (EMEA/EU-based) Honeywell TCC system.
Create a (EMEA/EU-based) Honeywell TCC system.
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Create a (EMEA/EU-based) Honeywell TCC system.""" async def load_auth_tokens(store) -> tuple[dict, dict | None]: app_storage = await store.async_load() tokens = dict(app_storage or {}) if tokens.pop(CONF_USERNAM...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "async", "def", "load_auth_tokens", "(", "store", ")", "->", "tuple", "[", "dict", ",", "dict", "|", "None", "]", ":", "app_storag...
[ 177, 0 ]
[ 262, 15 ]
python
en
['en', 'haw', 'en']
True
setup_service_functions
(hass: HomeAssistant, broker)
Set up the service handlers for the system/zone operating modes. Not all Honeywell TCC-compatible systems support all operating modes. In addition, each mode will require any of four distinct service schemas. This has to be enumerated before registering the appropriate handlers. It appears that all TC...
Set up the service handlers for the system/zone operating modes.
def setup_service_functions(hass: HomeAssistant, broker): """Set up the service handlers for the system/zone operating modes. Not all Honeywell TCC-compatible systems support all operating modes. In addition, each mode will require any of four distinct service schemas. This has to be enumerated before ...
[ "def", "setup_service_functions", "(", "hass", ":", "HomeAssistant", ",", "broker", ")", ":", "@", "verify_domain_control", "(", "hass", ",", "DOMAIN", ")", "async", "def", "force_refresh", "(", "call", ")", "->", "None", ":", "\"\"\"Obtain the latest state data v...
[ 266, 0 ]
[ 381, 5 ]
python
en
['en', 'en', 'en']
True
EvoBroker.__init__
(self, hass, client, client_v1, store, params)
Initialize the evohome client and its data structure.
Initialize the evohome client and its data structure.
def __init__(self, hass, client, client_v1, store, params) -> None: """Initialize the evohome client and its data structure.""" self.hass = hass self.client = client self.client_v1 = client_v1 self._store = store self.params = params loc_idx = params[CONF_LOCATIO...
[ "def", "__init__", "(", "self", ",", "hass", ",", "client", ",", "client_v1", ",", "store", ",", "params", ")", "->", "None", ":", "self", ".", "hass", "=", "hass", "self", ".", "client", "=", "client", "self", ".", "client_v1", "=", "client_v1", "se...
[ 387, 4 ]
[ 401, 23 ]
python
en
['en', 'en', 'en']
True
EvoBroker.save_auth_tokens
(self)
Save access tokens and session IDs to the store for later use.
Save access tokens and session IDs to the store for later use.
async def save_auth_tokens(self) -> None: """Save access tokens and session IDs to the store for later use.""" # evohomeasync2 uses naive/local datetimes access_token_expires = _dt_local_to_aware(self.client.access_token_expires) app_storage = { CONF_USERNAME: self.client.us...
[ "async", "def", "save_auth_tokens", "(", "self", ")", "->", "None", ":", "# evohomeasync2 uses naive/local datetimes", "access_token_expires", "=", "_dt_local_to_aware", "(", "self", ".", "client", ".", "access_token_expires", ")", "app_storage", "=", "{", "CONF_USERNAM...
[ 403, 4 ]
[ 423, 49 ]
python
en
['en', 'en', 'en']
True
EvoBroker.call_client_api
(self, api_function, update_state=True)
Call a client API and update the broker state if required.
Call a client API and update the broker state if required.
async def call_client_api(self, api_function, update_state=True) -> Any: """Call a client API and update the broker state if required.""" try: result = await api_function except (aiohttp.ClientError, evohomeasync2.AuthenticationError) as err: _handle_exception(err) ...
[ "async", "def", "call_client_api", "(", "self", ",", "api_function", ",", "update_state", "=", "True", ")", "->", "Any", ":", "try", ":", "result", "=", "await", "api_function", "except", "(", "aiohttp", ".", "ClientError", ",", "evohomeasync2", ".", "Authen...
[ 425, 4 ]
[ 436, 21 ]
python
en
['en', 'en', 'en']
True
EvoBroker._update_v1_api_temps
(self, *args, **kwargs)
Get the latest high-precision temperatures of the default Location.
Get the latest high-precision temperatures of the default Location.
async def _update_v1_api_temps(self, *args, **kwargs) -> None: """Get the latest high-precision temperatures of the default Location.""" def get_session_id(client_v1) -> str | None: user_data = client_v1.user_data if client_v1 else None return user_data.get("sessionId") if user_...
[ "async", "def", "_update_v1_api_temps", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "def", "get_session_id", "(", "client_v1", ")", "->", "str", "|", "None", ":", "user_data", "=", "client_v1", ".", "user_data", "if", ...
[ 438, 4 ]
[ 477, 41 ]
python
en
['en', 'en', 'en']
True
EvoBroker._update_v2_api_state
(self, *args, **kwargs)
Get the latest modes, temperatures, setpoints of a Location.
Get the latest modes, temperatures, setpoints of a Location.
async def _update_v2_api_state(self, *args, **kwargs) -> None: """Get the latest modes, temperatures, setpoints of a Location.""" access_token = self.client.access_token loc_idx = self.params[CONF_LOCATION_IDX] try: status = await self.client.locations[loc_idx].status() ...
[ "async", "def", "_update_v2_api_state", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "access_token", "=", "self", ".", "client", ".", "access_token", "loc_idx", "=", "self", ".", "params", "[", "CONF_LOCATION_IDX", "]", ...
[ 479, 4 ]
[ 494, 41 ]
python
en
['en', 'en', 'en']
True
EvoBroker.async_update
(self, *args, **kwargs)
Get the latest state data of an entire Honeywell TCC Location. This includes state data for a Controller and all its child devices, such as the operating mode of the Controller and the current temp of its children (e.g. Zones, DHW controller).
Get the latest state data of an entire Honeywell TCC Location.
async def async_update(self, *args, **kwargs) -> None: """Get the latest state data of an entire Honeywell TCC Location. This includes state data for a Controller and all its child devices, such as the operating mode of the Controller and the current temp of its children (e.g. Zones, DH...
[ "async", "def", "async_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "self", ".", "client_v1", ":", "await", "self", ".", "_update_v1_api_temps", "(", ")", "await", "self", ".", "_update_v2_api_state", "("...
[ 496, 4 ]
[ 506, 41 ]
python
en
['en', 'en', 'en']
True
EvoDevice.__init__
(self, evo_broker, evo_device)
Initialize the evohome entity.
Initialize the evohome entity.
def __init__(self, evo_broker, evo_device) -> None: """Initialize the evohome entity.""" self._evo_device = evo_device self._evo_broker = evo_broker self._evo_tcs = evo_broker.tcs self._unique_id = self._name = self._icon = self._precision = None self._supported_features...
[ "def", "__init__", "(", "self", ",", "evo_broker", ",", "evo_device", ")", "->", "None", ":", "self", ".", "_evo_device", "=", "evo_device", "self", ".", "_evo_broker", "=", "evo_broker", "self", ".", "_evo_tcs", "=", "evo_broker", ".", "tcs", "self", ".",...
[ 516, 4 ]
[ 524, 37 ]
python
en
['en', 'en', 'en']
True
EvoDevice.async_refresh
(self, payload: dict | None = None)
Process any signals.
Process any signals.
async def async_refresh(self, payload: dict | None = None) -> None: """Process any signals.""" if payload is None: self.async_schedule_update_ha_state(force_refresh=True) return if payload["unique_id"] != self._unique_id: return if payload["service"] i...
[ "async", "def", "async_refresh", "(", "self", ",", "payload", ":", "dict", "|", "None", "=", "None", ")", "->", "None", ":", "if", "payload", "is", "None", ":", "self", ".", "async_schedule_update_ha_state", "(", "force_refresh", "=", "True", ")", "return"...
[ 526, 4 ]
[ 536, 77 ]
python
en
['en', 'en', 'en']
True
EvoDevice.async_tcs_svc_request
(self, service: dict, data: dict)
Process a service request (system mode) for a controller.
Process a service request (system mode) for a controller.
async def async_tcs_svc_request(self, service: dict, data: dict) -> None: """Process a service request (system mode) for a controller.""" raise NotImplementedError
[ "async", "def", "async_tcs_svc_request", "(", "self", ",", "service", ":", "dict", ",", "data", ":", "dict", ")", "->", "None", ":", "raise", "NotImplementedError" ]
[ 538, 4 ]
[ 540, 33 ]
python
en
['en', 'en', 'en']
True
EvoDevice.async_zone_svc_request
(self, service: dict, data: dict)
Process a service request (setpoint override) for a zone.
Process a service request (setpoint override) for a zone.
async def async_zone_svc_request(self, service: dict, data: dict) -> None: """Process a service request (setpoint override) for a zone.""" raise NotImplementedError
[ "async", "def", "async_zone_svc_request", "(", "self", ",", "service", ":", "dict", ",", "data", ":", "dict", ")", "->", "None", ":", "raise", "NotImplementedError" ]
[ 542, 4 ]
[ 544, 33 ]
python
en
['en', 'en', 'en']
True
EvoDevice.should_poll
(self)
Evohome entities should not be polled.
Evohome entities should not be polled.
def should_poll(self) -> bool: """Evohome entities should not be polled.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 547, 4 ]
[ 549, 20 ]
python
en
['en', 'en', 'en']
True
EvoDevice.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self) -> str | None: """Return a unique ID.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "_unique_id" ]
[ 552, 4 ]
[ 554, 30 ]
python
ca
['fr', 'ca', 'en']
False
EvoDevice.name
(self)
Return the name of the evohome entity.
Return the name of the evohome entity.
def name(self) -> str: """Return the name of the evohome entity.""" return self._name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_name" ]
[ 557, 4 ]
[ 559, 25 ]
python
en
['en', 'en', 'en']
True
EvoDevice.extra_state_attributes
(self)
Return the evohome-specific state attributes.
Return the evohome-specific state attributes.
def extra_state_attributes(self) -> dict[str, Any]: """Return the evohome-specific state attributes.""" status = self._device_state_attrs if "systemModeStatus" in status: convert_until(status["systemModeStatus"], "timeUntil") if "setpointStatus" in status: convert...
[ "def", "extra_state_attributes", "(", "self", ")", "->", "dict", "[", "str", ",", "Any", "]", ":", "status", "=", "self", ".", "_device_state_attrs", "if", "\"systemModeStatus\"", "in", "status", ":", "convert_until", "(", "status", "[", "\"systemModeStatus\"", ...
[ 562, 4 ]
[ 572, 47 ]
python
en
['en', 'en', 'en']
True
EvoDevice.icon
(self)
Return the icon to use in the frontend UI.
Return the icon to use in the frontend UI.
def icon(self) -> str: """Return the icon to use in the frontend UI.""" return self._icon
[ "def", "icon", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_icon" ]
[ 575, 4 ]
[ 577, 25 ]
python
en
['en', 'en', 'en']
True
EvoDevice.supported_features
(self)
Get the flag of supported features of the device.
Get the flag of supported features of the device.
def supported_features(self) -> int: """Get the flag of supported features of the device.""" return self._supported_features
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_supported_features" ]
[ 580, 4 ]
[ 582, 39 ]
python
en
['en', 'en', 'en']
True
EvoDevice.async_added_to_hass
(self)
Run when entity about to be added to hass.
Run when entity about to be added to hass.
async def async_added_to_hass(self) -> None: """Run when entity about to be added to hass.""" async_dispatcher_connect(self.hass, DOMAIN, self.async_refresh)
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "DOMAIN", ",", "self", ".", "async_refresh", ")" ]
[ 584, 4 ]
[ 586, 71 ]
python
en
['en', 'en', 'en']
True
EvoDevice.precision
(self)
Return the temperature precision to use in the frontend UI.
Return the temperature precision to use in the frontend UI.
def precision(self) -> float: """Return the temperature precision to use in the frontend UI.""" return self._precision
[ "def", "precision", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_precision" ]
[ 589, 4 ]
[ 591, 30 ]
python
en
['en', 'en', 'en']
True
EvoDevice.temperature_unit
(self)
Return the temperature unit to use in the frontend UI.
Return the temperature unit to use in the frontend UI.
def temperature_unit(self) -> str: """Return the temperature unit to use in the frontend UI.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", "->", "str", ":", "return", "TEMP_CELSIUS" ]
[ 594, 4 ]
[ 596, 27 ]
python
en
['en', 'en', 'en']
True
EvoChild.__init__
(self, evo_broker, evo_device)
Initialize a evohome Controller (hub).
Initialize a evohome Controller (hub).
def __init__(self, evo_broker, evo_device) -> None: """Initialize a evohome Controller (hub).""" super().__init__(evo_broker, evo_device) self._schedule = {} self._setpoints = {}
[ "def", "__init__", "(", "self", ",", "evo_broker", ",", "evo_device", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "evo_broker", ",", "evo_device", ")", "self", ".", "_schedule", "=", "{", "}", "self", ".", "_setpoints", "=", "{", ...
[ 605, 4 ]
[ 609, 28 ]
python
en
['es', 'en', 'it']
False
EvoChild.current_temperature
(self)
Return the current temperature of a Zone.
Return the current temperature of a Zone.
def current_temperature(self) -> float | None: """Return the current temperature of a Zone.""" if ( self._evo_broker.temps and self._evo_broker.temps[self._evo_device.zoneId] != 128 ): return self._evo_broker.temps[self._evo_device.zoneId] if self._ev...
[ "def", "current_temperature", "(", "self", ")", "->", "float", "|", "None", ":", "if", "(", "self", ".", "_evo_broker", ".", "temps", "and", "self", ".", "_evo_broker", ".", "temps", "[", "self", ".", "_evo_device", ".", "zoneId", "]", "!=", "128", ")"...
[ 612, 4 ]
[ 621, 68 ]
python
en
['en', 'en', 'en']
True
EvoChild.setpoints
(self)
Return the current/next setpoints from the schedule. Only Zones & DHW controllers (but not the TCS) can have schedules.
Return the current/next setpoints from the schedule.
def setpoints(self) -> dict[str, Any]: """Return the current/next setpoints from the schedule. Only Zones & DHW controllers (but not the TCS) can have schedules. """ def _dt_evo_to_aware(dt_naive: dt, utc_offset: timedelta) -> dt: dt_aware = dt_naive.replace(tzinfo=dt_util....
[ "def", "setpoints", "(", "self", ")", "->", "dict", "[", "str", ",", "Any", "]", ":", "def", "_dt_evo_to_aware", "(", "dt_naive", ":", "dt", ",", "utc_offset", ":", "timedelta", ")", "->", "dt", ":", "dt_aware", "=", "dt_naive", ".", "replace", "(", ...
[ 624, 4 ]
[ 681, 30 ]
python
en
['en', 'en', 'en']
True
EvoChild._update_schedule
(self)
Get the latest schedule, if any.
Get the latest schedule, if any.
async def _update_schedule(self) -> None: """Get the latest schedule, if any.""" self._schedule = await self._evo_broker.call_client_api( self._evo_device.schedule(), update_state=False ) _LOGGER.debug("Schedule['%s'] = %s", self.name, self._schedule)
[ "async", "def", "_update_schedule", "(", "self", ")", "->", "None", ":", "self", ".", "_schedule", "=", "await", "self", ".", "_evo_broker", ".", "call_client_api", "(", "self", ".", "_evo_device", ".", "schedule", "(", ")", ",", "update_state", "=", "Fals...
[ 683, 4 ]
[ 689, 71 ]
python
en
['en', 'en', 'en']
True
EvoChild.async_update
(self)
Get the latest state data.
Get the latest state data.
async def async_update(self) -> None: """Get the latest state data.""" next_sp_from = self._setpoints.get("next_sp_from", "2000-01-01T00:00:00+00:00") if dt_util.now() >= dt_util.parse_datetime(next_sp_from): await self._update_schedule() # no schedule, or it's out-of-date ...
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":", "next_sp_from", "=", "self", ".", "_setpoints", ".", "get", "(", "\"next_sp_from\"", ",", "\"2000-01-01T00:00:00+00:00\"", ")", "if", "dt_util", ".", "now", "(", ")", ">=", "dt_util", ".", ...
[ 691, 4 ]
[ 697, 64 ]
python
en
['en', 'en', 'en']
True
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 26, 0 ]
[ 28, 37 ]
python
en
['en', 'fy', 'en']
True
entity_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def entity_reg(hass): """Return an empty, loaded, registry.""" return mock_registry(hass)
[ "def", "entity_reg", "(", "hass", ")", ":", "return", "mock_registry", "(", "hass", ")" ]
[ 32, 0 ]
[ 34, 30 ]
python
en
['en', 'fy', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 38, 0 ]
[ 40, 57 ]
python
en
['en', 'en', 'en']
True
test_get_triggers
(hass, device_reg, entity_reg)
Test we get the expected triggers from a fan.
Test we get the expected triggers from a fan.
async def test_get_triggers(hass, device_reg, entity_reg): """Test we get the expected triggers from a fan.""" config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, conne...
[ "async", "def", "test_get_triggers", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "hass", ")", ...
[ 43, 0 ]
[ 69, 50 ]
python
en
['en', 'en', 'en']
True
test_get_trigger_capabilities
(hass, device_reg, entity_reg)
Test we get the expected capabilities from a switch trigger.
Test we get the expected capabilities from a switch trigger.
async def test_get_trigger_capabilities(hass, device_reg, entity_reg): """Test we get the expected capabilities from a switch trigger.""" config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config_en...
[ "async", "def", "test_get_trigger_capabilities", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "has...
[ 72, 0 ]
[ 91, 52 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_state_change
(hass, calls)
Test for turn_on and turn_off triggers firing.
Test for turn_on and turn_off triggers firing.
async def test_if_fires_on_state_change(hass, calls): """Test for turn_on and turn_off triggers firing.""" hass.states.async_set("fan.entity", STATE_OFF) assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: [ { ...
[ "async", "def", "test_if_fires_on_state_change", "(", "hass", ",", "calls", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"fan.entity\"", ",", "STATE_OFF", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN"...
[ 94, 0 ]
[ 155, 86 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_state_change_with_for
(hass, calls)
Test for triggers firing with delay.
Test for triggers firing with delay.
async def test_if_fires_on_state_change_with_for(hass, calls): """Test for triggers firing with delay.""" entity_id = "fan.entity" hass.states.async_set(entity_id, STATE_ON) assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: [ ...
[ "async", "def", "test_if_fires_on_state_change_with_for", "(", "hass", ",", "calls", ")", ":", "entity_id", "=", "\"fan.entity\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_ON", ")", "assert", "await", "async_setup_component", "(", "ha...
[ 158, 0 ]
[ 209, 5 ]
python
en
['en', 'en', 'en']
True
surepetcare
()
Mock the SurePetcare for easier testing.
Mock the SurePetcare for easier testing.
async def surepetcare(): """Mock the SurePetcare for easier testing.""" with patch("surepy.SureAPIClient", autospec=True) as mock_client_class: client = mock_client_class.return_value client.resources = {} client.call = _mock_call yield client
[ "async", "def", "surepetcare", "(", ")", ":", "with", "patch", "(", "\"surepy.SureAPIClient\"", ",", "autospec", "=", "True", ")", "as", "mock_client_class", ":", "client", "=", "mock_client_class", ".", "return_value", "client", ".", "resources", "=", "{", "}...
[ 15, 0 ]
[ 21, 20 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up a Axis light.
Set up a Axis light.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up a Axis light.""" device = hass.data[AXIS_DOMAIN][config_entry.unique_id] if ( device.api.vapix.light_control is None or len(device.api.vapix.light_control) == 0 ): return @callback def async_...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "device", "=", "hass", ".", "data", "[", "AXIS_DOMAIN", "]", "[", "config_entry", ".", "unique_id", "]", "if", "(", "device", ".", "api", ".", "vapi...
[ 16, 0 ]
[ 36, 5 ]
python
en
['en', 'lb', 'en']
True
AxisLight.__init__
(self, event, device)
Initialize the Axis light.
Initialize the Axis light.
def __init__(self, event, device): """Initialize the Axis light.""" super().__init__(event, device) self.light_id = f"led{self.event.id}" self.current_intensity = 0 self.max_intensity = 0 light_type = device.api.vapix.light_control[self.light_id].light_type sel...
[ "def", "__init__", "(", "self", ",", "event", ",", "device", ")", ":", "super", "(", ")", ".", "__init__", "(", "event", ",", "device", ")", "self", ".", "light_id", "=", "f\"led{self.event.id}\"", "self", ".", "current_intensity", "=", "0", "self", ".",...
[ 44, 4 ]
[ 57, 53 ]
python
en
['en', 'en', 'en']
True
AxisLight.async_added_to_hass
(self)
Subscribe lights events.
Subscribe lights events.
async def async_added_to_hass(self) -> None: """Subscribe lights events.""" await super().async_added_to_hass() current_intensity = ( await self.device.api.vapix.light_control.get_current_intensity( self.light_id ) ) self.current_intensity...
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "current_intensity", "=", "(", "await", "self", ".", "device", ".", "api", ".", "vapix", ".", "light_control", "."...
[ 59, 4 ]
[ 73, 71 ]
python
en
['en', 'en', 'en']
True
AxisLight.is_on
(self)
Return true if light is on.
Return true if light is on.
def is_on(self): """Return true if light is on.""" return self.event.is_tripped
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "event", ".", "is_tripped" ]
[ 76, 4 ]
[ 78, 36 ]
python
en
['en', 'et', 'en']
True
AxisLight.brightness
(self)
Return the brightness of this light between 0..255.
Return the brightness of this light between 0..255.
def brightness(self): """Return the brightness of this light between 0..255.""" return int((self.current_intensity / self.max_intensity) * 255)
[ "def", "brightness", "(", "self", ")", ":", "return", "int", "(", "(", "self", ".", "current_intensity", "/", "self", ".", "max_intensity", ")", "*", "255", ")" ]
[ 81, 4 ]
[ 83, 71 ]
python
en
['en', 'en', 'en']
True
AxisLight.async_turn_on
(self, **kwargs)
Turn on light.
Turn on light.
async def async_turn_on(self, **kwargs): """Turn on light.""" if not self.is_on: await self.device.api.vapix.light_control.activate_light(self.light_id) if ATTR_BRIGHTNESS in kwargs: intensity = int((kwargs[ATTR_BRIGHTNESS] / 255) * self.max_intensity) await ...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "is_on", ":", "await", "self", ".", "device", ".", "api", ".", "vapix", ".", "light_control", ".", "activate_light", "(", "self", ".", "light_id"...
[ 85, 4 ]
[ 94, 13 ]
python
en
['en', 'et', 'en']
True
AxisLight.async_turn_off
(self, **kwargs)
Turn off light.
Turn off light.
async def async_turn_off(self, **kwargs): """Turn off light.""" if self.is_on: await self.device.api.vapix.light_control.deactivate_light(self.light_id)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "is_on", ":", "await", "self", ".", "device", ".", "api", ".", "vapix", ".", "light_control", ".", "deactivate_light", "(", "self", ".", "light_id", ")...
[ 96, 4 ]
[ 99, 85 ]
python
en
['en', 'zh', 'en']
True
AxisLight.async_update
(self)
Update brightness.
Update brightness.
async def async_update(self): """Update brightness.""" current_intensity = ( await self.device.api.vapix.light_control.get_current_intensity( self.light_id ) ) self.current_intensity = current_intensity["data"]["intensity"]
[ "async", "def", "async_update", "(", "self", ")", ":", "current_intensity", "=", "(", "await", "self", ".", "device", ".", "api", ".", "vapix", ".", "light_control", ".", "get_current_intensity", "(", "self", ".", "light_id", ")", ")", "self", ".", "curren...
[ 101, 4 ]
[ 108, 71 ]
python
en
['en', 'sn', 'en']
False
async_setup
(hass, data, store)
Set up the onboarding view.
Set up the onboarding view.
async def async_setup(hass, data, store): """Set up the onboarding view.""" hass.http.register_view(OnboardingView(data, store)) hass.http.register_view(InstallationTypeOnboardingView(data)) hass.http.register_view(UserOnboardingView(data, store)) hass.http.register_view(CoreConfigOnboardingView(dat...
[ "async", "def", "async_setup", "(", "hass", ",", "data", ",", "store", ")", ":", "hass", ".", "http", ".", "register_view", "(", "OnboardingView", "(", "data", ",", "store", ")", ")", "hass", ".", "http", ".", "register_view", "(", "InstallationTypeOnboard...
[ 26, 0 ]
[ 33, 65 ]
python
en
['en', 'en', 'en']
True
_async_get_hass_provider
(hass)
Get the Home Assistant auth provider.
Get the Home Assistant auth provider.
def _async_get_hass_provider(hass): """Get the Home Assistant auth provider.""" for prv in hass.auth.auth_providers: if prv.type == "homeassistant": return prv raise RuntimeError("No Home Assistant provider found")
[ "def", "_async_get_hass_provider", "(", "hass", ")", ":", "for", "prv", "in", "hass", ".", "auth", ".", "auth_providers", ":", "if", "prv", ".", "type", "==", "\"homeassistant\"", ":", "return", "prv", "raise", "RuntimeError", "(", "\"No Home Assistant provider ...
[ 268, 0 ]
[ 274, 58 ]
python
en
['en', 'en', 'en']
True
OnboardingView.__init__
(self, data, store)
Initialize the onboarding view.
Initialize the onboarding view.
def __init__(self, data, store): """Initialize the onboarding view.""" self._store = store self._data = data
[ "def", "__init__", "(", "self", ",", "data", ",", "store", ")", ":", "self", ".", "_store", "=", "store", "self", ".", "_data", "=", "data" ]
[ 43, 4 ]
[ 46, 25 ]
python
en
['en', 'en', 'en']
True
OnboardingView.get
(self, request)
Return the onboarding status.
Return the onboarding status.
async def get(self, request): """Return the onboarding status.""" return self.json( [{"step": key, "done": key in self._data["done"]} for key in STEPS] )
[ "async", "def", "get", "(", "self", ",", "request", ")", ":", "return", "self", ".", "json", "(", "[", "{", "\"step\"", ":", "key", ",", "\"done\"", ":", "key", "in", "self", ".", "_data", "[", "\"done\"", "]", "}", "for", "key", "in", "STEPS", "...
[ 48, 4 ]
[ 52, 9 ]
python
en
['en', 'af', 'en']
True