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
start_step
(step_label)
Generates the HTML for the start of a step, including breadcrumbs
Generates the HTML for the start of a step, including breadcrumbs
def start_step(step_label): """Generates the HTML for the start of a step, including breadcrumbs""" if '"' in step_label: raise ValueError("step_label must not contain \" characters") step_id = slugify(step_label) out_html = """ <div class="interactive-block" id="interactive-{step_id}"> <di...
[ "def", "start_step", "(", "step_label", ")", ":", "if", "'\"'", "in", "step_label", ":", "raise", "ValueError", "(", "\"step_label must not contain \\\" characters\"", ")", "step_id", "=", "slugify", "(", "step_label", ")", "out_html", "=", "\"\"\"\n<div class=\"inter...
[ 21, 0 ]
[ 39, 19 ]
python
en
['en', 'en', 'en']
True
end_step
()
Generates the HTML for the end of a step
Generates the HTML for the end of a step
def end_step(): """Generates the HTML for the end of a step""" return " </div><!--/.interactive-block-ui-->\n </div><!--/.interactive-block-inner-->\n</div><!--/.interactive-block-->"
[ "def", "end_step", "(", ")", ":", "return", "\" </div><!--/.interactive-block-ui-->\\n </div><!--/.interactive-block-inner-->\\n</div><!--/.interactive-block-->\"" ]
[ 41, 0 ]
[ 43, 128 ]
python
en
['en', 'en', 'en']
True
filter_soup
(soup, **kwargs)
Add steps to each tutorial-step-crumbs element based on the total steps in the document. Each step results in a li element such as: <li class="breadcrumb-item disabled current bc-connect"> <a href="#interactive-connect">Connect</a> </li>
Add steps to each tutorial-step-crumbs element based on the total steps in the document. Each step results in a li element such as: <li class="breadcrumb-item disabled current bc-connect"> <a href="#interactive-connect">Connect</a> </li>
def filter_soup(soup, **kwargs): """Add steps to each tutorial-step-crumbs element based on the total steps in the document. Each step results in a li element such as: <li class="breadcrumb-item disabled current bc-connect"> <a href="#interactive-connect">Connect</a> </li>""" crumb_uls = sou...
[ "def", "filter_soup", "(", "soup", ",", "*", "*", "kwargs", ")", ":", "crumb_uls", "=", "soup", ".", "find_all", "(", "class_", "=", "\"tutorial-step-crumbs\"", ")", "steps", "=", "[", "(", "el", ".", "attrs", "[", "\"data-stepid\"", "]", ",", "el", "....
[ 45, 0 ]
[ 72, 38 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: dict)
Set up the Tado component.
Set up the Tado component.
async def async_setup(hass: HomeAssistant, config: dict): """Set up the Tado component.""" hass.data.setdefault(DOMAIN, {}) if DOMAIN not in config: return True for conf in config[DOMAIN]: hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN,...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "for", "c...
[ 54, 0 ]
[ 71, 15 ]
python
en
['en', 'pt', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up Tado from a config entry.
Set up Tado from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Tado from a config entry.""" _async_import_options_from_data_if_missing(hass, entry) username = entry.data[CONF_USERNAME] password = entry.data[CONF_PASSWORD] fallback = entry.options.get(CONF_FALLBACK, True) tado...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "_async_import_options_from_data_if_missing", "(", "hass", ",", "entry", ")", "username", "=", "entry", ".", "data", "[", "CONF_USERNAME", "]", "p...
[ 74, 0 ]
[ 124, 15 ]
python
en
['en', 'pt', 'en']
True
_async_update_listener
(hass: HomeAssistant, entry: ConfigEntry)
Handle options update.
Handle options update.
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry): """Handle options update.""" await hass.config_entries.async_reload(entry.entry_id)
[ "async", "def", "_async_update_listener", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "await", "hass", ".", "config_entries", ".", "async_reload", "(", "entry", ".", "entry_id", ")" ]
[ 135, 0 ]
[ 137, 58 ]
python
en
['en', 'nl', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in TADO_COMPONENTS ] ...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload...
[ 140, 0 ]
[ 157, 20 ]
python
en
['en', 'es', 'en']
True
TadoConnector.__init__
(self, hass, username, password, fallback)
Initialize Tado Connector.
Initialize Tado Connector.
def __init__(self, hass, username, password, fallback): """Initialize Tado Connector.""" self.hass = hass self._username = username self._password = password self._fallback = fallback self.device_id = None self.tado = None self.zones = None self.d...
[ "def", "__init__", "(", "self", ",", "hass", ",", "username", ",", "password", ",", "fallback", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "_username", "=", "username", "self", ".", "_password", "=", "password", "self", ".", "_fallback", ...
[ 163, 4 ]
[ 177, 9 ]
python
en
['es', 'en', 'it']
False
TadoConnector.fallback
(self)
Return fallback flag to Smart Schedule.
Return fallback flag to Smart Schedule.
def fallback(self): """Return fallback flag to Smart Schedule.""" return self._fallback
[ "def", "fallback", "(", "self", ")", ":", "return", "self", ".", "_fallback" ]
[ 180, 4 ]
[ 182, 29 ]
python
en
['en', 'ig', 'en']
True
TadoConnector.setup
(self)
Connect to Tado and fetch the zones.
Connect to Tado and fetch the zones.
def setup(self): """Connect to Tado and fetch the zones.""" self.tado = Tado(self._username, self._password) self.tado.setDebugging(True) # Load zones and devices self.zones = self.tado.getZones() self.devices = self.tado.getMe()["homes"] self.device_id = self.dev...
[ "def", "setup", "(", "self", ")", ":", "self", ".", "tado", "=", "Tado", "(", "self", ".", "_username", ",", "self", ".", "_password", ")", "self", ".", "tado", ".", "setDebugging", "(", "True", ")", "# Load zones and devices", "self", ".", "zones", "=...
[ 184, 4 ]
[ 191, 46 ]
python
en
['en', 'en', 'en']
True
TadoConnector.update
(self)
Update the registered zones.
Update the registered zones.
def update(self): """Update the registered zones.""" for zone in self.zones: self.update_sensor("zone", zone["id"]) for device in self.devices: self.update_sensor("device", device["id"])
[ "def", "update", "(", "self", ")", ":", "for", "zone", "in", "self", ".", "zones", ":", "self", ".", "update_sensor", "(", "\"zone\"", ",", "zone", "[", "\"id\"", "]", ")", "for", "device", "in", "self", ".", "devices", ":", "self", ".", "update_sens...
[ 194, 4 ]
[ 199, 54 ]
python
en
['en', 'en', 'en']
True
TadoConnector.update_sensor
(self, sensor_type, sensor)
Update the internal data from Tado.
Update the internal data from Tado.
def update_sensor(self, sensor_type, sensor): """Update the internal data from Tado.""" _LOGGER.debug("Updating %s %s", sensor_type, sensor) try: if sensor_type == "zone": data = self.tado.getZoneState(sensor) elif sensor_type == "device": ...
[ "def", "update_sensor", "(", "self", ",", "sensor_type", ",", "sensor", ")", ":", "_LOGGER", ".", "debug", "(", "\"Updating %s %s\"", ",", "sensor_type", ",", "sensor", ")", "try", ":", "if", "sensor_type", "==", "\"zone\"", ":", "data", "=", "self", ".", ...
[ 201, 4 ]
[ 237, 9 ]
python
en
['en', 'en', 'en']
True
TadoConnector.get_capabilities
(self, zone_id)
Return the capabilities of the devices.
Return the capabilities of the devices.
def get_capabilities(self, zone_id): """Return the capabilities of the devices.""" return self.tado.getCapabilities(zone_id)
[ "def", "get_capabilities", "(", "self", ",", "zone_id", ")", ":", "return", "self", ".", "tado", ".", "getCapabilities", "(", "zone_id", ")" ]
[ 239, 4 ]
[ 241, 49 ]
python
en
['en', 'en', 'en']
True
TadoConnector.reset_zone_overlay
(self, zone_id)
Reset the zone back to the default operation.
Reset the zone back to the default operation.
def reset_zone_overlay(self, zone_id): """Reset the zone back to the default operation.""" self.tado.resetZoneOverlay(zone_id) self.update_sensor("zone", zone_id)
[ "def", "reset_zone_overlay", "(", "self", ",", "zone_id", ")", ":", "self", ".", "tado", ".", "resetZoneOverlay", "(", "zone_id", ")", "self", ".", "update_sensor", "(", "\"zone\"", ",", "zone_id", ")" ]
[ 243, 4 ]
[ 246, 43 ]
python
en
['en', 'en', 'en']
True
TadoConnector.set_presence
( self, presence=PRESET_HOME, )
Set the presence to home or away.
Set the presence to home or away.
def set_presence( self, presence=PRESET_HOME, ): """Set the presence to home or away.""" if presence == PRESET_AWAY: self.tado.setAway() elif presence == PRESET_HOME: self.tado.setHome()
[ "def", "set_presence", "(", "self", ",", "presence", "=", "PRESET_HOME", ",", ")", ":", "if", "presence", "==", "PRESET_AWAY", ":", "self", ".", "tado", ".", "setAway", "(", ")", "elif", "presence", "==", "PRESET_HOME", ":", "self", ".", "tado", ".", "...
[ 248, 4 ]
[ 256, 31 ]
python
en
['en', 'en', 'en']
True
TadoConnector.set_zone_overlay
( self, zone_id=None, overlay_mode=None, temperature=None, duration=None, device_type="HEATING", mode=None, fan_speed=None, swing=None, )
Set a zone overlay.
Set a zone overlay.
def set_zone_overlay( self, zone_id=None, overlay_mode=None, temperature=None, duration=None, device_type="HEATING", mode=None, fan_speed=None, swing=None, ): """Set a zone overlay.""" _LOGGER.debug( "Set overlay for...
[ "def", "set_zone_overlay", "(", "self", ",", "zone_id", "=", "None", ",", "overlay_mode", "=", "None", ",", "temperature", "=", "None", ",", "duration", "=", "None", ",", "device_type", "=", "\"HEATING\"", ",", "mode", "=", "None", ",", "fan_speed", "=", ...
[ 258, 4 ]
[ 298, 43 ]
python
en
['nl', 'en', 'en']
True
TadoConnector.set_zone_off
(self, zone_id, overlay_mode, device_type="HEATING")
Set a zone to off.
Set a zone to off.
def set_zone_off(self, zone_id, overlay_mode, device_type="HEATING"): """Set a zone to off.""" try: self.tado.setZoneOverlay( zone_id, overlay_mode, None, None, device_type, "OFF" ) except RequestException as exc: _LOGGER.error("Could not set z...
[ "def", "set_zone_off", "(", "self", ",", "zone_id", ",", "overlay_mode", ",", "device_type", "=", "\"HEATING\"", ")", ":", "try", ":", "self", ".", "tado", ".", "setZoneOverlay", "(", "zone_id", ",", "overlay_mode", ",", "None", ",", "None", ",", "device_t...
[ 300, 4 ]
[ 309, 43 ]
python
en
['en', 'en', 'en']
True
is_on
(hass: HomeAssistantType, entity_id: str)
Return if the remote is on based on the statemachine.
Return if the remote is on based on the statemachine.
def is_on(hass: HomeAssistantType, entity_id: str) -> bool: """Return if the remote is on based on the statemachine.""" return hass.states.is_state(entity_id, STATE_ON)
[ "def", "is_on", "(", "hass", ":", "HomeAssistantType", ",", "entity_id", ":", "str", ")", "->", "bool", ":", "return", "hass", ".", "states", ".", "is_state", "(", "entity_id", ",", "STATE_ON", ")" ]
[ 65, 0 ]
[ 67, 52 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistantType, config: ConfigType)
Track states and offer events for remotes.
Track states and offer events for remotes.
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: """Track states and offer events for remotes.""" component = hass.data[DOMAIN] = EntityComponent( _LOGGER, DOMAIN, hass, SCAN_INTERVAL ) await component.async_setup(config) component.async_register_entity_service( ...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "component", "=", "hass", ".", "data", "[", "DOMAIN", "]", "=", "EntityComponent", "(", "_LOGGER", ",", "DOMAIN", ",", "hass", ...
[ 70, 0 ]
[ 124, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistantType, entry: ConfigEntry)
Set up a config entry.
Set up a config entry.
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Set up a config entry.""" return await cast(EntityComponent, hass.data[DOMAIN]).async_setup_entry(entry)
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "return", "await", "cast", "(", "EntityComponent", ",", "hass", ".", "data", "[", "DOMAIN", "]", ")", ".", "async_setup_entr...
[ 127, 0 ]
[ 129, 82 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistantType, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Unload a config entry.""" return await cast(EntityComponent, hass.data[DOMAIN]).async_unload_entry(entry)
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "return", "await", "cast", "(", "EntityComponent", ",", "hass", ".", "data", "[", "DOMAIN", "]", ")", ".", "async_unload_en...
[ 132, 0 ]
[ 134, 83 ]
python
en
['en', 'es', 'en']
True
RemoteEntity.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self) -> int: """Flag supported features.""" return 0
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "0" ]
[ 141, 4 ]
[ 143, 16 ]
python
en
['da', 'en', 'en']
True
RemoteEntity.send_command
(self, command: Iterable[str], **kwargs: Any)
Send commands to a device.
Send commands to a device.
def send_command(self, command: Iterable[str], **kwargs: Any) -> None: """Send commands to a device.""" raise NotImplementedError()
[ "def", "send_command", "(", "self", ",", "command", ":", "Iterable", "[", "str", "]", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "raise", "NotImplementedError", "(", ")" ]
[ 145, 4 ]
[ 147, 35 ]
python
en
['en', 'en', 'en']
True
RemoteEntity.async_send_command
(self, command: Iterable[str], **kwargs: Any)
Send commands to a device.
Send commands to a device.
async def async_send_command(self, command: Iterable[str], **kwargs: Any) -> None: """Send commands to a device.""" assert self.hass is not None await self.hass.async_add_executor_job( ft.partial(self.send_command, command, **kwargs) )
[ "async", "def", "async_send_command", "(", "self", ",", "command", ":", "Iterable", "[", "str", "]", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "assert", "self", ".", "hass", "is", "not", "None", "await", "self", ".", "hass", ".", ...
[ 149, 4 ]
[ 154, 9 ]
python
en
['en', 'en', 'en']
True
RemoteEntity.learn_command
(self, **kwargs: Any)
Learn a command from a device.
Learn a command from a device.
def learn_command(self, **kwargs: Any) -> None: """Learn a command from a device.""" raise NotImplementedError()
[ "def", "learn_command", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "raise", "NotImplementedError", "(", ")" ]
[ 156, 4 ]
[ 158, 35 ]
python
en
['en', 'en', 'en']
True
RemoteEntity.async_learn_command
(self, **kwargs: Any)
Learn a command from a device.
Learn a command from a device.
async def async_learn_command(self, **kwargs: Any) -> None: """Learn a command from a device.""" assert self.hass is not None await self.hass.async_add_executor_job(ft.partial(self.learn_command, **kwargs))
[ "async", "def", "async_learn_command", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "assert", "self", ".", "hass", "is", "not", "None", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "ft", ".", "partial", ...
[ 160, 4 ]
[ 163, 88 ]
python
en
['en', 'en', 'en']
True
RemoteEntity.delete_command
(self, **kwargs: Any)
Delete commands from the database.
Delete commands from the database.
def delete_command(self, **kwargs: Any) -> None: """Delete commands from the database.""" raise NotImplementedError()
[ "def", "delete_command", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "raise", "NotImplementedError", "(", ")" ]
[ 165, 4 ]
[ 167, 35 ]
python
en
['en', 'en', 'en']
True
RemoteEntity.async_delete_command
(self, **kwargs: Any)
Delete commands from the database.
Delete commands from the database.
async def async_delete_command(self, **kwargs: Any) -> None: """Delete commands from the database.""" assert self.hass is not None await self.hass.async_add_executor_job( ft.partial(self.delete_command, **kwargs) )
[ "async", "def", "async_delete_command", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "assert", "self", ".", "hass", "is", "not", "None", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "ft", ".", "partial", ...
[ 169, 4 ]
[ 174, 9 ]
python
en
['en', 'en', 'en']
True
RemoteDevice.__init_subclass__
(cls, **kwargs)
Print deprecation warning.
Print deprecation warning.
def __init_subclass__(cls, **kwargs): """Print deprecation warning.""" super().__init_subclass__(**kwargs) _LOGGER.warning( "RemoteDevice is deprecated, modify %s to extend RemoteEntity", cls.__name__, )
[ "def", "__init_subclass__", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init_subclass__", "(", "*", "*", "kwargs", ")", "_LOGGER", ".", "warning", "(", "\"RemoteDevice is deprecated, modify %s to extend RemoteEntity\"", ",", "cls", ...
[ 180, 4 ]
[ 186, 9 ]
python
de
['de', 'sv', 'en']
False
async_setup_entry
( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities )
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: HomeAssistantType, entry: ConfigEntry, async_add_entities ) -> None: """Set up AdGuard Home switch based on a config entry.""" adguard = hass.data[DOMAIN][DATA_ADGUARD_CLIENT] try: version = await adguard.version() except AdGuardHomeConnectionError as exce...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "adguard", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "DATA_ADGUARD_CLIENT", "]", "try", ...
[ 23, 0 ]
[ 44, 38 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeSwitch.__init__
( self, adguard, name: str, icon: str, key: str, enabled_default: bool = True )
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__( self, adguard, name: str, icon: str, key: str, enabled_default: bool = True ): """Initialize AdGuard Home switch.""" self._state = False self._key = key super().__init__(adguard, name, icon, enabled_default)
[ "def", "__init__", "(", "self", ",", "adguard", ",", "name", ":", "str", ",", "icon", ":", "str", ",", "key", ":", "str", ",", "enabled_default", ":", "bool", "=", "True", ")", ":", "self", ".", "_state", "=", "False", "self", ".", "_key", "=", "...
[ 50, 4 ]
[ 56, 62 ]
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", ".", ...
[ 59, 4 ]
[ 63, 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" ]
[ 66, 4 ]
[ 68, 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...
[ 70, 4 ]
[ 76, 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", "(", ")" ]
[ 78, 4 ]
[ 80, 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...
[ 82, 4 ]
[ 88, 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", "(", ")" ]
[ 90, 4 ]
[ 92, 35 ]
python
en
['en', 'en', 'en']
True
AdGuardHomeProtectionSwitch.__init__
(self, adguard)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, "AdGuard Protection", "mdi:shield-check", "protection" )
[ "def", "__init__", "(", "self", ",", "adguard", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "\"AdGuard Protection\"", ",", "\"mdi:shield-check\"", ",", "\"protection\"", ")" ]
[ 98, 4 ]
[ 102, 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", "(", ")" ]
[ 104, 4 ]
[ 106, 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", "(", ")" ]
[ 108, 4 ]
[ 110, 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", "(", ")" ]
[ 112, 4 ]
[ 114, 61 ]
python
en
['es', 'en', 'en']
True
AdGuardHomeParentalSwitch.__init__
(self, adguard)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, "AdGuard Parental Control", "mdi:shield-check", "parental" )
[ "def", "__init__", "(", "self", ",", "adguard", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "\"AdGuard Parental Control\"", ",", "\"mdi:shield-check\"", ",", "\"parental\"", ")" ]
[ 120, 4 ]
[ 124, 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", "(", ")" ]
[ 126, 4 ]
[ 128, 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", "(", ")" ]
[ 130, 4 ]
[ 132, 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", "(", ")" ]
[ 134, 4 ]
[ 136, 59 ]
python
en
['es', 'en', 'en']
True
AdGuardHomeSafeSearchSwitch.__init__
(self, adguard)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, "AdGuard Safe Search", "mdi:shield-check", "safesearch" )
[ "def", "__init__", "(", "self", ",", "adguard", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "\"AdGuard Safe Search\"", ",", "\"mdi:shield-check\"", ",", "\"safesearch\"", ")" ]
[ 142, 4 ]
[ 146, 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", "(", ")" ]
[ 148, 4 ]
[ 150, 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", "(", ")" ]
[ 152, 4 ]
[ 154, 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", "(", ")" ]
[ 156, 4 ]
[ 158, 61 ]
python
en
['es', 'en', 'en']
True
AdGuardHomeSafeBrowsingSwitch.__init__
(self, adguard)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, "AdGuard Safe Browsing", "mdi:shield-check", "safebrowsing" )
[ "def", "__init__", "(", "self", ",", "adguard", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "\"AdGuard Safe Browsing\"", ",", "\"mdi:shield-check\"", ",", "\"safebrowsing\"", ")" ]
[ 164, 4 ]
[ 168, 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", "(", ")" ]
[ 170, 4 ]
[ 172, 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", "(", ")" ]
[ 174, 4 ]
[ 176, 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", "(", ")" ]
[ 178, 4 ]
[ 180, 63 ]
python
en
['es', 'en', 'en']
True
AdGuardHomeFilteringSwitch.__init__
(self, adguard)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard) -> None: """Initialize AdGuard Home switch.""" super().__init__(adguard, "AdGuard Filtering", "mdi:shield-check", "filtering")
[ "def", "__init__", "(", "self", ",", "adguard", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "\"AdGuard Filtering\"", ",", "\"mdi:shield-check\"", ",", "\"filtering\"", ")" ]
[ 186, 4 ]
[ 188, 87 ]
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", "(", ")" ]
[ 190, 4 ]
[ 192, 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", "(", ")" ]
[ 194, 4 ]
[ 196, 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", "(", ")" ]
[ 198, 4 ]
[ 200, 60 ]
python
en
['es', 'en', 'en']
True
AdGuardHomeQueryLogSwitch.__init__
(self, adguard)
Initialize AdGuard Home switch.
Initialize AdGuard Home switch.
def __init__(self, adguard) -> None: """Initialize AdGuard Home switch.""" super().__init__( adguard, "AdGuard Query Log", "mdi:shield-check", "querylog", enabled_default=False, )
[ "def", "__init__", "(", "self", ",", "adguard", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "\"AdGuard Query Log\"", ",", "\"mdi:shield-check\"", ",", "\"querylog\"", ",", "enabled_default", "=", "False", ",", ")" ]
[ 206, 4 ]
[ 214, 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", "(", ")" ]
[ 216, 4 ]
[ 218, 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", "(", ")" ]
[ 220, 4 ]
[ 222, 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", "(", ")" ]
[ 224, 4 ]
[ 226, 59 ]
python
en
['es', 'en', 'en']
True
async_setup
(hass)
Enable the Home Assistant views.
Enable the Home Assistant views.
async def async_setup(hass): """Enable the Home Assistant views.""" hass.components.websocket_api.async_register_command(websocket_create) hass.components.websocket_api.async_register_command(websocket_delete) hass.components.websocket_api.async_register_command(websocket_change_password) hass.compo...
[ "async", "def", "async_setup", "(", "hass", ")", ":", "hass", ".", "components", ".", "websocket_api", ".", "async_register_command", "(", "websocket_create", ")", "hass", ".", "components", ".", "websocket_api", ".", "async_register_command", "(", "websocket_delete...
[ 9, 0 ]
[ 17, 15 ]
python
en
['en', 'en', 'en']
True
websocket_create
(hass, connection, msg)
Create credentials and attach to a user.
Create credentials and attach to a user.
async def websocket_create(hass, connection, msg): """Create credentials and attach to a user.""" provider = auth_ha.async_get_provider(hass) user = await hass.auth.async_get_user(msg["user_id"]) if user is None: connection.send_error(msg["id"], "not_found", "User not found") return ...
[ "async", "def", "websocket_create", "(", "hass", ",", "connection", ",", "msg", ")", ":", "provider", "=", "auth_ha", ".", "async_get_provider", "(", "hass", ")", "user", "=", "await", "hass", ".", "auth", ".", "async_get_user", "(", "msg", "[", "\"user_id...
[ 30, 0 ]
[ 58, 37 ]
python
en
['en', 'en', 'en']
True
websocket_delete
(hass, connection, msg)
Delete username and related credential.
Delete username and related credential.
async def websocket_delete(hass, connection, msg): """Delete username and related credential.""" provider = auth_ha.async_get_provider(hass) credentials = await provider.async_get_or_create_credentials( {"username": msg["username"]} ) # if not new, an existing credential exists. # Remov...
[ "async", "def", "websocket_delete", "(", "hass", ",", "connection", ",", "msg", ")", ":", "provider", "=", "auth_ha", ".", "async_get_provider", "(", "hass", ")", "credentials", "=", "await", "provider", ".", "async_get_or_create_credentials", "(", "{", "\"usern...
[ 69, 0 ]
[ 92, 37 ]
python
en
['en', 'en', 'en']
True
websocket_change_password
(hass, connection, msg)
Change current user password.
Change current user password.
async def websocket_change_password(hass, connection, msg): """Change current user password.""" user = connection.user if user is None: connection.send_error(msg["id"], "user_not_found", "User not found") return provider = auth_ha.async_get_provider(hass) username = None for cre...
[ "async", "def", "websocket_change_password", "(", "hass", ",", "connection", ",", "msg", ")", ":", "user", "=", "connection", ".", "user", "if", "user", "is", "None", ":", "connection", ".", "send_error", "(", "msg", "[", "\"id\"", "]", ",", "\"user_not_fo...
[ 103, 0 ]
[ 131, 37 ]
python
en
['fr', 'nl', 'en']
False
websocket_admin_change_password
(hass, connection, msg)
Change password of any user.
Change password of any user.
async def websocket_admin_change_password(hass, connection, msg): """Change password of any user.""" if not connection.user.is_owner: raise Unauthorized(context=connection.context(msg)) user = await hass.auth.async_get_user(msg["user_id"]) if user is None: connection.send_error(msg["id...
[ "async", "def", "websocket_admin_change_password", "(", "hass", ",", "connection", ",", "msg", ")", ":", "if", "not", "connection", ".", "user", ".", "is_owner", ":", "raise", "Unauthorized", "(", "context", "=", "connection", ".", "context", "(", "msg", ")"...
[ 145, 0 ]
[ 177, 14 ]
python
en
['en', 'en', 'en']
True
DeviceHelper.try_bind_device
(device_info: DeviceInfo)
Try and bing with a discovered device. Note the you must bind with the device very quickly after it is discovered, or the process may not be completed correctly, raising a `CannotConnect` error.
Try and bing with a discovered device.
async def try_bind_device(device_info: DeviceInfo) -> Device: """Try and bing with a discovered device. Note the you must bind with the device very quickly after it is discovered, or the process may not be completed correctly, raising a `CannotConnect` error. """ device = Device...
[ "async", "def", "try_bind_device", "(", "device_info", ":", "DeviceInfo", ")", "->", "Device", ":", "device", "=", "Device", "(", "device_info", ")", "try", ":", "await", "device", ".", "bind", "(", ")", "except", "DeviceNotBoundError", "as", "exception", ":...
[ 14, 4 ]
[ 25, 21 ]
python
en
['en', 'en', 'en']
True
DeviceHelper.find_devices
()
Gather a list of device infos from the local network.
Gather a list of device infos from the local network.
async def find_devices() -> List[DeviceInfo]: """Gather a list of device infos from the local network.""" return await Discovery.search_devices()
[ "async", "def", "find_devices", "(", ")", "->", "List", "[", "DeviceInfo", "]", ":", "return", "await", "Discovery", ".", "search_devices", "(", ")" ]
[ 28, 4 ]
[ 30, 47 ]
python
en
['en', 'en', 'en']
True
test_unload_entry
(hass, mock_simple_nws)
Test that nws setup with config yaml.
Test that nws setup with config yaml.
async def test_unload_entry(hass, mock_simple_nws): """Test that nws setup with config yaml.""" entry = MockConfigEntry( domain=DOMAIN, data=NWS_CONFIG, ) entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() assert...
[ "async", "def", "test_unload_entry", "(", "hass", ",", "mock_simple_nws", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "NWS_CONFIG", ",", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "await", "hass", "."...
[ 8, 0 ]
[ 28, 34 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Clementine platform.
Set up the Clementine platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Clementine platform.""" host = config[CONF_HOST] port = config[CONF_PORT] token = config.get(CONF_ACCESS_TOKEN) client = ClementineRemote(host, port, token, reconnect=True) add_entities([ClementineDevice(client...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "host", "=", "config", "[", "CONF_HOST", "]", "port", "=", "config", "[", "CONF_PORT", "]", "token", "=", "config", ".", "get", "(", ...
[ 54, 0 ]
[ 63, 63 ]
python
en
['en', 'da', 'en']
True
ClementineDevice.__init__
(self, client, name)
Initialize the Clementine device.
Initialize the Clementine device.
def __init__(self, client, name): """Initialize the Clementine device.""" self._client = client self._name = name self._muted = False self._volume = 0.0 self._track_id = 0 self._last_track_id = 0 self._track_name = "" self._track_artist = "" ...
[ "def", "__init__", "(", "self", ",", "client", ",", "name", ")", ":", "self", ".", "_client", "=", "client", "self", ".", "_name", "=", "name", "self", ".", "_muted", "=", "False", "self", ".", "_volume", "=", "0.0", "self", ".", "_track_id", "=", ...
[ 69, 4 ]
[ 80, 26 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.update
(self)
Retrieve the latest data from the Clementine Player.
Retrieve the latest data from the Clementine Player.
def update(self): """Retrieve the latest data from the Clementine Player.""" try: client = self._client if client.state == "Playing": self._state = STATE_PLAYING elif client.state == "Paused": self._state = STATE_PAUSED eli...
[ "def", "update", "(", "self", ")", ":", "try", ":", "client", "=", "self", ".", "_client", "if", "client", ".", "state", "==", "\"Playing\"", ":", "self", ".", "_state", "=", "STATE_PLAYING", "elif", "client", ".", "state", "==", "\"Paused\"", ":", "se...
[ 82, 4 ]
[ 109, 17 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 112, 4 ]
[ 114, 25 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.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
ClementineDevice.volume_level
(self)
Volume level of the media player (0..1).
Volume level of the media player (0..1).
def volume_level(self): """Volume level of the media player (0..1).""" return self._volume / 100.0
[ "def", "volume_level", "(", "self", ")", ":", "return", "self", ".", "_volume", "/", "100.0" ]
[ 122, 4 ]
[ 124, 35 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.source
(self)
Return current source name.
Return current source name.
def source(self): """Return current source name.""" source_name = "Unknown" client = self._client if client.active_playlist_id in client.playlists: source_name = client.playlists[client.active_playlist_id]["name"] return source_name
[ "def", "source", "(", "self", ")", ":", "source_name", "=", "\"Unknown\"", "client", "=", "self", ".", "_client", "if", "client", ".", "active_playlist_id", "in", "client", ".", "playlists", ":", "source_name", "=", "client", ".", "playlists", "[", "client",...
[ 127, 4 ]
[ 133, 26 ]
python
en
['fr', 'ig', 'en']
False
ClementineDevice.source_list
(self)
List of available input sources.
List of available input sources.
def source_list(self): """List of available input sources.""" source_names = [s["name"] for s in self._client.playlists.values()] return source_names
[ "def", "source_list", "(", "self", ")", ":", "source_names", "=", "[", "s", "[", "\"name\"", "]", "for", "s", "in", "self", ".", "_client", ".", "playlists", ".", "values", "(", ")", "]", "return", "source_names" ]
[ 136, 4 ]
[ 139, 27 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.select_source
(self, source)
Select input source.
Select input source.
def select_source(self, source): """Select input source.""" client = self._client sources = [s for s in client.playlists.values() if s["name"] == source] if len(sources) == 1: client.change_song(sources[0]["id"], 0)
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "client", "=", "self", ".", "_client", "sources", "=", "[", "s", "for", "s", "in", "client", ".", "playlists", ".", "values", "(", ")", "if", "s", "[", "\"name\"", "]", "==", "source", "...
[ 141, 4 ]
[ 146, 51 ]
python
en
['fr', 'su', 'en']
False
ClementineDevice.media_content_type
(self)
Content type of current playing media.
Content type of current playing media.
def media_content_type(self): """Content type of current playing media.""" return MEDIA_TYPE_MUSIC
[ "def", "media_content_type", "(", "self", ")", ":", "return", "MEDIA_TYPE_MUSIC" ]
[ 149, 4 ]
[ 151, 31 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.media_title
(self)
Title of current playing media.
Title of current playing media.
def media_title(self): """Title of current playing media.""" return self._track_name
[ "def", "media_title", "(", "self", ")", ":", "return", "self", ".", "_track_name" ]
[ 154, 4 ]
[ 156, 31 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.media_artist
(self)
Artist of current playing media, music track only.
Artist of current playing media, music track only.
def media_artist(self): """Artist of current playing media, music track only.""" return self._track_artist
[ "def", "media_artist", "(", "self", ")", ":", "return", "self", ".", "_track_artist" ]
[ 159, 4 ]
[ 161, 33 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.media_album_name
(self)
Album name of current playing media, music track only.
Album name of current playing media, music track only.
def media_album_name(self): """Album name of current playing media, music track only.""" return self._track_album_name
[ "def", "media_album_name", "(", "self", ")", ":", "return", "self", ".", "_track_album_name" ]
[ 164, 4 ]
[ 166, 37 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.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_CLEMENTINE
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_CLEMENTINE" ]
[ 169, 4 ]
[ 171, 33 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.media_image_hash
(self)
Hash value for media image.
Hash value for media image.
def media_image_hash(self): """Hash value for media image.""" if self._client.current_track: return self._client.current_track["track_id"] return None
[ "def", "media_image_hash", "(", "self", ")", ":", "if", "self", ".", "_client", ".", "current_track", ":", "return", "self", ".", "_client", ".", "current_track", "[", "\"track_id\"", "]", "return", "None" ]
[ 174, 4 ]
[ 179, 19 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.async_get_media_image
(self)
Fetch media image of current playing image.
Fetch media image of current playing image.
async def async_get_media_image(self): """Fetch media image of current playing image.""" if self._client.current_track: image = bytes(self._client.current_track["art"]) return (image, "image/png") return None, None
[ "async", "def", "async_get_media_image", "(", "self", ")", ":", "if", "self", ".", "_client", ".", "current_track", ":", "image", "=", "bytes", "(", "self", ".", "_client", ".", "current_track", "[", "\"art\"", "]", ")", "return", "(", "image", ",", "\"i...
[ 181, 4 ]
[ 187, 25 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.volume_up
(self)
Volume up the media player.
Volume up the media player.
def volume_up(self): """Volume up the media player.""" newvolume = min(self._client.volume + 4, 100) self._client.set_volume(newvolume)
[ "def", "volume_up", "(", "self", ")", ":", "newvolume", "=", "min", "(", "self", ".", "_client", ".", "volume", "+", "4", ",", "100", ")", "self", ".", "_client", ".", "set_volume", "(", "newvolume", ")" ]
[ 189, 4 ]
[ 192, 42 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.volume_down
(self)
Volume down media player.
Volume down media player.
def volume_down(self): """Volume down media player.""" newvolume = max(self._client.volume - 4, 0) self._client.set_volume(newvolume)
[ "def", "volume_down", "(", "self", ")", ":", "newvolume", "=", "max", "(", "self", ".", "_client", ".", "volume", "-", "4", ",", "0", ")", "self", ".", "_client", ".", "set_volume", "(", "newvolume", ")" ]
[ 194, 4 ]
[ 197, 42 ]
python
en
['en', 'sl', 'en']
True
ClementineDevice.mute_volume
(self, mute)
Send mute command.
Send mute command.
def mute_volume(self, mute): """Send mute command.""" self._client.set_volume(0)
[ "def", "mute_volume", "(", "self", ",", "mute", ")", ":", "self", ".", "_client", ".", "set_volume", "(", "0", ")" ]
[ 199, 4 ]
[ 201, 34 ]
python
en
['en', 'co', 'en']
True
ClementineDevice.set_volume_level
(self, volume)
Set volume level.
Set volume level.
def set_volume_level(self, volume): """Set volume level.""" self._client.set_volume(int(100 * volume))
[ "def", "set_volume_level", "(", "self", ",", "volume", ")", ":", "self", ".", "_client", ".", "set_volume", "(", "int", "(", "100", "*", "volume", ")", ")" ]
[ 203, 4 ]
[ 205, 50 ]
python
en
['fr', 'sr', 'en']
False
ClementineDevice.media_play_pause
(self)
Simulate play pause media player.
Simulate play pause media player.
def media_play_pause(self): """Simulate play pause media player.""" if self._state == STATE_PLAYING: self.media_pause() else: self.media_play()
[ "def", "media_play_pause", "(", "self", ")", ":", "if", "self", ".", "_state", "==", "STATE_PLAYING", ":", "self", ".", "media_pause", "(", ")", "else", ":", "self", ".", "media_play", "(", ")" ]
[ 207, 4 ]
[ 212, 29 ]
python
en
['en', 'en', 'it']
True
ClementineDevice.media_play
(self)
Send play command.
Send play command.
def media_play(self): """Send play command.""" self._state = STATE_PLAYING self._client.play()
[ "def", "media_play", "(", "self", ")", ":", "self", ".", "_state", "=", "STATE_PLAYING", "self", ".", "_client", ".", "play", "(", ")" ]
[ 214, 4 ]
[ 217, 27 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.media_pause
(self)
Send media pause command to media player.
Send media pause command to media player.
def media_pause(self): """Send media pause command to media player.""" self._state = STATE_PAUSED self._client.pause()
[ "def", "media_pause", "(", "self", ")", ":", "self", ".", "_state", "=", "STATE_PAUSED", "self", ".", "_client", ".", "pause", "(", ")" ]
[ 219, 4 ]
[ 222, 28 ]
python
en
['en', 'en', 'en']
True
ClementineDevice.media_next_track
(self)
Send next track command.
Send next track command.
def media_next_track(self): """Send next track command.""" self._client.next()
[ "def", "media_next_track", "(", "self", ")", ":", "self", ".", "_client", ".", "next", "(", ")" ]
[ 224, 4 ]
[ 226, 27 ]
python
en
['en', 'pt', 'en']
True
ClementineDevice.media_previous_track
(self)
Send the previous track command.
Send the previous track command.
def media_previous_track(self): """Send the previous track command.""" self._client.previous()
[ "def", "media_previous_track", "(", "self", ")", ":", "self", ".", "_client", ".", "previous", "(", ")" ]
[ 228, 4 ]
[ 230, 31 ]
python
en
['en', 'en', 'en']
True
test_form
(hass)
Test we get the form.
Test we get the form.
async def test_form(hass): """Test we get the form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["errors...
[ "async", "def", "test_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(...
[ 9, 0 ]
[ 38, 48 ]
python
en
['en', 'en', 'en']
True
test_form_invalid_auth
(hass)
Test we handle invalid auth.
Test we handle invalid auth.
async def test_form_invalid_auth(hass): """Test we handle invalid auth.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "sense_energy.ASyncSenseable.authenticate", side_effect=SenseAuthenticationExceptio...
[ "async", "def", "test_form_invalid_auth", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")"...
[ 41, 0 ]
[ 57, 56 ]
python
en
['en', 'en', '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( "sense_energy.ASyncSenseable.authenticate", side_effect=SenseAPITimeoutEx...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", "...
[ 60, 0 ]
[ 76, 58 ]
python
en
['en', 'en', 'en']
True
mock_client
(hass, hass_client)
Create http client for webhooks.
Create http client for webhooks.
def mock_client(hass, hass_client): """Create http client for webhooks.""" hass.loop.run_until_complete(async_setup_component(hass, "webhook", {})) return hass.loop.run_until_complete(hass_client())
[ "def", "mock_client", "(", "hass", ",", "hass_client", ")", ":", "hass", ".", "loop", ".", "run_until_complete", "(", "async_setup_component", "(", "hass", ",", "\"webhook\"", ",", "{", "}", ")", ")", "return", "hass", ".", "loop", ".", "run_until_complete",...
[ 8, 0 ]
[ 11, 54 ]
python
en
['en', 'en', 'en']
True
test_unregistering_webhook
(hass, mock_client)
Test unregistering a webhook.
Test unregistering a webhook.
async def test_unregistering_webhook(hass, mock_client): """Test unregistering a webhook.""" hooks = [] webhook_id = hass.components.webhook.async_generate_id() async def handle(*args): """Handle webhook.""" hooks.append(args) hass.components.webhook.async_register("test", "Test ho...
[ "async", "def", "test_unregistering_webhook", "(", "hass", ",", "mock_client", ")", ":", "hooks", "=", "[", "]", "webhook_id", "=", "hass", ".", "components", ".", "webhook", ".", "async_generate_id", "(", ")", "async", "def", "handle", "(", "*", "args", "...
[ 14, 0 ]
[ 33, 26 ]
python
da
['en', 'da', 'it']
False
test_generate_webhook_url
(hass)
Test we generate a webhook url correctly.
Test we generate a webhook url correctly.
async def test_generate_webhook_url(hass): """Test we generate a webhook url correctly.""" await async_process_ha_core_config( hass, {"external_url": "https://example.com"}, ) url = hass.components.webhook.async_generate_url("some_id") assert url == "https://example.com/api/webhook/...
[ "async", "def", "test_generate_webhook_url", "(", "hass", ")", ":", "await", "async_process_ha_core_config", "(", "hass", ",", "{", "\"external_url\"", ":", "\"https://example.com\"", "}", ",", ")", "url", "=", "hass", ".", "components", ".", "webhook", ".", "as...
[ 36, 0 ]
[ 44, 59 ]
python
en
['en', 'en', 'en']
True