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
test_options_bad_will_message_fails
(hass, mock_try_connection)
Test bad will message.
Test bad will message.
async def test_options_bad_will_message_fails(hass, mock_try_connection): """Test bad will message.""" config_entry = MockConfigEntry(domain=mqtt.DOMAIN) config_entry.add_to_hass(hass) config_entry.data = { mqtt.CONF_BROKER: "test-broker", mqtt.CONF_PORT: 1234, } mock_try_connec...
[ "async", "def", "test_options_bad_will_message_fails", "(", "hass", ",", "mock_try_connection", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "mqtt", ".", "DOMAIN", ")", "config_entry", ".", "add_to_hass", "(", "hass", ")", "config_entry", ...
[ 534, 0 ]
[ 567, 5 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Osram Lightify lights.
Set up the Osram Lightify lights.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Osram Lightify lights.""" host = config[CONF_HOST] try: bridge = Lightify(host, log_level=logging.NOTSET) except OSError as err: _LOGGER.exception("Error connecting to bridge: %s due to: %s", host, err) ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "host", "=", "config", "[", "CONF_HOST", "]", "try", ":", "bridge", "=", "Lightify", "(", "host", ",", "log_level", "=", "logging", "....
[ 70, 0 ]
[ 79, 46 ]
python
en
['en', 'ky', 'en']
True
setup_bridge
(bridge, add_entities, config)
Set up the Lightify bridge.
Set up the Lightify bridge.
def setup_bridge(bridge, add_entities, config): """Set up the Lightify bridge.""" lights = {} groups = {} groups_last_updated = [0] def update_lights(): """Update the lights objects with the latest info from the bridge.""" try: new_lights = bridge.update_all_light_status...
[ "def", "setup_bridge", "(", "bridge", ",", "add_entities", ",", "config", ")", ":", "lights", "=", "{", "}", "groups", "=", "{", "}", "groups_last_updated", "=", "[", "0", "]", "def", "update_lights", "(", ")", ":", "\"\"\"Update the lights objects with the la...
[ 82, 0 ]
[ 167, 23 ]
python
en
['en', 'zh', 'en']
True
Luminary.__init__
(self, luminary, update_func, changed)
Initialize a Luminary Light.
Initialize a Luminary Light.
def __init__(self, luminary, update_func, changed): """Initialize a Luminary Light.""" self.update_func = update_func self._luminary = luminary self._changed = changed self._unique_id = None self._supported_features = [] self._effect_list = [] self._is_on...
[ "def", "__init__", "(", "self", ",", "luminary", ",", "update_func", ",", "changed", ")", ":", "self", ".", "update_func", "=", "update_func", "self", ".", "_luminary", "=", "luminary", "self", ".", "_changed", "=", "changed", "self", ".", "_unique_id", "=...
[ 173, 4 ]
[ 192, 40 ]
python
en
['en', 'ny', 'it']
False
Luminary._get_unique_id
(self)
Get a unique ID (not implemented).
Get a unique ID (not implemented).
def _get_unique_id(self): """Get a unique ID (not implemented).""" raise NotImplementedError
[ "def", "_get_unique_id", "(", "self", ")", ":", "raise", "NotImplementedError" ]
[ 194, 4 ]
[ 196, 33 ]
python
en
['fr', 'en', 'en']
True
Luminary._get_supported_features
(self)
Get list of supported features.
Get list of supported features.
def _get_supported_features(self): """Get list of supported features.""" features = 0 if "lum" in self._luminary.supported_features(): features = features | SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION if "temp" in self._luminary.supported_features(): features = featu...
[ "def", "_get_supported_features", "(", "self", ")", ":", "features", "=", "0", "if", "\"lum\"", "in", "self", ".", "_luminary", ".", "supported_features", "(", ")", ":", "features", "=", "features", "|", "SUPPORT_BRIGHTNESS", "|", "SUPPORT_TRANSITION", "if", "...
[ 198, 4 ]
[ 210, 23 ]
python
en
['en', 'en', 'en']
True
Luminary._get_effect_list
(self)
Get list of supported effects.
Get list of supported effects.
def _get_effect_list(self): """Get list of supported effects.""" effects = [] if "rgb" in self._luminary.supported_features(): effects.append(EFFECT_RANDOM) return effects
[ "def", "_get_effect_list", "(", "self", ")", ":", "effects", "=", "[", "]", "if", "\"rgb\"", "in", "self", ".", "_luminary", ".", "supported_features", "(", ")", ":", "effects", ".", "append", "(", "EFFECT_RANDOM", ")", "return", "effects" ]
[ 212, 4 ]
[ 218, 22 ]
python
en
['en', 'en', 'en']
True
Luminary.name
(self)
Return the name of the luminary.
Return the name of the luminary.
def name(self): """Return the name of the luminary.""" return self._luminary.name()
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_luminary", ".", "name", "(", ")" ]
[ 221, 4 ]
[ 223, 36 ]
python
en
['en', 'mi', 'en']
True
Luminary.hs_color
(self)
Return last hs color value set.
Return last hs color value set.
def hs_color(self): """Return last hs color value set.""" return color_util.color_RGB_to_hs(*self._rgb_color)
[ "def", "hs_color", "(", "self", ")", ":", "return", "color_util", ".", "color_RGB_to_hs", "(", "*", "self", ".", "_rgb_color", ")" ]
[ 226, 4 ]
[ 228, 59 ]
python
en
['es', 'fr', 'en']
False
Luminary.color_temp
(self)
Return the color temperature.
Return the color temperature.
def color_temp(self): """Return the color temperature.""" return self._color_temp
[ "def", "color_temp", "(", "self", ")", ":", "return", "self", ".", "_color_temp" ]
[ 231, 4 ]
[ 233, 31 ]
python
en
['en', 'la', 'en']
True
Luminary.brightness
(self)
Return brightness of the luminary (0..255).
Return brightness of the luminary (0..255).
def brightness(self): """Return brightness of the luminary (0..255).""" return self._brightness
[ "def", "brightness", "(", "self", ")", ":", "return", "self", ".", "_brightness" ]
[ 236, 4 ]
[ 238, 31 ]
python
en
['en', 'sn', 'en']
True
Luminary.is_on
(self)
Return True if the device is on.
Return True if the device is on.
def is_on(self): """Return True if the device is on.""" return self._is_on
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_is_on" ]
[ 241, 4 ]
[ 243, 26 ]
python
en
['en', 'en', 'en']
True
Luminary.supported_features
(self)
List of supported features.
List of supported features.
def supported_features(self): """List of supported features.""" return self._supported_features
[ "def", "supported_features", "(", "self", ")", ":", "return", "self", ".", "_supported_features" ]
[ 246, 4 ]
[ 248, 39 ]
python
en
['en', 'en', 'en']
True
Luminary.effect_list
(self)
List of supported effects.
List of supported effects.
def effect_list(self): """List of supported effects.""" return self._effect_list
[ "def", "effect_list", "(", "self", ")", ":", "return", "self", ".", "_effect_list" ]
[ 251, 4 ]
[ 253, 32 ]
python
en
['en', 'en', 'en']
True
Luminary.min_mireds
(self)
Return the coldest color_temp that this light supports.
Return the coldest color_temp that this light supports.
def min_mireds(self): """Return the coldest color_temp that this light supports.""" return self._min_mireds
[ "def", "min_mireds", "(", "self", ")", ":", "return", "self", ".", "_min_mireds" ]
[ 256, 4 ]
[ 258, 31 ]
python
en
['en', 'en', 'en']
True
Luminary.max_mireds
(self)
Return the warmest color_temp that this light supports.
Return the warmest color_temp that this light supports.
def max_mireds(self): """Return the warmest color_temp that this light supports.""" return self._max_mireds
[ "def", "max_mireds", "(", "self", ")", ":", "return", "self", ".", "_max_mireds" ]
[ 261, 4 ]
[ 263, 31 ]
python
en
['en', 'en', 'en']
True
Luminary.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self): """Return a unique ID.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 266, 4 ]
[ 268, 30 ]
python
ca
['fr', 'ca', 'en']
False
Luminary.extra_state_attributes
(self)
Return device specific state attributes.
Return device specific state attributes.
def extra_state_attributes(self): """Return device specific state attributes.""" return self._device_attributes
[ "def", "extra_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_device_attributes" ]
[ 271, 4 ]
[ 273, 38 ]
python
en
['fr', 'en', 'en']
True
Luminary.available
(self)
Return True if entity is available.
Return True if entity is available.
def available(self): """Return True if entity is available.""" return self._available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_available" ]
[ 276, 4 ]
[ 278, 30 ]
python
en
['en', 'en', 'en']
True
Luminary.play_effect
(self, effect, transition)
Play selected effect.
Play selected effect.
def play_effect(self, effect, transition): """Play selected effect.""" if effect == EFFECT_RANDOM: self._rgb_color = ( random.randrange(0, 256), random.randrange(0, 256), random.randrange(0, 256), ) self._luminary.set_rg...
[ "def", "play_effect", "(", "self", ",", "effect", ",", "transition", ")", ":", "if", "effect", "==", "EFFECT_RANDOM", ":", "self", ".", "_rgb_color", "=", "(", "random", ".", "randrange", "(", "0", ",", "256", ")", ",", "random", ".", "randrange", "(",...
[ 280, 4 ]
[ 292, 20 ]
python
en
['en', 'en', 'en']
True
Luminary.turn_on
(self, **kwargs)
Turn the device on.
Turn the device on.
def turn_on(self, **kwargs): """Turn the device on.""" transition = int(kwargs.get(ATTR_TRANSITION, 0) * 10) if ATTR_EFFECT in kwargs: self.play_effect(kwargs[ATTR_EFFECT], transition) return if ATTR_HS_COLOR in kwargs: self._rgb_color = color_util.co...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "transition", "=", "int", "(", "kwargs", ".", "get", "(", "ATTR_TRANSITION", ",", "0", ")", "*", "10", ")", "if", "ATTR_EFFECT", "in", "kwargs", ":", "self", ".", "play_effect", "(", ...
[ 294, 4 ]
[ 317, 42 ]
python
en
['en', 'en', 'en']
True
Luminary.turn_off
(self, **kwargs)
Turn the device off.
Turn the device off.
def turn_off(self, **kwargs): """Turn the device off.""" self._is_on = False if ATTR_TRANSITION in kwargs: transition = int(kwargs[ATTR_TRANSITION] * 10) self._brightness = DEFAULT_BRIGHTNESS self._luminary.set_luminance(0, transition) else: ...
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_is_on", "=", "False", "if", "ATTR_TRANSITION", "in", "kwargs", ":", "transition", "=", "int", "(", "kwargs", "[", "ATTR_TRANSITION", "]", "*", "10", ")", "self", ".", "...
[ 319, 4 ]
[ 327, 43 ]
python
en
['en', 'en', 'en']
True
Luminary.update_luminary
(self, luminary)
Update internal luminary object.
Update internal luminary object.
def update_luminary(self, luminary): """Update internal luminary object.""" self._luminary = luminary self.update_static_attributes()
[ "def", "update_luminary", "(", "self", ",", "luminary", ")", ":", "self", ".", "_luminary", "=", "luminary", "self", ".", "update_static_attributes", "(", ")" ]
[ 329, 4 ]
[ 332, 39 ]
python
en
['en', 'ny', 'en']
True
Luminary.update_static_attributes
(self)
Update static attributes of the luminary.
Update static attributes of the luminary.
def update_static_attributes(self): """Update static attributes of the luminary.""" self._unique_id = self._get_unique_id() self._supported_features = self._get_supported_features() self._effect_list = self._get_effect_list() if self._supported_features & SUPPORT_COLOR_TEMP: ...
[ "def", "update_static_attributes", "(", "self", ")", ":", "self", ".", "_unique_id", "=", "self", ".", "_get_unique_id", "(", ")", "self", ".", "_supported_features", "=", "self", ".", "_get_supported_features", "(", ")", "self", ".", "_effect_list", "=", "sel...
[ 334, 4 ]
[ 345, 13 ]
python
en
['en', 'en', 'en']
True
Luminary.update_dynamic_attributes
(self)
Update dynamic attributes of the luminary.
Update dynamic attributes of the luminary.
def update_dynamic_attributes(self): """Update dynamic attributes of the luminary.""" self._is_on = self._luminary.on() self._available = self._luminary.reachable() and not self._luminary.deleted() if self._supported_features & SUPPORT_BRIGHTNESS: self._brightness = int(self....
[ "def", "update_dynamic_attributes", "(", "self", ")", ":", "self", ".", "_is_on", "=", "self", ".", "_luminary", ".", "on", "(", ")", "self", ".", "_available", "=", "self", ".", "_luminary", ".", "reachable", "(", ")", "and", "not", "self", ".", "_lum...
[ 347, 4 ]
[ 360, 50 ]
python
en
['en', 'en', 'en']
True
Luminary.update
(self)
Synchronize state with bridge.
Synchronize state with bridge.
def update(self): """Synchronize state with bridge.""" changed = self.update_func() if changed > self._changed: self._changed = changed self.update_dynamic_attributes()
[ "def", "update", "(", "self", ")", ":", "changed", "=", "self", ".", "update_func", "(", ")", "if", "changed", ">", "self", ".", "_changed", ":", "self", ".", "_changed", "=", "changed", "self", ".", "update_dynamic_attributes", "(", ")" ]
[ 362, 4 ]
[ 367, 44 ]
python
en
['en', 'en', 'en']
True
OsramLightifyLight._get_unique_id
(self)
Get a unique ID.
Get a unique ID.
def _get_unique_id(self): """Get a unique ID.""" return self._luminary.addr()
[ "def", "_get_unique_id", "(", "self", ")", ":", "return", "self", ".", "_luminary", ".", "addr", "(", ")" ]
[ 373, 4 ]
[ 375, 36 ]
python
en
['fr', 'es', 'en']
False
OsramLightifyLight.update_static_attributes
(self)
Update static attributes of the luminary.
Update static attributes of the luminary.
def update_static_attributes(self): """Update static attributes of the luminary.""" super().update_static_attributes() attrs = { "device_type": f"{self._luminary.type_id()} ({self._luminary.devicename()})", "firmware_version": self._luminary.version(), } i...
[ "def", "update_static_attributes", "(", "self", ")", ":", "super", "(", ")", ".", "update_static_attributes", "(", ")", "attrs", "=", "{", "\"device_type\"", ":", "f\"{self._luminary.type_id()} ({self._luminary.devicename()})\"", ",", "\"firmware_version\"", ":", "self", ...
[ 377, 4 ]
[ 387, 39 ]
python
en
['en', 'en', 'en']
True
OsramLightifyGroup._get_unique_id
(self)
Get a unique ID for the group.
Get a unique ID for the group.
def _get_unique_id(self): """Get a unique ID for the group.""" # Actually, it's a wrong choice for a unique ID, because a combination of # lights is NOT unique (Osram Lightify allows to create different groups # with the same lights). Also a combination of lights may ea...
[ "def", "_get_unique_id", "(", "self", ")", ":", "# Actually, it's a wrong choice for a unique ID, because a combination of", "# lights is NOT unique (Osram Lightify allows to create different groups", "# with the same lights). Also a combination of lights may easily change,", "# ...
[ 393, 4 ]
[ 402, 43 ]
python
en
['en', 'en', 'en']
True
OsramLightifyGroup._get_supported_features
(self)
Get list of supported features.
Get list of supported features.
def _get_supported_features(self): """Get list of supported features.""" features = super()._get_supported_features() if self._luminary.scenes(): features = features | SUPPORT_EFFECT return features
[ "def", "_get_supported_features", "(", "self", ")", ":", "features", "=", "super", "(", ")", ".", "_get_supported_features", "(", ")", "if", "self", ".", "_luminary", ".", "scenes", "(", ")", ":", "features", "=", "features", "|", "SUPPORT_EFFECT", "return",...
[ 404, 4 ]
[ 410, 23 ]
python
en
['en', 'en', 'en']
True
OsramLightifyGroup._get_effect_list
(self)
Get list of supported effects.
Get list of supported effects.
def _get_effect_list(self): """Get list of supported effects.""" effects = super()._get_effect_list() effects.extend(self._luminary.scenes()) return sorted(effects)
[ "def", "_get_effect_list", "(", "self", ")", ":", "effects", "=", "super", "(", ")", ".", "_get_effect_list", "(", ")", "effects", ".", "extend", "(", "self", ".", "_luminary", ".", "scenes", "(", ")", ")", "return", "sorted", "(", "effects", ")" ]
[ 412, 4 ]
[ 416, 30 ]
python
en
['en', 'en', 'en']
True
OsramLightifyGroup.play_effect
(self, effect, transition)
Play selected effect.
Play selected effect.
def play_effect(self, effect, transition): """Play selected effect.""" if super().play_effect(effect, transition): return True if effect in self._luminary.scenes(): self._luminary.activate_scene(effect) return True return False
[ "def", "play_effect", "(", "self", ",", "effect", ",", "transition", ")", ":", "if", "super", "(", ")", ".", "play_effect", "(", "effect", ",", "transition", ")", ":", "return", "True", "if", "effect", "in", "self", ".", "_luminary", ".", "scenes", "("...
[ 418, 4 ]
[ 427, 20 ]
python
en
['en', 'en', 'en']
True
OsramLightifyGroup.update_static_attributes
(self)
Update static attributes of the luminary.
Update static attributes of the luminary.
def update_static_attributes(self): """Update static attributes of the luminary.""" super().update_static_attributes() self._device_attributes = {"lights": self._luminary.light_names()}
[ "def", "update_static_attributes", "(", "self", ")", ":", "super", "(", ")", ".", "update_static_attributes", "(", ")", "self", ".", "_device_attributes", "=", "{", "\"lights\"", ":", "self", ".", "_luminary", ".", "light_names", "(", ")", "}" ]
[ 429, 4 ]
[ 432, 74 ]
python
en
['en', 'en', 'en']
True
test_fail_setup_without_state_topic
(hass, mqtt_mock)
Test for failing with no state topic.
Test for failing with no state topic.
async def test_fail_setup_without_state_topic(hass, mqtt_mock): """Test for failing with no state topic.""" with assert_setup_component(0) as config: assert await async_setup_component( hass, alarm_control_panel.DOMAIN, { alarm_control_panel.DOMAIN: { ...
[ "async", "def", "test_fail_setup_without_state_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "with", "assert_setup_component", "(", "0", ")", "as", "config", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alarm_control_panel", ".", "DOMAIN", ...
[ 86, 0 ]
[ 99, 53 ]
python
en
['en', 'en', 'en']
True
test_fail_setup_without_command_topic
(hass, mqtt_mock)
Test failing with no command topic.
Test failing with no command topic.
async def test_fail_setup_without_command_topic(hass, mqtt_mock): """Test failing with no command topic.""" with assert_setup_component(0): assert await async_setup_component( hass, alarm_control_panel.DOMAIN, { alarm_control_panel.DOMAIN: { ...
[ "async", "def", "test_fail_setup_without_command_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "with", "assert_setup_component", "(", "0", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alarm_control_panel", ".", "DOMAIN", ",", "{", "a...
[ 102, 0 ]
[ 114, 9 ]
python
en
['en', 'en', 'en']
True
test_update_state_via_state_topic
(hass, mqtt_mock)
Test updating with via state topic.
Test updating with via state topic.
async def test_update_state_via_state_topic(hass, mqtt_mock): """Test updating with via state topic.""" assert await async_setup_component( hass, alarm_control_panel.DOMAIN, DEFAULT_CONFIG, ) await hass.async_block_till_done() entity_id = "alarm_control_panel.test" asse...
[ "async", "def", "test_update_state_via_state_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ",", ")", "await", "hass", ".", "async_block_till...
[ 117, 0 ]
[ 143, 56 ]
python
en
['en', 'en', 'en']
True
test_ignore_update_state_if_unknown_via_state_topic
(hass, mqtt_mock)
Test ignoring updates via state topic.
Test ignoring updates via state topic.
async def test_ignore_update_state_if_unknown_via_state_topic(hass, mqtt_mock): """Test ignoring updates via state topic.""" assert await async_setup_component( hass, alarm_control_panel.DOMAIN, DEFAULT_CONFIG, ) await hass.async_block_till_done() entity_id = "alarm_control_...
[ "async", "def", "test_ignore_update_state_if_unknown_via_state_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ",", ")", "await", "hass", ".", ...
[ 146, 0 ]
[ 160, 60 ]
python
en
['fr', 'la', 'en']
False
test_publish_mqtt_no_code
(hass, mqtt_mock, service, payload)
Test publishing of MQTT messages when no code is configured.
Test publishing of MQTT messages when no code is configured.
async def test_publish_mqtt_no_code(hass, mqtt_mock, service, payload): """Test publishing of MQTT messages when no code is configured.""" assert await async_setup_component( hass, alarm_control_panel.DOMAIN, DEFAULT_CONFIG, ) await hass.async_block_till_done() await hass.se...
[ "async", "def", "test_publish_mqtt_no_code", "(", "hass", ",", "mqtt_mock", ",", "service", ",", "payload", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ",", ")", "await", "h...
[ 174, 0 ]
[ 190, 87 ]
python
en
['en', 'en', 'en']
True
test_publish_mqtt_with_code
(hass, mqtt_mock, service, payload)
Test publishing of MQTT messages when code is configured.
Test publishing of MQTT messages when code is configured.
async def test_publish_mqtt_with_code(hass, mqtt_mock, service, payload): """Test publishing of MQTT messages when code is configured.""" assert await async_setup_component( hass, alarm_control_panel.DOMAIN, DEFAULT_CONFIG_CODE, ) await hass.async_block_till_done() call_count...
[ "async", "def", "test_publish_mqtt_with_code", "(", "hass", ",", "mqtt_mock", ",", "service", ",", "payload", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG_CODE", ",", ")", "await...
[ 204, 0 ]
[ 239, 87 ]
python
en
['en', 'en', 'en']
True
test_publish_mqtt_with_code_required_false
( hass, mqtt_mock, service, payload, disable_code )
Test publishing of MQTT messages when code is configured. code_arm_required = False / code_disarm_required = false
Test publishing of MQTT messages when code is configured.
async def test_publish_mqtt_with_code_required_false( hass, mqtt_mock, service, payload, disable_code ): """Test publishing of MQTT messages when code is configured. code_arm_required = False / code_disarm_required = false """ config = copy.deepcopy(DEFAULT_CONFIG_CODE) config[alarm_control_pan...
[ "async", "def", "test_publish_mqtt_with_code_required_false", "(", "hass", ",", "mqtt_mock", ",", "service", ",", "payload", ",", "disable_code", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG_CODE", ")", "config", "[", "alarm_control_panel",...
[ 253, 0 ]
[ 297, 26 ]
python
en
['en', 'en', 'en']
True
test_disarm_publishes_mqtt_with_template
(hass, mqtt_mock)
Test publishing of MQTT messages while disarmed. When command_template set to output json
Test publishing of MQTT messages while disarmed.
async def test_disarm_publishes_mqtt_with_template(hass, mqtt_mock): """Test publishing of MQTT messages while disarmed. When command_template set to output json """ config = copy.deepcopy(DEFAULT_CONFIG_CODE) config[alarm_control_panel.DOMAIN]["code"] = "0123" config[alarm_control_panel.DOMAIN...
[ "async", "def", "test_disarm_publishes_mqtt_with_template", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG_CODE", ")", "config", "[", "alarm_control_panel", ".", "DOMAIN", "]", "[", "\"code\"", "]", "=", "\"...
[ 300, 0 ]
[ 320, 5 ]
python
en
['en', 'en', 'en']
True
test_update_state_via_state_topic_template
(hass, mqtt_mock)
Test updating with template_value via state topic.
Test updating with template_value via state topic.
async def test_update_state_via_state_topic_template(hass, mqtt_mock): """Test updating with template_value via state topic.""" assert await async_setup_component( hass, alarm_control_panel.DOMAIN, { alarm_control_panel.DOMAIN: { "platform": "mqtt", ...
[ "async", "def", "test_update_state_via_state_topic_template", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alarm_control_panel", ".", "DOMAIN", ",", "{", "alarm_control_panel", ".", "DOMAIN", ":", "{", "\"pl...
[ 323, 0 ]
[ 351, 48 ]
python
en
['en', 'en', 'en']
True
test_attributes_code_number
(hass, mqtt_mock)
Test attributes which are not supported by the vacuum.
Test attributes which are not supported by the vacuum.
async def test_attributes_code_number(hass, mqtt_mock): """Test attributes which are not supported by the vacuum.""" config = copy.deepcopy(DEFAULT_CONFIG) config[alarm_control_panel.DOMAIN]["code"] = CODE_NUMBER assert await async_setup_component(hass, alarm_control_panel.DOMAIN, config) await has...
[ "async", "def", "test_attributes_code_number", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "alarm_control_panel", ".", "DOMAIN", "]", "[", "\"code\"", "]", "=", "CODE_NUMBER", "ass...
[ 354, 0 ]
[ 366, 5 ]
python
en
['en', 'en', 'en']
True
test_attributes_code_text
(hass, mqtt_mock)
Test attributes which are not supported by the vacuum.
Test attributes which are not supported by the vacuum.
async def test_attributes_code_text(hass, mqtt_mock): """Test attributes which are not supported by the vacuum.""" config = copy.deepcopy(DEFAULT_CONFIG) config[alarm_control_panel.DOMAIN]["code"] = CODE_TEXT assert await async_setup_component(hass, alarm_control_panel.DOMAIN, config) await hass.as...
[ "async", "def", "test_attributes_code_text", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "alarm_control_panel", ".", "DOMAIN", "]", "[", "\"code\"", "]", "=", "CODE_TEXT", "assert"...
[ 369, 0 ]
[ 381, 5 ]
python
en
['en', 'en', 'en']
True
test_availability_when_connection_lost
(hass, mqtt_mock)
Test availability after MQTT disconnection.
Test availability after MQTT disconnection.
async def test_availability_when_connection_lost(hass, mqtt_mock): """Test availability after MQTT disconnection.""" await help_test_availability_when_connection_lost( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG_CODE )
[ "async", "def", "test_availability_when_connection_lost", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_availability_when_connection_lost", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG_CODE", ")" ]
[ 384, 0 ]
[ 388, 5 ]
python
en
['en', 'en', 'en']
True
test_availability_without_topic
(hass, mqtt_mock)
Test availability without defined availability topic.
Test availability without defined availability topic.
async def test_availability_without_topic(hass, mqtt_mock): """Test availability without defined availability topic.""" await help_test_availability_without_topic( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG_CODE )
[ "async", "def", "test_availability_without_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_availability_without_topic", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG_CODE", ")" ]
[ 391, 0 ]
[ 395, 5 ]
python
en
['en', 'en', 'en']
True
test_default_availability_payload
(hass, mqtt_mock)
Test availability by default payload with defined topic.
Test availability by default payload with defined topic.
async def test_default_availability_payload(hass, mqtt_mock): """Test availability by default payload with defined topic.""" await help_test_default_availability_payload( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG_CODE )
[ "async", "def", "test_default_availability_payload", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_default_availability_payload", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG_CODE", ")" ]
[ 398, 0 ]
[ 402, 5 ]
python
en
['en', 'en', 'en']
True
test_custom_availability_payload
(hass, mqtt_mock)
Test availability by custom payload with defined topic.
Test availability by custom payload with defined topic.
async def test_custom_availability_payload(hass, mqtt_mock): """Test availability by custom payload with defined topic.""" await help_test_custom_availability_payload( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG_CODE )
[ "async", "def", "test_custom_availability_payload", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_custom_availability_payload", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG_CODE", ")" ]
[ 405, 0 ]
[ 409, 5 ]
python
en
['en', 'en', 'en']
True
test_setting_attribute_via_mqtt_json_message
(hass, mqtt_mock)
Test the setting of attribute via MQTT with JSON payload.
Test the setting of attribute via MQTT with JSON payload.
async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock): """Test the setting of attribute via MQTT with JSON payload.""" await help_test_setting_attribute_via_mqtt_json_message( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_setting_attribute_via_mqtt_json_message", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_setting_attribute_via_mqtt_json_message", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 412, 0 ]
[ 416, 5 ]
python
en
['en', 'en', 'en']
True
test_setting_blocked_attribute_via_mqtt_json_message
(hass, mqtt_mock)
Test the setting of attribute via MQTT with JSON payload.
Test the setting of attribute via MQTT with JSON payload.
async def test_setting_blocked_attribute_via_mqtt_json_message(hass, mqtt_mock): """Test the setting of attribute via MQTT with JSON payload.""" await help_test_setting_blocked_attribute_via_mqtt_json_message( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG, M...
[ "async", "def", "test_setting_blocked_attribute_via_mqtt_json_message", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_setting_blocked_attribute_via_mqtt_json_message", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFI...
[ 419, 0 ]
[ 427, 5 ]
python
en
['en', 'en', 'en']
True
test_setting_attribute_with_template
(hass, mqtt_mock)
Test the setting of attribute via MQTT with JSON payload.
Test the setting of attribute via MQTT with JSON payload.
async def test_setting_attribute_with_template(hass, mqtt_mock): """Test the setting of attribute via MQTT with JSON payload.""" await help_test_setting_attribute_with_template( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_setting_attribute_with_template", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_setting_attribute_with_template", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 430, 0 ]
[ 434, 5 ]
python
en
['en', 'en', 'en']
True
test_update_with_json_attrs_not_dict
(hass, mqtt_mock, caplog)
Test attributes get extracted from a JSON result.
Test attributes get extracted from a JSON result.
async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog): """Test attributes get extracted from a JSON result.""" await help_test_update_with_json_attrs_not_dict( hass, mqtt_mock, caplog, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_update_with_json_attrs_not_dict", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_update_with_json_attrs_not_dict", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT...
[ 437, 0 ]
[ 441, 5 ]
python
en
['en', 'en', 'en']
True
test_update_with_json_attrs_bad_JSON
(hass, mqtt_mock, caplog)
Test attributes get extracted from a JSON result.
Test attributes get extracted from a JSON result.
async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog): """Test attributes get extracted from a JSON result.""" await help_test_update_with_json_attrs_bad_JSON( hass, mqtt_mock, caplog, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_update_with_json_attrs_bad_JSON", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_update_with_json_attrs_bad_JSON", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT...
[ 444, 0 ]
[ 448, 5 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_attr
(hass, mqtt_mock, caplog)
Test update of discovered MQTTAttributes.
Test update of discovered MQTTAttributes.
async def test_discovery_update_attr(hass, mqtt_mock, caplog): """Test update of discovered MQTTAttributes.""" await help_test_discovery_update_attr( hass, mqtt_mock, caplog, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_discovery_update_attr", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_discovery_update_attr", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 451, 0 ]
[ 455, 5 ]
python
en
['en', 'en', 'en']
True
test_unique_id
(hass, mqtt_mock)
Test unique id option only creates one alarm per unique_id.
Test unique id option only creates one alarm per unique_id.
async def test_unique_id(hass, mqtt_mock): """Test unique id option only creates one alarm per unique_id.""" config = { alarm_control_panel.DOMAIN: [ { "platform": "mqtt", "name": "Test 1", "state_topic": "test-topic", "command_...
[ "async", "def", "test_unique_id", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "{", "alarm_control_panel", ".", "DOMAIN", ":", "[", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"Test 1\"", ",", "\"state_topic\"", ":", "\"test-topic\...
[ 458, 0 ]
[ 478, 82 ]
python
en
['en', 'la', 'en']
True
test_discovery_removal_alarm
(hass, mqtt_mock, caplog)
Test removal of discovered alarm_control_panel.
Test removal of discovered alarm_control_panel.
async def test_discovery_removal_alarm(hass, mqtt_mock, caplog): """Test removal of discovered alarm_control_panel.""" data = json.dumps(DEFAULT_CONFIG[alarm_control_panel.DOMAIN]) await help_test_discovery_removal( hass, mqtt_mock, caplog, alarm_control_panel.DOMAIN, data )
[ "async", "def", "test_discovery_removal_alarm", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data", "=", "json", ".", "dumps", "(", "DEFAULT_CONFIG", "[", "alarm_control_panel", ".", "DOMAIN", "]", ")", "await", "help_test_discovery_removal", "(", "h...
[ 481, 0 ]
[ 486, 5 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_alarm_topic_and_template
(hass, mqtt_mock, caplog)
Test update of discovered alarm_control_panel.
Test update of discovered alarm_control_panel.
async def test_discovery_update_alarm_topic_and_template(hass, mqtt_mock, caplog): """Test update of discovered alarm_control_panel.""" config1 = copy.deepcopy(DEFAULT_CONFIG[alarm_control_panel.DOMAIN]) config2 = copy.deepcopy(DEFAULT_CONFIG[alarm_control_panel.DOMAIN]) config1["name"] = "Beer" con...
[ "async", "def", "test_discovery_update_alarm_topic_and_template", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "config1", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", "[", "alarm_control_panel", ".", "DOMAIN", "]", ")", "config2", "=", "copy", ...
[ 489, 0 ]
[ 521, 5 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_alarm_template
(hass, mqtt_mock, caplog)
Test update of discovered alarm_control_panel.
Test update of discovered alarm_control_panel.
async def test_discovery_update_alarm_template(hass, mqtt_mock, caplog): """Test update of discovered alarm_control_panel.""" config1 = copy.deepcopy(DEFAULT_CONFIG[alarm_control_panel.DOMAIN]) config2 = copy.deepcopy(DEFAULT_CONFIG[alarm_control_panel.DOMAIN]) config1["name"] = "Beer" config2["name...
[ "async", "def", "test_discovery_update_alarm_template", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "config1", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", "[", "alarm_control_panel", ".", "DOMAIN", "]", ")", "config2", "=", "copy", ".", "d...
[ 524, 0 ]
[ 554, 5 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_unchanged_alarm
(hass, mqtt_mock, caplog)
Test update of discovered alarm_control_panel.
Test update of discovered alarm_control_panel.
async def test_discovery_update_unchanged_alarm(hass, mqtt_mock, caplog): """Test update of discovered alarm_control_panel.""" config1 = copy.deepcopy(DEFAULT_CONFIG[alarm_control_panel.DOMAIN]) config1["name"] = "Beer" data1 = json.dumps(config1) with patch( "homeassistant.components.mqtt....
[ "async", "def", "test_discovery_update_unchanged_alarm", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "config1", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", "[", "alarm_control_panel", ".", "DOMAIN", "]", ")", "config1", "[", "\"name\"", "]",...
[ 557, 0 ]
[ 568, 9 ]
python
en
['en', 'en', 'en']
True
test_discovery_broken
(hass, mqtt_mock, caplog)
Test handling of bad discovery message.
Test handling of bad discovery message.
async def test_discovery_broken(hass, mqtt_mock, caplog): """Test handling of bad discovery message.""" data1 = '{ "name": "Beer" }' data2 = ( '{ "name": "Milk",' ' "state_topic": "test_topic",' ' "command_topic": "test_topic" }' ) await help_test_discovery_broken( ...
[ "async", "def", "test_discovery_broken", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data1", "=", "'{ \"name\": \"Beer\" }'", "data2", "=", "(", "'{ \"name\": \"Milk\",'", "' \"state_topic\": \"test_topic\",'", "' \"command_topic\": \"test_topic\" }'", ")", "...
[ 572, 0 ]
[ 582, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_device_info_with_connection
(hass, mqtt_mock)
Test MQTT alarm control panel device registry integration.
Test MQTT alarm control panel device registry integration.
async def test_entity_device_info_with_connection(hass, mqtt_mock): """Test MQTT alarm control panel device registry integration.""" await help_test_entity_device_info_with_connection( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_with_connection", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_with_connection", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 585, 0 ]
[ 589, 5 ]
python
en
['en', 'sv', 'en']
True
test_entity_device_info_with_identifier
(hass, mqtt_mock)
Test MQTT alarm control panel device registry integration.
Test MQTT alarm control panel device registry integration.
async def test_entity_device_info_with_identifier(hass, mqtt_mock): """Test MQTT alarm control panel device registry integration.""" await help_test_entity_device_info_with_identifier( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_with_identifier", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_with_identifier", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 592, 0 ]
[ 596, 5 ]
python
en
['en', 'sv', 'en']
True
test_entity_device_info_update
(hass, mqtt_mock)
Test device registry update.
Test device registry update.
async def test_entity_device_info_update(hass, mqtt_mock): """Test device registry update.""" await help_test_entity_device_info_update( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_update", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_update", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 599, 0 ]
[ 603, 5 ]
python
en
['fr', 'fy', 'en']
False
test_entity_device_info_remove
(hass, mqtt_mock)
Test device registry remove.
Test device registry remove.
async def test_entity_device_info_remove(hass, mqtt_mock): """Test device registry remove.""" await help_test_entity_device_info_remove( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_remove", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_remove", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 606, 0 ]
[ 610, 5 ]
python
en
['fr', 'en', 'en']
True
test_entity_id_update_subscriptions
(hass, mqtt_mock)
Test MQTT subscriptions are managed when entity_id is updated.
Test MQTT subscriptions are managed when entity_id is updated.
async def test_entity_id_update_subscriptions(hass, mqtt_mock): """Test MQTT subscriptions are managed when entity_id is updated.""" await help_test_entity_id_update_subscriptions( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_id_update_subscriptions", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_id_update_subscriptions", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 613, 0 ]
[ 617, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_id_update_discovery_update
(hass, mqtt_mock)
Test MQTT discovery update when entity_id is updated.
Test MQTT discovery update when entity_id is updated.
async def test_entity_id_update_discovery_update(hass, mqtt_mock): """Test MQTT discovery update when entity_id is updated.""" await help_test_entity_id_update_discovery_update( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_id_update_discovery_update", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_id_update_discovery_update", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 620, 0 ]
[ 624, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_debug_info_message
(hass, mqtt_mock)
Test MQTT debug info.
Test MQTT debug info.
async def test_entity_debug_info_message(hass, mqtt_mock): """Test MQTT debug info.""" await help_test_entity_debug_info_message( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_debug_info_message", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_debug_info_message", "(", "hass", ",", "mqtt_mock", ",", "alarm_control_panel", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 627, 0 ]
[ 631, 5 ]
python
es
['es', 'mt', 'it']
False
test_test_all
()
Test if we can test the all group.
Test if we can test the all group.
def test_test_all(): """Test if we can test the all group.""" for val in (None, {}, {"all": None}, {"all": {}}): assert util.test_all(val, "read") is False for val in (True, {"all": True}, {"all": {"read": True}}): assert util.test_all(val, "read") is True
[ "def", "test_test_all", "(", ")", ":", "for", "val", "in", "(", "None", ",", "{", "}", ",", "{", "\"all\"", ":", "None", "}", ",", "{", "\"all\"", ":", "{", "}", "}", ")", ":", "assert", "util", ".", "test_all", "(", "val", ",", "\"read\"", ")"...
[ 5, 0 ]
[ 11, 49 ]
python
en
['en', 'en', 'en']
True
convert_filter
(config: dict[str, list[str]])
Convert the filter schema into a filter.
Convert the filter schema into a filter.
def convert_filter(config: dict[str, list[str]]) -> Callable[[str], bool]: """Convert the filter schema into a filter.""" filt = generate_filter( config[CONF_INCLUDE_DOMAINS], config[CONF_INCLUDE_ENTITIES], config[CONF_EXCLUDE_DOMAINS], config[CONF_EXCLUDE_ENTITIES], conf...
[ "def", "convert_filter", "(", "config", ":", "dict", "[", "str", ",", "list", "[", "str", "]", "]", ")", "->", "Callable", "[", "[", "str", "]", ",", "bool", "]", ":", "filt", "=", "generate_filter", "(", "config", "[", "CONF_INCLUDE_DOMAINS", "]", "...
[ 23, 0 ]
[ 35, 15 ]
python
en
['en', 'lb', 'en']
True
convert_include_exclude_filter
( config: dict[str, dict[str, list[str]]] )
Convert the include exclude filter schema into a filter.
Convert the include exclude filter schema into a filter.
def convert_include_exclude_filter( config: dict[str, dict[str, list[str]]] ) -> Callable[[str], bool]: """Convert the include exclude filter schema into a filter.""" include = config[CONF_INCLUDE] exclude = config[CONF_EXCLUDE] filt = convert_filter( { CONF_INCLUDE_DOMAINS: incl...
[ "def", "convert_include_exclude_filter", "(", "config", ":", "dict", "[", "str", ",", "dict", "[", "str", ",", "list", "[", "str", "]", "]", "]", ")", "->", "Callable", "[", "[", "str", "]", ",", "bool", "]", ":", "include", "=", "config", "[", "CO...
[ 60, 0 ]
[ 77, 15 ]
python
en
['en', 'en', 'en']
True
_glob_to_re
(glob: str)
Translate and compile glob string into pattern.
Translate and compile glob string into pattern.
def _glob_to_re(glob: str) -> re.Pattern[str]: """Translate and compile glob string into pattern.""" return re.compile(fnmatch.translate(glob))
[ "def", "_glob_to_re", "(", "glob", ":", "str", ")", "->", "re", ".", "Pattern", "[", "str", "]", ":", "return", "re", ".", "compile", "(", "fnmatch", ".", "translate", "(", "glob", ")", ")" ]
[ 106, 0 ]
[ 108, 46 ]
python
en
['en', 'en', 'en']
True
_test_against_patterns
(patterns: list[re.Pattern[str]], entity_id: str)
Test entity against list of patterns, true if any match.
Test entity against list of patterns, true if any match.
def _test_against_patterns(patterns: list[re.Pattern[str]], entity_id: str) -> bool: """Test entity against list of patterns, true if any match.""" for pattern in patterns: if pattern.match(entity_id): return True return False
[ "def", "_test_against_patterns", "(", "patterns", ":", "list", "[", "re", ".", "Pattern", "[", "str", "]", "]", ",", "entity_id", ":", "str", ")", "->", "bool", ":", "for", "pattern", "in", "patterns", ":", "if", "pattern", ".", "match", "(", "entity_i...
[ 111, 0 ]
[ 117, 16 ]
python
en
['en', 'en', 'en']
True
generate_filter
( include_domains: list[str], include_entities: list[str], exclude_domains: list[str], exclude_entities: list[str], include_entity_globs: list[str] = [], exclude_entity_globs: list[str] = [], )
Return a function that will filter entities based on the args.
Return a function that will filter entities based on the args.
def generate_filter( include_domains: list[str], include_entities: list[str], exclude_domains: list[str], exclude_entities: list[str], include_entity_globs: list[str] = [], exclude_entity_globs: list[str] = [], ) -> Callable[[str], bool]: """Return a function that will filter entities based ...
[ "def", "generate_filter", "(", "include_domains", ":", "list", "[", "str", "]", ",", "include_entities", ":", "list", "[", "str", "]", ",", "exclude_domains", ":", "list", "[", "str", "]", ",", "exclude_entities", ":", "list", "[", "str", "]", ",", "incl...
[ 122, 0 ]
[ 230, 51 ]
python
en
['en', 'en', 'en']
True
test_form
(hass: HomeAssistant)
Test we get the form.
Test we get the form.
async def test_form(hass: HomeAssistant) -> None: """Test we get the form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == RESULT_TY...
[ "async", "def", "test_form", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ...
[ 11, 0 ]
[ 39, 5 ]
python
en
['en', 'en', 'en']
True
test_form_auth
(hass: HomeAssistant)
Test we handle auth.
Test we handle auth.
async def test_form_auth(hass: HomeAssistant) -> None: """Test we handle auth.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == RESU...
[ "async", "def", "test_form_auth", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entri...
[ 42, 0 ]
[ 104, 5 ]
python
en
['de', 'en', 'en']
True
test_form_cannot_connect
(hass: HomeAssistant)
Test we handle cannot connect error.
Test we handle cannot connect error.
async def test_form_cannot_connect(hass: HomeAssistant) -> None: """Test we handle cannot connect error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.iotawatt.config_flow.Iotawatt.co...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_...
[ 107, 0 ]
[ 123, 58 ]
python
en
['en', 'en', 'en']
True
test_form_setup_exception
(hass: HomeAssistant)
Test we handle broad exception.
Test we handle broad exception.
async def test_form_setup_exception(hass: HomeAssistant) -> None: """Test we handle broad exception.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.iotawatt.config_flow.Iotawatt.connec...
[ "async", "def", "test_form_setup_exception", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config...
[ 126, 0 ]
[ 142, 51 ]
python
en
['en', 'en', 'en']
True
async_init_integration
( hass, use_switch=False, use_scene=False )
Set up the LiteJet integration in Home Assistant.
Set up the LiteJet integration in Home Assistant.
async def async_init_integration( hass, use_switch=False, use_scene=False ) -> MockConfigEntry: """Set up the LiteJet integration in Home Assistant.""" registry = er.async_get(hass) entry_data = {CONF_PORT: "/dev/mock"} entry = MockConfigEntry( domain=DOMAIN, unique_id=entry_data[CONF_POR...
[ "async", "def", "async_init_integration", "(", "hass", ",", "use_switch", "=", "False", ",", "use_scene", "=", "False", ")", "->", "MockConfigEntry", ":", "registry", "=", "er", ".", "async_get", "(", "hass", ")", "entry_data", "=", "{", "CONF_PORT", ":", ...
[ 9, 0 ]
[ 51, 16 ]
python
en
['en', 'da', 'en']
True
ObjectWithValidations.additional_properties_type
()
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ return (bool, date, datetime, dict, float, int, list, str, none_type,)
[ "def", "additional_properties_type", "(", ")", ":", "return", "(", "bool", ",", "date", ",", "datetime", ",", "dict", ",", "float", ",", "int", ",", "list", ",", "str", ",", "none_type", ",", ")" ]
[ 63, 4 ]
[ 68, 78 ]
python
en
['en', 'error', 'th']
False
ObjectWithValidations.openapi_types
()
This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type.
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ retu...
[ "def", "openapi_types", "(", ")", ":", "return", "{", "}" ]
[ 73, 4 ]
[ 83, 9 ]
python
en
['en', 'error', 'th']
False
ObjectWithValidations.__init__
(self, *args, **kwargs)
ObjectWithValidations - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. ...
ObjectWithValidations - a model defined in OpenAPI
def __init__(self, *args, **kwargs): # noqa: E501 """ObjectWithValidations - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be ...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "_check_type", "=", "kwargs", ".", "pop", "(", "'_check_type'", ",", "True", ")", "_spec_property_naming", "=", "kwargs", ".", "pop", "(", "'_spec_property...
[ 105, 4 ]
[ 171, 46 ]
python
en
['en', 'en', 'en']
True
patch_blueprint
(blueprint_path: str, data_path)
Patch blueprint loading from a different source.
Patch blueprint loading from a different source.
def patch_blueprint(blueprint_path: str, data_path): """Patch blueprint loading from a different source.""" orig_load = models.DomainBlueprints._load_blueprint @callback def mock_load_blueprint(self, path): if path != blueprint_path: assert False, f"Unexpected blueprint {path}" ...
[ "def", "patch_blueprint", "(", "blueprint_path", ":", "str", ",", "data_path", ")", ":", "orig_load", "=", "models", ".", "DomainBlueprints", ".", "_load_blueprint", "@", "callback", "def", "mock_load_blueprint", "(", "self", ",", "path", ")", ":", "if", "path...
[ 19, 0 ]
[ 37, 13 ]
python
en
['en', 'en', 'en']
True
test_notify_leaving_zone
(hass)
Test notifying leaving a zone blueprint.
Test notifying leaving a zone blueprint.
async def test_notify_leaving_zone(hass): """Test notifying leaving a zone blueprint.""" def set_person_state(state, extra={}): hass.states.async_set( "person.test_person", state, {"friendly_name": "Paulus", **extra} ) set_person_state("School") assert await async_setup_co...
[ "async", "def", "test_notify_leaving_zone", "(", "hass", ")", ":", "def", "set_person_state", "(", "state", ",", "extra", "=", "{", "}", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"person.test_person\"", ",", "state", ",", "{", "\"friendly_nam...
[ 40, 0 ]
[ 125, 52 ]
python
en
['en', 'en', 'en']
True
test_motion_light
(hass)
Test motion light blueprint.
Test motion light blueprint.
async def test_motion_light(hass): """Test motion light blueprint.""" hass.states.async_set("binary_sensor.kitchen", "off") with patch_blueprint( "motion_light.yaml", BUILTIN_BLUEPRINT_FOLDER / "motion_light.yaml", ): assert await async_setup_component( hass, ...
[ "async", "def", "test_motion_light", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"binary_sensor.kitchen\"", ",", "\"off\"", ")", "with", "patch_blueprint", "(", "\"motion_light.yaml\"", ",", "BUILTIN_BLUEPRINT_FOLDER", "/", "\"motion_light.y...
[ 128, 0 ]
[ 213, 34 ]
python
en
['fr', 'no', 'en']
False
test_sensor
(hass, generic_data)
Test setting up config entry.
Test setting up config entry.
async def test_sensor(hass, generic_data): """Test setting up config entry.""" await setup_ozw(hass, fixture=generic_data) # Test standard sensor state = hass.states.get("sensor.smart_plug_electric_v") assert state is not None assert state.state == "123.9" assert state.attributes["unit_of_m...
[ "async", "def", "test_sensor", "(", "hass", ",", "generic_data", ")", ":", "await", "setup_ozw", "(", "hass", ",", "fixture", "=", "generic_data", ")", "# Test standard sensor", "state", "=", "hass", ".", "states", ".", "get", "(", "\"sensor.smart_plug_electric_...
[ 14, 0 ]
[ 52, 42 ]
python
en
['en', 'en', 'en']
True
test_sensor_enabled
(hass, generic_data, sensor_msg)
Test enabling an advanced sensor.
Test enabling an advanced sensor.
async def test_sensor_enabled(hass, generic_data, sensor_msg): """Test enabling an advanced sensor.""" registry = er.async_get(hass) entry = registry.async_get_or_create( SENSOR_DOMAIN, DOMAIN, "1-36-1407375493578772", suggested_object_id="water_sensor_6_instance_1_water", ...
[ "async", "def", "test_sensor_enabled", "(", "hass", ",", "generic_data", ",", "sensor_msg", ")", ":", "registry", "=", "er", ".", "async_get", "(", "hass", ")", "entry", "=", "registry", ".", "async_get_or_create", "(", "SENSOR_DOMAIN", ",", "DOMAIN", ",", "...
[ 55, 0 ]
[ 76, 47 ]
python
en
['en', 'ht', 'en']
True
test_string_sensor
(hass, string_sensor_data)
Test so the returned type is a string sensor.
Test so the returned type is a string sensor.
async def test_string_sensor(hass, string_sensor_data): """Test so the returned type is a string sensor.""" registry = er.async_get(hass) entry = registry.async_get_or_create( SENSOR_DOMAIN, DOMAIN, "1-49-73464969749610519", suggested_object_id="id_150_z_wave_module_user_co...
[ "async", "def", "test_string_sensor", "(", "hass", ",", "string_sensor_data", ")", ":", "registry", "=", "er", ".", "async_get", "(", "hass", ")", "entry", "=", "registry", ".", "async_get_or_create", "(", "SENSOR_DOMAIN", ",", "DOMAIN", ",", "\"1-49-73464969749...
[ 79, 0 ]
[ 97, 34 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback )
Set up ESPHome covers based on a config entry.
Set up ESPHome covers based on a config entry.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: """Set up ESPHome covers based on a config entry.""" await platform_async_setup_entry( hass, entry, async_add_entities, component_key="cover", info...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ")", "->", "None", ":", "await", "platform_async_setup_entry", "(", "hass", ",", "entry", ",", "async_a...
[ 26, 0 ]
[ 38, 5 ]
python
en
['en', 'en', 'en']
True
EsphomeCover.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self) -> int: """Flag supported features.""" flags = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP if self._static_info.supports_position: flags |= SUPPORT_SET_POSITION if self._static_info.supports_tilt: flags |= SUPPORT_OPEN_TILT | SUPPORT_C...
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "flags", "=", "SUPPORT_OPEN", "|", "SUPPORT_CLOSE", "|", "SUPPORT_STOP", "if", "self", ".", "_static_info", ".", "supports_position", ":", "flags", "|=", "SUPPORT_SET_POSITION", "if", "self", ".", ...
[ 49, 4 ]
[ 56, 20 ]
python
en
['da', 'en', 'en']
True
EsphomeCover.device_class
(self)
Return the class of this device, from component DEVICE_CLASSES.
Return the class of this device, from component DEVICE_CLASSES.
def device_class(self) -> str: """Return the class of this device, from component DEVICE_CLASSES.""" return self._static_info.device_class
[ "def", "device_class", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_static_info", ".", "device_class" ]
[ 59, 4 ]
[ 61, 45 ]
python
en
['en', 'en', 'en']
True
EsphomeCover.assumed_state
(self)
Return true if we do optimistic updates.
Return true if we do optimistic updates.
def assumed_state(self) -> bool: """Return true if we do optimistic updates.""" return self._static_info.assumed_state
[ "def", "assumed_state", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_static_info", ".", "assumed_state" ]
[ 64, 4 ]
[ 66, 46 ]
python
en
['pt', 'la', 'en']
False
EsphomeCover.is_closed
(self)
Return if the cover is closed or not.
Return if the cover is closed or not.
def is_closed(self) -> bool | None: """Return if the cover is closed or not.""" # Check closed state with api version due to a protocol change return self._state.is_closed(self._api_version)
[ "def", "is_closed", "(", "self", ")", "->", "bool", "|", "None", ":", "# Check closed state with api version due to a protocol change", "return", "self", ".", "_state", ".", "is_closed", "(", "self", ".", "_api_version", ")" ]
[ 69, 4 ]
[ 72, 55 ]
python
en
['en', 'en', 'en']
True
EsphomeCover.is_opening
(self)
Return if the cover is opening or not.
Return if the cover is opening or not.
def is_opening(self) -> bool: """Return if the cover is opening or not.""" return self._state.current_operation == CoverOperation.IS_OPENING
[ "def", "is_opening", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_state", ".", "current_operation", "==", "CoverOperation", ".", "IS_OPENING" ]
[ 75, 4 ]
[ 77, 73 ]
python
en
['en', 'en', 'en']
True
EsphomeCover.is_closing
(self)
Return if the cover is closing or not.
Return if the cover is closing or not.
def is_closing(self) -> bool: """Return if the cover is closing or not.""" return self._state.current_operation == CoverOperation.IS_CLOSING
[ "def", "is_closing", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_state", ".", "current_operation", "==", "CoverOperation", ".", "IS_CLOSING" ]
[ 80, 4 ]
[ 82, 73 ]
python
en
['en', 'en', 'en']
True
EsphomeCover.current_cover_position
(self)
Return current position of cover. 0 is closed, 100 is open.
Return current position of cover. 0 is closed, 100 is open.
def current_cover_position(self) -> int | None: """Return current position of cover. 0 is closed, 100 is open.""" if not self._static_info.supports_position: return None return round(self._state.position * 100.0)
[ "def", "current_cover_position", "(", "self", ")", "->", "int", "|", "None", ":", "if", "not", "self", ".", "_static_info", ".", "supports_position", ":", "return", "None", "return", "round", "(", "self", ".", "_state", ".", "position", "*", "100.0", ")" ]
[ 85, 4 ]
[ 89, 50 ]
python
en
['en', 'en', 'en']
True
EsphomeCover.current_cover_tilt_position
(self)
Return current position of cover tilt. 0 is closed, 100 is open.
Return current position of cover tilt. 0 is closed, 100 is open.
def current_cover_tilt_position(self) -> int | None: """Return current position of cover tilt. 0 is closed, 100 is open.""" if not self._static_info.supports_tilt: return None return round(self._state.tilt * 100.0)
[ "def", "current_cover_tilt_position", "(", "self", ")", "->", "int", "|", "None", ":", "if", "not", "self", ".", "_static_info", ".", "supports_tilt", ":", "return", "None", "return", "round", "(", "self", ".", "_state", ".", "tilt", "*", "100.0", ")" ]
[ 92, 4 ]
[ 96, 46 ]
python
en
['en', 'en', 'en']
True
EsphomeCover.async_open_cover
(self, **kwargs: Any)
Open the cover.
Open the cover.
async def async_open_cover(self, **kwargs: Any) -> None: """Open the cover.""" await self._client.cover_command(key=self._static_info.key, position=1.0)
[ "async", "def", "async_open_cover", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "await", "self", ".", "_client", ".", "cover_command", "(", "key", "=", "self", ".", "_static_info", ".", "key", ",", "position", "=", "1.0", ...
[ 98, 4 ]
[ 100, 81 ]
python
en
['en', 'en', 'en']
True
EsphomeCover.async_close_cover
(self, **kwargs: Any)
Close cover.
Close cover.
async def async_close_cover(self, **kwargs: Any) -> None: """Close cover.""" await self._client.cover_command(key=self._static_info.key, position=0.0)
[ "async", "def", "async_close_cover", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "await", "self", ".", "_client", ".", "cover_command", "(", "key", "=", "self", ".", "_static_info", ".", "key", ",", "position", "=", "0.0",...
[ 102, 4 ]
[ 104, 81 ]
python
en
['en', 'la', 'en']
False
EsphomeCover.async_stop_cover
(self, **kwargs: Any)
Stop the cover.
Stop the cover.
async def async_stop_cover(self, **kwargs: Any) -> None: """Stop the cover.""" await self._client.cover_command(key=self._static_info.key, stop=True)
[ "async", "def", "async_stop_cover", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "await", "self", ".", "_client", ".", "cover_command", "(", "key", "=", "self", ".", "_static_info", ".", "key", ",", "stop", "=", "True", "...
[ 106, 4 ]
[ 108, 78 ]
python
en
['en', 'en', 'en']
True
EsphomeCover.async_set_cover_position
(self, **kwargs: int)
Move the cover to a specific position.
Move the cover to a specific position.
async def async_set_cover_position(self, **kwargs: int) -> None: """Move the cover to a specific position.""" await self._client.cover_command( key=self._static_info.key, position=kwargs[ATTR_POSITION] / 100 )
[ "async", "def", "async_set_cover_position", "(", "self", ",", "*", "*", "kwargs", ":", "int", ")", "->", "None", ":", "await", "self", ".", "_client", ".", "cover_command", "(", "key", "=", "self", ".", "_static_info", ".", "key", ",", "position", "=", ...
[ 110, 4 ]
[ 114, 9 ]
python
en
['en', 'en', 'en']
True