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
KNXSensor.__init__
(self, device: XknxSensor)
Initialize of a KNX sensor.
Initialize of a KNX sensor.
def __init__(self, device: XknxSensor): """Initialize of a KNX sensor.""" super().__init__(device)
[ "def", "__init__", "(", "self", ",", "device", ":", "XknxSensor", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ")" ]
[ 22, 4 ]
[ 24, 32 ]
python
en
['en', 'pt', 'en']
True
KNXSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._device.resolve_state()
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "resolve_state", "(", ")" ]
[ 27, 4 ]
[ 29, 43 ]
python
en
['en', 'en', 'en']
True
KNXSensor.unit_of_measurement
(self)
Return the unit this state is expressed in.
Return the unit this state is expressed in.
def unit_of_measurement(self): """Return the unit this state is expressed in.""" return self._device.unit_of_measurement()
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "unit_of_measurement", "(", ")" ]
[ 32, 4 ]
[ 34, 49 ]
python
en
['en', 'en', 'en']
True
KNXSensor.device_class
(self)
Return the device class of the sensor.
Return the device class of the sensor.
def device_class(self): """Return the device class of the sensor.""" device_class = self._device.ha_device_class() if device_class in DEVICE_CLASSES: return device_class return None
[ "def", "device_class", "(", "self", ")", ":", "device_class", "=", "self", ".", "_device", ".", "ha_device_class", "(", ")", "if", "device_class", "in", "DEVICE_CLASSES", ":", "return", "device_class", "return", "None" ]
[ 37, 4 ]
[ 42, 19 ]
python
en
['en', 'en', 'en']
True
KNXSensor.force_update
(self)
Return True if state updates should be forced. If True, a state change will be triggered anytime the state property is updated, not just when the value changes.
Return True if state updates should be forced.
def force_update(self) -> bool: """ Return True if state updates should be forced. If True, a state change will be triggered anytime the state property is updated, not just when the value changes. """ return self._device.always_callback
[ "def", "force_update", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_device", ".", "always_callback" ]
[ 45, 4 ]
[ 52, 43 ]
python
en
['en', 'error', 'th']
False
validate_input
(hass: core.HomeAssistant, data)
Validate the user host input.
Validate the user host input.
async def validate_input(hass: core.HomeAssistant, data): """Validate the user host input.""" confs = hass.config_entries.async_entries(DOMAIN) same_entries = [ True for entry in confs if entry.data.get("host") == data["host"] and entry.data.get("port") == data["port"] ]...
[ "async", "def", "validate_input", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "data", ")", ":", "confs", "=", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ")", "same_entries", "=", "[", "True", "for", "entry", "in", "confs",...
[ 14, 0 ]
[ 39, 5 ]
python
en
['en', 'en', 'en']
True
ProgettiHWSWConfigFlow.__init__
(self)
Initialize class variables.
Initialize class variables.
def __init__(self): """Initialize class variables.""" self.s1_in = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "s1_in", "=", "None" ]
[ 48, 4 ]
[ 50, 25 ]
python
en
['en', 'en', 'en']
True
ProgettiHWSWConfigFlow.async_step_relay_modes
(self, user_input=None)
Manage relay modes step.
Manage relay modes step.
async def async_step_relay_modes(self, user_input=None): """Manage relay modes step.""" errors = {} if user_input is not None: whole_data = user_input whole_data.update(self.s1_in) return self.async_create_entry(title=whole_data["title"], data=whole_data) ...
[ "async", "def", "async_step_relay_modes", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "whole_data", "=", "user_input", "whole_data", ".", "update", "(", "self", ".", "s1_in",...
[ 52, 4 ]
[ 77, 9 ]
python
en
['en', 'en', 'en']
True
ProgettiHWSWConfigFlow.async_step_user
(self, user_input=None)
Handle the initial step.
Handle the initial step.
async def async_step_user(self, user_input=None): """Handle the initial step.""" errors = {} if user_input is not None: try: info = await validate_input(self.hass, user_input) except CannotConnect: errors["base"] = "cannot_connect" ...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "try", ":", "info", "=", "await", "validate_input", "(", "self", ".", "hass", ",", "user_in...
[ 79, 4 ]
[ 99, 9 ]
python
en
['en', 'en', 'en']
True
get_id
(sensorid, feedtag, feedname, feedid, feeduserid)
Return unique identifier for feed / sensor.
Return unique identifier for feed / sensor.
def get_id(sensorid, feedtag, feedname, feedid, feeduserid): """Return unique identifier for feed / sensor.""" return f"emoncms{sensorid}_{feedtag}_{feedname}_{feedid}_{feeduserid}"
[ "def", "get_id", "(", "sensorid", ",", "feedtag", ",", "feedname", ",", "feedid", ",", "feeduserid", ")", ":", "return", "f\"emoncms{sensorid}_{feedtag}_{feedname}_{feedid}_{feeduserid}\"" ]
[ 64, 0 ]
[ 66, 74 ]
python
en
['fr', 'no', 'en']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Emoncms sensor.
Set up the Emoncms sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Emoncms sensor.""" apikey = config.get(CONF_API_KEY) url = config.get(CONF_URL) sensorid = config.get(CONF_ID) value_template = config.get(CONF_VALUE_TEMPLATE) config_unit = config.get(CONF_UNIT_OF_MEASUREMENT) ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "apikey", "=", "config", ".", "get", "(", "CONF_API_KEY", ")", "url", "=", "config", ".", "get", "(", "CONF_URL", ")", "sensorid", "="...
[ 69, 0 ]
[ 124, 25 ]
python
en
['en', 'da', 'en']
True
EmonCmsSensor.__init__
( self, hass, data, name, value_template, unit_of_measurement, sensorid, elem )
Initialize the sensor.
Initialize the sensor.
def __init__( self, hass, data, name, value_template, unit_of_measurement, sensorid, elem ): """Initialize the sensor.""" if name is None: # Suppress ID in sensor name if it's 1, since most people won't # have more than one EmonCMS source and it's redundant to show th...
[ "def", "__init__", "(", "self", ",", "hass", ",", "data", ",", "name", ",", "value_template", ",", "unit_of_measurement", ",", "sensorid", ",", "elem", ")", ":", "if", "name", "is", "None", ":", "# Suppress ID in sensor name if it's 1, since most people won't", "#...
[ 130, 4 ]
[ 159, 63 ]
python
en
['en', 'en', 'en']
True
EmonCmsSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 162, 4 ]
[ 164, 25 ]
python
en
['en', 'mi', 'en']
True
EmonCmsSensor.unit_of_measurement
(self)
Return the unit of measurement of this entity, if any.
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 167, 4 ]
[ 169, 40 ]
python
en
['en', 'en', 'en']
True
EmonCmsSensor.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 172, 4 ]
[ 174, 26 ]
python
en
['en', 'en', 'en']
True
EmonCmsSensor.device_state_attributes
(self)
Return the attributes of the sensor.
Return the attributes of the sensor.
def device_state_attributes(self): """Return the attributes of the sensor.""" return { ATTR_FEEDID: self._elem["id"], ATTR_TAG: self._elem["tag"], ATTR_FEEDNAME: self._elem["name"], ATTR_SIZE: self._elem["size"], ATTR_USERID: self._elem["userid...
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_FEEDID", ":", "self", ".", "_elem", "[", "\"id\"", "]", ",", "ATTR_TAG", ":", "self", ".", "_elem", "[", "\"tag\"", "]", ",", "ATTR_FEEDNAME", ":", "self", ".", "_elem", "[", ...
[ 177, 4 ]
[ 187, 9 ]
python
en
['en', 'en', 'en']
True
EmonCmsSensor.update
(self)
Get the latest data and updates the state.
Get the latest data and updates the state.
def update(self): """Get the latest data and updates the state.""" self._data.update() if self._data.data is None: return elem = next( ( elem for elem in self._data.data if get_id( self._sensori...
[ "def", "update", "(", "self", ")", ":", "self", ".", "_data", ".", "update", "(", ")", "if", "self", ".", "_data", ".", "data", "is", "None", ":", "return", "elem", "=", "next", "(", "(", "elem", "for", "elem", "in", "self", ".", "_data", ".", ...
[ 189, 4 ]
[ 222, 63 ]
python
en
['en', 'en', 'en']
True
EmonCmsData.__init__
(self, hass, url, apikey, interval)
Initialize the data object.
Initialize the data object.
def __init__(self, hass, url, apikey, interval): """Initialize the data object.""" self._apikey = apikey self._url = f"{url}/feed/list.json" self._interval = interval self._hass = hass self.data = None
[ "def", "__init__", "(", "self", ",", "hass", ",", "url", ",", "apikey", ",", "interval", ")", ":", "self", ".", "_apikey", "=", "apikey", "self", ".", "_url", "=", "f\"{url}/feed/list.json\"", "self", ".", "_interval", "=", "interval", "self", ".", "_has...
[ 228, 4 ]
[ 234, 24 ]
python
en
['en', 'en', 'en']
True
EmonCmsData.update
(self)
Get the latest data from Emoncms.
Get the latest data from Emoncms.
def update(self): """Get the latest data from Emoncms.""" try: parameters = {"apikey": self._apikey} req = requests.get( self._url, params=parameters, allow_redirects=True, timeout=5 ) except requests.exceptions.RequestException as exception: ...
[ "def", "update", "(", "self", ")", ":", "try", ":", "parameters", "=", "{", "\"apikey\"", ":", "self", ".", "_apikey", "}", "req", "=", "requests", ".", "get", "(", "self", ".", "_url", ",", "params", "=", "parameters", ",", "allow_redirects", "=", "...
[ 237, 4 ]
[ 256, 17 ]
python
en
['en', 'en', 'en']
True
test_update_scene
(hass, hass_client)
Test updating a scene.
Test updating a scene.
async def test_update_scene(hass, hass_client): """Test updating a scene.""" with patch.object(config, "SECTIONS", ["scene"]): await async_setup_component(hass, "config", {}) client = await hass_client() orig_data = [{"id": "light_on"}, {"id": "light_off"}] def mock_read(path): ""...
[ "async", "def", "test_update_scene", "(", "hass", ",", "hass_client", ")", ":", "with", "patch", ".", "object", "(", "config", ",", "\"SECTIONS\"", ",", "[", "\"scene\"", "]", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"config\"", ",", ...
[ 10, 0 ]
[ 59, 5 ]
python
en
['en', 'en', 'en']
True
test_bad_formatted_scene
(hass, hass_client)
Test that we handle scene without ID.
Test that we handle scene without ID.
async def test_bad_formatted_scene(hass, hass_client): """Test that we handle scene without ID.""" with patch.object(config, "SECTIONS", ["scene"]): await async_setup_component(hass, "config", {}) client = await hass_client() orig_data = [ { # No ID "entities": ...
[ "async", "def", "test_bad_formatted_scene", "(", "hass", ",", "hass_client", ")", ":", "with", "patch", ".", "object", "(", "config", ",", "\"SECTIONS\"", ",", "[", "\"scene\"", "]", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"config\"", ...
[ 62, 0 ]
[ 112, 5 ]
python
en
['en', 'en', 'en']
True
test_delete_scene
(hass, hass_client)
Test deleting a scene.
Test deleting a scene.
async def test_delete_scene(hass, hass_client): """Test deleting a scene.""" ent_reg = await hass.helpers.entity_registry.async_get_registry() assert await async_setup_component( hass, "scene", { "scene": [ {"id": "light_on", "name": "Light on", "entities...
[ "async", "def", "test_delete_scene", "(", "hass", ",", "hass_client", ")", ":", "ent_reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "\"scene\"...
[ 115, 0 ]
[ 162, 37 ]
python
ca
['ca', 'en', 'pt']
False
async_setup_entry
( hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities )
Set up the HomematicIP climate from a config entry.
Set up the HomematicIP climate from a config entry.
async def async_setup_entry( hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities ) -> None: """Set up the HomematicIP climate from a config entry.""" hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id] entities = [] for device in hap.home.groups: if isinstance(device, As...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "hap", "=", "hass", ".", "data", "[", "HMIPC_DOMAIN", "]", "[", "config_entry", ".", "unique...
[ 42, 0 ]
[ 53, 36 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup.__init__
(self, hap: HomematicipHAP, device: AsyncHeatingGroup)
Initialize heating group.
Initialize heating group.
def __init__(self, hap: HomematicipHAP, device: AsyncHeatingGroup) -> None: """Initialize heating group.""" device.modelType = "HmIP-Heating-Group" super().__init__(hap, device) self._simple_heating = None if device.actualTemperature is None: self._simple_heating = se...
[ "def", "__init__", "(", "self", ",", "hap", ":", "HomematicipHAP", ",", "device", ":", "AsyncHeatingGroup", ")", "->", "None", ":", "device", ".", "modelType", "=", "\"HmIP-Heating-Group\"", "super", "(", ")", ".", "__init__", "(", "hap", ",", "device", ")...
[ 64, 4 ]
[ 70, 66 ]
python
en
['de', 'en', 'en']
True
HomematicipHeatingGroup.device_info
(self)
Return device specific attributes.
Return device specific attributes.
def device_info(self) -> Dict[str, Any]: """Return device specific attributes.""" return { "identifiers": {(HMIPC_DOMAIN, self._device.id)}, "name": self._device.label, "manufacturer": "eQ-3", "model": self._device.modelType, "via_device": (HMI...
[ "def", "device_info", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "HMIPC_DOMAIN", ",", "self", ".", "_device", ".", "id", ")", "}", ",", "\"name\"", ":", "self", ".", "_device", ...
[ 73, 4 ]
[ 81, 9 ]
python
en
['fr', 'it', 'en']
False
HomematicipHeatingGroup.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self) -> str: """Return the unit of measurement.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", "->", "str", ":", "return", "TEMP_CELSIUS" ]
[ 84, 4 ]
[ 86, 27 ]
python
en
['en', 'la', 'en']
True
HomematicipHeatingGroup.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self) -> int: """Return the list of supported features.""" return SUPPORT_PRESET_MODE | SUPPORT_TARGET_TEMPERATURE
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_PRESET_MODE", "|", "SUPPORT_TARGET_TEMPERATURE" ]
[ 89, 4 ]
[ 91, 63 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup.target_temperature
(self)
Return the temperature we try to reach.
Return the temperature we try to reach.
def target_temperature(self) -> float: """Return the temperature we try to reach.""" return self._device.setPointTemperature
[ "def", "target_temperature", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_device", ".", "setPointTemperature" ]
[ 94, 4 ]
[ 96, 47 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self) -> float: """Return the current temperature.""" if self._simple_heating: return self._simple_heating.valveActualTemperature return self._device.actualTemperature
[ "def", "current_temperature", "(", "self", ")", "->", "float", ":", "if", "self", ".", "_simple_heating", ":", "return", "self", ".", "_simple_heating", ".", "valveActualTemperature", "return", "self", ".", "_device", ".", "actualTemperature" ]
[ 99, 4 ]
[ 103, 45 ]
python
en
['en', 'la', 'en']
True
HomematicipHeatingGroup.current_humidity
(self)
Return the current humidity.
Return the current humidity.
def current_humidity(self) -> int: """Return the current humidity.""" return self._device.humidity
[ "def", "current_humidity", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_device", ".", "humidity" ]
[ 106, 4 ]
[ 108, 36 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup.hvac_mode
(self)
Return hvac operation ie.
Return hvac operation ie.
def hvac_mode(self) -> str: """Return hvac operation ie.""" if self._disabled_by_cooling_mode and not self._has_switch: return HVAC_MODE_OFF if self._device.boostMode: return HVAC_MODE_HEAT if self._device.controlMode == HMIP_MANUAL_CM: return HVAC_MOD...
[ "def", "hvac_mode", "(", "self", ")", "->", "str", ":", "if", "self", ".", "_disabled_by_cooling_mode", "and", "not", "self", ".", "_has_switch", ":", "return", "HVAC_MODE_OFF", "if", "self", ".", "_device", ".", "boostMode", ":", "return", "HVAC_MODE_HEAT", ...
[ 111, 4 ]
[ 120, 29 ]
python
en
['en', 'et', 'ru']
False
HomematicipHeatingGroup.hvac_modes
(self)
Return the list of available hvac operation modes.
Return the list of available hvac operation modes.
def hvac_modes(self) -> List[str]: """Return the list of available hvac operation modes.""" if self._disabled_by_cooling_mode and not self._has_switch: return [HVAC_MODE_OFF] return ( [HVAC_MODE_AUTO, HVAC_MODE_HEAT] if self._heat_mode_enabled els...
[ "def", "hvac_modes", "(", "self", ")", "->", "List", "[", "str", "]", ":", "if", "self", ".", "_disabled_by_cooling_mode", "and", "not", "self", ".", "_has_switch", ":", "return", "[", "HVAC_MODE_OFF", "]", "return", "(", "[", "HVAC_MODE_AUTO", ",", "HVAC_...
[ 123, 4 ]
[ 132, 9 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup.hvac_action
(self)
Return the current hvac_action. This is only relevant for radiator thermostats.
Return the current hvac_action.
def hvac_action(self) -> Optional[str]: """ Return the current hvac_action. This is only relevant for radiator thermostats. """ if ( self._device.floorHeatingMode == "RADIATOR" and self._has_radiator_thermostat and self._heat_mode_enabled ...
[ "def", "hvac_action", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "(", "self", ".", "_device", ".", "floorHeatingMode", "==", "\"RADIATOR\"", "and", "self", ".", "_has_radiator_thermostat", "and", "self", ".", "_heat_mode_enabled", ")", "...
[ 135, 4 ]
[ 150, 19 ]
python
en
['en', 'error', 'th']
False
HomematicipHeatingGroup.preset_mode
(self)
Return the current preset mode.
Return the current preset mode.
def preset_mode(self) -> Optional[str]: """Return the current preset mode.""" if self._device.boostMode: return PRESET_BOOST if self.hvac_mode in (HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_OFF): return PRESET_NONE if self._device.controlMode == HMIP_ECO_CM: ...
[ "def", "preset_mode", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "self", ".", "_device", ".", "boostMode", ":", "return", "PRESET_BOOST", "if", "self", ".", "hvac_mode", "in", "(", "HVAC_MODE_COOL", ",", "HVAC_MODE_HEAT", ",", "HVAC_MO...
[ 153, 4 ]
[ 173, 9 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup.preset_modes
(self)
Return a list of available preset modes incl. hmip profiles.
Return a list of available preset modes incl. hmip profiles.
def preset_modes(self) -> List[str]: """Return a list of available preset modes incl. hmip profiles.""" # Boost is only available if a radiator thermostat is in the room, # and heat mode is enabled. profile_names = self._device_profile_names presets = [] if ( ...
[ "def", "preset_modes", "(", "self", ")", "->", "List", "[", "str", "]", ":", "# Boost is only available if a radiator thermostat is in the room,", "# and heat mode is enabled.", "profile_names", "=", "self", ".", "_device_profile_names", "presets", "=", "[", "]", "if", ...
[ 176, 4 ]
[ 192, 22 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup.min_temp
(self)
Return the minimum temperature.
Return the minimum temperature.
def min_temp(self) -> float: """Return the minimum temperature.""" return self._device.minTemperature
[ "def", "min_temp", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_device", ".", "minTemperature" ]
[ 195, 4 ]
[ 197, 42 ]
python
en
['en', 'la', 'en']
True
HomematicipHeatingGroup.max_temp
(self)
Return the maximum temperature.
Return the maximum temperature.
def max_temp(self) -> float: """Return the maximum temperature.""" return self._device.maxTemperature
[ "def", "max_temp", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_device", ".", "maxTemperature" ]
[ 200, 4 ]
[ 202, 42 ]
python
en
['en', 'la', 'en']
True
HomematicipHeatingGroup.async_set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
async def async_set_temperature(self, **kwargs) -> None: """Set new target temperature.""" temperature = kwargs.get(ATTR_TEMPERATURE) if temperature is None: return if self.min_temp <= temperature <= self.max_temp: await self._device.set_point_temperature(tempera...
[ "async", "def", "async_set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "if", "temperature", "is", "None", ":", "return", "if", "self", ".", "min_temp", ...
[ 204, 4 ]
[ 211, 65 ]
python
en
['en', 'ca', 'en']
True
HomematicipHeatingGroup.async_set_hvac_mode
(self, hvac_mode: str)
Set new target hvac mode.
Set new target hvac mode.
async def async_set_hvac_mode(self, hvac_mode: str) -> None: """Set new target hvac mode.""" if hvac_mode not in self.hvac_modes: return if hvac_mode == HVAC_MODE_AUTO: await self._device.set_control_mode(HMIP_AUTOMATIC_CM) else: await self._device.se...
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ":", "str", ")", "->", "None", ":", "if", "hvac_mode", "not", "in", "self", ".", "hvac_modes", ":", "return", "if", "hvac_mode", "==", "HVAC_MODE_AUTO", ":", "await", "self", ".", "_devi...
[ 213, 4 ]
[ 221, 63 ]
python
da
['da', 'su', 'en']
False
HomematicipHeatingGroup.async_set_preset_mode
(self, preset_mode: str)
Set new preset mode.
Set new preset mode.
async def async_set_preset_mode(self, preset_mode: str) -> None: """Set new preset mode.""" if preset_mode not in self.preset_modes: return if self._device.boostMode and preset_mode != PRESET_BOOST: await self._device.set_boost(False) if preset_mode == PRESET_BOO...
[ "async", "def", "async_set_preset_mode", "(", "self", ",", "preset_mode", ":", "str", ")", "->", "None", ":", "if", "preset_mode", "not", "in", "self", ".", "preset_modes", ":", "return", "if", "self", ".", "_device", ".", "boostMode", "and", "preset_mode", ...
[ 223, 4 ]
[ 236, 62 ]
python
en
['en', 'sr', 'en']
True
HomematicipHeatingGroup.device_state_attributes
(self)
Return the state attributes of the access point.
Return the state attributes of the access point.
def device_state_attributes(self) -> Dict[str, Any]: """Return the state attributes of the access point.""" state_attr = super().device_state_attributes if self._device.controlMode == HMIP_ECO_CM: if self._indoor_climate.absenceType in [ AbsenceType.PARTY, ...
[ "def", "device_state_attributes", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "state_attr", "=", "super", "(", ")", ".", "device_state_attributes", "if", "self", ".", "_device", ".", "controlMode", "==", "HMIP_ECO_CM", ":", "if", "sel...
[ 239, 4 ]
[ 253, 25 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup._indoor_climate
(self)
Return the hmip indoor climate functional home of this group.
Return the hmip indoor climate functional home of this group.
def _indoor_climate(self) -> IndoorClimateHome: """Return the hmip indoor climate functional home of this group.""" return self._home.get_functionalHome(IndoorClimateHome)
[ "def", "_indoor_climate", "(", "self", ")", "->", "IndoorClimateHome", ":", "return", "self", ".", "_home", ".", "get_functionalHome", "(", "IndoorClimateHome", ")" ]
[ 256, 4 ]
[ 258, 63 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup._device_profiles
(self)
Return the relevant profiles.
Return the relevant profiles.
def _device_profiles(self) -> List[str]: """Return the relevant profiles.""" return [ profile for profile in self._device.profiles if profile.visible and profile.name != "" and profile.index in self._relevant_profile_group ]
[ "def", "_device_profiles", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "[", "profile", "for", "profile", "in", "self", ".", "_device", ".", "profiles", "if", "profile", ".", "visible", "and", "profile", ".", "name", "!=", "\"\"", "a...
[ 261, 4 ]
[ 269, 9 ]
python
en
['en', 'sr', 'en']
True
HomematicipHeatingGroup._device_profile_names
(self)
Return a collection of profile names.
Return a collection of profile names.
def _device_profile_names(self) -> List[str]: """Return a collection of profile names.""" return [profile.name for profile in self._device_profiles]
[ "def", "_device_profile_names", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "[", "profile", ".", "name", "for", "profile", "in", "self", ".", "_device_profiles", "]" ]
[ 272, 4 ]
[ 274, 66 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup._get_profile_idx_by_name
(self, profile_name: str)
Return a profile index by name.
Return a profile index by name.
def _get_profile_idx_by_name(self, profile_name: str) -> int: """Return a profile index by name.""" relevant_index = self._relevant_profile_group index_name = [ profile.index for profile in self._device_profiles if profile.name == profile_name ] ...
[ "def", "_get_profile_idx_by_name", "(", "self", ",", "profile_name", ":", "str", ")", "->", "int", ":", "relevant_index", "=", "self", ".", "_relevant_profile_group", "index_name", "=", "[", "profile", ".", "index", "for", "profile", "in", "self", ".", "_devic...
[ 276, 4 ]
[ 285, 44 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup._heat_mode_enabled
(self)
Return, if heating mode is enabled.
Return, if heating mode is enabled.
def _heat_mode_enabled(self) -> bool: """Return, if heating mode is enabled.""" return not self._device.cooling
[ "def", "_heat_mode_enabled", "(", "self", ")", "->", "bool", ":", "return", "not", "self", ".", "_device", ".", "cooling" ]
[ 288, 4 ]
[ 290, 39 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup._disabled_by_cooling_mode
(self)
Return, if group is disabled by the cooling mode.
Return, if group is disabled by the cooling mode.
def _disabled_by_cooling_mode(self) -> bool: """Return, if group is disabled by the cooling mode.""" return self._device.cooling and ( self._device.coolingIgnored or not self._device.coolingAllowed )
[ "def", "_disabled_by_cooling_mode", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_device", ".", "cooling", "and", "(", "self", ".", "_device", ".", "coolingIgnored", "or", "not", "self", ".", "_device", ".", "coolingAllowed", ")" ]
[ 293, 4 ]
[ 297, 9 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup._relevant_profile_group
(self)
Return the relevant profile groups.
Return the relevant profile groups.
def _relevant_profile_group(self) -> List[str]: """Return the relevant profile groups.""" if self._disabled_by_cooling_mode: return [] return HEATING_PROFILES if self._heat_mode_enabled else COOLING_PROFILES
[ "def", "_relevant_profile_group", "(", "self", ")", "->", "List", "[", "str", "]", ":", "if", "self", ".", "_disabled_by_cooling_mode", ":", "return", "[", "]", "return", "HEATING_PROFILES", "if", "self", ".", "_heat_mode_enabled", "else", "COOLING_PROFILES" ]
[ 300, 4 ]
[ 305, 80 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup._has_switch
(self)
Return, if a switch is in the hmip heating group.
Return, if a switch is in the hmip heating group.
def _has_switch(self) -> bool: """Return, if a switch is in the hmip heating group.""" for device in self._device.devices: if isinstance(device, Switch): return True return False
[ "def", "_has_switch", "(", "self", ")", "->", "bool", ":", "for", "device", "in", "self", ".", "_device", ".", "devices", ":", "if", "isinstance", "(", "device", ",", "Switch", ")", ":", "return", "True", "return", "False" ]
[ 308, 4 ]
[ 314, 20 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup._has_radiator_thermostat
(self)
Return, if a radiator thermostat is in the hmip heating group.
Return, if a radiator thermostat is in the hmip heating group.
def _has_radiator_thermostat(self) -> bool: """Return, if a radiator thermostat is in the hmip heating group.""" return bool(self._first_radiator_thermostat)
[ "def", "_has_radiator_thermostat", "(", "self", ")", "->", "bool", ":", "return", "bool", "(", "self", ".", "_first_radiator_thermostat", ")" ]
[ 317, 4 ]
[ 319, 52 ]
python
en
['en', 'en', 'en']
True
HomematicipHeatingGroup._first_radiator_thermostat
( self, )
Return the first radiator thermostat from the hmip heating group.
Return the first radiator thermostat from the hmip heating group.
def _first_radiator_thermostat( self, ) -> Optional[Union[AsyncHeatingThermostat, AsyncHeatingThermostatCompact]]: """Return the first radiator thermostat from the hmip heating group.""" for device in self._device.devices: if isinstance( device, (AsyncHeatingTherm...
[ "def", "_first_radiator_thermostat", "(", "self", ",", ")", "->", "Optional", "[", "Union", "[", "AsyncHeatingThermostat", ",", "AsyncHeatingThermostatCompact", "]", "]", ":", "for", "device", "in", "self", ".", "_device", ".", "devices", ":", "if", "isinstance"...
[ 322, 4 ]
[ 332, 19 ]
python
en
['en', 'en', 'en']
True
urlbase
(value)
Validate and transform urlbase.
Validate and transform urlbase.
def urlbase(value) -> str: """Validate and transform urlbase.""" if value is None: raise vol.Invalid("string value is None") value = str(value).strip("/") if not value: return value return f"{value}/"
[ "def", "urlbase", "(", "value", ")", "->", "str", ":", "if", "value", "is", "None", ":", "raise", "vol", ".", "Invalid", "(", "\"string value is None\"", ")", "value", "=", "str", "(", "value", ")", ".", "strip", "(", "\"/\"", ")", "if", "not", "valu...
[ 33, 0 ]
[ 40, 22 ]
python
en
['en', 'zu', 'en']
True
setup
(hass, config)
Set up the Ombi component platform.
Set up the Ombi component platform.
def setup(hass, config): """Set up the Ombi component platform.""" ombi = pyombi.Ombi( ssl=config[DOMAIN][CONF_SSL], host=config[DOMAIN][CONF_HOST], port=config[DOMAIN][CONF_PORT], urlbase=config[DOMAIN][CONF_URLBASE], username=config[DOMAIN][CONF_USERNAME], pass...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "ombi", "=", "pyombi", ".", "Ombi", "(", "ssl", "=", "config", "[", "DOMAIN", "]", "[", "CONF_SSL", "]", ",", "host", "=", "config", "[", "DOMAIN", "]", "[", "CONF_HOST", "]", ",", "port", "="...
[ 75, 0 ]
[ 153, 15 ]
python
en
['en', 'da', 'en']
True
test_async_step_user_success
(hass: HomeAssistant)
Test user step success.
Test user step success.
async def test_async_step_user_success(hass: HomeAssistant) -> None: """Test user step success.""" with patch("pyvera.VeraController") as vera_controller_class_mock: controller = MagicMock() controller.refresh_data = MagicMock() controller.serial_number = "serial_number_0" vera_c...
[ "async", "def", "test_async_step_user_success", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "with", "patch", "(", "\"pyvera.VeraController\"", ")", "as", "vera_controller_class_mock", ":", "controller", "=", "MagicMock", "(", ")", "controller", ".", ...
[ 13, 0 ]
[ 47, 18 ]
python
da
['da', 'sd', 'en']
False
test_async_step_import_success
(hass: HomeAssistant)
Test import step success.
Test import step success.
async def test_async_step_import_success(hass: HomeAssistant) -> None: """Test import step success.""" with patch("pyvera.VeraController") as vera_controller_class_mock: controller = MagicMock() controller.refresh_data = MagicMock() controller.serial_number = "serial_number_1" ve...
[ "async", "def", "test_async_step_import_success", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "with", "patch", "(", "\"pyvera.VeraController\"", ")", "as", "vera_controller_class_mock", ":", "controller", "=", "MagicMock", "(", ")", "controller", ".",...
[ 50, 0 ]
[ 71, 69 ]
python
de
['de', 'sd', 'en']
False
test_async_step_import_success_with_legacy_unique_id
( hass: HomeAssistant, )
Test import step success with legacy unique id.
Test import step success with legacy unique id.
async def test_async_step_import_success_with_legacy_unique_id( hass: HomeAssistant, ) -> None: """Test import step success with legacy unique id.""" entity_registry = mock_registry(hass) entity_registry.async_get_or_create( domain="switch", platform=DOMAIN, unique_id="12" ) with patch(...
[ "async", "def", "test_async_step_import_success_with_legacy_unique_id", "(", "hass", ":", "HomeAssistant", ",", ")", "->", "None", ":", "entity_registry", "=", "mock_registry", "(", "hass", ")", "entity_registry", ".", "async_get_or_create", "(", "domain", "=", "\"swi...
[ 74, 0 ]
[ 102, 69 ]
python
en
['en', 'en', 'en']
True
test_async_step_finish_error
(hass: HomeAssistant)
Test finish step with error.
Test finish step with error.
async def test_async_step_finish_error(hass: HomeAssistant) -> None: """Test finish step with error.""" with patch("pyvera.VeraController") as vera_controller_class_mock: controller = MagicMock() controller.refresh_data = MagicMock(side_effect=RequestException()) vera_controller_class_mo...
[ "async", "def", "test_async_step_finish_error", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "with", "patch", "(", "\"pyvera.VeraController\"", ")", "as", "vera_controller_class_mock", ":", "controller", "=", "MagicMock", "(", ")", "controller", ".", ...
[ 105, 0 ]
[ 122, 9 ]
python
en
['en', 'en', 'en']
True
test_options
(hass)
Test updating options.
Test updating options.
async def test_options(hass): """Test updating options.""" base_url = "http://127.0.0.1/" entry = MockConfigEntry( domain=DOMAIN, title=base_url, data={CONF_CONTROLLER: "http://127.0.0.1/"}, options={CONF_LIGHTS: [1, 2, 3]}, ) entry.add_to_hass(hass) result = awa...
[ "async", "def", "test_options", "(", "hass", ")", ":", "base_url", "=", "\"http://127.0.0.1/\"", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "title", "=", "base_url", ",", "data", "=", "{", "CONF_CONTROLLER", ":", "\"http://127.0.0.1/\"",...
[ 125, 0 ]
[ 153, 5 ]
python
en
['en', 'en', 'en']
True
mock_collector
()
Fixture with import collector that adds all referenced nodes.
Fixture with import collector that adds all referenced nodes.
def mock_collector(): """Fixture with import collector that adds all referenced nodes.""" collector = ImportCollector(None) collector.unfiltered_referenced = set() collector._add_reference = collector.unfiltered_referenced.add return collector
[ "def", "mock_collector", "(", ")", ":", "collector", "=", "ImportCollector", "(", "None", ")", "collector", ".", "unfiltered_referenced", "=", "set", "(", ")", "collector", ".", "_add_reference", "=", "collector", ".", "unfiltered_referenced", ".", "add", "retur...
[ 9, 0 ]
[ 14, 20 ]
python
en
['en', 'en', 'en']
True
test_child_import
(mock_collector)
Test detecting a child_import reference.
Test detecting a child_import reference.
def test_child_import(mock_collector): """Test detecting a child_import reference.""" mock_collector.visit( ast.parse( """ from homeassistant.components import child_import """ ) ) assert mock_collector.unfiltered_referenced == {"child_import"}
[ "def", "test_child_import", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nfrom homeassistant.components import child_import\n\"\"\"", ")", ")", "assert", "mock_collector", ".", "unfiltered_referenced", "==", "{", ...
[ 17, 0 ]
[ 26, 67 ]
python
en
['en', 'en', 'en']
True
test_subimport
(mock_collector)
Test detecting a subimport reference.
Test detecting a subimport reference.
def test_subimport(mock_collector): """Test detecting a subimport reference.""" mock_collector.visit( ast.parse( """ from homeassistant.components.subimport.smart_home import EVENT_ALEXA_SMART_HOME """ ) ) assert mock_collector.unfiltered_referenced == {"subimport"}
[ "def", "test_subimport", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nfrom homeassistant.components.subimport.smart_home import EVENT_ALEXA_SMART_HOME\n\"\"\"", ")", ")", "assert", "mock_collector", ".", "unfiltered_...
[ 29, 0 ]
[ 38, 64 ]
python
en
['da', 'en', 'en']
True
test_child_import_field
(mock_collector)
Test detecting a child_import_field reference.
Test detecting a child_import_field reference.
def test_child_import_field(mock_collector): """Test detecting a child_import_field reference.""" mock_collector.visit( ast.parse( """ from homeassistant.components.child_import_field import bla """ ) ) assert mock_collector.unfiltered_referenced == {"child_import_field"}
[ "def", "test_child_import_field", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nfrom homeassistant.components.child_import_field import bla\n\"\"\"", ")", ")", "assert", "mock_collector", ".", "unfiltered_referenced",...
[ 41, 0 ]
[ 50, 73 ]
python
en
['en', 'en', 'en']
True
test_renamed_absolute
(mock_collector)
Test detecting a renamed_absolute reference.
Test detecting a renamed_absolute reference.
def test_renamed_absolute(mock_collector): """Test detecting a renamed_absolute reference.""" mock_collector.visit( ast.parse( """ import homeassistant.components.renamed_absolute as hue """ ) ) assert mock_collector.unfiltered_referenced == {"renamed_absolute"}
[ "def", "test_renamed_absolute", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nimport homeassistant.components.renamed_absolute as hue\n\"\"\"", ")", ")", "assert", "mock_collector", ".", "unfiltered_referenced", "==...
[ 53, 0 ]
[ 62, 71 ]
python
en
['en', 'en', 'en']
True
test_hass_components_var
(mock_collector)
Test detecting a hass_components_var reference.
Test detecting a hass_components_var reference.
def test_hass_components_var(mock_collector): """Test detecting a hass_components_var reference.""" mock_collector.visit( ast.parse( """ def bla(hass): hass.components.hass_components_var.async_do_something() """ ) ) assert mock_collector.unfiltered_referenced == {"hass_c...
[ "def", "test_hass_components_var", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\ndef bla(hass):\n hass.components.hass_components_var.async_do_something()\n\"\"\"", ")", ")", "assert", "mock_collector", ".", "unfil...
[ 65, 0 ]
[ 75, 74 ]
python
en
['en', 'en', 'en']
True
test_hass_components_class
(mock_collector)
Test detecting a hass_components_class reference.
Test detecting a hass_components_class reference.
def test_hass_components_class(mock_collector): """Test detecting a hass_components_class reference.""" mock_collector.visit( ast.parse( """ class Hello: def something(self): self.hass.components.hass_components_class.async_yo() """ ) ) assert mock_collector.unfil...
[ "def", "test_hass_components_class", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nclass Hello:\n def something(self):\n self.hass.components.hass_components_class.async_yo()\n\"\"\"", ")", ")", "assert", "mock_...
[ 78, 0 ]
[ 89, 76 ]
python
en
['en', 'en', 'en']
True
test_all_imports
(mock_collector)
Test all imports together.
Test all imports together.
def test_all_imports(mock_collector): """Test all imports together.""" mock_collector.visit( ast.parse( """ from homeassistant.components import child_import from homeassistant.components.subimport.smart_home import EVENT_ALEXA_SMART_HOME from homeassistant.components.child_import_field im...
[ "def", "test_all_imports", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nfrom homeassistant.components import child_import\n\nfrom homeassistant.components.subimport.smart_home import EVENT_ALEXA_SMART_HOME\n\nfrom homeassistant....
[ 92, 0 ]
[ 121, 5 ]
python
en
['en', 'en', 'en']
True
TFMPNetEmbeddings.create_position_ids_from_input_ids
(self, input_ids)
Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignored. This is modified from fairseq's `utils.make_positions`. Args: input_ids: tf.Tensor Returns: tf.Tensor
Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignored. This is modified from fairseq's `utils.make_positions`.
def create_position_ids_from_input_ids(self, input_ids): """ Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignored. This is modified from fairseq's `utils.make_positions`. Args: input_ids: tf.Tensor ...
[ "def", "create_position_ids_from_input_ids", "(", "self", ",", "input_ids", ")", ":", "mask", "=", "tf", ".", "cast", "(", "tf", ".", "math", ".", "not_equal", "(", "input_ids", ",", "self", ".", "padding_idx", ")", ",", "dtype", "=", "input_ids", ".", "...
[ 121, 4 ]
[ 133, 53 ]
python
en
['en', 'error', 'th']
False
TFMPNetEmbeddings.call
(self, input_ids=None, position_ids=None, inputs_embeds=None, training=False)
Applies embedding based on inputs tensor. Returns: final_embeddings (:obj:`tf.Tensor`): output embedding tensor.
Applies embedding based on inputs tensor.
def call(self, input_ids=None, position_ids=None, inputs_embeds=None, training=False): """ Applies embedding based on inputs tensor. Returns: final_embeddings (:obj:`tf.Tensor`): output embedding tensor. """ assert not (input_ids is None and inputs_embeds is None) ...
[ "def", "call", "(", "self", ",", "input_ids", "=", "None", ",", "position_ids", "=", "None", ",", "inputs_embeds", "=", "None", ",", "training", "=", "False", ")", ":", "assert", "not", "(", "input_ids", "is", "None", "and", "inputs_embeds", "is", "None"...
[ 135, 4 ]
[ 164, 31 ]
python
en
['en', 'error', 'th']
False
TFMPNetEncoder.compute_position_bias
(self, x, position_ids=None)
Compute binned relative position bias
Compute binned relative position bias
def compute_position_bias(self, x, position_ids=None): """ Compute binned relative position bias """ input_shape = shape_list(x) qlen, klen = input_shape[1], input_shape[1] if position_ids is not None: context_position = position_ids[:, :, None] memory_position =...
[ "def", "compute_position_bias", "(", "self", ",", "x", ",", "position_ids", "=", "None", ")", ":", "input_shape", "=", "shape_list", "(", "x", ")", "qlen", ",", "klen", "=", "input_shape", "[", "1", "]", ",", "input_shape", "[", "1", "]", "if", "positi...
[ 431, 4 ]
[ 451, 21 ]
python
en
['en', 'en', 'nl']
True
async_setup_platform
(hass, config)
Set up the Telegram broadcast platform.
Set up the Telegram broadcast platform.
async def async_setup_platform(hass, config): """Set up the Telegram broadcast platform.""" bot = initialize_bot(config) bot_config = await hass.async_add_executor_job(bot.getMe) _LOGGER.debug( "Telegram broadcast platform setup with bot %s", bot_config["username"] ) return True
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ")", ":", "bot", "=", "initialize_bot", "(", "config", ")", "bot_config", "=", "await", "hass", ".", "async_add_executor_job", "(", "bot", ".", "getMe", ")", "_LOGGER", ".", "debug", "(", ...
[ 8, 0 ]
[ 16, 15 ]
python
en
['en', 'da', 'en']
True
devices_from_config
(domain_config)
Parse configuration and add Rflink sensor devices.
Parse configuration and add Rflink sensor devices.
def devices_from_config(domain_config): """Parse configuration and add Rflink sensor devices.""" devices = [] for device_id, config in domain_config[CONF_DEVICES].items(): device = RflinkBinarySensor(device_id, **config) devices.append(device) return devices
[ "def", "devices_from_config", "(", "domain_config", ")", ":", "devices", "=", "[", "]", "for", "device_id", ",", "config", "in", "domain_config", "[", "CONF_DEVICES", "]", ".", "items", "(", ")", ":", "device", "=", "RflinkBinarySensor", "(", "device_id", ",...
[ 39, 0 ]
[ 46, 18 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Rflink platform.
Set up the Rflink platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Rflink platform.""" async_add_entities(devices_from_config(config))
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "async_add_entities", "(", "devices_from_config", "(", "config", ")", ")" ]
[ 49, 0 ]
[ 51, 51 ]
python
en
['en', 'da', 'en']
True
RflinkBinarySensor.__init__
( self, device_id, device_class=None, force_update=False, off_delay=None, **kwargs )
Handle sensor specific args and super init.
Handle sensor specific args and super init.
def __init__( self, device_id, device_class=None, force_update=False, off_delay=None, **kwargs ): """Handle sensor specific args and super init.""" self._state = None self._device_class = device_class self._force_update = force_update self._off_delay = off_delay ...
[ "def", "__init__", "(", "self", ",", "device_id", ",", "device_class", "=", "None", ",", "force_update", "=", "False", ",", "off_delay", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_state", "=", "None", "self", ".", "_device_class", "...
[ 57, 4 ]
[ 66, 45 ]
python
en
['en', 'en', 'en']
True
RflinkBinarySensor._handle_event
(self, event)
Domain specific event handler.
Domain specific event handler.
def _handle_event(self, event): """Domain specific event handler.""" command = event["command"] if command in ["on", "allon"]: self._state = True elif command in ["off", "alloff"]: self._state = False if self._state and self._off_delay is not None: ...
[ "def", "_handle_event", "(", "self", ",", "event", ")", ":", "command", "=", "event", "[", "\"command\"", "]", "if", "command", "in", "[", "\"on\"", ",", "\"allon\"", "]", ":", "self", ".", "_state", "=", "True", "elif", "command", "in", "[", "\"off\""...
[ 68, 4 ]
[ 88, 13 ]
python
en
['en', 'nl', 'en']
True
RflinkBinarySensor.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self): """Return true if the binary sensor is on.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 91, 4 ]
[ 93, 26 ]
python
en
['en', 'fy', 'en']
True
RflinkBinarySensor.device_class
(self)
Return the class of this sensor.
Return the class of this sensor.
def device_class(self): """Return the class of this sensor.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 96, 4 ]
[ 98, 33 ]
python
en
['en', 'en', 'en']
True
RflinkBinarySensor.force_update
(self)
Force update.
Force update.
def force_update(self): """Force update.""" return self._force_update
[ "def", "force_update", "(", "self", ")", ":", "return", "self", ".", "_force_update" ]
[ 101, 4 ]
[ 103, 33 ]
python
en
['en', 'en', 'en']
False
test_flow_discovered_bridges
(hass, aioclient_mock)
Test that config flow works for discovered bridges.
Test that config flow works for discovered bridges.
async def test_flow_discovered_bridges(hass, aioclient_mock): """Test that config flow works for discovered bridges.""" aioclient_mock.get( pydeconz.utils.URL_DISCOVER, json=[ {"id": BRIDGEID, "internalipaddress": "1.2.3.4", "internalport": 80}, {"id": "1234E567890A", "in...
[ "async", "def", "test_flow_discovered_bridges", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "pydeconz", ".", "utils", ".", "URL_DISCOVER", ",", "json", "=", "[", "{", "\"id\"", ":", "BRIDGEID", ",", "\"internalipaddress\"", ...
[ 38, 0 ]
[ 79, 5 ]
python
en
['en', 'en', 'en']
True
test_flow_manual_configuration_decision
(hass, aioclient_mock)
Test that config flow for one discovered bridge works.
Test that config flow for one discovered bridge works.
async def test_flow_manual_configuration_decision(hass, aioclient_mock): """Test that config flow for one discovered bridge works.""" aioclient_mock.get( pydeconz.utils.URL_DISCOVER, json=[{"id": BRIDGEID, "internalipaddress": "1.2.3.4", "internalport": 80}], headers={"content-type": CON...
[ "async", "def", "test_flow_manual_configuration_decision", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "pydeconz", ".", "utils", ".", "URL_DISCOVER", ",", "json", "=", "[", "{", "\"id\"", ":", "BRIDGEID", ",", "\"internalipad...
[ 82, 0 ]
[ 131, 5 ]
python
en
['en', 'en', 'en']
True
test_flow_manual_configuration
(hass, aioclient_mock)
Test that config flow works with manual configuration after no discovered bridges.
Test that config flow works with manual configuration after no discovered bridges.
async def test_flow_manual_configuration(hass, aioclient_mock): """Test that config flow works with manual configuration after no discovered bridges.""" aioclient_mock.get( pydeconz.utils.URL_DISCOVER, json=[], headers={"content-type": CONTENT_TYPE_JSON}, ) result = await hass.c...
[ "async", "def", "test_flow_manual_configuration", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "pydeconz", ".", "utils", ".", "URL_DISCOVER", ",", "json", "=", "[", "]", ",", "headers", "=", "{", "\"content-type\"", ":", "...
[ 134, 0 ]
[ 179, 5 ]
python
en
['en', 'en', 'en']
True
test_manual_configuration_after_discovery_timeout
(hass, aioclient_mock)
Test failed discovery fallbacks to manual configuration.
Test failed discovery fallbacks to manual configuration.
async def test_manual_configuration_after_discovery_timeout(hass, aioclient_mock): """Test failed discovery fallbacks to manual configuration.""" aioclient_mock.get(pydeconz.utils.URL_DISCOVER, exc=asyncio.TimeoutError) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": ...
[ "async", "def", "test_manual_configuration_after_discovery_timeout", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "pydeconz", ".", "utils", ".", "URL_DISCOVER", ",", "exc", "=", "asyncio", ".", "TimeoutError", ")", "result", "="...
[ 182, 0 ]
[ 192, 76 ]
python
en
['en', 'sm', 'en']
True
test_manual_configuration_after_discovery_ResponseError
(hass, aioclient_mock)
Test failed discovery fallbacks to manual configuration.
Test failed discovery fallbacks to manual configuration.
async def test_manual_configuration_after_discovery_ResponseError(hass, aioclient_mock): """Test failed discovery fallbacks to manual configuration.""" aioclient_mock.get(pydeconz.utils.URL_DISCOVER, exc=pydeconz.errors.ResponseError) result = await hass.config_entries.flow.async_init( DOMAIN, cont...
[ "async", "def", "test_manual_configuration_after_discovery_ResponseError", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "pydeconz", ".", "utils", ".", "URL_DISCOVER", ",", "exc", "=", "pydeconz", ".", "errors", ".", "ResponseError...
[ 195, 0 ]
[ 205, 76 ]
python
en
['en', 'sm', 'en']
True
test_manual_configuration_update_configuration
(hass, aioclient_mock)
Test that manual configuration can update existing config entry.
Test that manual configuration can update existing config entry.
async def test_manual_configuration_update_configuration(hass, aioclient_mock): """Test that manual configuration can update existing config entry.""" config_entry = await setup_deconz_integration(hass) aioclient_mock.get( pydeconz.utils.URL_DISCOVER, json=[], headers={"content-type...
[ "async", "def", "test_manual_configuration_update_configuration", "(", "hass", ",", "aioclient_mock", ")", ":", "config_entry", "=", "await", "setup_deconz_integration", "(", "hass", ")", "aioclient_mock", ".", "get", "(", "pydeconz", ".", "utils", ".", "URL_DISCOVER"...
[ 208, 0 ]
[ 251, 52 ]
python
en
['en', 'en', 'en']
True
test_manual_configuration_dont_update_configuration
(hass, aioclient_mock)
Test that _create_entry work and that bridgeid can be requested.
Test that _create_entry work and that bridgeid can be requested.
async def test_manual_configuration_dont_update_configuration(hass, aioclient_mock): """Test that _create_entry work and that bridgeid can be requested.""" await setup_deconz_integration(hass) aioclient_mock.get( pydeconz.utils.URL_DISCOVER, json=[], headers={"content-type": CONTENT...
[ "async", "def", "test_manual_configuration_dont_update_configuration", "(", "hass", ",", "aioclient_mock", ")", ":", "await", "setup_deconz_integration", "(", "hass", ")", "aioclient_mock", ".", "get", "(", "pydeconz", ".", "utils", ".", "URL_DISCOVER", ",", "json", ...
[ 254, 0 ]
[ 296, 51 ]
python
en
['en', 'en', 'en']
True
test_manual_configuration_timeout_get_bridge
(hass, aioclient_mock)
Test that _create_entry handles a timeout.
Test that _create_entry handles a timeout.
async def test_manual_configuration_timeout_get_bridge(hass, aioclient_mock): """Test that _create_entry handles a timeout.""" aioclient_mock.get( pydeconz.utils.URL_DISCOVER, json=[], headers={"content-type": CONTENT_TYPE_JSON}, ) result = await hass.config_entries.flow.async_i...
[ "async", "def", "test_manual_configuration_timeout_get_bridge", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "pydeconz", ".", "utils", ".", "URL_DISCOVER", ",", "json", "=", "[", "]", ",", "headers", "=", "{", "\"content-type\...
[ 299, 0 ]
[ 337, 43 ]
python
en
['en', 'en', 'en']
True
test_link_get_api_key_ResponseError
(hass, aioclient_mock)
Test config flow should abort if no API key was possible to retrieve.
Test config flow should abort if no API key was possible to retrieve.
async def test_link_get_api_key_ResponseError(hass, aioclient_mock): """Test config flow should abort if no API key was possible to retrieve.""" aioclient_mock.get( pydeconz.utils.URL_DISCOVER, json=[{"id": BRIDGEID, "internalipaddress": "1.2.3.4", "internalport": 80}], headers={"content...
[ "async", "def", "test_link_get_api_key_ResponseError", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "pydeconz", ".", "utils", ".", "URL_DISCOVER", ",", "json", "=", "[", "{", "\"id\"", ":", "BRIDGEID", ",", "\"internalipaddres...
[ 340, 0 ]
[ 367, 49 ]
python
en
['en', 'en', 'en']
True
test_flow_ssdp_discovery
(hass, aioclient_mock)
Test that config flow for one discovered bridge works.
Test that config flow for one discovered bridge works.
async def test_flow_ssdp_discovery(hass, aioclient_mock): """Test that config flow for one discovered bridge works.""" result = await hass.config_entries.flow.async_init( DOMAIN, data={ ATTR_SSDP_LOCATION: "http://1.2.3.4:80/", ATTR_UPNP_MANUFACTURER_URL: DECONZ_MANUFACTU...
[ "async", "def", "test_flow_ssdp_discovery", "(", "hass", ",", "aioclient_mock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "data", "=", "{", "ATTR_SSDP_LOCATION", ":", "\"http://1.2.3.4:80...
[ 370, 0 ]
[ 401, 5 ]
python
en
['en', 'en', 'en']
True
test_flow_ssdp_discovery_bad_bridge_id_aborts
(hass, aioclient_mock)
Test that config flow aborts if deCONZ signals no radio hardware available.
Test that config flow aborts if deCONZ signals no radio hardware available.
async def test_flow_ssdp_discovery_bad_bridge_id_aborts(hass, aioclient_mock): """Test that config flow aborts if deCONZ signals no radio hardware available.""" result = await hass.config_entries.flow.async_init( DOMAIN, data={ ATTR_SSDP_LOCATION: "http://1.2.3.4:80/", AT...
[ "async", "def", "test_flow_ssdp_discovery_bad_bridge_id_aborts", "(", "hass", ",", "aioclient_mock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "data", "=", "{", "ATTR_SSDP_LOCATION", ":", ...
[ 404, 0 ]
[ 430, 54 ]
python
en
['en', 'en', 'en']
True
test_ssdp_discovery_not_deconz_bridge
(hass)
Test a non deconz bridge being discovered over ssdp.
Test a non deconz bridge being discovered over ssdp.
async def test_ssdp_discovery_not_deconz_bridge(hass): """Test a non deconz bridge being discovered over ssdp.""" result = await hass.config_entries.flow.async_init( DOMAIN, data={ATTR_UPNP_MANUFACTURER_URL: "not deconz bridge"}, context={"source": SOURCE_SSDP}, ) assert result[...
[ "async", "def", "test_ssdp_discovery_not_deconz_bridge", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "data", "=", "{", "ATTR_UPNP_MANUFACTURER_URL", ":", "\"not deconz bridge\"", ...
[ 433, 0 ]
[ 442, 50 ]
python
en
['en', 'en', 'en']
True
test_ssdp_discovery_update_configuration
(hass)
Test if a discovered bridge is configured but updates with new attributes.
Test if a discovered bridge is configured but updates with new attributes.
async def test_ssdp_discovery_update_configuration(hass): """Test if a discovered bridge is configured but updates with new attributes.""" config_entry = await setup_deconz_integration(hass) with patch( "homeassistant.components.deconz.async_setup_entry", return_value=True, ) as mock_se...
[ "async", "def", "test_ssdp_discovery_update_configuration", "(", "hass", ")", ":", "config_entry", "=", "await", "setup_deconz_integration", "(", "hass", ")", "with", "patch", "(", "\"homeassistant.components.deconz.async_setup_entry\"", ",", "return_value", "=", "True", ...
[ 445, 0 ]
[ 467, 48 ]
python
en
['en', 'en', 'en']
True
test_ssdp_discovery_dont_update_configuration
(hass)
Test if a discovered bridge has already been configured.
Test if a discovered bridge has already been configured.
async def test_ssdp_discovery_dont_update_configuration(hass): """Test if a discovered bridge has already been configured.""" config_entry = await setup_deconz_integration(hass) result = await hass.config_entries.flow.async_init( DOMAIN, data={ ATTR_SSDP_LOCATION: "http://1.2.3....
[ "async", "def", "test_ssdp_discovery_dont_update_configuration", "(", "hass", ")", ":", "config_entry", "=", "await", "setup_deconz_integration", "(", "hass", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ...
[ 470, 0 ]
[ 486, 52 ]
python
en
['en', 'en', 'en']
True
test_ssdp_discovery_dont_update_existing_hassio_configuration
(hass)
Test to ensure the SSDP discovery does not update an Hass.io entry.
Test to ensure the SSDP discovery does not update an Hass.io entry.
async def test_ssdp_discovery_dont_update_existing_hassio_configuration(hass): """Test to ensure the SSDP discovery does not update an Hass.io entry.""" config_entry = await setup_deconz_integration(hass, source=SOURCE_HASSIO) result = await hass.config_entries.flow.async_init( DOMAIN, data...
[ "async", "def", "test_ssdp_discovery_dont_update_existing_hassio_configuration", "(", "hass", ")", ":", "config_entry", "=", "await", "setup_deconz_integration", "(", "hass", ",", "source", "=", "SOURCE_HASSIO", ")", "result", "=", "await", "hass", ".", "config_entries"...
[ 489, 0 ]
[ 505, 52 ]
python
en
['en', 'en', 'en']
True
test_flow_hassio_discovery
(hass)
Test hassio discovery flow works.
Test hassio discovery flow works.
async def test_flow_hassio_discovery(hass): """Test hassio discovery flow works.""" result = await hass.config_entries.flow.async_init( DOMAIN, data={ "addon": "Mock Addon", CONF_HOST: "mock-deconz", CONF_PORT: 80, CONF_SERIAL: BRIDGEID, ...
[ "async", "def", "test_flow_hassio_discovery", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "data", "=", "{", "\"addon\"", ":", "\"Mock Addon\"", ",", "CONF_HOST", ":", "\"mo...
[ 508, 0 ]
[ 543, 48 ]
python
en
['en', 'en', 'en']
True
test_hassio_discovery_update_configuration
(hass)
Test we can update an existing config entry.
Test we can update an existing config entry.
async def test_hassio_discovery_update_configuration(hass): """Test we can update an existing config entry.""" config_entry = await setup_deconz_integration(hass) with patch( "homeassistant.components.deconz.async_setup_entry", return_value=True, ) as mock_setup_entry: result = ...
[ "async", "def", "test_hassio_discovery_update_configuration", "(", "hass", ")", ":", "config_entry", "=", "await", "setup_deconz_integration", "(", "hass", ")", "with", "patch", "(", "\"homeassistant.components.deconz.async_setup_entry\"", ",", "return_value", "=", "True", ...
[ 546, 0 ]
[ 571, 48 ]
python
en
['en', 'en', 'en']
True
test_hassio_discovery_dont_update_configuration
(hass)
Test we can update an existing config entry.
Test we can update an existing config entry.
async def test_hassio_discovery_dont_update_configuration(hass): """Test we can update an existing config entry.""" await setup_deconz_integration(hass) result = await hass.config_entries.flow.async_init( DOMAIN, data={ CONF_HOST: "1.2.3.4", CONF_PORT: 80, ...
[ "async", "def", "test_hassio_discovery_dont_update_configuration", "(", "hass", ")", ":", "await", "setup_deconz_integration", "(", "hass", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "data", "=",...
[ 574, 0 ]
[ 590, 51 ]
python
en
['en', 'en', 'en']
True
test_option_flow
(hass)
Test config flow options.
Test config flow options.
async def test_option_flow(hass): """Test config flow options.""" config_entry = await setup_deconz_integration(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) assert result["type"] == RESULT_TYPE_FORM assert result["step_id"] == "deconz_devices" result = aw...
[ "async", "def", "test_option_flow", "(", "hass", ")", ":", "config_entry", "=", "await", "setup_deconz_integration", "(", "hass", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "options", ".", "async_init", "(", "config_entry", ".", "entry_id",...
[ 593, 0 ]
[ 617, 5 ]
python
en
['en', 'fr', 'en']
True
test_setup_no_devices
(hass, numato_fixture, monkeypatch)
Test handling of an 'empty' discovery. Platform setups are expected to return after handling errors locally without raising.
Test handling of an 'empty' discovery.
async def test_setup_no_devices(hass, numato_fixture, monkeypatch): """Test handling of an 'empty' discovery. Platform setups are expected to return after handling errors locally without raising. """ monkeypatch.setattr(numato_fixture, "discover", mockup_return) assert await async_setup_compone...
[ "async", "def", "test_setup_no_devices", "(", "hass", ",", "numato_fixture", ",", "monkeypatch", ")", ":", "monkeypatch", ".", "setattr", "(", "numato_fixture", ",", "\"discover\"", ",", "mockup_return", ")", "assert", "await", "async_setup_component", "(", "hass", ...
[ 10, 0 ]
[ 18, 43 ]
python
en
['en', 'en', 'en']
True
test_fail_setup_raising_discovery
(hass, numato_fixture, caplog, monkeypatch)
Test handling of an exception during discovery. Setup shall return False.
Test handling of an exception during discovery.
async def test_fail_setup_raising_discovery(hass, numato_fixture, caplog, monkeypatch): """Test handling of an exception during discovery. Setup shall return False. """ monkeypatch.setattr(numato_fixture, "discover", mockup_raise) assert not await async_setup_component(hass, "numato", NUMATO_CFG) ...
[ "async", "def", "test_fail_setup_raising_discovery", "(", "hass", ",", "numato_fixture", ",", "caplog", ",", "monkeypatch", ")", ":", "monkeypatch", ".", "setattr", "(", "numato_fixture", ",", "\"discover\"", ",", "mockup_raise", ")", "assert", "not", "await", "as...
[ 21, 0 ]
[ 28, 38 ]
python
en
['en', 'en', 'en']
True
test_hass_numato_api_wrong_port_directions
(hass, numato_fixture)
Test handling of wrong port directions. This won't happen in the current platform implementation but would raise in case of an introduced bug in the platforms.
Test handling of wrong port directions.
async def test_hass_numato_api_wrong_port_directions(hass, numato_fixture): """Test handling of wrong port directions. This won't happen in the current platform implementation but would raise in case of an introduced bug in the platforms. """ numato_fixture.discover() api = numato.NumatoAPI() ...
[ "async", "def", "test_hass_numato_api_wrong_port_directions", "(", "hass", ",", "numato_fixture", ")", ":", "numato_fixture", ".", "discover", "(", ")", "api", "=", "numato", ".", "NumatoAPI", "(", ")", "api", ".", "setup_output", "(", "0", ",", "5", ")", "a...
[ 31, 0 ]
[ 45, 33 ]
python
en
['en', 'en', 'en']
True
test_hass_numato_api_errors
(hass, numato_fixture, monkeypatch)
Test whether Home Assistant numato API (re-)raises errors.
Test whether Home Assistant numato API (re-)raises errors.
async def test_hass_numato_api_errors(hass, numato_fixture, monkeypatch): """Test whether Home Assistant numato API (re-)raises errors.""" numato_fixture.discover() monkeypatch.setattr(numato_fixture.devices[0], "setup", mockup_raise) monkeypatch.setattr(numato_fixture.devices[0], "adc_read", mockup_rai...
[ "async", "def", "test_hass_numato_api_errors", "(", "hass", ",", "numato_fixture", ",", "monkeypatch", ")", ":", "numato_fixture", ".", "discover", "(", ")", "monkeypatch", ".", "setattr", "(", "numato_fixture", ".", "devices", "[", "0", "]", ",", "\"setup\"", ...
[ 48, 0 ]
[ 60, 33 ]
python
en
['en', 'fr', 'pt']
False