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_remove_entry_if_integration_deleted
(hass, manager)
Test that we can remove an entry when the integration is deleted.
Test that we can remove an entry when the integration is deleted.
async def test_remove_entry_if_integration_deleted(hass, manager): """Test that we can remove an entry when the integration is deleted.""" mock_unload_entry = AsyncMock(return_value=True) MockConfigEntry(domain="test", entry_id="test1").add_to_manager(manager) MockConfigEntry(domain="comp", entry_id="t...
[ "async", "def", "test_remove_entry_if_integration_deleted", "(", "hass", ",", "manager", ")", ":", "mock_unload_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "entry_id", "=", "\"test1\"", "...
[ 412, 0 ]
[ 431, 49 ]
python
en
['en', 'en', 'en']
True
test_add_entry_calls_setup_entry
(hass, manager)
Test we call setup_config_entry.
Test we call setup_config_entry.
async def test_add_entry_calls_setup_entry(hass, manager): """Test we call setup_config_entry.""" mock_setup_entry = AsyncMock(return_value=True) mock_integration(hass, MockModule("comp", async_setup_entry=mock_setup_entry)) mock_entity_platform(hass, "config_flow.comp", None) class TestFlow(confi...
[ "async", "def", "test_add_entry_calls_setup_entry", "(", "hass", ",", "manager", ")", ":", "mock_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ",", "async_setup_entry", "...
[ 434, 0 ]
[ 460, 51 ]
python
en
['en', 'pt', 'en']
True
test_entries_gets_entries
(manager)
Test entries are filtered by domain.
Test entries are filtered by domain.
async def test_entries_gets_entries(manager): """Test entries are filtered by domain.""" MockConfigEntry(domain="test").add_to_manager(manager) entry1 = MockConfigEntry(domain="test2") entry1.add_to_manager(manager) entry2 = MockConfigEntry(domain="test2") entry2.add_to_manager(manager) ass...
[ "async", "def", "test_entries_gets_entries", "(", "manager", ")", ":", "MockConfigEntry", "(", "domain", "=", "\"test\"", ")", ".", "add_to_manager", "(", "manager", ")", "entry1", "=", "MockConfigEntry", "(", "domain", "=", "\"test2\"", ")", "entry1", ".", "a...
[ 463, 0 ]
[ 471, 61 ]
python
en
['en', 'en', 'en']
True
test_domains_gets_uniques
(manager)
Test we only return each domain once.
Test we only return each domain once.
async def test_domains_gets_uniques(manager): """Test we only return each domain once.""" MockConfigEntry(domain="test").add_to_manager(manager) MockConfigEntry(domain="test2").add_to_manager(manager) MockConfigEntry(domain="test2").add_to_manager(manager) MockConfigEntry(domain="test").add_to_manag...
[ "async", "def", "test_domains_gets_uniques", "(", "manager", ")", ":", "MockConfigEntry", "(", "domain", "=", "\"test\"", ")", ".", "add_to_manager", "(", "manager", ")", "MockConfigEntry", "(", "domain", "=", "\"test2\"", ")", ".", "add_to_manager", "(", "manag...
[ 474, 0 ]
[ 482, 64 ]
python
en
['en', 'en', 'en']
True
test_saving_and_loading
(hass)
Test that we're saving and loading correctly.
Test that we're saving and loading correctly.
async def test_saving_and_loading(hass): """Test that we're saving and loading correctly.""" mock_integration( hass, MockModule("test", async_setup_entry=lambda *args: mock_coro(True)) ) mock_entity_platform(hass, "config_flow.test", None) class TestFlow(config_entries.ConfigFlow): ...
[ "async", "def", "test_saving_and_loading", "(", "hass", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"test\"", ",", "async_setup_entry", "=", "lambda", "*", "args", ":", "mock_coro", "(", "True", ")", ")", ")", "mock_entity_platform", "...
[ 485, 0 ]
[ 548, 49 ]
python
en
['en', 'en', 'en']
True
test_forward_entry_sets_up_component
(hass)
Test we setup the component entry is forwarded to.
Test we setup the component entry is forwarded to.
async def test_forward_entry_sets_up_component(hass): """Test we setup the component entry is forwarded to.""" entry = MockConfigEntry(domain="original") mock_original_setup_entry = AsyncMock(return_value=True) mock_integration( hass, MockModule("original", async_setup_entry=mock_original_setup...
[ "async", "def", "test_forward_entry_sets_up_component", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"original\"", ")", "mock_original_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", "mock_integration", "(", "h...
[ 551, 0 ]
[ 567, 58 ]
python
en
['en', 'en', 'en']
True
test_forward_entry_does_not_setup_entry_if_setup_fails
(hass)
Test we do not set up entry if component setup fails.
Test we do not set up entry if component setup fails.
async def test_forward_entry_does_not_setup_entry_if_setup_fails(hass): """Test we do not set up entry if component setup fails.""" entry = MockConfigEntry(domain="original") mock_setup = AsyncMock(return_value=False) mock_setup_entry = AsyncMock() mock_integration( hass, MockModule...
[ "async", "def", "test_forward_entry_does_not_setup_entry_if_setup_fails", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"original\"", ")", "mock_setup", "=", "AsyncMock", "(", "return_value", "=", "False", ")", "mock_setup_entry", "=", ...
[ 570, 0 ]
[ 585, 48 ]
python
en
['en', 'en', 'en']
True
test_discovery_notification
(hass)
Test that we create/dismiss a notification when source is discovery.
Test that we create/dismiss a notification when source is discovery.
async def test_discovery_notification(hass): """Test that we create/dismiss a notification when source is discovery.""" mock_integration(hass, MockModule("test")) mock_entity_platform(hass, "config_flow.test", None) await async_setup_component(hass, "persistent_notification", {}) with patch.dict(co...
[ "async", "def", "test_discovery_notification", "(", "hass", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"test\"", ")", ")", "mock_entity_platform", "(", "hass", ",", "\"config_flow.test\"", ",", "None", ")", "await", "async_setup_component",...
[ 588, 0 ]
[ 638, 28 ]
python
en
['en', 'en', 'en']
True
test_reauth_notification
(hass)
Test that we create/dismiss a notification when source is reauth.
Test that we create/dismiss a notification when source is reauth.
async def test_reauth_notification(hass): """Test that we create/dismiss a notification when source is reauth.""" mock_integration(hass, MockModule("test")) mock_entity_platform(hass, "config_flow.test", None) await async_setup_component(hass, "persistent_notification", {}) with patch.dict(config_e...
[ "async", "def", "test_reauth_notification", "(", "hass", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"test\"", ")", ")", "mock_entity_platform", "(", "hass", ",", "\"config_flow.test\"", ",", "None", ")", "await", "async_setup_component", ...
[ 641, 0 ]
[ 706, 28 ]
python
en
['en', 'en', 'en']
True
test_discovery_notification_not_created
(hass)
Test that we not create a notification when discovery is aborted.
Test that we not create a notification when discovery is aborted.
async def test_discovery_notification_not_created(hass): """Test that we not create a notification when discovery is aborted.""" mock_integration(hass, MockModule("test")) mock_entity_platform(hass, "config_flow.test", None) await async_setup_component(hass, "persistent_notification", {}) class Tes...
[ "async", "def", "test_discovery_notification_not_created", "(", "hass", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"test\"", ")", ")", "mock_entity_platform", "(", "hass", ",", "\"config_flow.test\"", ",", "None", ")", "await", "async_setup...
[ 709, 0 ]
[ 731, 24 ]
python
en
['en', 'en', 'en']
True
test_loading_default_config
(hass)
Test loading the default config.
Test loading the default config.
async def test_loading_default_config(hass): """Test loading the default config.""" manager = config_entries.ConfigEntries(hass, {}) with patch("homeassistant.util.json.open", side_effect=FileNotFoundError): await manager.async_initialize() assert len(manager.async_entries()) == 0
[ "async", "def", "test_loading_default_config", "(", "hass", ")", ":", "manager", "=", "config_entries", ".", "ConfigEntries", "(", "hass", ",", "{", "}", ")", "with", "patch", "(", "\"homeassistant.util.json.open\"", ",", "side_effect", "=", "FileNotFoundError", "...
[ 734, 0 ]
[ 741, 44 ]
python
en
['en', 'da', 'en']
True
test_updating_entry_data
(manager)
Test that we can update an entry data.
Test that we can update an entry data.
async def test_updating_entry_data(manager): """Test that we can update an entry data.""" entry = MockConfigEntry( domain="test", data={"first": True}, state=config_entries.ENTRY_STATE_SETUP_ERROR, ) entry.add_to_manager(manager) assert manager.async_update_entry(entry) is F...
[ "async", "def", "test_updating_entry_data", "(", "manager", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "\"first\"", ":", "True", "}", ",", "state", "=", "config_entries", ".", "ENTRY_STATE_SETUP_ERROR", ",...
[ 744, 0 ]
[ 757, 41 ]
python
en
['en', 'en', 'en']
True
test_updating_entry_system_options
(manager)
Test that we can update an entry data.
Test that we can update an entry data.
async def test_updating_entry_system_options(manager): """Test that we can update an entry data.""" entry = MockConfigEntry( domain="test", data={"first": True}, state=config_entries.ENTRY_STATE_SETUP_ERROR, system_options={"disable_new_entities": True}, ) entry.add_to_ma...
[ "async", "def", "test_updating_entry_system_options", "(", "manager", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "\"first\"", ":", "True", "}", ",", "state", "=", "config_entries", ".", "ENTRY_STATE_SETUP_ER...
[ 760, 0 ]
[ 773, 56 ]
python
en
['en', 'en', 'en']
True
test_update_entry_options_and_trigger_listener
(hass, manager)
Test that we can update entry options and trigger listener.
Test that we can update entry options and trigger listener.
async def test_update_entry_options_and_trigger_listener(hass, manager): """Test that we can update entry options and trigger listener.""" entry = MockConfigEntry(domain="test", options={"first": True}) entry.add_to_manager(manager) async def update_listener(hass, entry): """Test function.""" ...
[ "async", "def", "test_update_entry_options_and_trigger_listener", "(", "hass", ",", "manager", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "options", "=", "{", "\"first\"", ":", "True", "}", ")", "entry", ".", "add_to_manager"...
[ 776, 0 ]
[ 789, 44 ]
python
en
['en', 'en', 'en']
True
test_setup_raise_not_ready
(hass, caplog)
Test a setup raising not ready.
Test a setup raising not ready.
async def test_setup_raise_not_ready(hass, caplog): """Test a setup raising not ready.""" entry = MockConfigEntry(domain="test") mock_setup_entry = AsyncMock(side_effect=ConfigEntryNotReady) mock_integration(hass, MockModule("test", async_setup_entry=mock_setup_entry)) mock_entity_platform(hass, "c...
[ "async", "def", "test_setup_raise_not_ready", "(", "hass", ",", "caplog", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ")", "mock_setup_entry", "=", "AsyncMock", "(", "side_effect", "=", "ConfigEntryNotReady", ")", "mock_integration", ...
[ 792, 0 ]
[ 815, 59 ]
python
en
['en', 'hu', 'en']
True
test_setup_retrying_during_unload
(hass)
Test if we unload an entry that is in retry mode.
Test if we unload an entry that is in retry mode.
async def test_setup_retrying_during_unload(hass): """Test if we unload an entry that is in retry mode.""" entry = MockConfigEntry(domain="test") mock_setup_entry = AsyncMock(side_effect=ConfigEntryNotReady) mock_integration(hass, MockModule("test", async_setup_entry=mock_setup_entry)) mock_entity_...
[ "async", "def", "test_setup_retrying_during_unload", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ")", "mock_setup_entry", "=", "AsyncMock", "(", "side_effect", "=", "ConfigEntryNotReady", ")", "mock_integration", "(", "has...
[ 818, 0 ]
[ 835, 54 ]
python
en
['en', 'en', 'en']
True
test_entry_options
(hass, manager)
Test that we can set options on an entry.
Test that we can set options on an entry.
async def test_entry_options(hass, manager): """Test that we can set options on an entry.""" entry = MockConfigEntry(domain="test", data={"first": True}, options=None) entry.add_to_manager(manager) class TestFlow: """Test flow.""" @staticmethod @callback def async_get_o...
[ "async", "def", "test_entry_options", "(", "hass", ",", "manager", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "\"first\"", ":", "True", "}", ",", "options", "=", "None", ")", "entry", ".", "add_to_ma...
[ 838, 0 ]
[ 869, 44 ]
python
en
['en', 'en', 'en']
True
test_entry_options_abort
(hass, manager)
Test that we can abort options flow.
Test that we can abort options flow.
async def test_entry_options_abort(hass, manager): """Test that we can abort options flow.""" entry = MockConfigEntry(domain="test", data={"first": True}, options=None) entry.add_to_manager(manager) class TestFlow: """Test flow.""" @staticmethod @callback def async_get_...
[ "async", "def", "test_entry_options_abort", "(", "hass", ",", "manager", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "\"first\"", ":", "True", "}", ",", "options", "=", "None", ")", "entry", ".", "add...
[ 872, 0 ]
[ 899, 5 ]
python
en
['en', 'en', 'en']
True
test_entry_setup_succeed
(hass, manager)
Test that we can setup an entry.
Test that we can setup an entry.
async def test_entry_setup_succeed(hass, manager): """Test that we can setup an entry.""" entry = MockConfigEntry(domain="comp", state=config_entries.ENTRY_STATE_NOT_LOADED) entry.add_to_hass(hass) mock_setup = AsyncMock(return_value=True) mock_setup_entry = AsyncMock(return_value=True) mock_i...
[ "async", "def", "test_entry_setup_succeed", "(", "hass", ",", "manager", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "state", "=", "config_entries", ".", "ENTRY_STATE_NOT_LOADED", ")", "entry", ".", "add_to_hass", "(", "hass",...
[ 902, 0 ]
[ 919, 59 ]
python
en
['en', 'en', 'en']
True
test_entry_setup_invalid_state
(hass, manager, state)
Test that we cannot setup an entry with invalid state.
Test that we cannot setup an entry with invalid state.
async def test_entry_setup_invalid_state(hass, manager, state): """Test that we cannot setup an entry with invalid state.""" entry = MockConfigEntry(domain="comp", state=state) entry.add_to_hass(hass) mock_setup = AsyncMock(return_value=True) mock_setup_entry = AsyncMock(return_value=True) moc...
[ "async", "def", "test_entry_setup_invalid_state", "(", "hass", ",", "manager", ",", "state", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "state", "=", "state", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "mock_setu...
[ 932, 0 ]
[ 950, 31 ]
python
en
['en', 'en', 'en']
True
test_entry_unload_succeed
(hass, manager)
Test that we can unload an entry.
Test that we can unload an entry.
async def test_entry_unload_succeed(hass, manager): """Test that we can unload an entry.""" entry = MockConfigEntry(domain="comp", state=config_entries.ENTRY_STATE_LOADED) entry.add_to_hass(hass) async_unload_entry = AsyncMock(return_value=True) mock_integration(hass, MockModule("comp", async_unlo...
[ "async", "def", "test_entry_unload_succeed", "(", "hass", ",", "manager", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "state", "=", "config_entries", ".", "ENTRY_STATE_LOADED", ")", "entry", ".", "add_to_hass", "(", "hass", ...
[ 953, 0 ]
[ 964, 63 ]
python
en
['en', 'en', 'en']
True
test_entry_unload_failed_to_load
(hass, manager, state)
Test that we can unload an entry.
Test that we can unload an entry.
async def test_entry_unload_failed_to_load(hass, manager, state): """Test that we can unload an entry.""" entry = MockConfigEntry(domain="comp", state=state) entry.add_to_hass(hass) async_unload_entry = AsyncMock(return_value=True) mock_integration(hass, MockModule("comp", async_unload_entry=async...
[ "async", "def", "test_entry_unload_failed_to_load", "(", "hass", ",", "manager", ",", "state", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "state", "=", "state", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "async_u...
[ 975, 0 ]
[ 986, 63 ]
python
en
['en', 'en', 'en']
True
test_entry_unload_invalid_state
(hass, manager, state)
Test that we cannot unload an entry with invalid state.
Test that we cannot unload an entry with invalid state.
async def test_entry_unload_invalid_state(hass, manager, state): """Test that we cannot unload an entry with invalid state.""" entry = MockConfigEntry(domain="comp", state=state) entry.add_to_hass(hass) async_unload_entry = AsyncMock(return_value=True) mock_integration(hass, MockModule("comp", asy...
[ "async", "def", "test_entry_unload_invalid_state", "(", "hass", ",", "manager", ",", "state", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "state", "=", "state", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "async_un...
[ 996, 0 ]
[ 1009, 31 ]
python
en
['en', 'en', 'en']
True
test_entry_reload_succeed
(hass, manager)
Test that we can reload an entry.
Test that we can reload an entry.
async def test_entry_reload_succeed(hass, manager): """Test that we can reload an entry.""" entry = MockConfigEntry(domain="comp", state=config_entries.ENTRY_STATE_LOADED) entry.add_to_hass(hass) async_setup = AsyncMock(return_value=True) async_setup_entry = AsyncMock(return_value=True) async_u...
[ "async", "def", "test_entry_reload_succeed", "(", "hass", ",", "manager", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "state", "=", "config_entries", ".", "ENTRY_STATE_LOADED", ")", "entry", ".", "add_to_hass", "(", "hass", ...
[ 1012, 0 ]
[ 1036, 59 ]
python
en
['en', 'en', 'en']
True
test_entry_reload_not_loaded
(hass, manager, state)
Test that we can reload an entry.
Test that we can reload an entry.
async def test_entry_reload_not_loaded(hass, manager, state): """Test that we can reload an entry.""" entry = MockConfigEntry(domain="comp", state=state) entry.add_to_hass(hass) async_setup = AsyncMock(return_value=True) async_setup_entry = AsyncMock(return_value=True) async_unload_entry = Asyn...
[ "async", "def", "test_entry_reload_not_loaded", "(", "hass", ",", "manager", ",", "state", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "state", "=", "state", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "async_setup...
[ 1047, 0 ]
[ 1071, 59 ]
python
en
['en', 'en', 'en']
True
test_entry_reload_error
(hass, manager, state)
Test that we can reload an entry.
Test that we can reload an entry.
async def test_entry_reload_error(hass, manager, state): """Test that we can reload an entry.""" entry = MockConfigEntry(domain="comp", state=state) entry.add_to_hass(hass) async_setup = AsyncMock(return_value=True) async_setup_entry = AsyncMock(return_value=True) async_unload_entry = AsyncMock...
[ "async", "def", "test_entry_reload_error", "(", "hass", ",", "manager", ",", "state", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "state", "=", "state", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "async_setup", ...
[ 1081, 0 ]
[ 1107, 31 ]
python
en
['en', 'en', 'en']
True
test_init_custom_integration
(hass)
Test initializing flow for custom integration.
Test initializing flow for custom integration.
async def test_init_custom_integration(hass): """Test initializing flow for custom integration.""" integration = loader.Integration( hass, "custom_components.hue", None, {"name": "Hue", "dependencies": [], "requirements": [], "domain": "hue"}, ) with pytest.raises(data_en...
[ "async", "def", "test_init_custom_integration", "(", "hass", ")", ":", "integration", "=", "loader", ".", "Integration", "(", "hass", ",", "\"custom_components.hue\"", ",", "None", ",", "{", "\"name\"", ":", "\"Hue\"", ",", "\"dependencies\"", ":", "[", "]", "...
[ 1110, 0 ]
[ 1123, 60 ]
python
en
['en', 'no', 'en']
True
test_support_entry_unload
(hass)
Test unloading entry.
Test unloading entry.
async def test_support_entry_unload(hass): """Test unloading entry.""" assert await config_entries.support_entry_unload(hass, "light") assert not await config_entries.support_entry_unload(hass, "auth")
[ "async", "def", "test_support_entry_unload", "(", "hass", ")", ":", "assert", "await", "config_entries", ".", "support_entry_unload", "(", "hass", ",", "\"light\"", ")", "assert", "not", "await", "config_entries", ".", "support_entry_unload", "(", "hass", ",", "\"...
[ 1126, 0 ]
[ 1129, 70 ]
python
de
['de', 'no', 'en']
False
test_reload_entry_entity_registry_ignores_no_entry
(hass)
Test reloading entry in entity registry skips if no config entry linked.
Test reloading entry in entity registry skips if no config entry linked.
async def test_reload_entry_entity_registry_ignores_no_entry(hass): """Test reloading entry in entity registry skips if no config entry linked.""" handler = config_entries.EntityRegistryDisabledHandler(hass) registry = mock_registry(hass) # Test we ignore entities without config entry entry = regis...
[ "async", "def", "test_reload_entry_entity_registry_ignores_no_entry", "(", "hass", ")", ":", "handler", "=", "config_entries", ".", "EntityRegistryDisabledHandler", "(", "hass", ")", "registry", "=", "mock_registry", "(", "hass", ")", "# Test we ignore entities without conf...
[ 1132, 0 ]
[ 1142, 45 ]
python
en
['en', 'en', 'en']
True
test_reload_entry_entity_registry_works
(hass)
Test we schedule an entry to be reloaded if disabled_by is updated.
Test we schedule an entry to be reloaded if disabled_by is updated.
async def test_reload_entry_entity_registry_works(hass): """Test we schedule an entry to be reloaded if disabled_by is updated.""" handler = config_entries.EntityRegistryDisabledHandler(hass) handler.async_setup() registry = mock_registry(hass) config_entry = MockConfigEntry( domain="comp",...
[ "async", "def", "test_reload_entry_entity_registry_works", "(", "hass", ")", ":", "handler", "=", "config_entries", ".", "EntityRegistryDisabledHandler", "(", "hass", ")", "handler", ".", "async_setup", "(", ")", "registry", "=", "mock_registry", "(", "hass", ")", ...
[ 1145, 0 ]
[ 1195, 49 ]
python
en
['en', 'en', 'en']
True
test_unqiue_id_persisted
(hass, manager)
Test that a unique ID is stored in the config entry.
Test that a unique ID is stored in the config entry.
async def test_unqiue_id_persisted(hass, manager): """Test that a unique ID is stored in the config entry.""" mock_setup_entry = AsyncMock(return_value=True) mock_integration(hass, MockModule("comp", async_setup_entry=mock_setup_entry)) mock_entity_platform(hass, "config_flow.comp", None) class Te...
[ "async", "def", "test_unqiue_id_persisted", "(", "hass", ",", "manager", ")", ":", "mock_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ",", "async_setup_entry", "=", "m...
[ 1198, 0 ]
[ 1224, 48 ]
python
en
['en', 'en', 'en']
True
test_unique_id_existing_entry
(hass, manager)
Test that we remove an entry if there already is an entry with unique ID.
Test that we remove an entry if there already is an entry with unique ID.
async def test_unique_id_existing_entry(hass, manager): """Test that we remove an entry if there already is an entry with unique ID.""" hass.config.components.add("comp") MockConfigEntry( domain="comp", state=config_entries.ENTRY_STATE_LOADED, unique_id="mock-unique-id", ).add_to...
[ "async", "def", "test_unique_id_existing_entry", "(", "hass", ",", "manager", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "\"comp\"", ")", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "state", "=", "config_entries", ".", "...
[ 1227, 0 ]
[ 1277, 50 ]
python
en
['en', 'en', 'en']
True
test_unique_id_update_existing_entry_without_reload
(hass, manager)
Test that we update an entry if there already is an entry with unique ID.
Test that we update an entry if there already is an entry with unique ID.
async def test_unique_id_update_existing_entry_without_reload(hass, manager): """Test that we update an entry if there already is an entry with unique ID.""" hass.config.components.add("comp") entry = MockConfigEntry( domain="comp", data={"additional": "data", "host": "0.0.0.0"}, uni...
[ "async", "def", "test_unique_id_update_existing_entry_without_reload", "(", "hass", ",", "manager", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "\"comp\"", ")", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "data"...
[ 1280, 0 ]
[ 1321, 44 ]
python
en
['en', 'en', 'en']
True
test_unique_id_update_existing_entry_with_reload
(hass, manager)
Test that we update an entry if there already is an entry with unique ID and we reload on changes.
Test that we update an entry if there already is an entry with unique ID and we reload on changes.
async def test_unique_id_update_existing_entry_with_reload(hass, manager): """Test that we update an entry if there already is an entry with unique ID and we reload on changes.""" hass.config.components.add("comp") entry = MockConfigEntry( domain="comp", data={"additional": "data", "host": "...
[ "async", "def", "test_unique_id_update_existing_entry_with_reload", "(", "hass", ",", "manager", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "\"comp\"", ")", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "data", ...
[ 1324, 0 ]
[ 1383, 44 ]
python
en
['en', 'en', 'en']
True
test_unique_id_not_update_existing_entry
(hass, manager)
Test that we do not update an entry if existing entry has the data.
Test that we do not update an entry if existing entry has the data.
async def test_unique_id_not_update_existing_entry(hass, manager): """Test that we do not update an entry if existing entry has the data.""" hass.config.components.add("comp") entry = MockConfigEntry( domain="comp", data={"additional": "data", "host": "0.0.0.0"}, unique_id="mock-uniq...
[ "async", "def", "test_unique_id_not_update_existing_entry", "(", "hass", ",", "manager", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "\"comp\"", ")", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "data", "=", ...
[ 1386, 0 ]
[ 1426, 44 ]
python
en
['en', 'en', 'en']
True
test_unique_id_in_progress
(hass, manager)
Test that we abort if there is already a flow in progress with same unique id.
Test that we abort if there is already a flow in progress with same unique id.
async def test_unique_id_in_progress(hass, manager): """Test that we abort if there is already a flow in progress with same unique id.""" mock_integration(hass, MockModule("comp")) mock_entity_platform(hass, "config_flow.comp", None) class TestFlow(config_entries.ConfigFlow): """Test flow.""" ...
[ "async", "def", "test_unique_id_in_progress", "(", "hass", ",", "manager", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ")", ")", "mock_entity_platform", "(", "hass", ",", "\"config_flow.comp\"", ",", "None", ")", "class", "Test...
[ 1429, 0 ]
[ 1457, 53 ]
python
en
['en', 'en', 'en']
True
test_finish_flow_aborts_progress
(hass, manager)
Test that when finishing a flow, we abort other flows in progress with unique ID.
Test that when finishing a flow, we abort other flows in progress with unique ID.
async def test_finish_flow_aborts_progress(hass, manager): """Test that when finishing a flow, we abort other flows in progress with unique ID.""" mock_integration( hass, MockModule("comp", async_setup_entry=AsyncMock(return_value=True)), ) mock_entity_platform(hass, "config_flow.comp", ...
[ "async", "def", "test_finish_flow_aborts_progress", "(", "hass", ",", "manager", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ",", "async_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", ")", ",", ")", "m...
[ 1460, 0 ]
[ 1496, 62 ]
python
en
['en', 'en', 'en']
True
test_unique_id_ignore
(hass, manager)
Test that we can ignore flows that are in progress and have a unique ID.
Test that we can ignore flows that are in progress and have a unique ID.
async def test_unique_id_ignore(hass, manager): """Test that we can ignore flows that are in progress and have a unique ID.""" async_setup_entry = AsyncMock(return_value=False) mock_integration(hass, MockModule("comp", async_setup_entry=async_setup_entry)) mock_entity_platform(hass, "config_flow.comp", ...
[ "async", "def", "test_unique_id_ignore", "(", "hass", ",", "manager", ")", ":", "async_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "False", ")", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ",", "async_setup_entry", "=", "as...
[ 1499, 0 ]
[ 1538, 46 ]
python
en
['en', 'en', 'en']
True
test_unignore_step_form
(hass, manager)
Test that we can ignore flows that are in progress and have a unique ID, then rediscover them.
Test that we can ignore flows that are in progress and have a unique ID, then rediscover them.
async def test_unignore_step_form(hass, manager): """Test that we can ignore flows that are in progress and have a unique ID, then rediscover them.""" async_setup_entry = AsyncMock(return_value=True) mock_integration(hass, MockModule("comp", async_setup_entry=async_setup_entry)) mock_entity_platform(has...
[ "async", "def", "test_unignore_step_form", "(", "hass", ",", "manager", ")", ":", "async_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ",", "async_setup_entry", "=", "a...
[ 1541, 0 ]
[ 1582, 66 ]
python
en
['en', 'en', 'en']
True
test_unignore_create_entry
(hass, manager)
Test that we can ignore flows that are in progress and have a unique ID, then rediscover them.
Test that we can ignore flows that are in progress and have a unique ID, then rediscover them.
async def test_unignore_create_entry(hass, manager): """Test that we can ignore flows that are in progress and have a unique ID, then rediscover them.""" async_setup_entry = AsyncMock(return_value=True) mock_integration(hass, MockModule("comp", async_setup_entry=async_setup_entry)) mock_entity_platform(...
[ "async", "def", "test_unignore_create_entry", "(", "hass", ",", "manager", ")", ":", "async_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ",", "async_setup_entry", "=", ...
[ 1585, 0 ]
[ 1629, 66 ]
python
en
['en', 'en', 'en']
True
test_unignore_default_impl
(hass, manager)
Test that resdicovery is a no-op by default.
Test that resdicovery is a no-op by default.
async def test_unignore_default_impl(hass, manager): """Test that resdicovery is a no-op by default.""" async_setup_entry = AsyncMock(return_value=True) mock_integration(hass, MockModule("comp", async_setup_entry=async_setup_entry)) mock_entity_platform(hass, "config_flow.comp", None) class TestFlo...
[ "async", "def", "test_unignore_default_impl", "(", "hass", ",", "manager", ")", ":", "async_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ",", "async_setup_entry", "=", ...
[ 1632, 0 ]
[ 1660, 66 ]
python
en
['en', 'en', 'en']
True
test_partial_flows_hidden
(hass, manager)
Test that flows that don't have a cur_step and haven't finished initing are hidden.
Test that flows that don't have a cur_step and haven't finished initing are hidden.
async def test_partial_flows_hidden(hass, manager): """Test that flows that don't have a cur_step and haven't finished initing are hidden.""" async_setup_entry = AsyncMock(return_value=True) mock_integration(hass, MockModule("comp", async_setup_entry=async_setup_entry)) mock_entity_platform(hass, "confi...
[ "async", "def", "test_partial_flows_hidden", "(", "hass", ",", "manager", ")", ":", "async_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ",", "async_setup_entry", "=", ...
[ 1663, 0 ]
[ 1719, 32 ]
python
en
['en', 'en', 'en']
True
test_async_setup_init_entry
(hass)
Test a config entry being initialized during integration setup.
Test a config entry being initialized during integration setup.
async def test_async_setup_init_entry(hass): """Test a config entry being initialized during integration setup.""" async def mock_async_setup(hass, config): """Mock setup.""" hass.async_create_task( hass.config_entries.flow.async_init( "comp", context...
[ "async", "def", "test_async_setup_init_entry", "(", "hass", ")", ":", "async", "def", "mock_async_setup", "(", "hass", ",", "config", ")", ":", "\"\"\"Mock setup.\"\"\"", "hass", ".", "async_create_task", "(", "hass", ".", "config_entries", ".", "flow", ".", "as...
[ 1722, 0 ]
[ 1764, 68 ]
python
en
['en', 'en', 'en']
True
test_async_setup_update_entry
(hass)
Test a config entry being updated during integration setup.
Test a config entry being updated during integration setup.
async def test_async_setup_update_entry(hass): """Test a config entry being updated during integration setup.""" entry = MockConfigEntry(domain="comp", data={"value": "initial"}) entry.add_to_hass(hass) async def mock_async_setup(hass, config): """Mock setup.""" hass.async_create_task( ...
[ "async", "def", "test_async_setup_update_entry", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "data", "=", "{", "\"value\"", ":", "\"initial\"", "}", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "async",...
[ 1767, 0 ]
[ 1820, 54 ]
python
en
['en', 'en', 'en']
True
test_flow_with_default_discovery
(hass, manager, discovery_source)
Test that finishing a default discovery flow removes the unique ID in the entry.
Test that finishing a default discovery flow removes the unique ID in the entry.
async def test_flow_with_default_discovery(hass, manager, discovery_source): """Test that finishing a default discovery flow removes the unique ID in the entry.""" mock_integration( hass, MockModule("comp", async_setup_entry=AsyncMock(return_value=True)), ) mock_entity_platform(hass, "co...
[ "async", "def", "test_flow_with_default_discovery", "(", "hass", ",", "manager", ",", "discovery_source", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ",", "async_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", "...
[ 1833, 0 ]
[ 1878, 34 ]
python
en
['en', 'en', 'en']
True
test_flow_with_default_discovery_with_unique_id
(hass, manager)
Test discovery flow using the default discovery is ignored when unique ID is set.
Test discovery flow using the default discovery is ignored when unique ID is set.
async def test_flow_with_default_discovery_with_unique_id(hass, manager): """Test discovery flow using the default discovery is ignored when unique ID is set.""" mock_integration(hass, MockModule("comp")) mock_entity_platform(hass, "config_flow.comp", None) class TestFlow(config_entries.ConfigFlow): ...
[ "async", "def", "test_flow_with_default_discovery_with_unique_id", "(", "hass", ",", "manager", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ")", ")", "mock_entity_platform", "(", "hass", ",", "\"config_flow.comp\"", ",", "None", ")...
[ 1881, 0 ]
[ 1906, 63 ]
python
en
['en', 'en', 'en']
True
test_default_discovery_abort_existing_entries
(hass, manager)
Test that a flow without discovery implementation aborts when a config entry exists.
Test that a flow without discovery implementation aborts when a config entry exists.
async def test_default_discovery_abort_existing_entries(hass, manager): """Test that a flow without discovery implementation aborts when a config entry exists.""" hass.config.components.add("comp") entry = MockConfigEntry(domain="comp", data={}, unique_id="mock-unique-id") entry.add_to_hass(hass) m...
[ "async", "def", "test_default_discovery_abort_existing_entries", "(", "hass", ",", "manager", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "\"comp\"", ")", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"comp\"", ",", "data", "=...
[ 1909, 0 ]
[ 1928, 55 ]
python
en
['en', 'en', 'en']
True
test_default_discovery_in_progress
(hass, manager)
Test that a flow using default discovery can only be triggered once.
Test that a flow using default discovery can only be triggered once.
async def test_default_discovery_in_progress(hass, manager): """Test that a flow using default discovery can only be triggered once.""" mock_integration(hass, MockModule("comp")) mock_entity_platform(hass, "config_flow.comp", None) class TestFlow(config_entries.ConfigFlow): """Test flow.""" ...
[ "async", "def", "test_default_discovery_in_progress", "(", "hass", ",", "manager", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ")", ")", "mock_entity_platform", "(", "hass", ",", "\"config_flow.comp\"", ",", "None", ")", "class",...
[ 1931, 0 ]
[ 1963, 63 ]
python
en
['en', 'en', 'en']
True
test_default_discovery_abort_on_new_unique_flow
(hass, manager)
Test that a flow using default discovery is aborted when a second flow with unique ID is created.
Test that a flow using default discovery is aborted when a second flow with unique ID is created.
async def test_default_discovery_abort_on_new_unique_flow(hass, manager): """Test that a flow using default discovery is aborted when a second flow with unique ID is created.""" mock_integration(hass, MockModule("comp")) mock_entity_platform(hass, "config_flow.comp", None) class TestFlow(config_entries...
[ "async", "def", "test_default_discovery_abort_on_new_unique_flow", "(", "hass", ",", "manager", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"comp\"", ")", ")", "mock_entity_platform", "(", "hass", ",", "\"config_flow.comp\"", ",", "None", ")...
[ 1966, 0 ]
[ 2000, 63 ]
python
en
['en', 'en', 'en']
True
test_updating_entry_with_and_without_changes
(manager)
Test that we can update an entry data.
Test that we can update an entry data.
async def test_updating_entry_with_and_without_changes(manager): """Test that we can update an entry data.""" entry = MockConfigEntry( domain="test", data={"first": True}, title="thetitle", options={"option": True}, unique_id="abc123", state=config_entries.ENTRY_S...
[ "async", "def", "test_updating_entry_with_and_without_changes", "(", "manager", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "\"first\"", ":", "True", "}", ",", "title", "=", "\"thetitle\"", ",", "options", ...
[ 2003, 0 ]
[ 2057, 73 ]
python
en
['en', 'en', 'en']
True
mock_controller_service
()
Mock a successful service.
Mock a successful service.
def mock_controller_service(): """Mock a successful service.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.information.serial = SERIAL service_mock.return_value.utilisation.cpu_user_load = 1 service...
[ "def", "mock_controller_service", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.synology_dsm.config_flow.SynologyDSM\"", ")", "as", "service_mock", ":", "service_mock", ".", "return_value", ".", "information", ".", "serial", "=", "SERIAL", "service_mock...
[ 57, 0 ]
[ 67, 26 ]
python
en
['en', 'ro', 'en']
True
mock_controller_service_2sa
()
Mock a successful service with 2SA login.
Mock a successful service with 2SA login.
def mock_controller_service_2sa(): """Mock a successful service with 2SA login.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.login = Mock( side_effect=SynologyDSMLogin2SARequiredException(USERNAME) ...
[ "def", "mock_controller_service_2sa", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.synology_dsm.config_flow.SynologyDSM\"", ")", "as", "service_mock", ":", "service_mock", ".", "return_value", ".", "login", "=", "Mock", "(", "side_effect", "=", "Syno...
[ 71, 0 ]
[ 84, 26 ]
python
en
['en', 'en', 'en']
True
mock_controller_service_vdsm
()
Mock a successful service.
Mock a successful service.
def mock_controller_service_vdsm(): """Mock a successful service.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.information.serial = SERIAL service_mock.return_value.utilisation.cpu_user_load = 1 se...
[ "def", "mock_controller_service_vdsm", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.synology_dsm.config_flow.SynologyDSM\"", ")", "as", "service_mock", ":", "service_mock", ".", "return_value", ".", "information", ".", "serial", "=", "SERIAL", "service...
[ 88, 0 ]
[ 98, 26 ]
python
en
['en', 'ro', 'en']
True
mock_controller_service_failed
()
Mock a failed service.
Mock a failed service.
def mock_controller_service_failed(): """Mock a failed service.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.information.serial = None service_mock.return_value.utilisation.cpu_user_load = None ser...
[ "def", "mock_controller_service_failed", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.synology_dsm.config_flow.SynologyDSM\"", ")", "as", "service_mock", ":", "service_mock", ".", "return_value", ".", "information", ".", "serial", "=", "None", "service...
[ 102, 0 ]
[ 112, 26 ]
python
en
['en', 'ga', 'en']
True
test_user
(hass: HomeAssistantType, service: MagicMock)
Test user config.
Test user config.
async def test_user(hass: HomeAssistantType, service: MagicMock): """Test user config.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=None ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user" ...
[ "async", "def", "test_user", "(", "hass", ":", "HomeAssistantType", ",", "service", ":", "MagicMock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":...
[ 115, 0 ]
[ 175, 51 ]
python
en
['en', 'da', 'en']
True
test_user_2sa
(hass: HomeAssistantType, service_2sa: MagicMock)
Test user with 2sa authentication config.
Test user with 2sa authentication config.
async def test_user_2sa(hass: HomeAssistantType, service_2sa: MagicMock): """Test user with 2sa authentication config.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD},...
[ "async", "def", "test_user_2sa", "(", "hass", ":", "HomeAssistantType", ",", "service_2sa", ":", "MagicMock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\...
[ 178, 0 ]
[ 218, 51 ]
python
en
['en', 'en', 'en']
True
test_user_vdsm
(hass: HomeAssistantType, service_vdsm: MagicMock)
Test user config.
Test user config.
async def test_user_vdsm(hass: HomeAssistantType, service_vdsm: MagicMock): """Test user config.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=None ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "...
[ "async", "def", "test_user_vdsm", "(", "hass", ":", "HomeAssistantType", ",", "service_vdsm", ":", "MagicMock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"sourc...
[ 221, 0 ]
[ 254, 51 ]
python
en
['en', 'da', 'en']
True
test_import
(hass: HomeAssistantType, service: MagicMock)
Test import step.
Test import step.
async def test_import(hass: HomeAssistantType, service: MagicMock): """Test import step.""" # import with minimum setup result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWO...
[ "async", "def", "test_import", "(", "hass", ":", "HomeAssistantType", ",", "service", ":", "MagicMock", ")", ":", "# import with minimum setup", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context",...
[ 257, 0 ]
[ 307, 55 ]
python
de
['de', 'sd', 'en']
False
test_abort_if_already_setup
(hass: HomeAssistantType, service: MagicMock)
Test we abort if the account is already setup.
Test we abort if the account is already setup.
async def test_abort_if_already_setup(hass: HomeAssistantType, service: MagicMock): """Test we abort if the account is already setup.""" MockConfigEntry( domain=DOMAIN, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, unique_id=SERIAL, ).add_to_hass(hass) ...
[ "async", "def", "test_abort_if_already_setup", "(", "hass", ":", "HomeAssistantType", ",", "service", ":", "MagicMock", ")", ":", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_HOST", ":", "HOST", ",", "CONF_USERNAME", ":", "USER...
[ 310, 0 ]
[ 334, 51 ]
python
en
['en', 'en', 'en']
True
test_login_failed
(hass: HomeAssistantType, service: MagicMock)
Test when we have errors during login.
Test when we have errors during login.
async def test_login_failed(hass: HomeAssistantType, service: MagicMock): """Test when we have errors during login.""" service.return_value.login = Mock( side_effect=(SynologyDSMLoginInvalidException(USERNAME)) ) result = await hass.config_entries.flow.async_init( DOMAIN, contex...
[ "async", "def", "test_login_failed", "(", "hass", ":", "HomeAssistantType", ",", "service", ":", "MagicMock", ")", ":", "service", ".", "return_value", ".", "login", "=", "Mock", "(", "side_effect", "=", "(", "SynologyDSMLoginInvalidException", "(", "USERNAME", ...
[ 337, 0 ]
[ 349, 62 ]
python
en
['en', 'en', 'en']
True
test_connection_failed
(hass: HomeAssistantType, service: MagicMock)
Test when we have errors during connection.
Test when we have errors during connection.
async def test_connection_failed(hass: HomeAssistantType, service: MagicMock): """Test when we have errors during connection.""" service.return_value.login = Mock( side_effect=SynologyDSMRequestException(IOError("arg")) ) result = await hass.config_entries.flow.async_init( DOMAIN, ...
[ "async", "def", "test_connection_failed", "(", "hass", ":", "HomeAssistantType", ",", "service", ":", "MagicMock", ")", ":", "service", ".", "return_value", ".", "login", "=", "Mock", "(", "side_effect", "=", "SynologyDSMRequestException", "(", "IOError", "(", "...
[ 352, 0 ]
[ 365, 60 ]
python
en
['en', 'en', 'en']
True
test_unknown_failed
(hass: HomeAssistantType, service: MagicMock)
Test when we have an unknown error.
Test when we have an unknown error.
async def test_unknown_failed(hass: HomeAssistantType, service: MagicMock): """Test when we have an unknown error.""" service.return_value.login = Mock(side_effect=SynologyDSMException(None, None)) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, ...
[ "async", "def", "test_unknown_failed", "(", "hass", ":", "HomeAssistantType", ",", "service", ":", "MagicMock", ")", ":", "service", ".", "return_value", ".", "login", "=", "Mock", "(", "side_effect", "=", "SynologyDSMException", "(", "None", ",", "None", ")",...
[ 368, 0 ]
[ 379, 50 ]
python
en
['en', 'de', 'en']
True
test_missing_data_after_login
( hass: HomeAssistantType, service_failed: MagicMock )
Test when we have errors during connection.
Test when we have errors during connection.
async def test_missing_data_after_login( hass: HomeAssistantType, service_failed: MagicMock ): """Test when we have errors during connection.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME...
[ "async", "def", "test_missing_data_after_login", "(", "hass", ":", "HomeAssistantType", ",", "service_failed", ":", "MagicMock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", ...
[ 382, 0 ]
[ 392, 55 ]
python
en
['en', 'en', 'en']
True
test_form_ssdp_already_configured
( hass: HomeAssistantType, service: MagicMock )
Test ssdp abort when the serial number is already configured.
Test ssdp abort when the serial number is already configured.
async def test_form_ssdp_already_configured( hass: HomeAssistantType, service: MagicMock ): """Test ssdp abort when the serial number is already configured.""" await setup.async_setup_component(hass, "persistent_notification", {}) MockConfigEntry( domain=DOMAIN, data={ CONF_...
[ "async", "def", "test_form_ssdp_already_configured", "(", "hass", ":", "HomeAssistantType", ",", "service", ":", "MagicMock", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "MockConfigEn...
[ 395, 0 ]
[ 421, 62 ]
python
en
['en', 'en', 'en']
True
test_form_ssdp
(hass: HomeAssistantType, service: MagicMock)
Test we can setup from ssdp.
Test we can setup from ssdp.
async def test_form_ssdp(hass: HomeAssistantType, service: MagicMock): """Test we can setup from ssdp.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data={ ...
[ "async", "def", "test_form_ssdp", "(", "hass", ":", "HomeAssistantType", ",", "service", ":", "MagicMock", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "h...
[ 424, 0 ]
[ 457, 51 ]
python
en
['en', 'en', 'en']
True
test_options_flow
(hass: HomeAssistantType, service: MagicMock)
Test config flow options.
Test config flow options.
async def test_options_flow(hass: HomeAssistantType, service: MagicMock): """Test config flow options.""" config_entry = MockConfigEntry( domain=DOMAIN, data={ CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD, CONF_MAC: MACS, ...
[ "async", "def", "test_options_flow", "(", "hass", ":", "HomeAssistantType", ",", "service", ":", "MagicMock", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_HOST", ":", "HOST", ",", "CONF_USERNAME",...
[ 460, 0 ]
[ 498, 51 ]
python
en
['en', 'fr', 'en']
True
OpenThermGwConfigFlow.async_get_options_flow
(config_entry)
Get the options flow for this handler.
Get the options flow for this handler.
def async_get_options_flow(config_entry): """Get the options flow for this handler.""" return OpenThermGwOptionsFlow(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "OpenThermGwOptionsFlow", "(", "config_entry", ")" ]
[ 32, 4 ]
[ 34, 51 ]
python
en
['en', 'en', 'en']
True
OpenThermGwConfigFlow.async_step_init
(self, info=None)
Handle config flow initiation.
Handle config flow initiation.
async def async_step_init(self, info=None): """Handle config flow initiation.""" if info: name = info[CONF_NAME] device = info[CONF_DEVICE] gw_id = cv.slugify(info.get(CONF_ID, name)) entries = [e.data for e in self.hass.config_entries.async_entries(DOMAI...
[ "async", "def", "async_step_init", "(", "self", ",", "info", "=", "None", ")", ":", "if", "info", ":", "name", "=", "info", "[", "CONF_NAME", "]", "device", "=", "info", "[", "CONF_DEVICE", "]", "gw_id", "=", "cv", ".", "slugify", "(", "info", ".", ...
[ 36, 4 ]
[ 66, 32 ]
python
en
['en', 'en', 'en']
True
OpenThermGwConfigFlow.async_step_user
(self, user_input=None)
Handle manual initiation of the config flow.
Handle manual initiation of the config flow.
async def async_step_user(self, user_input=None): """Handle manual initiation of the config flow.""" return await self.async_step_init(user_input)
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "return", "await", "self", ".", "async_step_init", "(", "user_input", ")" ]
[ 68, 4 ]
[ 70, 53 ]
python
en
['en', 'en', 'en']
True
OpenThermGwConfigFlow.async_step_import
(self, import_config)
Import an OpenTherm Gateway device as a config entry. This flow is triggered by `async_setup` for configured devices.
Import an OpenTherm Gateway device as a config entry.
async def async_step_import(self, import_config): """ Import an OpenTherm Gateway device as a config entry. This flow is triggered by `async_setup` for configured devices. """ formatted_config = { CONF_NAME: import_config.get(CONF_NAME, import_config[CONF_ID]), ...
[ "async", "def", "async_step_import", "(", "self", ",", "import_config", ")", ":", "formatted_config", "=", "{", "CONF_NAME", ":", "import_config", ".", "get", "(", "CONF_NAME", ",", "import_config", "[", "CONF_ID", "]", ")", ",", "CONF_DEVICE", ":", "import_co...
[ 72, 4 ]
[ 83, 64 ]
python
en
['en', 'error', 'th']
False
OpenThermGwConfigFlow._show_form
(self, errors=None)
Show the config flow form with possible errors.
Show the config flow form with possible errors.
def _show_form(self, errors=None): """Show the config flow form with possible errors.""" return self.async_show_form( step_id="init", data_schema=vol.Schema( { vol.Required(CONF_NAME): str, vol.Required(CONF_DEVICE): str, ...
[ "def", "_show_form", "(", "self", ",", "errors", "=", "None", ")", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"init\"", ",", "data_schema", "=", "vol", ".", "Schema", "(", "{", "vol", ".", "Required", "(", "CONF_NAME", ")", "...
[ 85, 4 ]
[ 97, 9 ]
python
en
['en', 'en', 'en']
True
OpenThermGwConfigFlow._create_entry
(self, gw_id, name, device)
Create entry for the OpenTherm Gateway device.
Create entry for the OpenTherm Gateway device.
def _create_entry(self, gw_id, name, device): """Create entry for the OpenTherm Gateway device.""" return self.async_create_entry( title=name, data={CONF_ID: gw_id, CONF_DEVICE: device, CONF_NAME: name} )
[ "def", "_create_entry", "(", "self", ",", "gw_id", ",", "name", ",", "device", ")", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "name", ",", "data", "=", "{", "CONF_ID", ":", "gw_id", ",", "CONF_DEVICE", ":", "device", ",", "CO...
[ 99, 4 ]
[ 103, 9 ]
python
en
['en', 'en', 'en']
True
OpenThermGwOptionsFlow.__init__
(self, config_entry)
Initialize the options flow.
Initialize the options flow.
def __init__(self, config_entry): """Initialize the options flow.""" self.config_entry = config_entry
[ "def", "__init__", "(", "self", ",", "config_entry", ")", ":", "self", ".", "config_entry", "=", "config_entry" ]
[ 109, 4 ]
[ 111, 40 ]
python
en
['en', 'en', 'en']
True
OpenThermGwOptionsFlow.async_step_init
(self, user_input=None)
Manage the opentherm_gw options.
Manage the opentherm_gw options.
async def async_step_init(self, user_input=None): """Manage the opentherm_gw options.""" if user_input is not None: return self.async_create_entry(title="", data=user_input) return self.async_show_form( step_id="init", data_schema=vol.Schema( ...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "\"\"", ",", "data", "=", "user_input", ")", "return", ...
[ 113, 4 ]
[ 137, 9 ]
python
en
['en', 'en', 'en']
True
get_scanner
(hass, config)
Return a mock scanner.
Return a mock scanner.
def get_scanner(hass, config): """Return a mock scanner.""" return SCANNER
[ "def", "get_scanner", "(", "hass", ",", "config", ")", ":", "return", "SCANNER" ]
[ 7, 0 ]
[ 9, 18 ]
python
en
['en', 'da', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the config entry.
Set up the config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the config entry.""" entity = MockScannerEntity() async_add_entities([entity])
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "entity", "=", "MockScannerEntity", "(", ")", "async_add_entities", "(", "[", "entity", "]", ")" ]
[ 43, 0 ]
[ 46, 32 ]
python
en
['en', 'en', 'en']
True
MockScannerEntity.source_type
(self)
Return the source type, eg gps or router, of the device.
Return the source type, eg gps or router, of the device.
def source_type(self): """Return the source type, eg gps or router, of the device.""" return SOURCE_TYPE_ROUTER
[ "def", "source_type", "(", "self", ")", ":", "return", "SOURCE_TYPE_ROUTER" ]
[ 20, 4 ]
[ 22, 33 ]
python
en
['en', 'en', 'en']
True
MockScannerEntity.battery_level
(self)
Return the battery level of the device. Percentage from 0-100.
Return the battery level of the device.
def battery_level(self): """Return the battery level of the device. Percentage from 0-100. """ return 100
[ "def", "battery_level", "(", "self", ")", ":", "return", "100" ]
[ 25, 4 ]
[ 30, 18 ]
python
en
['en', 'en', 'en']
True
MockScannerEntity.is_connected
(self)
Return true if the device is connected to the network.
Return true if the device is connected to the network.
def is_connected(self): """Return true if the device is connected to the network.""" return self.connected
[ "def", "is_connected", "(", "self", ")", ":", "return", "self", ".", "connected" ]
[ 33, 4 ]
[ 35, 29 ]
python
en
['en', 'en', 'en']
True
MockScannerEntity.set_connected
(self)
Set connected to True.
Set connected to True.
def set_connected(self): """Set connected to True.""" self.connected = True self.async_schedule_update_ha_state()
[ "def", "set_connected", "(", "self", ")", ":", "self", ".", "connected", "=", "True", "self", ".", "async_schedule_update_ha_state", "(", ")" ]
[ 37, 4 ]
[ 40, 45 ]
python
en
['en', 'en', 'en']
True
MockScanner.__init__
(self)
Initialize the MockScanner.
Initialize the MockScanner.
def __init__(self): """Initialize the MockScanner.""" self.devices_home = []
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "devices_home", "=", "[", "]" ]
[ 52, 4 ]
[ 54, 30 ]
python
en
['en', 'da', 'en']
True
MockScanner.come_home
(self, device)
Make a device come home.
Make a device come home.
def come_home(self, device): """Make a device come home.""" self.devices_home.append(device)
[ "def", "come_home", "(", "self", ",", "device", ")", ":", "self", ".", "devices_home", ".", "append", "(", "device", ")" ]
[ 56, 4 ]
[ 58, 40 ]
python
en
['es', 'it', 'en']
False
MockScanner.leave_home
(self, device)
Make a device leave the house.
Make a device leave the house.
def leave_home(self, device): """Make a device leave the house.""" self.devices_home.remove(device)
[ "def", "leave_home", "(", "self", ",", "device", ")", ":", "self", ".", "devices_home", ".", "remove", "(", "device", ")" ]
[ 60, 4 ]
[ 62, 40 ]
python
en
['en', 'en', 'en']
True
MockScanner.reset
(self)
Reset which devices are home.
Reset which devices are home.
def reset(self): """Reset which devices are home.""" self.devices_home = []
[ "def", "reset", "(", "self", ")", ":", "self", ".", "devices_home", "=", "[", "]" ]
[ 64, 4 ]
[ 66, 30 ]
python
en
['en', 'en', 'en']
True
MockScanner.scan_devices
(self)
Return a list of fake devices.
Return a list of fake devices.
def scan_devices(self): """Return a list of fake devices.""" return list(self.devices_home)
[ "def", "scan_devices", "(", "self", ")", ":", "return", "list", "(", "self", ".", "devices_home", ")" ]
[ 68, 4 ]
[ 70, 38 ]
python
en
['en', 'en', 'en']
True
MockScanner.get_device_name
(self, device)
Return a name for a mock device. Return None for dev1 for testing.
Return a name for a mock device.
def get_device_name(self, device): """Return a name for a mock device. Return None for dev1 for testing. """ return None if device == "DEV1" else device.lower()
[ "def", "get_device_name", "(", "self", ",", "device", ")", ":", "return", "None", "if", "device", "==", "\"DEV1\"", "else", "device", ".", "lower", "(", ")" ]
[ 72, 4 ]
[ 77, 59 ]
python
en
['en', 'en', 'en']
True
ConditionalEvent._decomposer
(self, event: Union[str, Tuple], suffix_tree: SuffixTree)
To generate suffix tree depending on the conditional event.
To generate suffix tree depending on the conditional event.
def _decomposer(self, event: Union[str, Tuple], suffix_tree: SuffixTree): """To generate suffix tree depending on the conditional event.""" operation_and_list = ["&&", "AND"] operation_or_list = ["||", "OR"] # Check it is unit conditional event(str) or conditional event(tuple). ...
[ "def", "_decomposer", "(", "self", ",", "event", ":", "Union", "[", "str", ",", "Tuple", "]", ",", "suffix_tree", ":", "SuffixTree", ")", ":", "operation_and_list", "=", "[", "\"&&\"", ",", "\"AND\"", "]", "operation_or_list", "=", "[", "\"||\"", ",", "\...
[ 67, 4 ]
[ 97, 93 ]
python
en
['en', 'en', 'en']
True
ConditionalEvent._unit_event_syntax_check
(self, unit_event: str)
To check unit conditional event expression. Args: unit_event (str): The description of the requisite messages.
To check unit conditional event expression.
def _unit_event_syntax_check(self, unit_event: str): """To check unit conditional event expression. Args: unit_event (str): The description of the requisite messages. """ slots = unit_event.split(":") if len(slots) != 3: raise ConditionalEventSyntaxError(...
[ "def", "_unit_event_syntax_check", "(", "self", ",", "unit_event", ":", "str", ")", ":", "slots", "=", "unit_event", ".", "split", "(", "\":\"", ")", "if", "len", "(", "slots", ")", "!=", "3", ":", "raise", "ConditionalEventSyntaxError", "(", "f\"The conditi...
[ 99, 4 ]
[ 120, 13 ]
python
en
['en', 'en', 'en']
True
ConditionalEvent._get_request_message_number
(self, unit_event: str)
To get the number of request messages by the given unit event.
To get the number of request messages by the given unit event.
def _get_request_message_number(self, unit_event: str) -> int: """To get the number of request messages by the given unit event.""" component_type, _, number = unit_event.split(":") peers_number = len(self._peers_name[component_type]) if component_type != "*" else \ len(list(itertool...
[ "def", "_get_request_message_number", "(", "self", ",", "unit_event", ":", "str", ")", "->", "int", ":", "component_type", ",", "_", ",", "number", "=", "unit_event", ".", "split", "(", "\":\"", ")", "peers_number", "=", "len", "(", "self", ".", "_peers_na...
[ 122, 4 ]
[ 135, 111 ]
python
en
['en', 'en', 'en']
True
ConditionalEvent._unit_event_satisfied
(self, unit_event: str)
To check if the given unit conditional event has been satisfied. Returns: If the unit conditional event has been satisfied, it will return the list of unit conditional event; otherwise, it will return None.
To check if the given unit conditional event has been satisfied.
def _unit_event_satisfied(self, unit_event: str) -> List[str]: """To check if the given unit conditional event has been satisfied. Returns: If the unit conditional event has been satisfied, it will return the list of unit conditional event; otherwise, it will return None. ...
[ "def", "_unit_event_satisfied", "(", "self", ",", "unit_event", ":", "str", ")", "->", "List", "[", "str", "]", ":", "request_message_number", "=", "self", ".", "_get_request_message_number", "(", "unit_event", ")", "# Check if unit conditional event dict storied enough...
[ 137, 4 ]
[ 150, 17 ]
python
en
['en', 'en', 'en']
True
ConditionalEvent._conditional_event_satisfied
(self, suffixtree)
To check if the completed conditional event been satisfied.
To check if the completed conditional event been satisfied.
def _conditional_event_satisfied(self, suffixtree) -> List[str]: """To check if the completed conditional event been satisfied.""" operation = suffixtree.value if isinstance(operation, str): return self._unit_event_satisfied(operation) result = [] for node in suffixt...
[ "def", "_conditional_event_satisfied", "(", "self", ",", "suffixtree", ")", "->", "List", "[", "str", "]", ":", "operation", "=", "suffixtree", ".", "value", "if", "isinstance", "(", "operation", ",", "str", ")", ":", "return", "self", ".", "_unit_event_sati...
[ 152, 4 ]
[ 170, 29 ]
python
en
['en', 'en', 'en']
True
ConditionalEvent.push_message
(self, message: Message)
Push message to all satisfied unit conditional events. Args: message (Message): Received message.
Push message to all satisfied unit conditional events.
def push_message(self, message: Message): """Push message to all satisfied unit conditional events. Args: message (Message): Received message. """ message_source, message_type = message.source, message.tag if isinstance(message_type, Enum): message_type ...
[ "def", "push_message", "(", "self", ",", "message", ":", "Message", ")", ":", "message_source", ",", "message_type", "=", "message", ".", "source", ",", "message", ".", "tag", "if", "isinstance", "(", "message_type", ",", "Enum", ")", ":", "message_type", ...
[ 172, 4 ]
[ 192, 73 ]
python
en
['en', 'en', 'en']
True
ConditionalEvent.get_qualified_message
(self)
Self-inspection of conditional event, if satisfied, pop qualified messages. Return: List[Message]: List of qualified messages.
Self-inspection of conditional event, if satisfied, pop qualified messages.
def get_qualified_message(self) -> List[Message]: """Self-inspection of conditional event, if satisfied, pop qualified messages. Return: List[Message]: List of qualified messages. """ message_list = [] satisfied_unit_events = self._conditional_event_satisfied(self._s...
[ "def", "get_qualified_message", "(", "self", ")", "->", "List", "[", "Message", "]", ":", "message_list", "=", "[", "]", "satisfied_unit_events", "=", "self", ".", "_conditional_event_satisfied", "(", "self", ".", "_suffix_tree", ")", "if", "satisfied_unit_events"...
[ 194, 4 ]
[ 212, 27 ]
python
en
['en', 'en', 'en']
True
ConditionalEvent.clear
(self)
Clear all messages from cache.
Clear all messages from cache.
def clear(self): """Clear all messages from cache.""" for message_cache in self._unit_event_message_dict.values(): message_cache.clear()
[ "def", "clear", "(", "self", ")", ":", "for", "message_cache", "in", "self", ".", "_unit_event_message_dict", ".", "values", "(", ")", ":", "message_cache", ".", "clear", "(", ")" ]
[ 214, 4 ]
[ 217, 33 ]
python
en
['en', 'en', 'en']
True
RegisterTable.register_event_handler
(self, event: Union[str, tuple], handler_fn: callable)
Register conditional event in the RegisterTable, and create a dict which match ``message handler`` and ``conditional event``. Args: event (str|Tuple): The description of the requisite messages' combination, handler_fn (callable): The user-define function which usually uses to ha...
Register conditional event in the RegisterTable, and create a dict which match ``message handler`` and ``conditional event``.
def register_event_handler(self, event: Union[str, tuple], handler_fn: callable): """Register conditional event in the RegisterTable, and create a dict which match ``message handler`` and ``conditional event``. Args: event (str|Tuple): The description of the requisite messages' comb...
[ "def", "register_event_handler", "(", "self", ",", "event", ":", "Union", "[", "str", ",", "tuple", "]", ",", "handler_fn", ":", "callable", ")", ":", "event", "=", "ConditionalEvent", "(", "event", ",", "self", ".", "_peers_name", ")", "self", ".", "_ev...
[ 232, 4 ]
[ 241, 52 ]
python
en
['en', 'en', 'en']
True
RegisterTable.push
(self, message: Message, auto_trigger: bool = True)
Push a newly received message into the corresponding unit event cache. If some conditional event is satisfied and ``auto_trigger`` is true, the set of messages forming the satisfied conditional event will be processed by the corresponding handler functions. Args: message (M...
Push a newly received message into the corresponding unit event cache. If some conditional event is satisfied and ``auto_trigger`` is true, the set of messages forming the satisfied conditional event will be processed by the corresponding handler functions.
def push(self, message: Message, auto_trigger: bool = True): """ Push a newly received message into the corresponding unit event cache. If some conditional event is satisfied and ``auto_trigger`` is true, the set of messages forming the satisfied conditional event will be processed by th...
[ "def", "push", "(", "self", ",", "message", ":", "Message", ",", "auto_trigger", ":", "bool", "=", "True", ")", ":", "for", "event", "in", "self", ".", "_event_handler_dict", ":", "event", ".", "push_message", "(", "message", ")", "if", "auto_trigger", "...
[ 243, 4 ]
[ 260, 97 ]
python
en
['en', 'error', 'th']
False
RegisterTable.get
(self)
If any ``conditional event`` has been satisfied, return the requisite message list and the correlational handler function. Return: List[Tuple[callable, List[Message]]]: The list of triggered handler functions and messages. E.g. [(handle_function_1, [messages]), (handle_function_...
If any ``conditional event`` has been satisfied, return the requisite message list and the correlational handler function.
def get(self) -> List[Tuple[callable, List[Message]]]: """If any ``conditional event`` has been satisfied, return the requisite message list and the correlational handler function. Return: List[Tuple[callable, List[Message]]]: The list of triggered handler functions and messages. ...
[ "def", "get", "(", "self", ")", "->", "List", "[", "Tuple", "[", "callable", ",", "List", "[", "Message", "]", "]", "]", ":", "satisfied_handler_fn", "=", "[", "]", "for", "event", ",", "handler_fn", "in", "self", ".", "_event_handler_dict", ".", "item...
[ 262, 4 ]
[ 278, 35 ]
python
en
['en', 'en', 'en']
True
RegisterTable.clear
(self)
Clear all messages from conditional event caches.
Clear all messages from conditional event caches.
def clear(self): """Clear all messages from conditional event caches.""" for event in self._event_handler_dict: event.clear()
[ "def", "clear", "(", "self", ")", ":", "for", "event", "in", "self", ".", "_event_handler_dict", ":", "event", ".", "clear", "(", ")" ]
[ 280, 4 ]
[ 283, 25 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: Config)
Configure Glances using config flow only.
Configure Glances using config flow only.
async def async_setup(hass: HomeAssistant, config: Config) -> bool: """Configure Glances using config flow only.""" if DOMAIN in config: for entry in config[DOMAIN]: hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"source": SO...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "Config", ")", "->", "bool", ":", "if", "DOMAIN", "in", "config", ":", "for", "entry", "in", "config", "[", "DOMAIN", "]", ":", "hass", ".", "async_create_task", "(", ...
[ 58, 0 ]
[ 68, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry)
Set up Glances from config entry.
Set up Glances from config entry.
async def async_setup_entry(hass, config_entry): """Set up Glances from config entry.""" client = GlancesData(hass, config_entry) hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = client if not await client.async_setup(): return False return True
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ")", ":", "client", "=", "GlancesData", "(", "hass", ",", "config_entry", ")", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "[", "config_entry", ".", "en...
[ 71, 0 ]
[ 78, 15 ]
python
en
['en', 'en', 'en']
True