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_homekit_start_with_a_broken_accessory
(hass, hk_driver, debounce_patcher)
Test HomeKit start method.
Test HomeKit start method.
async def test_homekit_start_with_a_broken_accessory(hass, hk_driver, debounce_patcher): """Test HomeKit start method.""" pin = b"123-45-678" entry = MockConfigEntry( domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345} ) entity_filter = generate_filter(["cover", "light"], ["demo.t...
[ "async", "def", "test_homekit_start_with_a_broken_accessory", "(", "hass", ",", "hk_driver", ",", "debounce_patcher", ")", ":", "pin", "=", "b\"123-45-678\"", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_NAME", ":", ...
[ 570, 0 ]
[ 619, 37 ]
python
en
['en', 'et', 'en']
True
test_homekit_stop
(hass)
Test HomeKit stop method.
Test HomeKit stop method.
async def test_homekit_stop(hass): """Test HomeKit stop method.""" entry = await async_init_integration(hass) homekit = HomeKit( hass, None, None, None, {}, {}, DEFAULT_SAFE_MODE, HOMEKIT_MODE_BRIDGE, advertise_ip=None, entry_i...
[ "async", "def", "test_homekit_stop", "(", "hass", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ")", "homekit", "=", "HomeKit", "(", "hass", ",", "None", ",", "None", ",", "None", ",", "{", "}", ",", "{", "}", ",", "DEFAULT_SA...
[ 622, 0 ]
[ 658, 51 ]
python
en
['en', 'nl', 'en']
True
test_homekit_reset_accessories
(hass)
Test adding too many accessories to HomeKit.
Test adding too many accessories to HomeKit.
async def test_homekit_reset_accessories(hass): """Test adding too many accessories to HomeKit.""" entry = MockConfigEntry( domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345} ) entity_id = "light.demo" homekit = HomeKit( hass, None, None, None, ...
[ "async", "def", "test_homekit_reset_accessories", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_NAME", ":", "\"mock_name\"", ",", "CONF_PORT", ":", "12345", "}", ")", "entity_id", "=", "\"l...
[ 661, 0 ]
[ 707, 37 ]
python
en
['en', 'en', 'en']
True
test_homekit_too_many_accessories
(hass, hk_driver, caplog)
Test adding too many accessories to HomeKit.
Test adding too many accessories to HomeKit.
async def test_homekit_too_many_accessories(hass, hk_driver, caplog): """Test adding too many accessories to HomeKit.""" entry = await async_init_integration(hass) entity_filter = generate_filter(["cover", "light"], ["demo.test"], [], []) homekit = HomeKit( hass, None, None, ...
[ "async", "def", "test_homekit_too_many_accessories", "(", "hass", ",", "hk_driver", ",", "caplog", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ")", "entity_filter", "=", "generate_filter", "(", "[", "\"cover\"", ",", "\"light\"", "]", ...
[ 710, 0 ]
[ 749, 44 ]
python
en
['en', 'en', 'en']
True
test_homekit_finds_linked_batteries
( hass, hk_driver, debounce_patcher, device_reg, entity_reg )
Test HomeKit start method.
Test HomeKit start method.
async def test_homekit_finds_linked_batteries( hass, hk_driver, debounce_patcher, device_reg, entity_reg ): """Test HomeKit start method.""" entry = await async_init_integration(hass) homekit = HomeKit( hass, None, None, None, {}, {"light.demo": {}}, ...
[ "async", "def", "test_homekit_finds_linked_batteries", "(", "hass", ",", "hk_driver", ",", "debounce_patcher", ",", "device_reg", ",", "entity_reg", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ")", "homekit", "=", "HomeKit", "(", "hass"...
[ 752, 0 ]
[ 836, 5 ]
python
en
['en', 'et', 'en']
True
test_homekit_async_get_integration_fails
( hass, hk_driver, debounce_patcher, device_reg, entity_reg )
Test that we continue if async_get_integration fails.
Test that we continue if async_get_integration fails.
async def test_homekit_async_get_integration_fails( hass, hk_driver, debounce_patcher, device_reg, entity_reg ): """Test that we continue if async_get_integration fails.""" entry = await async_init_integration(hass) homekit = HomeKit( hass, None, None, None, {}, ...
[ "async", "def", "test_homekit_async_get_integration_fails", "(", "hass", ",", "hk_driver", ",", "debounce_patcher", ",", "device_reg", ",", "entity_reg", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ")", "homekit", "=", "HomeKit", "(", "...
[ 839, 0 ]
[ 922, 5 ]
python
en
['en', 'en', 'en']
True
test_setup_imported
(hass)
Test async_setup with imported config options.
Test async_setup with imported config options.
async def test_setup_imported(hass): """Test async_setup with imported config options.""" legacy_persist_file_path = hass.config.path(HOMEKIT_FILE) legacy_aid_storage_path = hass.config.path(STORAGE_DIR, "homekit.aids") legacy_homekit_state_contents = {"homekit.state": 1} legacy_homekit_aids_content...
[ "async", "def", "test_setup_imported", "(", "hass", ")", ":", "legacy_persist_file_path", "=", "hass", ".", "config", ".", "path", "(", "HOMEKIT_FILE", ")", "legacy_aid_storage_path", "=", "hass", ".", "config", ".", "path", "(", "STORAGE_DIR", ",", "\"homekit.a...
[ 925, 0 ]
[ 986, 37 ]
python
en
['en', 'en', 'en']
True
test_yaml_updates_update_config_entry_for_name
(hass)
Test async_setup with imported config.
Test async_setup with imported config.
async def test_yaml_updates_update_config_entry_for_name(hass): """Test async_setup with imported config.""" entry = MockConfigEntry( domain=DOMAIN, source=SOURCE_IMPORT, data={CONF_NAME: BRIDGE_NAME, CONF_PORT: DEFAULT_PORT}, options={}, ) entry.add_to_hass(hass) wi...
[ "async", "def", "test_yaml_updates_update_config_entry_for_name", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "source", "=", "SOURCE_IMPORT", ",", "data", "=", "{", "CONF_NAME", ":", "BRIDGE_NAME", ",", "CONF_PORT", ...
[ 989, 0 ]
[ 1026, 46 ]
python
en
['en', 'en', 'en']
True
test_raise_config_entry_not_ready
(hass)
Test async_setup when the port is not available.
Test async_setup when the port is not available.
async def test_raise_config_entry_not_ready(hass): """Test async_setup when the port is not available.""" entry = MockConfigEntry( domain=DOMAIN, data={CONF_NAME: BRIDGE_NAME, CONF_PORT: DEFAULT_PORT}, options={}, ) entry.add_to_hass(hass) with patch( "homeassistant....
[ "async", "def", "test_raise_config_entry_not_ready", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_NAME", ":", "BRIDGE_NAME", ",", "CONF_PORT", ":", "DEFAULT_PORT", "}", ",", "options", "=", ...
[ 1029, 0 ]
[ 1043, 42 ]
python
en
['en', 'en', 'en']
True
test_homekit_uses_system_zeroconf
(hass, hk_driver, mock_zeroconf)
Test HomeKit uses system zeroconf.
Test HomeKit uses system zeroconf.
async def test_homekit_uses_system_zeroconf(hass, hk_driver, mock_zeroconf): """Test HomeKit uses system zeroconf.""" entry = MockConfigEntry( domain=DOMAIN, data={CONF_NAME: BRIDGE_NAME, CONF_PORT: DEFAULT_PORT}, options={}, ) assert await async_setup_component(hass, "zeroconf",...
[ "async", "def", "test_homekit_uses_system_zeroconf", "(", "hass", ",", "hk_driver", ",", "mock_zeroconf", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_NAME", ":", "BRIDGE_NAME", ",", "CONF_PORT", ":", "D...
[ 1046, 0 ]
[ 1064, 42 ]
python
de
['de', 'pl', 'en']
False
_write_data
(path: str, data: Dict)
Write the data.
Write the data.
def _write_data(path: str, data: Dict) -> None: """Write the data.""" if not os.path.isdir(os.path.dirname(path)): os.makedirs(os.path.dirname(path)) json_util.save_json(path, data)
[ "def", "_write_data", "(", "path", ":", "str", ",", "data", ":", "Dict", ")", "->", "None", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "dirname", "(", "path", ")", ")", ":", "os", ".", "makedirs", "(", "os",...
[ 1067, 0 ]
[ 1071, 35 ]
python
en
['en', 'sn', 'en']
True
test_homekit_ignored_missing_devices
( hass, hk_driver, debounce_patcher, device_reg, entity_reg )
Test HomeKit handles a device in the entity registry but missing from the device registry.
Test HomeKit handles a device in the entity registry but missing from the device registry.
async def test_homekit_ignored_missing_devices( hass, hk_driver, debounce_patcher, device_reg, entity_reg ): """Test HomeKit handles a device in the entity registry but missing from the device registry.""" entry = await async_init_integration(hass) homekit = HomeKit( hass, None, ...
[ "async", "def", "test_homekit_ignored_missing_devices", "(", "hass", ",", "hk_driver", ",", "debounce_patcher", ",", "device_reg", ",", "entity_reg", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ")", "homekit", "=", "HomeKit", "(", "hass...
[ 1074, 0 ]
[ 1153, 5 ]
python
en
['en', 'en', 'en']
True
test_homekit_finds_linked_motion_sensors
( hass, hk_driver, debounce_patcher, device_reg, entity_reg )
Test HomeKit start method.
Test HomeKit start method.
async def test_homekit_finds_linked_motion_sensors( hass, hk_driver, debounce_patcher, device_reg, entity_reg ): """Test HomeKit start method.""" entry = await async_init_integration(hass) homekit = HomeKit( hass, None, None, None, {}, {"camera.camera_dem...
[ "async", "def", "test_homekit_finds_linked_motion_sensors", "(", "hass", ",", "hk_driver", ",", "debounce_patcher", ",", "device_reg", ",", "entity_reg", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ")", "homekit", "=", "HomeKit", "(", "...
[ 1156, 0 ]
[ 1229, 5 ]
python
en
['en', 'et', 'en']
True
test_homekit_finds_linked_humidity_sensors
( hass, hk_driver, debounce_patcher, device_reg, entity_reg )
Test HomeKit start method.
Test HomeKit start method.
async def test_homekit_finds_linked_humidity_sensors( hass, hk_driver, debounce_patcher, device_reg, entity_reg ): """Test HomeKit start method.""" entry = await async_init_integration(hass) homekit = HomeKit( hass, None, None, None, {}, {"humidifier.humi...
[ "async", "def", "test_homekit_finds_linked_humidity_sensors", "(", "hass", ",", "hk_driver", ",", "debounce_patcher", ",", "device_reg", ",", "entity_reg", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ")", "homekit", "=", "HomeKit", "(", ...
[ 1232, 0 ]
[ 1307, 5 ]
python
en
['en', 'et', 'en']
True
test_reload
(hass)
Test we can reload from yaml.
Test we can reload from yaml.
async def test_reload(hass): """Test we can reload from yaml.""" entry = MockConfigEntry( domain=DOMAIN, source=SOURCE_IMPORT, data={CONF_NAME: "reloadable", CONF_PORT: 12345}, options={}, ) entry.add_to_hass(hass) with patch(f"{PATH_HOMEKIT}.HomeKit") as mock_homeki...
[ "async", "def", "test_reload", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "source", "=", "SOURCE_IMPORT", ",", "data", "=", "{", "CONF_NAME", ":", "\"reloadable\"", ",", "CONF_PORT", ":", "12345", "}", ",", ...
[ 1310, 0 ]
[ 1377, 47 ]
python
en
['en', 'en', 'en']
True
test_homekit_start_in_accessory_mode
( hass, hk_driver, device_reg, debounce_patcher )
Test HomeKit start method in accessory mode.
Test HomeKit start method in accessory mode.
async def test_homekit_start_in_accessory_mode( hass, hk_driver, device_reg, debounce_patcher ): """Test HomeKit start method in accessory mode.""" entry = await async_init_integration(hass) pin = b"123-45-678" homekit = HomeKit( hass, None, None, None, {}, ...
[ "async", "def", "test_homekit_start_in_accessory_mode", "(", "hass", ",", "hk_driver", ",", "device_reg", ",", "debounce_patcher", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ")", "pin", "=", "b\"123-45-678\"", "homekit", "=", "HomeKit", ...
[ 1384, 0 ]
[ 1423, 43 ]
python
en
['en', 'fy', 'en']
True
client
(loop, hass, hass_client)
Client to communicate with Z-Wave config views.
Client to communicate with Z-Wave config views.
def client(loop, hass, hass_client): """Client to communicate with Z-Wave config views.""" with patch.object(config, "SECTIONS", ["zwave"]): loop.run_until_complete(async_setup_component(hass, "config", {})) return loop.run_until_complete(hass_client())
[ "def", "client", "(", "loop", ",", "hass", ",", "hass_client", ")", ":", "with", "patch", ".", "object", "(", "config", ",", "\"SECTIONS\"", ",", "[", "\"zwave\"", "]", ")", ":", "loop", ".", "run_until_complete", "(", "async_setup_component", "(", "hass",...
[ 17, 0 ]
[ 22, 49 ]
python
en
['en', 'en', 'en']
True
test_get_device_config
(client)
Test getting device config.
Test getting device config.
async def test_get_device_config(client): """Test getting device config.""" def mock_read(path): """Mock reading data.""" return {"hello.beer": {"free": "beer"}, "other.entity": {"do": "something"}} with patch("homeassistant.components.config._read", mock_read): resp = await client...
[ "async", "def", "test_get_device_config", "(", "client", ")", ":", "def", "mock_read", "(", "path", ")", ":", "\"\"\"Mock reading data.\"\"\"", "return", "{", "\"hello.beer\"", ":", "{", "\"free\"", ":", "\"beer\"", "}", ",", "\"other.entity\"", ":", "{", "\"do\...
[ 25, 0 ]
[ 38, 37 ]
python
en
['de', 'en', 'en']
True
test_update_device_config
(client)
Test updating device config.
Test updating device config.
async def test_update_device_config(client): """Test updating device config.""" orig_data = { "hello.beer": {"ignored": True}, "other.entity": {"polling_intensity": 2}, } def mock_read(path): """Mock reading data.""" return orig_data written = [] def mock_write...
[ "async", "def", "test_update_device_config", "(", "client", ")", ":", "orig_data", "=", "{", "\"hello.beer\"", ":", "{", "\"ignored\"", ":", "True", "}", ",", "\"other.entity\"", ":", "{", "\"polling_intensity\"", ":", "2", "}", ",", "}", "def", "mock_read", ...
[ 41, 0 ]
[ 72, 34 ]
python
en
['de', 'en', 'en']
True
test_update_device_config_invalid_key
(client)
Test updating device config.
Test updating device config.
async def test_update_device_config_invalid_key(client): """Test updating device config.""" resp = await client.post( "/api/config/zwave/device_config/invalid_entity", data=json.dumps({"polling_intensity": 2}), ) assert resp.status == 400
[ "async", "def", "test_update_device_config_invalid_key", "(", "client", ")", ":", "resp", "=", "await", "client", ".", "post", "(", "\"/api/config/zwave/device_config/invalid_entity\"", ",", "data", "=", "json", ".", "dumps", "(", "{", "\"polling_intensity\"", ":", ...
[ 75, 0 ]
[ 82, 29 ]
python
en
['de', 'en', 'en']
True
test_update_device_config_invalid_data
(client)
Test updating device config.
Test updating device config.
async def test_update_device_config_invalid_data(client): """Test updating device config.""" resp = await client.post( "/api/config/zwave/device_config/hello.beer", data=json.dumps({"invalid_option": 2}), ) assert resp.status == 400
[ "async", "def", "test_update_device_config_invalid_data", "(", "client", ")", ":", "resp", "=", "await", "client", ".", "post", "(", "\"/api/config/zwave/device_config/hello.beer\"", ",", "data", "=", "json", ".", "dumps", "(", "{", "\"invalid_option\"", ":", "2", ...
[ 85, 0 ]
[ 92, 29 ]
python
en
['de', 'en', 'en']
True
test_update_device_config_invalid_json
(client)
Test updating device config.
Test updating device config.
async def test_update_device_config_invalid_json(client): """Test updating device config.""" resp = await client.post( "/api/config/zwave/device_config/hello.beer", data="not json" ) assert resp.status == 400
[ "async", "def", "test_update_device_config_invalid_json", "(", "client", ")", ":", "resp", "=", "await", "client", ".", "post", "(", "\"/api/config/zwave/device_config/hello.beer\"", ",", "data", "=", "\"not json\"", ")", "assert", "resp", ".", "status", "==", "400"...
[ 95, 0 ]
[ 101, 29 ]
python
en
['de', 'en', 'en']
True
test_get_values
(hass, client)
Test getting values on node.
Test getting values on node.
async def test_get_values(hass, client): """Test getting values on node.""" node = MockNode(node_id=1) value = MockValue( value_id=123456, node=node, label="Test Label", instance=1, index=2, poll_intensity=4, ) values = MockEntityValues(primary=value) ...
[ "async", "def", "test_get_values", "(", "hass", ",", "client", ")", ":", "node", "=", "MockNode", "(", "node_id", "=", "1", ")", "value", "=", "MockValue", "(", "value_id", "=", "123456", ",", "node", "=", "node", ",", "label", "=", "\"Test Label\"", "...
[ 104, 0 ]
[ 133, 5 ]
python
en
['nl', 'en', 'en']
True
test_get_groups
(hass, client)
Test getting groupdata on node.
Test getting groupdata on node.
async def test_get_groups(hass, client): """Test getting groupdata on node.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=2) node.groups.associations = "assoc" node.groups.associations_instances = "inst" node.groups.label = "the label" node.groups.max_association...
[ "async", "def", "test_get_groups", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "2", ")", "node", ".", "groups", ".", "a...
[ 136, 0 ]
[ 159, 5 ]
python
de
['nl', 'de', 'en']
False
test_get_groups_nogroups
(hass, client)
Test getting groupdata on node with no groups.
Test getting groupdata on node with no groups.
async def test_get_groups_nogroups(hass, client): """Test getting groupdata on node with no groups.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=2) network.nodes = {2: node} resp = await client.get("/api/zwave/groups/2") assert resp.status == 200 result = awa...
[ "async", "def", "test_get_groups_nogroups", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "2", ")", "network", ".", "nodes", ...
[ 162, 0 ]
[ 174, 23 ]
python
en
['en', 'en', 'en']
True
test_get_groups_nonode
(hass, client)
Test getting groupdata on nonexisting node.
Test getting groupdata on nonexisting node.
async def test_get_groups_nonode(hass, client): """Test getting groupdata on nonexisting node.""" network = hass.data[DATA_NETWORK] = MagicMock() network.nodes = {1: 1, 5: 5} resp = await client.get("/api/zwave/groups/2") assert resp.status == HTTP_NOT_FOUND result = await resp.json() ass...
[ "async", "def", "test_get_groups_nonode", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "network", ".", "nodes", "=", "{", "1", ":", "1", ",", "5", ":", "5", "}", "r...
[ 177, 0 ]
[ 187, 50 ]
python
en
['nl', 'en', 'en']
True
test_get_config
(hass, client)
Test getting config on node.
Test getting config on node.
async def test_get_config(hass, client): """Test getting config on node.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=2) value = MockValue(index=12, command_class=const.COMMAND_CLASS_CONFIGURATION) value.label = "label" value.help = "help" value.type = "type" ...
[ "async", "def", "test_get_config", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "2", ")", "value", "=", "MockValue", "(", ...
[ 190, 0 ]
[ 221, 5 ]
python
en
['nl', 'en', 'en']
True
test_get_config_noconfig_node
(hass, client)
Test getting config on node without config.
Test getting config on node without config.
async def test_get_config_noconfig_node(hass, client): """Test getting config on node without config.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=2) network.nodes = {2: node} node.get_values.return_value = node.values resp = await client.get("/api/zwave/config/2"...
[ "async", "def", "test_get_config_noconfig_node", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "2", ")", "network", ".", "nod...
[ 224, 0 ]
[ 237, 23 ]
python
en
['en', 'en', 'en']
True
test_get_config_nonode
(hass, client)
Test getting config on nonexisting node.
Test getting config on nonexisting node.
async def test_get_config_nonode(hass, client): """Test getting config on nonexisting node.""" network = hass.data[DATA_NETWORK] = MagicMock() network.nodes = {1: 1, 5: 5} resp = await client.get("/api/zwave/config/2") assert resp.status == HTTP_NOT_FOUND result = await resp.json() assert...
[ "async", "def", "test_get_config_nonode", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "network", ".", "nodes", "=", "{", "1", ":", "1", ",", "5", ":", "5", "}", "r...
[ 240, 0 ]
[ 250, 50 ]
python
en
['nl', 'en', 'en']
True
test_get_usercodes_nonode
(hass, client)
Test getting usercodes on nonexisting node.
Test getting usercodes on nonexisting node.
async def test_get_usercodes_nonode(hass, client): """Test getting usercodes on nonexisting node.""" network = hass.data[DATA_NETWORK] = MagicMock() network.nodes = {1: 1, 5: 5} resp = await client.get("/api/zwave/usercodes/2") assert resp.status == HTTP_NOT_FOUND result = await resp.json() ...
[ "async", "def", "test_get_usercodes_nonode", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "network", ".", "nodes", "=", "{", "1", ":", "1", ",", "5", ":", "5", "}", ...
[ 253, 0 ]
[ 263, 50 ]
python
en
['en', 'en', 'en']
True
test_get_usercodes
(hass, client)
Test getting usercodes on node.
Test getting usercodes on node.
async def test_get_usercodes(hass, client): """Test getting usercodes on node.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=18, command_classes=[const.COMMAND_CLASS_USER_CODE]) value = MockValue(index=0, command_class=const.COMMAND_CLASS_USER_CODE) value.genre = const.G...
[ "async", "def", "test_get_usercodes", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "18", ",", "command_classes", "=", "[", ...
[ 266, 0 ]
[ 283, 75 ]
python
en
['en', 'en', 'en']
True
test_get_usercode_nousercode_node
(hass, client)
Test getting usercodes on node without usercodes.
Test getting usercodes on node without usercodes.
async def test_get_usercode_nousercode_node(hass, client): """Test getting usercodes on node without usercodes.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=18) network.nodes = {18: node} node.get_values.return_value = node.values resp = await client.get("/api/zwa...
[ "async", "def", "test_get_usercode_nousercode_node", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "18", ")", "network", ".", ...
[ 286, 0 ]
[ 299, 23 ]
python
en
['en', 'en', 'en']
True
test_get_usercodes_no_genreuser
(hass, client)
Test getting usercodes on node missing genre user.
Test getting usercodes on node missing genre user.
async def test_get_usercodes_no_genreuser(hass, client): """Test getting usercodes on node missing genre user.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=18, command_classes=[const.COMMAND_CLASS_USER_CODE]) value = MockValue(index=0, command_class=const.COMMAND_CLASS_USER...
[ "async", "def", "test_get_usercodes_no_genreuser", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "18", ",", "command_classes", ...
[ 302, 0 ]
[ 319, 23 ]
python
en
['nl', 'en', 'en']
True
test_save_config_no_network
(hass, client)
Test saving configuration without network data.
Test saving configuration without network data.
async def test_save_config_no_network(hass, client): """Test saving configuration without network data.""" resp = await client.post("/api/zwave/saveconfig") assert resp.status == HTTP_NOT_FOUND result = await resp.json() assert result == {"message": "No Z-Wave network data found"}
[ "async", "def", "test_save_config_no_network", "(", "hass", ",", "client", ")", ":", "resp", "=", "await", "client", ".", "post", "(", "\"/api/zwave/saveconfig\"", ")", "assert", "resp", ".", "status", "==", "HTTP_NOT_FOUND", "result", "=", "await", "resp", "....
[ 322, 0 ]
[ 328, 64 ]
python
en
['en', 'en', 'en']
True
test_save_config
(hass, client)
Test saving configuration.
Test saving configuration.
async def test_save_config(hass, client): """Test saving configuration.""" network = hass.data[DATA_NETWORK] = MagicMock() resp = await client.post("/api/zwave/saveconfig") assert resp.status == 200 result = await resp.json() assert network.write_config.called assert result == {"message": ...
[ "async", "def", "test_save_config", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "resp", "=", "await", "client", ".", "post", "(", "\"/api/zwave/saveconfig\"", ")", "assert...
[ 331, 0 ]
[ 340, 70 ]
python
en
['en', 'zh', 'en']
True
test_get_protection_values
(hass, client)
Test getting protection values on node.
Test getting protection values on node.
async def test_get_protection_values(hass, client): """Test getting protection values on node.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=18, command_classes=[const.COMMAND_CLASS_PROTECTION]) value = MockValue( value_id=123456, index=0, instance=1,...
[ "async", "def", "test_get_protection_values", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "18", ",", "command_classes", "=", ...
[ 343, 0 ]
[ 378, 5 ]
python
en
['en', 'en', 'en']
True
test_get_protection_values_nonexisting_node
(hass, client)
Test getting protection values on node with wrong nodeid.
Test getting protection values on node with wrong nodeid.
async def test_get_protection_values_nonexisting_node(hass, client): """Test getting protection values on node with wrong nodeid.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=18, command_classes=[const.COMMAND_CLASS_PROTECTION]) value = MockValue( value_id=123456, ...
[ "async", "def", "test_get_protection_values_nonexisting_node", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "18", ",", "command_...
[ 381, 0 ]
[ 408, 50 ]
python
en
['en', 'en', 'en']
True
test_get_protection_values_without_protectionclass
(hass, client)
Test getting protection values on node without protectionclass.
Test getting protection values on node without protectionclass.
async def test_get_protection_values_without_protectionclass(hass, client): """Test getting protection values on node without protectionclass.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=18) value = MockValue(value_id=123456, index=0, instance=1) network.nodes = {18: n...
[ "async", "def", "test_get_protection_values_without_protectionclass", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "18", ")", "v...
[ 411, 0 ]
[ 426, 23 ]
python
en
['en', 'en', 'en']
True
test_set_protection_value
(hass, client)
Test setting protection value on node.
Test setting protection value on node.
async def test_set_protection_value(hass, client): """Test setting protection value on node.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=18, command_classes=[const.COMMAND_CLASS_PROTECTION]) value = MockValue( value_id=123456, index=0, instance=1, ...
[ "async", "def", "test_set_protection_value", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "18", ",", "command_classes", "=", ...
[ 429, 0 ]
[ 457, 72 ]
python
en
['en', 'en', 'en']
True
test_set_protection_value_failed
(hass, client)
Test setting protection value failed on node.
Test setting protection value failed on node.
async def test_set_protection_value_failed(hass, client): """Test setting protection value failed on node.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=18, command_classes=[const.COMMAND_CLASS_PROTECTION]) value = MockValue( value_id=123456, index=0, ...
[ "async", "def", "test_set_protection_value_failed", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "18", ",", "command_classes", ...
[ 460, 0 ]
[ 489, 71 ]
python
en
['en', 'en', 'en']
True
test_set_protection_value_nonexisting_node
(hass, client)
Test setting protection value on nonexisting node.
Test setting protection value on nonexisting node.
async def test_set_protection_value_nonexisting_node(hass, client): """Test setting protection value on nonexisting node.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=17, command_classes=[const.COMMAND_CLASS_PROTECTION]) value = MockValue( value_id=123456, i...
[ "async", "def", "test_set_protection_value_nonexisting_node", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "17", ",", "command_c...
[ 492, 0 ]
[ 521, 50 ]
python
en
['en', 'en', 'en']
True
test_set_protection_value_missing_class
(hass, client)
Test setting protection value on node without protectionclass.
Test setting protection value on node without protectionclass.
async def test_set_protection_value_missing_class(hass, client): """Test setting protection value on node without protectionclass.""" network = hass.data[DATA_NETWORK] = MagicMock() node = MockNode(node_id=17) value = MockValue(value_id=123456, index=0, instance=1) network.nodes = {17: node} nod...
[ "async", "def", "test_set_protection_value_missing_class", "(", "hass", ",", "client", ")", ":", "network", "=", "hass", ".", "data", "[", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "node_id", "=", "17", ")", "value", "=...
[ 524, 0 ]
[ 541, 75 ]
python
en
['en', 'en', 'en']
True
create_position_ids_from_input_ids
(input_ids, padding_idx)
Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignored. This is modified from fairseq's `utils.make_positions`. :param torch.Tensor x: :return torch.Tensor:
Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignored. This is modified from fairseq's `utils.make_positions`. :param torch.Tensor x: :return torch.Tensor:
def create_position_ids_from_input_ids(input_ids, padding_idx): """ Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignored. This is modified from fairseq's `utils.make_positions`. :param torch.Tensor x: :return torch.Tensor: """ ...
[ "def", "create_position_ids_from_input_ids", "(", "input_ids", ",", "padding_idx", ")", ":", "# The series of casts and type-conversions here are carefully balanced to both work with ONNX export and XLA.", "mask", "=", "input_ids", ".", "ne", "(", "padding_idx", ")", ".", "int", ...
[ 1058, 0 ]
[ 1066, 51 ]
python
en
['en', 'error', 'th']
False
MPNetPreTrainedModel._init_weights
(self, module)
Initialize the weights
Initialize the weights
def _init_weights(self, module): """ Initialize the weights """ if isinstance(module, nn.Linear): # Slightly different from the TF version which uses truncated_normal for initialization # cf https://github.com/pytorch/pytorch/pull/5617 module.weight.data.normal_(mean=...
[ "def", "_init_weights", "(", "self", ",", "module", ")", ":", "if", "isinstance", "(", "module", ",", "nn", ".", "Linear", ")", ":", "# Slightly different from the TF version which uses truncated_normal for initialization", "# cf https://github.com/pytorch/pytorch/pull/5617", ...
[ 57, 4 ]
[ 71, 41 ]
python
en
['en', 'en', 'en']
True
MPNetEmbeddings.create_position_ids_from_inputs_embeds
(self, inputs_embeds)
We are provided embeddings directly. We cannot infer which are padded so just generate sequential position ids. Args: inputs_embeds: torch.Tensor Returns: torch.Tensor
We are provided embeddings directly. We cannot infer which are padded so just generate sequential position ids.
def create_position_ids_from_inputs_embeds(self, inputs_embeds): """ We are provided embeddings directly. We cannot infer which are padded so just generate sequential position ids. Args: inputs_embeds: torch.Tensor Returns: torch.Tensor """ input_shape = inp...
[ "def", "create_position_ids_from_inputs_embeds", "(", "self", ",", "inputs_embeds", ")", ":", "input_shape", "=", "inputs_embeds", ".", "size", "(", ")", "[", ":", "-", "1", "]", "sequence_length", "=", "input_shape", "[", "1", "]", "position_ids", "=", "torch...
[ 113, 4 ]
[ 128, 60 ]
python
en
['en', 'error', 'th']
False
MPNetForMaskedLM.forward
( self, input_ids=None, attention_mask=None, position_ids=None, head_mask=None, inputs_embeds=None, labels=None, output_attentions=None, output_hidden_states=None, return_dict=None, )
r""" labels (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`): Labels for computing the masked language modeling loss. Indices should be in ``[-100, 0, ..., config.vocab_size]`` (see ``input_ids`` docstring) Tokens with indices set to ``-100`` are ignore...
r""" labels (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`): Labels for computing the masked language modeling loss. Indices should be in ``[-100, 0, ..., config.vocab_size]`` (see ``input_ids`` docstring) Tokens with indices set to ``-100`` are ignore...
def forward( self, input_ids=None, attention_mask=None, position_ids=None, head_mask=None, inputs_embeds=None, labels=None, output_attentions=None, output_hidden_states=None, return_dict=None, ): r""" labels (:obj:`torch...
[ "def", "forward", "(", "self", ",", "input_ids", "=", "None", ",", "attention_mask", "=", "None", ",", "position_ids", "=", "None", ",", "head_mask", "=", "None", ",", "inputs_embeds", "=", "None", ",", "labels", "=", "None", ",", "output_attentions", "=",...
[ 600, 4 ]
[ 648, 9 ]
python
cy
['en', 'cy', 'hi']
False
async_register_panel
( hass, # The url to serve the panel frontend_url_path, # The webcomponent name that loads your panel webcomponent_name, # Title/icon for sidebar sidebar_title=None, sidebar_icon=None, # JS source of your panel js_url=None, # JS module of your panel module_url=None, #...
Register a new custom panel.
Register a new custom panel.
async def async_register_panel( hass, # The url to serve the panel frontend_url_path, # The webcomponent name that loads your panel webcomponent_name, # Title/icon for sidebar sidebar_title=None, sidebar_icon=None, # JS source of your panel js_url=None, # JS module of your pa...
[ "async", "def", "async_register_panel", "(", "hass", ",", "# The url to serve the panel", "frontend_url_path", ",", "# The webcomponent name that loads your panel", "webcomponent_name", ",", "# Title/icon for sidebar", "sidebar_title", "=", "None", ",", "sidebar_icon", "=", "No...
[ 68, 0 ]
[ 123, 5 ]
python
en
['en', 'no', 'en']
True
async_setup
(hass, config)
Initialize custom panel.
Initialize custom panel.
async def async_setup(hass, config): """Initialize custom panel.""" if DOMAIN not in config: return True for panel in config[DOMAIN]: name = panel[CONF_COMPONENT_NAME] kwargs = { "webcomponent_name": panel[CONF_COMPONENT_NAME], "frontend_url_path": panel.get...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "for", "panel", "in", "config", "[", "DOMAIN", "]", ":", "name", "=", "panel", "[", "CONF_COMPONENT_NAME", "]", "kwargs", ...
[ 126, 0 ]
[ 160, 15 ]
python
en
['en', 'la', 'en']
True
setup_platform
(hass, config, add_devices, discovery_info=None)
Set up of an enigma2 media player.
Set up of an enigma2 media player.
def setup_platform(hass, config, add_devices, discovery_info=None): """Set up of an enigma2 media player.""" if discovery_info: # Discovery gives us the streaming service port (8001) # which is not useful as OpenWebif never runs on that port. # So use the default port instead. co...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_devices", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", ":", "# Discovery gives us the streaming service port (8001)", "# which is not useful as OpenWebif never runs on that port.", "# So use...
[ 83, 0 ]
[ 112, 65 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.__init__
(self, name, device)
Initialize the Enigma2 device.
Initialize the Enigma2 device.
def __init__(self, name, device): """Initialize the Enigma2 device.""" self._name = name self.e2_box = device
[ "def", "__init__", "(", "self", ",", "name", ",", "device", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "e2_box", "=", "device" ]
[ 118, 4 ]
[ 121, 28 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.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" ]
[ 124, 4 ]
[ 126, 25 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" if self.e2_box.is_recording_playback: return STATE_PLAYING return STATE_OFF if self.e2_box.in_standby else STATE_ON
[ "def", "state", "(", "self", ")", ":", "if", "self", ".", "e2_box", ".", "is_recording_playback", ":", "return", "STATE_PLAYING", "return", "STATE_OFF", "if", "self", ".", "e2_box", ".", "in_standby", "else", "STATE_ON" ]
[ 129, 4 ]
[ 133, 64 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.available
(self)
Return True if the device is available.
Return True if the device is available.
def available(self): """Return True if the device is available.""" return not self.e2_box.is_offline
[ "def", "available", "(", "self", ")", ":", "return", "not", "self", ".", "e2_box", ".", "is_offline" ]
[ 136, 4 ]
[ 138, 41 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.supported_features
(self)
Flag of media commands that are supported.
Flag of media commands that are supported.
def supported_features(self): """Flag of media commands that are supported.""" return SUPPORTED_ENIGMA2
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORTED_ENIGMA2" ]
[ 141, 4 ]
[ 143, 32 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.turn_off
(self)
Turn off media player.
Turn off media player.
def turn_off(self): """Turn off media player.""" self.e2_box.turn_off()
[ "def", "turn_off", "(", "self", ")", ":", "self", ".", "e2_box", ".", "turn_off", "(", ")" ]
[ 145, 4 ]
[ 147, 30 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.turn_on
(self)
Turn the media player on.
Turn the media player on.
def turn_on(self): """Turn the media player on.""" self.e2_box.turn_on()
[ "def", "turn_on", "(", "self", ")", ":", "self", ".", "e2_box", ".", "turn_on", "(", ")" ]
[ 149, 4 ]
[ 151, 29 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.media_title
(self)
Title of current playing media.
Title of current playing media.
def media_title(self): """Title of current playing media.""" return self.e2_box.current_service_channel_name
[ "def", "media_title", "(", "self", ")", ":", "return", "self", ".", "e2_box", ".", "current_service_channel_name" ]
[ 154, 4 ]
[ 156, 55 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.media_series_title
(self)
Return the title of current episode of TV show.
Return the title of current episode of TV show.
def media_series_title(self): """Return the title of current episode of TV show.""" return self.e2_box.current_programme_name
[ "def", "media_series_title", "(", "self", ")", ":", "return", "self", ".", "e2_box", ".", "current_programme_name" ]
[ 159, 4 ]
[ 161, 49 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.media_channel
(self)
Channel of current playing media.
Channel of current playing media.
def media_channel(self): """Channel of current playing media.""" return self.e2_box.current_service_channel_name
[ "def", "media_channel", "(", "self", ")", ":", "return", "self", ".", "e2_box", ".", "current_service_channel_name" ]
[ 164, 4 ]
[ 166, 55 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.media_content_id
(self)
Service Ref of current playing media.
Service Ref of current playing media.
def media_content_id(self): """Service Ref of current playing media.""" return self.e2_box.current_service_ref
[ "def", "media_content_id", "(", "self", ")", ":", "return", "self", ".", "e2_box", ".", "current_service_ref" ]
[ 169, 4 ]
[ 171, 46 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.media_content_type
(self)
Type of video currently playing.
Type of video currently playing.
def media_content_type(self): """Type of video currently playing.""" return MEDIA_TYPE_TVSHOW
[ "def", "media_content_type", "(", "self", ")", ":", "return", "MEDIA_TYPE_TVSHOW" ]
[ 174, 4 ]
[ 176, 32 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.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.e2_box.muted
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "e2_box", ".", "muted" ]
[ 179, 4 ]
[ 181, 32 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.media_image_url
(self)
Picon url for the channel.
Picon url for the channel.
def media_image_url(self): """Picon url for the channel.""" return self.e2_box.picon_url
[ "def", "media_image_url", "(", "self", ")", ":", "return", "self", ".", "e2_box", ".", "picon_url" ]
[ 184, 4 ]
[ 186, 36 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.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.e2_box.set_volume(int(volume * 100))
[ "def", "set_volume_level", "(", "self", ",", "volume", ")", ":", "self", ".", "e2_box", ".", "set_volume", "(", "int", "(", "volume", "*", "100", ")", ")" ]
[ 188, 4 ]
[ 190, 49 ]
python
en
['fr', 'zu', 'en']
False
Enigma2Device.volume_up
(self)
Volume up the media player.
Volume up the media player.
def volume_up(self): """Volume up the media player.""" self.e2_box.set_volume(int(self.e2_box.volume * 100) + 5)
[ "def", "volume_up", "(", "self", ")", ":", "self", ".", "e2_box", ".", "set_volume", "(", "int", "(", "self", ".", "e2_box", ".", "volume", "*", "100", ")", "+", "5", ")" ]
[ 192, 4 ]
[ 194, 65 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.volume_down
(self)
Volume down media player.
Volume down media player.
def volume_down(self): """Volume down media player.""" self.e2_box.set_volume(int(self.e2_box.volume * 100) - 5)
[ "def", "volume_down", "(", "self", ")", ":", "self", ".", "e2_box", ".", "set_volume", "(", "int", "(", "self", ".", "e2_box", ".", "volume", "*", "100", ")", "-", "5", ")" ]
[ 196, 4 ]
[ 198, 65 ]
python
en
['en', 'sl', 'en']
True
Enigma2Device.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.e2_box.volume
[ "def", "volume_level", "(", "self", ")", ":", "return", "self", ".", "e2_box", ".", "volume" ]
[ 201, 4 ]
[ 203, 33 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.media_stop
(self)
Send stop command.
Send stop command.
def media_stop(self): """Send stop command.""" self.e2_box.set_stop()
[ "def", "media_stop", "(", "self", ")", ":", "self", ".", "e2_box", ".", "set_stop", "(", ")" ]
[ 205, 4 ]
[ 207, 30 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.media_play
(self)
Play media.
Play media.
def media_play(self): """Play media.""" self.e2_box.toggle_play_pause()
[ "def", "media_play", "(", "self", ")", ":", "self", ".", "e2_box", ".", "toggle_play_pause", "(", ")" ]
[ 209, 4 ]
[ 211, 39 ]
python
en
['en', 'sv', 'en']
False
Enigma2Device.media_pause
(self)
Pause the media player.
Pause the media player.
def media_pause(self): """Pause the media player.""" self.e2_box.toggle_play_pause()
[ "def", "media_pause", "(", "self", ")", ":", "self", ".", "e2_box", ".", "toggle_play_pause", "(", ")" ]
[ 213, 4 ]
[ 215, 39 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.media_next_track
(self)
Send next track command.
Send next track command.
def media_next_track(self): """Send next track command.""" self.e2_box.set_channel_up()
[ "def", "media_next_track", "(", "self", ")", ":", "self", ".", "e2_box", ".", "set_channel_up", "(", ")" ]
[ 217, 4 ]
[ 219, 36 ]
python
en
['en', 'pt', 'en']
True
Enigma2Device.media_previous_track
(self)
Send next track command.
Send next track command.
def media_previous_track(self): """Send next track command.""" self.e2_box.set_channel_down()
[ "def", "media_previous_track", "(", "self", ")", ":", "self", ".", "e2_box", ".", "set_channel_down", "(", ")" ]
[ 221, 4 ]
[ 223, 38 ]
python
en
['en', 'pt', 'en']
True
Enigma2Device.mute_volume
(self, mute)
Mute or unmute.
Mute or unmute.
def mute_volume(self, mute): """Mute or unmute.""" self.e2_box.mute_volume()
[ "def", "mute_volume", "(", "self", ",", "mute", ")", ":", "self", ".", "e2_box", ".", "mute_volume", "(", ")" ]
[ 225, 4 ]
[ 227, 33 ]
python
en
['en', 'la', 'it']
False
Enigma2Device.source
(self)
Return the current input source.
Return the current input source.
def source(self): """Return the current input source.""" return self.e2_box.current_service_channel_name
[ "def", "source", "(", "self", ")", ":", "return", "self", ".", "e2_box", ".", "current_service_channel_name" ]
[ 230, 4 ]
[ 232, 55 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.source_list
(self)
List of available input sources.
List of available input sources.
def source_list(self): """List of available input sources.""" return self.e2_box.source_list
[ "def", "source_list", "(", "self", ")", ":", "return", "self", ".", "e2_box", ".", "source_list" ]
[ 235, 4 ]
[ 237, 38 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.select_source
(self, source)
Select input source.
Select input source.
def select_source(self, source): """Select input source.""" self.e2_box.select_source(self.e2_box.sources[source])
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "self", ".", "e2_box", ".", "select_source", "(", "self", ".", "e2_box", ".", "sources", "[", "source", "]", ")" ]
[ 239, 4 ]
[ 241, 62 ]
python
en
['fr', 'su', 'en']
False
Enigma2Device.update
(self)
Update state of the media_player.
Update state of the media_player.
def update(self): """Update state of the media_player.""" self.e2_box.update()
[ "def", "update", "(", "self", ")", ":", "self", ".", "e2_box", ".", "update", "(", ")" ]
[ 243, 4 ]
[ 245, 28 ]
python
en
['en', 'en', 'en']
True
Enigma2Device.device_state_attributes
(self)
Return device specific state attributes. isRecording: Is the box currently recording. currservice_fulldescription: Full program description. currservice_begin: is in the format '21:00'. currservice_end: is in the format '21:00'.
Return device specific state attributes.
def device_state_attributes(self): """Return device specific state attributes. isRecording: Is the box currently recording. currservice_fulldescription: Full program description. currservice_begin: is in the format '21:00'. currservice_end: is in the format '21:00'. ...
[ "def", "device_state_attributes", "(", "self", ")", ":", "if", "self", ".", "e2_box", ".", "in_standby", ":", "return", "{", "}", "return", "{", "ATTR_MEDIA_CURRENTLY_RECORDING", ":", "self", ".", "e2_box", ".", "status_info", "[", "\"isRecording\"", "]", ",",...
[ 248, 4 ]
[ 265, 9 ]
python
en
['fr', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Flu Near You sensors based on a config entry.
Set up Flu Near You sensors based on a config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Flu Near You sensors based on a config entry.""" coordinators = hass.data[DOMAIN][DATA_COORDINATOR][config_entry.entry_id] sensors = [] for (sensor_type, name, icon, unit) in CDC_SENSORS: sensors.append( ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "coordinators", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "DATA_COORDINATOR", "]", "[", "config_entry", ".", "entry_id", "]", "sensors", "=", ...
[ 54, 0 ]
[ 84, 31 ]
python
en
['en', 'en', 'en']
True
FluNearYouSensor.__init__
(self, coordinator, config_entry, sensor_type, name, icon, unit)
Initialize the sensor.
Initialize the sensor.
def __init__(self, coordinator, config_entry, sensor_type, name, icon, unit): """Initialize the sensor.""" super().__init__(coordinator) self._attrs = {ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION} self._config_entry = config_entry self._icon = icon self._name = name sel...
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "config_entry", ",", "sensor_type", ",", "name", ",", "icon", ",", "unit", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_attrs", "=", "{", "ATTR_ATTRIBUTION"...
[ 90, 4 ]
[ 99, 25 ]
python
en
['en', 'en', 'en']
True
FluNearYouSensor.device_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def device_state_attributes(self): """Return the device state attributes.""" return self._attrs
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attrs" ]
[ 102, 4 ]
[ 104, 26 ]
python
en
['en', 'en', 'en']
True
FluNearYouSensor.icon
(self)
Return the icon.
Return the icon.
def icon(self): """Return the icon.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 107, 4 ]
[ 109, 25 ]
python
en
['en', 'sr', 'en']
True
FluNearYouSensor.name
(self)
Return the name.
Return the name.
def name(self): """Return the name.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 112, 4 ]
[ 114, 25 ]
python
en
['en', 'ig', 'en']
True
FluNearYouSensor.state
(self)
Return the state.
Return the state.
def state(self): """Return the state.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 117, 4 ]
[ 119, 26 ]
python
en
['en', 'en', 'en']
True
FluNearYouSensor.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): """Return a unique, Home Assistant friendly identifier for this entity.""" return ( f"{self._config_entry.data[CONF_LATITUDE]}," f"{self._config_entry.data[CONF_LONGITUDE]}_{self._sensor_type}" )
[ "def", "unique_id", "(", "self", ")", ":", "return", "(", "f\"{self._config_entry.data[CONF_LATITUDE]},\"", "f\"{self._config_entry.data[CONF_LONGITUDE]}_{self._sensor_type}\"", ")" ]
[ 122, 4 ]
[ 127, 9 ]
python
en
['en', 'en', 'en']
True
FluNearYouSensor.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" ]
[ 130, 4 ]
[ 132, 25 ]
python
en
['en', 'en', 'en']
True
FluNearYouSensor._handle_coordinator_update
(self)
Handle updated data from the coordinator.
Handle updated data from the coordinator.
def _handle_coordinator_update(self) -> None: """Handle updated data from the coordinator.""" self.update_from_latest_data() self.async_write_ha_state()
[ "def", "_handle_coordinator_update", "(", "self", ")", "->", "None", ":", "self", ".", "update_from_latest_data", "(", ")", "self", ".", "async_write_ha_state", "(", ")" ]
[ 135, 4 ]
[ 138, 35 ]
python
en
['en', 'en', 'en']
True
FluNearYouSensor.async_added_to_hass
(self)
Register callbacks.
Register callbacks.
async def async_added_to_hass(self): """Register callbacks.""" await super().async_added_to_hass() self.update_from_latest_data()
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "self", ".", "update_from_latest_data", "(", ")" ]
[ 140, 4 ]
[ 143, 38 ]
python
en
['en', 'no', 'en']
False
FluNearYouSensor.update_from_latest_data
(self)
Update the sensor.
Update the sensor.
def update_from_latest_data(self): """Update the sensor.""" raise NotImplementedError
[ "def", "update_from_latest_data", "(", "self", ")", ":", "raise", "NotImplementedError" ]
[ 146, 4 ]
[ 148, 33 ]
python
en
['en', 'nl', 'en']
True
CdcSensor.update_from_latest_data
(self)
Update the sensor.
Update the sensor.
def update_from_latest_data(self): """Update the sensor.""" self._attrs.update( { ATTR_REPORTED_DATE: self.coordinator.data["week_date"], ATTR_STATE: self.coordinator.data["name"], } ) self._state = self.coordinator.data[self._senso...
[ "def", "update_from_latest_data", "(", "self", ")", ":", "self", ".", "_attrs", ".", "update", "(", "{", "ATTR_REPORTED_DATE", ":", "self", ".", "coordinator", ".", "data", "[", "\"week_date\"", "]", ",", "ATTR_STATE", ":", "self", ".", "coordinator", ".", ...
[ 155, 4 ]
[ 163, 62 ]
python
en
['en', 'nl', 'en']
True
UserSensor.update_from_latest_data
(self)
Update the sensor.
Update the sensor.
def update_from_latest_data(self): """Update the sensor.""" self._attrs.update( { ATTR_CITY: self.coordinator.data["local"]["city"].split("(")[0], ATTR_REPORTED_LATITUDE: self.coordinator.data["local"]["latitude"], ATTR_REPORTED_LONGITUDE: self...
[ "def", "update_from_latest_data", "(", "self", ")", ":", "self", ".", "_attrs", ".", "update", "(", "{", "ATTR_CITY", ":", "self", ".", "coordinator", ".", "data", "[", "\"local\"", "]", "[", "\"city\"", "]", ".", "split", "(", "\"(\"", ")", "[", "0", ...
[ 170, 4 ]
[ 208, 75 ]
python
en
['en', 'nl', 'en']
True
IRobotEntity.__init__
(self, roomba, blid)
Initialize the iRobot handler.
Initialize the iRobot handler.
def __init__(self, roomba, blid): """Initialize the iRobot handler.""" self.vacuum = roomba self._blid = blid self.vacuum_state = roomba_reported_state(roomba) self._name = self.vacuum_state.get("name") self._version = self.vacuum_state.get("softwareVer") self._sk...
[ "def", "__init__", "(", "self", ",", "roomba", ",", "blid", ")", ":", "self", ".", "vacuum", "=", "roomba", "self", ".", "_blid", "=", "blid", "self", ".", "vacuum_state", "=", "roomba_reported_state", "(", "roomba", ")", "self", ".", "_name", "=", "se...
[ 66, 4 ]
[ 73, 48 ]
python
en
['en', 'lb', 'en']
True
IRobotEntity.should_poll
(self)
Disable polling.
Disable polling.
def should_poll(self): """Disable polling.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 76, 4 ]
[ 78, 20 ]
python
en
['fr', 'en', 'en']
False
IRobotEntity.robot_unique_id
(self)
Return the uniqueid of the vacuum cleaner.
Return the uniqueid of the vacuum cleaner.
def robot_unique_id(self): """Return the uniqueid of the vacuum cleaner.""" return f"roomba_{self._blid}"
[ "def", "robot_unique_id", "(", "self", ")", ":", "return", "f\"roomba_{self._blid}\"" ]
[ 81, 4 ]
[ 83, 37 ]
python
en
['en', 'la', 'en']
True
IRobotEntity.unique_id
(self)
Return the uniqueid of the vacuum cleaner.
Return the uniqueid of the vacuum cleaner.
def unique_id(self): """Return the uniqueid of the vacuum cleaner.""" return self.robot_unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "robot_unique_id" ]
[ 86, 4 ]
[ 88, 35 ]
python
en
['en', 'la', 'en']
True
IRobotEntity.device_info
(self)
Return the device info of the vacuum cleaner.
Return the device info of the vacuum cleaner.
def device_info(self): """Return the device info of the vacuum cleaner.""" return { "identifiers": {(DOMAIN, self.robot_unique_id)}, "manufacturer": "iRobot", "name": str(self._name), "sw_version": self._version, "model": self._sku, }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "robot_unique_id", ")", "}", ",", "\"manufacturer\"", ":", "\"iRobot\"", ",", "\"name\"", ":", "str", "(", "self", ".", "_name", ")"...
[ 91, 4 ]
[ 99, 9 ]
python
en
['en', 'en', 'en']
True
IRobotEntity._battery_level
(self)
Return the battery level of the vacuum cleaner.
Return the battery level of the vacuum cleaner.
def _battery_level(self): """Return the battery level of the vacuum cleaner.""" return self.vacuum_state.get("batPct")
[ "def", "_battery_level", "(", "self", ")", ":", "return", "self", ".", "vacuum_state", ".", "get", "(", "\"batPct\"", ")" ]
[ 102, 4 ]
[ 104, 46 ]
python
en
['en', 'en', 'en']
True
IRobotEntity._robot_state
(self)
Return the state of the vacuum cleaner.
Return the state of the vacuum cleaner.
def _robot_state(self): """Return the state of the vacuum cleaner.""" clean_mission_status = self.vacuum_state.get("cleanMissionStatus", {}) cycle = clean_mission_status.get("cycle") phase = clean_mission_status.get("phase") try: state = STATE_MAP[phase] excep...
[ "def", "_robot_state", "(", "self", ")", ":", "clean_mission_status", "=", "self", ".", "vacuum_state", ".", "get", "(", "\"cleanMissionStatus\"", ",", "{", "}", ")", "cycle", "=", "clean_mission_status", ".", "get", "(", "\"cycle\"", ")", "phase", "=", "cle...
[ 107, 4 ]
[ 118, 20 ]
python
en
['en', 'en', 'en']
True
IRobotEntity.async_added_to_hass
(self)
Register callback function.
Register callback function.
async def async_added_to_hass(self): """Register callback function.""" self.vacuum.register_on_message_callback(self.on_message)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "vacuum", ".", "register_on_message_callback", "(", "self", ".", "on_message", ")" ]
[ 120, 4 ]
[ 122, 65 ]
python
en
['en', 'no', 'en']
True
IRobotEntity.new_state_filter
(self, new_state)
Filter out wifi state messages.
Filter out wifi state messages.
def new_state_filter(self, new_state): # pylint: disable=no-self-use """Filter out wifi state messages.""" return len(new_state) > 1 or "signal" not in new_state
[ "def", "new_state_filter", "(", "self", ",", "new_state", ")", ":", "# pylint: disable=no-self-use", "return", "len", "(", "new_state", ")", ">", "1", "or", "\"signal\"", "not", "in", "new_state" ]
[ 124, 4 ]
[ 126, 62 ]
python
en
['en', 'en', 'en']
True