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
Integration._import_platform
(self, platform_name: str)
Import the platform.
Import the platform.
def _import_platform(self, platform_name: str) -> ModuleType: """Import the platform.""" return importlib.import_module(f"{self.pkg_path}.{platform_name}")
[ "def", "_import_platform", "(", "self", ",", "platform_name", ":", "str", ")", "->", "ModuleType", ":", "return", "importlib", ".", "import_module", "(", "f\"{self.pkg_path}.{platform_name}\"", ")" ]
[ 526, 4 ]
[ 528, 74 ]
python
en
['en', 'da', 'en']
True
Integration.__repr__
(self)
Text representation of class.
Text representation of class.
def __repr__(self) -> str: """Text representation of class.""" return f"<Integration {self.domain}: {self.pkg_path}>"
[ "def", "__repr__", "(", "self", ")", "->", "str", ":", "return", "f\"<Integration {self.domain}: {self.pkg_path}>\"" ]
[ 530, 4 ]
[ 532, 62 ]
python
en
['en', 'en', 'en']
True
IntegrationNotFound.__init__
(self, domain: str)
Initialize a component not found error.
Initialize a component not found error.
def __init__(self, domain: str) -> None: """Initialize a component not found error.""" super().__init__(f"Integration '{domain}' not found.") self.domain = domain
[ "def", "__init__", "(", "self", ",", "domain", ":", "str", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "f\"Integration '{domain}' not found.\"", ")", "self", ".", "domain", "=", "domain" ]
[ 596, 4 ]
[ 599, 28 ]
python
en
['en', 'en', 'en']
True
CircularDependency.__init__
(self, from_domain: str, to_domain: str)
Initialize circular dependency error.
Initialize circular dependency error.
def __init__(self, from_domain: str, to_domain: str) -> None: """Initialize circular dependency error.""" super().__init__(f"Circular dependency detected: {from_domain} -> {to_domain}.") self.from_domain = from_domain self.to_domain = to_domain
[ "def", "__init__", "(", "self", ",", "from_domain", ":", "str", ",", "to_domain", ":", "str", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "f\"Circular dependency detected: {from_domain} -> {to_domain}.\"", ")", "self", ".", "from_domain", "=...
[ 605, 4 ]
[ 609, 34 ]
python
da
['da', 'nl', 'en']
False
ModuleWrapper.__init__
(self, hass: HomeAssistant, module: ModuleType)
Initialize the module wrapper.
Initialize the module wrapper.
def __init__(self, hass: HomeAssistant, module: ModuleType) -> None: """Initialize the module wrapper.""" self._hass = hass self._module = module
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "module", ":", "ModuleType", ")", "->", "None", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_module", "=", "module" ]
[ 672, 4 ]
[ 675, 29 ]
python
en
['en', 'en', 'en']
True
ModuleWrapper.__getattr__
(self, attr: str)
Fetch an attribute.
Fetch an attribute.
def __getattr__(self, attr: str) -> Any: """Fetch an attribute.""" value = getattr(self._module, attr) if hasattr(value, "__bind_hass"): value = ft.partial(value, self._hass) setattr(self, attr, value) return value
[ "def", "__getattr__", "(", "self", ",", "attr", ":", "str", ")", "->", "Any", ":", "value", "=", "getattr", "(", "self", ".", "_module", ",", "attr", ")", "if", "hasattr", "(", "value", ",", "\"__bind_hass\"", ")", ":", "value", "=", "ft", ".", "pa...
[ 677, 4 ]
[ 685, 20 ]
python
en
['en', 'co', 'en']
True
Components.__init__
(self, hass: HomeAssistant)
Initialize the Components class.
Initialize the Components class.
def __init__(self, hass: HomeAssistant) -> None: """Initialize the Components class.""" self._hass = hass
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "self", ".", "_hass", "=", "hass" ]
[ 691, 4 ]
[ 693, 25 ]
python
en
['en', 'en', 'en']
True
Components.__getattr__
(self, comp_name: str)
Fetch a component.
Fetch a component.
def __getattr__(self, comp_name: str) -> ModuleWrapper: """Fetch a component.""" # Test integration cache integration = self._hass.data.get(DATA_INTEGRATIONS, {}).get(comp_name) if isinstance(integration, Integration): component: ModuleType | None = integration.get_component...
[ "def", "__getattr__", "(", "self", ",", "comp_name", ":", "str", ")", "->", "ModuleWrapper", ":", "# Test integration cache", "integration", "=", "self", ".", "_hass", ".", "data", ".", "get", "(", "DATA_INTEGRATIONS", ",", "{", "}", ")", ".", "get", "(", ...
[ 695, 4 ]
[ 711, 22 ]
python
en
['en', 'en', 'en']
True
Helpers.__init__
(self, hass: HomeAssistant)
Initialize the Helpers class.
Initialize the Helpers class.
def __init__(self, hass: HomeAssistant) -> None: """Initialize the Helpers class.""" self._hass = hass
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "self", ".", "_hass", "=", "hass" ]
[ 717, 4 ]
[ 719, 25 ]
python
en
['en', 'en', 'en']
True
Helpers.__getattr__
(self, helper_name: str)
Fetch a helper.
Fetch a helper.
def __getattr__(self, helper_name: str) -> ModuleWrapper: """Fetch a helper.""" helper = importlib.import_module(f"homeassistant.helpers.{helper_name}") wrapped = ModuleWrapper(self._hass, helper) setattr(self, helper_name, wrapped) return wrapped
[ "def", "__getattr__", "(", "self", ",", "helper_name", ":", "str", ")", "->", "ModuleWrapper", ":", "helper", "=", "importlib", ".", "import_module", "(", "f\"homeassistant.helpers.{helper_name}\"", ")", "wrapped", "=", "ModuleWrapper", "(", "self", ".", "_hass", ...
[ 721, 4 ]
[ 726, 22 ]
python
en
['en', 'co', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info)
Set up Netgear LTE binary sensor devices.
Set up Netgear LTE binary sensor devices.
async def async_setup_platform(hass, config, async_add_entities, discovery_info): """Set up Netgear LTE binary sensor devices.""" if discovery_info is None: return modem_data = hass.data[DATA_KEY].get_modem_data(discovery_info) if not modem_data or not modem_data.data: raise PlatformNo...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "modem_data", "=", "hass", ".", "data", "[", "DATA_KEY", "]", ".", "get_modem_d...
[ 8, 0 ]
[ 25, 38 ]
python
en
['en', 'haw', 'en']
True
LTEBinarySensor.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self): """Return true if the binary sensor is on.""" return getattr(self.modem_data.data, self.sensor_type)
[ "def", "is_on", "(", "self", ")", ":", "return", "getattr", "(", "self", ".", "modem_data", ".", "data", ",", "self", ".", "sensor_type", ")" ]
[ 32, 4 ]
[ 34, 62 ]
python
en
['en', 'fy', 'en']
True
LTEBinarySensor.device_class
(self)
Return the class of binary sensor.
Return the class of binary sensor.
def device_class(self): """Return the class of binary sensor.""" return BINARY_SENSOR_CLASSES[self.sensor_type]
[ "def", "device_class", "(", "self", ")", ":", "return", "BINARY_SENSOR_CLASSES", "[", "self", ".", "sensor_type", "]" ]
[ 37, 4 ]
[ 39, 54 ]
python
en
['en', 'ku', 'en']
True
configured_servers
(hass)
Return a set of the configured Plex servers.
Return a set of the configured Plex servers.
def configured_servers(hass): """Return a set of the configured Plex servers.""" return { entry.data[CONF_SERVER_IDENTIFIER] for entry in hass.config_entries.async_entries(DOMAIN) }
[ "def", "configured_servers", "(", "hass", ")", ":", "return", "{", "entry", ".", "data", "[", "CONF_SERVER_IDENTIFIER", "]", "for", "entry", "in", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ")", "}" ]
[ 60, 0 ]
[ 65, 5 ]
python
en
['en', 'ca', 'en']
True
async_discover
(hass)
Scan for available Plex servers.
Scan for available Plex servers.
async def async_discover(hass): """Scan for available Plex servers.""" gdm = GDM() await hass.async_add_executor_job(gdm.scan) for server_data in gdm.entries: await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: config_entries.SOURCE_INTEGRATION_DISCOV...
[ "async", "def", "async_discover", "(", "hass", ")", ":", "gdm", "=", "GDM", "(", ")", "await", "hass", ".", "async_add_executor_job", "(", "gdm", ".", "scan", ")", "for", "server_data", "in", "gdm", ".", "entries", ":", "await", "hass", ".", "config_entr...
[ 68, 0 ]
[ 77, 9 ]
python
en
['en', 'en', 'en']
True
PlexFlowHandler.async_get_options_flow
(config_entry)
Get the options flow for this handler.
Get the options flow for this handler.
def async_get_options_flow(config_entry): """Get the options flow for this handler.""" return PlexOptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "PlexOptionsFlowHandler", "(", "config_entry", ")" ]
[ 87, 4 ]
[ 89, 51 ]
python
en
['en', 'en', 'en']
True
PlexFlowHandler.__init__
(self)
Initialize the Plex flow.
Initialize the Plex flow.
def __init__(self): """Initialize the Plex flow.""" self.current_login = {} self.available_servers = None self.plexauth = None self.token = None self.client_id = None self._manual = False
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "current_login", "=", "{", "}", "self", ".", "available_servers", "=", "None", "self", ".", "plexauth", "=", "None", "self", ".", "token", "=", "None", "self", ".", "client_id", "=", "None", "self"...
[ 91, 4 ]
[ 98, 28 ]
python
en
['en', 'pl', 'en']
True
PlexFlowHandler.async_step_user
( self, user_input=None, errors=None )
Handle a flow initialized by the user.
Handle a flow initialized by the user.
async def async_step_user( self, user_input=None, errors=None ): # pylint: disable=arguments-differ """Handle a flow initialized by the user.""" if user_input is not None: return await self.async_step_plex_website_auth() if self.show_advanced_options: return ...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ",", "errors", "=", "None", ")", ":", "# pylint: disable=arguments-differ", "if", "user_input", "is", "not", "None", ":", "return", "await", "self", ".", "async_step_plex_website_auth"...
[ 100, 4 ]
[ 108, 66 ]
python
en
['en', 'en', 'en']
True
PlexFlowHandler.async_step_user_advanced
(self, user_input=None, errors=None)
Handle an advanced mode flow initialized by the user.
Handle an advanced mode flow initialized by the user.
async def async_step_user_advanced(self, user_input=None, errors=None): """Handle an advanced mode flow initialized by the user.""" if user_input is not None: if user_input.get("setup_method") == MANUAL_SETUP_STRING: self._manual = True return await self.async...
[ "async", "def", "async_step_user_advanced", "(", "self", ",", "user_input", "=", "None", ",", "errors", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "if", "user_input", ".", "get", "(", "\"setup_method\"", ")", "==", "MANUAL_SETUP_STR...
[ 110, 4 ]
[ 127, 9 ]
python
en
['en', 'en', 'en']
True
PlexFlowHandler.async_step_manual_setup
(self, user_input=None, errors=None)
Begin manual configuration.
Begin manual configuration.
async def async_step_manual_setup(self, user_input=None, errors=None): """Begin manual configuration.""" if user_input is not None and errors is None: user_input.pop(CONF_URL, None) host = user_input.get(CONF_HOST) if host: port = user_input[CONF_PORT]...
[ "async", "def", "async_step_manual_setup", "(", "self", ",", "user_input", "=", "None", ",", "errors", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", "and", "errors", "is", "None", ":", "user_input", ".", "pop", "(", "CONF_URL", ",", "No...
[ 129, 4 ]
[ 170, 9 ]
python
en
['en', 'ca', 'en']
True
PlexFlowHandler.async_step_server_validate
(self, server_config)
Validate a provided configuration.
Validate a provided configuration.
async def async_step_server_validate(self, server_config): """Validate a provided configuration.""" errors = {} self.current_login = server_config plex_server = PlexServer(self.hass, server_config) try: await self.hass.async_add_executor_job(plex_server.connect) ...
[ "async", "def", "async_step_server_validate", "(", "self", ",", "server_config", ")", ":", "errors", "=", "{", "}", "self", ".", "current_login", "=", "server_config", "plex_server", "=", "PlexServer", "(", "self", ".", "hass", ",", "server_config", ")", "try"...
[ 172, 4 ]
[ 243, 60 ]
python
en
['en', 'en', 'en']
True
PlexFlowHandler.async_step_select_server
(self, user_input=None)
Use selected Plex server.
Use selected Plex server.
async def async_step_select_server(self, user_input=None): """Use selected Plex server.""" config = dict(self.current_login) if user_input is not None: config[CONF_SERVER] = user_input[CONF_SERVER] return await self.async_step_server_validate(config) configured =...
[ "async", "def", "async_step_select_server", "(", "self", ",", "user_input", "=", "None", ")", ":", "config", "=", "dict", "(", "self", ".", "current_login", ")", "if", "user_input", "is", "not", "None", ":", "config", "[", "CONF_SERVER", "]", "=", "user_in...
[ 245, 4 ]
[ 271, 9 ]
python
en
['en', 'en', 'en']
True
PlexFlowHandler.async_step_integration_discovery
(self, discovery_info)
Handle GDM discovery.
Handle GDM discovery.
async def async_step_integration_discovery(self, discovery_info): """Handle GDM discovery.""" machine_identifier = discovery_info["data"]["Resource-Identifier"] await self.async_set_unique_id(machine_identifier) self._abort_if_unique_id_configured() host = f"{discovery_info['from...
[ "async", "def", "async_step_integration_discovery", "(", "self", ",", "discovery_info", ")", ":", "machine_identifier", "=", "discovery_info", "[", "\"data\"", "]", "[", "\"Resource-Identifier\"", "]", "await", "self", ".", "async_set_unique_id", "(", "machine_identifie...
[ 273, 4 ]
[ 284, 43 ]
python
en
['en', 'en', 'en']
True
PlexFlowHandler.async_step_plex_website_auth
(self)
Begin external auth flow on Plex website.
Begin external auth flow on Plex website.
async def async_step_plex_website_auth(self): """Begin external auth flow on Plex website.""" self.hass.http.register_view(PlexAuthorizationCallbackView) if (req := http.current_request.get()) is None: raise RuntimeError("No current request in context") if (hass_url := req.he...
[ "async", "def", "async_step_plex_website_auth", "(", "self", ")", ":", "self", ".", "hass", ".", "http", ".", "register_view", "(", "PlexAuthorizationCallbackView", ")", "if", "(", "req", ":=", "http", ".", "current_request", ".", "get", "(", ")", ")", "is",...
[ 286, 4 ]
[ 308, 77 ]
python
en
['en', 'lb', 'en']
True
PlexFlowHandler.async_step_obtain_token
(self, user_input=None)
Obtain token after external auth completed.
Obtain token after external auth completed.
async def async_step_obtain_token(self, user_input=None): """Obtain token after external auth completed.""" token = await self.plexauth.token(10) if not token: return self.async_external_step_done(next_step_id="timed_out") self.token = token self.client_id = self.pl...
[ "async", "def", "async_step_obtain_token", "(", "self", ",", "user_input", "=", "None", ")", ":", "token", "=", "await", "self", ".", "plexauth", ".", "token", "(", "10", ")", "if", "not", "token", ":", "return", "self", ".", "async_external_step_done", "(...
[ 310, 4 ]
[ 319, 79 ]
python
en
['da', 'en', 'en']
True
PlexFlowHandler.async_step_timed_out
(self, user_input=None)
Abort flow when time expires.
Abort flow when time expires.
async def async_step_timed_out(self, user_input=None): """Abort flow when time expires.""" return self.async_abort(reason="token_request_timeout")
[ "async", "def", "async_step_timed_out", "(", "self", ",", "user_input", "=", "None", ")", ":", "return", "self", ".", "async_abort", "(", "reason", "=", "\"token_request_timeout\"", ")" ]
[ 321, 4 ]
[ 323, 63 ]
python
en
['en', 'en', 'en']
True
PlexFlowHandler.async_step_use_external_token
(self, user_input=None)
Continue server validation with external token.
Continue server validation with external token.
async def async_step_use_external_token(self, user_input=None): """Continue server validation with external token.""" server_config = {CONF_TOKEN: self.token} return await self.async_step_server_validate(server_config)
[ "async", "def", "async_step_use_external_token", "(", "self", ",", "user_input", "=", "None", ")", ":", "server_config", "=", "{", "CONF_TOKEN", ":", "self", ".", "token", "}", "return", "await", "self", ".", "async_step_server_validate", "(", "server_config", "...
[ 325, 4 ]
[ 328, 67 ]
python
en
['en', 'en', 'en']
True
PlexFlowHandler.async_step_reauth
(self, data)
Handle a reauthorization flow request.
Handle a reauthorization flow request.
async def async_step_reauth(self, data): """Handle a reauthorization flow request.""" self.current_login = dict(data) return await self.async_step_user()
[ "async", "def", "async_step_reauth", "(", "self", ",", "data", ")", ":", "self", ".", "current_login", "=", "dict", "(", "data", ")", "return", "await", "self", ".", "async_step_user", "(", ")" ]
[ 330, 4 ]
[ 333, 43 ]
python
en
['en', 'fr', 'en']
True
PlexOptionsFlowHandler.__init__
(self, config_entry)
Initialize Plex options flow.
Initialize Plex options flow.
def __init__(self, config_entry): """Initialize Plex options flow.""" self.options = copy.deepcopy(dict(config_entry.options)) self.server_id = config_entry.data[CONF_SERVER_IDENTIFIER]
[ "def", "__init__", "(", "self", ",", "config_entry", ")", ":", "self", ".", "options", "=", "copy", ".", "deepcopy", "(", "dict", "(", "config_entry", ".", "options", ")", ")", "self", ".", "server_id", "=", "config_entry", ".", "data", "[", "CONF_SERVER...
[ 339, 4 ]
[ 342, 66 ]
python
en
['en', 'fr', 'en']
True
PlexOptionsFlowHandler.async_step_init
(self, user_input=None)
Manage the Plex options.
Manage the Plex options.
async def async_step_init(self, user_input=None): """Manage the Plex options.""" return await self.async_step_plex_mp_settings()
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "return", "await", "self", ".", "async_step_plex_mp_settings", "(", ")" ]
[ 344, 4 ]
[ 346, 55 ]
python
en
['en', 'fr', 'en']
True
PlexOptionsFlowHandler.async_step_plex_mp_settings
(self, user_input=None)
Manage the Plex media_player options.
Manage the Plex media_player options.
async def async_step_plex_mp_settings(self, user_input=None): """Manage the Plex media_player options.""" plex_server = self.hass.data[DOMAIN][SERVERS][self.server_id] if user_input is not None: self.options[MP_DOMAIN][CONF_USE_EPISODE_ART] = user_input[ CONF_USE_EPI...
[ "async", "def", "async_step_plex_mp_settings", "(", "self", ",", "user_input", "=", "None", ")", ":", "plex_server", "=", "self", ".", "hass", ".", "data", "[", "DOMAIN", "]", "[", "SERVERS", "]", "[", "self", ".", "server_id", "]", "if", "user_input", "...
[ 348, 4 ]
[ 412, 9 ]
python
en
['en', 'en', 'en']
True
PlexAuthorizationCallbackView.get
(self, request)
Receive authorization confirmation.
Receive authorization confirmation.
async def get(self, request): """Receive authorization confirmation.""" hass = request.app["hass"] await hass.config_entries.flow.async_configure( flow_id=request.query["flow_id"], user_input=None ) return web_response.Response( headers={"content-type": "...
[ "async", "def", "get", "(", "self", ",", "request", ")", ":", "hass", "=", "request", ".", "app", "[", "\"hass\"", "]", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_configure", "(", "flow_id", "=", "request", ".", "query", "[", "\"f...
[ 422, 4 ]
[ 432, 9 ]
python
en
['de', 'en', 'en']
True
async_get_scanner
(hass: HomeAssistant, config: ConfigType)
Import legacy FRITZ!Box configuration.
Import legacy FRITZ!Box configuration.
async def async_get_scanner(hass: HomeAssistant, config: ConfigType) -> None: """Import legacy FRITZ!Box configuration.""" _LOGGER.debug("Import legacy FRITZ!Box configuration from YAML") hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"source":...
[ "async", "def", "async_get_scanner", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Import legacy FRITZ!Box configuration from YAML\"", ")", "hass", ".", "async_create_task", "(", "hass",...
[ 44, 0 ]
[ 62, 15 ]
python
en
['fr', 'zu', 'en']
False
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback )
Set up device tracker for FRITZ!Box component.
Set up device tracker for FRITZ!Box component.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: """Set up device tracker for FRITZ!Box component.""" _LOGGER.debug("Starting FRITZ!Box device tracker") router: FritzBoxTools = hass.data[DOMAIN][entry.entry_id] data_fritz: Fritz...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Starting FRITZ!Box device tracker\"", ")", "rout...
[ 65, 0 ]
[ 82, 19 ]
python
en
['en', 'en', 'en']
True
_async_add_entities
( router: FritzBoxTools, async_add_entities: AddEntitiesCallback, data_fritz: FritzData, )
Add new tracker entities from the router.
Add new tracker entities from the router.
def _async_add_entities( router: FritzBoxTools, async_add_entities: AddEntitiesCallback, data_fritz: FritzData, ) -> None: """Add new tracker entities from the router.""" def _is_tracked(mac: str) -> bool: for tracked in data_fritz.tracked.values(): if mac in tracked: ...
[ "def", "_async_add_entities", "(", "router", ":", "FritzBoxTools", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", "data_fritz", ":", "FritzData", ",", ")", "->", "None", ":", "def", "_is_tracked", "(", "mac", ":", "str", ")", "->", "bool", ":", ...
[ 86, 0 ]
[ 112, 39 ]
python
en
['en', 'en', 'en']
True
FritzBoxTracker.__init__
(self, router: FritzBoxTools, device: FritzDevice)
Initialize a FRITZ!Box device.
Initialize a FRITZ!Box device.
def __init__(self, router: FritzBoxTools, device: FritzDevice) -> None: """Initialize a FRITZ!Box device.""" super().__init__(router, device) self._last_activity: datetime.datetime | None = device.last_activity self._active = False
[ "def", "__init__", "(", "self", ",", "router", ":", "FritzBoxTools", ",", "device", ":", "FritzDevice", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "router", ",", "device", ")", "self", ".", "_last_activity", ":", "datetime", ".", ...
[ 118, 4 ]
[ 122, 28 ]
python
en
['es', 'en', 'it']
False
FritzBoxTracker.is_connected
(self)
Return device status.
Return device status.
def is_connected(self) -> bool: """Return device status.""" return self._active
[ "def", "is_connected", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_active" ]
[ 125, 4 ]
[ 127, 27 ]
python
en
['es', 'la', 'en']
False
FritzBoxTracker.unique_id
(self)
Return device unique id.
Return device unique id.
def unique_id(self) -> str: """Return device unique id.""" return f"{self._mac}_tracker"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "f\"{self._mac}_tracker\"" ]
[ 130, 4 ]
[ 132, 37 ]
python
en
['fr', 'it', 'en']
False
FritzBoxTracker.icon
(self)
Return device icon.
Return device icon.
def icon(self) -> str: """Return device icon.""" if self.is_connected: return "mdi:lan-connect" return "mdi:lan-disconnect"
[ "def", "icon", "(", "self", ")", "->", "str", ":", "if", "self", ".", "is_connected", ":", "return", "\"mdi:lan-connect\"", "return", "\"mdi:lan-disconnect\"" ]
[ 135, 4 ]
[ 139, 35 ]
python
en
['es', 'sr', 'en']
False
FritzBoxTracker.extra_state_attributes
(self)
Return the attributes.
Return the attributes.
def extra_state_attributes(self) -> dict[str, str]: """Return the attributes.""" attrs: dict[str, str] = {} if self._last_activity is not None: attrs["last_time_reachable"] = self._last_activity.isoformat( timespec="seconds" ) return attrs
[ "def", "extra_state_attributes", "(", "self", ")", "->", "dict", "[", "str", ",", "str", "]", ":", "attrs", ":", "dict", "[", "str", ",", "str", "]", "=", "{", "}", "if", "self", ".", "_last_activity", "is", "not", "None", ":", "attrs", "[", "\"las...
[ 142, 4 ]
[ 149, 20 ]
python
en
['en', 'la', 'en']
True
FritzBoxTracker.source_type
(self)
Return tracker source type.
Return tracker source type.
def source_type(self) -> str: """Return tracker source type.""" return SOURCE_TYPE_ROUTER
[ "def", "source_type", "(", "self", ")", "->", "str", ":", "return", "SOURCE_TYPE_ROUTER" ]
[ 152, 4 ]
[ 154, 33 ]
python
en
['en', 'sn', 'en']
True
FritzBoxTracker.async_process_update
(self)
Update device.
Update device.
async def async_process_update(self) -> None: """Update device.""" if not self._mac: return device = self._router.devices[self._mac] self._active = device.is_connected self._last_activity = device.last_activity
[ "async", "def", "async_process_update", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "_mac", ":", "return", "device", "=", "self", ".", "_router", ".", "devices", "[", "self", ".", "_mac", "]", "self", ".", "_active", "=", "device", ...
[ 156, 4 ]
[ 163, 50 ]
python
co
['fr', 'co', 'en']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Pilight platform.
Set up the Pilight platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Pilight platform.""" switches = config.get(CONF_SWITCHES) devices = [] for dev_name, dev_config in switches.items(): devices.append(PilightSwitch(hass, dev_name, dev_config)) add_entities(devices)
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "switches", "=", "config", ".", "get", "(", "CONF_SWITCHES", ")", "devices", "=", "[", "]", "for", "dev_name", ",", "dev_config", "in", ...
[ 14, 0 ]
[ 22, 25 ]
python
en
['en', 'lv', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Russound RNET platform.
Set up the Russound RNET platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Russound RNET platform.""" host = config.get(CONF_HOST) port = config.get(CONF_PORT) if host is None or port is None: _LOGGER.error("Invalid config. Expected %s and %s", CONF_HOST, CONF_PORT) return False...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "host", "=", "config", ".", "get", "(", "CONF_HOST", ")", "port", "=", "config", ".", "get", "(", "CONF_PORT", ")", "if", "host", "i...
[ 45, 0 ]
[ 67, 59 ]
python
en
['en', 'lb', 'en']
True
RussoundRNETDevice.__init__
(self, hass, russ, sources, zone_id, extra)
Initialise the Russound RNET device.
Initialise the Russound RNET device.
def __init__(self, hass, russ, sources, zone_id, extra): """Initialise the Russound RNET device.""" self._name = extra["name"] self._russ = russ self._sources = sources self._zone_id = zone_id self._state = None self._volume = None self._source = None
[ "def", "__init__", "(", "self", ",", "hass", ",", "russ", ",", "sources", ",", "zone_id", ",", "extra", ")", ":", "self", ".", "_name", "=", "extra", "[", "\"name\"", "]", "self", ".", "_russ", "=", "russ", "self", ".", "_sources", "=", "sources", ...
[ 73, 4 ]
[ 82, 27 ]
python
en
['en', 'en', 'en']
True
RussoundRNETDevice.update
(self)
Retrieve latest state.
Retrieve latest state.
def update(self): """Retrieve latest state.""" # Updated this function to make a single call to get_zone_info, so that # with a single call we can get On/Off, Volume and Source, reducing the # amount of traffic and speeding up the update process. ret = self._russ.get_zone_info("1...
[ "def", "update", "(", "self", ")", ":", "# Updated this function to make a single call to get_zone_info, so that", "# with a single call we can get On/Off, Volume and Source, reducing the", "# amount of traffic and speeding up the update process.", "ret", "=", "self", ".", "_russ", ".", ...
[ 84, 4 ]
[ 109, 79 ]
python
en
['es', 'sk', 'en']
False
RussoundRNETDevice.name
(self)
Return the name of the zone.
Return the name of the zone.
def name(self): """Return the name of the zone.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 112, 4 ]
[ 114, 25 ]
python
en
['en', 'en', 'en']
True
RussoundRNETDevice.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 117, 4 ]
[ 119, 26 ]
python
en
['en', 'en', 'en']
True
RussoundRNETDevice.supported_features
(self)
Flag media player features that are supported.
Flag media player features that are supported.
def supported_features(self): """Flag media player features that are supported.""" return SUPPORT_RUSSOUND
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_RUSSOUND" ]
[ 122, 4 ]
[ 124, 31 ]
python
en
['en', 'en', 'en']
True
RussoundRNETDevice.source
(self)
Get the currently selected source.
Get the currently selected source.
def source(self): """Get the currently selected source.""" return self._source
[ "def", "source", "(", "self", ")", ":", "return", "self", ".", "_source" ]
[ 127, 4 ]
[ 129, 27 ]
python
en
['en', 'en', 'en']
True
RussoundRNETDevice.volume_level
(self)
Volume level of the media player (0..1). Value is returned based on a range (0..100). Therefore float divide by 100 to get to the required range.
Volume level of the media player (0..1).
def volume_level(self): """Volume level of the media player (0..1). Value is returned based on a range (0..100). Therefore float divide by 100 to get to the required range. """ return self._volume
[ "def", "volume_level", "(", "self", ")", ":", "return", "self", ".", "_volume" ]
[ 132, 4 ]
[ 138, 27 ]
python
en
['en', 'en', 'en']
True
RussoundRNETDevice.set_volume_level
(self, volume)
Set volume level. Volume has a range (0..1). Translate this to a range of (0..100) as expected by _russ.set_volume()
Set volume level. Volume has a range (0..1).
def set_volume_level(self, volume): """Set volume level. Volume has a range (0..1). Translate this to a range of (0..100) as expected by _russ.set_volume() """ self._russ.set_volume("1", self._zone_id, volume * 100)
[ "def", "set_volume_level", "(", "self", ",", "volume", ")", ":", "self", ".", "_russ", ".", "set_volume", "(", "\"1\"", ",", "self", ".", "_zone_id", ",", "volume", "*", "100", ")" ]
[ 140, 4 ]
[ 146, 63 ]
python
en
['en', 'sr', 'en']
True
RussoundRNETDevice.turn_on
(self)
Turn the media player on.
Turn the media player on.
def turn_on(self): """Turn the media player on.""" self._russ.set_power("1", self._zone_id, "1")
[ "def", "turn_on", "(", "self", ")", ":", "self", ".", "_russ", ".", "set_power", "(", "\"1\"", ",", "self", ".", "_zone_id", ",", "\"1\"", ")" ]
[ 148, 4 ]
[ 150, 53 ]
python
en
['en', 'en', 'en']
True
RussoundRNETDevice.turn_off
(self)
Turn off media player.
Turn off media player.
def turn_off(self): """Turn off media player.""" self._russ.set_power("1", self._zone_id, "0")
[ "def", "turn_off", "(", "self", ")", ":", "self", ".", "_russ", ".", "set_power", "(", "\"1\"", ",", "self", ".", "_zone_id", ",", "\"0\"", ")" ]
[ 152, 4 ]
[ 154, 53 ]
python
en
['en', 'en', 'en']
True
RussoundRNETDevice.mute_volume
(self, mute)
Send mute command.
Send mute command.
def mute_volume(self, mute): """Send mute command.""" self._russ.toggle_mute("1", self._zone_id)
[ "def", "mute_volume", "(", "self", ",", "mute", ")", ":", "self", ".", "_russ", ".", "toggle_mute", "(", "\"1\"", ",", "self", ".", "_zone_id", ")" ]
[ 156, 4 ]
[ 158, 50 ]
python
en
['en', 'co', 'en']
True
RussoundRNETDevice.select_source
(self, source)
Set the input source.
Set the input source.
def select_source(self, source): """Set the input source.""" if source in self._sources: index = self._sources.index(source) # 0 based value for source self._russ.set_source("1", self._zone_id, index)
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "if", "source", "in", "self", ".", "_sources", ":", "index", "=", "self", ".", "_sources", ".", "index", "(", "source", ")", "# 0 based value for source", "self", ".", "_russ", ".", "set_source"...
[ 160, 4 ]
[ 165, 60 ]
python
en
['en', 'su', 'en']
True
RussoundRNETDevice.source_list
(self)
Return a list of available input sources.
Return a list of available input sources.
def source_list(self): """Return a list of available input sources.""" return self._sources
[ "def", "source_list", "(", "self", ")", ":", "return", "self", ".", "_sources" ]
[ 168, 4 ]
[ 170, 28 ]
python
en
['en', 'en', 'en']
True
OndiloOauth2Implementation.__init__
(self, hass: HomeAssistant)
Just init default class with default values.
Just init default class with default values.
def __init__(self, hass: HomeAssistant) -> None: """Just init default class with default values.""" super().__init__( hass, DOMAIN, OAUTH2_CLIENTID, OAUTH2_CLIENTSECRET, OAUTH2_AUTHORIZE, OAUTH2_TOKEN, )
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "hass", ",", "DOMAIN", ",", "OAUTH2_CLIENTID", ",", "OAUTH2_CLIENTSECRET", ",", "OAUTH2_AUTHORIZE", ",", "OAUTH2_TOKEN", ",", ...
[ 17, 4 ]
[ 26, 9 ]
python
en
['en', 'en', 'en']
True
OndiloOauth2Implementation.name
(self)
Name of the implementation.
Name of the implementation.
def name(self) -> str: """Name of the implementation.""" return "Ondilo"
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "\"Ondilo\"" ]
[ 29, 4 ]
[ 31, 23 ]
python
en
['en', 'en', 'en']
True
test_convert_same_unit
()
Test conversion from any unit to same unit.
Test conversion from any unit to same unit.
def test_convert_same_unit(): """Test conversion from any unit to same unit.""" assert distance_util.convert(5, LENGTH_KILOMETERS, LENGTH_KILOMETERS) == 5 assert distance_util.convert(2, LENGTH_METERS, LENGTH_METERS) == 2 assert distance_util.convert(6, LENGTH_CENTIMETERS, LENGTH_CENTIMETERS) == 6 a...
[ "def", "test_convert_same_unit", "(", ")", ":", "assert", "distance_util", ".", "convert", "(", "5", ",", "LENGTH_KILOMETERS", ",", "LENGTH_KILOMETERS", ")", "==", "5", "assert", "distance_util", ".", "convert", "(", "2", ",", "LENGTH_METERS", ",", "LENGTH_METER...
[ 20, 0 ]
[ 29, 70 ]
python
en
['en', 'en', 'en']
True
test_convert_invalid_unit
()
Test exception is thrown for invalid units.
Test exception is thrown for invalid units.
def test_convert_invalid_unit(): """Test exception is thrown for invalid units.""" with pytest.raises(ValueError): distance_util.convert(5, INVALID_SYMBOL, VALID_SYMBOL) with pytest.raises(ValueError): distance_util.convert(5, VALID_SYMBOL, INVALID_SYMBOL)
[ "def", "test_convert_invalid_unit", "(", ")", ":", "with", "pytest", ".", "raises", "(", "ValueError", ")", ":", "distance_util", ".", "convert", "(", "5", ",", "INVALID_SYMBOL", ",", "VALID_SYMBOL", ")", "with", "pytest", ".", "raises", "(", "ValueError", "...
[ 32, 0 ]
[ 38, 62 ]
python
en
['en', 'en', 'en']
True
test_convert_nonnumeric_value
()
Test exception is thrown for nonnumeric type.
Test exception is thrown for nonnumeric type.
def test_convert_nonnumeric_value(): """Test exception is thrown for nonnumeric type.""" with pytest.raises(TypeError): distance_util.convert("a", LENGTH_KILOMETERS, LENGTH_METERS)
[ "def", "test_convert_nonnumeric_value", "(", ")", ":", "with", "pytest", ".", "raises", "(", "TypeError", ")", ":", "distance_util", ".", "convert", "(", "\"a\"", ",", "LENGTH_KILOMETERS", ",", "LENGTH_METERS", ")" ]
[ 41, 0 ]
[ 44, 68 ]
python
en
['en', 'en', 'en']
True
test_convert_from_miles
()
Test conversion from miles to other units.
Test conversion from miles to other units.
def test_convert_from_miles(): """Test conversion from miles to other units.""" miles = 5 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_KILOMETERS) == 8.04672 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_METERS) == 8046.72 assert distance_util.convert(miles, LENGTH_MILES, LENG...
[ "def", "test_convert_from_miles", "(", ")", ":", "miles", "=", "5", "assert", "distance_util", ".", "convert", "(", "miles", ",", "LENGTH_MILES", ",", "LENGTH_KILOMETERS", ")", "==", "8.04672", "assert", "distance_util", ".", "convert", "(", "miles", ",", "LEN...
[ 47, 0 ]
[ 56, 85 ]
python
en
['en', 'en', 'en']
True
test_convert_from_yards
()
Test conversion from yards to other units.
Test conversion from yards to other units.
def test_convert_from_yards(): """Test conversion from yards to other units.""" yards = 5 assert ( distance_util.convert(yards, LENGTH_YARD, LENGTH_KILOMETERS) == 0.0045720000000000005 ) assert distance_util.convert(yards, LENGTH_YARD, LENGTH_METERS) == 4.572 assert distance_util...
[ "def", "test_convert_from_yards", "(", ")", ":", "yards", "=", "5", "assert", "(", "distance_util", ".", "convert", "(", "yards", ",", "LENGTH_YARD", ",", "LENGTH_KILOMETERS", ")", "==", "0.0045720000000000005", ")", "assert", "distance_util", ".", "convert", "(...
[ 59, 0 ]
[ 71, 82 ]
python
en
['en', 'en', 'en']
True
test_convert_from_feet
()
Test conversion from feet to other units.
Test conversion from feet to other units.
def test_convert_from_feet(): """Test conversion from feet to other units.""" feet = 5000 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_KILOMETERS) == 1.524 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_METERS) == 1524 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_CENTIMET...
[ "def", "test_convert_from_feet", "(", ")", ":", "feet", "=", "5000", "assert", "distance_util", ".", "convert", "(", "feet", ",", "LENGTH_FEET", ",", "LENGTH_KILOMETERS", ")", "==", "1.524", "assert", "distance_util", ".", "convert", "(", "feet", ",", "LENGTH_...
[ 74, 0 ]
[ 83, 88 ]
python
en
['en', 'en', 'en']
True
test_convert_from_inches
()
Test conversion from inches to other units.
Test conversion from inches to other units.
def test_convert_from_inches(): """Test conversion from inches to other units.""" inches = 5000 assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_KILOMETERS) == 0.127 assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_METERS) == 127.0 assert distance_util.convert(inches, LENGTH_INCH...
[ "def", "test_convert_from_inches", "(", ")", ":", "inches", "=", "5000", "assert", "distance_util", ".", "convert", "(", "inches", ",", "LENGTH_INCHES", ",", "LENGTH_KILOMETERS", ")", "==", "0.127", "assert", "distance_util", ".", "convert", "(", "inches", ",", ...
[ 86, 0 ]
[ 97, 81 ]
python
en
['en', 'en', 'en']
True
test_convert_from_kilometers
()
Test conversion from kilometers to other units.
Test conversion from kilometers to other units.
def test_convert_from_kilometers(): """Test conversion from kilometers to other units.""" km = 5 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_METERS) == 5000 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_CENTIMETERS) == 500000 assert distance_util.convert(km, LENGTH_KILOME...
[ "def", "test_convert_from_kilometers", "(", ")", ":", "km", "=", "5", "assert", "distance_util", ".", "convert", "(", "km", ",", "LENGTH_KILOMETERS", ",", "LENGTH_METERS", ")", "==", "5000", "assert", "distance_util", ".", "convert", "(", "km", ",", "LENGTH_KI...
[ 100, 0 ]
[ 109, 82 ]
python
en
['en', 'en', 'en']
True
test_convert_from_meters
()
Test conversion from meters to other units.
Test conversion from meters to other units.
def test_convert_from_meters(): """Test conversion from meters to other units.""" m = 5000 assert distance_util.convert(m, LENGTH_METERS, LENGTH_KILOMETERS) == 5 assert distance_util.convert(m, LENGTH_METERS, LENGTH_CENTIMETERS) == 500000 assert distance_util.convert(m, LENGTH_METERS, LENGTH_MILLIME...
[ "def", "test_convert_from_meters", "(", ")", ":", "m", "=", "5000", "assert", "distance_util", ".", "convert", "(", "m", ",", "LENGTH_METERS", ",", "LENGTH_KILOMETERS", ")", "==", "5", "assert", "distance_util", ".", "convert", "(", "m", ",", "LENGTH_METERS", ...
[ 112, 0 ]
[ 121, 77 ]
python
en
['en', 'en', 'en']
True
test_convert_from_centimeters
()
Test conversion from centimeters to other units.
Test conversion from centimeters to other units.
def test_convert_from_centimeters(): """Test conversion from centimeters to other units.""" cm = 500000 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_KILOMETERS) == 5 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_METERS) == 5000 assert distance_util.convert(cm, LENGTH_CEN...
[ "def", "test_convert_from_centimeters", "(", ")", ":", "cm", "=", "500000", "assert", "distance_util", ".", "convert", "(", "cm", ",", "LENGTH_CENTIMETERS", ",", "LENGTH_KILOMETERS", ")", "==", "5", "assert", "distance_util", ".", "convert", "(", "cm", ",", "L...
[ 124, 0 ]
[ 133, 83 ]
python
en
['en', 'en', 'en']
True
test_convert_from_millimeters
()
Test conversion from millimeters to other units.
Test conversion from millimeters to other units.
def test_convert_from_millimeters(): """Test conversion from millimeters to other units.""" mm = 5000000 assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_KILOMETERS) == 5 assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_METERS) == 5000 assert distance_util.convert(mm, LENGTH_MI...
[ "def", "test_convert_from_millimeters", "(", ")", ":", "mm", "=", "5000000", "assert", "distance_util", ".", "convert", "(", "mm", ",", "LENGTH_MILLIMETERS", ",", "LENGTH_KILOMETERS", ")", "==", "5", "assert", "distance_util", ".", "convert", "(", "mm", ",", "...
[ 136, 0 ]
[ 145, 83 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Check connectivity and version of KEBA charging station.
Check connectivity and version of KEBA charging station.
async def async_setup(hass, config): """Check connectivity and version of KEBA charging station.""" host = config[DOMAIN][CONF_HOST] rfid = config[DOMAIN][CONF_RFID] refresh_interval = config[DOMAIN][CONF_FS_INTERVAL] keba = KebaHandler(hass, host, rfid, refresh_interval) hass.data[DOMAIN] = keb...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "host", "=", "config", "[", "DOMAIN", "]", "[", "CONF_HOST", "]", "rfid", "=", "config", "[", "DOMAIN", "]", "[", "CONF_RFID", "]", "refresh_interval", "=", "config", "[", "DOMAIN", "...
[ 55, 0 ]
[ 101, 15 ]
python
en
['en', 'en', 'en']
True
KebaHandler.__init__
(self, hass, host, rfid, refresh_interval)
Initialize charging station connection.
Initialize charging station connection.
def __init__(self, hass, host, rfid, refresh_interval): """Initialize charging station connection.""" super().__init__(host, self.hass_callback) self._update_listeners = [] self._hass = hass self.rfid = rfid self.device_name = "keba" # correct device name will be set in...
[ "def", "__init__", "(", "self", ",", "hass", ",", "host", ",", "rfid", ",", "refresh_interval", ")", ":", "super", "(", ")", ".", "__init__", "(", "host", ",", "self", ".", "hass_callback", ")", "self", ".", "_update_listeners", "=", "[", "]", "self", ...
[ 107, 4 ]
[ 120, 33 ]
python
en
['en', 'en', 'en']
True
KebaHandler.start_periodic_request
(self)
Start periodic data polling.
Start periodic data polling.
def start_periodic_request(self): """Start periodic data polling.""" self._polling_task = self._hass.loop.create_task(self._periodic_request())
[ "def", "start_periodic_request", "(", "self", ")", ":", "self", ".", "_polling_task", "=", "self", ".", "_hass", ".", "loop", ".", "create_task", "(", "self", ".", "_periodic_request", "(", ")", ")" ]
[ 122, 4 ]
[ 124, 82 ]
python
en
['en', 'jv', 'en']
True
KebaHandler._periodic_request
(self)
Send periodic update requests.
Send periodic update requests.
async def _periodic_request(self): """Send periodic update requests.""" await self.request_data() if self._fast_polling_count < MAX_FAST_POLLING_COUNT: self._fast_polling_count += 1 _LOGGER.debug("Periodic data request executed, now wait for 2 seconds") awai...
[ "async", "def", "_periodic_request", "(", "self", ")", ":", "await", "self", ".", "request_data", "(", ")", "if", "self", ".", "_fast_polling_count", "<", "MAX_FAST_POLLING_COUNT", ":", "self", ".", "_fast_polling_count", "+=", "1", "_LOGGER", ".", "debug", "(...
[ 126, 4 ]
[ 142, 82 ]
python
en
['en', 'co', 'en']
True
KebaHandler.setup
(self, loop=None)
Initialize KebaHandler object.
Initialize KebaHandler object.
async def setup(self, loop=None): """Initialize KebaHandler object.""" await super().setup(loop) # Request initial values and extract serial number await self.request_data() if ( self.get_value("Serial") is not None and self.get_value("Product") is not No...
[ "async", "def", "setup", "(", "self", ",", "loop", "=", "None", ")", ":", "await", "super", "(", ")", ".", "setup", "(", "loop", ")", "# Request initial values and extract serial number", "await", "self", ".", "request_data", "(", ")", "if", "(", "self", "...
[ 144, 4 ]
[ 158, 20 ]
python
sv
['sv', 'zu', 'ur']
False
KebaHandler.hass_callback
(self, data)
Handle component notification via callback.
Handle component notification via callback.
def hass_callback(self, data): """Handle component notification via callback.""" # Inform entities about updated values for listener in self._update_listeners: listener() _LOGGER.debug("Notifying %d listeners", len(self._update_listeners))
[ "def", "hass_callback", "(", "self", ",", "data", ")", ":", "# Inform entities about updated values", "for", "listener", "in", "self", ".", "_update_listeners", ":", "listener", "(", ")", "_LOGGER", ".", "debug", "(", "\"Notifying %d listeners\"", ",", "len", "(",...
[ 160, 4 ]
[ 167, 76 ]
python
ca
['ro', 'ca', 'en']
False
KebaHandler.add_update_listener
(self, listener)
Add a listener for update notifications.
Add a listener for update notifications.
def add_update_listener(self, listener): """Add a listener for update notifications.""" self._update_listeners.append(listener) # initial data is already loaded, thus update the component listener()
[ "def", "add_update_listener", "(", "self", ",", "listener", ")", ":", "self", ".", "_update_listeners", ".", "append", "(", "listener", ")", "# initial data is already loaded, thus update the component", "listener", "(", ")" ]
[ 175, 4 ]
[ 180, 18 ]
python
en
['en', 'en', 'en']
True
KebaHandler.async_request_data
(self, param)
Request new data in async way.
Request new data in async way.
async def async_request_data(self, param): """Request new data in async way.""" await self.request_data() _LOGGER.debug("New data from KEBA wallbox requested")
[ "async", "def", "async_request_data", "(", "self", ",", "param", ")", ":", "await", "self", ".", "request_data", "(", ")", "_LOGGER", ".", "debug", "(", "\"New data from KEBA wallbox requested\"", ")" ]
[ 182, 4 ]
[ 185, 61 ]
python
en
['en', 'en', 'en']
True
KebaHandler.async_set_energy
(self, param)
Set energy target in async way.
Set energy target in async way.
async def async_set_energy(self, param): """Set energy target in async way.""" try: energy = param["energy"] await self.set_energy(float(energy)) self._set_fast_polling() except (KeyError, ValueError) as ex: _LOGGER.warning("Energy value is not cor...
[ "async", "def", "async_set_energy", "(", "self", ",", "param", ")", ":", "try", ":", "energy", "=", "param", "[", "\"energy\"", "]", "await", "self", ".", "set_energy", "(", "float", "(", "energy", ")", ")", "self", ".", "_set_fast_polling", "(", ")", ...
[ 187, 4 ]
[ 194, 66 ]
python
en
['en', 'af', 'en']
True
KebaHandler.async_set_current
(self, param)
Set current maximum in async way.
Set current maximum in async way.
async def async_set_current(self, param): """Set current maximum in async way.""" try: current = param["current"] await self.set_current(float(current)) # No fast polling as this function might be called regularly except (KeyError, ValueError) as ex: ...
[ "async", "def", "async_set_current", "(", "self", ",", "param", ")", ":", "try", ":", "current", "=", "param", "[", "\"current\"", "]", "await", "self", ".", "set_current", "(", "float", "(", "current", ")", ")", "# No fast polling as this function might be call...
[ 196, 4 ]
[ 203, 67 ]
python
en
['en', 'la', 'en']
True
KebaHandler.async_start
(self, param=None)
Authorize EV in async way.
Authorize EV in async way.
async def async_start(self, param=None): """Authorize EV in async way.""" await self.start(self.rfid) self._set_fast_polling()
[ "async", "def", "async_start", "(", "self", ",", "param", "=", "None", ")", ":", "await", "self", ".", "start", "(", "self", ".", "rfid", ")", "self", ".", "_set_fast_polling", "(", ")" ]
[ 205, 4 ]
[ 208, 32 ]
python
en
['en', 'en', 'en']
True
KebaHandler.async_stop
(self, param=None)
De-authorize EV in async way.
De-authorize EV in async way.
async def async_stop(self, param=None): """De-authorize EV in async way.""" await self.stop(self.rfid) self._set_fast_polling()
[ "async", "def", "async_stop", "(", "self", ",", "param", "=", "None", ")", ":", "await", "self", ".", "stop", "(", "self", ".", "rfid", ")", "self", ".", "_set_fast_polling", "(", ")" ]
[ 210, 4 ]
[ 213, 32 ]
python
en
['en', 'es', 'it']
False
KebaHandler.async_enable_ev
(self, param=None)
Enable EV in async way.
Enable EV in async way.
async def async_enable_ev(self, param=None): """Enable EV in async way.""" await self.enable(True) self._set_fast_polling()
[ "async", "def", "async_enable_ev", "(", "self", ",", "param", "=", "None", ")", ":", "await", "self", ".", "enable", "(", "True", ")", "self", ".", "_set_fast_polling", "(", ")" ]
[ 215, 4 ]
[ 218, 32 ]
python
en
['en', 'es', 'en']
True
KebaHandler.async_disable_ev
(self, param=None)
Disable EV in async way.
Disable EV in async way.
async def async_disable_ev(self, param=None): """Disable EV in async way.""" await self.enable(False) self._set_fast_polling()
[ "async", "def", "async_disable_ev", "(", "self", ",", "param", "=", "None", ")", ":", "await", "self", ".", "enable", "(", "False", ")", "self", ".", "_set_fast_polling", "(", ")" ]
[ 220, 4 ]
[ 223, 32 ]
python
en
['en', 'es', 'en']
True
KebaHandler.async_set_failsafe
(self, param=None)
Set failsafe mode in async way.
Set failsafe mode in async way.
async def async_set_failsafe(self, param=None): """Set failsafe mode in async way.""" try: timeout = param[CONF_FS_TIMEOUT] fallback = param[CONF_FS_FALLBACK] persist = param[CONF_FS_PERSIST] await self.set_failsafe(int(timeout), float(fallback), bool(pers...
[ "async", "def", "async_set_failsafe", "(", "self", ",", "param", "=", "None", ")", ":", "try", ":", "timeout", "=", "param", "[", "CONF_FS_TIMEOUT", "]", "fallback", "=", "param", "[", "CONF_FS_FALLBACK", "]", "persist", "=", "param", "[", "CONF_FS_PERSIST",...
[ 225, 4 ]
[ 238, 13 ]
python
en
['en', 'en', 'en']
True
TestOpenAlprCloudSetup.setup_method
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant()
[ "def", "setup_method", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")" ]
[ 16, 4 ]
[ 18, 45 ]
python
en
['en', 'en', 'en']
True
TestOpenAlprCloudSetup.teardown_method
(self)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self): """Stop everything that was started.""" self.hass.stop()
[ "def", "teardown_method", "(", "self", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 20, 4 ]
[ 22, 24 ]
python
en
['en', 'en', 'en']
True
TestOpenAlprCloudSetup.test_setup_platform
(self)
Set up platform with one entity.
Set up platform with one entity.
def test_setup_platform(self): """Set up platform with one entity.""" config = { ip.DOMAIN: { "platform": "openalpr_cloud", "source": {"entity_id": "camera.demo_camera"}, "region": "eu", "api_key": "sk_abcxyz123456", ...
[ "def", "test_setup_platform", "(", "self", ")", ":", "config", "=", "{", "ip", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"openalpr_cloud\"", ",", "\"source\"", ":", "{", "\"entity_id\"", ":", "\"camera.demo_camera\"", "}", ",", "\"region\"", ":", "\"eu\"...
[ 24, 4 ]
[ 40, 76 ]
python
en
['en', 'en', 'en']
True
TestOpenAlprCloudSetup.test_setup_platform_name
(self)
Set up platform with one entity and set name.
Set up platform with one entity and set name.
def test_setup_platform_name(self): """Set up platform with one entity and set name.""" config = { ip.DOMAIN: { "platform": "openalpr_cloud", "source": {"entity_id": "camera.demo_camera", "name": "test local"}, "region": "eu", "...
[ "def", "test_setup_platform_name", "(", "self", ")", ":", "config", "=", "{", "ip", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"openalpr_cloud\"", ",", "\"source\"", ":", "{", "\"entity_id\"", ":", "\"camera.demo_camera\"", ",", "\"name\"", ":", "\"test loc...
[ 42, 4 ]
[ 58, 66 ]
python
en
['en', 'en', 'en']
True
TestOpenAlprCloudSetup.test_setup_platform_without_api_key
(self)
Set up platform with one entity without api_key.
Set up platform with one entity without api_key.
def test_setup_platform_without_api_key(self): """Set up platform with one entity without api_key.""" config = { ip.DOMAIN: { "platform": "openalpr_cloud", "source": {"entity_id": "camera.demo_camera"}, "region": "eu", }, ...
[ "def", "test_setup_platform_without_api_key", "(", "self", ")", ":", "config", "=", "{", "ip", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"openalpr_cloud\"", ",", "\"source\"", ":", "{", "\"entity_id\"", ":", "\"camera.demo_camera\"", "}", ",", "\"region\"", ...
[ 60, 4 ]
[ 72, 57 ]
python
en
['en', 'zu', 'en']
True
TestOpenAlprCloudSetup.test_setup_platform_without_region
(self)
Set up platform with one entity without region.
Set up platform with one entity without region.
def test_setup_platform_without_region(self): """Set up platform with one entity without region.""" config = { ip.DOMAIN: { "platform": "openalpr_cloud", "source": {"entity_id": "camera.demo_camera"}, "api_key": "sk_abcxyz123456", }...
[ "def", "test_setup_platform_without_region", "(", "self", ")", ":", "config", "=", "{", "ip", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"openalpr_cloud\"", ",", "\"source\"", ":", "{", "\"entity_id\"", ":", "\"camera.demo_camera\"", "}", ",", "\"api_key\"", ...
[ 74, 4 ]
[ 86, 57 ]
python
en
['en', 'en', 'en']
True
TestOpenAlprCloud.setup_method
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() config = { ip.DOMAIN: { "platform": "openalpr_cloud", "source": {"entity_id": "camera.demo_camera", "name": "test local"}, ...
[ "def", "setup_method", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "config", "=", "{", "ip", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"openalpr_cloud\"", ",", "\"source\"", ":", "{", "\"entity_id\"", ":", "\...
[ 92, 4 ]
[ 128, 9 ]
python
en
['en', 'en', 'en']
True
TestOpenAlprCloud.teardown_method
(self)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self): """Stop everything that was started.""" self.hass.stop()
[ "def", "teardown_method", "(", "self", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 130, 4 ]
[ 132, 24 ]
python
en
['en', 'en', 'en']
True
TestOpenAlprCloud.test_openalpr_process_image
(self, aioclient_mock)
Set up and scan a picture and test plates from event.
Set up and scan a picture and test plates from event.
def test_openalpr_process_image(self, aioclient_mock): """Set up and scan a picture and test plates from event.""" aioclient_mock.post( OPENALPR_API_URL, params=self.params, text=load_fixture("alpr_cloud.json"), status=200, ) with patch( ...
[ "def", "test_openalpr_process_image", "(", "self", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "post", "(", "OPENALPR_API_URL", ",", "params", "=", "self", ".", "params", ",", "text", "=", "load_fixture", "(", "\"alpr_cloud.json\"", ")", ",", "status...
[ 134, 4 ]
[ 165, 74 ]
python
en
['en', 'en', 'en']
True
TestOpenAlprCloud.test_openalpr_process_image_api_error
(self, aioclient_mock)
Set up and scan a picture and test api error.
Set up and scan a picture and test api error.
def test_openalpr_process_image_api_error(self, aioclient_mock): """Set up and scan a picture and test api error.""" aioclient_mock.post( OPENALPR_API_URL, params=self.params, text="{'error': 'error message'}", status=400, ) with patch( ...
[ "def", "test_openalpr_process_image_api_error", "(", "self", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "post", "(", "OPENALPR_API_URL", ",", "params", "=", "self", ".", "params", ",", "text", "=", "\"{'error': 'error message'}\"", ",", "status", "=", ...
[ 167, 4 ]
[ 184, 41 ]
python
en
['en', 'en', 'en']
True
TestOpenAlprCloud.test_openalpr_process_image_api_timeout
(self, aioclient_mock)
Set up and scan a picture and test api error.
Set up and scan a picture and test api error.
def test_openalpr_process_image_api_timeout(self, aioclient_mock): """Set up and scan a picture and test api error.""" aioclient_mock.post( OPENALPR_API_URL, params=self.params, exc=asyncio.TimeoutError() ) with patch( "homeassistant.components.camera.async_get_i...
[ "def", "test_openalpr_process_image_api_timeout", "(", "self", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "post", "(", "OPENALPR_API_URL", ",", "params", "=", "self", ".", "params", ",", "exc", "=", "asyncio", ".", "TimeoutError", "(", ")", ")", "...
[ 186, 4 ]
[ 200, 41 ]
python
en
['en', 'en', 'en']
True
test_abort_if_existing_entry
(hass)
Check flow abort when an entry already exist.
Check flow abort when an entry already exist.
async def test_abort_if_existing_entry(hass): """Check flow abort when an entry already exist.""" MockConfigEntry(domain=DOMAIN).add_to_hass(hass) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == data_entry...
[ "async", "def", "test_abort_if_existing_entry", "(", "hass", ")", ":", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ")", ".", "add_to_hass", "(", "hass", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DO...
[ 20, 0 ]
[ 28, 56 ]
python
en
['en', 'en', 'en']
True
test_full_flow
( hass, hass_client_no_auth, aioclient_mock, current_request_with_host )
Check full flow.
Check full flow.
async def test_full_flow( hass, hass_client_no_auth, aioclient_mock, current_request_with_host ): """Check full flow.""" assert await setup.async_setup_component( hass, DOMAIN, { DOMAIN: {CONF_CLIENT_ID: CLIENT_ID, CONF_CLIENT_SECRET: CLIENT_SECRET}, "http": {...
[ "async", "def", "test_full_flow", "(", "hass", ",", "hass_client_no_auth", ",", "aioclient_mock", ",", "current_request_with_host", ")", ":", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "CON...
[ 31, 0 ]
[ 83, 42 ]
python
en
['sv', 'no', 'en']
False
TestTypeHolderExample.testTypeHolderExample
(self)
Test TypeHolderExample
Test TypeHolderExample
def testTypeHolderExample(self): """Test TypeHolderExample""" # FIXME: construct object with mandatory attributes with example values # model = TypeHolderExample() # noqa: E501 pass
[ "def", "testTypeHolderExample", "(", "self", ")", ":", "# FIXME: construct object with mandatory attributes with example values", "# model = TypeHolderExample() # noqa: E501", "pass" ]
[ 29, 4 ]
[ 33, 12 ]
python
en
['en', 'sr', 'en']
False
ZWaveServices.__init__
(self, hass, manager)
Initialize with both hass and ozwmanager objects.
Initialize with both hass and ozwmanager objects.
def __init__(self, hass, manager): """Initialize with both hass and ozwmanager objects.""" self._hass = hass self._manager = manager
[ "def", "__init__", "(", "self", ",", "hass", ",", "manager", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_manager", "=", "manager" ]
[ 18, 4 ]
[ 21, 31 ]
python
en
['en', 'en', 'en']
True