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_legacy_login_flow_validates
(legacy_data, hass)
Test in legacy mode login flow.
Test in legacy mode login flow.
async def test_legacy_login_flow_validates(legacy_data, hass): """Test in legacy mode login flow.""" legacy_data.add_auth("test-user", "test-pass") await legacy_data.async_save() provider = hass_auth.HassAuthProvider( hass, auth_store.AuthStore(hass), {"type": "homeassistant"} ) flow = ...
[ "async", "def", "test_legacy_login_flow_validates", "(", "legacy_data", ",", "hass", ")", ":", "legacy_data", ".", "add_auth", "(", "\"test-user\"", ",", "\"test-pass\"", ")", "await", "legacy_data", ".", "async_save", "(", ")", "provider", "=", "hass_auth", ".", ...
[ 209, 0 ]
[ 237, 52 ]
python
en
['es', 'fy', 'en']
False
test_legacy_saving_loading
(legacy_data, hass)
Test in legacy mode saving and loading JSON.
Test in legacy mode saving and loading JSON.
async def test_legacy_saving_loading(legacy_data, hass): """Test in legacy mode saving and loading JSON.""" legacy_data.add_auth("test-user", "test-pass") legacy_data.add_auth("second-user", "second-pass") await legacy_data.async_save() legacy_data = hass_auth.Data(hass) await legacy_data.async...
[ "async", "def", "test_legacy_saving_loading", "(", "legacy_data", ",", "hass", ")", ":", "legacy_data", ".", "add_auth", "(", "\"test-user\"", ",", "\"test-pass\"", ")", "legacy_data", ".", "add_auth", "(", "\"second-user\"", ",", "\"second-pass\"", ")", "await", ...
[ 240, 0 ]
[ 253, 61 ]
python
en
['en', 'en', 'en']
True
test_legacy_get_or_create_credentials
(hass, legacy_data)
Test in legacy mode that we can get or create credentials.
Test in legacy mode that we can get or create credentials.
async def test_legacy_get_or_create_credentials(hass, legacy_data): """Test in legacy mode that we can get or create credentials.""" manager = await auth_manager_from_config(hass, [{"type": "homeassistant"}], []) provider = manager.auth_providers[0] provider.data = legacy_data credentials1 = await p...
[ "async", "def", "test_legacy_get_or_create_credentials", "(", "hass", ",", "legacy_data", ")", ":", "manager", "=", "await", "auth_manager_from_config", "(", "hass", ",", "[", "{", "\"type\"", ":", "\"homeassistant\"", "}", "]", ",", "[", "]", ")", "provider", ...
[ 256, 0 ]
[ 273, 43 ]
python
en
['en', 'en', 'en']
True
test_race_condition_in_data_loading
(hass)
Test race condition in the hass_auth.Data loading. Ref issue: https://github.com/home-assistant/core/issues/21569
Test race condition in the hass_auth.Data loading.
async def test_race_condition_in_data_loading(hass): """Test race condition in the hass_auth.Data loading. Ref issue: https://github.com/home-assistant/core/issues/21569 """ counter = 0 async def mock_load(_): """Mock of homeassistant.helpers.storage.Store.async_load.""" nonlocal c...
[ "async", "def", "test_race_condition_in_data_loading", "(", "hass", ")", ":", "counter", "=", "0", "async", "def", "mock_load", "(", "_", ")", ":", "\"\"\"Mock of homeassistant.helpers.storage.Store.async_load.\"\"\"", "nonlocal", "counter", "counter", "+=", "1", "await...
[ 276, 0 ]
[ 299, 60 ]
python
en
['en', 'en', 'en']
True
test_abort_already_setup
(hass)
Test if we abort because component is already setup.
Test if we abort because component is already setup.
async def test_abort_already_setup(hass): """Test if we abort because component is already setup.""" flow = config_flow.VeSyncFlowHandler() flow.hass = hass MockConfigEntry(domain=DOMAIN, title="user", data={"user": "pass"}).add_to_hass( hass ) result = await flow.async_step_user() ...
[ "async", "def", "test_abort_already_setup", "(", "hass", ")", ":", "flow", "=", "config_flow", ".", "VeSyncFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "title", "=", "\"user\"", ",", "data", ...
[ 9, 0 ]
[ 19, 56 ]
python
en
['en', 'en', 'en']
True
test_invalid_login_error
(hass)
Test if we return error for invalid username and password.
Test if we return error for invalid username and password.
async def test_invalid_login_error(hass): """Test if we return error for invalid username and password.""" test_dict = {CONF_USERNAME: "user", CONF_PASSWORD: "pass"} flow = config_flow.VeSyncFlowHandler() flow.hass = hass with patch("pyvesync.vesync.VeSync.login", return_value=False): result...
[ "async", "def", "test_invalid_login_error", "(", "hass", ")", ":", "test_dict", "=", "{", "CONF_USERNAME", ":", "\"user\"", ",", "CONF_PASSWORD", ":", "\"pass\"", "}", "flow", "=", "config_flow", ".", "VeSyncFlowHandler", "(", ")", "flow", ".", "hass", "=", ...
[ 22, 0 ]
[ 31, 55 ]
python
en
['en', 'en', 'en']
True
test_config_flow_configuration_yaml
(hass)
Test config flow with configuration.yaml user input.
Test config flow with configuration.yaml user input.
async def test_config_flow_configuration_yaml(hass): """Test config flow with configuration.yaml user input.""" test_dict = {CONF_USERNAME: "user", CONF_PASSWORD: "pass"} flow = config_flow.VeSyncFlowHandler() flow.hass = hass with patch("pyvesync.vesync.VeSync.login", return_value=True): re...
[ "async", "def", "test_config_flow_configuration_yaml", "(", "hass", ")", ":", "test_dict", "=", "{", "CONF_USERNAME", ":", "\"user\"", ",", "CONF_PASSWORD", ":", "\"pass\"", "}", "flow", "=", "config_flow", ".", "VeSyncFlowHandler", "(", ")", "flow", ".", "hass"...
[ 34, 0 ]
[ 43, 72 ]
python
en
['en', 'en', 'en']
True
test_config_flow_user_input
(hass)
Test config flow with user input.
Test config flow with user input.
async def test_config_flow_user_input(hass): """Test config flow with user input.""" flow = config_flow.VeSyncFlowHandler() flow.hass = hass result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_FORM with patch("pyvesync.vesync.VeSync.login", return_value=Tru...
[ "async", "def", "test_config_flow_user_input", "(", "hass", ")", ":", "flow", "=", "config_flow", ".", "VeSyncFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "result", "=", "await", "flow", ".", "async_step_user", "(", ")", "assert", "result", "[",...
[ 46, 0 ]
[ 58, 54 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the SmartHab platform.
Set up the SmartHab platform.
async def async_setup(hass, config) -> bool: """Set up the SmartHab platform.""" hass.data.setdefault(DOMAIN, {}) if DOMAIN not in config: return True if not hass.config_entries.async_entries(DOMAIN): hass.async_create_task( hass.config_entries.flow.async_init( ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", "->", "bool", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "if", "not", "hass", ".", "c...
[ 32, 0 ]
[ 49, 15 ]
python
en
['en', 'da', 'en']
True
async_setup_entry
(hass: HomeAssistantType, entry: ConfigEntry)
Set up config entry for SmartHab integration.
Set up config entry for SmartHab integration.
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry): """Set up config entry for SmartHab integration.""" # Assign configuration variables username = entry.data[CONF_EMAIL] password = entry.data[CONF_PASSWORD] # Setup connection with SmartHab API hub = pysmarthab.SmartHab()...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ")", ":", "# Assign configuration variables", "username", "=", "entry", ".", "data", "[", "CONF_EMAIL", "]", "password", "=", "entry", ".", "data", "[",...
[ 52, 0 ]
[ 76, 15 ]
python
en
['en', 'da', 'en']
True
async_unload_entry
(hass: HomeAssistantType, entry: ConfigEntry)
Unload config entry from SmartHab integration.
Unload config entry from SmartHab integration.
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry): """Unload config entry from SmartHab integration.""" result = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in COMPONENTS...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ")", ":", "result", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unloa...
[ 79, 0 ]
[ 94, 17 ]
python
en
['en', 'en', 'en']
True
no_replace
(module, mask)
No need to replace
No need to replace
def no_replace(module, mask): """ No need to replace """ _logger.debug("no need to replace") return module
[ "def", "no_replace", "(", "module", ",", "mask", ")", ":", "_logger", ".", "debug", "(", "\"no need to replace\"", ")", "return", "module" ]
[ 26, 0 ]
[ 31, 17 ]
python
en
['en', 'error', 'th']
False
replace_linear
(linear, mask)
Parameters ---------- linear : torch.nn.Linear The linear module to be replace mask : ModuleMasks The masks of this module Returns ------- torch.nn.Linear The new linear module
Parameters ---------- linear : torch.nn.Linear The linear module to be replace mask : ModuleMasks The masks of this module
def replace_linear(linear, mask): """ Parameters ---------- linear : torch.nn.Linear The linear module to be replace mask : ModuleMasks The masks of this module Returns ------- torch.nn.Linear The new linear module """ assert isinstance(mask, ModuleMasks)...
[ "def", "replace_linear", "(", "linear", ",", "mask", ")", ":", "assert", "isinstance", "(", "mask", ",", "ModuleMasks", ")", "assert", "mask", ".", "input_mask", "is", "not", "None", "assert", "mask", ".", "output_mask", "is", "None", "assert", "not", "mas...
[ 34, 0 ]
[ 63, 21 ]
python
en
['en', 'error', 'th']
False
replace_batchnorm2d
(norm, mask)
Parameters ---------- norm : torch.nn.BatchNorm2d The batchnorm module to be replace mask : ModuleMasks The masks of this module Returns ------- torch.nn.BatchNorm2d The new batchnorm module
Parameters ---------- norm : torch.nn.BatchNorm2d The batchnorm module to be replace mask : ModuleMasks The masks of this module
def replace_batchnorm2d(norm, mask): """ Parameters ---------- norm : torch.nn.BatchNorm2d The batchnorm module to be replace mask : ModuleMasks The masks of this module Returns ------- torch.nn.BatchNorm2d The new batchnorm module """ assert isinstance(m...
[ "def", "replace_batchnorm2d", "(", "norm", ",", "mask", ")", ":", "assert", "isinstance", "(", "mask", ",", "ModuleMasks", ")", "assert", "'weight'", "in", "mask", ".", "param_masks", "and", "'bias'", "in", "mask", ".", "param_masks", "index", "=", "mask", ...
[ 66, 0 ]
[ 98, 19 ]
python
en
['en', 'error', 'th']
False
replace_conv2d
(conv, mask)
Parameters ---------- conv : torch.nn.Conv2d The conv2d module to be replaced mask : ModuleMasks The masks of this module Returns ------- torch.nn.Conv2d The new conv2d module
Parameters ---------- conv : torch.nn.Conv2d The conv2d module to be replaced mask : ModuleMasks The masks of this module
def replace_conv2d(conv, mask): """ Parameters ---------- conv : torch.nn.Conv2d The conv2d module to be replaced mask : ModuleMasks The masks of this module Returns ------- torch.nn.Conv2d The new conv2d module """ assert isinstance(mask, ModuleMasks) ...
[ "def", "replace_conv2d", "(", "conv", ",", "mask", ")", ":", "assert", "isinstance", "(", "mask", ",", "ModuleMasks", ")", "if", "mask", ".", "input_mask", "is", "None", ":", "in_channels", "=", "conv", ".", "in_channels", "else", ":", "in_channels_index", ...
[ 101, 0 ]
[ 191, 19 ]
python
en
['en', 'error', 'th']
False
replace_convtranspose2d
(convtrans, mask)
We need anothor replace function for convtranspose2d, because the layout of the weight is different from traditional conv layers. The layout of the weight is [N_in, N_out, ksize_1, ksize_2] Parameters ---------- convtrans : torch.nn.ConvTranspose2d The conv2d module to be replaced ...
We need anothor replace function for convtranspose2d, because the layout of the weight is different from traditional conv layers. The layout of the weight is [N_in, N_out, ksize_1, ksize_2] Parameters ---------- convtrans : torch.nn.ConvTranspose2d The conv2d module to be replaced ...
def replace_convtranspose2d(convtrans, mask): """ We need anothor replace function for convtranspose2d, because the layout of the weight is different from traditional conv layers. The layout of the weight is [N_in, N_out, ksize_1, ksize_2] Parameters ---------- convtrans : torch.nn.ConvT...
[ "def", "replace_convtranspose2d", "(", "convtrans", ",", "mask", ")", ":", "assert", "isinstance", "(", "mask", ",", "ModuleMasks", ")", "assert", "isinstance", "(", "convtrans", ",", "torch", ".", "nn", ".", "ConvTranspose2d", ")", "if", "mask", ".", "input...
[ 194, 0 ]
[ 281, 24 ]
python
en
['en', 'error', 'th']
False
alexa_client
(loop, hass, hass_client)
Initialize a Home Assistant server for testing this module.
Initialize a Home Assistant server for testing this module.
def alexa_client(loop, hass, hass_client): """Initialize a Home Assistant server for testing this module.""" @callback def mock_service(call): calls.append(call) hass.services.async_register("test", "alexa", mock_service) assert loop.run_until_complete( async_setup_component( ...
[ "def", "alexa_client", "(", "loop", ",", "hass", ",", "hass_client", ")", ":", "@", "callback", "def", "mock_service", "(", "call", ")", ":", "calls", ".", "append", "(", "call", ")", "hass", ".", "services", ".", "async_register", "(", "\"test\"", ",", ...
[ 25, 0 ]
[ 107, 49 ]
python
en
['en', 'en', 'en']
True
test_intent_launch_request
(alexa_client)
Test the launch of a request.
Test the launch of a request.
async def test_intent_launch_request(alexa_client): """Test the launch of a request.""" data = { "version": "1.0", "session": { "new": True, "sessionId": SESSION_ID, "application": {"applicationId": APPLICATION_ID}, "attributes": {}, "u...
[ "async", "def", "test_intent_launch_request", "(", "alexa_client", ")", ":", "data", "=", "{", "\"version\"", ":", "\"1.0\"", ",", "\"session\"", ":", "{", "\"new\"", ":", "True", ",", "\"sessionId\"", ":", "SESSION_ID", ",", "\"application\"", ":", "{", "\"ap...
[ 118, 0 ]
[ 139, 53 ]
python
en
['en', 'en', 'en']
True
test_intent_launch_request_not_configured
(alexa_client)
Test the launch of a request.
Test the launch of a request.
async def test_intent_launch_request_not_configured(alexa_client): """Test the launch of a request.""" data = { "version": "1.0", "session": { "new": True, "sessionId": SESSION_ID, "application": { "applicationId": "amzn1.echo-sdk-ams.app.00000...
[ "async", "def", "test_intent_launch_request_not_configured", "(", "alexa_client", ")", ":", "data", "=", "{", "\"version\"", ":", "\"1.0\"", ",", "\"session\"", ":", "{", "\"new\"", ":", "True", ",", "\"sessionId\"", ":", "SESSION_ID", ",", "\"application\"", ":",...
[ 142, 0 ]
[ 165, 77 ]
python
en
['en', 'en', 'en']
True
test_intent_request_with_slots
(alexa_client)
Test a request with slots.
Test a request with slots.
async def test_intent_request_with_slots(alexa_client): """Test a request with slots.""" data = { "version": "1.0", "session": { "new": False, "sessionId": SESSION_ID, "application": {"applicationId": APPLICATION_ID}, "attributes": { ...
[ "async", "def", "test_intent_request_with_slots", "(", "alexa_client", ")", ":", "data", "=", "{", "\"version\"", ":", "\"1.0\"", ",", "\"session\"", ":", "{", "\"new\"", ":", "False", ",", "\"sessionId\"", ":", "SESSION_ID", ",", "\"application\"", ":", "{", ...
[ 168, 0 ]
[ 199, 52 ]
python
en
['en', 'en', 'en']
True
test_intent_request_with_slots_and_synonym_resolution
(alexa_client)
Test a request with slots and a name synonym.
Test a request with slots and a name synonym.
async def test_intent_request_with_slots_and_synonym_resolution(alexa_client): """Test a request with slots and a name synonym.""" data = { "version": "1.0", "session": { "new": False, "sessionId": SESSION_ID, "application": {"applicationId": APPLICATION_ID}, ...
[ "async", "def", "test_intent_request_with_slots_and_synonym_resolution", "(", "alexa_client", ")", ":", "data", "=", "{", "\"version\"", ":", "\"1.0\"", ",", "\"session\"", ":", "{", "\"new\"", ":", "False", ",", "\"sessionId\"", ":", "SESSION_ID", ",", "\"applicati...
[ 202, 0 ]
[ 252, 52 ]
python
en
['en', 'en', 'en']
True
test_intent_request_with_slots_and_multi_synonym_resolution
(alexa_client)
Test a request with slots and multiple name synonyms.
Test a request with slots and multiple name synonyms.
async def test_intent_request_with_slots_and_multi_synonym_resolution(alexa_client): """Test a request with slots and multiple name synonyms.""" data = { "version": "1.0", "session": { "new": False, "sessionId": SESSION_ID, "application": {"applicationId": APP...
[ "async", "def", "test_intent_request_with_slots_and_multi_synonym_resolution", "(", "alexa_client", ")", ":", "data", "=", "{", "\"version\"", ":", "\"1.0\"", ",", "\"session\"", ":", "{", "\"new\"", ":", "False", ",", "\"sessionId\"", ":", "SESSION_ID", ",", "\"app...
[ 255, 0 ]
[ 305, 55 ]
python
en
['en', 'en', 'en']
True
test_intent_request_with_slots_but_no_value
(alexa_client)
Test a request with slots but no value.
Test a request with slots but no value.
async def test_intent_request_with_slots_but_no_value(alexa_client): """Test a request with slots but no value.""" data = { "version": "1.0", "session": { "new": False, "sessionId": SESSION_ID, "application": {"applicationId": APPLICATION_ID}, "att...
[ "async", "def", "test_intent_request_with_slots_but_no_value", "(", "alexa_client", ")", ":", "data", "=", "{", "\"version\"", ":", "\"1.0\"", ",", "\"session\"", ":", "{", "\"new\"", ":", "False", ",", "\"sessionId\"", ":", "SESSION_ID", ",", "\"application\"", "...
[ 308, 0 ]
[ 339, 47 ]
python
en
['en', 'en', 'en']
True
test_intent_request_without_slots
(hass, alexa_client)
Test a request without slots.
Test a request without slots.
async def test_intent_request_without_slots(hass, alexa_client): """Test a request without slots.""" data = { "version": "1.0", "session": { "new": False, "sessionId": SESSION_ID, "application": {"applicationId": APPLICATION_ID}, "attributes": { ...
[ "async", "def", "test_intent_request_without_slots", "(", "hass", ",", "alexa_client", ")", ":", "data", "=", "{", "\"version\"", ":", "\"1.0\"", ",", "\"session\"", ":", "{", "\"new\"", ":", "False", ",", "\"sessionId\"", ":", "SESSION_ID", ",", "\"application\...
[ 342, 0 ]
[ 380, 49 ]
python
en
['en', 'en', 'en']
True
test_intent_request_calling_service
(alexa_client)
Test a request for calling a service.
Test a request for calling a service.
async def test_intent_request_calling_service(alexa_client): """Test a request for calling a service.""" data = { "version": "1.0", "session": { "new": False, "sessionId": SESSION_ID, "application": {"applicationId": APPLICATION_ID}, "attributes": ...
[ "async", "def", "test_intent_request_calling_service", "(", "alexa_client", ")", ":", "data", "=", "{", "\"version\"", ":", "\"1.0\"", ",", "\"session\"", ":", "{", "\"new\"", ":", "False", ",", "\"sessionId\"", ":", "SESSION_ID", ",", "\"application\"", ":", "{...
[ 383, 0 ]
[ 418, 81 ]
python
en
['en', 'en', 'en']
True
test_intent_session_ended_request
(alexa_client)
Test the request for ending the session.
Test the request for ending the session.
async def test_intent_session_ended_request(alexa_client): """Test the request for ending the session.""" data = { "version": "1.0", "session": { "new": False, "sessionId": SESSION_ID, "application": {"applicationId": APPLICATION_ID}, "attributes":...
[ "async", "def", "test_intent_session_ended_request", "(", "alexa_client", ")", ":", "data", "=", "{", "\"version\"", ":", "\"1.0\"", ",", "\"session\"", ":", "{", "\"new\"", ":", "False", ",", "\"sessionId\"", ":", "SESSION_ID", ",", "\"application\"", ":", "{",...
[ 421, 0 ]
[ 449, 21 ]
python
en
['en', 'en', 'en']
True
test_intent_from_built_in_intent_library
(alexa_client)
Test intents from the Built-in Intent Library.
Test intents from the Built-in Intent Library.
async def test_intent_from_built_in_intent_library(alexa_client): """Test intents from the Built-in Intent Library.""" data = { "request": { "intent": { "name": "AMAZON.PlaybackAction<object@MusicCreativeWork>", "slots": { "object.byArtist....
[ "async", "def", "test_intent_from_built_in_intent_library", "(", "alexa_client", ")", ":", "data", "=", "{", "\"request\"", ":", "{", "\"intent\"", ":", "{", "\"name\"", ":", "\"AMAZON.PlaybackAction<object@MusicCreativeWork>\"", ",", "\"slots\"", ":", "{", "\"object.by...
[ 452, 0 ]
[ 487, 39 ]
python
en
['en', 'en', 'en']
True
xiaomi_aqara_fixture
()
Mock xiaomi_aqara discovery and entry setup.
Mock xiaomi_aqara discovery and entry setup.
def xiaomi_aqara_fixture(): """Mock xiaomi_aqara discovery and entry setup.""" mock_gateway_discovery = get_mock_discovery([TEST_HOST]) with patch( "homeassistant.components.xiaomi_aqara.config_flow.XiaomiGatewayDiscovery", return_value=mock_gateway_discovery, ), patch( "homeass...
[ "def", "xiaomi_aqara_fixture", "(", ")", ":", "mock_gateway_discovery", "=", "get_mock_discovery", "(", "[", "TEST_HOST", "]", ")", "with", "patch", "(", "\"homeassistant.components.xiaomi_aqara.config_flow.XiaomiGatewayDiscovery\"", ",", "return_value", "=", "mock_gateway_di...
[ 29, 0 ]
[ 42, 13 ]
python
en
['en', 'fil', 'en']
True
get_mock_discovery
( host_list, invalid_interface=False, invalid_key=False, invalid_host=False, invalid_mac=False, )
Return a mock gateway info instance.
Return a mock gateway info instance.
def get_mock_discovery( host_list, invalid_interface=False, invalid_key=False, invalid_host=False, invalid_mac=False, ): """Return a mock gateway info instance.""" gateway_discovery = Mock() gateway_dict = {} for host in host_list: gateway = Mock() gateway.ip_adress...
[ "def", "get_mock_discovery", "(", "host_list", ",", "invalid_interface", "=", "False", ",", "invalid_key", "=", "False", ",", "invalid_host", "=", "False", ",", "invalid_mac", "=", "False", ",", ")", ":", "gateway_discovery", "=", "Mock", "(", ")", "gateway_di...
[ 45, 0 ]
[ 76, 28 ]
python
en
['en', 'fy', 'en']
True
test_config_flow_user_success
(hass)
Test a successful config flow initialized by the user.
Test a successful config flow initialized by the user.
async def test_config_flow_user_success(hass): """Test a successful config flow initialized by the user.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["step_id"] == "user" ...
[ "async", "def", "test_config_flow_user_success", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "S...
[ 79, 0 ]
[ 113, 5 ]
python
en
['en', 'en', 'en']
True
test_config_flow_user_multiple_success
(hass)
Test a successful config flow initialized by the user with multiple gateways discoverd.
Test a successful config flow initialized by the user with multiple gateways discoverd.
async def test_config_flow_user_multiple_success(hass): """Test a successful config flow initialized by the user with multiple gateways discoverd.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form...
[ "async", "def", "test_config_flow_user_multiple_success", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ...
[ 116, 0 ]
[ 165, 5 ]
python
en
['en', 'en', 'en']
True
test_config_flow_user_no_key_success
(hass)
Test a successful config flow initialized by the user without a key.
Test a successful config flow initialized by the user without a key.
async def test_config_flow_user_no_key_success(hass): """Test a successful config flow initialized by the user without a key.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["...
[ "async", "def", "test_config_flow_user_no_key_success", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", "....
[ 168, 0 ]
[ 202, 5 ]
python
en
['en', 'en', 'en']
True
test_config_flow_user_host_mac_success
(hass)
Test a successful config flow initialized by the user with a host and mac specified.
Test a successful config flow initialized by the user with a host and mac specified.
async def test_config_flow_user_host_mac_success(hass): """Test a successful config flow initialized by the user with a host and mac specified.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" ...
[ "async", "def", "test_config_flow_user_host_mac_success", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ...
[ 205, 0 ]
[ 249, 5 ]
python
en
['en', 'en', 'en']
True
test_config_flow_user_discovery_error
(hass)
Test a failed config flow initialized by the user with no gateways discoverd.
Test a failed config flow initialized by the user with no gateways discoverd.
async def test_config_flow_user_discovery_error(hass): """Test a failed config flow initialized by the user with no gateways discoverd.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" asser...
[ "async", "def", "test_config_flow_user_discovery_error", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", "...
[ 252, 0 ]
[ 275, 58 ]
python
en
['en', 'en', 'en']
True
test_config_flow_user_invalid_interface
(hass)
Test a failed config flow initialized by the user with an invalid interface.
Test a failed config flow initialized by the user with an invalid interface.
async def test_config_flow_user_invalid_interface(hass): """Test a failed config flow initialized by the user with an invalid interface.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" asse...
[ "async", "def", "test_config_flow_user_invalid_interface", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ...
[ 278, 0 ]
[ 301, 74 ]
python
en
['en', 'en', 'en']
True
test_config_flow_user_invalid_host
(hass)
Test a failed config flow initialized by the user with an invalid host.
Test a failed config flow initialized by the user with an invalid host.
async def test_config_flow_user_invalid_host(hass): """Test a failed config flow initialized by the user with an invalid host.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result[...
[ "async", "def", "test_config_flow_user_invalid_host", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".",...
[ 304, 0 ]
[ 331, 55 ]
python
en
['en', 'en', 'en']
True
test_config_flow_user_invalid_mac
(hass)
Test a failed config flow initialized by the user with an invalid mac.
Test a failed config flow initialized by the user with an invalid mac.
async def test_config_flow_user_invalid_mac(hass): """Test a failed config flow initialized by the user with an invalid mac.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["s...
[ "async", "def", "test_config_flow_user_invalid_mac", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", ...
[ 334, 0 ]
[ 361, 53 ]
python
en
['en', 'en', 'en']
True
test_config_flow_user_invalid_key
(hass)
Test a failed config flow initialized by the user with an invalid key.
Test a failed config flow initialized by the user with an invalid key.
async def test_config_flow_user_invalid_key(hass): """Test a failed config flow initialized by the user with an invalid key.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["s...
[ "async", "def", "test_config_flow_user_invalid_key", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", ...
[ 364, 0 ]
[ 396, 62 ]
python
en
['en', 'en', 'en']
True
test_zeroconf_success
(hass)
Test a successful zeroconf discovery of a xiaomi aqara gateway.
Test a successful zeroconf discovery of a xiaomi aqara gateway.
async def test_zeroconf_success(hass): """Test a successful zeroconf discovery of a xiaomi aqara gateway.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data={ zeroconf.ATTR_HOST: TEST_HOST, ...
[ "async", "def", "test_zeroconf_success", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_ZE...
[ 399, 0 ]
[ 439, 5 ]
python
en
['en', 'co', 'en']
True
test_zeroconf_missing_data
(hass)
Test a failed zeroconf discovery because of missing data.
Test a failed zeroconf discovery because of missing data.
async def test_zeroconf_missing_data(hass): """Test a failed zeroconf discovery because of missing data.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data={zeroconf.ATTR_HOST: TEST_HOST, ZEROCONF_NAME: TEST_ZEROC...
[ "async", "def", "test_zeroconf_missing_data", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOUR...
[ 442, 0 ]
[ 451, 49 ]
python
en
['en', 'en', 'en']
True
test_zeroconf_unknown_device
(hass)
Test a failed zeroconf discovery because of a unknown device.
Test a failed zeroconf discovery because of a unknown device.
async def test_zeroconf_unknown_device(hass): """Test a failed zeroconf discovery because of a unknown device.""" result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data={ zeroconf.ATTR_HOST: TEST_HOST, ...
[ "async", "def", "test_zeroconf_unknown_device", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "const", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SO...
[ 454, 0 ]
[ 467, 49 ]
python
en
['en', 'en', 'en']
True
mock_dummy_get_components_from_model
()
Mock a clear components list.
Mock a clear components list.
def mock_dummy_get_components_from_model(): """Mock a clear components list.""" components = [] with patch( "pywilight.get_components_from_model", return_value=components, ): yield components
[ "def", "mock_dummy_get_components_from_model", "(", ")", ":", "components", "=", "[", "]", "with", "patch", "(", "\"pywilight.get_components_from_model\"", ",", "return_value", "=", "components", ",", ")", ":", "yield", "components" ]
[ 33, 0 ]
[ 40, 24 ]
python
en
['en', 'en', 'en']
True
test_show_ssdp_form
(hass: HomeAssistantType)
Test that the ssdp confirmation form is served.
Test that the ssdp confirmation form is served.
async def test_show_ssdp_form(hass: HomeAssistantType) -> None: """Test that the ssdp confirmation form is served.""" discovery_info = MOCK_SSDP_DISCOVERY_INFO_P_B.copy() result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery_info ) a...
[ "async", "def", "test_show_ssdp_form", "(", "hass", ":", "HomeAssistantType", ")", "->", "None", ":", "discovery_info", "=", "MOCK_SSDP_DISCOVERY_INFO_P_B", ".", "copy", "(", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_in...
[ 43, 0 ]
[ 56, 5 ]
python
en
['en', 'en', 'en']
True
test_ssdp_not_wilight_abort_1
(hass: HomeAssistantType)
Test that the ssdp aborts not_wilight.
Test that the ssdp aborts not_wilight.
async def test_ssdp_not_wilight_abort_1(hass: HomeAssistantType) -> None: """Test that the ssdp aborts not_wilight.""" discovery_info = MOCK_SSDP_DISCOVERY_INFO_WRONG_MANUFACTORER.copy() result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery_i...
[ "async", "def", "test_ssdp_not_wilight_abort_1", "(", "hass", ":", "HomeAssistantType", ")", "->", "None", ":", "discovery_info", "=", "MOCK_SSDP_DISCOVERY_INFO_WRONG_MANUFACTORER", ".", "copy", "(", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "...
[ 59, 0 ]
[ 68, 51 ]
python
en
['en', 'en', 'en']
True
test_ssdp_not_wilight_abort_2
(hass: HomeAssistantType)
Test that the ssdp aborts not_wilight.
Test that the ssdp aborts not_wilight.
async def test_ssdp_not_wilight_abort_2(hass: HomeAssistantType) -> None: """Test that the ssdp aborts not_wilight.""" discovery_info = MOCK_SSDP_DISCOVERY_INFO_MISSING_MANUFACTORER.copy() result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery...
[ "async", "def", "test_ssdp_not_wilight_abort_2", "(", "hass", ":", "HomeAssistantType", ")", "->", "None", ":", "discovery_info", "=", "MOCK_SSDP_DISCOVERY_INFO_MISSING_MANUFACTORER", ".", "copy", "(", ")", "result", "=", "await", "hass", ".", "config_entries", ".", ...
[ 71, 0 ]
[ 80, 51 ]
python
en
['en', 'en', 'en']
True
test_ssdp_not_wilight_abort_3
( hass: HomeAssistantType, dummy_get_components_from_model_clear )
Test that the ssdp aborts not_wilight.
Test that the ssdp aborts not_wilight.
async def test_ssdp_not_wilight_abort_3( hass: HomeAssistantType, dummy_get_components_from_model_clear ) -> None: """Test that the ssdp aborts not_wilight.""" discovery_info = MOCK_SSDP_DISCOVERY_INFO_P_B.copy() result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: ...
[ "async", "def", "test_ssdp_not_wilight_abort_3", "(", "hass", ":", "HomeAssistantType", ",", "dummy_get_components_from_model_clear", ")", "->", "None", ":", "discovery_info", "=", "MOCK_SSDP_DISCOVERY_INFO_P_B", ".", "copy", "(", ")", "result", "=", "await", "hass", ...
[ 83, 0 ]
[ 94, 51 ]
python
en
['en', 'en', 'en']
True
test_ssdp_not_supported_abort
(hass: HomeAssistantType)
Test that the ssdp aborts not_supported.
Test that the ssdp aborts not_supported.
async def test_ssdp_not_supported_abort(hass: HomeAssistantType) -> None: """Test that the ssdp aborts not_supported.""" discovery_info = MOCK_SSDP_DISCOVERY_INFO_LIGHT_FAN.copy() result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery_info ...
[ "async", "def", "test_ssdp_not_supported_abort", "(", "hass", ":", "HomeAssistantType", ")", "->", "None", ":", "discovery_info", "=", "MOCK_SSDP_DISCOVERY_INFO_LIGHT_FAN", ".", "copy", "(", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ...
[ 97, 0 ]
[ 106, 53 ]
python
en
['en', 'en', 'en']
True
test_ssdp_device_exists_abort
(hass: HomeAssistantType)
Test abort SSDP flow if WiLight already configured.
Test abort SSDP flow if WiLight already configured.
async def test_ssdp_device_exists_abort(hass: HomeAssistantType) -> None: """Test abort SSDP flow if WiLight already configured.""" entry = MockConfigEntry( domain=DOMAIN, unique_id=WILIGHT_ID, data={ CONF_HOST: HOST, CONF_SERIAL_NUMBER: UPNP_SERIAL, C...
[ "async", "def", "test_ssdp_device_exists_abort", "(", "hass", ":", "HomeAssistantType", ")", "->", "None", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "WILIGHT_ID", ",", "data", "=", "{", "CONF_HOST", ":", "HOST",...
[ 109, 0 ]
[ 131, 51 ]
python
en
['en', 'de', 'en']
True
test_full_ssdp_flow_implementation
(hass: HomeAssistantType)
Test the full SSDP flow from start to finish.
Test the full SSDP flow from start to finish.
async def test_full_ssdp_flow_implementation(hass: HomeAssistantType) -> None: """Test the full SSDP flow from start to finish.""" discovery_info = MOCK_SSDP_DISCOVERY_INFO_P_B.copy() result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery_info...
[ "async", "def", "test_full_ssdp_flow_implementation", "(", "hass", ":", "HomeAssistantType", ")", "->", "None", ":", "discovery_info", "=", "MOCK_SSDP_DISCOVERY_INFO_P_B", ".", "copy", "(", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", "...
[ 134, 0 ]
[ 159, 65 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up switches for device.
Set up switches for device.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up switches for device.""" wrapper = hass.data[DOMAIN][DATA_CONFIG_ENTRY][config_entry.entry_id][COAP] # In roller mode the relay blocks exist but do not contain required info if ( wrapper.model in ["SHSW-21", "SHSW-25"...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "wrapper", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "DATA_CONFIG_ENTRY", "]", "[", "config_entry", ".", "entry_id", "]", "[", "COAP", "]", ...
[ 12, 0 ]
[ 43, 77 ]
python
en
['en', 'en', 'en']
True
RelaySwitch.__init__
(self, wrapper: ShellyDeviceWrapper, block: Block)
Initialize relay switch.
Initialize relay switch.
def __init__(self, wrapper: ShellyDeviceWrapper, block: Block) -> None: """Initialize relay switch.""" super().__init__(wrapper, block) self.control_result = None
[ "def", "__init__", "(", "self", ",", "wrapper", ":", "ShellyDeviceWrapper", ",", "block", ":", "Block", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "wrapper", ",", "block", ")", "self", ".", "control_result", "=", "None" ]
[ 49, 4 ]
[ 52, 34 ]
python
en
['en', 'pl', 'en']
True
RelaySwitch.is_on
(self)
If switch is on.
If switch is on.
def is_on(self) -> bool: """If switch is on.""" if self.control_result: return self.control_result["ison"] return self.block.output
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "control_result", ":", "return", "self", ".", "control_result", "[", "\"ison\"", "]", "return", "self", ".", "block", ".", "output" ]
[ 55, 4 ]
[ 60, 32 ]
python
en
['en', 'en', 'en']
True
RelaySwitch.async_turn_on
(self, **kwargs)
Turn on relay.
Turn on relay.
async def async_turn_on(self, **kwargs): """Turn on relay.""" self.control_result = await self.block.set_state(turn="on") self.async_write_ha_state()
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "control_result", "=", "await", "self", ".", "block", ".", "set_state", "(", "turn", "=", "\"on\"", ")", "self", ".", "async_write_ha_state", "(", ")" ]
[ 62, 4 ]
[ 65, 35 ]
python
en
['en', 'en', 'en']
True
RelaySwitch.async_turn_off
(self, **kwargs)
Turn off relay.
Turn off relay.
async def async_turn_off(self, **kwargs): """Turn off relay.""" self.control_result = await self.block.set_state(turn="off") self.async_write_ha_state()
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "control_result", "=", "await", "self", ".", "block", ".", "set_state", "(", "turn", "=", "\"off\"", ")", "self", ".", "async_write_ha_state", "(", ")" ]
[ 67, 4 ]
[ 70, 35 ]
python
en
['en', 'en', 'en']
True
RelaySwitch._update_callback
(self)
When device updates, clear control result that overrides state.
When device updates, clear control result that overrides state.
def _update_callback(self): """When device updates, clear control result that overrides state.""" self.control_result = None super()._update_callback()
[ "def", "_update_callback", "(", "self", ")", ":", "self", ".", "control_result", "=", "None", "super", "(", ")", ".", "_update_callback", "(", ")" ]
[ 73, 4 ]
[ 76, 34 ]
python
en
['en', 'en', 'en']
True
_has_all_unique_hosts
(value)
Validate that each hub configured has a unique host.
Validate that each hub configured has a unique host.
def _has_all_unique_hosts(value): """Validate that each hub configured has a unique host.""" hosts = [device[CONF_HOST] for device in value] schema = vol.Schema(vol.Unique()) schema(hosts) return value
[ "def", "_has_all_unique_hosts", "(", "value", ")", ":", "hosts", "=", "[", "device", "[", "CONF_HOST", "]", "for", "device", "in", "value", "]", "schema", "=", "vol", ".", "Schema", "(", "vol", ".", "Unique", "(", ")", ")", "schema", "(", "hosts", ")...
[ 66, 0 ]
[ 71, 16 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, hass_config: dict)
Set up the Hunter Douglas PowerView component.
Set up the Hunter Douglas PowerView component.
async def async_setup(hass: HomeAssistant, hass_config: dict): """Set up the Hunter Douglas PowerView component.""" hass.data.setdefault(DOMAIN, {}) if DOMAIN not in hass_config: return True for conf in hass_config[DOMAIN]: hass.async_create_task( hass.config_entries.flow.a...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "hass_config", ":", "dict", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "if", "DOMAIN", "not", "in", "hass_config", ":", "return", "True", "...
[ 84, 0 ]
[ 98, 15 ]
python
en
['en', 'fr', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up Hunter Douglas PowerView from a config entry.
Set up Hunter Douglas PowerView from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Hunter Douglas PowerView from a config entry.""" config = entry.data hub_address = config.get(CONF_HOST) websession = async_get_clientsession(hass) pv_request = AioRequest(hub_address, loop=hass.loop, websession=webse...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "config", "=", "entry", ".", "data", "hub_address", "=", "config", ".", "get", "(", "CONF_HOST", ")", "websession", "=", "async_get_clientsessio...
[ 101, 0 ]
[ 169, 15 ]
python
en
['en', 'en', 'en']
True
async_get_device_info
(pv_request)
Determine device info.
Determine device info.
async def async_get_device_info(pv_request): """Determine device info.""" userdata = UserData(pv_request) resources = await userdata.get_resources() userdata_data = resources[USER_DATA] if FIRMWARE_IN_USERDATA in userdata_data: main_processor_info = userdata_data[FIRMWARE_IN_USERDATA][ ...
[ "async", "def", "async_get_device_info", "(", "pv_request", ")", ":", "userdata", "=", "UserData", "(", "pv_request", ")", "resources", "=", "await", "userdata", ".", "get_resources", "(", ")", "userdata_data", "=", "resources", "[", "USER_DATA", "]", "if", "F...
[ 172, 0 ]
[ 198, 5 ]
python
en
['it', 'sr', 'en']
False
_async_map_data_by_id
(data)
Return a dict with the key being the id for a list of entries.
Return a dict with the key being the id for a list of entries.
def _async_map_data_by_id(data): """Return a dict with the key being the id for a list of entries.""" return {entry[ATTR_ID]: entry for entry in data}
[ "def", "_async_map_data_by_id", "(", "data", ")", ":", "return", "{", "entry", "[", "ATTR_ID", "]", ":", "entry", "for", "entry", "in", "data", "}" ]
[ 202, 0 ]
[ 204, 52 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in PLATFORMS ] ) ...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload...
[ 207, 0 ]
[ 220, 20 ]
python
en
['en', 'es', 'en']
True
CTRLPreTrainedModel._init_weights
(self, module)
Initialize the weights.
Initialize the weights.
def _init_weights(self, module): """Initialize the weights.""" if isinstance(module, (nn.Linear, Conv1D)): # Slightly different from the TF version which uses truncated_normal for initialization # cf https://github.com/pytorch/pytorch/pull/5617 module.weight.data.norm...
[ "def", "_init_weights", "(", "self", ",", "module", ")", ":", "if", "isinstance", "(", "module", ",", "(", "nn", ".", "Linear", ",", "Conv1D", ")", ")", ":", "# Slightly different from the TF version which uses truncated_normal for initialization", "# cf https://github....
[ 222, 4 ]
[ 236, 41 ]
python
en
['en', 'en', 'en']
True
_battery_convert
(value)
Battery is given as a value between 0 and 9.
Battery is given as a value between 0 and 9.
def _battery_convert(value): """Battery is given as a value between 0 and 9.""" if value is None: return None return (value + 1) * 10
[ "def", "_battery_convert", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "return", "(", "value", "+", "1", ")", "*", "10" ]
[ 34, 0 ]
[ 38, 27 ]
python
en
['en', 'en', 'en']
True
_rssi_convert
(value)
Rssi is given as dBm value.
Rssi is given as dBm value.
def _rssi_convert(value): """Rssi is given as dBm value.""" if value is None: return None return f"{value*8-120}"
[ "def", "_rssi_convert", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "return", "f\"{value*8-120}\"" ]
[ 41, 0 ]
[ 45, 27 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass, config_entry, async_add_entities, )
Set up platform.
Set up platform.
async def async_setup_entry( hass, config_entry, async_add_entities, ): """Set up platform.""" discovery_info = config_entry.data data_ids = set() def supported(event): return isinstance(event, (ControlEvent, SensorEvent)) entities = [] for packet_id, entity_info in discove...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ",", ")", ":", "discovery_info", "=", "config_entry", ".", "data", "data_ids", "=", "set", "(", ")", "def", "supported", "(", "event", ")", ":", "return", "isin...
[ 69, 0 ]
[ 128, 57 ]
python
en
['en', 'ru', 'en']
True
RfxtrxSensor.__init__
(self, device, device_id, data_type, event=None)
Initialize the sensor.
Initialize the sensor.
def __init__(self, device, device_id, data_type, event=None): """Initialize the sensor.""" super().__init__(device, device_id, event=event) self.data_type = data_type self._unit_of_measurement = DATA_TYPES.get(data_type) self._name = f"{device.type_string} {device.id_string} {dat...
[ "def", "__init__", "(", "self", ",", "device", ",", "device_id", ",", "data_type", ",", "event", "=", "None", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ",", "device_id", ",", "event", "=", "event", ")", "self", ".", "data_type", "=...
[ 134, 4 ]
[ 143, 73 ]
python
en
['en', 'en', 'en']
True
RfxtrxSensor.async_added_to_hass
(self)
Restore device state.
Restore device state.
async def async_added_to_hass(self): """Restore device state.""" await super().async_added_to_hass() if self._event is None: old_state = await self.async_get_last_state() if old_state is not None: event = old_state.attributes.get(ATTR_EVENT) ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "if", "self", ".", "_event", "is", "None", ":", "old_state", "=", "await", "self", ".", "async_get_last_state", "(", ")", "if", ...
[ 145, 4 ]
[ 154, 60 ]
python
it
['it', 'it', 'en']
True
RfxtrxSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" if not self._event: return None value = self._event.values.get(self.data_type) return self._convert_fun(value)
[ "def", "state", "(", "self", ")", ":", "if", "not", "self", ".", "_event", ":", "return", "None", "value", "=", "self", ".", "_event", ".", "values", ".", "get", "(", "self", ".", "data_type", ")", "return", "self", ".", "_convert_fun", "(", "value",...
[ 157, 4 ]
[ 162, 39 ]
python
en
['en', 'en', 'en']
True
RfxtrxSensor.unit_of_measurement
(self)
Return the unit this state is expressed in.
Return the unit this state is expressed in.
def unit_of_measurement(self): """Return the unit this state is expressed in.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 165, 4 ]
[ 167, 40 ]
python
en
['en', 'en', 'en']
True
RfxtrxSensor.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 170, 4 ]
[ 172, 20 ]
python
en
['en', 'en', 'en']
True
RfxtrxSensor.force_update
(self)
We should force updates. Repeated states have meaning.
We should force updates. Repeated states have meaning.
def force_update(self) -> bool: """We should force updates. Repeated states have meaning.""" return True
[ "def", "force_update", "(", "self", ")", "->", "bool", ":", "return", "True" ]
[ 175, 4 ]
[ 177, 19 ]
python
en
['en', 'en', 'en']
True
RfxtrxSensor.device_class
(self)
Return a device class for sensor.
Return a device class for sensor.
def device_class(self): """Return a device class for sensor.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 180, 4 ]
[ 182, 33 ]
python
en
['es', 'pt', 'en']
False
RfxtrxSensor._handle_event
(self, event, device_id)
Check if event applies to me and update.
Check if event applies to me and update.
def _handle_event(self, event, device_id): """Check if event applies to me and update.""" if device_id != self._device_id: return if self.data_type not in event.values: return _LOGGER.debug( "Sensor update (Device ID: %s Class: %s Sub: %s)", ...
[ "def", "_handle_event", "(", "self", ",", "event", ",", "device_id", ")", ":", "if", "device_id", "!=", "self", ".", "_device_id", ":", "return", "if", "self", ".", "data_type", "not", "in", "event", ".", "values", ":", "return", "_LOGGER", ".", "debug",...
[ 185, 4 ]
[ 202, 35 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the Matrix bot component.
Set up the Matrix bot component.
def setup(hass, config): """Set up the Matrix bot component.""" config = config[DOMAIN] try: bot = MatrixBot( hass, os.path.join(hass.config.path(), SESSION_FILE), config[CONF_HOMESERVER], config[CONF_VERIFY_SSL], config[CONF_USERNAME], ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "config", "=", "config", "[", "DOMAIN", "]", "try", ":", "bot", "=", "MatrixBot", "(", "hass", ",", "os", ".", "path", ".", "join", "(", "hass", ".", "config", ".", "path", "(", ")", ",", "S...
[ 74, 0 ]
[ 101, 15 ]
python
en
['en', 'ca', 'en']
True
MatrixBot.__init__
( self, hass, config_file, homeserver, verify_ssl, username, password, listening_rooms, commands, )
Set up the client.
Set up the client.
def __init__( self, hass, config_file, homeserver, verify_ssl, username, password, listening_rooms, commands, ): """Set up the client.""" self.hass = hass self._session_filepath = config_file self._auth_tokens =...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config_file", ",", "homeserver", ",", "verify_ssl", ",", "username", ",", "password", ",", "listening_rooms", ",", "commands", ",", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "_session_filepa...
[ 107, 4 ]
[ 179, 76 ]
python
en
['en', 'fr', 'en']
True
MatrixBot._handle_room_message
(self, room_id, room, event)
Handle a message sent to a Matrix room.
Handle a message sent to a Matrix room.
def _handle_room_message(self, room_id, room, event): """Handle a message sent to a Matrix room.""" if event["content"]["msgtype"] != "m.text": return if event["sender"] == self._mx_id: return _LOGGER.debug("Handling message: %s", event["content"]["body"]) ...
[ "def", "_handle_room_message", "(", "self", ",", "room_id", ",", "room", ",", "event", ")", ":", "if", "event", "[", "\"content\"", "]", "[", "\"msgtype\"", "]", "!=", "\"m.text\"", ":", "return", "if", "event", "[", "\"sender\"", "]", "==", "self", ".",...
[ 181, 4 ]
[ 217, 64 ]
python
en
['en', 'ca', 'en']
True
MatrixBot._join_or_get_room
(self, room_id_or_alias)
Join a room or get it, if we are already in the room. We can't just always call join_room(), since that seems to crash the client if we're already in the room.
Join a room or get it, if we are already in the room.
def _join_or_get_room(self, room_id_or_alias): """Join a room or get it, if we are already in the room. We can't just always call join_room(), since that seems to crash the client if we're already in the room. """ rooms = self._client.get_rooms() if room_id_or_alias in r...
[ "def", "_join_or_get_room", "(", "self", ",", "room_id_or_alias", ")", ":", "rooms", "=", "self", ".", "_client", ".", "get_rooms", "(", ")", "if", "room_id_or_alias", "in", "rooms", ":", "_LOGGER", ".", "debug", "(", "\"Already in room %s\"", ",", "room_id_or...
[ 219, 4 ]
[ 243, 19 ]
python
en
['en', 'en', 'en']
True
MatrixBot._join_rooms
(self)
Join the Matrix rooms that we listen for commands in.
Join the Matrix rooms that we listen for commands in.
def _join_rooms(self): """Join the Matrix rooms that we listen for commands in.""" for room_id in self._listening_rooms: try: room = self._join_or_get_room(room_id) room.add_listener( partial(self._handle_room_message, room_id), "m.room.mes...
[ "def", "_join_rooms", "(", "self", ")", ":", "for", "room_id", "in", "self", ".", "_listening_rooms", ":", "try", ":", "room", "=", "self", ".", "_join_or_get_room", "(", "room_id", ")", "room", ".", "add_listener", "(", "partial", "(", "self", ".", "_ha...
[ 245, 4 ]
[ 255, 72 ]
python
en
['en', 'en', 'en']
True
MatrixBot._get_auth_tokens
(self)
Read sorted authentication tokens from disk. Returns the auth_tokens dictionary.
Read sorted authentication tokens from disk.
def _get_auth_tokens(self): """ Read sorted authentication tokens from disk. Returns the auth_tokens dictionary. """ try: auth_tokens = load_json(self._session_filepath) return auth_tokens except HomeAssistantError as ex: _LOGGER.warn...
[ "def", "_get_auth_tokens", "(", "self", ")", ":", "try", ":", "auth_tokens", "=", "load_json", "(", "self", ".", "_session_filepath", ")", "return", "auth_tokens", "except", "HomeAssistantError", "as", "ex", ":", "_LOGGER", ".", "warning", "(", "\"Loading authen...
[ 257, 4 ]
[ 273, 21 ]
python
en
['en', 'error', 'th']
False
MatrixBot._store_auth_token
(self, token)
Store authentication token to session and persistent storage.
Store authentication token to session and persistent storage.
def _store_auth_token(self, token): """Store authentication token to session and persistent storage.""" self._auth_tokens[self._mx_id] = token save_json(self._session_filepath, self._auth_tokens)
[ "def", "_store_auth_token", "(", "self", ",", "token", ")", ":", "self", ".", "_auth_tokens", "[", "self", ".", "_mx_id", "]", "=", "token", "save_json", "(", "self", ".", "_session_filepath", ",", "self", ".", "_auth_tokens", ")" ]
[ 275, 4 ]
[ 279, 60 ]
python
en
['en', 'en', 'en']
True
MatrixBot._login
(self)
Login to the Matrix homeserver and return the client instance.
Login to the Matrix homeserver and return the client instance.
def _login(self): """Login to the Matrix homeserver and return the client instance.""" # Attempt to generate a valid client using either of the two possible # login methods: client = None # If we have an authentication token if self._mx_id in self._auth_tokens: ...
[ "def", "_login", "(", "self", ")", ":", "# Attempt to generate a valid client using either of the two possible", "# login methods:", "client", "=", "None", "# If we have an authentication token", "if", "self", ".", "_mx_id", "in", "self", ".", "_auth_tokens", ":", "try", ...
[ 281, 4 ]
[ 315, 21 ]
python
en
['en', 'en', 'en']
True
MatrixBot._login_by_token
(self)
Login using authentication token and return the client.
Login using authentication token and return the client.
def _login_by_token(self): """Login using authentication token and return the client.""" return MatrixClient( base_url=self._homeserver, token=self._auth_tokens[self._mx_id], user_id=self._mx_id, valid_cert_check=self._verify_tls, )
[ "def", "_login_by_token", "(", "self", ")", ":", "return", "MatrixClient", "(", "base_url", "=", "self", ".", "_homeserver", ",", "token", "=", "self", ".", "_auth_tokens", "[", "self", ".", "_mx_id", "]", ",", "user_id", "=", "self", ".", "_mx_id", ",",...
[ 317, 4 ]
[ 324, 9 ]
python
en
['en', 'en', 'en']
True
MatrixBot._login_by_password
(self)
Login using password authentication and return the client.
Login using password authentication and return the client.
def _login_by_password(self): """Login using password authentication and return the client.""" _client = MatrixClient( base_url=self._homeserver, valid_cert_check=self._verify_tls ) _client.login_with_password(self._mx_id, self._password) self._store_auth_token(_cli...
[ "def", "_login_by_password", "(", "self", ")", ":", "_client", "=", "MatrixClient", "(", "base_url", "=", "self", ".", "_homeserver", ",", "valid_cert_check", "=", "self", ".", "_verify_tls", ")", "_client", ".", "login_with_password", "(", "self", ".", "_mx_i...
[ 326, 4 ]
[ 336, 22 ]
python
en
['en', 'en', 'en']
True
MatrixBot._send_message
(self, message, target_rooms)
Send the message to the Matrix server.
Send the message to the Matrix server.
def _send_message(self, message, target_rooms): """Send the message to the Matrix server.""" for target_room in target_rooms: try: room = self._join_or_get_room(target_room) _LOGGER.debug(room.send_text(message)) except MatrixRequestError as ex: ...
[ "def", "_send_message", "(", "self", ",", "message", ",", "target_rooms", ")", ":", "for", "target_room", "in", "target_rooms", ":", "try", ":", "room", "=", "self", ".", "_join_or_get_room", "(", "target_room", ")", "_LOGGER", ".", "debug", "(", "room", "...
[ 338, 4 ]
[ 351, 17 ]
python
en
['en', 'en', 'en']
True
MatrixBot.handle_send_message
(self, service)
Handle the send_message service.
Handle the send_message service.
def handle_send_message(self, service): """Handle the send_message service.""" self._send_message(service.data[ATTR_MESSAGE], service.data[ATTR_TARGET])
[ "def", "handle_send_message", "(", "self", ",", "service", ")", ":", "self", ".", "_send_message", "(", "service", ".", "data", "[", "ATTR_MESSAGE", "]", ",", "service", ".", "data", "[", "ATTR_TARGET", "]", ")" ]
[ 353, 4 ]
[ 355, 81 ]
python
en
['en', 'en', 'en']
True
get_mock_inputs
(input_list)
Return list of MockInput.
Return list of MockInput.
def get_mock_inputs(input_list): """Return list of MockInput.""" return [MockInput(input) for input in input_list]
[ "def", "get_mock_inputs", "(", "input_list", ")", ":", "return", "[", "MockInput", "(", "input", ")", "for", "input", "in", "input_list", "]" ]
[ 36, 0 ]
[ 38, 53 ]
python
en
['en', 'et', 'en']
True
skip_notifications_fixture
()
Skip notification calls.
Skip notification calls.
def skip_notifications_fixture(): """Skip notification calls.""" with patch("homeassistant.components.persistent_notification.async_create"), patch( "homeassistant.components.persistent_notification.async_dismiss" ): yield
[ "def", "skip_notifications_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.persistent_notification.async_create\"", ")", ",", "patch", "(", "\"homeassistant.components.persistent_notification.async_dismiss\"", ")", ":", "yield" ]
[ 42, 0 ]
[ 47, 13 ]
python
ca
['ro', 'ca', 'en']
False
vizio_get_unique_id_fixture
()
Mock get vizio unique ID.
Mock get vizio unique ID.
def vizio_get_unique_id_fixture(): """Mock get vizio unique ID.""" with patch( "homeassistant.components.vizio.config_flow.VizioAsync.get_unique_id", AsyncMock(return_value=UNIQUE_ID), ): yield
[ "def", "vizio_get_unique_id_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.config_flow.VizioAsync.get_unique_id\"", ",", "AsyncMock", "(", "return_value", "=", "UNIQUE_ID", ")", ",", ")", ":", "yield" ]
[ 51, 0 ]
[ 57, 13 ]
python
en
['it', 'es', 'en']
False
vizio_data_coordinator_update_fixture
()
Mock get data coordinator update.
Mock get data coordinator update.
def vizio_data_coordinator_update_fixture(): """Mock get data coordinator update.""" with patch( "homeassistant.components.vizio.gen_apps_list_from_url", return_value=APP_LIST, ): yield
[ "def", "vizio_data_coordinator_update_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.gen_apps_list_from_url\"", ",", "return_value", "=", "APP_LIST", ",", ")", ":", "yield" ]
[ 61, 0 ]
[ 67, 13 ]
python
nl
['nl', 'nl', 'en']
True
vizio_no_unique_id_fixture
()
Mock no vizio unique ID returrned.
Mock no vizio unique ID returrned.
def vizio_no_unique_id_fixture(): """Mock no vizio unique ID returrned.""" with patch( "homeassistant.components.vizio.config_flow.VizioAsync.get_unique_id", return_value=None, ): yield
[ "def", "vizio_no_unique_id_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.config_flow.VizioAsync.get_unique_id\"", ",", "return_value", "=", "None", ",", ")", ":", "yield" ]
[ 71, 0 ]
[ 77, 13 ]
python
it
['it', 'it', 'it']
True
vizio_connect_fixture
()
Mock valid vizio device and entry setup.
Mock valid vizio device and entry setup.
def vizio_connect_fixture(): """Mock valid vizio device and entry setup.""" with patch( "homeassistant.components.vizio.config_flow.VizioAsync.validate_ha_config", AsyncMock(return_value=True), ): yield
[ "def", "vizio_connect_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.config_flow.VizioAsync.validate_ha_config\"", ",", "AsyncMock", "(", "return_value", "=", "True", ")", ",", ")", ":", "yield" ]
[ 81, 0 ]
[ 87, 13 ]
python
en
['it', 'en', 'en']
True
vizio_complete_pairing_fixture
()
Mock complete vizio pairing workflow.
Mock complete vizio pairing workflow.
def vizio_complete_pairing_fixture(): """Mock complete vizio pairing workflow.""" with patch( "homeassistant.components.vizio.config_flow.VizioAsync.start_pair", return_value=MockStartPairingResponse(CH_TYPE, RESPONSE_TOKEN), ), patch( "homeassistant.components.vizio.config_flow.Vizi...
[ "def", "vizio_complete_pairing_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.config_flow.VizioAsync.start_pair\"", ",", "return_value", "=", "MockStartPairingResponse", "(", "CH_TYPE", ",", "RESPONSE_TOKEN", ")", ",", ")", ",", "patch", ...
[ 91, 0 ]
[ 100, 13 ]
python
en
['it', 'sr', 'en']
False
vizio_start_pairing_failure_fixture
()
Mock vizio start pairing failure.
Mock vizio start pairing failure.
def vizio_start_pairing_failure_fixture(): """Mock vizio start pairing failure.""" with patch( "homeassistant.components.vizio.config_flow.VizioAsync.start_pair", return_value=None, ): yield
[ "def", "vizio_start_pairing_failure_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.config_flow.VizioAsync.start_pair\"", ",", "return_value", "=", "None", ",", ")", ":", "yield" ]
[ 104, 0 ]
[ 110, 13 ]
python
en
['lt', 'fi', 'en']
False
vizio_invalid_pin_failure_fixture
()
Mock vizio failure due to invalid pin.
Mock vizio failure due to invalid pin.
def vizio_invalid_pin_failure_fixture(): """Mock vizio failure due to invalid pin.""" with patch( "homeassistant.components.vizio.config_flow.VizioAsync.start_pair", return_value=MockStartPairingResponse(CH_TYPE, RESPONSE_TOKEN), ), patch( "homeassistant.components.vizio.config_flow....
[ "def", "vizio_invalid_pin_failure_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.config_flow.VizioAsync.start_pair\"", ",", "return_value", "=", "MockStartPairingResponse", "(", "CH_TYPE", ",", "RESPONSE_TOKEN", ")", ",", ")", ",", "patch",...
[ 114, 0 ]
[ 123, 13 ]
python
it
['it', 'it', 'it']
True
vizio_bypass_setup_fixture
()
Mock component setup.
Mock component setup.
def vizio_bypass_setup_fixture(): """Mock component setup.""" with patch("homeassistant.components.vizio.async_setup_entry", return_value=True): yield
[ "def", "vizio_bypass_setup_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.async_setup_entry\"", ",", "return_value", "=", "True", ")", ":", "yield" ]
[ 127, 0 ]
[ 130, 13 ]
python
en
['en', 'bg', 'en']
True
vizio_bypass_update_fixture
()
Mock component update.
Mock component update.
def vizio_bypass_update_fixture(): """Mock component update.""" with patch( "homeassistant.components.vizio.media_player.VizioAsync.can_connect_with_auth_check", return_value=True, ), patch("homeassistant.components.vizio.media_player.VizioDevice.async_update"): yield
[ "def", "vizio_bypass_update_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.media_player.VizioAsync.can_connect_with_auth_check\"", ",", "return_value", "=", "True", ",", ")", ",", "patch", "(", "\"homeassistant.components.vizio.media_player.Vizio...
[ 134, 0 ]
[ 140, 13 ]
python
de
['de', 'nl', 'en']
False
vizio_guess_device_type_fixture
()
Mock vizio async_guess_device_type function.
Mock vizio async_guess_device_type function.
def vizio_guess_device_type_fixture(): """Mock vizio async_guess_device_type function.""" with patch( "homeassistant.components.vizio.config_flow.async_guess_device_type", return_value="speaker", ): yield
[ "def", "vizio_guess_device_type_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.config_flow.async_guess_device_type\"", ",", "return_value", "=", "\"speaker\"", ",", ")", ":", "yield" ]
[ 144, 0 ]
[ 150, 13 ]
python
en
['it', 'ht', 'en']
False
vizio_cant_connect_fixture
()
Mock vizio device can't connect with valid auth.
Mock vizio device can't connect with valid auth.
def vizio_cant_connect_fixture(): """Mock vizio device can't connect with valid auth.""" with patch( "homeassistant.components.vizio.config_flow.VizioAsync.validate_ha_config", AsyncMock(return_value=False), ): yield
[ "def", "vizio_cant_connect_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.config_flow.VizioAsync.validate_ha_config\"", ",", "AsyncMock", "(", "return_value", "=", "False", ")", ",", ")", ":", "yield" ]
[ 154, 0 ]
[ 160, 13 ]
python
en
['en', 'en', 'en']
True
vizio_update_fixture
()
Mock valid updates to vizio device.
Mock valid updates to vizio device.
def vizio_update_fixture(): """Mock valid updates to vizio device.""" with patch( "homeassistant.components.vizio.media_player.VizioAsync.can_connect_with_auth_check", return_value=True, ), patch( "homeassistant.components.vizio.media_player.VizioAsync.get_all_settings", retu...
[ "def", "vizio_update_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.media_player.VizioAsync.can_connect_with_auth_check\"", ",", "return_value", "=", "True", ",", ")", ",", "patch", "(", "\"homeassistant.components.vizio.media_player.VizioAsync.g...
[ 164, 0 ]
[ 195, 13 ]
python
it
['it', 'sr', 'it']
True
vizio_update_with_apps_fixture
(vizio_update: pytest.fixture)
Mock valid updates to vizio device that supports apps.
Mock valid updates to vizio device that supports apps.
def vizio_update_with_apps_fixture(vizio_update: pytest.fixture): """Mock valid updates to vizio device that supports apps.""" with patch( "homeassistant.components.vizio.media_player.VizioAsync.get_inputs_list", return_value=get_mock_inputs(INPUT_LIST_WITH_APPS), ), patch( "homeassi...
[ "def", "vizio_update_with_apps_fixture", "(", "vizio_update", ":", "pytest", ".", "fixture", ")", ":", "with", "patch", "(", "\"homeassistant.components.vizio.media_player.VizioAsync.get_inputs_list\"", ",", "return_value", "=", "get_mock_inputs", "(", "INPUT_LIST_WITH_APPS", ...
[ 199, 0 ]
[ 211, 13 ]
python
en
['en', 'en', 'en']
True