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
EQ3BTSmartThermostat.set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
def set_temperature(self, **kwargs): """Set new target temperature.""" temperature = kwargs.get(ATTR_TEMPERATURE) if temperature is None: return self._thermostat.target_temperature = temperature
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "if", "temperature", "is", "None", ":", "return", "self", ".", "_thermostat", ".", "target_temperature", "=", ...
[ 121, 4 ]
[ 126, 57 ]
python
en
['en', 'ca', 'en']
True
EQ3BTSmartThermostat.hvac_mode
(self)
Return the current operation mode.
Return the current operation mode.
def hvac_mode(self): """Return the current operation mode.""" if self._thermostat.mode < 0: return HVAC_MODE_OFF return EQ_TO_HA_HVAC[self._thermostat.mode]
[ "def", "hvac_mode", "(", "self", ")", ":", "if", "self", ".", "_thermostat", ".", "mode", "<", "0", ":", "return", "HVAC_MODE_OFF", "return", "EQ_TO_HA_HVAC", "[", "self", ".", "_thermostat", ".", "mode", "]" ]
[ 129, 4 ]
[ 133, 51 ]
python
en
['en', 'en', 'en']
True
EQ3BTSmartThermostat.hvac_modes
(self)
Return the list of available operation modes.
Return the list of available operation modes.
def hvac_modes(self): """Return the list of available operation modes.""" return list(HA_TO_EQ_HVAC)
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "list", "(", "HA_TO_EQ_HVAC", ")" ]
[ 136, 4 ]
[ 138, 34 ]
python
en
['en', 'en', 'en']
True
EQ3BTSmartThermostat.set_hvac_mode
(self, hvac_mode)
Set operation mode.
Set operation mode.
def set_hvac_mode(self, hvac_mode): """Set operation mode.""" if self.preset_mode: return self._thermostat.mode = HA_TO_EQ_HVAC[hvac_mode]
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "if", "self", ".", "preset_mode", ":", "return", "self", ".", "_thermostat", ".", "mode", "=", "HA_TO_EQ_HVAC", "[", "hvac_mode", "]" ]
[ 140, 4 ]
[ 144, 56 ]
python
en
['nl', 'ny', 'en']
False
EQ3BTSmartThermostat.min_temp
(self)
Return the minimum temperature.
Return the minimum temperature.
def min_temp(self): """Return the minimum temperature.""" return self._thermostat.min_temp
[ "def", "min_temp", "(", "self", ")", ":", "return", "self", ".", "_thermostat", ".", "min_temp" ]
[ 147, 4 ]
[ 149, 40 ]
python
en
['en', 'la', 'en']
True
EQ3BTSmartThermostat.max_temp
(self)
Return the maximum temperature.
Return the maximum temperature.
def max_temp(self): """Return the maximum temperature.""" return self._thermostat.max_temp
[ "def", "max_temp", "(", "self", ")", ":", "return", "self", ".", "_thermostat", ".", "max_temp" ]
[ 152, 4 ]
[ 154, 40 ]
python
en
['en', 'la', 'en']
True
EQ3BTSmartThermostat.extra_state_attributes
(self)
Return the device specific state attributes.
Return the device specific state attributes.
def extra_state_attributes(self): """Return the device specific state attributes.""" dev_specific = { ATTR_STATE_AWAY_END: self._thermostat.away_end, ATTR_STATE_LOCKED: self._thermostat.locked, ATTR_STATE_LOW_BAT: self._thermostat.low_battery, ATTR_STATE_V...
[ "def", "extra_state_attributes", "(", "self", ")", ":", "dev_specific", "=", "{", "ATTR_STATE_AWAY_END", ":", "self", ".", "_thermostat", ".", "away_end", ",", "ATTR_STATE_LOCKED", ":", "self", ".", "_thermostat", ".", "locked", ",", "ATTR_STATE_LOW_BAT", ":", "...
[ 157, 4 ]
[ 167, 27 ]
python
en
['en', 'en', 'en']
True
EQ3BTSmartThermostat.preset_mode
(self)
Return the current preset mode, e.g., home, away, temp. Requires SUPPORT_PRESET_MODE.
Return the current preset mode, e.g., home, away, temp.
def preset_mode(self): """Return the current preset mode, e.g., home, away, temp. Requires SUPPORT_PRESET_MODE. """ return EQ_TO_HA_PRESET.get(self._thermostat.mode)
[ "def", "preset_mode", "(", "self", ")", ":", "return", "EQ_TO_HA_PRESET", ".", "get", "(", "self", ".", "_thermostat", ".", "mode", ")" ]
[ 170, 4 ]
[ 175, 57 ]
python
en
['en', 'pt', 'en']
True
EQ3BTSmartThermostat.preset_modes
(self)
Return a list of available preset modes. Requires SUPPORT_PRESET_MODE.
Return a list of available preset modes.
def preset_modes(self): """Return a list of available preset modes. Requires SUPPORT_PRESET_MODE. """ return list(HA_TO_EQ_PRESET)
[ "def", "preset_modes", "(", "self", ")", ":", "return", "list", "(", "HA_TO_EQ_PRESET", ")" ]
[ 178, 4 ]
[ 183, 36 ]
python
en
['en', 'en', 'en']
True
EQ3BTSmartThermostat.set_preset_mode
(self, preset_mode)
Set new preset mode.
Set new preset mode.
def set_preset_mode(self, preset_mode): """Set new preset mode.""" if preset_mode == PRESET_NONE: self.set_hvac_mode(HVAC_MODE_HEAT) self._thermostat.mode = HA_TO_EQ_PRESET[preset_mode]
[ "def", "set_preset_mode", "(", "self", ",", "preset_mode", ")", ":", "if", "preset_mode", "==", "PRESET_NONE", ":", "self", ".", "set_hvac_mode", "(", "HVAC_MODE_HEAT", ")", "self", ".", "_thermostat", ".", "mode", "=", "HA_TO_EQ_PRESET", "[", "preset_mode", "...
[ 185, 4 ]
[ 189, 60 ]
python
en
['en', 'sr', 'en']
True
EQ3BTSmartThermostat.update
(self)
Update the data from the thermostat.
Update the data from the thermostat.
def update(self): """Update the data from the thermostat.""" try: self._thermostat.update() except BTLEException as ex: _LOGGER.warning("Updating the state failed: %s", ex)
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "_thermostat", ".", "update", "(", ")", "except", "BTLEException", "as", "ex", ":", "_LOGGER", ".", "warning", "(", "\"Updating the state failed: %s\"", ",", "ex", ")" ]
[ 191, 4 ]
[ 197, 64 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
( hass: HomeAssistant, config: ConfigType, async_add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, )
Set up the Ampio Smog air quality platform.
Set up the Ampio Smog air quality platform.
async def async_setup_platform( hass: HomeAssistant, config: ConfigType, async_add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, ) -> None: """Set up the Ampio Smog air quality platform.""" name = config.get(CONF_NAME) station_id = config[CONF_STATION_ID] ...
[ "async", "def", "async_setup_platform", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", "discovery_info", ":", "DiscoveryInfoType", "|", "None", "=", "None", ",", ")", "->", "None", ...
[ 30, 0 ]
[ 50, 71 ]
python
en
['en', 'pt', 'en']
True
AmpioSmogQuality.__init__
( self, api: AmpioSmogMapData, station_id: str, name: str | None )
Initialize the air quality entity.
Initialize the air quality entity.
def __init__( self, api: AmpioSmogMapData, station_id: str, name: str | None ) -> None: """Initialize the air quality entity.""" self._ampio = api self._station_id = station_id self._name = name or api.api.name
[ "def", "__init__", "(", "self", ",", "api", ":", "AmpioSmogMapData", ",", "station_id", ":", "str", ",", "name", ":", "str", "|", "None", ")", "->", "None", ":", "self", ".", "_ampio", "=", "api", "self", ".", "_station_id", "=", "station_id", "self", ...
[ 56, 4 ]
[ 62, 41 ]
python
en
['en', 'en', 'en']
True
AmpioSmogQuality.name
(self)
Return the name of the air quality entity.
Return the name of the air quality entity.
def name(self) -> str: """Return the name of the air quality entity.""" return self._name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_name" ]
[ 65, 4 ]
[ 67, 25 ]
python
en
['en', 'en', 'en']
True
AmpioSmogQuality.unique_id
(self)
Return unique_name.
Return unique_name.
def unique_id(self) -> str: """Return unique_name.""" return f"ampio_smog_{self._station_id}"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "f\"ampio_smog_{self._station_id}\"" ]
[ 70, 4 ]
[ 72, 47 ]
python
en
['fr', 'la', 'en']
False
AmpioSmogQuality.particulate_matter_2_5
(self)
Return the particulate matter 2.5 level.
Return the particulate matter 2.5 level.
def particulate_matter_2_5(self) -> str | None: """Return the particulate matter 2.5 level.""" return self._ampio.api.pm2_5
[ "def", "particulate_matter_2_5", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "_ampio", ".", "api", ".", "pm2_5" ]
[ 75, 4 ]
[ 77, 36 ]
python
en
['en', 'en', 'en']
True
AmpioSmogQuality.particulate_matter_10
(self)
Return the particulate matter 10 level.
Return the particulate matter 10 level.
def particulate_matter_10(self) -> str | None: """Return the particulate matter 10 level.""" return self._ampio.api.pm10
[ "def", "particulate_matter_10", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "_ampio", ".", "api", ".", "pm10" ]
[ 80, 4 ]
[ 82, 35 ]
python
en
['en', 'en', 'en']
True
AmpioSmogQuality.attribution
(self)
Return the attribution.
Return the attribution.
def attribution(self) -> str: """Return the attribution.""" return ATTRIBUTION
[ "def", "attribution", "(", "self", ")", "->", "str", ":", "return", "ATTRIBUTION" ]
[ 85, 4 ]
[ 87, 26 ]
python
en
['en', 'ja', 'en']
True
AmpioSmogQuality.async_update
(self)
Get the latest data from the AmpioMap API.
Get the latest data from the AmpioMap API.
async def async_update(self) -> None: """Get the latest data from the AmpioMap API.""" await self._ampio.async_update()
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_ampio", ".", "async_update", "(", ")" ]
[ 89, 4 ]
[ 91, 40 ]
python
en
['en', 'en', 'en']
True
AmpioSmogMapData.__init__
(self, api: AmpioSmog)
Initialize the data object.
Initialize the data object.
def __init__(self, api: AmpioSmog) -> None: """Initialize the data object.""" self.api = api
[ "def", "__init__", "(", "self", ",", "api", ":", "AmpioSmog", ")", "->", "None", ":", "self", ".", "api", "=", "api" ]
[ 97, 4 ]
[ 99, 22 ]
python
en
['en', 'en', 'en']
True
AmpioSmogMapData.async_update
(self)
Get the latest data from AmpioMap.
Get the latest data from AmpioMap.
async def async_update(self) -> None: """Get the latest data from AmpioMap.""" await self.api.get_data()
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":", "await", "self", ".", "api", ".", "get_data", "(", ")" ]
[ 102, 4 ]
[ 104, 33 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Bizkaibus public transport sensor.
Set up the Bizkaibus public transport sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Bizkaibus public transport sensor.""" name = config[CONF_NAME] stop = config[CONF_STOP_ID] route = config[CONF_ROUTE] data = Bizkaibus(stop, route) add_entities([BizkaibusSensor(data, name)], True)
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", "[", "CONF_NAME", "]", "stop", "=", "config", "[", "CONF_STOP_ID", "]", "route", "=", "config", "[", "CONF_ROUTE"...
[ 26, 0 ]
[ 33, 53 ]
python
en
['en', 'sq', 'ur']
False
BizkaibusSensor.__init__
(self, data, name)
Initialize the sensor.
Initialize the sensor.
def __init__(self, data, name): """Initialize the sensor.""" self.data = data self._attr_name = name
[ "def", "__init__", "(", "self", ",", "data", ",", "name", ")", ":", "self", ".", "data", "=", "data", "self", ".", "_attr_name", "=", "name" ]
[ 41, 4 ]
[ 44, 30 ]
python
en
['en', 'en', 'en']
True
BizkaibusSensor.update
(self)
Get the latest data from the webservice.
Get the latest data from the webservice.
def update(self): """Get the latest data from the webservice.""" self.data.update() with suppress(TypeError): self._attr_native_value = self.data.info[0][ATTR_DUE_IN]
[ "def", "update", "(", "self", ")", ":", "self", ".", "data", ".", "update", "(", ")", "with", "suppress", "(", "TypeError", ")", ":", "self", ".", "_attr_native_value", "=", "self", ".", "data", ".", "info", "[", "0", "]", "[", "ATTR_DUE_IN", "]" ]
[ 46, 4 ]
[ 50, 68 ]
python
en
['en', 'en', 'en']
True
Bizkaibus.__init__
(self, stop, route)
Initialize the data object.
Initialize the data object.
def __init__(self, stop, route): """Initialize the data object.""" self.stop = stop self.route = route self.info = None
[ "def", "__init__", "(", "self", ",", "stop", ",", "route", ")", ":", "self", ".", "stop", "=", "stop", "self", ".", "route", "=", "route", "self", ".", "info", "=", "None" ]
[ 56, 4 ]
[ 60, 24 ]
python
en
['en', 'en', 'en']
True
Bizkaibus.update
(self)
Retrieve the information from API.
Retrieve the information from API.
def update(self): """Retrieve the information from API.""" bridge = BizkaibusData(self.stop, self.route) bridge.getNextBus() self.info = bridge.info
[ "def", "update", "(", "self", ")", ":", "bridge", "=", "BizkaibusData", "(", "self", ".", "stop", ",", "self", ".", "route", ")", "bridge", ".", "getNextBus", "(", ")", "self", ".", "info", "=", "bridge", ".", "info" ]
[ 62, 4 ]
[ 66, 31 ]
python
en
['en', 'pt', 'en']
True
async_setup
(hass, config)
Set up the Eight Sleep component.
Set up the Eight Sleep component.
async def async_setup(hass, config): """Set up the Eight Sleep component.""" conf = config.get(DOMAIN) user = conf.get(CONF_USERNAME) password = conf.get(CONF_PASSWORD) if hass.config.time_zone is None: _LOGGER.error("Timezone is not set in Home Assistant") return False timezo...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", ".", "get", "(", "DOMAIN", ")", "user", "=", "conf", ".", "get", "(", "CONF_USERNAME", ")", "password", "=", "conf", ".", "get", "(", "CONF_PASSWORD", ")", "i...
[ 102, 0 ]
[ 192, 15 ]
python
en
['en', 'en', 'en']
True
EightSleepUserEntity.__init__
(self, eight)
Initialize the data object.
Initialize the data object.
def __init__(self, eight): """Initialize the data object.""" self._eight = eight
[ "def", "__init__", "(", "self", ",", "eight", ")", ":", "self", ".", "_eight", "=", "eight" ]
[ 198, 4 ]
[ 200, 27 ]
python
en
['en', 'en', 'en']
True
EightSleepUserEntity.async_added_to_hass
(self)
Register update dispatcher.
Register update dispatcher.
async def async_added_to_hass(self): """Register update dispatcher.""" @callback def async_eight_user_update(): """Update callback.""" self.async_schedule_update_ha_state(True) self.async_on_remove( async_dispatcher_connect( self.hass...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "@", "callback", "def", "async_eight_user_update", "(", ")", ":", "\"\"\"Update callback.\"\"\"", "self", ".", "async_schedule_update_ha_state", "(", "True", ")", "self", ".", "async_on_remove", "(", "asy...
[ 202, 4 ]
[ 214, 9 ]
python
de
['it', 'de', 'en']
False
EightSleepUserEntity.should_poll
(self)
Return True if entity has to be polled for state.
Return True if entity has to be polled for state.
def should_poll(self): """Return True if entity has to be polled for state.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 217, 4 ]
[ 219, 20 ]
python
en
['en', 'en', 'en']
True
EightSleepHeatEntity.__init__
(self, eight)
Initialize the data object.
Initialize the data object.
def __init__(self, eight): """Initialize the data object.""" self._eight = eight
[ "def", "__init__", "(", "self", ",", "eight", ")", ":", "self", ".", "_eight", "=", "eight" ]
[ 225, 4 ]
[ 227, 27 ]
python
en
['en', 'en', 'en']
True
EightSleepHeatEntity.async_added_to_hass
(self)
Register update dispatcher.
Register update dispatcher.
async def async_added_to_hass(self): """Register update dispatcher.""" @callback def async_eight_heat_update(): """Update callback.""" self.async_schedule_update_ha_state(True) self.async_on_remove( async_dispatcher_connect( self.hass...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "@", "callback", "def", "async_eight_heat_update", "(", ")", ":", "\"\"\"Update callback.\"\"\"", "self", ".", "async_schedule_update_ha_state", "(", "True", ")", "self", ".", "async_on_remove", "(", "asy...
[ 229, 4 ]
[ 241, 9 ]
python
de
['it', 'de', 'en']
False
EightSleepHeatEntity.should_poll
(self)
Return True if entity has to be polled for state.
Return True if entity has to be polled for state.
def should_poll(self): """Return True if entity has to be polled for state.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 244, 4 ]
[ 246, 20 ]
python
en
['en', 'en', 'en']
True
ConnectXiaomiDevice.__init__
(self, hass)
Initialize the entity.
Initialize the entity.
def __init__(self, hass): """Initialize the entity.""" self._hass = hass self._device = None self._device_info = None
[ "def", "__init__", "(", "self", ",", "hass", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_device", "=", "None", "self", ".", "_device_info", "=", "None" ]
[ 20, 4 ]
[ 24, 32 ]
python
en
['en', 'en', 'en']
True
ConnectXiaomiDevice.device
(self)
Return the class containing all connections to the device.
Return the class containing all connections to the device.
def device(self): """Return the class containing all connections to the device.""" return self._device
[ "def", "device", "(", "self", ")", ":", "return", "self", ".", "_device" ]
[ 27, 4 ]
[ 29, 27 ]
python
en
['en', 'en', 'en']
True
ConnectXiaomiDevice.device_info
(self)
Return the class containing device info.
Return the class containing device info.
def device_info(self): """Return the class containing device info.""" return self._device_info
[ "def", "device_info", "(", "self", ")", ":", "return", "self", ".", "_device_info" ]
[ 32, 4 ]
[ 34, 32 ]
python
en
['en', 'en', 'en']
True
ConnectXiaomiDevice.async_connect_device
(self, host, token)
Connect to the Xiaomi Device.
Connect to the Xiaomi Device.
async def async_connect_device(self, host, token): """Connect to the Xiaomi Device.""" _LOGGER.debug("Initializing with host %s (token %s...)", host, token[:5]) try: self._device = Device(host, token) # get the device info self._device_info = await self._hass...
[ "async", "def", "async_connect_device", "(", "self", ",", "host", ",", "token", ")", ":", "_LOGGER", ".", "debug", "(", "\"Initializing with host %s (token %s...)\"", ",", "host", ",", "token", "[", ":", "5", "]", ")", "try", ":", "self", ".", "_device", "...
[ 36, 4 ]
[ 63, 19 ]
python
en
['en', 'en', 'en']
True
XiaomiMiioEntity.__init__
(self, name, device, entry, unique_id)
Initialize the Xiaomi Miio Device.
Initialize the Xiaomi Miio Device.
def __init__(self, name, device, entry, unique_id): """Initialize the Xiaomi Miio Device.""" self._device = device self._model = entry.data[CONF_MODEL] self._mac = entry.data[CONF_MAC] self._device_id = entry.unique_id self._unique_id = unique_id self._name = name...
[ "def", "__init__", "(", "self", ",", "name", ",", "device", ",", "entry", ",", "unique_id", ")", ":", "self", ".", "_device", "=", "device", "self", ".", "_model", "=", "entry", ".", "data", "[", "CONF_MODEL", "]", "self", ".", "_mac", "=", "entry", ...
[ 69, 4 ]
[ 77, 30 ]
python
en
['en', 'pl', 'en']
True
XiaomiMiioEntity.unique_id
(self)
Return an unique ID.
Return an unique ID.
def unique_id(self): """Return an unique ID.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 80, 4 ]
[ 82, 30 ]
python
fr
['fr', 'fr', 'en']
True
XiaomiMiioEntity.name
(self)
Return the name of this entity, if any.
Return the name of this entity, if any.
def name(self): """Return the name of this entity, if any.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 85, 4 ]
[ 87, 25 ]
python
en
['en', 'en', 'en']
True
XiaomiMiioEntity.device_info
(self)
Return the device info.
Return the device info.
def device_info(self): """Return the device info.""" device_info = { "identifiers": {(DOMAIN, self._device_id)}, "manufacturer": "Xiaomi", "name": self._name, "model": self._model, } if self._mac is not None: device_info["conne...
[ "def", "device_info", "(", "self", ")", ":", "device_info", "=", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_device_id", ")", "}", ",", "\"manufacturer\"", ":", "\"Xiaomi\"", ",", "\"name\"", ":", "self", ".", "_name", ",", "\"mo...
[ 90, 4 ]
[ 102, 26 ]
python
en
['en', 'en', 'en']
True
XiaomiCoordinatedMiioEntity.__init__
(self, name, device, entry, unique_id, coordinator)
Initialize the coordinated Xiaomi Miio Device.
Initialize the coordinated Xiaomi Miio Device.
def __init__(self, name, device, entry, unique_id, coordinator): """Initialize the coordinated Xiaomi Miio Device.""" super().__init__(coordinator) self._device = device self._model = entry.data[CONF_MODEL] self._mac = entry.data[CONF_MAC] self._device_id = entry.unique_i...
[ "def", "__init__", "(", "self", ",", "name", ",", "device", ",", "entry", ",", "unique_id", ",", "coordinator", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_device", "=", "device", "self", ".", "_model", "=", ...
[ 108, 4 ]
[ 117, 25 ]
python
en
['en', 'en', 'en']
True
XiaomiCoordinatedMiioEntity.unique_id
(self)
Return an unique ID.
Return an unique ID.
def unique_id(self): """Return an unique ID.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 120, 4 ]
[ 122, 30 ]
python
fr
['fr', 'fr', 'en']
True
XiaomiCoordinatedMiioEntity.name
(self)
Return the name of this entity, if any.
Return the name of this entity, if any.
def name(self): """Return the name of this entity, if any.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 125, 4 ]
[ 127, 25 ]
python
en
['en', 'en', 'en']
True
XiaomiCoordinatedMiioEntity.device_info
(self)
Return the device info.
Return the device info.
def device_info(self): """Return the device info.""" device_info = { "identifiers": {(DOMAIN, self._device_id)}, "manufacturer": "Xiaomi", "name": self._device_name, "model": self._model, } if self._mac is not None: device_info...
[ "def", "device_info", "(", "self", ")", ":", "device_info", "=", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_device_id", ")", "}", ",", "\"manufacturer\"", ":", "\"Xiaomi\"", ",", "\"name\"", ":", "self", ".", "_device_name", ",", ...
[ 130, 4 ]
[ 142, 26 ]
python
en
['en', 'en', 'en']
True
XiaomiCoordinatedMiioEntity._try_command
(self, mask_error, func, *args, **kwargs)
Call a miio device command handling error messages.
Call a miio device command handling error messages.
async def _try_command(self, mask_error, func, *args, **kwargs): """Call a miio device command handling error messages.""" try: result = await self.hass.async_add_executor_job( partial(func, *args, **kwargs) ) _LOGGER.debug("Response received from mii...
[ "async", "def", "_try_command", "(", "self", ",", "mask_error", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "result", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "partial", "(", "func", ",", ...
[ 144, 4 ]
[ 158, 24 ]
python
en
['en', 'en', 'en']
True
RPI.flash_uboot
(self, uboot)
In this case it's flashing the vfat partition of the bootload. Need to have that image u-boot and serial turned on via dtoverlay for things to work after flashing
In this case it's flashing the vfat partition of the bootload. Need to have that image u-boot and serial turned on via dtoverlay for things to work after flashing
def flash_uboot(self, uboot): '''In this case it's flashing the vfat partition of the bootload. Need to have that image u-boot and serial turned on via dtoverlay for things to work after flashing''' common.print_bold("\n===== Flashing bootloader (and u-boot) =====\n") filen...
[ "def", "flash_uboot", "(", "self", ",", "uboot", ")", ":", "common", ".", "print_bold", "(", "\"\\n===== Flashing bootloader (and u-boot) =====\\n\"", ")", "filename", "=", "self", ".", "prepare_file", "(", "uboot", ")", "size", "=", "self", ".", "tftp_get_file_ub...
[ 30, 4 ]
[ 53, 34 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback, )
Set up WLED select based on a config entry.
Set up WLED select based on a config entry.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Set up WLED select based on a config entry.""" coordinator: WLEDDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] async_add_entities([WLEDPlaylistSelect(coordinat...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", ")", "->", "None", ":", "coordinator", ":", "WLEDDataUpdateCoordinator", "=", "hass", ".", "data",...
[ 20, 0 ]
[ 37, 21 ]
python
en
['en', 'en', 'en']
True
async_update_segments
( coordinator: WLEDDataUpdateCoordinator, current_ids: set[int], async_add_entities, )
Update segments.
Update segments.
def async_update_segments( coordinator: WLEDDataUpdateCoordinator, current_ids: set[int], async_add_entities, ) -> None: """Update segments.""" segment_ids = {segment.segment_id for segment in coordinator.data.state.segments} new_entities = [] # Process new segments, add them to Home Assis...
[ "def", "async_update_segments", "(", "coordinator", ":", "WLEDDataUpdateCoordinator", ",", "current_ids", ":", "set", "[", "int", "]", ",", "async_add_entities", ",", ")", "->", "None", ":", "segment_ids", "=", "{", "segment", ".", "segment_id", "for", "segment"...
[ 151, 0 ]
[ 167, 40 ]
python
co
['it', 'co', 'en']
False
WLEDPresetSelect.__init__
(self, coordinator: WLEDDataUpdateCoordinator)
Initialize WLED .
Initialize WLED .
def __init__(self, coordinator: WLEDDataUpdateCoordinator) -> None: """Initialize WLED .""" super().__init__(coordinator=coordinator) self._attr_name = f"{coordinator.data.info.name} Preset" self._attr_unique_id = f"{coordinator.data.info.mac_address}_preset" self._attr_options ...
[ "def", "__init__", "(", "self", ",", "coordinator", ":", "WLEDDataUpdateCoordinator", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", "=", "coordinator", ")", "self", ".", "_attr_name", "=", "f\"{coordinator.data.info.name} Preset\"...
[ 45, 4 ]
[ 51, 86 ]
python
en
['en', 'en', 'it']
True
WLEDPresetSelect.available
(self)
Return True if entity is available.
Return True if entity is available.
def available(self) -> bool: """Return True if entity is available.""" return len(self.coordinator.data.presets) > 0 and super().available
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "len", "(", "self", ".", "coordinator", ".", "data", ".", "presets", ")", ">", "0", "and", "super", "(", ")", ".", "available" ]
[ 54, 4 ]
[ 56, 75 ]
python
en
['en', 'en', 'en']
True
WLEDPresetSelect.current_option
(self)
Return the current selected preset.
Return the current selected preset.
def current_option(self) -> str | None: """Return the current selected preset.""" if not isinstance(self.coordinator.data.state.preset, Preset): return None return self.coordinator.data.state.preset.name
[ "def", "current_option", "(", "self", ")", "->", "str", "|", "None", ":", "if", "not", "isinstance", "(", "self", ".", "coordinator", ".", "data", ".", "state", ".", "preset", ",", "Preset", ")", ":", "return", "None", "return", "self", ".", "coordinat...
[ 59, 4 ]
[ 63, 54 ]
python
en
['en', 'en', 'en']
True
WLEDPresetSelect.async_select_option
(self, option: str)
Set WLED segment to the selected preset.
Set WLED segment to the selected preset.
async def async_select_option(self, option: str) -> None: """Set WLED segment to the selected preset.""" await self.coordinator.wled.preset(preset=option)
[ "async", "def", "async_select_option", "(", "self", ",", "option", ":", "str", ")", "->", "None", ":", "await", "self", ".", "coordinator", ".", "wled", ".", "preset", "(", "preset", "=", "option", ")" ]
[ 66, 4 ]
[ 68, 57 ]
python
en
['en', 'en', 'en']
True
WLEDPlaylistSelect.__init__
(self, coordinator: WLEDDataUpdateCoordinator)
Initialize WLED playlist.
Initialize WLED playlist.
def __init__(self, coordinator: WLEDDataUpdateCoordinator) -> None: """Initialize WLED playlist.""" super().__init__(coordinator=coordinator) self._attr_name = f"{coordinator.data.info.name} Playlist" self._attr_unique_id = f"{coordinator.data.info.mac_address}_playlist" self._a...
[ "def", "__init__", "(", "self", ",", "coordinator", ":", "WLEDDataUpdateCoordinator", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", "=", "coordinator", ")", "self", ".", "_attr_name", "=", "f\"{coordinator.data.info.name} Playlist...
[ 76, 4 ]
[ 84, 9 ]
python
en
['en', 'pl', 'it']
False
WLEDPlaylistSelect.available
(self)
Return True if entity is available.
Return True if entity is available.
def available(self) -> bool: """Return True if entity is available.""" return len(self.coordinator.data.playlists) > 0 and super().available
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "len", "(", "self", ".", "coordinator", ".", "data", ".", "playlists", ")", ">", "0", "and", "super", "(", ")", ".", "available" ]
[ 87, 4 ]
[ 89, 77 ]
python
en
['en', 'en', 'en']
True
WLEDPlaylistSelect.current_option
(self)
Return the currently selected playlist.
Return the currently selected playlist.
def current_option(self) -> str | None: """Return the currently selected playlist.""" if not isinstance(self.coordinator.data.state.playlist, Playlist): return None return self.coordinator.data.state.playlist.name
[ "def", "current_option", "(", "self", ")", "->", "str", "|", "None", ":", "if", "not", "isinstance", "(", "self", ".", "coordinator", ".", "data", ".", "state", ".", "playlist", ",", "Playlist", ")", ":", "return", "None", "return", "self", ".", "coord...
[ 92, 4 ]
[ 96, 56 ]
python
en
['en', 'en', 'en']
True
WLEDPlaylistSelect.async_select_option
(self, option: str)
Set WLED segment to the selected playlist.
Set WLED segment to the selected playlist.
async def async_select_option(self, option: str) -> None: """Set WLED segment to the selected playlist.""" await self.coordinator.wled.playlist(playlist=option)
[ "async", "def", "async_select_option", "(", "self", ",", "option", ":", "str", ")", "->", "None", ":", "await", "self", ".", "coordinator", ".", "wled", ".", "playlist", "(", "playlist", "=", "option", ")" ]
[ 99, 4 ]
[ 101, 61 ]
python
en
['en', 'en', 'en']
True
WLEDPaletteSelect.__init__
(self, coordinator: WLEDDataUpdateCoordinator, segment: int)
Initialize WLED .
Initialize WLED .
def __init__(self, coordinator: WLEDDataUpdateCoordinator, segment: int) -> None: """Initialize WLED .""" super().__init__(coordinator=coordinator) # Segment 0 uses a simpler name, which is more natural for when using # a single segment / using WLED with one big LED strip. self....
[ "def", "__init__", "(", "self", ",", "coordinator", ":", "WLEDDataUpdateCoordinator", ",", "segment", ":", "int", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", "=", "coordinator", ")", "# Segment 0 uses a simpler name, which is mo...
[ 111, 4 ]
[ 127, 31 ]
python
en
['en', 'en', 'it']
True
WLEDPaletteSelect.available
(self)
Return True if entity is available.
Return True if entity is available.
def available(self) -> bool: """Return True if entity is available.""" try: self.coordinator.data.state.segments[self._segment] except IndexError: return False return super().available
[ "def", "available", "(", "self", ")", "->", "bool", ":", "try", ":", "self", ".", "coordinator", ".", "data", ".", "state", ".", "segments", "[", "self", ".", "_segment", "]", "except", "IndexError", ":", "return", "False", "return", "super", "(", ")",...
[ 130, 4 ]
[ 137, 32 ]
python
en
['en', 'en', 'en']
True
WLEDPaletteSelect.current_option
(self)
Return the current selected color palette.
Return the current selected color palette.
def current_option(self) -> str | None: """Return the current selected color palette.""" return self.coordinator.data.state.segments[self._segment].palette.name
[ "def", "current_option", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "coordinator", ".", "data", ".", "state", ".", "segments", "[", "self", ".", "_segment", "]", ".", "palette", ".", "name" ]
[ 140, 4 ]
[ 142, 79 ]
python
en
['en', 'en', 'en']
True
WLEDPaletteSelect.async_select_option
(self, option: str)
Set WLED segment to the selected color palette.
Set WLED segment to the selected color palette.
async def async_select_option(self, option: str) -> None: """Set WLED segment to the selected color palette.""" await self.coordinator.wled.segment(segment_id=self._segment, palette=option)
[ "async", "def", "async_select_option", "(", "self", ",", "option", ":", "str", ")", "->", "None", ":", "await", "self", ".", "coordinator", ".", "wled", ".", "segment", "(", "segment_id", "=", "self", ".", "_segment", ",", "palette", "=", "option", ")" ]
[ 145, 4 ]
[ 147, 85 ]
python
en
['en', 'en', 'en']
True
preprocess
(image)
Create 4-dimensional blob from image and flip image :param image: input image
Create 4-dimensional blob from image and flip image :param image: input image
def preprocess(image): """ Create 4-dimensional blob from image and flip image :param image: input image """ image_rev = np.flip(image, axis=1) input = cv.dnn.blobFromImages([image, image_rev], mean=(104.00698793, 116.66876762, 122.67891434)) return input
[ "def", "preprocess", "(", "image", ")", ":", "image_rev", "=", "np", ".", "flip", "(", "image", ",", "axis", "=", "1", ")", "input", "=", "cv", ".", "dnn", ".", "blobFromImages", "(", "[", "image", ",", "image_rev", "]", ",", "mean", "=", "(", "1...
[ 51, 0 ]
[ 58, 16 ]
python
en
['en', 'error', 'th']
False
run_net
(input, model_path, backend, target)
Read network and infer model :param model_path: path to JPPNet model :param backend: computation backend :param target: computation device
Read network and infer model :param model_path: path to JPPNet model :param backend: computation backend :param target: computation device
def run_net(input, model_path, backend, target): """ Read network and infer model :param model_path: path to JPPNet model :param backend: computation backend :param target: computation device """ net = cv.dnn.readNet(model_path) net.setPreferableBackend(backend) net.setPreferableTarg...
[ "def", "run_net", "(", "input", ",", "model_path", ",", "backend", ",", "target", ")", ":", "net", "=", "cv", ".", "dnn", ".", "readNet", "(", "model_path", ")", "net", ".", "setPreferableBackend", "(", "backend", ")", "net", ".", "setPreferableTarget", ...
[ 61, 0 ]
[ 73, 14 ]
python
en
['en', 'error', 'th']
False
postprocess
(out, input_shape)
Create a grayscale human segmentation :param out: network output :param input_shape: input image width and height
Create a grayscale human segmentation :param out: network output :param input_shape: input image width and height
def postprocess(out, input_shape): """ Create a grayscale human segmentation :param out: network output :param input_shape: input image width and height """ # LIP classes # 0 Background # 1 Hat # 2 Hair # 3 Glove # 4 Sunglasses # 5 UpperClothes # 6 Dress # 7 Coat ...
[ "def", "postprocess", "(", "out", ",", "input_shape", ")", ":", "# LIP classes", "# 0 Background", "# 1 Hat", "# 2 Hair", "# 3 Glove", "# 4 Sunglasses", "# 5 UpperClothes", "# 6 Dress", "# 7 Coat", "# 8 Socks", "# 9 Pants", "# 10 Jumpsuits", "# 11 Scarf", "# 12 Skirt", "#...
[ 76, 0 ]
[ 119, 25 ]
python
en
['en', 'error', 'th']
False
decode_labels
(gray_image)
Colorize image according to labels :param gray_image: grayscale human segmentation result
Colorize image according to labels :param gray_image: grayscale human segmentation result
def decode_labels(gray_image): """ Colorize image according to labels :param gray_image: grayscale human segmentation result """ height, width, _ = gray_image.shape colors = [(0, 0, 0), (128, 0, 0), (255, 0, 0), (0, 85, 0), (170, 0, 51), (255, 85, 0), (0, 0, 85), (0, 119, 221), (85...
[ "def", "decode_labels", "(", "gray_image", ")", ":", "height", ",", "width", ",", "_", "=", "gray_image", ".", "shape", "colors", "=", "[", "(", "0", ",", "0", ",", "0", ")", ",", "(", "128", ",", "0", ",", "0", ")", ",", "(", "255", ",", "0"...
[ 122, 0 ]
[ 136, 15 ]
python
en
['en', 'error', 'th']
False
parse_human
(image, model_path, backend=cv.dnn.DNN_BACKEND_OPENCV, target=cv.dnn.DNN_TARGET_CPU)
Prepare input for execution, run net and postprocess output to parse human. :param image: input image :param model_path: path to JPPNet model :param backend: name of computation backend :param target: name of computation target
Prepare input for execution, run net and postprocess output to parse human. :param image: input image :param model_path: path to JPPNet model :param backend: name of computation backend :param target: name of computation target
def parse_human(image, model_path, backend=cv.dnn.DNN_BACKEND_OPENCV, target=cv.dnn.DNN_TARGET_CPU): """ Prepare input for execution, run net and postprocess output to parse human. :param image: input image :param model_path: path to JPPNet model :param backend: name of computation backend :para...
[ "def", "parse_human", "(", "image", ",", "model_path", ",", "backend", "=", "cv", ".", "dnn", ".", "DNN_BACKEND_OPENCV", ",", "target", "=", "cv", ".", "dnn", ".", "DNN_TARGET_CPU", ")", ":", "input", "=", "preprocess", "(", "image", ")", "input_h", ",",...
[ 139, 0 ]
[ 152, 23 ]
python
en
['en', 'error', 'th']
False
test_full_user_flow_single_installation
(hass: HomeAssistant)
Test a full user initiated configuration flow with a single installation.
Test a full user initiated configuration flow with a single installation.
async def test_full_user_flow_single_installation(hass: HomeAssistant) -> None: """Test a full user initiated configuration flow with a single installation.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["step_id"] ==...
[ "async", "def", "test_full_user_flow_single_installation", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ...
[ 34, 0 ]
[ 72, 48 ]
python
en
['en', 'en', 'en']
True
test_full_user_flow_multiple_installations
(hass: HomeAssistant)
Test a full user initiated configuration flow with multiple installations.
Test a full user initiated configuration flow with multiple installations.
async def test_full_user_flow_multiple_installations(hass: HomeAssistant) -> None: """Test a full user initiated configuration flow with multiple installations.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["step_id"...
[ "async", "def", "test_full_user_flow_multiple_installations", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"",...
[ 75, 0 ]
[ 123, 48 ]
python
en
['en', 'en', 'en']
True
test_invalid_login
(hass: HomeAssistant)
Test a flow with an invalid Verisure My Pages login.
Test a flow with an invalid Verisure My Pages login.
async def test_invalid_login(hass: HomeAssistant) -> None: """Test a flow with an invalid Verisure My Pages login.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.verisure.config_flow.V...
[ "async", "def", "test_invalid_login", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entrie...
[ 126, 0 ]
[ 147, 56 ]
python
en
['en', 'en', 'en']
True
test_unknown_error
(hass: HomeAssistant)
Test a flow with an invalid Verisure My Pages login.
Test a flow with an invalid Verisure My Pages login.
async def test_unknown_error(hass: HomeAssistant) -> None: """Test a flow with an invalid Verisure My Pages login.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.verisure.config_flow.V...
[ "async", "def", "test_unknown_error", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entrie...
[ 150, 0 ]
[ 171, 51 ]
python
en
['en', 'en', 'en']
True
test_dhcp
(hass: HomeAssistant)
Test that DHCP discovery works.
Test that DHCP discovery works.
async def test_dhcp(hass: HomeAssistant) -> None: """Test that DHCP discovery works.""" result = await hass.config_entries.flow.async_init( DOMAIN, data={MAC_ADDRESS: "01:23:45:67:89:ab"}, context={"source": config_entries.SOURCE_DHCP}, ) assert result["type"] == RESULT_TYPE_FOR...
[ "async", "def", "test_dhcp", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "data", "=", "{", "MAC_ADDRESS", ":", "\"01:23:45:67:89:ab\"", ...
[ 174, 0 ]
[ 183, 38 ]
python
en
['en', 'en', 'en']
True
test_reauth_flow
(hass: HomeAssistant)
Test a reauthentication flow.
Test a reauthentication flow.
async def test_reauth_flow(hass: HomeAssistant) -> None: """Test a reauthentication flow.""" entry = MockConfigEntry( domain=DOMAIN, unique_id="12345", data={ CONF_EMAIL: "verisure_my_pages@example.com", CONF_GIID: "12345", CONF_PASSWORD: "SuperS3cr3t!...
[ "async", "def", "test_reauth_flow", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "\"12345\"", ",", "data", "=", "{", "CONF_EMAIL", ":", "\"verisure_my_pages@exa...
[ 186, 0 ]
[ 237, 48 ]
python
en
['en', 'fr', 'en']
True
test_reauth_flow_invalid_login
(hass: HomeAssistant)
Test a reauthentication flow.
Test a reauthentication flow.
async def test_reauth_flow_invalid_login(hass: HomeAssistant) -> None: """Test a reauthentication flow.""" entry = MockConfigEntry( domain=DOMAIN, unique_id="12345", data={ CONF_EMAIL: "verisure_my_pages@example.com", CONF_GIID: "12345", CONF_PASSWORD:...
[ "async", "def", "test_reauth_flow_invalid_login", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "\"12345\"", ",", "data", "=", "{", "CONF_EMAIL", ":", "\"verisur...
[ 240, 0 ]
[ 278, 56 ]
python
en
['en', 'fr', 'en']
True
test_reauth_flow_unknown_error
(hass: HomeAssistant)
Test a reauthentication flow, with an unknown error happening.
Test a reauthentication flow, with an unknown error happening.
async def test_reauth_flow_unknown_error(hass: HomeAssistant) -> None: """Test a reauthentication flow, with an unknown error happening.""" entry = MockConfigEntry( domain=DOMAIN, unique_id="12345", data={ CONF_EMAIL: "verisure_my_pages@example.com", CONF_GIID: "1...
[ "async", "def", "test_reauth_flow_unknown_error", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "\"12345\"", ",", "data", "=", "{", "CONF_EMAIL", ":", "\"verisur...
[ 281, 0 ]
[ 319, 51 ]
python
en
['en', 'en', 'en']
True
test_options_flow
( hass: HomeAssistant, input: dict[str, int | str], output: dict[str, int | str] )
Test options config flow.
Test options config flow.
async def test_options_flow( hass: HomeAssistant, input: dict[str, int | str], output: dict[str, int | str] ) -> None: """Test options config flow.""" entry = MockConfigEntry( domain=DOMAIN, unique_id="12345", data={}, ) entry.add_to_hass(hass) with patch( "homea...
[ "async", "def", "test_options_flow", "(", "hass", ":", "HomeAssistant", ",", "input", ":", "dict", "[", "str", ",", "int", "|", "str", "]", ",", "output", ":", "dict", "[", "str", ",", "int", "|", "str", "]", ")", "->", "None", ":", "entry", "=", ...
[ 346, 0 ]
[ 375, 35 ]
python
en
['en', 'fr', 'en']
True
test_options_flow_code_format_mismatch
(hass: HomeAssistant)
Test options config flow with a code format mismatch.
Test options config flow with a code format mismatch.
async def test_options_flow_code_format_mismatch(hass: HomeAssistant) -> None: """Test options config flow with a code format mismatch.""" entry = MockConfigEntry( domain=DOMAIN, unique_id="12345", data={}, ) entry.add_to_hass(hass) with patch( "homeassistant.compone...
[ "async", "def", "test_options_flow_code_format_mismatch", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "\"12345\"", ",", "data", "=", "{", "}", ",", ")", "ent...
[ 378, 0 ]
[ 410, 63 ]
python
en
['en', 'en', 'en']
True
async_set_agent
(hass: core.HomeAssistant, agent: AbstractConversationAgent)
Set the agent to handle the conversations.
Set the agent to handle the conversations.
def async_set_agent(hass: core.HomeAssistant, agent: AbstractConversationAgent): """Set the agent to handle the conversations.""" hass.data[DATA_AGENT] = agent
[ "def", "async_set_agent", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "agent", ":", "AbstractConversationAgent", ")", ":", "hass", ".", "data", "[", "DATA_AGENT", "]", "=", "agent" ]
[ 48, 0 ]
[ 50, 33 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Register the process service.
Register the process service.
async def async_setup(hass, config): """Register the process service.""" hass.data[DATA_CONFIG] = config async def handle_service(service): """Parse text into commands.""" text = service.data[ATTR_TEXT] _LOGGER.debug("Processing: <%s>", text) agent = await _get_agent(hass) ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", "[", "DATA_CONFIG", "]", "=", "config", "async", "def", "handle_service", "(", "service", ")", ":", "\"\"\"Parse text into commands.\"\"\"", "text", "=", "service", ".", ...
[ 53, 0 ]
[ 75, 15 ]
python
en
['en', 'en', 'en']
True
websocket_process
(hass, connection, msg)
Process text.
Process text.
async def websocket_process(hass, connection, msg): """Process text.""" connection.send_result( msg["id"], await _async_converse( hass, msg["text"], msg.get("conversation_id"), connection.context(msg) ), )
[ "async", "def", "websocket_process", "(", "hass", ",", "connection", ",", "msg", ")", ":", "connection", ".", "send_result", "(", "msg", "[", "\"id\"", "]", ",", "await", "_async_converse", "(", "hass", ",", "msg", "[", "\"text\"", "]", ",", "msg", ".", ...
[ 82, 0 ]
[ 89, 5 ]
python
en
['en', 'su', 'en']
False
websocket_get_agent_info
(hass, connection, msg)
Do we need onboarding.
Do we need onboarding.
async def websocket_get_agent_info(hass, connection, msg): """Do we need onboarding.""" agent = await _get_agent(hass) connection.send_result( msg["id"], { "onboarding": await agent.async_get_onboarding(), "attribution": agent.attribution, }, )
[ "async", "def", "websocket_get_agent_info", "(", "hass", ",", "connection", ",", "msg", ")", ":", "agent", "=", "await", "_get_agent", "(", "hass", ")", "connection", ".", "send_result", "(", "msg", "[", "\"id\"", "]", ",", "{", "\"onboarding\"", ":", "awa...
[ 94, 0 ]
[ 104, 5 ]
python
en
['en', 'xh', 'en']
True
websocket_set_onboarding
(hass, connection, msg)
Set onboarding status.
Set onboarding status.
async def websocket_set_onboarding(hass, connection, msg): """Set onboarding status.""" agent = await _get_agent(hass) success = await agent.async_set_onboarding(msg["shown"]) if success: connection.send_result(msg["id"]) else: connection.send_error(msg["id"])
[ "async", "def", "websocket_set_onboarding", "(", "hass", ",", "connection", ",", "msg", ")", ":", "agent", "=", "await", "_get_agent", "(", "hass", ")", "success", "=", "await", "agent", ".", "async_set_onboarding", "(", "msg", "[", "\"shown\"", "]", ")", ...
[ 109, 0 ]
[ 118, 40 ]
python
en
['en', 'nl', 'en']
True
_get_agent
(hass: core.HomeAssistant)
Get the active conversation agent.
Get the active conversation agent.
async def _get_agent(hass: core.HomeAssistant) -> AbstractConversationAgent: """Get the active conversation agent.""" agent = hass.data.get(DATA_AGENT) if agent is None: agent = hass.data[DATA_AGENT] = DefaultAgent(hass) await agent.async_initialize(hass.data.get(DATA_CONFIG)) return age...
[ "async", "def", "_get_agent", "(", "hass", ":", "core", ".", "HomeAssistant", ")", "->", "AbstractConversationAgent", ":", "agent", "=", "hass", ".", "data", ".", "get", "(", "DATA_AGENT", ")", "if", "agent", "is", "None", ":", "agent", "=", "hass", ".",...
[ 154, 0 ]
[ 160, 16 ]
python
en
['en', 'nl', 'en']
True
_async_converse
( hass: core.HomeAssistant, text: str, conversation_id: str, context: core.Context )
Process text and get intent.
Process text and get intent.
async def _async_converse( hass: core.HomeAssistant, text: str, conversation_id: str, context: core.Context ) -> intent.IntentResponse: """Process text and get intent.""" agent = await _get_agent(hass) try: intent_result = await agent.async_process(text, context, conversation_id) except inte...
[ "async", "def", "_async_converse", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "text", ":", "str", ",", "conversation_id", ":", "str", ",", "context", ":", "core", ".", "Context", ")", "->", "intent", ".", "IntentResponse", ":", "agent", "=", "a...
[ 163, 0 ]
[ 178, 24 ]
python
en
['en', 'en', 'en']
True
ConversationProcessView.post
(self, request, data)
Send a request for processing.
Send a request for processing.
async def post(self, request, data): """Send a request for processing.""" hass = request.app["hass"] try: intent_result = await _async_converse( hass, data["text"], data.get("conversation_id"), self.context(request) ) except intent.IntentError as ...
[ "async", "def", "post", "(", "self", ",", "request", ",", "data", ")", ":", "hass", "=", "request", ".", "app", "[", "\"hass\"", "]", "try", ":", "intent_result", "=", "await", "_async_converse", "(", "hass", ",", "data", "[", "\"text\"", "]", ",", "...
[ 130, 4 ]
[ 151, 39 ]
python
en
['en', 'en', 'en']
True
TestModelReturn.testModelReturn
(self)
Test ModelReturn
Test ModelReturn
def testModelReturn(self): """Test ModelReturn""" # FIXME: construct object with mandatory attributes with example values # model = ModelReturn() # noqa: E501 pass
[ "def", "testModelReturn", "(", "self", ")", ":", "# FIXME: construct object with mandatory attributes with example values", "# model = ModelReturn() # noqa: E501", "pass" ]
[ 28, 4 ]
[ 32, 12 ]
python
en
['en', 'no', 'en']
False
make_filter
(callsigns: list)
Make a server-side filter from a list of callsigns.
Make a server-side filter from a list of callsigns.
def make_filter(callsigns: list) -> str: """Make a server-side filter from a list of callsigns.""" return " ".join(f"b/{sign.upper()}" for sign in callsigns)
[ "def", "make_filter", "(", "callsigns", ":", "list", ")", "->", "str", ":", "return", "\" \"", ".", "join", "(", "f\"b/{sign.upper()}\"", "for", "sign", "in", "callsigns", ")" ]
[ 59, 0 ]
[ 61, 62 ]
python
en
['en', 'en', 'en']
True
gps_accuracy
(gps, posambiguity: int)
Calculate the GPS accuracy based on APRS posambiguity.
Calculate the GPS accuracy based on APRS posambiguity.
def gps_accuracy(gps, posambiguity: int) -> int: """Calculate the GPS accuracy based on APRS posambiguity.""" pos_a_map = {0: 0, 1: 1 / 600, 2: 1 / 60, 3: 1 / 6, 4: 1} if posambiguity in pos_a_map: degrees = pos_a_map[posambiguity] gps2 = (gps[0], gps[1] + degrees) dist_m = geopy.d...
[ "def", "gps_accuracy", "(", "gps", ",", "posambiguity", ":", "int", ")", "->", "int", ":", "pos_a_map", "=", "{", "0", ":", "0", ",", "1", ":", "1", "/", "600", ",", "2", ":", "1", "/", "60", ",", "3", ":", "1", "/", "6", ",", "4", ":", "...
[ 64, 0 ]
[ 79, 19 ]
python
en
['en', 'en', 'en']
True
setup_scanner
(hass, config, see, discovery_info=None)
Set up the APRS tracker.
Set up the APRS tracker.
def setup_scanner(hass, config, see, discovery_info=None): """Set up the APRS tracker.""" callsigns = config.get(CONF_CALLSIGNS) server_filter = make_filter(callsigns) callsign = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) host = config.get(CONF_HOST) timeout = config.get...
[ "def", "setup_scanner", "(", "hass", ",", "config", ",", "see", ",", "discovery_info", "=", "None", ")", ":", "callsigns", "=", "config", ".", "get", "(", "CONF_CALLSIGNS", ")", "server_filter", "=", "make_filter", "(", "callsigns", ")", "callsign", "=", "...
[ 82, 0 ]
[ 109, 15 ]
python
en
['en', 'en', 'en']
True
AprsListenerThread.__init__
( self, callsign: str, password: str, host: str, server_filter: str, see )
Initialize the class.
Initialize the class.
def __init__( self, callsign: str, password: str, host: str, server_filter: str, see ): """Initialize the class.""" super().__init__() self.callsign = callsign self.host = host self.start_event = threading.Event() self.see = see self.server_filter = s...
[ "def", "__init__", "(", "self", ",", "callsign", ":", "str", ",", "password", ":", "str", ",", "host", ":", "str", ",", "server_filter", ":", "str", ",", "see", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "callsign", "=", ...
[ 115, 4 ]
[ 131, 9 ]
python
en
['en', 'en', 'en']
True
AprsListenerThread.start_complete
(self, success: bool, message: str)
Complete startup process.
Complete startup process.
def start_complete(self, success: bool, message: str): """Complete startup process.""" self.start_message = message self.start_success = success self.start_event.set()
[ "def", "start_complete", "(", "self", ",", "success", ":", "bool", ",", "message", ":", "str", ")", ":", "self", ".", "start_message", "=", "message", "self", ".", "start_success", "=", "success", "self", ".", "start_event", ".", "set", "(", ")" ]
[ 133, 4 ]
[ 137, 30 ]
python
en
['en', 'en', 'en']
True
AprsListenerThread.run
(self)
Connect to APRS and listen for data.
Connect to APRS and listen for data.
def run(self): """Connect to APRS and listen for data.""" self.ais.set_filter(self.server_filter) try: _LOGGER.info( "Opening connection to %s with callsign %s", self.host, self.callsign ) self.ais.connect() self.start_complete( ...
[ "def", "run", "(", "self", ")", ":", "self", ".", "ais", ".", "set_filter", "(", "self", ".", "server_filter", ")", "try", ":", "_LOGGER", ".", "info", "(", "\"Opening connection to %s with callsign %s\"", ",", "self", ".", "host", ",", "self", ".", "calls...
[ 139, 4 ]
[ 157, 13 ]
python
en
['en', 'en', 'en']
True
AprsListenerThread.stop
(self)
Close the connection to the APRS network.
Close the connection to the APRS network.
def stop(self): """Close the connection to the APRS network.""" self.ais.close()
[ "def", "stop", "(", "self", ")", ":", "self", ".", "ais", ".", "close", "(", ")" ]
[ 159, 4 ]
[ 161, 24 ]
python
en
['en', 'en', 'en']
True
AprsListenerThread.rx_msg
(self, msg: dict)
Receive message and process if position.
Receive message and process if position.
def rx_msg(self, msg: dict): """Receive message and process if position.""" _LOGGER.debug("APRS message received: %s", str(msg)) if msg[ATTR_FORMAT] in MSG_FORMATS: dev_id = slugify(msg[ATTR_FROM]) lat = msg[ATTR_LATITUDE] lon = msg[ATTR_LONGITUDE] ...
[ "def", "rx_msg", "(", "self", ",", "msg", ":", "dict", ")", ":", "_LOGGER", ".", "debug", "(", "\"APRS message received: %s\"", ",", "str", "(", "msg", ")", ")", "if", "msg", "[", "ATTR_FORMAT", "]", "in", "MSG_FORMATS", ":", "dev_id", "=", "slugify", ...
[ 163, 4 ]
[ 184, 69 ]
python
en
['en', 'en', 'en']
True
test_sensor
(hass, requests_mock)
Test the Ring sensors.
Test the Ring sensors.
async def test_sensor(hass, requests_mock): """Test the Ring sensors.""" await setup_platform(hass, "sensor") front_battery_state = hass.states.get("sensor.front_battery") assert front_battery_state is not None assert front_battery_state.state == "80" front_door_battery_state = hass.states.get...
[ "async", "def", "test_sensor", "(", "hass", ",", "requests_mock", ")", ":", "await", "setup_platform", "(", "hass", ",", "\"sensor\"", ")", "front_battery_state", "=", "hass", ".", "states", ".", "get", "(", "\"sensor.front_battery\"", ")", "assert", "front_batt...
[ 6, 0 ]
[ 45, 63 ]
python
en
['en', 'no', 'en']
True
issequence
(seq)
Is seq a sequence (ndarray, list or tuple)?
Is seq a sequence (ndarray, list or tuple)?
def issequence(seq): """ Is seq a sequence (ndarray, list or tuple)? """ return isinstance(seq, (ndarray, tuple, list))
[ "def", "issequence", "(", "seq", ")", ":", "return", "isinstance", "(", "seq", ",", "(", "ndarray", ",", "tuple", ",", "list", ")", ")" ]
[ 42, 0 ]
[ 47, 50 ]
python
en
['en', 'error', 'th']
False
count_masked
(arr, axis=None)
Count the number of masked elements along the given axis. Parameters ---------- arr : array_like An array with (possibly) masked elements. axis : int, optional Axis along which to count. If None (default), a flattened version of the array is used. Returns ------- ...
Count the number of masked elements along the given axis.
def count_masked(arr, axis=None): """ Count the number of masked elements along the given axis. Parameters ---------- arr : array_like An array with (possibly) masked elements. axis : int, optional Axis along which to count. If None (default), a flattened version of the ...
[ "def", "count_masked", "(", "arr", ",", "axis", "=", "None", ")", ":", "m", "=", "getmaskarray", "(", "arr", ")", "return", "m", ".", "sum", "(", "axis", ")" ]
[ 50, 0 ]
[ 101, 22 ]
python
en
['en', 'error', 'th']
False
masked_all
(shape, dtype=float)
Empty masked array with all elements masked. Return an empty masked array of the given shape and dtype, where all the data are masked. Parameters ---------- shape : tuple Shape of the required MaskedArray. dtype : dtype, optional Data type of the output. Returns -...
Empty masked array with all elements masked.
def masked_all(shape, dtype=float): """ Empty masked array with all elements masked. Return an empty masked array of the given shape and dtype, where all the data are masked. Parameters ---------- shape : tuple Shape of the required MaskedArray. dtype : dtype, optional ...
[ "def", "masked_all", "(", "shape", ",", "dtype", "=", "float", ")", ":", "a", "=", "masked_array", "(", "np", ".", "empty", "(", "shape", ",", "dtype", ")", ",", "mask", "=", "np", ".", "ones", "(", "shape", ",", "make_mask_descr", "(", "dtype", ")...
[ 104, 0 ]
[ 153, 12 ]
python
en
['en', 'error', 'th']
False
masked_all_like
(arr)
Empty masked array with the properties of an existing array. Return an empty masked array of the same shape and dtype as the array `arr`, where all the data are masked. Parameters ---------- arr : ndarray An array describing the shape and dtype of the required MaskedArray. Return...
Empty masked array with the properties of an existing array.
def masked_all_like(arr): """ Empty masked array with the properties of an existing array. Return an empty masked array of the same shape and dtype as the array `arr`, where all the data are masked. Parameters ---------- arr : ndarray An array describing the shape and dtype of the ...
[ "def", "masked_all_like", "(", "arr", ")", ":", "a", "=", "np", ".", "empty_like", "(", "arr", ")", ".", "view", "(", "MaskedArray", ")", "a", ".", "_mask", "=", "np", ".", "ones", "(", "a", ".", "shape", ",", "dtype", "=", "make_mask_descr", "(", ...
[ 156, 0 ]
[ 208, 12 ]
python
en
['en', 'error', 'th']
False
flatten_inplace
(seq)
Flatten a sequence in place.
Flatten a sequence in place.
def flatten_inplace(seq): """Flatten a sequence in place.""" k = 0 while (k != len(seq)): while hasattr(seq[k], '__iter__'): seq[k:(k + 1)] = seq[k] k += 1 return seq
[ "def", "flatten_inplace", "(", "seq", ")", ":", "k", "=", "0", "while", "(", "k", "!=", "len", "(", "seq", ")", ")", ":", "while", "hasattr", "(", "seq", "[", "k", "]", ",", "'__iter__'", ")", ":", "seq", "[", "k", ":", "(", "k", "+", "1", ...
[ 366, 0 ]
[ 373, 14 ]
python
en
['en', 'en', 'it']
True
apply_along_axis
(func1d, axis, arr, *args, **kwargs)
(This docstring should be overwritten)
(This docstring should be overwritten)
def apply_along_axis(func1d, axis, arr, *args, **kwargs): """ (This docstring should be overwritten) """ arr = array(arr, copy=False, subok=True) nd = arr.ndim axis = normalize_axis_index(axis, nd) ind = [0] * (nd - 1) i = np.zeros(nd, 'O') indlist = list(range(nd)) indlist.remov...
[ "def", "apply_along_axis", "(", "func1d", ",", "axis", ",", "arr", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "arr", "=", "array", "(", "arr", ",", "copy", "=", "False", ",", "subok", "=", "True", ")", "nd", "=", "arr", ".", "ndim", "...
[ 376, 0 ]
[ 455, 17 ]
python
en
['en', 'error', 'th']
False