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
test_async_aiohttp_proxy_stream_client_err
(aioclient_mock, camera_client)
Test that it fetches the given url.
Test that it fetches the given url.
async def test_async_aiohttp_proxy_stream_client_err(aioclient_mock, camera_client): """Test that it fetches the given url.""" aioclient_mock.get("http://example.com/mjpeg_stream", exc=aiohttp.ClientError()) resp = await camera_client.get("/api/camera_proxy_stream/camera.config_test") assert resp.statu...
[ "async", "def", "test_async_aiohttp_proxy_stream_client_err", "(", "aioclient_mock", ",", "camera_client", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://example.com/mjpeg_stream\"", ",", "exc", "=", "aiohttp", ".", "ClientError", "(", ")", ")", "resp", "=", ...
[ 191, 0 ]
[ 196, 29 ]
python
en
['en', 'en', 'en']
True
test_client_session_immutable_headers
(hass)
Test we can't mutate headers.
Test we can't mutate headers.
async def test_client_session_immutable_headers(hass): """Test we can't mutate headers.""" session = client.async_get_clientsession(hass) with pytest.raises(TypeError): session.headers["user-agent"] = "bla" with pytest.raises(AttributeError): session.headers.update({"user-agent": "bla"...
[ "async", "def", "test_client_session_immutable_headers", "(", "hass", ")", ":", "session", "=", "client", ".", "async_get_clientsession", "(", "hass", ")", "with", "pytest", ".", "raises", "(", "TypeError", ")", ":", "session", ".", "headers", "[", "\"user-agent...
[ 199, 0 ]
[ 207, 53 ]
python
en
['en', 'en', 'en']
True
OndiloClient.__init__
( self, hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry, implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation, )
Initialize Ondilo ICO Auth.
Initialize Ondilo ICO Auth.
def __init__( self, hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry, implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation, ) -> None: """Initialize Ondilo ICO Auth.""" self.hass = hass self.config_entry = config_entry ...
[ "def", "__init__", "(", "self", ",", "hass", ":", "core", ".", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ",", "implementation", ":", "config_entry_oauth2_flow", ".", "AbstractOAuth2Implementation", ",", ")", "->", "None", ":"...
[ 15, 4 ]
[ 27, 44 ]
python
eo
['eo', 'sr', 'it']
False
OndiloClient.refresh_tokens
(self)
Refresh and return new Ondilo ICO tokens using Home Assistant OAuth2 session.
Refresh and return new Ondilo ICO tokens using Home Assistant OAuth2 session.
def refresh_tokens(self) -> dict: """Refresh and return new Ondilo ICO tokens using Home Assistant OAuth2 session.""" run_coroutine_threadsafe( self.session.async_ensure_token_valid(), self.hass.loop ).result() return self.session.token
[ "def", "refresh_tokens", "(", "self", ")", "->", "dict", ":", "run_coroutine_threadsafe", "(", "self", ".", "session", ".", "async_ensure_token_valid", "(", ")", ",", "self", ".", "hass", ".", "loop", ")", ".", "result", "(", ")", "return", "self", ".", ...
[ 29, 4 ]
[ 35, 33 ]
python
en
['en', 'en', 'en']
True
OndiloClient.get_all_pools_data
(self)
Fetch pools and add pool details and last measures to pool data.
Fetch pools and add pool details and last measures to pool data.
def get_all_pools_data(self) -> dict: """Fetch pools and add pool details and last measures to pool data.""" pools = self.get_pools() for pool in pools: _LOGGER.debug( "Retrieving data for pool/spa: %s, id: %d", pool["name"], pool["id"] ) pool...
[ "def", "get_all_pools_data", "(", "self", ")", "->", "dict", ":", "pools", "=", "self", ".", "get_pools", "(", ")", "for", "pool", "in", "pools", ":", "_LOGGER", ".", "debug", "(", "\"Retrieving data for pool/spa: %s, id: %d\"", ",", "pool", "[", "\"name\"", ...
[ 37, 4 ]
[ 49, 20 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up RainMachine as config entry.
Set up RainMachine as config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up RainMachine as config entry.""" hass.data.setdefault(DOMAIN, {DATA_COORDINATOR: {}}) session = aiohttp_client.async_get_clientsession(hass) client = Client( entry.data[CONF_PLACE_ID], entry.data[CONF_SERVICE...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "DATA_COORDINATOR", ":", "{", "}", "}", ")", "session", "="...
[ 21, 0 ]
[ 57, 15 ]
python
en
['en', 'en', 'en']
True
async_reload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Handle an options update.
Handle an options update.
async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: """Handle an options update.""" await hass.config_entries.async_reload(entry.entry_id)
[ "async", "def", "async_reload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "None", ":", "await", "hass", ".", "config_entries", ".", "async_reload", "(", "entry", ".", "entry_id", ")" ]
[ 60, 0 ]
[ 62, 58 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload an RainMachine config entry.
Unload an RainMachine config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload an RainMachine config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: hass.data[DOMAIN][DATA_COORDINATOR].pop(entry.entry_id) return unload_ok
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "unload_ok", "=", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "entry", ",", "PLATFORMS", ")", "if...
[ 65, 0 ]
[ 71, 20 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback, )
Set up AdGuard Home switch based on a config entry.
Set up AdGuard Home switch based on a config entry.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Set up AdGuard Home switch based on a config entry.""" adguard = hass.data[DOMAIN][entry.entry_id][DATA_ADGUARD_CLIENT] try: version = await adguard.version() ...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", ")", "->", "None", ":", "adguard", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry...
[ 23, 0 ]
[ 46, 38 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSwitch.__init__
( self, adguard: AdGuardHome, entry: ConfigEntry, name: str, icon: str, key: str, enabled_default: bool = True, )
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__( self, adguard: AdGuardHome, entry: ConfigEntry, name: str, icon: str, key: str, enabled_default: bool = True, ) -> None: """Initialize AdGuard Home switch.""" self._state = False self._key = key super().__init__(ad...
[ "def", "__init__", "(", "self", ",", "adguard", ":", "AdGuardHome", ",", "entry", ":", "ConfigEntry", ",", "name", ":", "str", ",", "icon", ":", "str", ",", "key", ":", "str", ",", "enabled_default", ":", "bool", "=", "True", ",", ")", "->", "None", ...
[ 52, 4 ]
[ 64, 69 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSwitch.unique_id
(self)
Return the unique ID for this sensor.
Return the unique ID for this sensor.
def unique_id(self) -> str: """Return the unique ID for this sensor.""" return "_".join( [DOMAIN, self.adguard.host, str(self.adguard.port), "switch", self._key] )
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "\"_\"", ".", "join", "(", "[", "DOMAIN", ",", "self", ".", "adguard", ".", "host", ",", "str", "(", "self", ".", "adguard", ".", "port", ")", ",", "\"switch\"", ",", "self", ".", ...
[ 67, 4 ]
[ 71, 9 ]
python
en
['en', 'la', 'en']
True
AdGuardHomeSwitch.is_on
(self)
Return the state of the switch.
Return the state of the switch.
def is_on(self) -> bool: """Return the state of the switch.""" return self._state
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_state" ]
[ 74, 4 ]
[ 76, 26 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSwitch.async_turn_off
(self, **kwargs)
Turn off the switch.
Turn off the switch.
async def async_turn_off(self, **kwargs) -> None: """Turn off the switch.""" try: await self._adguard_turn_off() except AdGuardHomeError: _LOGGER.error("An error occurred while turning off AdGuard Home switch") self._available = False
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "try", ":", "await", "self", ".", "_adguard_turn_off", "(", ")", "except", "AdGuardHomeError", ":", "_LOGGER", ".", "error", "(", "\"An error occurred while turning...
[ 78, 4 ]
[ 84, 35 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSwitch._adguard_turn_off
(self)
Turn off the switch.
Turn off the switch.
async def _adguard_turn_off(self) -> None: """Turn off the switch.""" raise NotImplementedError()
[ "async", "def", "_adguard_turn_off", "(", "self", ")", "->", "None", ":", "raise", "NotImplementedError", "(", ")" ]
[ 86, 4 ]
[ 88, 35 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSwitch.async_turn_on
(self, **kwargs)
Turn on the switch.
Turn on the switch.
async def async_turn_on(self, **kwargs) -> None: """Turn on the switch.""" try: await self._adguard_turn_on() except AdGuardHomeError: _LOGGER.error("An error occurred while turning on AdGuard Home switch") self._available = False
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "try", ":", "await", "self", ".", "_adguard_turn_on", "(", ")", "except", "AdGuardHomeError", ":", "_LOGGER", ".", "error", "(", "\"An error occurred while turning o...
[ 90, 4 ]
[ 96, 35 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSwitch._adguard_turn_on
(self)
Turn on the switch.
Turn on the switch.
async def _adguard_turn_on(self) -> None: """Turn on the switch.""" raise NotImplementedError()
[ "async", "def", "_adguard_turn_on", "(", "self", ")", "->", "None", ":", "raise", "NotImplementedError", "(", ")" ]
[ 98, 4 ]
[ 100, 35 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeProtectionSwitch.__init__
(self, adguard: AdGuardHome, entry: ConfigEntry)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard: AdGuardHome, entry: ConfigEntry) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, entry, "AdGuard Protection", "mdi:shield-check", "protection" )
[ "def", "__init__", "(", "self", ",", "adguard", ":", "AdGuardHome", ",", "entry", ":", "ConfigEntry", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "entry", ",", "\"AdGuard Protection\"", ",", "\"mdi:shield-check\"", ",", ...
[ 106, 4 ]
[ 110, 9 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeProtectionSwitch._adguard_turn_off
(self)
Turn off the switch.
Turn off the switch.
async def _adguard_turn_off(self) -> None: """Turn off the switch.""" await self.adguard.disable_protection()
[ "async", "def", "_adguard_turn_off", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "disable_protection", "(", ")" ]
[ 112, 4 ]
[ 114, 47 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeProtectionSwitch._adguard_turn_on
(self)
Turn on the switch.
Turn on the switch.
async def _adguard_turn_on(self) -> None: """Turn on the switch.""" await self.adguard.enable_protection()
[ "async", "def", "_adguard_turn_on", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "enable_protection", "(", ")" ]
[ 116, 4 ]
[ 118, 46 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeProtectionSwitch._adguard_update
(self)
Update AdGuard Home entity.
Update AdGuard Home entity.
async def _adguard_update(self) -> None: """Update AdGuard Home entity.""" self._state = await self.adguard.protection_enabled()
[ "async", "def", "_adguard_update", "(", "self", ")", "->", "None", ":", "self", ".", "_state", "=", "await", "self", ".", "adguard", ".", "protection_enabled", "(", ")" ]
[ 120, 4 ]
[ 122, 61 ]
python
en
['es', 'en', 'en']
True
AdGuardHomeParentalSwitch.__init__
(self, adguard: AdGuardHome, entry: ConfigEntry)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard: AdGuardHome, entry: ConfigEntry) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, entry, "AdGuard Parental Control", "mdi:shield-check", "parental" )
[ "def", "__init__", "(", "self", ",", "adguard", ":", "AdGuardHome", ",", "entry", ":", "ConfigEntry", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "entry", ",", "\"AdGuard Parental Control\"", ",", "\"mdi:shield-check\"", ...
[ 128, 4 ]
[ 132, 9 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeParentalSwitch._adguard_turn_off
(self)
Turn off the switch.
Turn off the switch.
async def _adguard_turn_off(self) -> None: """Turn off the switch.""" await self.adguard.parental.disable()
[ "async", "def", "_adguard_turn_off", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "parental", ".", "disable", "(", ")" ]
[ 134, 4 ]
[ 136, 45 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeParentalSwitch._adguard_turn_on
(self)
Turn on the switch.
Turn on the switch.
async def _adguard_turn_on(self) -> None: """Turn on the switch.""" await self.adguard.parental.enable()
[ "async", "def", "_adguard_turn_on", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "parental", ".", "enable", "(", ")" ]
[ 138, 4 ]
[ 140, 44 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeParentalSwitch._adguard_update
(self)
Update AdGuard Home entity.
Update AdGuard Home entity.
async def _adguard_update(self) -> None: """Update AdGuard Home entity.""" self._state = await self.adguard.parental.enabled()
[ "async", "def", "_adguard_update", "(", "self", ")", "->", "None", ":", "self", ".", "_state", "=", "await", "self", ".", "adguard", ".", "parental", ".", "enabled", "(", ")" ]
[ 142, 4 ]
[ 144, 59 ]
python
en
['es', 'en', 'en']
True
AdGuardHomeSafeSearchSwitch.__init__
(self, adguard: AdGuardHome, entry: ConfigEntry)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard: AdGuardHome, entry: ConfigEntry) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, entry, "AdGuard Safe Search", "mdi:shield-check", "safesearch" )
[ "def", "__init__", "(", "self", ",", "adguard", ":", "AdGuardHome", ",", "entry", ":", "ConfigEntry", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "entry", ",", "\"AdGuard Safe Search\"", ",", "\"mdi:shield-check\"", ",", ...
[ 150, 4 ]
[ 154, 9 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSafeSearchSwitch._adguard_turn_off
(self)
Turn off the switch.
Turn off the switch.
async def _adguard_turn_off(self) -> None: """Turn off the switch.""" await self.adguard.safesearch.disable()
[ "async", "def", "_adguard_turn_off", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "safesearch", ".", "disable", "(", ")" ]
[ 156, 4 ]
[ 158, 47 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSafeSearchSwitch._adguard_turn_on
(self)
Turn on the switch.
Turn on the switch.
async def _adguard_turn_on(self) -> None: """Turn on the switch.""" await self.adguard.safesearch.enable()
[ "async", "def", "_adguard_turn_on", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "safesearch", ".", "enable", "(", ")" ]
[ 160, 4 ]
[ 162, 46 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSafeSearchSwitch._adguard_update
(self)
Update AdGuard Home entity.
Update AdGuard Home entity.
async def _adguard_update(self) -> None: """Update AdGuard Home entity.""" self._state = await self.adguard.safesearch.enabled()
[ "async", "def", "_adguard_update", "(", "self", ")", "->", "None", ":", "self", ".", "_state", "=", "await", "self", ".", "adguard", ".", "safesearch", ".", "enabled", "(", ")" ]
[ 164, 4 ]
[ 166, 61 ]
python
en
['es', 'en', 'en']
True
AdGuardHomeSafeBrowsingSwitch.__init__
(self, adguard: AdGuardHome, entry: ConfigEntry)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard: AdGuardHome, entry: ConfigEntry) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, entry, "AdGuard Safe Browsing", "mdi:shield-check", "safebrowsing" )
[ "def", "__init__", "(", "self", ",", "adguard", ":", "AdGuardHome", ",", "entry", ":", "ConfigEntry", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "entry", ",", "\"AdGuard Safe Browsing\"", ",", "\"mdi:shield-check\"", ","...
[ 172, 4 ]
[ 176, 9 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSafeBrowsingSwitch._adguard_turn_off
(self)
Turn off the switch.
Turn off the switch.
async def _adguard_turn_off(self) -> None: """Turn off the switch.""" await self.adguard.safebrowsing.disable()
[ "async", "def", "_adguard_turn_off", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "safebrowsing", ".", "disable", "(", ")" ]
[ 178, 4 ]
[ 180, 49 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSafeBrowsingSwitch._adguard_turn_on
(self)
Turn on the switch.
Turn on the switch.
async def _adguard_turn_on(self) -> None: """Turn on the switch.""" await self.adguard.safebrowsing.enable()
[ "async", "def", "_adguard_turn_on", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "safebrowsing", ".", "enable", "(", ")" ]
[ 182, 4 ]
[ 184, 48 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSafeBrowsingSwitch._adguard_update
(self)
Update AdGuard Home entity.
Update AdGuard Home entity.
async def _adguard_update(self) -> None: """Update AdGuard Home entity.""" self._state = await self.adguard.safebrowsing.enabled()
[ "async", "def", "_adguard_update", "(", "self", ")", "->", "None", ":", "self", ".", "_state", "=", "await", "self", ".", "adguard", ".", "safebrowsing", ".", "enabled", "(", ")" ]
[ 186, 4 ]
[ 188, 63 ]
python
en
['es', 'en', 'en']
True
AdGuardHomeFilteringSwitch.__init__
(self, adguard: AdGuardHome, entry: ConfigEntry)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard: AdGuardHome, entry: ConfigEntry) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, entry, "AdGuard Filtering", "mdi:shield-check", "filtering" )
[ "def", "__init__", "(", "self", ",", "adguard", ":", "AdGuardHome", ",", "entry", ":", "ConfigEntry", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "entry", ",", "\"AdGuard Filtering\"", ",", "\"mdi:shield-check\"", ",", ...
[ 194, 4 ]
[ 198, 9 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeFilteringSwitch._adguard_turn_off
(self)
Turn off the switch.
Turn off the switch.
async def _adguard_turn_off(self) -> None: """Turn off the switch.""" await self.adguard.filtering.disable()
[ "async", "def", "_adguard_turn_off", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "filtering", ".", "disable", "(", ")" ]
[ 200, 4 ]
[ 202, 46 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeFilteringSwitch._adguard_turn_on
(self)
Turn on the switch.
Turn on the switch.
async def _adguard_turn_on(self) -> None: """Turn on the switch.""" await self.adguard.filtering.enable()
[ "async", "def", "_adguard_turn_on", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "filtering", ".", "enable", "(", ")" ]
[ 204, 4 ]
[ 206, 45 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeFilteringSwitch._adguard_update
(self)
Update AdGuard Home entity.
Update AdGuard Home entity.
async def _adguard_update(self) -> None: """Update AdGuard Home entity.""" self._state = await self.adguard.filtering.enabled()
[ "async", "def", "_adguard_update", "(", "self", ")", "->", "None", ":", "self", ".", "_state", "=", "await", "self", ".", "adguard", ".", "filtering", ".", "enabled", "(", ")" ]
[ 208, 4 ]
[ 210, 60 ]
python
en
['es', 'en', 'en']
True
AdGuardHomeQueryLogSwitch.__init__
(self, adguard: AdGuardHome, entry: ConfigEntry)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard: AdGuardHome, entry: ConfigEntry) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, entry, "AdGuard Query Log", "mdi:shield-check", "querylog", enabled_default=False, )
[ "def", "__init__", "(", "self", ",", "adguard", ":", "AdGuardHome", ",", "entry", ":", "ConfigEntry", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "entry", ",", "\"AdGuard Query Log\"", ",", "\"mdi:shield-check\"", ",", ...
[ 216, 4 ]
[ 225, 9 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeQueryLogSwitch._adguard_turn_off
(self)
Turn off the switch.
Turn off the switch.
async def _adguard_turn_off(self) -> None: """Turn off the switch.""" await self.adguard.querylog.disable()
[ "async", "def", "_adguard_turn_off", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "querylog", ".", "disable", "(", ")" ]
[ 227, 4 ]
[ 229, 45 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeQueryLogSwitch._adguard_turn_on
(self)
Turn on the switch.
Turn on the switch.
async def _adguard_turn_on(self) -> None: """Turn on the switch.""" await self.adguard.querylog.enable()
[ "async", "def", "_adguard_turn_on", "(", "self", ")", "->", "None", ":", "await", "self", ".", "adguard", ".", "querylog", ".", "enable", "(", ")" ]
[ 231, 4 ]
[ 233, 44 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeQueryLogSwitch._adguard_update
(self)
Update AdGuard Home entity.
Update AdGuard Home entity.
async def _adguard_update(self) -> None: """Update AdGuard Home entity.""" self._state = await self.adguard.querylog.enabled()
[ "async", "def", "_adguard_update", "(", "self", ")", "->", "None", ":", "self", ".", "_state", "=", "await", "self", ".", "adguard", ".", "querylog", ".", "enabled", "(", ")" ]
[ 235, 4 ]
[ 237, 59 ]
python
en
['es', 'en', 'en']
True
test_device_trackers
(hass: HomeAssistant, vehicle_type: str)
Test for Renault device trackers.
Test for Renault device trackers.
async def test_device_trackers(hass: HomeAssistant, vehicle_type: str): """Test for Renault device trackers.""" await async_setup_component(hass, "persistent_notification", {}) entity_registry = mock_registry(hass) device_registry = mock_device_registry(hass) with patch("homeassistant.components.re...
[ "async", "def", "test_device_trackers", "(", "hass", ":", "HomeAssistant", ",", "vehicle_type", ":", "str", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entity_registry", "=", "mock_registry", "(...
[ 25, 0 ]
[ 48, 74 ]
python
en
['fr', 'en', 'en']
True
test_device_tracker_empty
(hass: HomeAssistant, vehicle_type: str)
Test for Renault device trackers with empty data from Renault.
Test for Renault device trackers with empty data from Renault.
async def test_device_tracker_empty(hass: HomeAssistant, vehicle_type: str): """Test for Renault device trackers with empty data from Renault.""" await async_setup_component(hass, "persistent_notification", {}) entity_registry = mock_registry(hass) device_registry = mock_device_registry(hass) with ...
[ "async", "def", "test_device_tracker_empty", "(", "hass", ":", "HomeAssistant", ",", "vehicle_type", ":", "str", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entity_registry", "=", "mock_registry",...
[ 52, 0 ]
[ 78, 55 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_errors
(hass: HomeAssistant, vehicle_type: str)
Test for Renault device trackers with temporary failure.
Test for Renault device trackers with temporary failure.
async def test_device_tracker_errors(hass: HomeAssistant, vehicle_type: str): """Test for Renault device trackers with temporary failure.""" await async_setup_component(hass, "persistent_notification", {}) entity_registry = mock_registry(hass) device_registry = mock_device_registry(hass) invalid_up...
[ "async", "def", "test_device_tracker_errors", "(", "hass", ":", "HomeAssistant", ",", "vehicle_type", ":", "str", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entity_registry", "=", "mock_registry"...
[ 82, 0 ]
[ 115, 55 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_access_denied
(hass: HomeAssistant)
Test for Renault device trackers with access denied failure.
Test for Renault device trackers with access denied failure.
async def test_device_tracker_access_denied(hass: HomeAssistant): """Test for Renault device trackers with access denied failure.""" await async_setup_component(hass, "persistent_notification", {}) entity_registry = mock_registry(hass) device_registry = mock_device_registry(hass) vehicle_type = "zo...
[ "async", "def", "test_device_tracker_access_denied", "(", "hass", ":", "HomeAssistant", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entity_registry", "=", "mock_registry", "(", "hass", ")", "devic...
[ 118, 0 ]
[ 139, 45 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_not_supported
(hass: HomeAssistant)
Test for Renault device trackers with not supported failure.
Test for Renault device trackers with not supported failure.
async def test_device_tracker_not_supported(hass: HomeAssistant): """Test for Renault device trackers with not supported failure.""" await async_setup_component(hass, "persistent_notification", {}) entity_registry = mock_registry(hass) device_registry = mock_device_registry(hass) vehicle_type = "zo...
[ "async", "def", "test_device_tracker_not_supported", "(", "hass", ":", "HomeAssistant", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entity_registry", "=", "mock_registry", "(", "hass", ")", "devic...
[ 142, 0 ]
[ 163, 45 ]
python
en
['en', 'en', 'en']
True
test_full_user_flow
(hass: HomeAssistant)
Test the full user configuration flow.
Test the full user configuration flow.
async def test_full_user_flow(hass: HomeAssistant) -> None: """Test the full user configuration flow.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) assert result.get("type") == RESULT_TYPE_FORM assert result.get("step_id") == SOURCE_USER ...
[ "async", "def", "test_full_user_flow", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "SOURCE_USER"...
[ 12, 0 ]
[ 42, 46 ]
python
en
['en', 'en', 'en']
True
test_api_error
(hass: HomeAssistant)
Test we handle cannot connect error.
Test we handle cannot connect error.
async def test_api_error(hass: HomeAssistant) -> None: """Test we handle cannot connect error.""" with patch( "homeassistant.components.p1_monitor.P1Monitor.smartmeter", side_effect=P1MonitorError, ): result = await hass.config_entries.flow.async_init( DOMAIN, ...
[ "async", "def", "test_api_error", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "with", "patch", "(", "\"homeassistant.components.p1_monitor.P1Monitor.smartmeter\"", ",", "side_effect", "=", "P1MonitorError", ",", ")", ":", "result", "=", "await", "hass...
[ 45, 0 ]
[ 61, 61 ]
python
en
['en', 'en', 'en']
True
async_check_sabnzbd
(sab_api)
Check if we can reach SABnzbd.
Check if we can reach SABnzbd.
async def async_check_sabnzbd(sab_api): """Check if we can reach SABnzbd.""" try: await sab_api.check_available() return True except SabnzbdApiException: _LOGGER.error("Connection to SABnzbd API failed") return False
[ "async", "def", "async_check_sabnzbd", "(", "sab_api", ")", ":", "try", ":", "await", "sab_api", ".", "check_available", "(", ")", "return", "True", "except", "SabnzbdApiException", ":", "_LOGGER", ".", "error", "(", "\"Connection to SABnzbd API failed\"", ")", "r...
[ 162, 0 ]
[ 170, 20 ]
python
en
['en', 'en', 'en']
True
async_configure_sabnzbd
( hass, config, use_ssl, name=DEFAULT_NAME, api_key=None )
Try to configure Sabnzbd and request api key if configuration fails.
Try to configure Sabnzbd and request api key if configuration fails.
async def async_configure_sabnzbd( hass, config, use_ssl, name=DEFAULT_NAME, api_key=None ): """Try to configure Sabnzbd and request api key if configuration fails.""" host = config[CONF_HOST] port = config[CONF_PORT] web_root = config.get(CONF_PATH) uri_scheme = "https" if use_ssl else "http" ...
[ "async", "def", "async_configure_sabnzbd", "(", "hass", ",", "config", ",", "use_ssl", ",", "name", "=", "DEFAULT_NAME", ",", "api_key", "=", "None", ")", ":", "host", "=", "config", "[", "CONF_HOST", "]", "port", "=", "config", "[", "CONF_PORT", "]", "w...
[ 173, 0 ]
[ 195, 69 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the SABnzbd component.
Set up the SABnzbd component.
async def async_setup(hass, config): """Set up the SABnzbd component.""" async def sabnzbd_discovered(service, info): """Handle service discovery.""" ssl = info.get("properties", {}).get("https", "0") == "1" await async_configure_sabnzbd(hass, info, ssl) discovery.async_listen(hass...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "async", "def", "sabnzbd_discovered", "(", "service", ",", "info", ")", ":", "\"\"\"Handle service discovery.\"\"\"", "ssl", "=", "info", ".", "get", "(", "\"properties\"", ",", "{", "}", "...
[ 198, 0 ]
[ 214, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_sabnzbd
(hass, sab_api, config, name)
Set up SABnzbd sensors and services.
Set up SABnzbd sensors and services.
def async_setup_sabnzbd(hass, sab_api, config, name): """Set up SABnzbd sensors and services.""" sab_api_data = SabnzbdApiData(sab_api, name, config.get(CONF_SENSORS, {})) if config.get(CONF_SENSORS): hass.data[DATA_SABNZBD] = sab_api_data hass.async_create_task( discovery.async...
[ "def", "async_setup_sabnzbd", "(", "hass", ",", "sab_api", ",", "config", ",", "name", ")", ":", "sab_api_data", "=", "SabnzbdApiData", "(", "sab_api", ",", "name", ",", "config", ".", "get", "(", "CONF_SENSORS", ",", "{", "}", ")", ")", "if", "config", ...
[ 218, 0 ]
[ 259, 74 ]
python
en
['en', 'en', 'en']
True
async_request_configuration
(hass, config, host, web_root)
Request configuration steps from the user.
Request configuration steps from the user.
def async_request_configuration(hass, config, host, web_root): """Request configuration steps from the user.""" configurator = hass.components.configurator # We got an error if this method is called while we are configuring if host in _CONFIGURING: configurator.async_notify_errors( ...
[ "def", "async_request_configuration", "(", "hass", ",", "config", ",", "host", ",", "web_root", ")", ":", "configurator", "=", "hass", ".", "components", ".", "configurator", "# We got an error if this method is called while we are configuring", "if", "host", "in", "_CO...
[ 263, 0 ]
[ 301, 5 ]
python
en
['en', 'en', 'en']
True
SabnzbdApiData.__init__
(self, sab_api, name, sensors)
Initialize component.
Initialize component.
def __init__(self, sab_api, name, sensors): """Initialize component.""" self.sab_api = sab_api self.name = name self.sensors = sensors
[ "def", "__init__", "(", "self", ",", "sab_api", ",", "name", ",", "sensors", ")", ":", "self", ".", "sab_api", "=", "sab_api", "self", ".", "name", "=", "name", "self", ".", "sensors", "=", "sensors" ]
[ 307, 4 ]
[ 311, 30 ]
python
en
['de', 'en', 'en']
False
SabnzbdApiData.async_pause_queue
(self)
Pause Sabnzbd queue.
Pause Sabnzbd queue.
async def async_pause_queue(self): """Pause Sabnzbd queue.""" try: return await self.sab_api.pause_queue() except SabnzbdApiException as err: _LOGGER.error(err) return False
[ "async", "def", "async_pause_queue", "(", "self", ")", ":", "try", ":", "return", "await", "self", ".", "sab_api", ".", "pause_queue", "(", ")", "except", "SabnzbdApiException", "as", "err", ":", "_LOGGER", ".", "error", "(", "err", ")", "return", "False" ...
[ 313, 4 ]
[ 320, 24 ]
python
es
['fr', 'es', 'pt']
False
SabnzbdApiData.async_resume_queue
(self)
Resume Sabnzbd queue.
Resume Sabnzbd queue.
async def async_resume_queue(self): """Resume Sabnzbd queue.""" try: return await self.sab_api.resume_queue() except SabnzbdApiException as err: _LOGGER.error(err) return False
[ "async", "def", "async_resume_queue", "(", "self", ")", ":", "try", ":", "return", "await", "self", ".", "sab_api", ".", "resume_queue", "(", ")", "except", "SabnzbdApiException", "as", "err", ":", "_LOGGER", ".", "error", "(", "err", ")", "return", "False...
[ 322, 4 ]
[ 329, 24 ]
python
es
['fr', 'es', 'pt']
False
SabnzbdApiData.async_set_queue_speed
(self, limit)
Set speed limit for the Sabnzbd queue.
Set speed limit for the Sabnzbd queue.
async def async_set_queue_speed(self, limit): """Set speed limit for the Sabnzbd queue.""" try: return await self.sab_api.set_speed_limit(limit) except SabnzbdApiException as err: _LOGGER.error(err) return False
[ "async", "def", "async_set_queue_speed", "(", "self", ",", "limit", ")", ":", "try", ":", "return", "await", "self", ".", "sab_api", ".", "set_speed_limit", "(", "limit", ")", "except", "SabnzbdApiException", "as", "err", ":", "_LOGGER", ".", "error", "(", ...
[ 331, 4 ]
[ 338, 24 ]
python
en
['en', 'en', 'en']
True
SabnzbdApiData.get_queue_field
(self, field)
Return the value for the given field from the Sabnzbd queue.
Return the value for the given field from the Sabnzbd queue.
def get_queue_field(self, field): """Return the value for the given field from the Sabnzbd queue.""" return self.sab_api.queue.get(field)
[ "def", "get_queue_field", "(", "self", ",", "field", ")", ":", "return", "self", ".", "sab_api", ".", "queue", ".", "get", "(", "field", ")" ]
[ 340, 4 ]
[ 342, 44 ]
python
en
['en', 'en', 'en']
True
test_form
(hass)
Test the entire flow.
Test the entire flow.
async def test_form(hass): """Test the entire flow.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user" assert result["errors"] == {} ...
[ "async", "def", "test_form", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")", "assert",...
[ 33, 0 ]
[ 58, 48 ]
python
en
['en', 'en', 'en']
True
test_account_already_exists
(hass)
Test account already exists.
Test account already exists.
async def test_account_already_exists(hass): """Test account already exists.""" mock_config = MockConfigEntry( domain=DOMAIN, unique_id=FIXTURE_USER_INPUT[CONF_EMAIL], data=FIXTURE_USER_INPUT, ) mock_config.add_to_hass(hass) result = await hass.config_entries.flow.async_init...
[ "async", "def", "test_account_already_exists", "(", "hass", ")", ":", "mock_config", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "FIXTURE_USER_INPUT", "[", "CONF_EMAIL", "]", ",", "data", "=", "FIXTURE_USER_INPUT", ",", ")", "moc...
[ 61, 0 ]
[ 88, 52 ]
python
en
['en', 'en', 'en']
True
test_form_invalid_auth
(hass: HomeAssistant)
Test we handle invalid auth.
Test we handle invalid auth.
async def test_form_invalid_auth(hass: HomeAssistant) -> None: """Test we handle invalid auth.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] =...
[ "async", "def", "test_form_invalid_auth", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_en...
[ 91, 0 ]
[ 113, 56 ]
python
en
['en', 'en', 'en']
True
test_form_account_locked
(hass: HomeAssistant)
Test we handle account locked error.
Test we handle account locked error.
async def test_form_account_locked(hass: HomeAssistant) -> None: """Test we handle account locked error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["s...
[ "async", "def", "test_form_account_locked", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_...
[ 116, 0 ]
[ 138, 58 ]
python
en
['en', 'sr', 'en']
True
test_form_cannot_connect
(hass)
Test we handle cannot connect error.
Test we handle cannot connect error.
async def test_form_cannot_connect(hass): """Test we handle cannot connect error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.mazda.config_flow.MazdaAPI.validate_credentials", ...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", "...
[ 141, 0 ]
[ 157, 58 ]
python
en
['en', 'en', 'en']
True
test_form_unknown_error
(hass)
Test we handle unknown error.
Test we handle unknown error.
async def test_form_unknown_error(hass): """Test we handle unknown error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.mazda.config_flow.MazdaAPI.validate_credentials", side_...
[ "async", "def", "test_form_unknown_error", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")...
[ 160, 0 ]
[ 176, 51 ]
python
en
['en', 'de', 'en']
True
test_reauth_flow
(hass: HomeAssistant)
Test reauth works.
Test reauth works.
async def test_reauth_flow(hass: HomeAssistant) -> None: """Test reauth works.""" await setup.async_setup_component(hass, "persistent_notification", {}) mock_config = MockConfigEntry( domain=DOMAIN, unique_id=FIXTURE_USER_INPUT[CONF_EMAIL], data=FIXTURE_USER_INPUT, ) mock_con...
[ "async", "def", "test_reauth_flow", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "mock_config", "=", "MockConfigEntry", "(", "domai...
[ 179, 0 ]
[ 223, 55 ]
python
en
['en', 'en', 'en']
True
test_reauth_authorization_error
(hass: HomeAssistant)
Test we show user form on authorization error.
Test we show user form on authorization error.
async def test_reauth_authorization_error(hass: HomeAssistant) -> None: """Test we show user form on authorization error.""" mock_config = MockConfigEntry( domain=DOMAIN, unique_id=FIXTURE_USER_INPUT[CONF_EMAIL], data=FIXTURE_USER_INPUT, ) mock_config.add_to_hass(hass) with ...
[ "async", "def", "test_reauth_authorization_error", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "mock_config", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "FIXTURE_USER_INPUT", "[", "CONF_EMAIL", "]", ",", "data", "...
[ 226, 0 ]
[ 262, 60 ]
python
en
['en', 'en', 'en']
True
test_reauth_account_locked
(hass: HomeAssistant)
Test we show user form on account_locked error.
Test we show user form on account_locked error.
async def test_reauth_account_locked(hass: HomeAssistant) -> None: """Test we show user form on account_locked error.""" mock_config = MockConfigEntry( domain=DOMAIN, unique_id=FIXTURE_USER_INPUT[CONF_EMAIL], data=FIXTURE_USER_INPUT, ) mock_config.add_to_hass(hass) with patc...
[ "async", "def", "test_reauth_account_locked", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "mock_config", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "FIXTURE_USER_INPUT", "[", "CONF_EMAIL", "]", ",", "data", "=", ...
[ 265, 0 ]
[ 301, 62 ]
python
en
['en', 'en', 'en']
True
test_reauth_connection_error
(hass: HomeAssistant)
Test we show user form on connection error.
Test we show user form on connection error.
async def test_reauth_connection_error(hass: HomeAssistant) -> None: """Test we show user form on connection error.""" mock_config = MockConfigEntry( domain=DOMAIN, unique_id=FIXTURE_USER_INPUT[CONF_EMAIL], data=FIXTURE_USER_INPUT, ) mock_config.add_to_hass(hass) with patch(...
[ "async", "def", "test_reauth_connection_error", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "mock_config", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "FIXTURE_USER_INPUT", "[", "CONF_EMAIL", "]", ",", "data", "=",...
[ 304, 0 ]
[ 340, 62 ]
python
en
['en', 'en', 'en']
True
test_reauth_unknown_error
(hass: HomeAssistant)
Test we show user form on unknown error.
Test we show user form on unknown error.
async def test_reauth_unknown_error(hass: HomeAssistant) -> None: """Test we show user form on unknown error.""" mock_config = MockConfigEntry( domain=DOMAIN, unique_id=FIXTURE_USER_INPUT[CONF_EMAIL], data=FIXTURE_USER_INPUT, ) mock_config.add_to_hass(hass) with patch( ...
[ "async", "def", "test_reauth_unknown_error", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "mock_config", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "FIXTURE_USER_INPUT", "[", "CONF_EMAIL", "]", ",", "data", "=", ...
[ 343, 0 ]
[ 379, 55 ]
python
en
['en', 'de', 'en']
True
test_reauth_user_has_new_email_address
(hass: HomeAssistant)
Test reauth with a new email address but same account.
Test reauth with a new email address but same account.
async def test_reauth_user_has_new_email_address(hass: HomeAssistant) -> None: """Test reauth with a new email address but same account.""" mock_config = MockConfigEntry( domain=DOMAIN, unique_id=FIXTURE_USER_INPUT[CONF_EMAIL], data=FIXTURE_USER_INPUT, ) mock_config.add_to_hass(h...
[ "async", "def", "test_reauth_user_has_new_email_address", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "mock_config", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "FIXTURE_USER_INPUT", "[", "CONF_EMAIL", "]", ",", "dat...
[ 382, 0 ]
[ 422, 55 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback )
Get all cover devices and setup them via config entry.
Get all cover devices and setup them via config entry.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: """Get all cover devices and setup them via config entry.""" entities = [] for gateway in hass.data[DOMAIN][entry.entry_id]["gateways"]: for device in gateway.multi_level_swi...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ")", "->", "None", ":", "entities", "=", "[", "]", "for", "gateway", "in", "hass", ".", "data", "...
[ 24, 0 ]
[ 46, 39 ]
python
en
['en', 'pt', 'en']
True
DevoloClimateDeviceEntity.__init__
( self, homecontrol: HomeControl, device_instance: Zwave, element_uid: str )
Initialize a climate entity within devolo Home Control.
Initialize a climate entity within devolo Home Control.
def __init__( self, homecontrol: HomeControl, device_instance: Zwave, element_uid: str ) -> None: """Initialize a climate entity within devolo Home Control.""" super().__init__( homecontrol=homecontrol, device_instance=device_instance, element_uid=element_...
[ "def", "__init__", "(", "self", ",", "homecontrol", ":", "HomeControl", ",", "device_instance", ":", "Zwave", ",", "element_uid", ":", "str", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "homecontrol", "=", "homecontrol", ",", "device_i...
[ 52, 4 ]
[ 69, 50 ]
python
en
['en', 'en', 'en']
True
DevoloClimateDeviceEntity.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self) -> float | None: """Return the current temperature.""" if hasattr(self._device_instance, "multi_level_sensor_property"): return next( ( multi_level_sensor.value for multi_level_sensor in self._device_instan...
[ "def", "current_temperature", "(", "self", ")", "->", "float", "|", "None", ":", "if", "hasattr", "(", "self", ".", "_device_instance", ",", "\"multi_level_sensor_property\"", ")", ":", "return", "next", "(", "(", "multi_level_sensor", ".", "value", "for", "mu...
[ 72, 4 ]
[ 84, 19 ]
python
en
['en', 'la', 'en']
True
DevoloClimateDeviceEntity.target_temperature
(self)
Return the target temperature.
Return the target temperature.
def target_temperature(self) -> float | None: """Return the target temperature.""" return self._value
[ "def", "target_temperature", "(", "self", ")", "->", "float", "|", "None", ":", "return", "self", ".", "_value" ]
[ 87, 4 ]
[ 89, 26 ]
python
en
['en', 'la', 'en']
True
DevoloClimateDeviceEntity.set_hvac_mode
(self, hvac_mode: str)
Do nothing as devolo devices do not support changing the hvac mode.
Do nothing as devolo devices do not support changing the hvac mode.
def set_hvac_mode(self, hvac_mode: str) -> None: """Do nothing as devolo devices do not support changing the hvac mode."""
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ":", "str", ")", "->", "None", ":" ]
[ 91, 4 ]
[ 92, 81 ]
python
en
['en', 'en', 'en']
True
DevoloClimateDeviceEntity.set_temperature
(self, **kwargs: Any)
Set new target temperature.
Set new target temperature.
def set_temperature(self, **kwargs: Any) -> None: """Set new target temperature.""" self._multi_level_switch_property.set(kwargs[ATTR_TEMPERATURE])
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "self", ".", "_multi_level_switch_property", ".", "set", "(", "kwargs", "[", "ATTR_TEMPERATURE", "]", ")" ]
[ 94, 4 ]
[ 96, 71 ]
python
en
['en', 'ca', 'en']
True
str2datetime
(timestamp, tz=False)
This function translates the time stamp into a datetime object. Args: timestamp (str): the time stamp from command `zdump -v` tz (bool): True if it's UTC TimeZone. Returns: time (datetime): the datetime object about the time stamp time_string (str): the formatted time stam...
This function translates the time stamp into a datetime object.
def str2datetime(timestamp, tz=False): """ This function translates the time stamp into a datetime object. Args: timestamp (str): the time stamp from command `zdump -v` tz (bool): True if it's UTC TimeZone. Returns: time (datetime): the datetime object about the time stamp ...
[ "def", "str2datetime", "(", "timestamp", ",", "tz", "=", "False", ")", ":", "time", ",", "time_string", "=", "None", ",", "timestamp", ".", "strip", "(", ")", "# Fixed the problem that the program running this python code doesn't", "# has the corresponding TimeZone where ...
[ 36, 0 ]
[ 67, 28 ]
python
en
['en', 'error', 'th']
False
get_service
(hass, config, discovery_info=None)
Get the Synology Chat notification service.
Get the Synology Chat notification service.
def get_service(hass, config, discovery_info=None): """Get the Synology Chat notification service.""" resource = config.get(CONF_RESOURCE) verify_ssl = config.get(CONF_VERIFY_SSL) return SynologyChatNotificationService(resource, verify_ssl)
[ "def", "get_service", "(", "hass", ",", "config", ",", "discovery_info", "=", "None", ")", ":", "resource", "=", "config", ".", "get", "(", "CONF_RESOURCE", ")", "verify_ssl", "=", "config", ".", "get", "(", "CONF_VERIFY_SSL", ")", "return", "SynologyChatNot...
[ 27, 0 ]
[ 32, 64 ]
python
en
['en', 'en', 'en']
True
SynologyChatNotificationService.__init__
(self, resource, verify_ssl)
Initialize the service.
Initialize the service.
def __init__(self, resource, verify_ssl): """Initialize the service.""" self._resource = resource self._verify_ssl = verify_ssl
[ "def", "__init__", "(", "self", ",", "resource", ",", "verify_ssl", ")", ":", "self", ".", "_resource", "=", "resource", "self", ".", "_verify_ssl", "=", "verify_ssl" ]
[ 38, 4 ]
[ 41, 37 ]
python
en
['en', 'en', 'en']
True
SynologyChatNotificationService.send_message
(self, message="", **kwargs)
Send a message to a user.
Send a message to a user.
def send_message(self, message="", **kwargs): """Send a message to a user.""" data = {"text": message} extended_data = kwargs.get(ATTR_DATA) file_url = extended_data.get(ATTR_FILE_URL) if extended_data else None if file_url: data["file_url"] = file_url to_s...
[ "def", "send_message", "(", "self", ",", "message", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"text\"", ":", "message", "}", "extended_data", "=", "kwargs", ".", "get", "(", "ATTR_DATA", ")", "file_url", "=", "extended_data", ...
[ 43, 4 ]
[ 64, 13 ]
python
en
['en', 'en', 'en']
True
ModInfo.from_content
(cls, content)
A classmethod to generated a `ModInfo` object from the given `content` list. Two more keys `module_name` and `module_deps` will be created as well per the `content`. Raises: SkipException: When nothing need to check to a dict.
A classmethod to generated a `ModInfo` object from the given `content` list. Two more keys `module_name` and `module_deps` will be created as well per the `content`.
def from_content(cls, content): """ A classmethod to generated a `ModInfo` object from the given `content` list. Two more keys `module_name` and `module_deps` will be created as well per the `content`. Raises: SkipException: When nothing need to check to a dict. ...
[ "def", "from_content", "(", "cls", ",", "content", ")", ":", "if", "not", "content", ":", "raise", "SkipException", "(", "\"No Contents\"", ")", "data", "=", "{", "}", "for", "line", "in", "content", ":", "line", "=", "line", ".", "strip", "(", ")", ...
[ 43, 4 ]
[ 73, 24 ]
python
en
['en', 'error', 'th']
False
ModInfo.module_name
(self)
(str): This will return kernel module name when set, else empty str.
(str): This will return kernel module name when set, else empty str.
def module_name(self): """ (str): This will return kernel module name when set, else empty str. """ return self.get('module_name', '')
[ "def", "module_name", "(", "self", ")", ":", "return", "self", ".", "get", "(", "'module_name'", ",", "''", ")" ]
[ 76, 4 ]
[ 80, 42 ]
python
en
['en', 'error', 'th']
False
ModInfo.module_path
(self)
(str): This will return kernel module path when set, else `None`.
(str): This will return kernel module path when set, else `None`.
def module_path(self): """ (str): This will return kernel module path when set, else `None`. """ return self.get('filename', '')
[ "def", "module_path", "(", "self", ")", ":", "return", "self", ".", "get", "(", "'filename'", ",", "''", ")" ]
[ 83, 4 ]
[ 87, 39 ]
python
en
['en', 'error', 'th']
False
ModInfo.module_deps
(self)
(list): This will return the list of kernel modules depend on the kernel module when set, else `[]`.
(list): This will return the list of kernel modules depend on the kernel module when set, else `[]`.
def module_deps(self): """ (list): This will return the list of kernel modules depend on the kernel module when set, else `[]`. """ return self.get('module_deps', [])
[ "def", "module_deps", "(", "self", ")", ":", "return", "self", ".", "get", "(", "'module_deps'", ",", "[", "]", ")" ]
[ 90, 4 ]
[ 95, 42 ]
python
en
['en', 'error', 'th']
False
ModInfo.module_firmware
(self)
(list): This will return the list of firmwares used by this module when set, else `[]`.
(list): This will return the list of firmwares used by this module when set, else `[]`.
def module_firmware(self): """ (list): This will return the list of firmwares used by this module when set, else `[]`. """ return self.get('firmware', [])
[ "def", "module_firmware", "(", "self", ")", ":", "return", "self", ".", "get", "(", "'firmware'", ",", "[", "]", ")" ]
[ 98, 4 ]
[ 103, 39 ]
python
en
['en', 'error', 'th']
False
ModInfo.module_alias
(self)
(list): This will return the list of alias to this kernel module when set, else `[]`.
(list): This will return the list of alias to this kernel module when set, else `[]`.
def module_alias(self): """ (list): This will return the list of alias to this kernel module when set, else `[]`. """ return self.get('alias', [])
[ "def", "module_alias", "(", "self", ")", ":", "return", "self", ".", "get", "(", "'alias'", ",", "[", "]", ")" ]
[ 106, 4 ]
[ 111, 36 ]
python
en
['en', 'error', 'th']
False
ModInfo.module_parm
(self)
(list): This will return the list of parms for this kernel module when set, else `[]`.
(list): This will return the list of parms for this kernel module when set, else `[]`.
def module_parm(self): """ (list): This will return the list of parms for this kernel module when set, else `[]`. """ return self.get('parm', [])
[ "def", "module_parm", "(", "self", ")", ":", "return", "self", ".", "get", "(", "'parm'", ",", "[", "]", ")" ]
[ 114, 4 ]
[ 119, 35 ]
python
en
['en', 'error', 'th']
False
ModInfo.module_version
(self)
(str): This will return the kernel module version when set, else empty string.
(str): This will return the kernel module version when set, else empty string.
def module_version(self): """ (str): This will return the kernel module version when set, else empty string. """ return self.get('version', '')
[ "def", "module_version", "(", "self", ")", ":", "return", "self", ".", "get", "(", "'version'", ",", "''", ")" ]
[ 122, 4 ]
[ 126, 38 ]
python
en
['en', 'error', 'th']
False
ModInfo.module_signer
(self)
(str): This will return the signer of kernel module when set, else empty string.
(str): This will return the signer of kernel module when set, else empty string.
def module_signer(self): """ (str): This will return the signer of kernel module when set, else empty string. """ return self.get('signer', '')
[ "def", "module_signer", "(", "self", ")", ":", "return", "self", ".", "get", "(", "'signer'", ",", "''", ")" ]
[ 129, 4 ]
[ 133, 37 ]
python
en
['en', 'error', 'th']
False
ModInfo.module_details
(self)
(dict): This will return the kernel module details when set.
(dict): This will return the kernel module details when set.
def module_details(self): """ (dict): This will return the kernel module details when set. """ return self
[ "def", "module_details", "(", "self", ")", ":", "return", "self" ]
[ 136, 4 ]
[ 140, 19 ]
python
en
['en', 'error', 'th']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the pocketcasts platform for sensors.
Set up the pocketcasts platform for sensors.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the pocketcasts platform for sensors.""" username = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) try: api = pocketcasts.PocketCast(email=username, password=password) _LOGGER.debug("Found %d ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "username", "=", "config", ".", "get", "(", "CONF_USERNAME", ")", "password", "=", "config", ".", "get", "(", "CONF_PASSWORD", ")", "try...
[ 24, 0 ]
[ 35, 20 ]
python
en
['en', 'pt', 'en']
True
PocketCastsSensor.__init__
(self, api)
Initialize the sensor.
Initialize the sensor.
def __init__(self, api): """Initialize the sensor.""" self._api = api self._state = None
[ "def", "__init__", "(", "self", ",", "api", ")", ":", "self", ".", "_api", "=", "api", "self", ".", "_state", "=", "None" ]
[ 41, 4 ]
[ 44, 26 ]
python
en
['en', 'en', 'en']
True
PocketCastsSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return SENSOR_NAME
[ "def", "name", "(", "self", ")", ":", "return", "SENSOR_NAME" ]
[ 47, 4 ]
[ 49, 26 ]
python
en
['en', 'mi', 'en']
True
PocketCastsSensor.native_value
(self)
Return the sensor state.
Return the sensor state.
def native_value(self): """Return the sensor state.""" return self._state
[ "def", "native_value", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 52, 4 ]
[ 54, 26 ]
python
en
['en', 'bs', 'en']
True
PocketCastsSensor.icon
(self)
Return the icon for the sensor.
Return the icon for the sensor.
def icon(self): """Return the icon for the sensor.""" return ICON
[ "def", "icon", "(", "self", ")", ":", "return", "ICON" ]
[ 57, 4 ]
[ 59, 19 ]
python
en
['en', 'en', 'en']
True
PocketCastsSensor.update
(self)
Update sensor values.
Update sensor values.
def update(self): """Update sensor values.""" try: self._state = len(self._api.new_releases) _LOGGER.debug("Found %d new episodes", self._state) except OSError as err: _LOGGER.warning("Failed to contact server: %s", err)
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "_state", "=", "len", "(", "self", ".", "_api", ".", "new_releases", ")", "_LOGGER", ".", "debug", "(", "\"Found %d new episodes\"", ",", "self", ".", "_state", ")", "except", "OSError", ...
[ 61, 4 ]
[ 67, 64 ]
python
en
['en', 'nl', 'en']
True
setup_comp
(hass)
Set up demo component.
Set up demo component.
async def setup_comp(hass): """Set up demo component.""" assert await async_setup_component(hass, stt.DOMAIN, {"stt": {"platform": "demo"}}) await hass.async_block_till_done()
[ "async", "def", "setup_comp", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "stt", ".", "DOMAIN", ",", "{", "\"stt\"", ":", "{", "\"platform\"", ":", "\"demo\"", "}", "}", ")", "await", "hass", ".", "async_block_till_...
[ 8, 0 ]
[ 11, 38 ]
python
en
['en', 'da', 'en']
True
test_demo_settings
(hass_client)
Test retrieve settings from demo provider.
Test retrieve settings from demo provider.
async def test_demo_settings(hass_client): """Test retrieve settings from demo provider.""" client = await hass_client() response = await client.get("/api/stt/demo") response_data = await response.json() assert response.status == 200 assert response_data == { "languages": ["en", "de"],...
[ "async", "def", "test_demo_settings", "(", "hass_client", ")", ":", "client", "=", "await", "hass_client", "(", ")", "response", "=", "await", "client", ".", "get", "(", "\"/api/stt/demo\"", ")", "response_data", "=", "await", "response", ".", "json", "(", "...
[ 14, 0 ]
[ 29, 5 ]
python
en
['en', 'en', 'en']
True
test_demo_speech_no_metadata
(hass_client)
Test retrieve settings from demo provider.
Test retrieve settings from demo provider.
async def test_demo_speech_no_metadata(hass_client): """Test retrieve settings from demo provider.""" client = await hass_client() response = await client.post("/api/stt/demo", data=b"Test") assert response.status == 400
[ "async", "def", "test_demo_speech_no_metadata", "(", "hass_client", ")", ":", "client", "=", "await", "hass_client", "(", ")", "response", "=", "await", "client", ".", "post", "(", "\"/api/stt/demo\"", ",", "data", "=", "b\"Test\"", ")", "assert", "response", ...
[ 32, 0 ]
[ 37, 33 ]
python
en
['en', 'en', 'en']
True
test_demo_speech_wrong_metadata
(hass_client)
Test retrieve settings from demo provider.
Test retrieve settings from demo provider.
async def test_demo_speech_wrong_metadata(hass_client): """Test retrieve settings from demo provider.""" client = await hass_client() response = await client.post( "/api/stt/demo", headers={ "X-Speech-Content": "format=wav; codec=pcm; sample_rate=8000; bit_rate=16; channel=1; la...
[ "async", "def", "test_demo_speech_wrong_metadata", "(", "hass_client", ")", ":", "client", "=", "await", "hass_client", "(", ")", "response", "=", "await", "client", ".", "post", "(", "\"/api/stt/demo\"", ",", "headers", "=", "{", "\"X-Speech-Content\"", ":", "\...
[ 40, 0 ]
[ 51, 33 ]
python
en
['en', 'en', 'en']
True
test_demo_speech
(hass_client)
Test retrieve settings from demo provider.
Test retrieve settings from demo provider.
async def test_demo_speech(hass_client): """Test retrieve settings from demo provider.""" client = await hass_client() response = await client.post( "/api/stt/demo", headers={ "X-Speech-Content": "format=wav; codec=pcm; sample_rate=16000; bit_rate=16; channel=2; language=de" ...
[ "async", "def", "test_demo_speech", "(", "hass_client", ")", ":", "client", "=", "await", "hass_client", "(", ")", "response", "=", "await", "client", ".", "post", "(", "\"/api/stt/demo\"", ",", "headers", "=", "{", "\"X-Speech-Content\"", ":", "\"format=wav; co...
[ 54, 0 ]
[ 68, 87 ]
python
en
['en', 'en', 'en']
True