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
replace_input_choice
(root_module, init_fn, modules=None)
Replace input choice modules with modules that are initiated with init_fn. Parameters ---------- root_module : nn.Module Root module to traverse. init_fn : Callable Initializing function. modules : dict, optional Update the replaced modules into the dict and check dupli...
Replace input choice modules with modules that are initiated with init_fn.
def replace_input_choice(root_module, init_fn, modules=None): """ Replace input choice modules with modules that are initiated with init_fn. Parameters ---------- root_module : nn.Module Root module to traverse. init_fn : Callable Initializing function. modules : dict, optio...
[ "def", "replace_input_choice", "(", "root_module", ",", "init_fn", ",", "modules", "=", "None", ")", ":", "return", "_replace_module_with_type", "(", "root_module", ",", "init_fn", ",", "(", "InputChoice", ",", "nn", ".", "InputChoice", ")", ",", "modules", ")...
[ 163, 0 ]
[ 181, 98 ]
python
en
['en', 'error', 'th']
False
AverageMeterGroup.update
(self, data)
Update the meter group with a dict of metrics. Non-exist average meters will be automatically created.
Update the meter group with a dict of metrics. Non-exist average meters will be automatically created.
def update(self, data): """ Update the meter group with a dict of metrics. Non-exist average meters will be automatically created. """ for k, v in data.items(): if k not in self.meters: self.meters[k] = AverageMeter(k, ":4f") self.meters[k]...
[ "def", "update", "(", "self", ",", "data", ")", ":", "for", "k", ",", "v", "in", "data", ".", "items", "(", ")", ":", "if", "k", "not", "in", "self", ".", "meters", ":", "self", ".", "meters", "[", "k", "]", "=", "AverageMeter", "(", "k", ","...
[ 49, 4 ]
[ 57, 36 ]
python
en
['en', 'error', 'th']
False
AverageMeterGroup.summary
(self)
Return a summary string of group data.
Return a summary string of group data.
def summary(self): """ Return a summary string of group data. """ return " ".join(v.summary() for v in self.meters.values())
[ "def", "summary", "(", "self", ")", ":", "return", "\" \"", ".", "join", "(", "v", ".", "summary", "(", ")", "for", "v", "in", "self", ".", "meters", ".", "values", "(", ")", ")" ]
[ 68, 4 ]
[ 72, 67 ]
python
en
['en', 'error', 'th']
False
AverageMeter.reset
(self)
Reset the meter.
Reset the meter.
def reset(self): """ Reset the meter. """ self.val = 0 self.avg = 0 self.sum = 0 self.count = 0
[ "def", "reset", "(", "self", ")", ":", "self", ".", "val", "=", "0", "self", ".", "avg", "=", "0", "self", ".", "sum", "=", "0", "self", ".", "count", "=", "0" ]
[ 92, 4 ]
[ 99, 22 ]
python
en
['en', 'error', 'th']
False
AverageMeter.update
(self, val, n=1)
Update with value and weight. Parameters ---------- val : float or int The new value to be accounted in. n : int The weight of the new value.
Update with value and weight.
def update(self, val, n=1): """ Update with value and weight. Parameters ---------- val : float or int The new value to be accounted in. n : int The weight of the new value. """ self.val = val self.sum += val * n se...
[ "def", "update", "(", "self", ",", "val", ",", "n", "=", "1", ")", ":", "self", ".", "val", "=", "val", "self", ".", "sum", "+=", "val", "*", "n", "self", ".", "count", "+=", "n", "self", ".", "avg", "=", "self", ".", "sum", "/", "self", "....
[ 101, 4 ]
[ 115, 40 ]
python
en
['en', 'error', 'th']
False
mock_connection
( aioclient_mock: AiohttpClientMocker, host: str = HOST, port: str = PORT, base_path: str = BASE_PATH, error: bool = False, invalid_auth: bool = False, server_error: bool = False, )
Mock Sonarr connection.
Mock Sonarr connection.
def mock_connection( aioclient_mock: AiohttpClientMocker, host: str = HOST, port: str = PORT, base_path: str = BASE_PATH, error: bool = False, invalid_auth: bool = False, server_error: bool = False, ) -> None: """Mock Sonarr connection.""" if error: mock_connection_error( ...
[ "def", "mock_connection", "(", "aioclient_mock", ":", "AiohttpClientMocker", ",", "host", ":", "str", "=", "HOST", ",", "port", ":", "str", "=", "PORT", ",", "base_path", ":", "str", "=", "BASE_PATH", ",", "error", ":", "bool", "=", "False", ",", "invali...
[ 41, 0 ]
[ 120, 5 ]
python
en
['en', 'da', 'en']
True
mock_connection_error
( aioclient_mock: AiohttpClientMocker, host: str = HOST, port: str = PORT, base_path: str = BASE_PATH, )
Mock Sonarr connection errors.
Mock Sonarr connection errors.
def mock_connection_error( aioclient_mock: AiohttpClientMocker, host: str = HOST, port: str = PORT, base_path: str = BASE_PATH, ) -> None: """Mock Sonarr connection errors.""" sonarr_url = f"http://{host}:{port}{base_path}" aioclient_mock.get(f"{sonarr_url}/system/status", exc=SocketGIAErro...
[ "def", "mock_connection_error", "(", "aioclient_mock", ":", "AiohttpClientMocker", ",", "host", ":", "str", "=", "HOST", ",", "port", ":", "str", "=", "PORT", ",", "base_path", ":", "str", "=", "BASE_PATH", ",", ")", "->", "None", ":", "sonarr_url", "=", ...
[ 123, 0 ]
[ 138, 74 ]
python
en
['eu', 'en', 'en']
True
mock_connection_invalid_auth
( aioclient_mock: AiohttpClientMocker, host: str = HOST, port: str = PORT, base_path: str = BASE_PATH, )
Mock Sonarr invalid auth errors.
Mock Sonarr invalid auth errors.
def mock_connection_invalid_auth( aioclient_mock: AiohttpClientMocker, host: str = HOST, port: str = PORT, base_path: str = BASE_PATH, ) -> None: """Mock Sonarr invalid auth errors.""" sonarr_url = f"http://{host}:{port}{base_path}" aioclient_mock.get(f"{sonarr_url}/system/status", status=4...
[ "def", "mock_connection_invalid_auth", "(", "aioclient_mock", ":", "AiohttpClientMocker", ",", "host", ":", "str", "=", "HOST", ",", "port", ":", "str", "=", "PORT", ",", "base_path", ":", "str", "=", "BASE_PATH", ",", ")", "->", "None", ":", "sonarr_url", ...
[ 141, 0 ]
[ 156, 66 ]
python
en
['en', 'et', 'en']
True
mock_connection_server_error
( aioclient_mock: AiohttpClientMocker, host: str = HOST, port: str = PORT, base_path: str = BASE_PATH, )
Mock Sonarr server errors.
Mock Sonarr server errors.
def mock_connection_server_error( aioclient_mock: AiohttpClientMocker, host: str = HOST, port: str = PORT, base_path: str = BASE_PATH, ) -> None: """Mock Sonarr server errors.""" sonarr_url = f"http://{host}:{port}{base_path}" aioclient_mock.get(f"{sonarr_url}/system/status", status=500) ...
[ "def", "mock_connection_server_error", "(", "aioclient_mock", ":", "AiohttpClientMocker", ",", "host", ":", "str", "=", "HOST", ",", "port", ":", "str", "=", "PORT", ",", "base_path", ":", "str", "=", "BASE_PATH", ",", ")", "->", "None", ":", "sonarr_url", ...
[ 159, 0 ]
[ 174, 66 ]
python
da
['da', 'no', 'en']
False
setup_integration
( hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker, host: str = HOST, port: str = PORT, base_path: str = BASE_PATH, api_key: str = API_KEY, unique_id: str = None, skip_entry_setup: bool = False, connection_error: bool = False, invalid_auth: bool = False, server_er...
Set up the Sonarr integration in Home Assistant.
Set up the Sonarr integration in Home Assistant.
async def setup_integration( hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker, host: str = HOST, port: str = PORT, base_path: str = BASE_PATH, api_key: str = API_KEY, unique_id: str = None, skip_entry_setup: bool = False, connection_error: bool = False, invalid_auth: ...
[ "async", "def", "setup_integration", "(", "hass", ":", "HomeAssistantType", ",", "aioclient_mock", ":", "AiohttpClientMocker", ",", "host", ":", "str", "=", "HOST", ",", "port", ":", "str", "=", "PORT", ",", "base_path", ":", "str", "=", "BASE_PATH", ",", ...
[ 177, 0 ]
[ 226, 16 ]
python
en
['en', 'en', 'en']
True
_patch_async_setup
(return_value=True)
Patch the async setup of sonarr.
Patch the async setup of sonarr.
def _patch_async_setup(return_value=True): """Patch the async setup of sonarr.""" return patch( "homeassistant.components.sonarr.async_setup", return_value=return_value )
[ "def", "_patch_async_setup", "(", "return_value", "=", "True", ")", ":", "return", "patch", "(", "\"homeassistant.components.sonarr.async_setup\"", ",", "return_value", "=", "return_value", ")" ]
[ 229, 0 ]
[ 233, 5 ]
python
en
['en', 'en', 'en']
True
_patch_async_setup_entry
(return_value=True)
Patch the async entry setup of sonarr.
Patch the async entry setup of sonarr.
def _patch_async_setup_entry(return_value=True): """Patch the async entry setup of sonarr.""" return patch( "homeassistant.components.sonarr.async_setup_entry", return_value=return_value, )
[ "def", "_patch_async_setup_entry", "(", "return_value", "=", "True", ")", ":", "return", "patch", "(", "\"homeassistant.components.sonarr.async_setup_entry\"", ",", "return_value", "=", "return_value", ",", ")" ]
[ 236, 0 ]
[ 241, 5 ]
python
en
['en', 'en', 'en']
True
test_setup_platform
(hass)
Test the legacy setup platform.
Test the legacy setup platform.
async def test_setup_platform(hass): """Test the legacy setup platform.""" mocked_device = _create_mocked_device(throw_exception=True) with _patch_media_player_device(mocked_device): await async_setup_component( hass, media_player.DOMAIN, { media_p...
[ "async", "def", "test_setup_platform", "(", "hass", ")", ":", "mocked_device", "=", "_create_mocked_device", "(", "throw_exception", "=", "True", ")", "with", "_patch_media_player_device", "(", "mocked_device", ")", ":", "await", "async_setup_component", "(", "hass", ...
[ 43, 0 ]
[ 65, 31 ]
python
en
['en', 'da', 'en']
True
test_setup_failed
(hass, caplog)
Test failed to set up the entity.
Test failed to set up the entity.
async def test_setup_failed(hass, caplog): """Test failed to set up the entity.""" mocked_device = _create_mocked_device(throw_exception=True) entry = MockConfigEntry(domain=songpal.DOMAIN, data=CONF_DATA) entry.add_to_hass(hass) with _patch_media_player_device(mocked_device): await hass.co...
[ "async", "def", "test_setup_failed", "(", "hass", ",", "caplog", ")", ":", "mocked_device", "=", "_create_mocked_device", "(", "throw_exception", "=", "True", ")", "entry", "=", "MockConfigEntry", "(", "domain", "=", "songpal", ".", "DOMAIN", ",", "data", "=",...
[ 68, 0 ]
[ 92, 70 ]
python
en
['en', 'en', 'en']
True
test_state
(hass)
Test state of the entity.
Test state of the entity.
async def test_state(hass): """Test state of the entity.""" mocked_device = _create_mocked_device() entry = MockConfigEntry(domain=songpal.DOMAIN, data=CONF_DATA) entry.add_to_hass(hass) with _patch_media_player_device(mocked_device): await hass.config_entries.async_setup(entry.entry_id) ...
[ "async", "def", "test_state", "(", "hass", ")", ":", "mocked_device", "=", "_create_mocked_device", "(", ")", "entry", "=", "MockConfigEntry", "(", "domain", "=", "songpal", ".", "DOMAIN", ",", "data", "=", "CONF_DATA", ")", "entry", ".", "add_to_hass", "(",...
[ 95, 0 ]
[ 127, 34 ]
python
en
['en', 'en', 'en']
True
test_services
(hass)
Test services.
Test services.
async def test_services(hass): """Test services.""" mocked_device = _create_mocked_device() entry = MockConfigEntry(domain=songpal.DOMAIN, data=CONF_DATA) entry.add_to_hass(hass) with _patch_media_player_device(mocked_device): await hass.config_entries.async_setup(entry.entry_id) aw...
[ "async", "def", "test_services", "(", "hass", ")", ":", "mocked_device", "=", "_create_mocked_device", "(", ")", "entry", "=", "MockConfigEntry", "(", "domain", "=", "songpal", ".", "DOMAIN", ",", "data", "=", "CONF_DATA", ")", "entry", ".", "add_to_hass", "...
[ 130, 0 ]
[ 197, 78 ]
python
en
['en', 'fr', 'en']
False
test_websocket_events
(hass)
Test websocket events.
Test websocket events.
async def test_websocket_events(hass): """Test websocket events.""" mocked_device = _create_mocked_device() entry = MockConfigEntry(domain=songpal.DOMAIN, data=CONF_DATA) entry.add_to_hass(hass) with _patch_media_player_device(mocked_device): await hass.config_entries.async_setup(entry.entr...
[ "async", "def", "test_websocket_events", "(", "hass", ")", ":", "mocked_device", "=", "_create_mocked_device", "(", ")", "entry", "=", "MockConfigEntry", "(", "domain", "=", "songpal", ".", "DOMAIN", ",", "data", "=", "CONF_DATA", ")", "entry", ".", "add_to_ha...
[ 200, 0 ]
[ 235, 56 ]
python
br
['br', 'da', 'en']
False
test_disconnected
(hass, caplog)
Test disconnected behavior.
Test disconnected behavior.
async def test_disconnected(hass, caplog): """Test disconnected behavior.""" mocked_device = _create_mocked_device() entry = MockConfigEntry(domain=songpal.DOMAIN, data=CONF_DATA) entry.add_to_hass(hass) with _patch_media_player_device(mocked_device): await hass.config_entries.async_setup(e...
[ "async", "def", "test_disconnected", "(", "hass", ",", "caplog", ")", ":", "mocked_device", "=", "_create_mocked_device", "(", ")", "entry", "=", "MockConfigEntry", "(", "domain", "=", "songpal", ".", "DOMAIN", ",", "data", "=", "CONF_DATA", ")", "entry", "....
[ 238, 0 ]
[ 264, 70 ]
python
en
['en', 'da', 'en']
True
mock_controller
()
Mock a successful Solaredge API.
Mock a successful Solaredge API.
def mock_controller(): """Mock a successful Solaredge API.""" api = Mock() api.get_details.return_value = {"details": {"status": "active"}} with patch("solaredge.Solaredge", return_value=api): yield api
[ "def", "mock_controller", "(", ")", ":", "api", "=", "Mock", "(", ")", "api", ".", "get_details", ".", "return_value", "=", "{", "\"details\"", ":", "{", "\"status\"", ":", "\"active\"", "}", "}", "with", "patch", "(", "\"solaredge.Solaredge\"", ",", "retu...
[ 18, 0 ]
[ 23, 17 ]
python
en
['it', 'sm', 'en']
False
init_config_flow
(hass)
Init a configuration flow.
Init a configuration flow.
def init_config_flow(hass): """Init a configuration flow.""" flow = config_flow.SolarEdgeConfigFlow() flow.hass = hass return flow
[ "def", "init_config_flow", "(", "hass", ")", ":", "flow", "=", "config_flow", ".", "SolarEdgeConfigFlow", "(", ")", "flow", ".", "hass", "=", "hass", "return", "flow" ]
[ 26, 0 ]
[ 30, 15 ]
python
en
['es', 'fr', 'en']
False
test_user
(hass, test_api)
Test user config.
Test user config.
async def test_user(hass, test_api): """Test user config.""" flow = init_config_flow(hass) result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user" # tets with all provided result = await flow.async_step_user( ...
[ "async", "def", "test_user", "(", "hass", ",", "test_api", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "result", "=", "await", "flow", ".", "async_step_user", "(", ")", "assert", "result", "[", "\"type\"", "]", "==", "data_entry_flow", "."...
[ 33, 0 ]
[ 48, 50 ]
python
en
['en', 'da', 'en']
True
test_import
(hass, test_api)
Test import step.
Test import step.
async def test_import(hass, test_api): """Test import step.""" flow = init_config_flow(hass) # import with site_id and api_key result = await flow.async_step_import( {CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID} ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY as...
[ "async", "def", "test_import", "(", "hass", ",", "test_api", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "# import with site_id and api_key", "result", "=", "await", "flow", ".", "async_step_import", "(", "{", "CONF_API_KEY", ":", "API_KEY", ","...
[ 51, 0 ]
[ 71, 50 ]
python
de
['de', 'sd', 'en']
False
test_abort_if_already_setup
(hass, test_api)
Test we abort if the site_id is already setup.
Test we abort if the site_id is already setup.
async def test_abort_if_already_setup(hass, test_api): """Test we abort if the site_id is already setup.""" flow = init_config_flow(hass) MockConfigEntry( domain="solaredge", data={CONF_NAME: DEFAULT_NAME, CONF_SITE_ID: SITE_ID, CONF_API_KEY: API_KEY}, ).add_to_hass(hass) # import: ...
[ "async", "def", "test_abort_if_already_setup", "(", "hass", ",", "test_api", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "MockConfigEntry", "(", "domain", "=", "\"solaredge\"", ",", "data", "=", "{", "CONF_NAME", ":", "DEFAULT_NAME", ",", "CON...
[ 74, 0 ]
[ 94, 60 ]
python
en
['en', 'en', 'en']
True
test_asserts
(hass, test_api)
Test the _site_in_configuration_exists method.
Test the _site_in_configuration_exists method.
async def test_asserts(hass, test_api): """Test the _site_in_configuration_exists method.""" flow = init_config_flow(hass) # test with inactive site test_api.get_details.return_value = {"details": {"status": "NOK"}} result = await flow.async_step_user( {CONF_NAME: NAME, CONF_API_KEY: API_KE...
[ "async", "def", "test_asserts", "(", "hass", ",", "test_api", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "# test with inactive site", "test_api", ".", "get_details", ".", "return_value", "=", "{", "\"details\"", ":", "{", "\"status\"", ":", "...
[ 97, 0 ]
[ 131, 66 ]
python
en
['en', 'en', 'en']
True
async_init_integration
( hass: HomeAssistant, skip_setup: bool = False, )
Set up the myq integration in Home Assistant.
Set up the myq integration in Home Assistant.
async def async_init_integration( hass: HomeAssistant, skip_setup: bool = False, ) -> MockConfigEntry: """Set up the myq integration in Home Assistant.""" devices_fixture = "myq/devices.json" devices_json = load_fixture(devices_fixture) devices_dict = json.loads(devices_json) def _handle_m...
[ "async", "def", "async_init_integration", "(", "hass", ":", "HomeAssistant", ",", "skip_setup", ":", "bool", "=", "False", ",", ")", "->", "MockConfigEntry", ":", "devices_fixture", "=", "\"myq/devices.json\"", "devices_json", "=", "load_fixture", "(", "devices_fixt...
[ 12, 0 ]
[ 41, 16 ]
python
en
['en', 'en', 'en']
True
async_call_action_from_config
( hass: HomeAssistant, config: ConfigType, variables: TemplateVarsType, context: Context, domain: str, )
Change state based on configuration.
Change state based on configuration.
async def async_call_action_from_config( hass: HomeAssistant, config: ConfigType, variables: TemplateVarsType, context: Context, domain: str, ) -> None: """Change state based on configuration.""" action_type = config[CONF_TYPE] if action_type == CONF_TURN_ON: action = "turn_on" ...
[ "async", "def", "async_call_action_from_config", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "variables", ":", "TemplateVarsType", ",", "context", ":", "Context", ",", "domain", ":", "str", ",", ")", "->", "None", ":", "action_typ...
[ 100, 0 ]
[ 120, 5 ]
python
en
['en', 'en', 'en']
True
async_condition_from_config
(config: ConfigType)
Evaluate state based on configuration.
Evaluate state based on configuration.
def async_condition_from_config(config: ConfigType) -> condition.ConditionCheckerType: """Evaluate state based on configuration.""" condition_type = config[CONF_TYPE] if condition_type == CONF_IS_ON: stat = "on" else: stat = "off" state_config = { condition.CONF_CONDITION: "s...
[ "def", "async_condition_from_config", "(", "config", ":", "ConfigType", ")", "->", "condition", ".", "ConditionCheckerType", ":", "condition_type", "=", "config", "[", "CONF_TYPE", "]", "if", "condition_type", "==", "CONF_IS_ON", ":", "stat", "=", "\"on\"", "else"...
[ 124, 0 ]
[ 139, 52 ]
python
en
['en', 'en', 'en']
True
async_attach_trigger
( hass: HomeAssistant, config: ConfigType, action: AutomationActionType, automation_info: dict, )
Listen for state changes based on configuration.
Listen for state changes based on configuration.
async def async_attach_trigger( hass: HomeAssistant, config: ConfigType, action: AutomationActionType, automation_info: dict, ) -> CALLBACK_TYPE: """Listen for state changes based on configuration.""" trigger_type = config[CONF_TYPE] if trigger_type == CONF_TURNED_ON: from_state = "o...
[ "async", "def", "async_attach_trigger", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "action", ":", "AutomationActionType", ",", "automation_info", ":", "dict", ",", ")", "->", "CALLBACK_TYPE", ":", "trigger_type", "=", "config", "["...
[ 142, 0 ]
[ 168, 5 ]
python
en
['en', 'en', 'en']
True
_async_get_automations
( hass: HomeAssistant, device_id: str, automation_templates: List[dict], domain: str )
List device automations.
List device automations.
async def _async_get_automations( hass: HomeAssistant, device_id: str, automation_templates: List[dict], domain: str ) -> List[dict]: """List device automations.""" automations: List[Dict[str, Any]] = [] entity_registry = await hass.helpers.entity_registry.async_get_registry() entries = [ e...
[ "async", "def", "_async_get_automations", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ",", "automation_templates", ":", "List", "[", "dict", "]", ",", "domain", ":", "str", ")", "->", "List", "[", "dict", "]", ":", "automations", ":", ...
[ 171, 0 ]
[ 195, 22 ]
python
en
['fr', 'en', 'en']
True
async_get_actions
( hass: HomeAssistant, device_id: str, domain: str )
List device actions.
List device actions.
async def async_get_actions( hass: HomeAssistant, device_id: str, domain: str ) -> List[dict]: """List device actions.""" return await _async_get_automations(hass, device_id, ENTITY_ACTIONS, domain)
[ "async", "def", "async_get_actions", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ",", "domain", ":", "str", ")", "->", "List", "[", "dict", "]", ":", "return", "await", "_async_get_automations", "(", "hass", ",", "device_id", ",", "ENT...
[ 198, 0 ]
[ 202, 80 ]
python
en
['fr', 'en', 'en']
True
async_get_conditions
( hass: HomeAssistant, device_id: str, domain: str )
List device conditions.
List device conditions.
async def async_get_conditions( hass: HomeAssistant, device_id: str, domain: str ) -> List[Dict[str, str]]: """List device conditions.""" return await _async_get_automations(hass, device_id, ENTITY_CONDITIONS, domain)
[ "async", "def", "async_get_conditions", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ",", "domain", ":", "str", ")", "->", "List", "[", "Dict", "[", "str", ",", "str", "]", "]", ":", "return", "await", "_async_get_automations", "(", "...
[ 205, 0 ]
[ 209, 83 ]
python
en
['fr', 'en', 'en']
True
async_get_triggers
( hass: HomeAssistant, device_id: str, domain: str )
List device triggers.
List device triggers.
async def async_get_triggers( hass: HomeAssistant, device_id: str, domain: str ) -> List[dict]: """List device triggers.""" return await _async_get_automations(hass, device_id, ENTITY_TRIGGERS, domain)
[ "async", "def", "async_get_triggers", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ",", "domain", ":", "str", ")", "->", "List", "[", "dict", "]", ":", "return", "await", "_async_get_automations", "(", "hass", ",", "device_id", ",", "EN...
[ 212, 0 ]
[ 216, 81 ]
python
en
['fr', 'en', 'en']
True
async_get_condition_capabilities
(hass: HomeAssistant, config: dict)
List condition capabilities.
List condition capabilities.
async def async_get_condition_capabilities(hass: HomeAssistant, config: dict) -> dict: """List condition capabilities.""" return { "extra_fields": vol.Schema( {vol.Optional(CONF_FOR): cv.positive_time_period_dict} ) }
[ "async", "def", "async_get_condition_capabilities", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", "->", "dict", ":", "return", "{", "\"extra_fields\"", ":", "vol", ".", "Schema", "(", "{", "vol", ".", "Optional", "(", "CONF_FOR", ")", ...
[ 219, 0 ]
[ 225, 5 ]
python
en
['ro', 'sr', 'en']
False
async_get_trigger_capabilities
(hass: HomeAssistant, config: dict)
List trigger capabilities.
List trigger capabilities.
async def async_get_trigger_capabilities(hass: HomeAssistant, config: dict) -> dict: """List trigger capabilities.""" return { "extra_fields": vol.Schema( {vol.Optional(CONF_FOR): cv.positive_time_period_dict} ) }
[ "async", "def", "async_get_trigger_capabilities", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", "->", "dict", ":", "return", "{", "\"extra_fields\"", ":", "vol", ".", "Schema", "(", "{", "vol", ".", "Optional", "(", "CONF_FOR", ")", "...
[ 228, 0 ]
[ 234, 5 ]
python
en
['en', 'la', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Import platform from yaml.
Import platform from yaml.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Import platform from yaml.""" hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data={CONF_HOST: config[HUB_ADDRESS]}, ...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "hass", ".", "async_create_task", "(", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",...
[ 29, 0 ]
[ 38, 5 ]
python
en
['en', 'ja', 'en']
True
async_setup_entry
(hass, entry, async_add_entities)
Set up powerview scene entries.
Set up powerview scene entries.
async def async_setup_entry(hass, entry, async_add_entities): """Set up powerview scene entries.""" pv_data = hass.data[DOMAIN][entry.entry_id] room_data = pv_data[PV_ROOM_DATA] scene_data = pv_data[PV_SCENE_DATA] pv_request = pv_data[PV_API] coordinator = pv_data[COORDINATOR] device_info =...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ",", "async_add_entities", ")", ":", "pv_data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", "]", "room_data", "=", "pv_data", "[", "PV_ROOM_DATA", "]", "scene_...
[ 41, 0 ]
[ 57, 32 ]
python
en
['en', 'en', 'en']
True
PowerViewScene.__init__
(self, scene, room_data, coordinator, device_info)
Initialize the scene.
Initialize the scene.
def __init__(self, scene, room_data, coordinator, device_info): """Initialize the scene.""" super().__init__(coordinator, device_info, scene.id) self._scene = scene self._room_name = room_data.get(scene.room_id, {}).get(ROOM_NAME_UNICODE, "")
[ "def", "__init__", "(", "self", ",", "scene", ",", "room_data", ",", "coordinator", ",", "device_info", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ",", "device_info", ",", "scene", ".", "id", ")", "self", ".", "_scene", "=", "sce...
[ 63, 4 ]
[ 67, 85 ]
python
en
['en', 'it', 'en']
True
PowerViewScene.name
(self)
Return the name of the scene.
Return the name of the scene.
def name(self): """Return the name of the scene.""" return self._scene.name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_scene", ".", "name" ]
[ 70, 4 ]
[ 72, 31 ]
python
en
['en', 'ig', 'en']
True
PowerViewScene.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" return {STATE_ATTRIBUTE_ROOM_NAME: self._room_name}
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "STATE_ATTRIBUTE_ROOM_NAME", ":", "self", ".", "_room_name", "}" ]
[ 75, 4 ]
[ 77, 59 ]
python
en
['en', 'en', 'en']
True
PowerViewScene.icon
(self)
Icon to use in the frontend.
Icon to use in the frontend.
def icon(self): """Icon to use in the frontend.""" return "mdi:blinds"
[ "def", "icon", "(", "self", ")", ":", "return", "\"mdi:blinds\"" ]
[ 80, 4 ]
[ 82, 27 ]
python
en
['en', 'en', 'en']
True
PowerViewScene.async_activate
(self, **kwargs: Any)
Activate scene. Try to get entities into requested state.
Activate scene. Try to get entities into requested state.
async def async_activate(self, **kwargs: Any) -> None: """Activate scene. Try to get entities into requested state.""" await self._scene.activate()
[ "async", "def", "async_activate", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "await", "self", ".", "_scene", ".", "activate", "(", ")" ]
[ 84, 4 ]
[ 86, 36 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], )
Set up a Vizio media player entry.
Set up a Vizio media player entry.
async def async_setup_entry( hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], ) -> None: """Set up a Vizio media player entry.""" host = config_entry.data[CONF_HOST] token = config_entry.data.get(CONF_ACCESS_TOKEN) name = config_en...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "Callable", "[", "[", "List", "[", "Entity", "]", ",", "bool", "]", ",", "None", "]", ",", ")", "->", "None...
[ 64, 0 ]
[ 129, 5 ]
python
en
['it', 'pt', 'en']
False
VizioDevice.__init__
( self, config_entry: ConfigEntry, device: VizioAsync, name: str, device_class: str, apps_coordinator: DataUpdateCoordinator, )
Initialize Vizio device.
Initialize Vizio device.
def __init__( self, config_entry: ConfigEntry, device: VizioAsync, name: str, device_class: str, apps_coordinator: DataUpdateCoordinator, ) -> None: """Initialize Vizio device.""" self._config_entry = config_entry self._apps_coordinator = apps_...
[ "def", "__init__", "(", "self", ",", "config_entry", ":", "ConfigEntry", ",", "device", ":", "VizioAsync", ",", "name", ":", "str", ",", "device_class", ":", "str", ",", "apps_coordinator", ":", "DataUpdateCoordinator", ",", ")", "->", "None", ":", "self", ...
[ 135, 4 ]
[ 171, 31 ]
python
it
['it', 'it', 'it']
True
VizioDevice._apps_list
(self, apps: List[str])
Return process apps list based on configured filters.
Return process apps list based on configured filters.
def _apps_list(self, apps: List[str]) -> List[str]: """Return process apps list based on configured filters.""" if self._conf_apps.get(CONF_INCLUDE): return [app for app in apps if app in self._conf_apps[CONF_INCLUDE]] if self._conf_apps.get(CONF_EXCLUDE): return [app fo...
[ "def", "_apps_list", "(", "self", ",", "apps", ":", "List", "[", "str", "]", ")", "->", "List", "[", "str", "]", ":", "if", "self", ".", "_conf_apps", ".", "get", "(", "CONF_INCLUDE", ")", ":", "return", "[", "app", "for", "app", "in", "apps", "i...
[ 173, 4 ]
[ 181, 19 ]
python
en
['en', 'en', 'en']
True
VizioDevice.async_update
(self)
Retrieve latest state of the device.
Retrieve latest state of the device.
async def async_update(self) -> None: """Retrieve latest state of the device.""" if not self._model: self._model = await self._device.get_model_name() if not self._sw_version: self._sw_version = await self._device.get_version() is_on = await self._device.get_pow...
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "_model", ":", "self", ".", "_model", "=", "await", "self", ".", "_device", ".", "get_model_name", "(", ")", "if", "not", "self", ".", "_sw_version", ":", ...
[ 183, 4 ]
[ 277, 36 ]
python
en
['en', 'en', 'en']
True
VizioDevice._get_additional_app_names
(self)
Return list of additional apps that were included in configuration.yaml.
Return list of additional apps that were included in configuration.yaml.
def _get_additional_app_names(self) -> List[Dict[str, Any]]: """Return list of additional apps that were included in configuration.yaml.""" return [ additional_app["name"] for additional_app in self._additional_app_configs ]
[ "def", "_get_additional_app_names", "(", "self", ")", "->", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":", "return", "[", "additional_app", "[", "\"name\"", "]", "for", "additional_app", "in", "self", ".", "_additional_app_configs", "]" ]
[ 279, 4 ]
[ 283, 9 ]
python
en
['en', 'en', 'en']
True
VizioDevice._async_send_update_options_signal
( hass: HomeAssistantType, config_entry: ConfigEntry )
Send update event when Vizio config entry is updated.
Send update event when Vizio config entry is updated.
async def _async_send_update_options_signal( hass: HomeAssistantType, config_entry: ConfigEntry ) -> None: """Send update event when Vizio config entry is updated.""" # Move this method to component level if another entity ever gets added for a single config entry. # See here: https:...
[ "async", "def", "_async_send_update_options_signal", "(", "hass", ":", "HomeAssistantType", ",", "config_entry", ":", "ConfigEntry", ")", "->", "None", ":", "# Move this method to component level if another entity ever gets added for a single config entry.", "# See here: https://gith...
[ 286, 4 ]
[ 292, 72 ]
python
en
['en', 'en', 'en']
True
VizioDevice._async_update_options
(self, config_entry: ConfigEntry)
Update options if the update signal comes from this entity.
Update options if the update signal comes from this entity.
async def _async_update_options(self, config_entry: ConfigEntry) -> None: """Update options if the update signal comes from this entity.""" self._volume_step = config_entry.options[CONF_VOLUME_STEP] # Update so that CONF_ADDITIONAL_CONFIGS gets retained for imports self._conf_apps.update...
[ "async", "def", "_async_update_options", "(", "self", ",", "config_entry", ":", "ConfigEntry", ")", "->", "None", ":", "self", ".", "_volume_step", "=", "config_entry", ".", "options", "[", "CONF_VOLUME_STEP", "]", "# Update so that CONF_ADDITIONAL_CONFIGS gets retained...
[ 294, 4 ]
[ 298, 71 ]
python
en
['en', 'en', 'en']
True
VizioDevice.async_update_setting
( self, setting_type: str, setting_name: str, new_value: Union[int, str] )
Update a setting when update_setting service is called.
Update a setting when update_setting service is called.
async def async_update_setting( self, setting_type: str, setting_name: str, new_value: Union[int, str] ) -> None: """Update a setting when update_setting service is called.""" await self._device.set_setting( setting_type, setting_name, new_value, )
[ "async", "def", "async_update_setting", "(", "self", ",", "setting_type", ":", "str", ",", "setting_name", ":", "str", ",", "new_value", ":", "Union", "[", "int", ",", "str", "]", ")", "->", "None", ":", "await", "self", ".", "_device", ".", "set_setting...
[ 300, 4 ]
[ 308, 9 ]
python
en
['en', 'en', 'en']
True
VizioDevice.async_added_to_hass
(self)
Register callbacks when entity is added.
Register callbacks when entity is added.
async def async_added_to_hass(self) -> None: """Register callbacks when entity is added.""" # Register callback for when config entry is updated. self.async_on_remove( self._config_entry.add_update_listener( self._async_send_update_options_signal ) ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "# Register callback for when config entry is updated.", "self", ".", "async_on_remove", "(", "self", ".", "_config_entry", ".", "add_update_listener", "(", "self", ".", "_async_send_update_option...
[ 310, 4 ]
[ 336, 13 ]
python
en
['en', 'en', 'en']
True
VizioDevice.available
(self)
Return the availabiliity of the device.
Return the availabiliity of the device.
def available(self) -> bool: """Return the availabiliity of the device.""" return self._available
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_available" ]
[ 339, 4 ]
[ 341, 30 ]
python
en
['en', 'en', 'en']
True
VizioDevice.state
(self)
Return the state of the device.
Return the state of the device.
def state(self) -> Optional[str]: """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "self", ".", "_state" ]
[ 344, 4 ]
[ 346, 26 ]
python
en
['en', 'en', 'en']
True
VizioDevice.name
(self)
Return the name of the device.
Return the name of the device.
def name(self) -> str: """Return the name of the device.""" return self._name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_name" ]
[ 349, 4 ]
[ 351, 25 ]
python
en
['en', 'en', 'en']
True
VizioDevice.icon
(self)
Return the icon of the device.
Return the icon of the device.
def icon(self) -> str: """Return the icon of the device.""" return self._icon
[ "def", "icon", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_icon" ]
[ 354, 4 ]
[ 356, 25 ]
python
en
['en', 'en', 'en']
True
VizioDevice.volume_level
(self)
Return the volume level of the device.
Return the volume level of the device.
def volume_level(self) -> Optional[float]: """Return the volume level of the device.""" return self._volume_level
[ "def", "volume_level", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "_volume_level" ]
[ 359, 4 ]
[ 361, 33 ]
python
en
['en', 'en', 'en']
True
VizioDevice.is_volume_muted
(self)
Boolean if volume is currently muted.
Boolean if volume is currently muted.
def is_volume_muted(self): """Boolean if volume is currently muted.""" return self._is_volume_muted
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "_is_volume_muted" ]
[ 364, 4 ]
[ 366, 36 ]
python
en
['en', 'en', 'en']
True
VizioDevice.source
(self)
Return current input of the device.
Return current input of the device.
def source(self) -> Optional[str]: """Return current input of the device.""" if self._current_app is not None and self._current_input in INPUT_APPS: return self._current_app return self._current_input
[ "def", "source", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "self", ".", "_current_app", "is", "not", "None", "and", "self", ".", "_current_input", "in", "INPUT_APPS", ":", "return", "self", ".", "_current_app", "return", "self", "."...
[ 369, 4 ]
[ 374, 34 ]
python
en
['en', 'en', 'en']
True
VizioDevice.source_list
(self)
Return list of available inputs of the device.
Return list of available inputs of the device.
def source_list(self) -> List[str]: """Return list of available inputs of the device.""" # If Smartcast app is in input list, and the app list has been retrieved, # show the combination with , otherwise just return inputs if self._available_apps: return [ *[ ...
[ "def", "source_list", "(", "self", ")", "->", "List", "[", "str", "]", ":", "# If Smartcast app is in input list, and the app list has been retrieved,", "# show the combination with , otherwise just return inputs", "if", "self", ".", "_available_apps", ":", "return", "[", "*"...
[ 377, 4 ]
[ 396, 37 ]
python
en
['en', 'en', 'en']
True
VizioDevice.app_id
(self)
Return the ID of the current app if it is unknown by pyvizio.
Return the ID of the current app if it is unknown by pyvizio.
def app_id(self) -> Optional[str]: """Return the ID of the current app if it is unknown by pyvizio.""" if self._current_app_config and self.app_name == UNKNOWN_APP: return { "APP_ID": self._current_app_config.APP_ID, "NAME_SPACE": self._current_app_config.NAME...
[ "def", "app_id", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "self", ".", "_current_app_config", "and", "self", ".", "app_name", "==", "UNKNOWN_APP", ":", "return", "{", "\"APP_ID\"", ":", "self", ".", "_current_app_config", ".", "APP_I...
[ 399, 4 ]
[ 408, 19 ]
python
en
['en', 'en', 'en']
True
VizioDevice.app_name
(self)
Return the friendly name of the current app.
Return the friendly name of the current app.
def app_name(self) -> Optional[str]: """Return the friendly name of the current app.""" return self._current_app
[ "def", "app_name", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "self", ".", "_current_app" ]
[ 411, 4 ]
[ 413, 32 ]
python
en
['en', 'en', 'en']
True
VizioDevice.supported_features
(self)
Flag device features that are supported.
Flag device features that are supported.
def supported_features(self) -> int: """Flag device features that are supported.""" return self._supported_commands
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_supported_commands" ]
[ 416, 4 ]
[ 418, 39 ]
python
en
['en', 'en', 'en']
True
VizioDevice.unique_id
(self)
Return the unique id of the device.
Return the unique id of the device.
def unique_id(self) -> str: """Return the unique id of the device.""" return self._config_entry.unique_id
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_config_entry", ".", "unique_id" ]
[ 421, 4 ]
[ 423, 43 ]
python
en
['en', 'en', 'en']
True
VizioDevice.device_info
(self)
Return device registry information.
Return device registry information.
def device_info(self) -> Dict[str, Any]: """Return device registry information.""" return { "identifiers": {(DOMAIN, self._config_entry.unique_id)}, "name": self.name, "manufacturer": "VIZIO", "model": self._model, "sw_version": self._sw_versio...
[ "def", "device_info", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_config_entry", ".", "unique_id", ")", "}", ",", "\"name\"", ":", "self", ".", "name...
[ 426, 4 ]
[ 434, 9 ]
python
en
['en', 'da', 'en']
True
VizioDevice.device_class
(self)
Return device class for entity.
Return device class for entity.
def device_class(self) -> str: """Return device class for entity.""" return self._device_class
[ "def", "device_class", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_class" ]
[ 437, 4 ]
[ 439, 33 ]
python
en
['da', 'en', 'en']
True
VizioDevice.sound_mode
(self)
Name of the current sound mode.
Name of the current sound mode.
def sound_mode(self) -> Optional[str]: """Name of the current sound mode.""" return self._current_sound_mode
[ "def", "sound_mode", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "self", ".", "_current_sound_mode" ]
[ 442, 4 ]
[ 444, 39 ]
python
en
['en', 'en', 'en']
True
VizioDevice.sound_mode_list
(self)
List of available sound modes.
List of available sound modes.
def sound_mode_list(self) -> Optional[List[str]]: """List of available sound modes.""" return self._available_sound_modes
[ "def", "sound_mode_list", "(", "self", ")", "->", "Optional", "[", "List", "[", "str", "]", "]", ":", "return", "self", ".", "_available_sound_modes" ]
[ 447, 4 ]
[ 449, 42 ]
python
en
['en', 'en', 'en']
True
VizioDevice.async_select_sound_mode
(self, sound_mode)
Select sound mode.
Select sound mode.
async def async_select_sound_mode(self, sound_mode): """Select sound mode.""" if sound_mode in self._available_sound_modes: await self._device.set_setting( VIZIO_AUDIO_SETTINGS, VIZIO_SOUND_MODE, sound_mode )
[ "async", "def", "async_select_sound_mode", "(", "self", ",", "sound_mode", ")", ":", "if", "sound_mode", "in", "self", ".", "_available_sound_modes", ":", "await", "self", ".", "_device", ".", "set_setting", "(", "VIZIO_AUDIO_SETTINGS", ",", "VIZIO_SOUND_MODE", ",...
[ 451, 4 ]
[ 456, 13 ]
python
en
['en', 'mk', 'en']
True
VizioDevice.async_turn_on
(self)
Turn the device on.
Turn the device on.
async def async_turn_on(self) -> None: """Turn the device on.""" await self._device.pow_on()
[ "async", "def", "async_turn_on", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_device", ".", "pow_on", "(", ")" ]
[ 458, 4 ]
[ 460, 35 ]
python
en
['en', 'en', 'en']
True
VizioDevice.async_turn_off
(self)
Turn the device off.
Turn the device off.
async def async_turn_off(self) -> None: """Turn the device off.""" await self._device.pow_off()
[ "async", "def", "async_turn_off", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_device", ".", "pow_off", "(", ")" ]
[ 462, 4 ]
[ 464, 36 ]
python
en
['en', 'en', 'en']
True
VizioDevice.async_mute_volume
(self, mute: bool)
Mute the volume.
Mute the volume.
async def async_mute_volume(self, mute: bool) -> None: """Mute the volume.""" if mute: await self._device.mute_on() self._is_volume_muted = True else: await self._device.mute_off() self._is_volume_muted = False
[ "async", "def", "async_mute_volume", "(", "self", ",", "mute", ":", "bool", ")", "->", "None", ":", "if", "mute", ":", "await", "self", ".", "_device", ".", "mute_on", "(", ")", "self", ".", "_is_volume_muted", "=", "True", "else", ":", "await", "self"...
[ 466, 4 ]
[ 473, 41 ]
python
en
['en', 'sn', 'en']
True
VizioDevice.async_media_previous_track
(self)
Send previous channel command.
Send previous channel command.
async def async_media_previous_track(self) -> None: """Send previous channel command.""" await self._device.ch_down()
[ "async", "def", "async_media_previous_track", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_device", ".", "ch_down", "(", ")" ]
[ 475, 4 ]
[ 477, 36 ]
python
en
['en', 'en', 'en']
True
VizioDevice.async_media_next_track
(self)
Send next channel command.
Send next channel command.
async def async_media_next_track(self) -> None: """Send next channel command.""" await self._device.ch_up()
[ "async", "def", "async_media_next_track", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_device", ".", "ch_up", "(", ")" ]
[ 479, 4 ]
[ 481, 34 ]
python
en
['en', 'en', 'en']
True
VizioDevice.async_select_source
(self, source: str)
Select input source.
Select input source.
async def async_select_source(self, source: str) -> None: """Select input source.""" if source in self._available_inputs: await self._device.set_input(source) elif source in self._get_additional_app_names(): await self._device.launch_app_config( **next( ...
[ "async", "def", "async_select_source", "(", "self", ",", "source", ":", "str", ")", "->", "None", ":", "if", "source", "in", "self", ".", "_available_inputs", ":", "await", "self", ".", "_device", ".", "set_input", "(", "source", ")", "elif", "source", "...
[ 483, 4 ]
[ 496, 65 ]
python
en
['fr', 'su', 'en']
False
VizioDevice.async_volume_up
(self)
Increase volume of the device.
Increase volume of the device.
async def async_volume_up(self) -> None: """Increase volume of the device.""" await self._device.vol_up(num=self._volume_step) if self._volume_level is not None: self._volume_level = min( 1.0, self._volume_level + self._volume_step / self._max_volume )
[ "async", "def", "async_volume_up", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_device", ".", "vol_up", "(", "num", "=", "self", ".", "_volume_step", ")", "if", "self", ".", "_volume_level", "is", "not", "None", ":", "self", ".", "_volu...
[ 498, 4 ]
[ 505, 13 ]
python
en
['en', 'en', 'en']
True
VizioDevice.async_volume_down
(self)
Decrease volume of the device.
Decrease volume of the device.
async def async_volume_down(self) -> None: """Decrease volume of the device.""" await self._device.vol_down(num=self._volume_step) if self._volume_level is not None: self._volume_level = max( 0.0, self._volume_level - self._volume_step / self._max_volume ...
[ "async", "def", "async_volume_down", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_device", ".", "vol_down", "(", "num", "=", "self", ".", "_volume_step", ")", "if", "self", ".", "_volume_level", "is", "not", "None", ":", "self", ".", "_...
[ 507, 4 ]
[ 514, 13 ]
python
en
['en', 'sr', 'en']
True
VizioDevice.async_set_volume_level
(self, volume: float)
Set volume level.
Set volume level.
async def async_set_volume_level(self, volume: float) -> None: """Set volume level.""" if self._volume_level is not None: if volume > self._volume_level: num = int(self._max_volume * (volume - self._volume_level)) await self._device.vol_up(num=num) ...
[ "async", "def", "async_set_volume_level", "(", "self", ",", "volume", ":", "float", ")", "->", "None", ":", "if", "self", ".", "_volume_level", "is", "not", "None", ":", "if", "volume", ">", "self", ".", "_volume_level", ":", "num", "=", "int", "(", "s...
[ 516, 4 ]
[ 527, 43 ]
python
en
['fr', 'sr', 'en']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the IO expander devices.
Set up the IO expander devices.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the IO expander devices.""" pins = config[CONF_PINS] binary_sensors = [] pi4ioe5v9xxxx.setup( i2c_bus=config[CONF_I2CBUS], i2c_addr=config[CONF_I2CADDR], bits=config[CONF_BITS], read_mode=True...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "pins", "=", "config", "[", "CONF_PINS", "]", "binary_sensors", "=", "[", "]", "pi4ioe5v9xxxx", ".", "setup", "(", "i2c_bus", "=", "conf...
[ 33, 0 ]
[ 49, 38 ]
python
en
['en', 'en', 'en']
True
Pi4ioe5v9BinarySensor.__init__
(self, name, pin, invert_logic)
Initialize the pi4ioe5v9xxxx sensor.
Initialize the pi4ioe5v9xxxx sensor.
def __init__(self, name, pin, invert_logic): """Initialize the pi4ioe5v9xxxx sensor.""" self._name = name or DEVICE_DEFAULT_NAME self._pin = pin self._invert_logic = invert_logic self._state = pi4ioe5v9xxxx.pin_from_memory(self._pin)
[ "def", "__init__", "(", "self", ",", "name", ",", "pin", ",", "invert_logic", ")", ":", "self", ".", "_name", "=", "name", "or", "DEVICE_DEFAULT_NAME", "self", ".", "_pin", "=", "pin", "self", ".", "_invert_logic", "=", "invert_logic", "self", ".", "_sta...
[ 55, 4 ]
[ 60, 62 ]
python
en
['en', 'pt', 'en']
True
Pi4ioe5v9BinarySensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 63, 4 ]
[ 65, 25 ]
python
en
['en', 'mi', 'en']
True
Pi4ioe5v9BinarySensor.is_on
(self)
Return the state of the entity.
Return the state of the entity.
def is_on(self): """Return the state of the entity.""" return self._state != self._invert_logic
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state", "!=", "self", ".", "_invert_logic" ]
[ 68, 4 ]
[ 70, 48 ]
python
en
['en', 'en', 'en']
True
Pi4ioe5v9BinarySensor.update
(self)
Update the IO state.
Update the IO state.
def update(self): """Update the IO state.""" pi4ioe5v9xxxx.hw_to_memory() self._state = pi4ioe5v9xxxx.pin_from_memory(self._pin)
[ "def", "update", "(", "self", ")", ":", "pi4ioe5v9xxxx", ".", "hw_to_memory", "(", ")", "self", ".", "_state", "=", "pi4ioe5v9xxxx", ".", "pin_from_memory", "(", "self", ".", "_pin", ")" ]
[ 72, 4 ]
[ 75, 62 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the BeagleBone Black GPIO component.
Set up the BeagleBone Black GPIO component.
def setup(hass, config): """Set up the BeagleBone Black GPIO component.""" # pylint: disable=import-error def cleanup_gpio(event): """Stuff to do before stopping.""" GPIO.cleanup() def prepare_gpio(event): """Stuff to do when Home Assistant starts.""" hass.bus.listen_on...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "# pylint: disable=import-error", "def", "cleanup_gpio", "(", "event", ")", ":", "\"\"\"Stuff to do before stopping.\"\"\"", "GPIO", ".", "cleanup", "(", ")", "def", "prepare_gpio", "(", "event", ")", ":", "\...
[ 8, 0 ]
[ 21, 15 ]
python
en
['en', 'pt', 'en']
True
setup_output
(pin)
Set up a GPIO as output.
Set up a GPIO as output.
def setup_output(pin): """Set up a GPIO as output.""" GPIO.setup(pin, GPIO.OUT)
[ "def", "setup_output", "(", "pin", ")", ":", "GPIO", ".", "setup", "(", "pin", ",", "GPIO", ".", "OUT", ")" ]
[ 24, 0 ]
[ 27, 29 ]
python
en
['en', 'el-Latn', 'en']
True
setup_input
(pin, pull_mode)
Set up a GPIO as input.
Set up a GPIO as input.
def setup_input(pin, pull_mode): """Set up a GPIO as input.""" GPIO.setup(pin, GPIO.IN, GPIO.PUD_DOWN if pull_mode == "DOWN" else GPIO.PUD_UP)
[ "def", "setup_input", "(", "pin", ",", "pull_mode", ")", ":", "GPIO", ".", "setup", "(", "pin", ",", "GPIO", ".", "IN", ",", "GPIO", ".", "PUD_DOWN", "if", "pull_mode", "==", "\"DOWN\"", "else", "GPIO", ".", "PUD_UP", ")" ]
[ 30, 0 ]
[ 33, 83 ]
python
en
['en', 'haw', 'en']
True
write_output
(pin, value)
Write a value to a GPIO.
Write a value to a GPIO.
def write_output(pin, value): """Write a value to a GPIO.""" GPIO.output(pin, value)
[ "def", "write_output", "(", "pin", ",", "value", ")", ":", "GPIO", ".", "output", "(", "pin", ",", "value", ")" ]
[ 36, 0 ]
[ 39, 27 ]
python
en
['en', 'pt', 'en']
True
read_input
(pin)
Read a value from a GPIO.
Read a value from a GPIO.
def read_input(pin): """Read a value from a GPIO.""" return GPIO.input(pin) is GPIO.HIGH
[ "def", "read_input", "(", "pin", ")", ":", "return", "GPIO", ".", "input", "(", "pin", ")", "is", "GPIO", ".", "HIGH" ]
[ 42, 0 ]
[ 45, 39 ]
python
en
['en', 'en', 'en']
True
edge_detect
(pin, event_callback, bounce)
Add detection for RISING and FALLING events.
Add detection for RISING and FALLING events.
def edge_detect(pin, event_callback, bounce): """Add detection for RISING and FALLING events.""" GPIO.add_event_detect(pin, GPIO.BOTH, callback=event_callback, bouncetime=bounce)
[ "def", "edge_detect", "(", "pin", ",", "event_callback", ",", "bounce", ")", ":", "GPIO", ".", "add_event_detect", "(", "pin", ",", "GPIO", ".", "BOTH", ",", "callback", "=", "event_callback", ",", "bouncetime", "=", "bounce", ")" ]
[ 48, 0 ]
[ 51, 85 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, _, add_entities, discovery_info=None)
Add switches from the main Qwikswitch component.
Add switches from the main Qwikswitch component.
async def async_setup_platform(hass, _, add_entities, discovery_info=None): """Add switches from the main Qwikswitch component.""" if discovery_info is None: return qsusb = hass.data[QWIKSWITCH] devs = [QSSwitch(qsid, qsusb) for qsid in discovery_info[QWIKSWITCH]] add_entities(devs)
[ "async", "def", "async_setup_platform", "(", "hass", ",", "_", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "qsusb", "=", "hass", ".", "data", "[", "QWIKSWITCH", "]", "devs", "=", ...
[ 6, 0 ]
[ 13, 22 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Initialize the platform.
Initialize the platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Initialize the platform.""" if discovery_info is None or discovery_info[ATTR_DISCOVER_DEVICES] is None: return disc_info = discovery_info[ATTR_DISCOVER_DEVICES] async_add_entities( ( E...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", "or", "discovery_info", "[", "ATTR_DISCOVER_DEVICES", "]", "is", "None", ":", "retu...
[ 17, 0 ]
[ 37, 5 ]
python
en
['en', 'en', 'en']
True
EgardiaBinarySensor.__init__
(self, sensor_id, name, egardia_system, device_class)
Initialize the sensor device.
Initialize the sensor device.
def __init__(self, sensor_id, name, egardia_system, device_class): """Initialize the sensor device.""" self._id = sensor_id self._name = name self._state = None self._device_class = device_class self._egardia_system = egardia_system
[ "def", "__init__", "(", "self", ",", "sensor_id", ",", "name", ",", "egardia_system", ",", "device_class", ")", ":", "self", ".", "_id", "=", "sensor_id", "self", ".", "_name", "=", "name", "self", ".", "_state", "=", "None", "self", ".", "_device_class"...
[ 43, 4 ]
[ 49, 45 ]
python
en
['en', 'en', 'en']
True
EgardiaBinarySensor.update
(self)
Update the status.
Update the status.
def update(self): """Update the status.""" egardia_input = self._egardia_system.getsensorstate(self._id) self._state = STATE_ON if egardia_input else STATE_OFF
[ "def", "update", "(", "self", ")", ":", "egardia_input", "=", "self", ".", "_egardia_system", ".", "getsensorstate", "(", "self", ".", "_id", ")", "self", ".", "_state", "=", "STATE_ON", "if", "egardia_input", "else", "STATE_OFF" ]
[ 51, 4 ]
[ 54, 62 ]
python
en
['en', 'sn', 'en']
True
EgardiaBinarySensor.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 57, 4 ]
[ 59, 25 ]
python
en
['en', 'en', 'en']
True
EgardiaBinarySensor.is_on
(self)
Whether the device is switched on.
Whether the device is switched on.
def is_on(self): """Whether the device is switched on.""" return self._state == STATE_ON
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state", "==", "STATE_ON" ]
[ 62, 4 ]
[ 64, 38 ]
python
en
['en', 'en', 'en']
True
EgardiaBinarySensor.device_class
(self)
Return the device class.
Return the device class.
def device_class(self): """Return the device class.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 67, 4 ]
[ 69, 33 ]
python
en
['en', 'en', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 22, 0 ]
[ 24, 57 ]
python
en
['en', 'en', 'en']
True
setup_comp
(hass)
Initialize components.
Initialize components.
def setup_comp(hass): """Initialize components.""" mock_component(hass, "group") hass.states.async_set("test.entity", "hello")
[ "def", "setup_comp", "(", "hass", ")", ":", "mock_component", "(", "hass", ",", "\"group\"", ")", "hass", ".", "states", ".", "async_set", "(", "\"test.entity\"", ",", "\"hello\"", ")" ]
[ 28, 0 ]
[ 31, 49 ]
python
en
['de', 'en', 'en']
False
test_if_fires_on_entity_change
(hass, calls)
Test for firing on entity change.
Test for firing on entity change.
async def test_if_fires_on_entity_change(hass, calls): """Test for firing on entity change.""" context = Context() hass.states.async_set("test.entity", "hello") await hass.async_block_till_done() assert await async_setup_component( hass, automation.DOMAIN, { auto...
[ "async", "def", "test_if_fires_on_entity_change", "(", "hass", ",", "calls", ")", ":", "context", "=", "Context", "(", ")", "hass", ".", "states", ".", "async_set", "(", "\"test.entity\"", ",", "\"hello\"", ")", "await", "hass", ".", "async_block_till_done", "...
[ 34, 0 ]
[ 80, 26 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_entity_change_with_from_filter
(hass, calls)
Test for firing on entity change with filter.
Test for firing on entity change with filter.
async def test_if_fires_on_entity_change_with_from_filter(hass, calls): """Test for firing on entity change with filter.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state"...
[ "async", "def", "test_if_fires_on_entity_change_with_from_filter", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", ...
[ 83, 0 ]
[ 103, 26 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_entity_change_with_to_filter
(hass, calls)
Test for firing on entity change with no filter.
Test for firing on entity change with no filter.
async def test_if_fires_on_entity_change_with_to_filter(hass, calls): """Test for firing on entity change with no filter.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state...
[ "async", "def", "test_if_fires_on_entity_change_with_to_filter", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", ...
[ 106, 0 ]
[ 126, 26 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_attribute_change_with_to_filter
(hass, calls)
Test for not firing on attribute change.
Test for not firing on attribute change.
async def test_if_fires_on_attribute_change_with_to_filter(hass, calls): """Test for not firing on attribute change.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_if_fires_on_attribute_change_with_to_filter", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":",...
[ 129, 0 ]
[ 150, 26 ]
python
en
['en', 'en', 'en']
True