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
SmartThingsScene.extra_state_attributes
(self)
Get attributes about the state.
Get attributes about the state.
def extra_state_attributes(self): """Get attributes about the state.""" return { "icon": self._scene.icon, "color": self._scene.color, "location_id": self._scene.location_id, }
[ "def", "extra_state_attributes", "(", "self", ")", ":", "return", "{", "\"icon\"", ":", "self", ".", "_scene", ".", "icon", ",", "\"color\"", ":", "self", ".", "_scene", ".", "color", ",", "\"location_id\"", ":", "self", ".", "_scene", ".", "location_id", ...
[ 26, 4 ]
[ 32, 9 ]
python
en
['en', 'en', 'en']
True
SmartThingsScene.name
(self)
Return the name of the device.
Return the name of the device.
def name(self) -> str: """Return the name of the device.""" return self._scene.name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_scene", ".", "name" ]
[ 35, 4 ]
[ 37, 31 ]
python
en
['en', 'en', 'en']
True
SmartThingsScene.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self) -> str: """Return a unique ID.""" return self._scene.scene_id
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_scene", ".", "scene_id" ]
[ 40, 4 ]
[ 42, 35 ]
python
ca
['fr', 'ca', 'en']
False
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Plaato sensor.
Set up the Plaato sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Plaato sensor."""
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":" ]
[ 26, 0 ]
[ 27, 35 ]
python
en
['en', 'ceb', 'en']
True
async_setup_entry
(hass, entry, async_add_entities)
Set up Plaato from a config entry.
Set up Plaato from a config entry.
async def async_setup_entry(hass, entry, async_add_entities): """Set up Plaato from a config entry.""" entry_data = hass.data[DOMAIN][entry.entry_id] @callback async def _async_update_from_webhook(device_id, sensor_data: PlaatoDevice): """Update/Create the sensors.""" entry_data[SENSOR_...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ",", "async_add_entities", ")", ":", "entry_data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", "]", "@", "callback", "async", "def", "_async_update_from_webhook", ...
[ 30, 0 ]
[ 58, 9 ]
python
en
['en', 'en', 'en']
True
PlaatoSensor.device_class
(self)
Return the class of this device, from component DEVICE_CLASSES.
Return the class of this device, from component DEVICE_CLASSES.
def device_class(self) -> str | None: """Return the class of this device, from component DEVICE_CLASSES.""" if ( self._coordinator is not None and self._sensor_type == PlaatoKeg.Pins.TEMPERATURE ): return DEVICE_CLASS_TEMPERATURE if self._sensor_type =...
[ "def", "device_class", "(", "self", ")", "->", "str", "|", "None", ":", "if", "(", "self", ".", "_coordinator", "is", "not", "None", "and", "self", ".", "_sensor_type", "==", "PlaatoKeg", ".", "Pins", ".", "TEMPERATURE", ")", ":", "return", "DEVICE_CLASS...
[ 65, 4 ]
[ 74, 19 ]
python
en
['en', 'en', 'en']
True
PlaatoSensor.native_value
(self)
Return the state of the sensor.
Return the state of the sensor.
def native_value(self): """Return the state of the sensor.""" return self._sensor_data.sensors.get(self._sensor_type)
[ "def", "native_value", "(", "self", ")", ":", "return", "self", ".", "_sensor_data", ".", "sensors", ".", "get", "(", "self", ".", "_sensor_type", ")" ]
[ 77, 4 ]
[ 79, 63 ]
python
en
['en', 'en', 'en']
True
PlaatoSensor.native_unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def native_unit_of_measurement(self): """Return the unit of measurement.""" return self._sensor_data.get_unit_of_measurement(self._sensor_type)
[ "def", "native_unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_sensor_data", ".", "get_unit_of_measurement", "(", "self", ".", "_sensor_type", ")" ]
[ 82, 4 ]
[ 84, 75 ]
python
en
['en', 'la', 'en']
True
options_updated
(hass, entry)
Handle options update.
Handle options update.
async def options_updated(hass, entry): """Handle options update.""" gateway = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][entry.data[CONF_ID]] async_dispatcher_send(hass, gateway.options_update_signal, entry)
[ "async", "def", "options_updated", "(", "hass", ",", "entry", ")", ":", "gateway", "=", "hass", ".", "data", "[", "DATA_OPENTHERM_GW", "]", "[", "DATA_GATEWAYS", "]", "[", "entry", ".", "data", "[", "CONF_ID", "]", "]", "async_dispatcher_send", "(", "hass"...
[ 85, 0 ]
[ 88, 69 ]
python
en
['en', 'nl', 'en']
True
async_setup_entry
(hass, config_entry)
Set up the OpenTherm Gateway component.
Set up the OpenTherm Gateway component.
async def async_setup_entry(hass, config_entry): """Set up the OpenTherm Gateway component.""" if DATA_OPENTHERM_GW not in hass.data: hass.data[DATA_OPENTHERM_GW] = {DATA_GATEWAYS: {}} gateway = OpenThermGatewayDevice(hass, config_entry) hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][config_entry....
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ")", ":", "if", "DATA_OPENTHERM_GW", "not", "in", "hass", ".", "data", ":", "hass", ".", "data", "[", "DATA_OPENTHERM_GW", "]", "=", "{", "DATA_GATEWAYS", ":", "{", "}", "}", "gateway",...
[ 91, 0 ]
[ 118, 15 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the OpenTherm Gateway component.
Set up the OpenTherm Gateway component.
async def async_setup(hass, config): """Set up the OpenTherm Gateway component.""" if not hass.config_entries.async_entries(DOMAIN) and DOMAIN in config: conf = config[DOMAIN] for device_id, device_config in conf.items(): device_config[CONF_ID] = device_id hass.async_cre...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "if", "not", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ")", "and", "DOMAIN", "in", "config", ":", "conf", "=", "config", "[", "DOMAIN", "]", "for", "device_id"...
[ 121, 0 ]
[ 133, 15 ]
python
en
['en', 'en', 'en']
True
register_services
(hass)
Register services for the component.
Register services for the component.
def register_services(hass): """Register services for the component.""" service_reset_schema = vol.Schema( { vol.Required(ATTR_GW_ID): vol.All( cv.string, vol.In(hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS]) ) } ) service_set_central_heating_ovrd_sc...
[ "def", "register_services", "(", "hass", ")", ":", "service_reset_schema", "=", "vol", ".", "Schema", "(", "{", "vol", ".", "Required", "(", "ATTR_GW_ID", ")", ":", "vol", ".", "All", "(", "cv", ".", "string", ",", "vol", ".", "In", "(", "hass", ".",...
[ 136, 0 ]
[ 395, 5 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, entry)
Cleanup and disconnect from gateway.
Cleanup and disconnect from gateway.
async def async_unload_entry(hass, entry): """Cleanup and disconnect from gateway.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) gateway = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][entry.data[CONF_ID]] await gateway.cleanup() return unload_ok
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "unload_ok", "=", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "entry", ",", "PLATFORMS", ")", "gateway", "=", "hass", ".", "data", "[", "DATA_OPENTHERM_G...
[ 398, 0 ]
[ 403, 20 ]
python
en
['en', 'en', 'en']
True
OpenThermGatewayDevice.__init__
(self, hass, config_entry)
Initialize the OpenTherm Gateway.
Initialize the OpenTherm Gateway.
def __init__(self, hass, config_entry): """Initialize the OpenTherm Gateway.""" self.hass = hass self.device_path = config_entry.data[CONF_DEVICE] self.gw_id = config_entry.data[CONF_ID] self.name = config_entry.data[CONF_NAME] self.climate_config = config_entry.options ...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config_entry", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "device_path", "=", "config_entry", ".", "data", "[", "CONF_DEVICE", "]", "self", ".", "gw_id", "=", "config_entry", ".", "data", ...
[ 409, 4 ]
[ 421, 30 ]
python
en
['en', 'en', 'en']
True
OpenThermGatewayDevice.cleanup
(self, event=None)
Reset overrides on the gateway.
Reset overrides on the gateway.
async def cleanup(self, event=None): """Reset overrides on the gateway.""" await self.gateway.set_control_setpoint(0) await self.gateway.set_max_relative_mod("-") await self.gateway.disconnect()
[ "async", "def", "cleanup", "(", "self", ",", "event", "=", "None", ")", ":", "await", "self", ".", "gateway", ".", "set_control_setpoint", "(", "0", ")", "await", "self", ".", "gateway", ".", "set_max_relative_mod", "(", "\"-\"", ")", "await", "self", "....
[ 423, 4 ]
[ 427, 39 ]
python
en
['en', 'en', 'en']
True
OpenThermGatewayDevice.connect_and_subscribe
(self)
Connect to serial device and subscribe report handler.
Connect to serial device and subscribe report handler.
async def connect_and_subscribe(self): """Connect to serial device and subscribe report handler.""" self.status = await self.gateway.connect(self.hass.loop, self.device_path) version_string = self.status[gw_vars.OTGW].get(gw_vars.OTGW_ABOUT) self.gw_version = version_string[18:] if versi...
[ "async", "def", "connect_and_subscribe", "(", "self", ")", ":", "self", ".", "status", "=", "await", "self", ".", "gateway", ".", "connect", "(", "self", ".", "hass", ".", "loop", ",", "self", ".", "device_path", ")", "version_string", "=", "self", ".", ...
[ 429, 4 ]
[ 456, 45 ]
python
en
['en', 'en', 'en']
True
async_migration_in_progress
(hass: HomeAssistant)
Check to see if a recorder migration is in progress.
Check to see if a recorder migration is in progress.
async def async_migration_in_progress(hass: HomeAssistant) -> bool: """Check to see if a recorder migration is in progress.""" if "recorder" not in hass.config.components: return False from homeassistant.components import ( # pylint: disable=import-outside-toplevel recorder, ) retu...
[ "async", "def", "async_migration_in_progress", "(", "hass", ":", "HomeAssistant", ")", "->", "bool", ":", "if", "\"recorder\"", "not", "in", "hass", ".", "config", ".", "components", ":", "return", "False", "from", "homeassistant", ".", "components", "import", ...
[ 6, 0 ]
[ 14, 59 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: ConfigType)
Register the iZone component config.
Register the iZone component config.
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Register the iZone component config.""" conf = config.get(IZONE) if not conf: return True hass.data[DATA_CONFIG] = conf # Explicitly added in the config file, create a config entry. hass.async_create_task( ...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "conf", "=", "config", ".", "get", "(", "IZONE", ")", "if", "not", "conf", ":", "return", "True", "hass", ".", "data", "[", "D...
[ 28, 0 ]
[ 43, 15 ]
python
en
['en', 'la', 'en']
True
async_setup_entry
(hass, entry)
Set up from a config entry.
Set up from a config entry.
async def async_setup_entry(hass, entry): """Set up from a config entry.""" await async_start_discovery_service(hass) hass.config_entries.async_setup_platforms(entry, PLATFORMS) return True
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "await", "async_start_discovery_service", "(", "hass", ")", "hass", ".", "config_entries", ".", "async_setup_platforms", "(", "entry", ",", "PLATFORMS", ")", "return", "True" ]
[ 46, 0 ]
[ 50, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, entry)
Unload the config entry and stop discovery process.
Unload the config entry and stop discovery process.
async def async_unload_entry(hass, entry): """Unload the config entry and stop discovery process.""" await async_stop_discovery_service(hass) return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "await", "async_stop_discovery_service", "(", "hass", ")", "return", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "entry", ",", "PLATFORMS", ")" ]
[ 53, 0 ]
[ 56, 77 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Z-Wave Climate from Config Entry.
Set up Z-Wave Climate from Config Entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Z-Wave Climate from Config Entry.""" @callback def async_add_climate(values): """Add Z-Wave Climate.""" async_add_entities([ZWaveClimateEntity(values)]) hass.data[DOMAIN][config_entry.entry_id][DATA_UNSUBSCR...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "@", "callback", "def", "async_add_climate", "(", "values", ")", ":", "\"\"\"Add Z-Wave Climate.\"\"\"", "async_add_entities", "(", "[", "ZWaveClimateEntity", "...
[ 142, 0 ]
[ 154, 5 ]
python
en
['en', 'en', 'en']
True
_get_list_id
(value_lst, value_lbl)
Return the id for the value in the list.
Return the id for the value in the list.
def _get_list_id(value_lst, value_lbl): """Return the id for the value in the list.""" return next( (val[VALUE_ID] for val in value_lst if val[VALUE_LABEL] == value_lbl), None )
[ "def", "_get_list_id", "(", "value_lst", ",", "value_lbl", ")", ":", "return", "next", "(", "(", "val", "[", "VALUE_ID", "]", "for", "val", "in", "value_lst", "if", "val", "[", "VALUE_LABEL", "]", "==", "value_lbl", ")", ",", "None", ")" ]
[ 371, 0 ]
[ 375, 5 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.__init__
(self, values)
Initialize the entity.
Initialize the entity.
def __init__(self, values): """Initialize the entity.""" super().__init__(values) self._hvac_modes = {} self._hvac_presets = {} self.on_value_update()
[ "def", "__init__", "(", "self", ",", "values", ")", ":", "super", "(", ")", ".", "__init__", "(", "values", ")", "self", ".", "_hvac_modes", "=", "{", "}", "self", ".", "_hvac_presets", "=", "{", "}", "self", ".", "on_value_update", "(", ")" ]
[ 160, 4 ]
[ 165, 30 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.on_value_update
(self)
Call when the underlying values object changes.
Call when the underlying values object changes.
def on_value_update(self): """Call when the underlying values object changes.""" self._current_mode_setpoint_values = self._get_current_mode_setpoint_values() if not self._hvac_modes: self._set_modes_and_presets()
[ "def", "on_value_update", "(", "self", ")", ":", "self", ".", "_current_mode_setpoint_values", "=", "self", ".", "_get_current_mode_setpoint_values", "(", ")", "if", "not", "self", ".", "_hvac_modes", ":", "self", ".", "_set_modes_and_presets", "(", ")" ]
[ 168, 4 ]
[ 172, 41 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.hvac_mode
(self)
Return hvac operation ie. heat, cool mode.
Return hvac operation ie. heat, cool mode.
def hvac_mode(self): """Return hvac operation ie. heat, cool mode.""" if not self.values.mode: # Thermostat(valve) with no support for setting a mode is considered heating-only return HVAC_MODE_HEAT return ZW_HVAC_MODE_MAPPINGS.get( self.values.mode.value[VALU...
[ "def", "hvac_mode", "(", "self", ")", ":", "if", "not", "self", ".", "values", ".", "mode", ":", "# Thermostat(valve) with no support for setting a mode is considered heating-only", "return", "HVAC_MODE_HEAT", "return", "ZW_HVAC_MODE_MAPPINGS", ".", "get", "(", "self", ...
[ 175, 4 ]
[ 182, 9 ]
python
bg
['en', 'bg', 'bg']
True
ZWaveClimateEntity.hvac_modes
(self)
Return the list of available hvac operation modes.
Return the list of available hvac operation modes.
def hvac_modes(self): """Return the list of available hvac operation modes.""" return list(self._hvac_modes)
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_hvac_modes", ")" ]
[ 185, 4 ]
[ 187, 37 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.fan_mode
(self)
Return the fan speed set.
Return the fan speed set.
def fan_mode(self): """Return the fan speed set.""" return self.values.fan_mode.value[VALUE_SELECTED_LABEL]
[ "def", "fan_mode", "(", "self", ")", ":", "return", "self", ".", "values", ".", "fan_mode", ".", "value", "[", "VALUE_SELECTED_LABEL", "]" ]
[ 190, 4 ]
[ 192, 63 ]
python
en
['en', 'fy', 'en']
True
ZWaveClimateEntity.fan_modes
(self)
Return a list of available fan modes.
Return a list of available fan modes.
def fan_modes(self): """Return a list of available fan modes.""" return [entry[VALUE_LABEL] for entry in self.values.fan_mode.value[VALUE_LIST]]
[ "def", "fan_modes", "(", "self", ")", ":", "return", "[", "entry", "[", "VALUE_LABEL", "]", "for", "entry", "in", "self", ".", "values", ".", "fan_mode", ".", "value", "[", "VALUE_LIST", "]", "]" ]
[ 195, 4 ]
[ 197, 87 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" if self.values.temperature is not None and self.values.temperature.units == "F": return TEMP_FAHRENHEIT return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "if", "self", ".", "values", ".", "temperature", "is", "not", "None", "and", "self", ".", "values", ".", "temperature", ".", "units", "==", "\"F\"", ":", "return", "TEMP_FAHRENHEIT", "return", "TEMP_CELSIUS" ...
[ 200, 4 ]
[ 204, 27 ]
python
en
['en', 'la', 'en']
True
ZWaveClimateEntity.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" if not self.values.temperature: return None return self.values.temperature.value
[ "def", "current_temperature", "(", "self", ")", ":", "if", "not", "self", ".", "values", ".", "temperature", ":", "return", "None", "return", "self", ".", "values", ".", "temperature", ".", "value" ]
[ 207, 4 ]
[ 211, 44 ]
python
en
['en', 'la', 'en']
True
ZWaveClimateEntity.hvac_action
(self)
Return the current running hvac operation if supported.
Return the current running hvac operation if supported.
def hvac_action(self): """Return the current running hvac operation if supported.""" if not self.values.operating_state: return None cur_state = self.values.operating_state.value.lower() return HVAC_CURRENT_MAPPINGS.get(cur_state)
[ "def", "hvac_action", "(", "self", ")", ":", "if", "not", "self", ".", "values", ".", "operating_state", ":", "return", "None", "cur_state", "=", "self", ".", "values", ".", "operating_state", ".", "value", ".", "lower", "(", ")", "return", "HVAC_CURRENT_M...
[ 214, 4 ]
[ 219, 51 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.preset_mode
(self)
Return preset operation ie. eco, away.
Return preset operation ie. eco, away.
def preset_mode(self): """Return preset operation ie. eco, away.""" # A Zwave mode that can not be translated to a hass mode is considered a preset if not self.values.mode: return None if self.values.mode.value[VALUE_SELECTED_ID] not in MODES_LIST: return self.val...
[ "def", "preset_mode", "(", "self", ")", ":", "# A Zwave mode that can not be translated to a hass mode is considered a preset", "if", "not", "self", ".", "values", ".", "mode", ":", "return", "None", "if", "self", ".", "values", ".", "mode", ".", "value", "[", "VA...
[ 222, 4 ]
[ 229, 26 ]
python
en
['nl', 'sr', 'en']
False
ZWaveClimateEntity.preset_modes
(self)
Return the list of available preset operation modes.
Return the list of available preset operation modes.
def preset_modes(self): """Return the list of available preset operation modes.""" return list(self._hvac_presets)
[ "def", "preset_modes", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_hvac_presets", ")" ]
[ 232, 4 ]
[ 234, 39 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.target_temperature
(self)
Return the temperature we try to reach.
Return the temperature we try to reach.
def target_temperature(self): """Return the temperature we try to reach.""" return self._current_mode_setpoint_values[0].value
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_current_mode_setpoint_values", "[", "0", "]", ".", "value" ]
[ 237, 4 ]
[ 239, 58 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.target_temperature_low
(self)
Return the lowbound target temperature we try to reach.
Return the lowbound target temperature we try to reach.
def target_temperature_low(self) -> float | None: """Return the lowbound target temperature we try to reach.""" return self._current_mode_setpoint_values[0].value
[ "def", "target_temperature_low", "(", "self", ")", "->", "float", "|", "None", ":", "return", "self", ".", "_current_mode_setpoint_values", "[", "0", "]", ".", "value" ]
[ 242, 4 ]
[ 244, 58 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.target_temperature_high
(self)
Return the highbound target temperature we try to reach.
Return the highbound target temperature we try to reach.
def target_temperature_high(self) -> float | None: """Return the highbound target temperature we try to reach.""" return self._current_mode_setpoint_values[1].value
[ "def", "target_temperature_high", "(", "self", ")", "->", "float", "|", "None", ":", "return", "self", ".", "_current_mode_setpoint_values", "[", "1", "]", ".", "value" ]
[ 247, 4 ]
[ 249, 58 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.async_set_temperature
(self, **kwargs)
Set new target temperature. Must know if single or double setpoint.
Set new target temperature.
async def async_set_temperature(self, **kwargs): """Set new target temperature. Must know if single or double setpoint. """ hvac_mode = kwargs.get(ATTR_HVAC_MODE) if hvac_mode is not None: await self.async_set_hvac_mode(hvac_mode) if len(self._current_mode_...
[ "async", "def", "async_set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "hvac_mode", "=", "kwargs", ".", "get", "(", "ATTR_HVAC_MODE", ")", "if", "hvac_mode", "is", "not", "None", ":", "await", "self", ".", "async_set_hvac_mode", "(", "hva...
[ 251, 4 ]
[ 273, 58 ]
python
en
['en', 'ca', 'en']
True
ZWaveClimateEntity.async_set_fan_mode
(self, fan_mode)
Set new target fan mode.
Set new target fan mode.
async def async_set_fan_mode(self, fan_mode): """Set new target fan mode.""" # get id for this fan_mode fan_mode_value = _get_list_id(self.values.fan_mode.value[VALUE_LIST], fan_mode) if fan_mode_value is None: _LOGGER.warning("Received an invalid fan mode: %s", fan_mode) ...
[ "async", "def", "async_set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "# get id for this fan_mode", "fan_mode_value", "=", "_get_list_id", "(", "self", ".", "values", ".", "fan_mode", ".", "value", "[", "VALUE_LIST", "]", ",", "fan_mode", ")", "if", "f...
[ 275, 4 ]
[ 282, 55 ]
python
en
['sv', 'fy', 'en']
False
ZWaveClimateEntity.async_set_hvac_mode
(self, hvac_mode)
Set new target hvac mode.
Set new target hvac mode.
async def async_set_hvac_mode(self, hvac_mode): """Set new target hvac mode.""" if not self.values.mode: # Thermostat(valve) with no support for setting a mode _LOGGER.warning( "Thermostat %s does not support setting a mode", self.entity_id ) ...
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "if", "not", "self", ".", "values", ".", "mode", ":", "# Thermostat(valve) with no support for setting a mode", "_LOGGER", ".", "warning", "(", "\"Thermostat %s does not support setting a mode...
[ 284, 4 ]
[ 296, 52 ]
python
da
['da', 'su', 'en']
False
ZWaveClimateEntity.async_set_preset_mode
(self, preset_mode)
Set new target preset mode.
Set new target preset mode.
async def async_set_preset_mode(self, preset_mode): """Set new target preset mode.""" if preset_mode == PRESET_NONE: # try to restore to the (translated) main hvac mode await self.async_set_hvac_mode(self.hvac_mode) return preset_mode_value = self._hvac_preset...
[ "async", "def", "async_set_preset_mode", "(", "self", ",", "preset_mode", ")", ":", "if", "preset_mode", "==", "PRESET_NONE", ":", "# try to restore to the (translated) main hvac mode", "await", "self", ".", "async_set_hvac_mode", "(", "self", ".", "hvac_mode", ")", "...
[ 298, 4 ]
[ 308, 54 ]
python
de
['de', 'su', 'en']
False
ZWaveClimateEntity.extra_state_attributes
(self)
Return the optional state attributes.
Return the optional state attributes.
def extra_state_attributes(self): """Return the optional state attributes.""" data = super().extra_state_attributes if self.values.fan_action: data[ATTR_FAN_ACTION] = self.values.fan_action.value if self.values.valve_position: data[ ATTR_VALVE_POSI...
[ "def", "extra_state_attributes", "(", "self", ")", ":", "data", "=", "super", "(", ")", ".", "extra_state_attributes", "if", "self", ".", "values", ".", "fan_action", ":", "data", "[", "ATTR_FAN_ACTION", "]", "=", "self", ".", "values", ".", "fan_action", ...
[ 311, 4 ]
[ 320, 19 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" support = 0 if len(self._current_mode_setpoint_values) == 1: support |= SUPPORT_TARGET_TEMPERATURE if len(self._current_mode_setpoint_values) > 1: support |= SUPPORT_TARGET_TEMPERATURE_RANG...
[ "def", "supported_features", "(", "self", ")", ":", "support", "=", "0", "if", "len", "(", "self", ".", "_current_mode_setpoint_values", ")", "==", "1", ":", "support", "|=", "SUPPORT_TARGET_TEMPERATURE", "if", "len", "(", "self", ".", "_current_mode_setpoint_va...
[ 323, 4 ]
[ 334, 22 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity._get_current_mode_setpoint_values
(self)
Return a tuple of current setpoint Z-Wave value(s).
Return a tuple of current setpoint Z-Wave value(s).
def _get_current_mode_setpoint_values(self) -> tuple: """Return a tuple of current setpoint Z-Wave value(s).""" if not self.values.mode: setpoint_names = ("setpoint_heating",) else: current_mode = self.values.mode.value[VALUE_SELECTED_ID] setpoint_names = MODE...
[ "def", "_get_current_mode_setpoint_values", "(", "self", ")", "->", "tuple", ":", "if", "not", "self", ".", "values", ".", "mode", ":", "setpoint_names", "=", "(", "\"setpoint_heating\"", ",", ")", "else", ":", "current_mode", "=", "self", ".", "values", "."...
[ 336, 4 ]
[ 348, 9 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity._set_modes_and_presets
(self)
Convert Z-Wave Thermostat modes into Home Assistant modes and presets.
Convert Z-Wave Thermostat modes into Home Assistant modes and presets.
def _set_modes_and_presets(self): """Convert Z-Wave Thermostat modes into Home Assistant modes and presets.""" all_modes = {} all_presets = {PRESET_NONE: None} if self.values.mode: # Z-Wave uses one list for both modes and presets. # Iterate over all Z-Wave Thermo...
[ "def", "_set_modes_and_presets", "(", "self", ")", ":", "all_modes", "=", "{", "}", "all_presets", "=", "{", "PRESET_NONE", ":", "None", "}", "if", "self", ".", "values", ".", "mode", ":", "# Z-Wave uses one list for both modes and presets.", "# Iterate over all Z-W...
[ 350, 4 ]
[ 368, 40 ]
python
en
['en', 'en', 'en']
True
File.__init__
(self, source_uri=None, local_vars_configuration=None)
File - a model defined in OpenAPI
File - a model defined in OpenAPI
def __init__(self, source_uri=None, local_vars_configuration=None): # noqa: E501 """File - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration.get_default_copy() self.local_vars_configuration = local_vars_configur...
[ "def", "__init__", "(", "self", ",", "source_uri", "=", "None", ",", "local_vars_configuration", "=", "None", ")", ":", "# noqa: E501", "# noqa: E501", "if", "local_vars_configuration", "is", "None", ":", "local_vars_configuration", "=", "Configuration", ".", "get_d...
[ 42, 4 ]
[ 52, 40 ]
python
en
['en', 'en', 'en']
True
File.source_uri
(self)
Gets the source_uri of this File. # noqa: E501 Test capitalization # noqa: E501 :return: The source_uri of this File. # noqa: E501 :rtype: str
Gets the source_uri of this File. # noqa: E501
def source_uri(self): """Gets the source_uri of this File. # noqa: E501 Test capitalization # noqa: E501 :return: The source_uri of this File. # noqa: E501 :rtype: str """ return self._source_uri
[ "def", "source_uri", "(", "self", ")", ":", "return", "self", ".", "_source_uri" ]
[ 55, 4 ]
[ 63, 31 ]
python
en
['en', 'en', 'en']
True
File.source_uri
(self, source_uri)
Sets the source_uri of this File. Test capitalization # noqa: E501 :param source_uri: The source_uri of this File. # noqa: E501 :type source_uri: str
Sets the source_uri of this File.
def source_uri(self, source_uri): """Sets the source_uri of this File. Test capitalization # noqa: E501 :param source_uri: The source_uri of this File. # noqa: E501 :type source_uri: str """ self._source_uri = source_uri
[ "def", "source_uri", "(", "self", ",", "source_uri", ")", ":", "self", ".", "_source_uri", "=", "source_uri" ]
[ 66, 4 ]
[ 75, 37 ]
python
en
['en', 'en', 'en']
True
File.to_dict
(self, serialize=False)
Returns the model properties as a dict
Returns the model properties as a dict
def to_dict(self, serialize=False): """Returns the model properties as a dict""" result = {} def convert(x): if hasattr(x, "to_dict"): args = inspect.getargspec(x.to_dict).args if len(args) == 1: return x.to_dict() ...
[ "def", "to_dict", "(", "self", ",", "serialize", "=", "False", ")", ":", "result", "=", "{", "}", "def", "convert", "(", "x", ")", ":", "if", "hasattr", "(", "x", ",", "\"to_dict\"", ")", ":", "args", "=", "inspect", ".", "getargspec", "(", "x", ...
[ 77, 4 ]
[ 107, 21 ]
python
en
['en', 'en', 'en']
True
File.to_str
(self)
Returns the string representation of the model
Returns the string representation of the model
def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict())
[ "def", "to_str", "(", "self", ")", ":", "return", "pprint", ".", "pformat", "(", "self", ".", "to_dict", "(", ")", ")" ]
[ 109, 4 ]
[ 111, 45 ]
python
en
['en', 'en', 'en']
True
File.__repr__
(self)
For `print` and `pprint`
For `print` and `pprint`
def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "to_str", "(", ")" ]
[ 113, 4 ]
[ 115, 28 ]
python
en
['en', 'en', 'en']
True
File.__eq__
(self, other)
Returns true if both objects are equal
Returns true if both objects are equal
def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, File): return False return self.to_dict() == other.to_dict()
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "File", ")", ":", "return", "False", "return", "self", ".", "to_dict", "(", ")", "==", "other", ".", "to_dict", "(", ")" ]
[ 117, 4 ]
[ 122, 48 ]
python
en
['en', 'en', 'en']
True
File.__ne__
(self, other)
Returns true if both objects are not equal
Returns true if both objects are not equal
def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, File): return True return self.to_dict() != other.to_dict()
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "File", ")", ":", "return", "True", "return", "self", ".", "to_dict", "(", ")", "!=", "other", ".", "to_dict", "(", ")" ]
[ 124, 4 ]
[ 129, 48 ]
python
en
['en', 'en', 'en']
True
test_eve_degree_setup
(hass)
Test that the accessory can be correctly setup in HA.
Test that the accessory can be correctly setup in HA.
async def test_eve_degree_setup(hass): """Test that the accessory can be correctly setup in HA.""" accessories = await setup_accessories_from_file(hass, "eve_degree.json") config_entry, pairing = await setup_test_accessories(hass, accessories) entity_registry = er.async_get(hass) device_registry = ...
[ "async", "def", "test_eve_degree_setup", "(", "hass", ")", ":", "accessories", "=", "await", "setup_accessories_from_file", "(", "hass", ",", "\"eve_degree.json\"", ")", "config_entry", ",", "pairing", "=", "await", "setup_test_accessories", "(", "hass", ",", "acces...
[ 11, 0 ]
[ 73, 31 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up switches for UniFi component. Switches are controlling network access and switch ports with POE.
Set up switches for UniFi component.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up switches for UniFi component. Switches are controlling network access and switch ports with POE. """ controller = hass.data[UNIFI_DOMAIN][config_entry.entry_id] controller.entities[DOMAIN] = { BLOCK_SWITCH: set()...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "controller", "=", "hass", ".", "data", "[", "UNIFI_DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "controller", ".", "entities", "[", "DOMAIN...
[ 38, 0 ]
[ 94, 29 ]
python
en
['en', 'en', 'en']
True
add_block_entities
(controller, async_add_entities, clients)
Add new switch entities from the controller.
Add new switch entities from the controller.
def add_block_entities(controller, async_add_entities, clients): """Add new switch entities from the controller.""" switches = [] for mac in controller.option_block_clients: if mac in controller.entities[DOMAIN][BLOCK_SWITCH] or mac not in clients: continue client = controller....
[ "def", "add_block_entities", "(", "controller", ",", "async_add_entities", ",", "clients", ")", ":", "switches", "=", "[", "]", "for", "mac", "in", "controller", ".", "option_block_clients", ":", "if", "mac", "in", "controller", ".", "entities", "[", "DOMAIN",...
[ 98, 0 ]
[ 110, 36 ]
python
en
['en', 'en', 'en']
True
add_poe_entities
(controller, async_add_entities, clients, known_poe_clients)
Add new switch entities from the controller.
Add new switch entities from the controller.
def add_poe_entities(controller, async_add_entities, clients, known_poe_clients): """Add new switch entities from the controller.""" switches = [] devices = controller.api.devices for mac in clients: if mac in controller.entities[DOMAIN][POE_SWITCH]: continue client = cont...
[ "def", "add_poe_entities", "(", "controller", ",", "async_add_entities", ",", "clients", ",", "known_poe_clients", ")", ":", "switches", "=", "[", "]", "devices", "=", "controller", ".", "api", ".", "devices", "for", "mac", "in", "clients", ":", "if", "mac",...
[ 114, 0 ]
[ 161, 36 ]
python
en
['en', 'en', 'en']
True
add_dpi_entities
(controller, async_add_entities, dpi_groups)
Add new switch entities from the controller.
Add new switch entities from the controller.
def add_dpi_entities(controller, async_add_entities, dpi_groups): """Add new switch entities from the controller.""" switches = [] for group in dpi_groups: if ( group in controller.entities[DOMAIN][DPI_SWITCH] or not dpi_groups[group].dpiapp_ids ): contin...
[ "def", "add_dpi_entities", "(", "controller", ",", "async_add_entities", ",", "dpi_groups", ")", ":", "switches", "=", "[", "]", "for", "group", "in", "dpi_groups", ":", "if", "(", "group", "in", "controller", ".", "entities", "[", "DOMAIN", "]", "[", "DPI...
[ 165, 0 ]
[ 179, 36 ]
python
en
['en', 'en', 'en']
True
UniFiPOEClientSwitch.__init__
(self, client, controller)
Set up POE switch.
Set up POE switch.
def __init__(self, client, controller): """Set up POE switch.""" super().__init__(client, controller) self.poe_mode = None if client.sw_port and self.port.poe_mode != "off": self.poe_mode = self.port.poe_mode
[ "def", "__init__", "(", "self", ",", "client", ",", "controller", ")", ":", "super", "(", ")", ".", "__init__", "(", "client", ",", "controller", ")", "self", ".", "poe_mode", "=", "None", "if", "client", ".", "sw_port", "and", "self", ".", "port", "...
[ 188, 4 ]
[ 194, 46 ]
python
en
['en', 'zu', 'en']
True
UniFiPOEClientSwitch.async_added_to_hass
(self)
Call when entity about to be added to Home Assistant.
Call when entity about to be added to Home Assistant.
async def async_added_to_hass(self): """Call when entity about to be added to Home Assistant.""" await super().async_added_to_hass() if self.poe_mode: # POE is enabled and client in a known state return if (state := await self.async_get_last_state()) is None: r...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "if", "self", ".", "poe_mode", ":", "# POE is enabled and client in a known state", "return", "if", "(", "state", ":=", "await", "self...
[ 196, 4 ]
[ 212, 69 ]
python
en
['en', 'en', 'en']
True
UniFiPOEClientSwitch.is_on
(self)
Return true if POE is active.
Return true if POE is active.
def is_on(self): """Return true if POE is active.""" return self.port.poe_mode != "off"
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "port", ".", "poe_mode", "!=", "\"off\"" ]
[ 215, 4 ]
[ 217, 42 ]
python
en
['en', 'nl', 'en']
True
UniFiPOEClientSwitch.available
(self)
Return if switch is available. Poe_mode None means its POE state is unknown. Sw_mac unavailable means restored client.
Return if switch is available.
def available(self): """Return if switch is available. Poe_mode None means its POE state is unknown. Sw_mac unavailable means restored client. """ return ( self.poe_mode is not None and self.controller.available and self.client.sw_port ...
[ "def", "available", "(", "self", ")", ":", "return", "(", "self", ".", "poe_mode", "is", "not", "None", "and", "self", ".", "controller", ".", "available", "and", "self", ".", "client", ".", "sw_port", "and", "self", ".", "client", ".", "sw_mac", "and"...
[ 220, 4 ]
[ 232, 9 ]
python
en
['en', 'en', 'en']
True
UniFiPOEClientSwitch.async_turn_on
(self, **kwargs)
Enable POE for client.
Enable POE for client.
async def async_turn_on(self, **kwargs): """Enable POE for client.""" await self.device.async_set_port_poe_mode(self.client.sw_port, self.poe_mode)
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "device", ".", "async_set_port_poe_mode", "(", "self", ".", "client", ".", "sw_port", ",", "self", ".", "poe_mode", ")" ]
[ 234, 4 ]
[ 236, 85 ]
python
en
['en', 'en', 'en']
True
UniFiPOEClientSwitch.async_turn_off
(self, **kwargs)
Disable POE for client.
Disable POE for client.
async def async_turn_off(self, **kwargs): """Disable POE for client.""" await self.device.async_set_port_poe_mode(self.client.sw_port, "off")
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "device", ".", "async_set_port_poe_mode", "(", "self", ".", "client", ".", "sw_port", ",", "\"off\"", ")" ]
[ 238, 4 ]
[ 240, 77 ]
python
en
['en', 'en', 'en']
True
UniFiPOEClientSwitch.extra_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def extra_state_attributes(self): """Return the device state attributes.""" attributes = { "power": self.port.poe_power, "switch": self.client.sw_mac, "port": self.client.sw_port, "poe_mode": self.poe_mode, } return attributes
[ "def", "extra_state_attributes", "(", "self", ")", ":", "attributes", "=", "{", "\"power\"", ":", "self", ".", "port", ".", "poe_power", ",", "\"switch\"", ":", "self", ".", "client", ".", "sw_mac", ",", "\"port\"", ":", "self", ".", "client", ".", "sw_p...
[ 243, 4 ]
[ 251, 25 ]
python
en
['en', 'en', 'en']
True
UniFiPOEClientSwitch.device
(self)
Shortcut to the switch that client is connected to.
Shortcut to the switch that client is connected to.
def device(self): """Shortcut to the switch that client is connected to.""" return self.controller.api.devices[self.client.sw_mac]
[ "def", "device", "(", "self", ")", ":", "return", "self", ".", "controller", ".", "api", ".", "devices", "[", "self", ".", "client", ".", "sw_mac", "]" ]
[ 254, 4 ]
[ 256, 62 ]
python
en
['en', 'en', 'en']
True
UniFiPOEClientSwitch.port
(self)
Shortcut to the switch port that client is connected to.
Shortcut to the switch port that client is connected to.
def port(self): """Shortcut to the switch port that client is connected to.""" return self.device.ports[self.client.sw_port]
[ "def", "port", "(", "self", ")", ":", "return", "self", ".", "device", ".", "ports", "[", "self", ".", "client", ".", "sw_port", "]" ]
[ 259, 4 ]
[ 261, 53 ]
python
en
['en', 'en', 'en']
True
UniFiPOEClientSwitch.options_updated
(self)
Config entry options are updated, remove entity if option is disabled.
Config entry options are updated, remove entity if option is disabled.
async def options_updated(self) -> None: """Config entry options are updated, remove entity if option is disabled.""" if not self.controller.option_poe_clients: await self.remove_item({self.client.mac})
[ "async", "def", "options_updated", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "controller", ".", "option_poe_clients", ":", "await", "self", ".", "remove_item", "(", "{", "self", ".", "client", ".", "mac", "}", ")" ]
[ 263, 4 ]
[ 266, 53 ]
python
en
['en', 'en', 'en']
True
UniFiBlockClientSwitch.__init__
(self, client, controller)
Set up block switch.
Set up block switch.
def __init__(self, client, controller): """Set up block switch.""" super().__init__(client, controller) self._is_blocked = client.blocked
[ "def", "__init__", "(", "self", ",", "client", ",", "controller", ")", ":", "super", "(", ")", ".", "__init__", "(", "client", ",", "controller", ")", "self", ".", "_is_blocked", "=", "client", ".", "blocked" ]
[ 275, 4 ]
[ 279, 41 ]
python
en
['en', 'zh', 'en']
True
UniFiBlockClientSwitch.async_update_callback
(self)
Update the clients state.
Update the clients state.
def async_update_callback(self) -> None: """Update the clients state.""" if ( self.client.last_updated == SOURCE_EVENT and self.client.event.event in CLIENT_BLOCKED + CLIENT_UNBLOCKED ): self._is_blocked = self.client.event.event in CLIENT_BLOCKED sup...
[ "def", "async_update_callback", "(", "self", ")", "->", "None", ":", "if", "(", "self", ".", "client", ".", "last_updated", "==", "SOURCE_EVENT", "and", "self", ".", "client", ".", "event", ".", "event", "in", "CLIENT_BLOCKED", "+", "CLIENT_UNBLOCKED", ")", ...
[ 282, 4 ]
[ 290, 39 ]
python
en
['en', 'en', 'en']
True
UniFiBlockClientSwitch.is_on
(self)
Return true if client is allowed to connect.
Return true if client is allowed to connect.
def is_on(self): """Return true if client is allowed to connect.""" return not self._is_blocked
[ "def", "is_on", "(", "self", ")", ":", "return", "not", "self", ".", "_is_blocked" ]
[ 293, 4 ]
[ 295, 35 ]
python
en
['en', 'en', 'en']
True
UniFiBlockClientSwitch.async_turn_on
(self, **kwargs)
Turn on connectivity for client.
Turn on connectivity for client.
async def async_turn_on(self, **kwargs): """Turn on connectivity for client.""" await self.controller.api.clients.async_unblock(self.client.mac)
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "controller", ".", "api", ".", "clients", ".", "async_unblock", "(", "self", ".", "client", ".", "mac", ")" ]
[ 297, 4 ]
[ 299, 72 ]
python
en
['en', 'en', 'en']
True
UniFiBlockClientSwitch.async_turn_off
(self, **kwargs)
Turn off connectivity for client.
Turn off connectivity for client.
async def async_turn_off(self, **kwargs): """Turn off connectivity for client.""" await self.controller.api.clients.async_block(self.client.mac)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "controller", ".", "api", ".", "clients", ".", "async_block", "(", "self", ".", "client", ".", "mac", ")" ]
[ 301, 4 ]
[ 303, 70 ]
python
en
['en', 'en', 'en']
True
UniFiBlockClientSwitch.icon
(self)
Return the icon to use in the frontend.
Return the icon to use in the frontend.
def icon(self): """Return the icon to use in the frontend.""" if self._is_blocked: return "mdi:network-off" return "mdi:network"
[ "def", "icon", "(", "self", ")", ":", "if", "self", ".", "_is_blocked", ":", "return", "\"mdi:network-off\"", "return", "\"mdi:network\"" ]
[ 306, 4 ]
[ 310, 28 ]
python
en
['en', 'en', 'en']
True
UniFiBlockClientSwitch.options_updated
(self)
Config entry options are updated, remove entity if option is disabled.
Config entry options are updated, remove entity if option is disabled.
async def options_updated(self) -> None: """Config entry options are updated, remove entity if option is disabled.""" if self.client.mac not in self.controller.option_block_clients: await self.remove_item({self.client.mac})
[ "async", "def", "options_updated", "(", "self", ")", "->", "None", ":", "if", "self", ".", "client", ".", "mac", "not", "in", "self", ".", "controller", ".", "option_block_clients", ":", "await", "self", ".", "remove_item", "(", "{", "self", ".", "client...
[ 312, 4 ]
[ 315, 53 ]
python
en
['en', 'en', 'en']
True
UniFiDPIRestrictionSwitch.key
(self)
Return item key.
Return item key.
def key(self) -> Any: """Return item key.""" return self._item.id
[ "def", "key", "(", "self", ")", "->", "Any", ":", "return", "self", ".", "_item", ".", "id" ]
[ 325, 4 ]
[ 327, 28 ]
python
en
['en', 'hi-Latn', 'en']
True
UniFiDPIRestrictionSwitch.unique_id
(self)
Return a unique identifier for this switch.
Return a unique identifier for this switch.
def unique_id(self): """Return a unique identifier for this switch.""" return self._item.id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_item", ".", "id" ]
[ 330, 4 ]
[ 332, 28 ]
python
en
['en', 'en', 'en']
True
UniFiDPIRestrictionSwitch.name
(self)
Return the name of the client.
Return the name of the client.
def name(self) -> str: """Return the name of the client.""" return self._item.name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_item", ".", "name" ]
[ 335, 4 ]
[ 337, 30 ]
python
en
['en', 'en', 'en']
True
UniFiDPIRestrictionSwitch.icon
(self)
Return the icon to use in the frontend.
Return the icon to use in the frontend.
def icon(self): """Return the icon to use in the frontend.""" if self._item.enabled: return "mdi:network" return "mdi:network-off"
[ "def", "icon", "(", "self", ")", ":", "if", "self", ".", "_item", ".", "enabled", ":", "return", "\"mdi:network\"", "return", "\"mdi:network-off\"" ]
[ 340, 4 ]
[ 344, 32 ]
python
en
['en', 'en', 'en']
True
UniFiDPIRestrictionSwitch.is_on
(self)
Return true if client is allowed to connect.
Return true if client is allowed to connect.
def is_on(self): """Return true if client is allowed to connect.""" return self._item.enabled
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_item", ".", "enabled" ]
[ 347, 4 ]
[ 349, 33 ]
python
en
['en', 'en', 'en']
True
UniFiDPIRestrictionSwitch.async_turn_on
(self, **kwargs)
Turn on connectivity for client.
Turn on connectivity for client.
async def async_turn_on(self, **kwargs): """Turn on connectivity for client.""" await self.controller.api.dpi_groups.async_enable(self._item)
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "controller", ".", "api", ".", "dpi_groups", ".", "async_enable", "(", "self", ".", "_item", ")" ]
[ 351, 4 ]
[ 353, 69 ]
python
en
['en', 'en', 'en']
True
UniFiDPIRestrictionSwitch.async_turn_off
(self, **kwargs)
Turn off connectivity for client.
Turn off connectivity for client.
async def async_turn_off(self, **kwargs): """Turn off connectivity for client.""" await self.controller.api.dpi_groups.async_disable(self._item)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "controller", ".", "api", ".", "dpi_groups", ".", "async_disable", "(", "self", ".", "_item", ")" ]
[ 355, 4 ]
[ 357, 70 ]
python
en
['en', 'en', 'en']
True
UniFiDPIRestrictionSwitch.options_updated
(self)
Config entry options are updated, remove entity if option is disabled.
Config entry options are updated, remove entity if option is disabled.
async def options_updated(self) -> None: """Config entry options are updated, remove entity if option is disabled.""" if not self.controller.option_dpi_restrictions: await self.remove_item({self.key})
[ "async", "def", "options_updated", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "controller", ".", "option_dpi_restrictions", ":", "await", "self", ".", "remove_item", "(", "{", "self", ".", "key", "}", ")" ]
[ 359, 4 ]
[ 362, 46 ]
python
en
['en', 'en', 'en']
True
UniFiDPIRestrictionSwitch.device_info
(self)
Return a service description for device registry.
Return a service description for device registry.
def device_info(self) -> DeviceInfo: """Return a service description for device registry.""" return { "identifiers": {(DOMAIN, f"unifi_controller_{self._item.site_id}")}, "name": "UniFi Controller", "manufacturer": ATTR_MANUFACTURER, "model": "UniFi Contro...
[ "def", "device_info", "(", "self", ")", "->", "DeviceInfo", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "f\"unifi_controller_{self._item.site_id}\"", ")", "}", ",", "\"name\"", ":", "\"UniFi Controller\"", ",", "\"manufacturer\"", ":", "AT...
[ 365, 4 ]
[ 373, 9 ]
python
en
['ro', 'fr', 'en']
False
get_snmp_engine
(hass: HomeAssistant)
Get SNMP engine.
Get SNMP engine.
def get_snmp_engine(hass: HomeAssistant) -> hlapi.SnmpEngine: """Get SNMP engine.""" _LOGGER.debug("Creating SNMP engine") snmp_engine = hlapi.SnmpEngine() @callback def shutdown_listener(ev: Event) -> None: if hass.data.get(DOMAIN): _LOGGER.debug("Unconfiguring SNMP engine") ...
[ "def", "get_snmp_engine", "(", "hass", ":", "HomeAssistant", ")", "->", "hlapi", ".", "SnmpEngine", ":", "_LOGGER", ".", "debug", "(", "\"Creating SNMP engine\"", ")", "snmp_engine", "=", "hlapi", ".", "SnmpEngine", "(", ")", "@", "callback", "def", "shutdown_...
[ 16, 0 ]
[ 29, 22 ]
python
en
['en', 'en', 'en']
True
cli
()
Access to the chado phylogeny content
Access to the chado phylogeny content
def cli(): """ Access to the chado phylogeny content """ pass
[ "def", "cli", "(", ")", ":", "pass" ]
[ 8, 0 ]
[ 12, 8 ]
python
en
['en', 'error', 'th']
False
async_get_service
(hass, config, discovery_info=None)
Return the notify service.
Return the notify service.
async def async_get_service(hass, config, discovery_info=None): """Return the notify service.""" url = f"{config.get(CONF_HOST)}:{config.get(CONF_PORT)}" username = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) host = config.get(CONF_HOST) port = config.get(CONF_PORT) encr...
[ "async", "def", "async_get_service", "(", "hass", ",", "config", ",", "discovery_info", "=", "None", ")", ":", "url", "=", "f\"{config.get(CONF_HOST)}:{config.get(CONF_PORT)}\"", "username", "=", "config", ".", "get", "(", "CONF_USERNAME", ")", "password", "=", "c...
[ 44, 0 ]
[ 71, 51 ]
python
en
['en', 'en', 'en']
True
KodiNotificationService.__init__
(self, hass, url, auth=None)
Initialize the service.
Initialize the service.
def __init__(self, hass, url, auth=None): """Initialize the service.""" self._url = url kwargs = {"timeout": DEFAULT_TIMEOUT, "session": async_get_clientsession(hass)} if auth is not None: kwargs["auth"] = auth self._server = jsonrpc_async.Server(self._url, **kwarg...
[ "def", "__init__", "(", "self", ",", "hass", ",", "url", ",", "auth", "=", "None", ")", ":", "self", ".", "_url", "=", "url", "kwargs", "=", "{", "\"timeout\"", ":", "DEFAULT_TIMEOUT", ",", "\"session\"", ":", "async_get_clientsession", "(", "hass", ")",...
[ 77, 4 ]
[ 86, 64 ]
python
en
['en', 'en', 'en']
True
KodiNotificationService.async_send_message
(self, message="", **kwargs)
Send a message to Kodi.
Send a message to Kodi.
async def async_send_message(self, message="", **kwargs): """Send a message to Kodi.""" try: data = kwargs.get(ATTR_DATA) or {} displaytime = int(data.get(ATTR_DISPLAYTIME, 10000)) icon = data.get(ATTR_ICON, "info") title = kwargs.get(ATTR_TITLE, ATTR_TIT...
[ "async", "def", "async_send_message", "(", "self", ",", "message", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "try", ":", "data", "=", "kwargs", ".", "get", "(", "ATTR_DATA", ")", "or", "{", "}", "displaytime", "=", "int", "(", "data", ".", "g...
[ 88, 4 ]
[ 99, 73 ]
python
en
['en', 'mk', 'en']
True
store
(hass)
Mock store.
Mock store.
def store(hass): """Mock store.""" return auth_store.AuthStore(hass)
[ "def", "store", "(", "hass", ")", ":", "return", "auth_store", ".", "AuthStore", "(", "hass", ")" ]
[ 15, 0 ]
[ 17, 37 ]
python
en
['en', 'fy', 'en']
False
provider
(hass, store)
Mock provider.
Mock provider.
def provider(hass, store): """Mock provider.""" return command_line.CommandLineAuthProvider( hass, store, { CONF_TYPE: "command_line", command_line.CONF_COMMAND: os.path.join( os.path.dirname(__file__), "test_command_line_cmd.sh" ), ...
[ "def", "provider", "(", "hass", ",", "store", ")", ":", "return", "command_line", ".", "CommandLineAuthProvider", "(", "hass", ",", "store", ",", "{", "CONF_TYPE", ":", "\"command_line\"", ",", "command_line", ".", "CONF_COMMAND", ":", "os", ".", "path", "."...
[ 21, 0 ]
[ 34, 5 ]
python
en
['en', 'sv', 'en']
False
manager
(hass, store, provider)
Mock manager.
Mock manager.
def manager(hass, store, provider): """Mock manager.""" return AuthManager(hass, store, {(provider.type, provider.id): provider}, {})
[ "def", "manager", "(", "hass", ",", "store", ",", "provider", ")", ":", "return", "AuthManager", "(", "hass", ",", "store", ",", "{", "(", "provider", ".", "type", ",", "provider", ".", "id", ")", ":", "provider", "}", ",", "{", "}", ")" ]
[ 38, 0 ]
[ 40, 81 ]
python
da
['id', 'da', 'en']
False
test_create_new_credential
(manager, provider)
Test that we create a new credential.
Test that we create a new credential.
async def test_create_new_credential(manager, provider): """Test that we create a new credential.""" credentials = await provider.async_get_or_create_credentials( {"username": "good-user", "password": "good-pass"} ) assert credentials.is_new is True user = await manager.async_get_or_create_...
[ "async", "def", "test_create_new_credential", "(", "manager", ",", "provider", ")", ":", "credentials", "=", "await", "provider", ".", "async_get_or_create_credentials", "(", "{", "\"username\"", ":", "\"good-user\"", ",", "\"password\"", ":", "\"good-pass\"", "}", ...
[ 43, 0 ]
[ 51, 25 ]
python
en
['en', 'en', 'en']
True
test_match_existing_credentials
(store, provider)
See if we match existing users.
See if we match existing users.
async def test_match_existing_credentials(store, provider): """See if we match existing users.""" existing = auth_models.Credentials( id=uuid.uuid4(), auth_provider_type="command_line", auth_provider_id=None, data={"username": "good-user"}, is_new=False, ) provide...
[ "async", "def", "test_match_existing_credentials", "(", "store", ",", "provider", ")", ":", "existing", "=", "auth_models", ".", "Credentials", "(", "id", "=", "uuid", ".", "uuid4", "(", ")", ",", "auth_provider_type", "=", "\"command_line\"", ",", "auth_provide...
[ 54, 0 ]
[ 67, 34 ]
python
en
['en', 'en', 'en']
True
test_invalid_username
(provider)
Test we raise if incorrect user specified.
Test we raise if incorrect user specified.
async def test_invalid_username(provider): """Test we raise if incorrect user specified.""" with pytest.raises(command_line.InvalidAuthError): await provider.async_validate_login("bad-user", "good-pass")
[ "async", "def", "test_invalid_username", "(", "provider", ")", ":", "with", "pytest", ".", "raises", "(", "command_line", ".", "InvalidAuthError", ")", ":", "await", "provider", ".", "async_validate_login", "(", "\"bad-user\"", ",", "\"good-pass\"", ")" ]
[ 70, 0 ]
[ 73, 68 ]
python
en
['en', 'en', 'en']
True
test_invalid_password
(provider)
Test we raise if incorrect password specified.
Test we raise if incorrect password specified.
async def test_invalid_password(provider): """Test we raise if incorrect password specified.""" with pytest.raises(command_line.InvalidAuthError): await provider.async_validate_login("good-user", "bad-pass")
[ "async", "def", "test_invalid_password", "(", "provider", ")", ":", "with", "pytest", ".", "raises", "(", "command_line", ".", "InvalidAuthError", ")", ":", "await", "provider", ".", "async_validate_login", "(", "\"good-user\"", ",", "\"bad-pass\"", ")" ]
[ 76, 0 ]
[ 79, 68 ]
python
en
['fr', 'en', 'en']
True
test_good_auth
(provider)
Test nothing is raised with good credentials.
Test nothing is raised with good credentials.
async def test_good_auth(provider): """Test nothing is raised with good credentials.""" await provider.async_validate_login("good-user", "good-pass")
[ "async", "def", "test_good_auth", "(", "provider", ")", ":", "await", "provider", ".", "async_validate_login", "(", "\"good-user\"", ",", "\"good-pass\"", ")" ]
[ 82, 0 ]
[ 84, 65 ]
python
en
['en', 'en', 'en']
True
test_good_auth_with_meta
(manager, provider)
Test metadata is added upon successful authentication.
Test metadata is added upon successful authentication.
async def test_good_auth_with_meta(manager, provider): """Test metadata is added upon successful authentication.""" provider.config[command_line.CONF_ARGS] = ["--with-meta"] provider.config[command_line.CONF_META] = True await provider.async_validate_login("good-user", "good-pass") credentials = a...
[ "async", "def", "test_good_auth_with_meta", "(", "manager", ",", "provider", ")", ":", "provider", ".", "config", "[", "command_line", ".", "CONF_ARGS", "]", "=", "[", "\"--with-meta\"", "]", "provider", ".", "config", "[", "command_line", ".", "CONF_META", "]...
[ 87, 0 ]
[ 101, 25 ]
python
en
['en', 'en', 'en']
True
test_utf_8_username_password
(provider)
Test that we create a new credential.
Test that we create a new credential.
async def test_utf_8_username_password(provider): """Test that we create a new credential.""" credentials = await provider.async_get_or_create_credentials( {"username": "ßßß", "password": "äöü"} ) assert credentials.is_new is True
[ "async", "def", "test_utf_8_username_password", "(", "provider", ")", ":", "credentials", "=", "await", "provider", ".", "async_get_or_create_credentials", "(", "{", "\"username\"", ":", "\"ßßß\", \"", "p", "ssword\": \"", "ä", "ü\"}", "", ")", "assert", "credential...
[ 104, 0 ]
[ 109, 37 ]
python
en
['en', 'en', 'en']
True
test_login_flow_validates
(provider)
Test login flow.
Test login flow.
async def test_login_flow_validates(provider): """Test login flow.""" flow = await provider.async_login_flow({}) result = await flow.async_step_init() assert result["type"] == data_entry_flow.RESULT_TYPE_FORM result = await flow.async_step_init( {"username": "bad-user", "password": "bad-pas...
[ "async", "def", "test_login_flow_validates", "(", "provider", ")", ":", "flow", "=", "await", "provider", ".", "async_login_flow", "(", "{", "}", ")", "result", "=", "await", "flow", ".", "async_step_init", "(", ")", "assert", "result", "[", "\"type\"", "]",...
[ 112, 0 ]
[ 128, 52 ]
python
en
['en', 'fy', 'en']
True
test_strip_username
(provider)
Test authentication works with username with whitespace around.
Test authentication works with username with whitespace around.
async def test_strip_username(provider): """Test authentication works with username with whitespace around.""" flow = await provider.async_login_flow({}) result = await flow.async_step_init( {"username": "\t\ngood-user ", "password": "good-pass"} ) assert result["type"] == data_entry_flow.RE...
[ "async", "def", "test_strip_username", "(", "provider", ")", ":", "flow", "=", "await", "provider", ".", "async_login_flow", "(", "{", "}", ")", "result", "=", "await", "flow", ".", "async_step_init", "(", "{", "\"username\"", ":", "\"\\t\\ngood-user \"", ",",...
[ 131, 0 ]
[ 138, 52 ]
python
en
['en', 'en', 'en']
True