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_themes_set_dark_theme_wrong_name
(hass, hass_ws_client)
Test frontend.set_theme service called with mode dark and wrong name.
Test frontend.set_theme service called with mode dark and wrong name.
async def test_themes_set_dark_theme_wrong_name(hass, hass_ws_client): """Test frontend.set_theme service called with mode dark and wrong name.""" assert await async_setup_component(hass, "frontend", CONFIG_THEMES) client = await hass_ws_client(hass) await hass.services.async_call( DOMAIN, "set...
[ "async", "def", "test_themes_set_dark_theme_wrong_name", "(", "hass", ",", "hass_ws_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"frontend\"", ",", "CONFIG_THEMES", ")", "client", "=", "await", "hass_ws_client", "(", "hass", ")"...
[ 282, 0 ]
[ 295, 54 ]
python
en
['en', 'en', 'en']
True
test_themes_reload_themes
(hass, hass_ws_client)
Test frontend.reload_themes service.
Test frontend.reload_themes service.
async def test_themes_reload_themes(hass, hass_ws_client): """Test frontend.reload_themes service.""" assert await async_setup_component(hass, "frontend", CONFIG_THEMES) client = await hass_ws_client(hass) with patch( "homeassistant.components.frontend.async_hass_config_yaml", return_va...
[ "async", "def", "test_themes_reload_themes", "(", "hass", ",", "hass_ws_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"frontend\"", ",", "CONFIG_THEMES", ")", "client", "=", "await", "hass_ws_client", "(", "hass", ")", "with", ...
[ 298, 0 ]
[ 317, 54 ]
python
en
['en', 'en', 'en']
True
test_missing_themes
(hass, hass_ws_client)
Test that themes API works when themes are not defined.
Test that themes API works when themes are not defined.
async def test_missing_themes(hass, hass_ws_client): """Test that themes API works when themes are not defined.""" await async_setup_component(hass, "frontend", {}) client = await hass_ws_client(hass) await client.send_json({"id": 5, "type": "frontend/get_themes"}) msg = await client.receive_json(...
[ "async", "def", "test_missing_themes", "(", "hass", ",", "hass_ws_client", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"frontend\"", ",", "{", "}", ")", "client", "=", "await", "hass_ws_client", "(", "hass", ")", "await", "client", ".", "...
[ 320, 0 ]
[ 333, 40 ]
python
en
['en', 'en', 'en']
True
test_get_panels
(hass, hass_ws_client, mock_http_client)
Test get_panels command.
Test get_panels command.
async def test_get_panels(hass, hass_ws_client, mock_http_client): """Test get_panels command.""" events = async_capture_events(hass, EVENT_PANELS_UPDATED) resp = await mock_http_client.get("/map") assert resp.status == HTTP_NOT_FOUND hass.components.frontend.async_register_built_in_panel( ...
[ "async", "def", "test_get_panels", "(", "hass", ",", "hass_ws_client", ",", "mock_http_client", ")", ":", "events", "=", "async_capture_events", "(", "hass", ",", "EVENT_PANELS_UPDATED", ")", "resp", "=", "await", "mock_http_client", ".", "get", "(", "\"/map\"", ...
[ 336, 0 ]
[ 371, 27 ]
python
en
['nl', 'en', 'en']
True
test_get_panels_non_admin
(hass, hass_ws_client, hass_admin_user)
Test get_panels command.
Test get_panels command.
async def test_get_panels_non_admin(hass, hass_ws_client, hass_admin_user): """Test get_panels command.""" hass_admin_user.groups = [] await async_setup_component(hass, "frontend", {}) hass.components.frontend.async_register_built_in_panel( "map", "Map", "mdi:tooltip-account", require_admin=True...
[ "async", "def", "test_get_panels_non_admin", "(", "hass", ",", "hass_ws_client", ",", "hass_admin_user", ")", ":", "hass_admin_user", ".", "groups", "=", "[", "]", "await", "async_setup_component", "(", "hass", ",", "\"frontend\"", ",", "{", "}", ")", "hass", ...
[ 374, 0 ]
[ 394, 37 ]
python
en
['nl', 'en', 'en']
True
test_get_translations
(hass, hass_ws_client)
Test get_translations command.
Test get_translations command.
async def test_get_translations(hass, hass_ws_client): """Test get_translations command.""" await async_setup_component(hass, "frontend", {}) client = await hass_ws_client(hass) with patch( "homeassistant.components.frontend.async_get_translations", side_effect=lambda hass, lang, catego...
[ "async", "def", "test_get_translations", "(", "hass", ",", "hass_ws_client", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"frontend\"", ",", "{", "}", ")", "client", "=", "await", "hass_ws_client", "(", "hass", ")", "with", "patch", "(", "...
[ 397, 0 ]
[ 421, 57 ]
python
en
['en', 'da', 'en']
True
test_auth_load
(mock_http_client, mock_onboarded)
Test auth component loaded by default.
Test auth component loaded by default.
async def test_auth_load(mock_http_client, mock_onboarded): """Test auth component loaded by default.""" resp = await mock_http_client.get("/auth/providers") assert resp.status == 200
[ "async", "def", "test_auth_load", "(", "mock_http_client", ",", "mock_onboarded", ")", ":", "resp", "=", "await", "mock_http_client", ".", "get", "(", "\"/auth/providers\"", ")", "assert", "resp", ".", "status", "==", "200" ]
[ 424, 0 ]
[ 427, 29 ]
python
en
['en', 'en', 'en']
True
test_onboarding_load
(mock_http_client)
Test onboarding component loaded by default.
Test onboarding component loaded by default.
async def test_onboarding_load(mock_http_client): """Test onboarding component loaded by default.""" resp = await mock_http_client.get("/api/onboarding") assert resp.status == 200
[ "async", "def", "test_onboarding_load", "(", "mock_http_client", ")", ":", "resp", "=", "await", "mock_http_client", ".", "get", "(", "\"/api/onboarding\"", ")", "assert", "resp", ".", "status", "==", "200" ]
[ 430, 0 ]
[ 433, 29 ]
python
en
['en', 'en', 'en']
True
test_auth_authorize
(mock_http_client)
Test the authorize endpoint works.
Test the authorize endpoint works.
async def test_auth_authorize(mock_http_client): """Test the authorize endpoint works.""" resp = await mock_http_client.get( "/auth/authorize?response_type=code&client_id=https://localhost/&" "redirect_uri=https://localhost/&state=123%23456" ) assert resp.status == 200 # No caching o...
[ "async", "def", "test_auth_authorize", "(", "mock_http_client", ")", ":", "resp", "=", "await", "mock_http_client", ".", "get", "(", "\"/auth/authorize?response_type=code&client_id=https://localhost/&\"", "\"redirect_uri=https://localhost/&state=123%23456\"", ")", "assert", "resp...
[ 436, 0 ]
[ 456, 56 ]
python
en
['en', 'en', 'en']
True
test_get_version
(hass, hass_ws_client)
Test get_version command.
Test get_version command.
async def test_get_version(hass, hass_ws_client): """Test get_version command.""" frontend = await async_get_integration(hass, "frontend") cur_version = next( req.split("==", 1)[1] for req in frontend.requirements if req.startswith("home-assistant-frontend==") ) await async_...
[ "async", "def", "test_get_version", "(", "hass", ",", "hass_ws_client", ")", ":", "frontend", "=", "await", "async_get_integration", "(", "hass", ",", "\"frontend\"", ")", "cur_version", "=", "next", "(", "req", ".", "split", "(", "\"==\"", ",", "1", ")", ...
[ 459, 0 ]
[ 477, 52 ]
python
en
['nl', 'en', 'en']
True
test_static_paths
(hass, mock_http_client)
Test static paths.
Test static paths.
async def test_static_paths(hass, mock_http_client): """Test static paths.""" resp = await mock_http_client.get( "/.well-known/change-password", allow_redirects=False ) assert resp.status == 302 assert resp.headers["location"] == "/profile"
[ "async", "def", "test_static_paths", "(", "hass", ",", "mock_http_client", ")", ":", "resp", "=", "await", "mock_http_client", ".", "get", "(", "\"/.well-known/change-password\"", ",", "allow_redirects", "=", "False", ")", "assert", "resp", ".", "status", "==", ...
[ 480, 0 ]
[ 486, 49 ]
python
en
['en', 'en', 'en']
True
mock_detections
()
Return a mock detection.
Return a mock detection.
def mock_detections(): """Return a mock detection.""" with mock.patch( "simplehound.core.cloud.detect", return_value=MOCK_DETECTIONS ) as detection: yield detection
[ "def", "mock_detections", "(", ")", ":", "with", "mock", ".", "patch", "(", "\"simplehound.core.cloud.detect\"", ",", "return_value", "=", "MOCK_DETECTIONS", ")", "as", "detection", ":", "yield", "detection" ]
[ 49, 0 ]
[ 54, 23 ]
python
da
['es', 'da', 'en']
False
mock_image
()
Return a mock camera image.
Return a mock camera image.
def mock_image(): """Return a mock camera image.""" with mock.patch( "homeassistant.components.demo.camera.DemoCamera.camera_image", return_value=b"Test", ) as image: yield image
[ "def", "mock_image", "(", ")", ":", "with", "mock", ".", "patch", "(", "\"homeassistant.components.demo.camera.DemoCamera.camera_image\"", ",", "return_value", "=", "b\"Test\"", ",", ")", "as", "image", ":", "yield", "image" ]
[ 58, 0 ]
[ 64, 19 ]
python
da
['es', 'da', 'en']
False
mock_bad_image_data
()
Mock bad image data.
Mock bad image data.
def mock_bad_image_data(): """Mock bad image data.""" with mock.patch( "homeassistant.components.sighthound.image_processing.Image.open", side_effect=UnidentifiedImageError, ) as bad_data: yield bad_data
[ "def", "mock_bad_image_data", "(", ")", ":", "with", "mock", ".", "patch", "(", "\"homeassistant.components.sighthound.image_processing.Image.open\"", ",", "side_effect", "=", "UnidentifiedImageError", ",", ")", "as", "bad_data", ":", "yield", "bad_data" ]
[ 68, 0 ]
[ 74, 22 ]
python
en
['en', 'zu', 'en']
True
mock_now
()
Return a mock now datetime.
Return a mock now datetime.
def mock_now(): """Return a mock now datetime.""" with mock.patch("homeassistant.util.dt.now", return_value=MOCK_NOW) as now_dt: yield now_dt
[ "def", "mock_now", "(", ")", ":", "with", "mock", ".", "patch", "(", "\"homeassistant.util.dt.now\"", ",", "return_value", "=", "MOCK_NOW", ")", "as", "now_dt", ":", "yield", "now_dt" ]
[ 78, 0 ]
[ 81, 20 ]
python
en
['en', 'da', 'en']
True
test_bad_api_key
(hass, caplog)
Catch bad api key.
Catch bad api key.
async def test_bad_api_key(hass, caplog): """Catch bad api key.""" with mock.patch( "simplehound.core.cloud.detect", side_effect=hound.SimplehoundException ): await async_setup_component(hass, ip.DOMAIN, VALID_CONFIG) await hass.async_block_till_done() assert "Sighthound erro...
[ "async", "def", "test_bad_api_key", "(", "hass", ",", "caplog", ")", ":", "with", "mock", ".", "patch", "(", "\"simplehound.core.cloud.detect\"", ",", "side_effect", "=", "hound", ".", "SimplehoundException", ")", ":", "await", "async_setup_component", "(", "hass"...
[ 84, 0 ]
[ 92, 51 ]
python
en
['en', 'pl', 'en']
True
test_setup_platform
(hass, mock_detections)
Set up platform with one entity.
Set up platform with one entity.
async def test_setup_platform(hass, mock_detections): """Set up platform with one entity.""" await async_setup_component(hass, ip.DOMAIN, VALID_CONFIG) await hass.async_block_till_done() assert hass.states.get(VALID_ENTITY_ID)
[ "async", "def", "test_setup_platform", "(", "hass", ",", "mock_detections", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ip", ".", "DOMAIN", ",", "VALID_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "assert", "hass", ...
[ 95, 0 ]
[ 99, 43 ]
python
en
['en', 'en', 'en']
True
test_process_image
(hass, mock_image, mock_detections)
Process an image.
Process an image.
async def test_process_image(hass, mock_image, mock_detections): """Process an image.""" await async_setup_component(hass, ip.DOMAIN, VALID_CONFIG) await hass.async_block_till_done() assert hass.states.get(VALID_ENTITY_ID) person_events = [] @callback def capture_person_event(event): ...
[ "async", "def", "test_process_image", "(", "hass", ",", "mock_image", ",", "mock_detections", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ip", ".", "DOMAIN", ",", "VALID_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", ...
[ 102, 0 ]
[ 123, 34 ]
python
en
['en', 'su', 'en']
True
test_catch_bad_image
( hass, caplog, mock_image, mock_detections, mock_bad_image_data )
Process an image.
Process an image.
async def test_catch_bad_image( hass, caplog, mock_image, mock_detections, mock_bad_image_data ): """Process an image.""" valid_config_save_file = deepcopy(VALID_CONFIG) valid_config_save_file[ip.DOMAIN].update({sh.CONF_SAVE_FILE_FOLDER: TEST_DIR}) await async_setup_component(hass, ip.DOMAIN, valid_...
[ "async", "def", "test_catch_bad_image", "(", "hass", ",", "caplog", ",", "mock_image", ",", "mock_detections", ",", "mock_bad_image_data", ")", ":", "valid_config_save_file", "=", "deepcopy", "(", "VALID_CONFIG", ")", "valid_config_save_file", "[", "ip", ".", "DOMAI...
[ 126, 0 ]
[ 139, 62 ]
python
en
['en', 'su', 'en']
True
test_save_image
(hass, mock_image, mock_detections)
Save a processed image.
Save a processed image.
async def test_save_image(hass, mock_image, mock_detections): """Save a processed image.""" valid_config_save_file = deepcopy(VALID_CONFIG) valid_config_save_file[ip.DOMAIN].update({sh.CONF_SAVE_FILE_FOLDER: TEST_DIR}) await async_setup_component(hass, ip.DOMAIN, valid_config_save_file) await hass.a...
[ "async", "def", "test_save_image", "(", "hass", ",", "mock_image", ",", "mock_detections", ")", ":", "valid_config_save_file", "=", "deepcopy", "(", "VALID_CONFIG", ")", "valid_config_save_file", "[", "ip", ".", "DOMAIN", "]", ".", "update", "(", "{", "sh", "....
[ 142, 0 ]
[ 164, 76 ]
python
en
['en', 'en', 'en']
True
test_save_timestamped_image
(hass, mock_image, mock_detections, mock_now)
Save a processed image.
Save a processed image.
async def test_save_timestamped_image(hass, mock_image, mock_detections, mock_now): """Save a processed image.""" valid_config_save_ts_file = deepcopy(VALID_CONFIG) valid_config_save_ts_file[ip.DOMAIN].update({sh.CONF_SAVE_FILE_FOLDER: TEST_DIR}) valid_config_save_ts_file[ip.DOMAIN].update({sh.CONF_SAVE...
[ "async", "def", "test_save_timestamped_image", "(", "hass", ",", "mock_image", ",", "mock_detections", ",", "mock_now", ")", ":", "valid_config_save_ts_file", "=", "deepcopy", "(", "VALID_CONFIG", ")", "valid_config_save_ts_file", "[", "ip", ".", "DOMAIN", "]", ".",...
[ 167, 0 ]
[ 192, 79 ]
python
en
['en', 'en', 'en']
True
test_one_light
(hass, rfxtrx)
Test with 1 light.
Test with 1 light.
async def test_one_light(hass, rfxtrx): """Test with 1 light.""" entry_data = create_rfx_test_cfg( devices={"0b1100cd0213c7f210020f51": {"signal_repetitions": 1}} ) mock_entry = MockConfigEntry(domain="rfxtrx", unique_id=DOMAIN, data=entry_data) mock_entry.add_to_hass(hass) await hass....
[ "async", "def", "test_one_light", "(", "hass", ",", "rfxtrx", ")", ":", "entry_data", "=", "create_rfx_test_cfg", "(", "devices", "=", "{", "\"0b1100cd0213c7f210020f51\"", ":", "{", "\"signal_repetitions\"", ":", "1", "}", "}", ")", "mock_entry", "=", "MockConfi...
[ 13, 0 ]
[ 88, 5 ]
python
en
['en', 'en', 'en']
True
test_state_restore
(hass, rfxtrx, state, brightness)
State restoration.
State restoration.
async def test_state_restore(hass, rfxtrx, state, brightness): """State restoration.""" entity_id = "light.ac_213c7f2_16" mock_restore_cache( hass, [State(entity_id, state, attributes={ATTR_BRIGHTNESS: brightness})] ) entry_data = create_rfx_test_cfg( devices={"0b1100cd0213c7f2100...
[ "async", "def", "test_state_restore", "(", "hass", ",", "rfxtrx", ",", "state", ",", "brightness", ")", ":", "entity_id", "=", "\"light.ac_213c7f2_16\"", "mock_restore_cache", "(", "hass", ",", "[", "State", "(", "entity_id", ",", "state", ",", "attributes", "...
[ 92, 0 ]
[ 112, 83 ]
python
en
['en', 'hr', 'en']
False
test_several_lights
(hass, rfxtrx)
Test with 3 lights.
Test with 3 lights.
async def test_several_lights(hass, rfxtrx): """Test with 3 lights.""" entry_data = create_rfx_test_cfg( devices={ "0b1100cd0213c7f230020f71": {"signal_repetitions": 1}, "0b1100100118cdea02020f70": {"signal_repetitions": 1}, "0b1100101118cdea02050f70": {"signal_repeti...
[ "async", "def", "test_several_lights", "(", "hass", ",", "rfxtrx", ")", ":", "entry_data", "=", "create_rfx_test_cfg", "(", "devices", "=", "{", "\"0b1100cd0213c7f230020f71\"", ":", "{", "\"signal_repetitions\"", ":", "1", "}", ",", "\"0b1100100118cdea02020f70\"", "...
[ 115, 0 ]
[ 161, 52 ]
python
en
['en', 'en', 'en']
True
test_repetitions
(hass, rfxtrx, repetitions)
Test signal repetitions.
Test signal repetitions.
async def test_repetitions(hass, rfxtrx, repetitions): """Test signal repetitions.""" entry_data = create_rfx_test_cfg( devices={"0b1100cd0213c7f230020f71": {"signal_repetitions": repetitions}} ) mock_entry = MockConfigEntry(domain="rfxtrx", unique_id=DOMAIN, data=entry_data) mock_entry.add...
[ "async", "def", "test_repetitions", "(", "hass", ",", "rfxtrx", ",", "repetitions", ")", ":", "entry_data", "=", "create_rfx_test_cfg", "(", "devices", "=", "{", "\"0b1100cd0213c7f230020f71\"", ":", "{", "\"signal_repetitions\"", ":", "repetitions", "}", "}", ")",...
[ 165, 0 ]
[ 182, 58 ]
python
en
['en', 'en', 'en']
True
test_discover_light
(hass, rfxtrx_automatic)
Test with discovery of lights.
Test with discovery of lights.
async def test_discover_light(hass, rfxtrx_automatic): """Test with discovery of lights.""" rfxtrx = rfxtrx_automatic await rfxtrx.signal("0b11009e00e6116202020070") state = hass.states.get("light.ac_0e61162_2") assert state assert state.state == "on" assert state.attributes.get("friendly_n...
[ "async", "def", "test_discover_light", "(", "hass", ",", "rfxtrx_automatic", ")", ":", "rfxtrx", "=", "rfxtrx_automatic", "await", "rfxtrx", ".", "signal", "(", "\"0b11009e00e6116202020070\"", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "\"light.a...
[ 185, 0 ]
[ 199, 66 ]
python
en
['en', 'en', 'en']
True
HfApiEndpointsTest.setUpClass
(cls)
Share this valid token in all tests below.
Share this valid token in all tests below.
def setUpClass(cls): """ Share this valid token in all tests below. """ cls._token = cls._api.login(username=USER, password=PASS)
[ "def", "setUpClass", "(", "cls", ")", ":", "cls", ".", "_token", "=", "cls", ".", "_api", ".", "login", "(", "username", "=", "USER", ",", "password", "=", "PASS", ")" ]
[ 56, 4 ]
[ 60, 65 ]
python
en
['en', 'error', 'th']
False
HfFolderTest.test_token_workflow
(self)
Test the whole token save/get/delete workflow, with the desired behavior with respect to non-existent tokens.
Test the whole token save/get/delete workflow, with the desired behavior with respect to non-existent tokens.
def test_token_workflow(self): """ Test the whole token save/get/delete workflow, with the desired behavior with respect to non-existent tokens. """ token = "token-{}".format(int(time.time())) HfFolder.save_token(token) self.assertEqual(HfFolder.get_token(), token...
[ "def", "test_token_workflow", "(", "self", ")", ":", "token", "=", "\"token-{}\"", ".", "format", "(", "int", "(", "time", ".", "time", "(", ")", ")", ")", "HfFolder", ".", "save_token", "(", "token", ")", "self", ".", "assertEqual", "(", "HfFolder", "...
[ 92, 4 ]
[ 104, 52 ]
python
en
['en', 'error', 'th']
False
test_simulated_sensor_default_config
(hass)
Test default config.
Test default config.
async def test_simulated_sensor_default_config(hass): """Test default config.""" config = {"sensor": {"platform": "simulated"}} assert await async_setup_component(hass, "sensor", config) await hass.async_block_till_done() assert len(hass.states.async_entity_ids()) == 1 state = hass.states.get("...
[ "async", "def", "test_simulated_sensor_default_config", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"simulated\"", "}", "}", "assert", "await", "async_setup_component", "(", "hass", ",", "\"sensor\"", ",", "config", ...
[ 22, 0 ]
[ 39, 84 ]
python
da
['fr', 'da', 'en']
False
async_setup_entry
(hass, entry, async_add_entities)
Set up a Nest sensor based on a config entry.
Set up a Nest sensor based on a config entry.
async def async_setup_entry(hass, entry, async_add_entities): """Set up a Nest sensor based on a config entry.""" openuv = hass.data[DOMAIN][DATA_OPENUV_CLIENT][entry.entry_id] sensors = [] for kind, attrs in SENSORS.items(): name, icon, unit = attrs sensors.append(OpenUvSensor(openuv, ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ",", "async_add_entities", ")", ":", "openuv", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "DATA_OPENUV_CLIENT", "]", "[", "entry", ".", "entry_id", "]", "sensors", "=", "[", "]", "fo...
[ 81, 0 ]
[ 90, 37 ]
python
en
['en', 'da', 'en']
True
OpenUvSensor.__init__
(self, openuv, sensor_type, name, icon, unit, entry_id)
Initialize the sensor.
Initialize the sensor.
def __init__(self, openuv, sensor_type, name, icon, unit, entry_id): """Initialize the sensor.""" super().__init__(openuv) self._async_unsub_dispatcher_connect = None self._entry_id = entry_id self._icon = icon self._latitude = openuv.client.latitude self._longit...
[ "def", "__init__", "(", "self", ",", "openuv", ",", "sensor_type", ",", "name", ",", "icon", ",", "unit", ",", "entry_id", ")", ":", "super", "(", ")", ".", "__init__", "(", "openuv", ")", "self", ".", "_async_unsub_dispatcher_connect", "=", "None", "sel...
[ 96, 4 ]
[ 108, 25 ]
python
en
['en', 'en', 'en']
True
OpenUvSensor.icon
(self)
Return the icon.
Return the icon.
def icon(self): """Return the icon.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 111, 4 ]
[ 113, 25 ]
python
en
['en', 'sr', 'en']
True
OpenUvSensor.should_poll
(self)
Disable polling.
Disable polling.
def should_poll(self): """Disable polling.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 116, 4 ]
[ 118, 20 ]
python
en
['fr', 'en', 'en']
False
OpenUvSensor.state
(self)
Return the status of the sensor.
Return the status of the sensor.
def state(self): """Return the status of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 121, 4 ]
[ 123, 26 ]
python
en
['en', 'id', 'en']
True
OpenUvSensor.unique_id
(self)
Return a unique, Home Assistant friendly identifier for this entity.
Return a unique, Home Assistant friendly identifier for this entity.
def unique_id(self) -> str: """Return a unique, Home Assistant friendly identifier for this entity.""" return f"{self._latitude}_{self._longitude}_{self._sensor_type}"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "f\"{self._latitude}_{self._longitude}_{self._sensor_type}\"" ]
[ 126, 4 ]
[ 128, 72 ]
python
en
['en', 'en', 'en']
True
OpenUvSensor.unit_of_measurement
(self)
Return the unit the value is expressed in.
Return the unit the value is expressed in.
def unit_of_measurement(self): """Return the unit the value is expressed in.""" return self._unit
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit" ]
[ 131, 4 ]
[ 133, 25 ]
python
en
['en', 'en', 'en']
True
OpenUvSensor.update_from_latest_data
(self)
Update the state.
Update the state.
def update_from_latest_data(self): """Update the state.""" data = self.openuv.data[DATA_UV].get("result") if not data: self._available = False return self._available = True if self._sensor_type == TYPE_CURRENT_OZONE_LEVEL: self._state = data...
[ "def", "update_from_latest_data", "(", "self", ")", ":", "data", "=", "self", ".", "openuv", ".", "data", "[", "DATA_UV", "]", ".", "get", "(", "\"result\"", ")", "if", "not", "data", ":", "self", ".", "_available", "=", "False", "return", "self", ".",...
[ 136, 4 ]
[ 176, 13 ]
python
en
['en', 'en', 'en']
True
mock_conf
(hass, cloud_prefs)
Mock Google conf.
Mock Google conf.
def mock_conf(hass, cloud_prefs): """Mock Google conf.""" return CloudGoogleConfig( hass, GACTIONS_SCHEMA({}), "mock-user-id", cloud_prefs, Mock(claims={"cognito:username": "abcdefghjkl"}), )
[ "def", "mock_conf", "(", "hass", ",", "cloud_prefs", ")", ":", "return", "CloudGoogleConfig", "(", "hass", ",", "GACTIONS_SCHEMA", "(", "{", "}", ")", ",", "\"mock-user-id\"", ",", "cloud_prefs", ",", "Mock", "(", "claims", "=", "{", "\"cognito:username\"", ...
[ 16, 0 ]
[ 24, 5 ]
python
da
['en', 'da', 'it']
False
test_google_update_report_state
(mock_conf, hass, cloud_prefs)
Test Google config responds to updating preference.
Test Google config responds to updating preference.
async def test_google_update_report_state(mock_conf, hass, cloud_prefs): """Test Google config responds to updating preference.""" await mock_conf.async_initialize() await mock_conf.async_connect_agent_user("mock-user-id") with patch.object(mock_conf, "async_sync_entities") as mock_sync, patch( ...
[ "async", "def", "test_google_update_report_state", "(", "mock_conf", ",", "hass", ",", "cloud_prefs", ")", ":", "await", "mock_conf", ".", "async_initialize", "(", ")", "await", "mock_conf", ".", "async_connect_agent_user", "(", "\"mock-user-id\"", ")", "with", "pat...
[ 27, 0 ]
[ 39, 49 ]
python
en
['en', 'en', 'en']
True
test_sync_entities
(aioclient_mock, hass, cloud_prefs)
Test sync devices.
Test sync devices.
async def test_sync_entities(aioclient_mock, hass, cloud_prefs): """Test sync devices.""" config = CloudGoogleConfig( hass, GACTIONS_SCHEMA({}), "mock-user-id", cloud_prefs, Mock(auth=Mock(async_check_token=AsyncMock())), ) with patch( "hass_nabucasa.clou...
[ "async", "def", "test_sync_entities", "(", "aioclient_mock", ",", "hass", ",", "cloud_prefs", ")", ":", "config", "=", "CloudGoogleConfig", "(", "hass", ",", "GACTIONS_SCHEMA", "(", "{", "}", ")", ",", "\"mock-user-id\"", ",", "cloud_prefs", ",", "Mock", "(", ...
[ 42, 0 ]
[ 57, 53 ]
python
en
['fr', 'en', 'en']
True
test_google_update_expose_trigger_sync
( hass, legacy_patchable_time, cloud_prefs )
Test Google config responds to updating exposed entities.
Test Google config responds to updating exposed entities.
async def test_google_update_expose_trigger_sync( hass, legacy_patchable_time, cloud_prefs ): """Test Google config responds to updating exposed entities.""" config = CloudGoogleConfig( hass, GACTIONS_SCHEMA({}), "mock-user-id", cloud_prefs, Mock(claims={"cognito:user...
[ "async", "def", "test_google_update_expose_trigger_sync", "(", "hass", ",", "legacy_patchable_time", ",", "cloud_prefs", ")", ":", "config", "=", "CloudGoogleConfig", "(", "hass", ",", "GACTIONS_SCHEMA", "(", "{", "}", ")", ",", "\"mock-user-id\"", ",", "cloud_prefs...
[ 60, 0 ]
[ 102, 41 ]
python
en
['en', 'en', 'en']
True
test_google_entity_registry_sync
(hass, mock_cloud_login, cloud_prefs)
Test Google config responds to entity registry.
Test Google config responds to entity registry.
async def test_google_entity_registry_sync(hass, mock_cloud_login, cloud_prefs): """Test Google config responds to entity registry.""" config = CloudGoogleConfig( hass, GACTIONS_SCHEMA({}), "mock-user-id", cloud_prefs, hass.data["cloud"] ) await config.async_initialize() await config.async_c...
[ "async", "def", "test_google_entity_registry_sync", "(", "hass", ",", "mock_cloud_login", ",", "cloud_prefs", ")", ":", "config", "=", "CloudGoogleConfig", "(", "hass", ",", "GACTIONS_SCHEMA", "(", "{", "}", ")", ",", "\"mock-user-id\"", ",", "cloud_prefs", ",", ...
[ 105, 0 ]
[ 169, 45 ]
python
en
['en', 'pt', 'en']
True
test_google_config_expose_entity_prefs
(mock_conf, cloud_prefs)
Test Google config should expose using prefs.
Test Google config should expose using prefs.
async def test_google_config_expose_entity_prefs(mock_conf, cloud_prefs): """Test Google config should expose using prefs.""" entity_conf = {"should_expose": False} await cloud_prefs.async_update( google_entity_configs={"light.kitchen": entity_conf}, google_default_expose=["light"], ) ...
[ "async", "def", "test_google_config_expose_entity_prefs", "(", "mock_conf", ",", "cloud_prefs", ")", ":", "entity_conf", "=", "{", "\"should_expose\"", ":", "False", "}", "await", "cloud_prefs", ".", "async_update", "(", "google_entity_configs", "=", "{", "\"light.kit...
[ 172, 0 ]
[ 192, 45 ]
python
en
['en', 'en', 'en']
True
NexiaEntity.__init__
(self, coordinator, name, unique_id)
Initialize the entity.
Initialize the entity.
def __init__(self, coordinator, name, unique_id): """Initialize the entity.""" super().__init__(coordinator) self._unique_id = unique_id self._name = name
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "name", ",", "unique_id", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_unique_id", "=", "unique_id", "self", ".", "_name", "=", "name" ]
[ 18, 4 ]
[ 22, 25 ]
python
en
['en', 'en', 'en']
True
NexiaEntity.unique_id
(self)
Return the unique id.
Return the unique id.
def unique_id(self): """Return the unique id.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 25, 4 ]
[ 27, 30 ]
python
en
['en', 'la', 'en']
True
NexiaEntity.name
(self)
Return the name.
Return the name.
def name(self): """Return the name.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 30, 4 ]
[ 32, 25 ]
python
en
['en', 'ig', 'en']
True
NexiaEntity.device_state_attributes
(self)
Return the device specific state attributes.
Return the device specific state attributes.
def device_state_attributes(self): """Return the device specific state attributes.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, }
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", ",", "}" ]
[ 35, 4 ]
[ 39, 9 ]
python
en
['en', 'en', 'en']
True
NexiaThermostatEntity.__init__
(self, coordinator, thermostat, name, unique_id)
Initialize the entity.
Initialize the entity.
def __init__(self, coordinator, thermostat, name, unique_id): """Initialize the entity.""" super().__init__(coordinator, name, unique_id) self._thermostat = thermostat
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "thermostat", ",", "name", ",", "unique_id", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ",", "name", ",", "unique_id", ")", "self", ".", "_thermostat", "=", "thermostat" ]
[ 45, 4 ]
[ 48, 37 ]
python
en
['en', 'en', 'en']
True
NexiaThermostatEntity.device_info
(self)
Return the device_info of the device.
Return the device_info of the device.
def device_info(self): """Return the device_info of the device.""" return { "identifiers": {(DOMAIN, self._thermostat.thermostat_id)}, "name": self._thermostat.get_name(), "model": self._thermostat.get_model(), "sw_version": self._thermostat.get_firmware()...
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_thermostat", ".", "thermostat_id", ")", "}", ",", "\"name\"", ":", "self", ".", "_thermostat", ".", "get_name", "(", ")", ",", "...
[ 51, 4 ]
[ 59, 9 ]
python
en
['en', 'en', 'en']
True
NexiaThermostatEntity.async_added_to_hass
(self)
Listen for signals for services.
Listen for signals for services.
async def async_added_to_hass(self): """Listen for signals for services.""" await super().async_added_to_hass() self.async_on_remove( async_dispatcher_connect( self.hass, f"{SIGNAL_THERMOSTAT_UPDATE}-{self._thermostat.thermostat_id}", s...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "f\"{SIGNAL_THERMOSTAT_UPDATE}-{self._ther...
[ 61, 4 ]
[ 70, 9 ]
python
en
['en', 'en', 'en']
True
NexiaThermostatZoneEntity.__init__
(self, coordinator, zone, name, unique_id)
Initialize the entity.
Initialize the entity.
def __init__(self, coordinator, zone, name, unique_id): """Initialize the entity.""" super().__init__(coordinator, zone.thermostat, name, unique_id) self._zone = zone
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "zone", ",", "name", ",", "unique_id", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ",", "zone", ".", "thermostat", ",", "name", ",", "unique_id", ")", "self", ".", "_zone", ...
[ 76, 4 ]
[ 79, 25 ]
python
en
['en', 'en', 'en']
True
NexiaThermostatZoneEntity.device_info
(self)
Return the device_info of the device.
Return the device_info of the device.
def device_info(self): """Return the device_info of the device.""" data = super().device_info data.update( { "identifiers": {(DOMAIN, self._zone.zone_id)}, "name": self._zone.get_name(), "via_device": (DOMAIN, self._zone.thermostat.ther...
[ "def", "device_info", "(", "self", ")", ":", "data", "=", "super", "(", ")", ".", "device_info", "data", ".", "update", "(", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_zone", ".", "zone_id", ")", "}", ",", "\"name\"", ":", ...
[ 82, 4 ]
[ 92, 19 ]
python
en
['en', 'en', 'en']
True
NexiaThermostatZoneEntity.async_added_to_hass
(self)
Listen for signals for services.
Listen for signals for services.
async def async_added_to_hass(self): """Listen for signals for services.""" await super().async_added_to_hass() self.async_on_remove( async_dispatcher_connect( self.hass, f"{SIGNAL_ZONE_UPDATE}-{self._zone.zone_id}", self.async_write_ha...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "f\"{SIGNAL_ZONE_UPDATE}-{self._zone.zone_...
[ 94, 4 ]
[ 103, 9 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the NAD platform.
Set up the NAD platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the NAD platform.""" if config.get(CONF_TYPE) in ("RS232", "Telnet"): add_entities( [NAD(config)], True, ) else: add_entities( [NADtcp(config)], True, ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "config", ".", "get", "(", "CONF_TYPE", ")", "in", "(", "\"RS232\"", ",", "\"Telnet\"", ")", ":", "add_entities", "(", "[", "NAD...
[ 60, 0 ]
[ 71, 9 ]
python
en
['en', 'da', 'en']
True
NAD.__init__
(self, config)
Initialize the NAD Receiver device.
Initialize the NAD Receiver device.
def __init__(self, config): """Initialize the NAD Receiver device.""" self.config = config self._instantiate_nad_receiver() self._min_volume = config[CONF_MIN_VOLUME] self._max_volume = config[CONF_MAX_VOLUME] self._source_dict = config[CONF_SOURCE_DICT] self._rev...
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "self", ".", "config", "=", "config", "self", ".", "_instantiate_nad_receiver", "(", ")", "self", ".", "_min_volume", "=", "config", "[", "CONF_MIN_VOLUME", "]", "self", ".", "_max_volume", "=", "con...
[ 77, 4 ]
[ 86, 69 ]
python
en
['en', 'en', 'en']
True
NAD.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.config[CONF_NAME]
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "config", "[", "CONF_NAME", "]" ]
[ 97, 4 ]
[ 99, 37 ]
python
en
['en', 'en', 'en']
True
NAD.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 102, 4 ]
[ 104, 26 ]
python
en
['en', 'en', 'en']
True
NAD.icon
(self)
Return the icon for the device.
Return the icon for the device.
def icon(self): """Return the icon for the device.""" return "mdi:speaker-multiple"
[ "def", "icon", "(", "self", ")", ":", "return", "\"mdi:speaker-multiple\"" ]
[ 107, 4 ]
[ 109, 37 ]
python
en
['en', 'en', 'en']
True
NAD.volume_level
(self)
Volume level of the media player (0..1).
Volume level of the media player (0..1).
def volume_level(self): """Volume level of the media player (0..1).""" return self._volume
[ "def", "volume_level", "(", "self", ")", ":", "return", "self", ".", "_volume" ]
[ 112, 4 ]
[ 114, 27 ]
python
en
['en', 'en', 'en']
True
NAD.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._mute
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "_mute" ]
[ 117, 4 ]
[ 119, 25 ]
python
en
['en', 'en', 'en']
True
NAD.supported_features
(self)
Flag media player features that are supported.
Flag media player features that are supported.
def supported_features(self): """Flag media player features that are supported.""" return SUPPORT_NAD
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_NAD" ]
[ 122, 4 ]
[ 124, 26 ]
python
en
['en', 'en', 'en']
True
NAD.turn_off
(self)
Turn the media player off.
Turn the media player off.
def turn_off(self): """Turn the media player off.""" self._nad_receiver.main_power("=", "Off")
[ "def", "turn_off", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "main_power", "(", "\"=\"", ",", "\"Off\"", ")" ]
[ 126, 4 ]
[ 128, 49 ]
python
en
['en', 'en', 'en']
True
NAD.turn_on
(self)
Turn the media player on.
Turn the media player on.
def turn_on(self): """Turn the media player on.""" self._nad_receiver.main_power("=", "On")
[ "def", "turn_on", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "main_power", "(", "\"=\"", ",", "\"On\"", ")" ]
[ 130, 4 ]
[ 132, 48 ]
python
en
['en', 'en', 'en']
True
NAD.volume_up
(self)
Volume up the media player.
Volume up the media player.
def volume_up(self): """Volume up the media player.""" self._nad_receiver.main_volume("+")
[ "def", "volume_up", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "main_volume", "(", "\"+\"", ")" ]
[ 134, 4 ]
[ 136, 43 ]
python
en
['en', 'en', 'en']
True
NAD.volume_down
(self)
Volume down the media player.
Volume down the media player.
def volume_down(self): """Volume down the media player.""" self._nad_receiver.main_volume("-")
[ "def", "volume_down", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "main_volume", "(", "\"-\"", ")" ]
[ 138, 4 ]
[ 140, 43 ]
python
en
['en', 'en', 'en']
True
NAD.set_volume_level
(self, volume)
Set volume level, range 0..1.
Set volume level, range 0..1.
def set_volume_level(self, volume): """Set volume level, range 0..1.""" self._nad_receiver.main_volume("=", self.calc_db(volume))
[ "def", "set_volume_level", "(", "self", ",", "volume", ")", ":", "self", ".", "_nad_receiver", ".", "main_volume", "(", "\"=\"", ",", "self", ".", "calc_db", "(", "volume", ")", ")" ]
[ 142, 4 ]
[ 144, 65 ]
python
en
['fr', 'zu', 'en']
False
NAD.mute_volume
(self, mute)
Mute (true) or unmute (false) media player.
Mute (true) or unmute (false) media player.
def mute_volume(self, mute): """Mute (true) or unmute (false) media player.""" if mute: self._nad_receiver.main_mute("=", "On") else: self._nad_receiver.main_mute("=", "Off")
[ "def", "mute_volume", "(", "self", ",", "mute", ")", ":", "if", "mute", ":", "self", ".", "_nad_receiver", ".", "main_mute", "(", "\"=\"", ",", "\"On\"", ")", "else", ":", "self", ".", "_nad_receiver", ".", "main_mute", "(", "\"=\"", ",", "\"Off\"", ")...
[ 146, 4 ]
[ 151, 52 ]
python
en
['en', 'la', 'it']
False
NAD.select_source
(self, source)
Select input source.
Select input source.
def select_source(self, source): """Select input source.""" self._nad_receiver.main_source("=", self._reverse_mapping.get(source))
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "self", ".", "_nad_receiver", ".", "main_source", "(", "\"=\"", ",", "self", ".", "_reverse_mapping", ".", "get", "(", "source", ")", ")" ]
[ 153, 4 ]
[ 155, 78 ]
python
en
['fr', 'su', 'en']
False
NAD.source
(self)
Name of the current input source.
Name of the current input source.
def source(self): """Name of the current input source.""" return self._source
[ "def", "source", "(", "self", ")", ":", "return", "self", ".", "_source" ]
[ 158, 4 ]
[ 160, 27 ]
python
en
['en', 'en', 'en']
True
NAD.source_list
(self)
List of available input sources.
List of available input sources.
def source_list(self): """List of available input sources.""" return sorted(list(self._reverse_mapping))
[ "def", "source_list", "(", "self", ")", ":", "return", "sorted", "(", "list", "(", "self", ".", "_reverse_mapping", ")", ")" ]
[ 163, 4 ]
[ 165, 50 ]
python
en
['en', 'en', 'en']
True
NAD.available
(self)
Return if device is available.
Return if device is available.
def available(self): """Return if device is available.""" return self._state is not None
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_state", "is", "not", "None" ]
[ 168, 4 ]
[ 170, 38 ]
python
en
['en', 'en', 'en']
True
NAD.update
(self)
Retrieve latest state.
Retrieve latest state.
def update(self) -> None: """Retrieve latest state.""" power_state = self._nad_receiver.main_power("?") if not power_state: self._state = None return self._state = ( STATE_ON if self._nad_receiver.main_power("?") == "On" else STATE_OFF ) ...
[ "def", "update", "(", "self", ")", "->", "None", ":", "power_state", "=", "self", ".", "_nad_receiver", ".", "main_power", "(", "\"?\"", ")", "if", "not", "power_state", ":", "self", ".", "_state", "=", "None", "return", "self", ".", "_state", "=", "("...
[ 172, 4 ]
[ 188, 85 ]
python
en
['es', 'sk', 'en']
False
NAD.calc_volume
(self, decibel)
Calculate the volume given the decibel. Return the volume (0..1).
Calculate the volume given the decibel.
def calc_volume(self, decibel): """ Calculate the volume given the decibel. Return the volume (0..1). """ return abs(self._min_volume - decibel) / abs( self._min_volume - self._max_volume )
[ "def", "calc_volume", "(", "self", ",", "decibel", ")", ":", "return", "abs", "(", "self", ".", "_min_volume", "-", "decibel", ")", "/", "abs", "(", "self", ".", "_min_volume", "-", "self", ".", "_max_volume", ")" ]
[ 190, 4 ]
[ 198, 9 ]
python
en
['en', 'error', 'th']
False
NAD.calc_db
(self, volume)
Calculate the decibel given the volume. Return the dB.
Calculate the decibel given the volume.
def calc_db(self, volume): """ Calculate the decibel given the volume. Return the dB. """ return self._min_volume + round( abs(self._min_volume - self._max_volume) * volume )
[ "def", "calc_db", "(", "self", ",", "volume", ")", ":", "return", "self", ".", "_min_volume", "+", "round", "(", "abs", "(", "self", ".", "_min_volume", "-", "self", ".", "_max_volume", ")", "*", "volume", ")" ]
[ 200, 4 ]
[ 208, 9 ]
python
en
['en', 'error', 'th']
False
NADtcp.__init__
(self, config)
Initialize the amplifier.
Initialize the amplifier.
def __init__(self, config): """Initialize the amplifier.""" self._name = config[CONF_NAME] self._nad_receiver = NADReceiverTCP(config.get(CONF_HOST)) self._min_vol = (config[CONF_MIN_VOLUME] + 90) * 2 # from dB to nad vol (0-200) self._max_vol = (config[CONF_MAX_VOLUME] + 90) * ...
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "self", ".", "_name", "=", "config", "[", "CONF_NAME", "]", "self", ".", "_nad_receiver", "=", "NADReceiverTCP", "(", "config", ".", "get", "(", "CONF_HOST", ")", ")", "self", ".", "_min_vol", "=...
[ 214, 4 ]
[ 226, 66 ]
python
en
['en', 'en', 'en']
True
NADtcp.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" ]
[ 229, 4 ]
[ 231, 25 ]
python
en
['en', 'en', 'en']
True
NADtcp.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 234, 4 ]
[ 236, 26 ]
python
en
['en', 'en', 'en']
True
NADtcp.volume_level
(self)
Volume level of the media player (0..1).
Volume level of the media player (0..1).
def volume_level(self): """Volume level of the media player (0..1).""" return self._volume
[ "def", "volume_level", "(", "self", ")", ":", "return", "self", ".", "_volume" ]
[ 239, 4 ]
[ 241, 27 ]
python
en
['en', 'en', 'en']
True
NADtcp.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._mute
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "_mute" ]
[ 244, 4 ]
[ 246, 25 ]
python
en
['en', 'en', 'en']
True
NADtcp.supported_features
(self)
Flag media player features that are supported.
Flag media player features that are supported.
def supported_features(self): """Flag media player features that are supported.""" return SUPPORT_NAD
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_NAD" ]
[ 249, 4 ]
[ 251, 26 ]
python
en
['en', 'en', 'en']
True
NADtcp.turn_off
(self)
Turn the media player off.
Turn the media player off.
def turn_off(self): """Turn the media player off.""" self._nad_receiver.power_off()
[ "def", "turn_off", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "power_off", "(", ")" ]
[ 253, 4 ]
[ 255, 38 ]
python
en
['en', 'en', 'en']
True
NADtcp.turn_on
(self)
Turn the media player on.
Turn the media player on.
def turn_on(self): """Turn the media player on.""" self._nad_receiver.power_on()
[ "def", "turn_on", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "power_on", "(", ")" ]
[ 257, 4 ]
[ 259, 37 ]
python
en
['en', 'en', 'en']
True
NADtcp.volume_up
(self)
Step volume up in the configured increments.
Step volume up in the configured increments.
def volume_up(self): """Step volume up in the configured increments.""" self._nad_receiver.set_volume(self._nad_volume + 2 * self._volume_step)
[ "def", "volume_up", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "set_volume", "(", "self", ".", "_nad_volume", "+", "2", "*", "self", ".", "_volume_step", ")" ]
[ 261, 4 ]
[ 263, 79 ]
python
en
['en', 'en', 'en']
True
NADtcp.volume_down
(self)
Step volume down in the configured increments.
Step volume down in the configured increments.
def volume_down(self): """Step volume down in the configured increments.""" self._nad_receiver.set_volume(self._nad_volume - 2 * self._volume_step)
[ "def", "volume_down", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "set_volume", "(", "self", ".", "_nad_volume", "-", "2", "*", "self", ".", "_volume_step", ")" ]
[ 265, 4 ]
[ 267, 79 ]
python
en
['en', 'en', 'en']
True
NADtcp.set_volume_level
(self, volume)
Set volume level, range 0..1.
Set volume level, range 0..1.
def set_volume_level(self, volume): """Set volume level, range 0..1.""" nad_volume_to_set = int( round(volume * (self._max_vol - self._min_vol) + self._min_vol) ) self._nad_receiver.set_volume(nad_volume_to_set)
[ "def", "set_volume_level", "(", "self", ",", "volume", ")", ":", "nad_volume_to_set", "=", "int", "(", "round", "(", "volume", "*", "(", "self", ".", "_max_vol", "-", "self", ".", "_min_vol", ")", "+", "self", ".", "_min_vol", ")", ")", "self", ".", ...
[ 269, 4 ]
[ 274, 56 ]
python
en
['fr', 'zu', 'en']
False
NADtcp.mute_volume
(self, mute)
Mute (true) or unmute (false) media player.
Mute (true) or unmute (false) media player.
def mute_volume(self, mute): """Mute (true) or unmute (false) media player.""" if mute: self._nad_receiver.mute() else: self._nad_receiver.unmute()
[ "def", "mute_volume", "(", "self", ",", "mute", ")", ":", "if", "mute", ":", "self", ".", "_nad_receiver", ".", "mute", "(", ")", "else", ":", "self", ".", "_nad_receiver", ".", "unmute", "(", ")" ]
[ 276, 4 ]
[ 281, 39 ]
python
en
['en', 'la', 'it']
False
NADtcp.select_source
(self, source)
Select input source.
Select input source.
def select_source(self, source): """Select input source.""" self._nad_receiver.select_source(source)
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "self", ".", "_nad_receiver", ".", "select_source", "(", "source", ")" ]
[ 283, 4 ]
[ 285, 48 ]
python
en
['fr', 'su', 'en']
False
NADtcp.source
(self)
Name of the current input source.
Name of the current input source.
def source(self): """Name of the current input source.""" return self._source
[ "def", "source", "(", "self", ")", ":", "return", "self", ".", "_source" ]
[ 288, 4 ]
[ 290, 27 ]
python
en
['en', 'en', 'en']
True
NADtcp.source_list
(self)
List of available input sources.
List of available input sources.
def source_list(self): """List of available input sources.""" return self._nad_receiver.available_sources()
[ "def", "source_list", "(", "self", ")", ":", "return", "self", ".", "_nad_receiver", ".", "available_sources", "(", ")" ]
[ 293, 4 ]
[ 295, 53 ]
python
en
['en', 'en', 'en']
True
NADtcp.update
(self)
Get the latest details from the device.
Get the latest details from the device.
def update(self): """Get the latest details from the device.""" try: nad_status = self._nad_receiver.status() except OSError: return if nad_status is None: return # Update on/off state if nad_status["power"]: self._state = ...
[ "def", "update", "(", "self", ")", ":", "try", ":", "nad_status", "=", "self", ".", "_nad_receiver", ".", "status", "(", ")", "except", "OSError", ":", "return", "if", "nad_status", "is", "None", ":", "return", "# Update on/off state", "if", "nad_status", ...
[ 297, 4 ]
[ 320, 43 ]
python
en
['en', 'en', 'en']
True
NADtcp.nad_vol_to_internal_vol
(self, nad_volume)
Convert nad volume range (0-200) to internal volume range. Takes into account configured min and max volume.
Convert nad volume range (0-200) to internal volume range.
def nad_vol_to_internal_vol(self, nad_volume): """Convert nad volume range (0-200) to internal volume range. Takes into account configured min and max volume. """ if nad_volume < self._min_vol: volume_internal = 0.0 elif nad_volume > self._max_vol: volume...
[ "def", "nad_vol_to_internal_vol", "(", "self", ",", "nad_volume", ")", ":", "if", "nad_volume", "<", "self", ".", "_min_vol", ":", "volume_internal", "=", "0.0", "elif", "nad_volume", ">", "self", ".", "_max_vol", ":", "volume_internal", "=", "1.0", "else", ...
[ 322, 4 ]
[ 335, 30 ]
python
en
['en', 'jv', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up a control panel managed through IFTTT.
Set up a control panel managed through IFTTT.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up a control panel managed through IFTTT.""" if DATA_IFTTT_ALARM not in hass.data: hass.data[DATA_IFTTT_ALARM] = [] name = config.get(CONF_NAME) code = config.get(CONF_CODE) event_away = config.get(CONF_EVENT_AWAY) ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "DATA_IFTTT_ALARM", "not", "in", "hass", ".", "data", ":", "hass", ".", "data", "[", "DATA_IFTTT_ALARM", "]", "=", "[", "]", "na...
[ 71, 0 ]
[ 107, 5 ]
python
en
['en', 'lb', 'en']
True
IFTTTAlarmPanel.__init__
( self, name, code, event_away, event_home, event_night, event_disarm, optimistic )
Initialize the alarm control panel.
Initialize the alarm control panel.
def __init__( self, name, code, event_away, event_home, event_night, event_disarm, optimistic ): """Initialize the alarm control panel.""" self._name = name self._code = code self._event_away = event_away self._event_home = event_home self._event_night = event...
[ "def", "__init__", "(", "self", ",", "name", ",", "code", ",", "event_away", ",", "event_home", ",", "event_night", ",", "event_disarm", ",", "optimistic", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_code", "=", "code", "self", ".", "_e...
[ 113, 4 ]
[ 124, 26 ]
python
en
['en', 'en', 'en']
True
IFTTTAlarmPanel.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" ]
[ 127, 4 ]
[ 129, 25 ]
python
en
['en', 'en', 'en']
True
IFTTTAlarmPanel.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 132, 4 ]
[ 134, 26 ]
python
en
['en', 'en', 'en']
True
IFTTTAlarmPanel.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self) -> int: """Return the list of supported features.""" return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_ALARM_ARM_HOME", "|", "SUPPORT_ALARM_ARM_AWAY", "|", "SUPPORT_ALARM_ARM_NIGHT" ]
[ 137, 4 ]
[ 139, 88 ]
python
en
['en', 'en', 'en']
True
IFTTTAlarmPanel.assumed_state
(self)
Notify that this platform return an assumed state.
Notify that this platform return an assumed state.
def assumed_state(self): """Notify that this platform return an assumed state.""" return True
[ "def", "assumed_state", "(", "self", ")", ":", "return", "True" ]
[ 142, 4 ]
[ 144, 19 ]
python
en
['en', 'en', 'en']
True
IFTTTAlarmPanel.code_format
(self)
Return one or more digits/characters.
Return one or more digits/characters.
def code_format(self): """Return one or more digits/characters.""" if self._code is None: return None if isinstance(self._code, str) and re.search("^\\d+$", self._code): return FORMAT_NUMBER return FORMAT_TEXT
[ "def", "code_format", "(", "self", ")", ":", "if", "self", ".", "_code", "is", "None", ":", "return", "None", "if", "isinstance", "(", "self", ".", "_code", ",", "str", ")", "and", "re", ".", "search", "(", "\"^\\\\d+$\"", ",", "self", ".", "_code", ...
[ 147, 4 ]
[ 153, 26 ]
python
en
['en', 'en', 'en']
True
IFTTTAlarmPanel.alarm_disarm
(self, code=None)
Send disarm command.
Send disarm command.
def alarm_disarm(self, code=None): """Send disarm command.""" if not self._check_code(code): return self.set_alarm_state(self._event_disarm, STATE_ALARM_DISARMED)
[ "def", "alarm_disarm", "(", "self", ",", "code", "=", "None", ")", ":", "if", "not", "self", ".", "_check_code", "(", "code", ")", ":", "return", "self", ".", "set_alarm_state", "(", "self", ".", "_event_disarm", ",", "STATE_ALARM_DISARMED", ")" ]
[ 155, 4 ]
[ 159, 70 ]
python
en
['en', 'pt', 'en']
True
IFTTTAlarmPanel.alarm_arm_away
(self, code=None)
Send arm away command.
Send arm away command.
def alarm_arm_away(self, code=None): """Send arm away command.""" if not self._check_code(code): return self.set_alarm_state(self._event_away, STATE_ALARM_ARMED_AWAY)
[ "def", "alarm_arm_away", "(", "self", ",", "code", "=", "None", ")", ":", "if", "not", "self", ".", "_check_code", "(", "code", ")", ":", "return", "self", ".", "set_alarm_state", "(", "self", ".", "_event_away", ",", "STATE_ALARM_ARMED_AWAY", ")" ]
[ 161, 4 ]
[ 165, 70 ]
python
en
['en', 'en', 'en']
True