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
TestMediaPlayer.test_config_children_only
(self)
Check config with only children.
Check config with only children.
def test_config_children_only(self): """Check config with only children.""" config_start = copy(self.config_children_only) del config_start["platform"] config_start["commands"] = {} config_start["attributes"] = {} config = validate_config(self.config_children_only) ...
[ "def", "test_config_children_only", "(", "self", ")", ":", "config_start", "=", "copy", "(", "self", ".", "config_children_only", ")", "del", "config_start", "[", "\"platform\"", "]", "config_start", "[", "\"commands\"", "]", "=", "{", "}", "config_start", "[", ...
[ 240, 4 ]
[ 248, 37 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_config_children_and_attr
(self)
Check config with children and attributes.
Check config with children and attributes.
def test_config_children_and_attr(self): """Check config with children and attributes.""" config_start = copy(self.config_children_and_attr) del config_start["platform"] config_start["commands"] = {} config = validate_config(self.config_children_and_attr) assert config_s...
[ "def", "test_config_children_and_attr", "(", "self", ")", ":", "config_start", "=", "copy", "(", "self", ".", "config_children_and_attr", ")", "del", "config_start", "[", "\"platform\"", "]", "config_start", "[", "\"commands\"", "]", "=", "{", "}", "config", "="...
[ 250, 4 ]
[ 257, 37 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_config_no_name
(self)
Check config with no Name entry.
Check config with no Name entry.
def test_config_no_name(self): """Check config with no Name entry.""" response = True try: validate_config({"platform": "universal"}) except MultipleInvalid: response = False assert not response
[ "def", "test_config_no_name", "(", "self", ")", ":", "response", "=", "True", "try", ":", "validate_config", "(", "{", "\"platform\"", ":", "\"universal\"", "}", ")", "except", "MultipleInvalid", ":", "response", "=", "False", "assert", "not", "response" ]
[ 259, 4 ]
[ 266, 27 ]
python
en
['en', 'gl', 'en']
True
TestMediaPlayer.test_config_bad_children
(self)
Check config with bad children entry.
Check config with bad children entry.
def test_config_bad_children(self): """Check config with bad children entry.""" config_no_children = {"name": "test", "platform": "universal"} config_bad_children = {"name": "test", "children": {}, "platform": "universal"} config_no_children = validate_config(config_no_children) ...
[ "def", "test_config_bad_children", "(", "self", ")", ":", "config_no_children", "=", "{", "\"name\"", ":", "\"test\"", ",", "\"platform\"", ":", "\"universal\"", "}", "config_bad_children", "=", "{", "\"name\"", ":", "\"test\"", ",", "\"children\"", ":", "{", "}...
[ 268, 4 ]
[ 277, 52 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_config_bad_commands
(self)
Check config with bad commands entry.
Check config with bad commands entry.
def test_config_bad_commands(self): """Check config with bad commands entry.""" config = {"name": "test", "platform": "universal"} config = validate_config(config) assert {} == config["commands"]
[ "def", "test_config_bad_commands", "(", "self", ")", ":", "config", "=", "{", "\"name\"", ":", "\"test\"", ",", "\"platform\"", ":", "\"universal\"", "}", "config", "=", "validate_config", "(", "config", ")", "assert", "{", "}", "==", "config", "[", "\"comma...
[ 279, 4 ]
[ 284, 39 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_config_bad_attributes
(self)
Check config with bad attributes.
Check config with bad attributes.
def test_config_bad_attributes(self): """Check config with bad attributes.""" config = {"name": "test", "platform": "universal"} config = validate_config(config) assert {} == config["attributes"]
[ "def", "test_config_bad_attributes", "(", "self", ")", ":", "config", "=", "{", "\"name\"", ":", "\"test\"", ",", "\"platform\"", ":", "\"universal\"", "}", "config", "=", "validate_config", "(", "config", ")", "assert", "{", "}", "==", "config", "[", "\"att...
[ 286, 4 ]
[ 291, 41 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_config_bad_key
(self)
Check config with bad key.
Check config with bad key.
def test_config_bad_key(self): """Check config with bad key.""" config = {"name": "test", "asdf": 5, "platform": "universal"} config = validate_config(config) assert not ("asdf" in config)
[ "def", "test_config_bad_key", "(", "self", ")", ":", "config", "=", "{", "\"name\"", ":", "\"test\"", ",", "\"asdf\"", ":", "5", ",", "\"platform\"", ":", "\"universal\"", "}", "config", "=", "validate_config", "(", "config", ")", "assert", "not", "(", "\"...
[ 293, 4 ]
[ 298, 37 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_platform_setup
(self)
Test platform setup.
Test platform setup.
def test_platform_setup(self): """Test platform setup.""" config = {"name": "test", "platform": "universal"} bad_config = {"platform": "universal"} entities = [] def add_entities(new_entities): """Add devices to list.""" for dev in new_entities: ...
[ "def", "test_platform_setup", "(", "self", ")", ":", "config", "=", "{", "\"name\"", ":", "\"test\"", ",", "\"platform\"", ":", "\"universal\"", "}", "bad_config", "=", "{", "\"platform\"", ":", "\"universal\"", "}", "entities", "=", "[", "]", "def", "add_en...
[ 300, 4 ]
[ 331, 41 ]
python
en
['en', 'da', 'en']
True
TestMediaPlayer.test_master_state
(self)
Test master state property.
Test master state property.
def test_master_state(self): """Test master state property.""" config = validate_config(self.config_children_only) ump = universal.UniversalMediaPlayer(self.hass, **config) assert ump.master_state is None
[ "def", "test_master_state", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_only", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", "assert", "ump",...
[ 333, 4 ]
[ 339, 39 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_master_state_with_attrs
(self)
Test master state property.
Test master state property.
def test_master_state_with_attrs(self): """Test master state property.""" config = validate_config(self.config_children_and_attr) ump = universal.UniversalMediaPlayer(self.hass, **config) assert STATE_OFF == ump.master_state self.hass.states.set(self.mock_state_switch_id, STATE...
[ "def", "test_master_state_with_attrs", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_and_attr", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", "as...
[ 341, 4 ]
[ 349, 43 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_master_state_with_bad_attrs
(self)
Test master state property.
Test master state property.
def test_master_state_with_bad_attrs(self): """Test master state property.""" config = copy(self.config_children_and_attr) config["attributes"]["state"] = "bad.entity_id" config = validate_config(config) ump = universal.UniversalMediaPlayer(self.hass, **config) assert S...
[ "def", "test_master_state_with_bad_attrs", "(", "self", ")", ":", "config", "=", "copy", "(", "self", ".", "config_children_and_attr", ")", "config", "[", "\"attributes\"", "]", "[", "\"state\"", "]", "=", "\"bad.entity_id\"", "config", "=", "validate_config", "("...
[ 351, 4 ]
[ 359, 44 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_active_child_state
(self)
Test active child state property.
Test active child state property.
def test_active_child_state(self): """Test active child state property.""" config = validate_config(self.config_children_only) ump = universal.UniversalMediaPlayer(self.hass, **config) ump.entity_id = media_player.ENTITY_ID_FORMAT.format(config["name"]) asyncio.run_coroutine_thr...
[ "def", "test_active_child_state", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_only", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", "ump", "."...
[ 361, 4 ]
[ 387, 69 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_name
(self)
Test name property.
Test name property.
def test_name(self): """Test name property.""" config = validate_config(self.config_children_only) ump = universal.UniversalMediaPlayer(self.hass, **config) assert config["name"] == ump.name
[ "def", "test_name", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_only", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", "assert", "config", "[...
[ 389, 4 ]
[ 395, 41 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_polling
(self)
Test should_poll property.
Test should_poll property.
def test_polling(self): """Test should_poll property.""" config = validate_config(self.config_children_only) ump = universal.UniversalMediaPlayer(self.hass, **config) assert ump.should_poll is False
[ "def", "test_polling", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_only", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", "assert", "ump", "....
[ 397, 4 ]
[ 403, 39 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_state_children_only
(self)
Test media player state with only children.
Test media player state with only children.
def test_state_children_only(self): """Test media player state with only children.""" config = validate_config(self.config_children_only) ump = universal.UniversalMediaPlayer(self.hass, **config) ump.entity_id = media_player.ENTITY_ID_FORMAT.format(config["name"]) asyncio.run_co...
[ "def", "test_state_children_only", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_only", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", "ump", "....
[ 405, 4 ]
[ 419, 41 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_state_with_children_and_attrs
(self)
Test media player with children and master state.
Test media player with children and master state.
def test_state_with_children_and_attrs(self): """Test media player with children and master state.""" config = validate_config(self.config_children_and_attr) ump = universal.UniversalMediaPlayer(self.hass, **config) ump.entity_id = media_player.ENTITY_ID_FORMAT.format(config["name"]) ...
[ "def", "test_state_with_children_and_attrs", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_and_attr", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")",...
[ 421, 4 ]
[ 443, 37 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_volume_level
(self)
Test volume level property.
Test volume level property.
def test_volume_level(self): """Test volume level property.""" config = validate_config(self.config_children_only) ump = universal.UniversalMediaPlayer(self.hass, **config) ump.entity_id = media_player.ENTITY_ID_FORMAT.format(config["name"]) asyncio.run_coroutine_threadsafe(ump....
[ "def", "test_volume_level", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_only", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", "ump", ".", "e...
[ 445, 4 ]
[ 465, 36 ]
python
en
['fr', 'ru-Latn', 'en']
False
TestMediaPlayer.test_media_image_url
(self)
Test media_image_url property.
Test media_image_url property.
def test_media_image_url(self): """Test media_image_url property.""" test_url = "test_url" config = validate_config(self.config_children_only) ump = universal.UniversalMediaPlayer(self.hass, **config) ump.entity_id = media_player.ENTITY_ID_FORMAT.format(config["name"]) a...
[ "def", "test_media_image_url", "(", "self", ")", ":", "test_url", "=", "\"test_url\"", "config", "=", "validate_config", "(", "self", ".", "config_children_only", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*...
[ 467, 4 ]
[ 485, 66 ]
python
en
['en', 'da', 'en']
True
TestMediaPlayer.test_is_volume_muted_children_only
(self)
Test is volume muted property w/ children only.
Test is volume muted property w/ children only.
def test_is_volume_muted_children_only(self): """Test is volume muted property w/ children only.""" config = validate_config(self.config_children_only) ump = universal.UniversalMediaPlayer(self.hass, **config) ump.entity_id = media_player.ENTITY_ID_FORMAT.format(config["name"]) ...
[ "def", "test_is_volume_muted_children_only", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_only", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", "...
[ 487, 4 ]
[ 507, 34 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_source_list_children_and_attr
(self)
Test source list property w/ children and attrs.
Test source list property w/ children and attrs.
def test_source_list_children_and_attr(self): """Test source list property w/ children and attrs.""" config = validate_config(self.config_children_and_attr) ump = universal.UniversalMediaPlayer(self.hass, **config) assert "['dvd', 'htpc']" == ump.source_list self.hass.states.s...
[ "def", "test_source_list_children_and_attr", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_and_attr", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")",...
[ 509, 4 ]
[ 518, 59 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_source_children_and_attr
(self)
Test source property w/ children and attrs.
Test source property w/ children and attrs.
def test_source_children_and_attr(self): """Test source property w/ children and attrs.""" config = validate_config(self.config_children_and_attr) ump = universal.UniversalMediaPlayer(self.hass, **config) assert "dvd" == ump.source self.hass.states.set(self.mock_source_id, "ht...
[ "def", "test_source_children_and_attr", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_and_attr", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", "a...
[ 520, 4 ]
[ 529, 35 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_volume_level_children_and_attr
(self)
Test volume level property w/ children and attrs.
Test volume level property w/ children and attrs.
def test_volume_level_children_and_attr(self): """Test volume level property w/ children and attrs.""" config = validate_config(self.config_children_and_attr) ump = universal.UniversalMediaPlayer(self.hass, **config) assert 0 == ump.volume_level self.hass.states.set(self.mock_...
[ "def", "test_volume_level_children_and_attr", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_and_attr", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")"...
[ 531, 4 ]
[ 540, 38 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_is_volume_muted_children_and_attr
(self)
Test is volume muted property w/ children and attrs.
Test is volume muted property w/ children and attrs.
def test_is_volume_muted_children_and_attr(self): """Test is volume muted property w/ children and attrs.""" config = validate_config(self.config_children_and_attr) ump = universal.UniversalMediaPlayer(self.hass, **config) assert not ump.is_volume_muted self.hass.states.set(se...
[ "def", "test_is_volume_muted_children_and_attr", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_and_attr", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ...
[ 542, 4 ]
[ 551, 34 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_supported_features_children_only
(self)
Test supported media commands with only children.
Test supported media commands with only children.
def test_supported_features_children_only(self): """Test supported media commands with only children.""" config = validate_config(self.config_children_only) ump = universal.UniversalMediaPlayer(self.hass, **config) ump.entity_id = media_player.ENTITY_ID_FORMAT.format(config["name"]) ...
[ "def", "test_supported_features_children_only", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_only", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", ...
[ 553, 4 ]
[ 568, 44 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_supported_features_children_and_cmds
(self)
Test supported media commands with children and attrs.
Test supported media commands with children and attrs.
def test_supported_features_children_and_cmds(self): """Test supported media commands with children and attrs.""" config = copy(self.config_children_and_attr) excmd = {"service": "media_player.test", "data": {"entity_id": "test"}} config["commands"] = { "turn_on": excmd, ...
[ "def", "test_supported_features_children_and_cmds", "(", "self", ")", ":", "config", "=", "copy", "(", "self", ".", "config_children_and_attr", ")", "excmd", "=", "{", "\"service\"", ":", "\"media_player.test\"", ",", "\"data\"", ":", "{", "\"entity_id\"", ":", "\...
[ 570, 4 ]
[ 605, 52 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_service_call_no_active_child
(self)
Test a service call to children with no active child.
Test a service call to children with no active child.
def test_service_call_no_active_child(self): """Test a service call to children with no active child.""" config = validate_config(self.config_children_and_attr) ump = universal.UniversalMediaPlayer(self.hass, **config) ump.entity_id = media_player.ENTITY_ID_FORMAT.format(config["name"])...
[ "def", "test_service_call_no_active_child", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_and_attr", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", ...
[ 607, 4 ]
[ 624, 65 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_service_call_to_child
(self)
Test service calls that should be routed to a child.
Test service calls that should be routed to a child.
def test_service_call_to_child(self): """Test service calls that should be routed to a child.""" config = validate_config(self.config_children_only) ump = universal.UniversalMediaPlayer(self.hass, **config) ump.entity_id = media_player.ENTITY_ID_FORMAT.format(config["name"]) asy...
[ "def", "test_service_call_to_child", "(", "self", ")", ":", "config", "=", "validate_config", "(", "self", ".", "config_children_only", ")", "ump", "=", "universal", ".", "UniversalMediaPlayer", "(", "self", ".", "hass", ",", "*", "*", "config", ")", "ump", ...
[ 626, 4 ]
[ 711, 68 ]
python
en
['en', 'en', 'en']
True
TestMediaPlayer.test_service_call_to_command
(self)
Test service call to command.
Test service call to command.
def test_service_call_to_command(self): """Test service call to command.""" config = copy(self.config_children_only) config["commands"] = {"turn_off": {"service": "test.turn_off", "data": {}}} config = validate_config(config) service = mock_service(self.hass, "test", "turn_off")...
[ "def", "test_service_call_to_command", "(", "self", ")", ":", "config", "=", "copy", "(", "self", ".", "config_children_only", ")", "config", "[", "\"commands\"", "]", "=", "{", "\"turn_off\"", ":", "{", "\"service\"", ":", "\"test.turn_off\"", ",", "\"data\"", ...
[ 713, 4 ]
[ 731, 32 ]
python
en
['en', 'en', 'en']
True
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 22, 0 ]
[ 24, 37 ]
python
en
['en', 'fy', 'en']
True
entity_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def entity_reg(hass): """Return an empty, loaded, registry.""" return mock_registry(hass)
[ "def", "entity_reg", "(", "hass", ")", ":", "return", "mock_registry", "(", "hass", ")" ]
[ 28, 0 ]
[ 30, 30 ]
python
en
['en', 'fy', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 34, 0 ]
[ 36, 57 ]
python
en
['en', 'en', 'en']
True
test_get_conditions
(hass, device_reg, entity_reg)
Test we get the expected conditions from a humidifier.
Test we get the expected conditions from a humidifier.
async def test_get_conditions(hass, device_reg, entity_reg): """Test we get the expected conditions from a humidifier.""" config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, ...
[ "async", "def", "test_get_conditions", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "hass", ")",...
[ 39, 0 ]
[ 83, 54 ]
python
en
['en', 'en', 'en']
True
test_get_conditions_toggle_only
(hass, device_reg, entity_reg)
Test we get the expected conditions from a humidifier.
Test we get the expected conditions from a humidifier.
async def test_get_conditions_toggle_only(hass, device_reg, entity_reg): """Test we get the expected conditions from a humidifier.""" config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config_entry....
[ "async", "def", "test_get_conditions_toggle_only", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "h...
[ 86, 0 ]
[ 123, 54 ]
python
en
['en', 'en', 'en']
True
test_if_state
(hass, calls)
Test for turn_on and turn_off conditions.
Test for turn_on and turn_off conditions.
async def test_if_state(hass, calls): """Test for turn_on and turn_off conditions.""" hass.states.async_set( "humidifier.entity", STATE_ON, {const.ATTR_MODE: const.MODE_AWAY} ) assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: ...
[ "async", "def", "test_if_state", "(", "hass", ",", "calls", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"humidifier.entity\"", ",", "STATE_ON", ",", "{", "const", ".", "ATTR_MODE", ":", "const", ".", "MODE_AWAY", "}", ")", "assert", "await", ...
[ 126, 0 ]
[ 231, 26 ]
python
en
['en', 'en', 'en']
True
test_capabilities
(hass)
Test capabilities.
Test capabilities.
async def test_capabilities(hass): """Test capabilities.""" hass.states.async_set( "humidifier.entity", STATE_ON, { const.ATTR_MODE: const.MODE_AWAY, const.ATTR_AVAILABLE_MODES: [const.MODE_HOME, const.MODE_AWAY], }, ) # Test mode capabilities...
[ "async", "def", "test_capabilities", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"humidifier.entity\"", ",", "STATE_ON", ",", "{", "const", ".", "ATTR_MODE", ":", "const", ".", "MODE_AWAY", ",", "const", ".", "ATTR_AVAILABLE_MODES", ...
[ 234, 0 ]
[ 268, 5 ]
python
en
['en', 'la', 'en']
False
test_capabilities_no_state
(hass)
Test capabilities while state not available.
Test capabilities while state not available.
async def test_capabilities_no_state(hass): """Test capabilities while state not available.""" # Test mode capabilities = await device_condition.async_get_condition_capabilities( hass, { "condition": "device", "domain": DOMAIN, "device_id": "", ...
[ "async", "def", "test_capabilities_no_state", "(", "hass", ")", ":", "# Test mode", "capabilities", "=", "await", "device_condition", ".", "async_get_condition_capabilities", "(", "hass", ",", "{", "\"condition\"", ":", "\"device\"", ",", "\"domain\"", ":", "DOMAIN", ...
[ 271, 0 ]
[ 291, 5 ]
python
en
['en', 'en', 'en']
True
test_get_condition_capabilities
(hass, device_reg, entity_reg)
Test we get the expected toggle capabilities.
Test we get the expected toggle capabilities.
async def test_get_condition_capabilities(hass, device_reg, entity_reg): """Test we get the expected toggle capabilities.""" config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id,...
[ "async", "def", "test_get_condition_capabilities", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "h...
[ 294, 0 ]
[ 313, 52 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up tellduslive sensors dynamically.
Set up tellduslive sensors dynamically.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up tellduslive sensors dynamically.""" async def async_discover_light(device_id): """Discover and add a discovered sensor.""" client = hass.data[tellduslive.DOMAIN] async_add_entities([TelldusLiveLight(client, d...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "async", "def", "async_discover_light", "(", "device_id", ")", ":", "\"\"\"Discover and add a discovered sensor.\"\"\"", "client", "=", "hass", ".", "data", "["...
[ 16, 0 ]
[ 28, 5 ]
python
en
['en', 'hu', 'en']
True
TelldusLiveLight.__init__
(self, client, device_id)
Initialize the Tellstick Net light.
Initialize the Tellstick Net light.
def __init__(self, client, device_id): """Initialize the Tellstick Net light.""" super().__init__(client, device_id) self._last_brightness = self.brightness
[ "def", "__init__", "(", "self", ",", "client", ",", "device_id", ")", ":", "super", "(", ")", ".", "__init__", "(", "client", ",", "device_id", ")", "self", ".", "_last_brightness", "=", "self", ".", "brightness" ]
[ 34, 4 ]
[ 37, 47 ]
python
en
['en', 'lb', 'en']
True
TelldusLiveLight.changed
(self)
Define a property of the device that might have changed.
Define a property of the device that might have changed.
def changed(self): """Define a property of the device that might have changed.""" self._last_brightness = self.brightness self._update_callback()
[ "def", "changed", "(", "self", ")", ":", "self", ".", "_last_brightness", "=", "self", ".", "brightness", "self", ".", "_update_callback", "(", ")" ]
[ 39, 4 ]
[ 42, 31 ]
python
en
['en', 'en', 'en']
True
TelldusLiveLight.brightness
(self)
Return the brightness of this light between 0..255.
Return the brightness of this light between 0..255.
def brightness(self): """Return the brightness of this light between 0..255.""" return self.device.dim_level
[ "def", "brightness", "(", "self", ")", ":", "return", "self", ".", "device", ".", "dim_level" ]
[ 45, 4 ]
[ 47, 36 ]
python
en
['en', 'en', 'en']
True
TelldusLiveLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return SUPPORT_BRIGHTNESS
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_BRIGHTNESS" ]
[ 50, 4 ]
[ 52, 33 ]
python
en
['da', 'en', 'en']
True
TelldusLiveLight.is_on
(self)
Return true if light is on.
Return true if light is on.
def is_on(self): """Return true if light is on.""" return self.device.is_on
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "device", ".", "is_on" ]
[ 55, 4 ]
[ 57, 32 ]
python
en
['en', 'et', 'en']
True
TelldusLiveLight.turn_on
(self, **kwargs)
Turn the light on.
Turn the light on.
def turn_on(self, **kwargs): """Turn the light on.""" brightness = kwargs.get(ATTR_BRIGHTNESS, self._last_brightness) if brightness == 0: fallback_brightness = 100 _LOGGER.info( "Setting brightness to %d%%, because it was 0", fallback_brightness ...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "brightness", "=", "kwargs", ".", "get", "(", "ATTR_BRIGHTNESS", ",", "self", ".", "_last_brightness", ")", "if", "brightness", "==", "0", ":", "fallback_brightness", "=", "100", "_LOGGER", ...
[ 59, 4 ]
[ 69, 22 ]
python
en
['en', 'et', 'en']
True
TelldusLiveLight.turn_off
(self, **kwargs)
Turn the light off.
Turn the light off.
def turn_off(self, **kwargs): """Turn the light off.""" self.device.turn_off() self.changed()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "device", ".", "turn_off", "(", ")", "self", ".", "changed", "(", ")" ]
[ 71, 4 ]
[ 74, 22 ]
python
en
['en', 'zh', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Demo geolocations.
Set up the Demo geolocations.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Demo geolocations.""" DemoManager(hass, add_entities)
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "DemoManager", "(", "hass", ",", "add_entities", ")" ]
[ 39, 0 ]
[ 41, 35 ]
python
en
['en', 'en', 'en']
True
DemoManager.__init__
(self, hass, add_entities)
Initialise the demo geolocation event manager.
Initialise the demo geolocation event manager.
def __init__(self, hass, add_entities): """Initialise the demo geolocation event manager.""" self._hass = hass self._add_entities = add_entities self._managed_devices = [] self._update(count=NUMBER_OF_DEMO_DEVICES) self._init_regular_updates()
[ "def", "__init__", "(", "self", ",", "hass", ",", "add_entities", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_add_entities", "=", "add_entities", "self", ".", "_managed_devices", "=", "[", "]", "self", ".", "_update", "(", "count", "=", ...
[ 47, 4 ]
[ 53, 36 ]
python
en
['en', 'en', 'en']
True
DemoManager._generate_random_event
(self)
Generate a random event in vicinity of this HA instance.
Generate a random event in vicinity of this HA instance.
def _generate_random_event(self): """Generate a random event in vicinity of this HA instance.""" home_latitude = self._hass.config.latitude home_longitude = self._hass.config.longitude # Approx. 111km per degree (north-south). radius_in_degrees = random.random() * MAX_RADIUS_IN_...
[ "def", "_generate_random_event", "(", "self", ")", ":", "home_latitude", "=", "self", ".", "_hass", ".", "config", ".", "latitude", "home_longitude", "=", "self", ".", "_hass", ".", "config", ".", "longitude", "# Approx. 111km per degree (north-south).", "radius_in_...
[ 55, 4 ]
[ 74, 9 ]
python
en
['en', 'en', 'en']
True
DemoManager._init_regular_updates
(self)
Schedule regular updates based on configured time interval.
Schedule regular updates based on configured time interval.
def _init_regular_updates(self): """Schedule regular updates based on configured time interval.""" track_time_interval( self._hass, lambda now: self._update(), DEFAULT_UPDATE_INTERVAL )
[ "def", "_init_regular_updates", "(", "self", ")", ":", "track_time_interval", "(", "self", ".", "_hass", ",", "lambda", "now", ":", "self", ".", "_update", "(", ")", ",", "DEFAULT_UPDATE_INTERVAL", ")" ]
[ 76, 4 ]
[ 80, 9 ]
python
en
['en', 'da', 'en']
True
DemoManager._update
(self, count=1)
Remove events and add new random events.
Remove events and add new random events.
def _update(self, count=1): """Remove events and add new random events.""" # Remove devices. for _ in range(1, count + 1): if self._managed_devices: device = random.choice(self._managed_devices) if device: _LOGGER.debug("Removing %s...
[ "def", "_update", "(", "self", ",", "count", "=", "1", ")", ":", "# Remove devices.", "for", "_", "in", "range", "(", "1", ",", "count", "+", "1", ")", ":", "if", "self", ".", "_managed_devices", ":", "device", "=", "random", ".", "choice", "(", "s...
[ 82, 4 ]
[ 99, 39 ]
python
en
['en', 'en', 'en']
True
DemoGeolocationEvent.__init__
(self, name, distance, latitude, longitude, unit_of_measurement)
Initialize entity with data provided.
Initialize entity with data provided.
def __init__(self, name, distance, latitude, longitude, unit_of_measurement): """Initialize entity with data provided.""" self._name = name self._distance = distance self._latitude = latitude self._longitude = longitude self._unit_of_measurement = unit_of_measurement
[ "def", "__init__", "(", "self", ",", "name", ",", "distance", ",", "latitude", ",", "longitude", ",", "unit_of_measurement", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_distance", "=", "distance", "self", ".", "_latitude", "=", "latitude", ...
[ 105, 4 ]
[ 111, 55 ]
python
en
['en', 'en', 'en']
True
DemoGeolocationEvent.source
(self)
Return source value of this external event.
Return source value of this external event.
def source(self) -> str: """Return source value of this external event.""" return SOURCE
[ "def", "source", "(", "self", ")", "->", "str", ":", "return", "SOURCE" ]
[ 114, 4 ]
[ 116, 21 ]
python
en
['en', 'en', 'en']
True
DemoGeolocationEvent.name
(self)
Return the name of the event.
Return the name of the event.
def name(self) -> Optional[str]: """Return the name of the event.""" return self._name
[ "def", "name", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "self", ".", "_name" ]
[ 119, 4 ]
[ 121, 25 ]
python
en
['en', 'en', 'en']
True
DemoGeolocationEvent.should_poll
(self)
No polling needed for a demo geolocation event.
No polling needed for a demo geolocation event.
def should_poll(self): """No polling needed for a demo geolocation event.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 124, 4 ]
[ 126, 20 ]
python
en
['en', 'en', 'en']
True
DemoGeolocationEvent.distance
(self)
Return distance value of this external event.
Return distance value of this external event.
def distance(self) -> Optional[float]: """Return distance value of this external event.""" return self._distance
[ "def", "distance", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "_distance" ]
[ 129, 4 ]
[ 131, 29 ]
python
en
['en', 'en', 'en']
True
DemoGeolocationEvent.latitude
(self)
Return latitude value of this external event.
Return latitude value of this external event.
def latitude(self) -> Optional[float]: """Return latitude value of this external event.""" return self._latitude
[ "def", "latitude", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "_latitude" ]
[ 134, 4 ]
[ 136, 29 ]
python
en
['en', 'la', 'en']
True
DemoGeolocationEvent.longitude
(self)
Return longitude value of this external event.
Return longitude value of this external event.
def longitude(self) -> Optional[float]: """Return longitude value of this external event.""" return self._longitude
[ "def", "longitude", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "_longitude" ]
[ 139, 4 ]
[ 141, 30 ]
python
en
['en', 'en', 'en']
True
DemoGeolocationEvent.unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def unit_of_measurement(self): """Return the unit of measurement.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 144, 4 ]
[ 146, 40 ]
python
en
['en', 'la', 'en']
True
get_status
(hass, host, port)
Get the status of a Konnected Panel.
Get the status of a Konnected Panel.
async def get_status(hass, host, port): """Get the status of a Konnected Panel.""" client = konnected.Client( host, str(port), aiohttp_client.async_get_clientsession(hass) ) try: return await client.get_status() except client.ClientError as err: _LOGGER.error("Exception tryi...
[ "async", "def", "get_status", "(", "hass", ",", "host", ",", "port", ")", ":", "client", "=", "konnected", ".", "Client", "(", "host", ",", "str", "(", "port", ")", ",", "aiohttp_client", ".", "async_get_clientsession", "(", "hass", ")", ")", "try", ":...
[ 382, 0 ]
[ 392, 36 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.__init__
(self, hass, config_entry)
Initialize the Konnected device.
Initialize the Konnected device.
def __init__(self, hass, config_entry): """Initialize the Konnected device.""" self.hass = hass self.config_entry = config_entry self.config = config_entry.data self.options = config_entry.options or config_entry.data.get( CONF_DEFAULT_OPTIONS, {} ) se...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config_entry", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "config_entry", "=", "config_entry", "self", ".", "config", "=", "config_entry", ".", "data", "self", ".", "options", "=", "config_...
[ 62, 4 ]
[ 77, 40 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.device_id
(self)
Device id is the chipId (pro) or MAC address as string with punctuation removed.
Device id is the chipId (pro) or MAC address as string with punctuation removed.
def device_id(self): """Device id is the chipId (pro) or MAC address as string with punctuation removed.""" return self.config.get(CONF_ID)
[ "def", "device_id", "(", "self", ")", ":", "return", "self", ".", "config", ".", "get", "(", "CONF_ID", ")" ]
[ 80, 4 ]
[ 82, 39 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.stored_configuration
(self)
Return the configuration stored in `hass.data` for this device.
Return the configuration stored in `hass.data` for this device.
def stored_configuration(self): """Return the configuration stored in `hass.data` for this device.""" return self.hass.data[DOMAIN][CONF_DEVICES].get(self.device_id)
[ "def", "stored_configuration", "(", "self", ")", ":", "return", "self", ".", "hass", ".", "data", "[", "DOMAIN", "]", "[", "CONF_DEVICES", "]", ".", "get", "(", "self", ".", "device_id", ")" ]
[ 85, 4 ]
[ 87, 71 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.available
(self)
Return whether the device is available.
Return whether the device is available.
def available(self): """Return whether the device is available.""" return self.connected
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "connected" ]
[ 90, 4 ]
[ 92, 29 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.format_zone
(self, zone, other_items=None)
Get zone or pin based dict based on the client type.
Get zone or pin based dict based on the client type.
def format_zone(self, zone, other_items=None): """Get zone or pin based dict based on the client type.""" payload = { self.api_version: zone if self.api_version == CONF_ZONE else ZONE_TO_PIN[zone] } payload.update(other_items or {}) return payl...
[ "def", "format_zone", "(", "self", ",", "zone", ",", "other_items", "=", "None", ")", ":", "payload", "=", "{", "self", ".", "api_version", ":", "zone", "if", "self", ".", "api_version", "==", "CONF_ZONE", "else", "ZONE_TO_PIN", "[", "zone", "]", "}", ...
[ 94, 4 ]
[ 102, 22 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.async_connect
(self, now=None)
Connect to and setup a Konnected device.
Connect to and setup a Konnected device.
async def async_connect(self, now=None): """Connect to and setup a Konnected device.""" if self.connected: return if self.cancel_connect_retry: # cancel any pending connect attempt and try now self.cancel_connect_retry() try: self.client ...
[ "async", "def", "async_connect", "(", "self", ",", "now", "=", "None", ")", ":", "if", "self", ".", "connected", ":", "return", "if", "self", ".", "cancel_connect_retry", ":", "# cancel any pending connect attempt and try now", "self", ".", "cancel_connect_retry", ...
[ 104, 4 ]
[ 162, 9 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.update_switch
(self, zone, state, momentary=None, times=None, pause=None)
Update the state of a switchable output.
Update the state of a switchable output.
async def update_switch(self, zone, state, momentary=None, times=None, pause=None): """Update the state of a switchable output.""" try: if self.client: if self.api_version == CONF_ZONE: return await self.client.put_zone( zone, ...
[ "async", "def", "update_switch", "(", "self", ",", "zone", ",", "state", ",", "momentary", "=", "None", ",", "times", "=", "None", ",", "pause", "=", "None", ")", ":", "try", ":", "if", "self", ".", "client", ":", "if", "self", ".", "api_version", ...
[ 164, 4 ]
[ 189, 27 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.async_save_data
(self)
Save the device configuration to `hass.data`.
Save the device configuration to `hass.data`.
async def async_save_data(self): """Save the device configuration to `hass.data`.""" binary_sensors = {} for entity in self.options.get(CONF_BINARY_SENSORS) or []: zone = entity[CONF_ZONE] binary_sensors[zone] = { CONF_TYPE: entity[CONF_TYPE], ...
[ "async", "def", "async_save_data", "(", "self", ")", ":", "binary_sensors", "=", "{", "}", "for", "entity", "in", "self", ".", "options", ".", "get", "(", "CONF_BINARY_SENSORS", ")", "or", "[", "]", ":", "zone", "=", "entity", "[", "CONF_ZONE", "]", "b...
[ 191, 4 ]
[ 271, 74 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.async_binary_sensor_configuration
(self)
Return the configuration map for syncing binary sensors.
Return the configuration map for syncing binary sensors.
def async_binary_sensor_configuration(self): """Return the configuration map for syncing binary sensors.""" return [ self.format_zone(p) for p in self.stored_configuration[CONF_BINARY_SENSORS] ]
[ "def", "async_binary_sensor_configuration", "(", "self", ")", ":", "return", "[", "self", ".", "format_zone", "(", "p", ")", "for", "p", "in", "self", ".", "stored_configuration", "[", "CONF_BINARY_SENSORS", "]", "]" ]
[ 274, 4 ]
[ 278, 9 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.async_actuator_configuration
(self)
Return the configuration map for syncing actuators.
Return the configuration map for syncing actuators.
def async_actuator_configuration(self): """Return the configuration map for syncing actuators.""" return [ self.format_zone( data[CONF_ZONE], {"trigger": (0 if data.get(CONF_ACTIVATION) in [0, STATE_LOW] else 1)}, ) for data in self.sto...
[ "def", "async_actuator_configuration", "(", "self", ")", ":", "return", "[", "self", ".", "format_zone", "(", "data", "[", "CONF_ZONE", "]", ",", "{", "\"trigger\"", ":", "(", "0", "if", "data", ".", "get", "(", "CONF_ACTIVATION", ")", "in", "[", "0", ...
[ 281, 4 ]
[ 289, 9 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.async_dht_sensor_configuration
(self)
Return the configuration map for syncing DHT sensors.
Return the configuration map for syncing DHT sensors.
def async_dht_sensor_configuration(self): """Return the configuration map for syncing DHT sensors.""" return [ self.format_zone( sensor[CONF_ZONE], {CONF_POLL_INTERVAL: sensor[CONF_POLL_INTERVAL]} ) for sensor in self.stored_configuration[CONF_SENSORS]...
[ "def", "async_dht_sensor_configuration", "(", "self", ")", ":", "return", "[", "self", ".", "format_zone", "(", "sensor", "[", "CONF_ZONE", "]", ",", "{", "CONF_POLL_INTERVAL", ":", "sensor", "[", "CONF_POLL_INTERVAL", "]", "}", ")", "for", "sensor", "in", "...
[ 292, 4 ]
[ 300, 9 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.async_ds18b20_sensor_configuration
(self)
Return the configuration map for syncing DS18B20 sensors.
Return the configuration map for syncing DS18B20 sensors.
def async_ds18b20_sensor_configuration(self): """Return the configuration map for syncing DS18B20 sensors.""" return [ self.format_zone(sensor[CONF_ZONE]) for sensor in self.stored_configuration[CONF_SENSORS] if sensor[CONF_TYPE] == "ds18b20" ]
[ "def", "async_ds18b20_sensor_configuration", "(", "self", ")", ":", "return", "[", "self", ".", "format_zone", "(", "sensor", "[", "CONF_ZONE", "]", ")", "for", "sensor", "in", "self", ".", "stored_configuration", "[", "CONF_SENSORS", "]", "if", "sensor", "[",...
[ 303, 4 ]
[ 309, 9 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.async_update_initial_states
(self)
Update the initial state of each sensor from status poll.
Update the initial state of each sensor from status poll.
async def async_update_initial_states(self): """Update the initial state of each sensor from status poll.""" for sensor_data in self.status.get("sensors"): sensor_config = self.stored_configuration[CONF_BINARY_SENSORS].get( sensor_data.get(CONF_ZONE, sensor_data.get(CONF_PIN)...
[ "async", "def", "async_update_initial_states", "(", "self", ")", ":", "for", "sensor_data", "in", "self", ".", "status", ".", "get", "(", "\"sensors\"", ")", ":", "sensor_config", "=", "self", ".", "stored_configuration", "[", "CONF_BINARY_SENSORS", "]", ".", ...
[ 311, 4 ]
[ 323, 84 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.async_desired_settings_payload
(self)
Return a dict representing the desired device configuration.
Return a dict representing the desired device configuration.
def async_desired_settings_payload(self): """Return a dict representing the desired device configuration.""" # keeping self.hass.data check for backwards compatibility # newly configured integrations store this in the config entry desired_api_host = self.options.get(CONF_API_HOST) or ( ...
[ "def", "async_desired_settings_payload", "(", "self", ")", ":", "# keeping self.hass.data check for backwards compatibility", "# newly configured integrations store this in the config entry", "desired_api_host", "=", "self", ".", "options", ".", "get", "(", "CONF_API_HOST", ")", ...
[ 326, 4 ]
[ 344, 9 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.async_current_settings_payload
(self)
Return a dict of configuration currently stored on the device.
Return a dict of configuration currently stored on the device.
def async_current_settings_payload(self): """Return a dict of configuration currently stored on the device.""" settings = self.status["settings"] if not settings: settings = {} return { "sensors": [ {self.api_version: s[self.api_version]} ...
[ "def", "async_current_settings_payload", "(", "self", ")", ":", "settings", "=", "self", ".", "status", "[", "\"settings\"", "]", "if", "not", "settings", ":", "settings", "=", "{", "}", "return", "{", "\"sensors\"", ":", "[", "{", "self", ".", "api_versio...
[ 347, 4 ]
[ 365, 9 ]
python
en
['en', 'en', 'en']
True
AlarmPanel.async_sync_device_config
(self)
Sync the new zone configuration to the Konnected device if needed.
Sync the new zone configuration to the Konnected device if needed.
async def async_sync_device_config(self): """Sync the new zone configuration to the Konnected device if needed.""" _LOGGER.debug( "Device %s settings payload: %s", self.device_id, self.async_desired_settings_payload(), ) if ( self.async_des...
[ "async", "def", "async_sync_device_config", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Device %s settings payload: %s\"", ",", "self", ".", "device_id", ",", "self", ".", "async_desired_settings_payload", "(", ")", ",", ")", "if", "(", "self", ".", ...
[ 367, 4 ]
[ 379, 83 ]
python
en
['en', 'en', 'en']
True
_async_has_devices
(hass)
Return if there are devices that can be discovered.
Return if there are devices that can be discovered.
async def _async_has_devices(hass) -> bool: """Return if there are devices that can be discovered.""" devices = await DeviceHelper.find_devices() return len(devices) > 0
[ "async", "def", "_async_has_devices", "(", "hass", ")", "->", "bool", ":", "devices", "=", "await", "DeviceHelper", ".", "find_devices", "(", ")", "return", "len", "(", "devices", ")", ">", "0" ]
[ 8, 0 ]
[ 11, 27 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Create and add an entity based on the configuration.
Create and add an entity based on the configuration.
def setup_platform(hass, config, add_entities, discovery_info=None): """Create and add an entity based on the configuration.""" zigbee_device = hass.data[DOMAIN] add_entities([XBeeLight(XBeeDigitalOutConfig(config), zigbee_device)])
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "zigbee_device", "=", "hass", ".", "data", "[", "DOMAIN", "]", "add_entities", "(", "[", "XBeeLight", "(", "XBeeDigitalOutConfig", "(", "c...
[ 17, 0 ]
[ 20, 74 ]
python
en
['en', 'en', 'en']
True
_get_config
()
Return a config dictionary.
Return a config dictionary.
def _get_config(): """Return a config dictionary.""" return { DYSON_DOMAIN: { CONF_USERNAME: "email", CONF_PASSWORD: "password", CONF_LANGUAGE: "GB", CONF_DEVICES: [ {"device_id": "XX-XXXXX-XX", "device_ip": "192.168.0.1"}, ...
[ "def", "_get_config", "(", ")", ":", "return", "{", "DYSON_DOMAIN", ":", "{", "CONF_USERNAME", ":", "\"email\"", ",", "CONF_PASSWORD", ":", "\"password\"", ",", "CONF_LANGUAGE", ":", "\"GB\"", ",", "CONF_DEVICES", ":", "[", "{", "\"device_id\"", ":", "\"XX-XXX...
[ 79, 0 ]
[ 91, 5 ]
python
en
['en', 'pt', 'en']
True
_get_dyson_purehotcool_device
()
Return a valid device as provided by the Dyson web services.
Return a valid device as provided by the Dyson web services.
def _get_dyson_purehotcool_device(): """Return a valid device as provided by the Dyson web services.""" device = Mock(spec=DysonPureHotCool) load_mock_device(device) device.name = "Living room" device.state.heat_target = "0000" device.state.heat_mode = HeatMode.HEAT_OFF.value device.state.fa...
[ "def", "_get_dyson_purehotcool_device", "(", ")", ":", "device", "=", "Mock", "(", "spec", "=", "DysonPureHotCool", ")", "load_mock_device", "(", "device", ")", "device", ".", "name", "=", "\"Living room\"", "device", ".", "state", ".", "heat_target", "=", "\"...
[ 94, 0 ]
[ 104, 17 ]
python
en
['en', 'en', 'en']
True
_get_device_off
()
Return a device with state off.
Return a device with state off.
def _get_device_off(): """Return a device with state off.""" device = Mock(spec=DysonPureHotCoolLink) load_mock_device(device) return device
[ "def", "_get_device_off", "(", ")", ":", "device", "=", "Mock", "(", "spec", "=", "DysonPureHotCoolLink", ")", "load_mock_device", "(", "device", ")", "return", "device" ]
[ 107, 0 ]
[ 111, 17 ]
python
en
['en', 'en', 'en']
True
_get_device_cool
()
Return a device with state of cooling.
Return a device with state of cooling.
def _get_device_cool(): """Return a device with state of cooling.""" device = Mock(spec=DysonPureHotCoolLink) load_mock_device(device) device.state.focus_mode = FocusMode.FOCUS_OFF.value device.state.heat_target = HeatTarget.celsius(12) device.state.heat_mode = HeatMode.HEAT_OFF.value device...
[ "def", "_get_device_cool", "(", ")", ":", "device", "=", "Mock", "(", "spec", "=", "DysonPureHotCoolLink", ")", "load_mock_device", "(", "device", ")", "device", ".", "state", ".", "focus_mode", "=", "FocusMode", ".", "FOCUS_OFF", ".", "value", "device", "."...
[ 114, 0 ]
[ 122, 17 ]
python
en
['en', 'en', 'en']
True
_get_device_heat_on
()
Return a device with state of heating.
Return a device with state of heating.
def _get_device_heat_on(): """Return a device with state of heating.""" device = Mock(spec=DysonPureHotCoolLink) load_mock_device(device) device.serial = "YY-YYYYY-YY" device.state.heat_target = HeatTarget.celsius(23) device.state.heat_mode = HeatMode.HEAT_ON.value device.state.heat_state = ...
[ "def", "_get_device_heat_on", "(", ")", ":", "device", "=", "Mock", "(", "spec", "=", "DysonPureHotCoolLink", ")", "load_mock_device", "(", "device", ")", "device", ".", "serial", "=", "\"YY-YYYYY-YY\"", "device", ".", "state", ".", "heat_target", "=", "HeatTa...
[ 125, 0 ]
[ 135, 17 ]
python
en
['en', 'en', 'en']
True
patch_platforms_fixture
()
Only set up the climate platform for the climate tests.
Only set up the climate platform for the climate tests.
def patch_platforms_fixture(): """Only set up the climate platform for the climate tests.""" with patch("homeassistant.components.dyson.DYSON_PLATFORMS", new=[DOMAIN]): yield
[ "def", "patch_platforms_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.dyson.DYSON_PLATFORMS\"", ",", "new", "=", "[", "DOMAIN", "]", ")", ":", "yield" ]
[ 139, 0 ]
[ 142, 13 ]
python
en
['en', 'en', 'en']
True
test_pure_hot_cool_link_set_mode
(mocked_login, mocked_devices, hass)
Test set climate mode.
Test set climate mode.
async def test_pure_hot_cool_link_set_mode(mocked_login, mocked_devices, hass): """Test set climate mode.""" await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() device = mocked_devices.return_value[0] await hass.services.async_call( DOMAIN, ...
[ "async", "def", "test_pure_hot_cool_link_set_mode", "(", "mocked_login", ",", "mocked_devices", ",", "hass", ")", ":", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ")", ")", "await", "hass", ".", "async_block_till_done...
[ 150, 0 ]
[ 175, 68 ]
python
en
['en', 'en', 'en']
True
test_pure_hot_cool_link_set_fan
(mocked_login, mocked_devices, hass)
Test set climate fan.
Test set climate fan.
async def test_pure_hot_cool_link_set_fan(mocked_login, mocked_devices, hass): """Test set climate fan.""" await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() device = mocked_devices.return_value[0] device.temp_unit = TEMP_CELSIUS await hass.servic...
[ "async", "def", "test_pure_hot_cool_link_set_fan", "(", "mocked_login", ",", "mocked_devices", ",", "hass", ")", ":", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ")", ")", "await", "hass", ".", "async_block_till_done"...
[ 183, 0 ]
[ 209, 71 ]
python
en
['en', 'fy', 'en']
True
test_pure_hot_cool_link_state
(mocked_login, mocked_devices, hass)
Test set climate temperature.
Test set climate temperature.
async def test_pure_hot_cool_link_state(mocked_login, mocked_devices, hass): """Test set climate temperature.""" await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() state = hass.states.get("climate.temp_name") assert state.attributes[ATTR_SUPPORTED_FEAT...
[ "async", "def", "test_pure_hot_cool_link_state", "(", "mocked_login", ",", "mocked_devices", ",", "hass", ")", ":", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ")", ")", "await", "hass", ".", "async_block_till_done", ...
[ 217, 0 ]
[ 282, 66 ]
python
en
['en', 'la', 'en']
True
test_setup_component_without_devices
(mocked_login, mocked_devices, hass)
Test setup component with no devices.
Test setup component with no devices.
async def test_setup_component_without_devices(mocked_login, mocked_devices, hass): """Test setup component with no devices.""" await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() entity_ids = hass.states.async_entity_ids(DOMAIN) assert not entity_ids
[ "async", "def", "test_setup_component_without_devices", "(", "mocked_login", ",", "mocked_devices", ",", "hass", ")", ":", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ")", ")", "await", "hass", ".", "async_block_till_...
[ 290, 0 ]
[ 296, 25 ]
python
en
['en', 'en', 'en']
True
test_dyson_set_temperature
(mocked_login, mocked_devices, hass)
Test set climate temperature.
Test set climate temperature.
async def test_dyson_set_temperature(mocked_login, mocked_devices, hass): """Test set climate temperature.""" await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() device = mocked_devices.return_value[0] device.temp_unit = TEMP_CELSIUS # Without corr...
[ "async", "def", "test_dyson_set_temperature", "(", "mocked_login", ",", "mocked_devices", ",", "hass", ")", ":", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ")", ")", "await", "hass", ".", "async_block_till_done", "...
[ 304, 0 ]
[ 362, 5 ]
python
en
['en', 'la', 'en']
True
test_dyson_set_temperature_when_cooling_mode
( mocked_login, mocked_devices, hass )
Test set climate temperature when heating is off.
Test set climate temperature when heating is off.
async def test_dyson_set_temperature_when_cooling_mode( mocked_login, mocked_devices, hass ): """Test set climate temperature when heating is off.""" await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() device = mocked_devices.return_value[0] device....
[ "async", "def", "test_dyson_set_temperature_when_cooling_mode", "(", "mocked_login", ",", "mocked_devices", ",", "hass", ")", ":", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ")", ")", "await", "hass", ".", "async_blo...
[ 370, 0 ]
[ 390, 5 ]
python
en
['en', 'en', 'en']
True
test_setup_component_with_parent_discovery
( mocked_login, mocked_devices, hass )
Test setup_component using discovery.
Test setup_component using discovery.
async def test_setup_component_with_parent_discovery( mocked_login, mocked_devices, hass ): """Test setup_component using discovery.""" await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() entity_ids = hass.states.async_entity_ids(DOMAIN) assert len(...
[ "async", "def", "test_setup_component_with_parent_discovery", "(", "mocked_login", ",", "mocked_devices", ",", "hass", ")", ":", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ")", ")", "await", "hass", ".", "async_block...
[ 398, 0 ]
[ 406, 31 ]
python
en
['id', 'en', 'en']
True
test_purehotcool_component_setup_only_once
(devices, login, hass)
Test if entities are created only once.
Test if entities are created only once.
async def test_purehotcool_component_setup_only_once(devices, login, hass): """Test if entities are created only once.""" config = _get_config() await async_setup_component(hass, DYSON_DOMAIN, config) await hass.async_block_till_done() entity_ids = hass.states.async_entity_ids(DOMAIN) assert le...
[ "async", "def", "test_purehotcool_component_setup_only_once", "(", "devices", ",", "login", ",", "hass", ")", ":", "config", "=", "_get_config", "(", ")", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "config", ")", "await", "hass", "....
[ 414, 0 ]
[ 423, 38 ]
python
en
['en', 'en', 'en']
True
test_purehotcoollink_component_setup_only_once
(devices, login, hass)
Test if entities are created only once.
Test if entities are created only once.
async def test_purehotcoollink_component_setup_only_once(devices, login, hass): """Test if entities are created only once.""" config = _get_config() await async_setup_component(hass, DYSON_DOMAIN, config) await hass.async_block_till_done() entity_ids = hass.states.async_entity_ids(DOMAIN) asser...
[ "async", "def", "test_purehotcoollink_component_setup_only_once", "(", "devices", ",", "login", ",", "hass", ")", ":", "config", "=", "_get_config", "(", ")", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "config", ")", "await", "hass", ...
[ 431, 0 ]
[ 440, 36 ]
python
en
['en', 'en', 'en']
True
test_purehotcool_update_state
(devices, login, hass)
Test state update.
Test state update.
async def test_purehotcool_update_state(devices, login, hass): """Test state update.""" device = devices.return_value[0] await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() event = { "msg": "CURRENT-STATE", "product-state": { ...
[ "async", "def", "test_purehotcool_update_state", "(", "devices", ",", "login", ",", "hass", ")", ":", "device", "=", "devices", ".", "return_value", "[", "0", "]", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ")"...
[ 448, 0 ]
[ 491, 60 ]
python
en
['en', 'co', 'en']
True
test_purehotcool_empty_env_attributes
(devices, login, hass)
Test empty environmental state update.
Test empty environmental state update.
async def test_purehotcool_empty_env_attributes(devices, login, hass): """Test empty environmental state update.""" device = devices.return_value[0] device.environmental_state.temperature = 0 device.environmental_state.humidity = None await async_setup_component(hass, DYSON_DOMAIN, _get_config()) ...
[ "async", "def", "test_purehotcool_empty_env_attributes", "(", "devices", ",", "login", ",", "hass", ")", ":", "device", "=", "devices", ".", "return_value", "[", "0", "]", "device", ".", "environmental_state", ".", "temperature", "=", "0", "device", ".", "envi...
[ 499, 0 ]
[ 510, 50 ]
python
en
['en', 'en', 'en']
True
test_purehotcool_fan_state_off
(devices, login, hass)
Test device fan state off.
Test device fan state off.
async def test_purehotcool_fan_state_off(devices, login, hass): """Test device fan state off.""" device = devices.return_value[0] device.state.fan_state = FanState.FAN_OFF.value await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() state = hass.states...
[ "async", "def", "test_purehotcool_fan_state_off", "(", "devices", ",", "login", ",", "hass", ")", ":", "device", "=", "devices", ".", "return_value", "[", "0", "]", "device", ".", "state", ".", "fan_state", "=", "FanState", ".", "FAN_OFF", ".", "value", "a...
[ 518, 0 ]
[ 528, 47 ]
python
en
['en', 'fy', 'en']
True
test_purehotcool_hvac_action_cool
(devices, login, hass)
Test device HVAC action cool.
Test device HVAC action cool.
async def test_purehotcool_hvac_action_cool(devices, login, hass): """Test device HVAC action cool.""" device = devices.return_value[0] device.state.fan_power = FanPower.POWER_ON.value await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() state = hass...
[ "async", "def", "test_purehotcool_hvac_action_cool", "(", "devices", ",", "login", ",", "hass", ")", ":", "device", "=", "devices", ".", "return_value", "[", "0", "]", "device", ".", "state", ".", "fan_power", "=", "FanPower", ".", "POWER_ON", ".", "value", ...
[ 536, 0 ]
[ 546, 60 ]
python
en
['fr', 'en', 'en']
True
test_purehotcool_hvac_action_idle
(devices, login, hass)
Test device HVAC action idle.
Test device HVAC action idle.
async def test_purehotcool_hvac_action_idle(devices, login, hass): """Test device HVAC action idle.""" device = devices.return_value[0] device.state.fan_power = FanPower.POWER_ON.value device.state.heat_mode = HeatMode.HEAT_ON.value await async_setup_component(hass, DYSON_DOMAIN, _get_config()) ...
[ "async", "def", "test_purehotcool_hvac_action_idle", "(", "devices", ",", "login", ",", "hass", ")", ":", "device", "=", "devices", ".", "return_value", "[", "0", "]", "device", ".", "state", ".", "fan_power", "=", "FanPower", ".", "POWER_ON", ".", "value", ...
[ 554, 0 ]
[ 565, 60 ]
python
en
['fr', 'en', 'en']
True
test_purehotcool_set_temperature
(devices, login, hass)
Test set temperature.
Test set temperature.
async def test_purehotcool_set_temperature(devices, login, hass): """Test set temperature.""" device = devices.return_value[0] await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() state = hass.states.get("climate.living_room") attributes = state.attri...
[ "async", "def", "test_purehotcool_set_temperature", "(", "devices", ",", "login", ",", "hass", ")", ":", "device", "=", "devices", ".", "return_value", "[", "0", "]", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ...
[ 573, 0 ]
[ 616, 75 ]
python
en
['en', 'la', 'en']
True
test_purehotcool_set_fan_mode
(devices, login, hass)
Test set fan mode.
Test set fan mode.
async def test_purehotcool_set_fan_mode(devices, login, hass): """Test set fan mode.""" device = devices.return_value[0] await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() await hass.services.async_call( DOMAIN, SERVICE_SET_FAN_MODE, ...
[ "async", "def", "test_purehotcool_set_fan_mode", "(", "devices", ",", "login", ",", "hass", ")", ":", "device", "=", "devices", ".", "return_value", "[", "0", "]", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ")"...
[ 624, 0 ]
[ 680, 68 ]
python
fy
['id', 'fy', 'nl']
False
test_purehotcool_set_hvac_mode
(devices, login, hass)
Test set HVAC mode.
Test set HVAC mode.
async def test_purehotcool_set_hvac_mode(devices, login, hass): """Test set HVAC mode.""" device = devices.return_value[0] await async_setup_component(hass, DYSON_DOMAIN, _get_config()) await hass.async_block_till_done() await hass.services.async_call( DOMAIN, SERVICE_SET_HVAC_MODE,...
[ "async", "def", "test_purehotcool_set_hvac_mode", "(", "devices", ",", "login", ",", "hass", ")", ":", "device", "=", "devices", ".", "return_value", "[", "0", "]", "await", "async_setup_component", "(", "hass", ",", "DYSON_DOMAIN", ",", "_get_config", "(", ")...
[ 688, 0 ]
[ 726, 51 ]
python
en
['en', 'is', 'en']
True