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_api_info_error
(hassio_handler, aioclient_mock)
Test setup with API Home Assistant info error.
Test setup with API Home Assistant info error.
async def test_api_info_error(hassio_handler, aioclient_mock): """Test setup with API Home Assistant info error.""" aioclient_mock.get( "http://127.0.0.1/info", json={"result": "error", "message": None} ) with pytest.raises(HassioAPIError): await hassio_handler.get_info() assert ai...
[ "async", "def", "test_api_info_error", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/info\"", ",", "json", "=", "{", "\"result\"", ":", "\"error\"", ",", "\"message\"", ":", "None", "}", ")", "with...
[ 49, 0 ]
[ 58, 41 ]
python
en
['en', 'pt', 'en']
True
test_api_host_info
(hassio_handler, aioclient_mock)
Test setup with API Host info.
Test setup with API Host info.
async def test_api_host_info(hassio_handler, aioclient_mock): """Test setup with API Host info.""" aioclient_mock.get( "http://127.0.0.1/host/info", json={ "result": "ok", "data": { "chassis": "vm", "operating_system": "Debian GNU/Linux 10 ...
[ "async", "def", "test_api_host_info", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/host/info\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\"", ":", "{", "\"chassis\"", ":", ...
[ 61, 0 ]
[ 79, 69 ]
python
en
['en', 'haw', 'en']
True
test_api_supervisor_info
(hassio_handler, aioclient_mock)
Test setup with API Supervisor info.
Test setup with API Supervisor info.
async def test_api_supervisor_info(hassio_handler, aioclient_mock): """Test setup with API Supervisor info.""" aioclient_mock.get( "http://127.0.0.1/supervisor/info", json={ "result": "ok", "data": {"supported": True, "version": "2020.11.1", "channel": "stable"}, ...
[ "async", "def", "test_api_supervisor_info", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/supervisor/info\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\"", ":", "{", "\"supported...
[ 82, 0 ]
[ 96, 38 ]
python
en
['en', 'haw', 'en']
True
test_api_os_info
(hassio_handler, aioclient_mock)
Test setup with API OS info.
Test setup with API OS info.
async def test_api_os_info(hassio_handler, aioclient_mock): """Test setup with API OS info.""" aioclient_mock.get( "http://127.0.0.1/os/info", json={ "result": "ok", "data": {"board": "odroid-n2", "version": "2020.11.1"}, }, ) data = await hassio_handler....
[ "async", "def", "test_api_os_info", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/os/info\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\"", ":", "{", "\"board\"", ":", "\"odr...
[ 99, 0 ]
[ 112, 41 ]
python
en
['en', 'haw', 'en']
True
test_api_host_info_error
(hassio_handler, aioclient_mock)
Test setup with API Home Assistant info error.
Test setup with API Home Assistant info error.
async def test_api_host_info_error(hassio_handler, aioclient_mock): """Test setup with API Home Assistant info error.""" aioclient_mock.get( "http://127.0.0.1/host/info", json={"result": "error", "message": None} ) with pytest.raises(HassioAPIError): await hassio_handler.get_host_info()...
[ "async", "def", "test_api_host_info_error", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/host/info\"", ",", "json", "=", "{", "\"result\"", ":", "\"error\"", ",", "\"message\"", ":", "None", "}", ")...
[ 115, 0 ]
[ 124, 41 ]
python
en
['en', 'pt', 'en']
True
test_api_core_info
(hassio_handler, aioclient_mock)
Test setup with API Home Assistant Core info.
Test setup with API Home Assistant Core info.
async def test_api_core_info(hassio_handler, aioclient_mock): """Test setup with API Home Assistant Core info.""" aioclient_mock.get( "http://127.0.0.1/core/info", json={"result": "ok", "data": {"version_latest": "1.0.0"}}, ) data = await hassio_handler.get_core_info() assert aiocli...
[ "async", "def", "test_api_core_info", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/core/info\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\"", ":", "{", "\"version_latest\"", ...
[ 127, 0 ]
[ 136, 44 ]
python
en
['en', 'haw', 'en']
True
test_api_core_info_error
(hassio_handler, aioclient_mock)
Test setup with API Home Assistant Core info error.
Test setup with API Home Assistant Core info error.
async def test_api_core_info_error(hassio_handler, aioclient_mock): """Test setup with API Home Assistant Core info error.""" aioclient_mock.get( "http://127.0.0.1/core/info", json={"result": "error", "message": None} ) with pytest.raises(HassioAPIError): await hassio_handler.get_core_i...
[ "async", "def", "test_api_core_info_error", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/core/info\"", ",", "json", "=", "{", "\"result\"", ":", "\"error\"", ",", "\"message\"", ":", "None", "}", ")...
[ 139, 0 ]
[ 148, 41 ]
python
en
['en', 'en', 'en']
True
test_api_homeassistant_stop
(hassio_handler, aioclient_mock)
Test setup with API Home Assistant stop.
Test setup with API Home Assistant stop.
async def test_api_homeassistant_stop(hassio_handler, aioclient_mock): """Test setup with API Home Assistant stop.""" aioclient_mock.post("http://127.0.0.1/homeassistant/stop", json={"result": "ok"}) assert await hassio_handler.stop_homeassistant() assert aioclient_mock.call_count == 1
[ "async", "def", "test_api_homeassistant_stop", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "post", "(", "\"http://127.0.0.1/homeassistant/stop\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", "}", ")", "assert", "await", "ha...
[ 151, 0 ]
[ 156, 41 ]
python
en
['en', 'en', 'en']
True
test_api_homeassistant_restart
(hassio_handler, aioclient_mock)
Test setup with API Home Assistant restart.
Test setup with API Home Assistant restart.
async def test_api_homeassistant_restart(hassio_handler, aioclient_mock): """Test setup with API Home Assistant restart.""" aioclient_mock.post("http://127.0.0.1/homeassistant/restart", json={"result": "ok"}) assert await hassio_handler.restart_homeassistant() assert aioclient_mock.call_count == 1
[ "async", "def", "test_api_homeassistant_restart", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "post", "(", "\"http://127.0.0.1/homeassistant/restart\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", "}", ")", "assert", "await",...
[ 159, 0 ]
[ 164, 41 ]
python
en
['en', 'da', 'en']
True
test_api_addon_info
(hassio_handler, aioclient_mock)
Test setup with API Add-on info.
Test setup with API Add-on info.
async def test_api_addon_info(hassio_handler, aioclient_mock): """Test setup with API Add-on info.""" aioclient_mock.get( "http://127.0.0.1/addons/test/info", json={"result": "ok", "data": {"name": "bla"}}, ) data = await hassio_handler.get_addon_info("test") assert data["name"] == ...
[ "async", "def", "test_api_addon_info", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/addons/test/info\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\"", ":", "{", "\"name\"", ":...
[ 167, 0 ]
[ 176, 41 ]
python
en
['en', 'haw', 'en']
True
test_api_discovery_message
(hassio_handler, aioclient_mock)
Test setup with API discovery message.
Test setup with API discovery message.
async def test_api_discovery_message(hassio_handler, aioclient_mock): """Test setup with API discovery message.""" aioclient_mock.get( "http://127.0.0.1/discovery/test", json={"result": "ok", "data": {"service": "mqtt"}}, ) data = await hassio_handler.get_discovery_message("test") a...
[ "async", "def", "test_api_discovery_message", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/discovery/test\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\"", ":", "{", "\"service\...
[ 179, 0 ]
[ 188, 41 ]
python
en
['en', 'haw', 'en']
True
test_api_retrieve_discovery
(hassio_handler, aioclient_mock)
Test setup with API discovery message.
Test setup with API discovery message.
async def test_api_retrieve_discovery(hassio_handler, aioclient_mock): """Test setup with API discovery message.""" aioclient_mock.get( "http://127.0.0.1/discovery", json={"result": "ok", "data": {"discovery": [{"service": "mqtt"}]}}, ) data = await hassio_handler.retrieve_discovery_mes...
[ "async", "def", "test_api_retrieve_discovery", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/discovery\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\"", ":", "{", "\"discovery\""...
[ 191, 0 ]
[ 200, 41 ]
python
en
['en', 'haw', 'en']
True
test_api_ingress_panels
(hassio_handler, aioclient_mock)
Test setup with API Ingress panels.
Test setup with API Ingress panels.
async def test_api_ingress_panels(hassio_handler, aioclient_mock): """Test setup with API Ingress panels.""" aioclient_mock.get( "http://127.0.0.1/ingress/panels", json={ "result": "ok", "data": { "panels": { "slug": { ...
[ "async", "def", "test_api_ingress_panels", "(", "hassio_handler", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/ingress/panels\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\"", ":", "{", "\"panels\"", ...
[ 203, 0 ]
[ 225, 35 ]
python
en
['en', 'zu', 'en']
True
TestFrame.test_snapshot_length
(self)
Test __len__ function result
Test __len__ function result
def test_snapshot_length(self): """Test __len__ function result""" for backend_name in backends_to_test: frm = build_frame(True, total_snapshot=10, backend_name=backend_name) self.assertEqual(0, len(frm.snapshots))
[ "def", "test_snapshot_length", "(", "self", ")", ":", "for", "backend_name", "in", "backends_to_test", ":", "frm", "=", "build_frame", "(", "True", ",", "total_snapshot", "=", "10", ",", "backend_name", "=", "backend_name", ")", "self", ".", "assertEqual", "("...
[ 176, 4 ]
[ 182, 51 ]
python
en
['en', 'no', 'en']
True
TestFrame.test_snapshot_node_length
(self)
Test if node number in snapshot correct
Test if node number in snapshot correct
def test_snapshot_node_length(self): """Test if node number in snapshot correct""" for backend_name in backends_to_test: frm = build_frame(True, backend_name=backend_name) self.assertEqual(STATIC_NODE_NUM, len(frm.snapshots["static"])) self.assertEqual(DYNAMIC_NODE_N...
[ "def", "test_snapshot_node_length", "(", "self", ")", ":", "for", "backend_name", "in", "backends_to_test", ":", "frm", "=", "build_frame", "(", "True", ",", "backend_name", "=", "backend_name", ")", "self", ".", "assertEqual", "(", "STATIC_NODE_NUM", ",", "len"...
[ 184, 4 ]
[ 190, 77 ]
python
en
['en', 'en', 'en']
True
list_python_files_in_repository
()
List all python files in the repository. This function assumes that the script is executed in the root folder.
List all python files in the repository.
def list_python_files_in_repository(): """List all python files in the repository. This function assumes that the script is executed in the root folder. """ source_code_files = [] for path, subdirs, files in os.walk("."): if "templates" in path: continue for name in file...
[ "def", "list_python_files_in_repository", "(", ")", ":", "source_code_files", "=", "[", "]", "for", "path", ",", "subdirs", ",", "files", "in", "os", ".", "walk", "(", "\".\"", ")", ":", "if", "\"templates\"", "in", "path", ":", "continue", "for", "name", ...
[ 33, 0 ]
[ 47, 28 ]
python
en
['en', 'en', 'en']
True
scan_code_for_links
(source)
Scans the file to find links using a regular expression. Returns a list of links.
Scans the file to find links using a regular expression. Returns a list of links.
def scan_code_for_links(source): """Scans the file to find links using a regular expression. Returns a list of links. """ with open(source, "r") as content: content = content.read() raw_links = re.findall(REGEXP_FIND_S3_LINKS, content) links = [prefix + suffix for _, prefix, suff...
[ "def", "scan_code_for_links", "(", "source", ")", ":", "with", "open", "(", "source", ",", "\"r\"", ")", "as", "content", ":", "content", "=", "content", ".", "read", "(", ")", "raw_links", "=", "re", ".", "findall", "(", "REGEXP_FIND_S3_LINKS", ",", "co...
[ 58, 0 ]
[ 67, 16 ]
python
en
['en', 'en', 'en']
True
check_all_links
(links)
Check that the provided links are valid. Links are considered valid if a HEAD request to the server returns a 200 status code.
Check that the provided links are valid.
def check_all_links(links): """Check that the provided links are valid. Links are considered valid if a HEAD request to the server returns a 200 status code. """ broken_links = [] for link in links: head = requests.head(link) if head.status_code != 200: broken_links....
[ "def", "check_all_links", "(", "links", ")", ":", "broken_links", "=", "[", "]", "for", "link", "in", "links", ":", "head", "=", "requests", ".", "head", "(", "link", ")", "if", "head", ".", "status_code", "!=", "200", ":", "broken_links", ".", "append...
[ 70, 0 ]
[ 82, 23 ]
python
en
['en', 'en', 'en']
True
media_player_media_seek_fixture
()
Mock demo YouTube player media seek.
Mock demo YouTube player media seek.
def media_player_media_seek_fixture(): """Mock demo YouTube player media seek.""" with patch( "homeassistant.components.demo.media_player.DemoYoutubePlayer.media_seek", autospec=True, ) as seek: yield seek
[ "def", "media_player_media_seek_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.demo.media_player.DemoYoutubePlayer.media_seek\"", ",", "autospec", "=", "True", ",", ")", "as", "seek", ":", "yield", "seek" ]
[ 22, 0 ]
[ 28, 18 ]
python
en
['es', 'ig', 'en']
False
test_source_select
(hass)
Test the input source service.
Test the input source service.
async def test_source_select(hass): """Test the input source service.""" entity_id = "media_player.lounge_room" assert await async_setup_component( hass, mp.DOMAIN, {"media_player": {"platform": "demo"}} ) await hass.async_block_till_done() state = hass.states.get(entity_id) assert ...
[ "async", "def", "test_source_select", "(", "hass", ")", ":", "entity_id", "=", "\"media_player.lounge_room\"", "assert", "await", "async_setup_component", "(", "hass", ",", "mp", ".", "DOMAIN", ",", "{", "\"media_player\"", ":", "{", "\"platform\"", ":", "\"demo\"...
[ 31, 0 ]
[ 59, 63 ]
python
en
['en', 'en', 'en']
True
test_repeat_set
(hass)
Test the repeat set service.
Test the repeat set service.
async def test_repeat_set(hass): """Test the repeat set service.""" entity_id = "media_player.walkman" assert await async_setup_component( hass, mp.DOMAIN, {"media_player": {"platform": "demo"}} ) await hass.async_block_till_done() state = hass.states.get(entity_id) assert state.att...
[ "async", "def", "test_repeat_set", "(", "hass", ")", ":", "entity_id", "=", "\"media_player.walkman\"", "assert", "await", "async_setup_component", "(", "hass", ",", "mp", ".", "DOMAIN", ",", "{", "\"media_player\"", ":", "{", "\"platform\"", ":", "\"demo\"", "}...
[ 62, 0 ]
[ 80, 81 ]
python
en
['en', 'en', 'en']
True
test_clear_playlist
(hass)
Test clear playlist.
Test clear playlist.
async def test_clear_playlist(hass): """Test clear playlist.""" assert await async_setup_component( hass, mp.DOMAIN, {"media_player": {"platform": "demo"}} ) await hass.async_block_till_done() state = hass.states.get(TEST_ENTITY_ID) assert state.state == STATE_PLAYING await hass.se...
[ "async", "def", "test_clear_playlist", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "mp", ".", "DOMAIN", ",", "{", "\"media_player\"", ":", "{", "\"platform\"", ":", "\"demo\"", "}", "}", ")", "await", "hass", ".", "...
[ 83, 0 ]
[ 100, 35 ]
python
en
['en', 'en', 'en']
True
test_volume_services
(hass)
Test the volume service.
Test the volume service.
async def test_volume_services(hass): """Test the volume service.""" assert await async_setup_component( hass, mp.DOMAIN, {"media_player": {"platform": "demo"}} ) await hass.async_block_till_done() state = hass.states.get(TEST_ENTITY_ID) assert state.attributes.get(mp.ATTR_MEDIA_VOLUME_...
[ "async", "def", "test_volume_services", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "mp", ".", "DOMAIN", ",", "{", "\"media_player\"", ":", "{", "\"platform\"", ":", "\"demo\"", "}", "}", ")", "await", "hass", ".", ...
[ 103, 0 ]
[ 172, 67 ]
python
en
['en', 'en', 'en']
True
test_turning_off_and_on
(hass)
Test turn_on and turn_off.
Test turn_on and turn_off.
async def test_turning_off_and_on(hass): """Test turn_on and turn_off.""" assert await async_setup_component( hass, mp.DOMAIN, {"media_player": {"platform": "demo"}} ) await hass.async_block_till_done() state = hass.states.get(TEST_ENTITY_ID) assert state.state == STATE_PLAYING awa...
[ "async", "def", "test_turning_off_and_on", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "mp", ".", "DOMAIN", ",", "{", "\"media_player\"", ":", "{", "\"platform\"", ":", "\"demo\"", "}", "}", ")", "await", "hass", ".",...
[ 175, 0 ]
[ 213, 45 ]
python
en
['en', 'en', 'en']
True
test_playing_pausing
(hass)
Test media_pause.
Test media_pause.
async def test_playing_pausing(hass): """Test media_pause.""" assert await async_setup_component( hass, mp.DOMAIN, {"media_player": {"platform": "demo"}} ) await hass.async_block_till_done() state = hass.states.get(TEST_ENTITY_ID) assert state.state == STATE_PLAYING await hass.serv...
[ "async", "def", "test_playing_pausing", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "mp", ".", "DOMAIN", ",", "{", "\"media_player\"", ":", "{", "\"platform\"", ":", "\"demo\"", "}", "}", ")", "await", "hass", ".", ...
[ 216, 0 ]
[ 260, 39 ]
python
de
['de', 'et', 'en']
False
test_prev_next_track
(hass)
Test media_next_track and media_previous_track .
Test media_next_track and media_previous_track .
async def test_prev_next_track(hass): """Test media_next_track and media_previous_track .""" assert await async_setup_component( hass, mp.DOMAIN, {"media_player": {"platform": "demo"}} ) await hass.async_block_till_done() state = hass.states.get(TEST_ENTITY_ID) assert state.attributes.g...
[ "async", "def", "test_prev_next_track", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "mp", ".", "DOMAIN", ",", "{", "\"media_player\"", ":", "{", "\"platform\"", ":", "\"demo\"", "}", "}", ")", "await", "hass", ".", ...
[ 263, 0 ]
[ 325, 59 ]
python
en
['en', 'en', 'en']
True
test_play_media
(hass)
Test play_media .
Test play_media .
async def test_play_media(hass): """Test play_media .""" assert await async_setup_component( hass, mp.DOMAIN, {"media_player": {"platform": "demo"}} ) await hass.async_block_till_done() ent_id = "media_player.living_room" state = hass.states.get(ent_id) assert mp.SUPPORT_PLAY_MEDIA ...
[ "async", "def", "test_play_media", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "mp", ".", "DOMAIN", ",", "{", "\"media_player\"", ":", "{", "\"platform\"", ":", "\"demo\"", "}", "}", ")", "await", "hass", ".", "asyn...
[ 328, 0 ]
[ 363, 70 ]
python
en
['en', 'et', 'en']
True
test_media_image_proxy
(hass, hass_client)
Test the media server image proxy server .
Test the media server image proxy server .
async def test_media_image_proxy(hass, hass_client): """Test the media server image proxy server .""" assert await async_setup_component( hass, mp.DOMAIN, {"media_player": {"platform": "demo"}} ) await hass.async_block_till_done() fake_picture_data = "test.test" class MockResponse: ...
[ "async", "def", "test_media_image_proxy", "(", "hass", ",", "hass_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "mp", ".", "DOMAIN", ",", "{", "\"media_player\"", ":", "{", "\"platform\"", ":", "\"demo\"", "}", "}", ")", "a...
[ 402, 0 ]
[ 443, 48 ]
python
en
['en', 'cs', 'en']
True
test_climate
(hass, climate_data, sent_messages, climate_msg, caplog)
Test setting up config entry.
Test setting up config entry.
async def test_climate(hass, climate_data, sent_messages, climate_msg, caplog): """Test setting up config entry.""" receive_message = await setup_ozw(hass, fixture=climate_data) # Test multi-setpoint thermostat (node 7 in dump) # mode is heat, this should be single setpoint state = hass.states.get(...
[ "async", "def", "test_climate", "(", "hass", ",", "climate_data", ",", "sent_messages", ",", "climate_msg", ",", "caplog", ")", ":", "receive_message", "=", "await", "setup_ozw", "(", "hass", ",", "fixture", "=", "climate_data", ")", "# Test multi-setpoint thermos...
[ 22, 0 ]
[ 326, 59 ]
python
en
['en', 'en', 'en']
True
discover_chromecast
(hass: HomeAssistant, info: ChromecastInfo)
Discover a Chromecast.
Discover a Chromecast.
def discover_chromecast(hass: HomeAssistant, info: ChromecastInfo): """Discover a Chromecast.""" if info.uuid is None: _LOGGER.error("Discovered chromecast without uuid %s", info) return if info.uuid in hass.data[KNOWN_CHROMECAST_INFO_KEY]: _LOGGER.debug("Discovered update for known...
[ "def", "discover_chromecast", "(", "hass", ":", "HomeAssistant", ",", "info", ":", "ChromecastInfo", ")", ":", "if", "info", ".", "uuid", "is", "None", ":", "_LOGGER", ".", "error", "(", "\"Discovered chromecast without uuid %s\"", ",", "info", ")", "return", ...
[ 21, 0 ]
[ 33, 55 ]
python
en
['en', 'pt', 'en']
True
setup_internal_discovery
(hass: HomeAssistant)
Set up the pychromecast internal discovery.
Set up the pychromecast internal discovery.
def setup_internal_discovery(hass: HomeAssistant) -> None: """Set up the pychromecast internal discovery.""" if INTERNAL_DISCOVERY_RUNNING_KEY not in hass.data: hass.data[INTERNAL_DISCOVERY_RUNNING_KEY] = threading.Lock() if not hass.data[INTERNAL_DISCOVERY_RUNNING_KEY].acquire(blocking=False): ...
[ "def", "setup_internal_discovery", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "if", "INTERNAL_DISCOVERY_RUNNING_KEY", "not", "in", "hass", ".", "data", ":", "hass", ".", "data", "[", "INTERNAL_DISCOVERY_RUNNING_KEY", "]", "=", "threading", ".", "...
[ 43, 0 ]
[ 120, 66 ]
python
en
['en', 'cs', 'en']
True
MasterAgent.start
(self)
Start agents.
Start agents.
def start(self) -> None: """Start agents.""" pending_job_agent = PendingJobAgent( cluster_name=self.cluster_name, redis_connection=self.redis_connection, check_interval=self.check_interval ) pending_job_agent.start() killed_job_agent = KilledJ...
[ "def", "start", "(", "self", ")", "->", "None", ":", "pending_job_agent", "=", "PendingJobAgent", "(", "cluster_name", "=", "self", ".", "cluster_name", ",", "redis_connection", "=", "self", ".", "redis_connection", ",", "check_interval", "=", "self", ".", "ch...
[ 318, 4 ]
[ 346, 40 ]
python
en
['en', 'de', 'en']
False
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 20, 0 ]
[ 22, 37 ]
python
en
['en', 'fy', 'en']
True
entity_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def entity_reg(hass): """Return an empty, loaded, registry.""" return mock_registry(hass)
[ "def", "entity_reg", "(", "hass", ")", ":", "return", "mock_registry", "(", "hass", ")" ]
[ 26, 0 ]
[ 28, 30 ]
python
en
['en', 'fy', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 32, 0 ]
[ 34, 57 ]
python
en
['en', 'en', 'en']
True
test_get_conditions
(hass, device_reg, entity_reg)
Test we get the expected conditions from a NEW_DOMAIN.
Test we get the expected conditions from a NEW_DOMAIN.
async def test_get_conditions(hass, device_reg, entity_reg): """Test we get the expected conditions from a NEW_DOMAIN.""" config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, ...
[ "async", "def", "test_get_conditions", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "hass", ")",...
[ 37, 0 ]
[ 63, 54 ]
python
en
['en', 'en', 'en']
True
test_if_state
(hass, calls)
Test for turn_on and turn_off conditions.
Test for turn_on and turn_off conditions.
async def test_if_state(hass, calls): """Test for turn_on and turn_off conditions.""" hass.states.async_set("NEW_DOMAIN.entity", STATE_ON) assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: [ { "trigger":...
[ "async", "def", "test_if_state", "(", "hass", ",", "calls", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"NEW_DOMAIN.entity\"", ",", "STATE_ON", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", ...
[ 66, 0 ]
[ 125, 66 ]
python
en
['en', 'en', 'en']
True
train
(args, train_dataset, model, tokenizer, teacher=None)
Train the model
Train the model
def train(args, train_dataset, model, tokenizer, teacher=None): """ Train the model """ if args.local_rank in [-1, 0]: tb_writer = SummaryWriter() args.train_batch_size = args.per_gpu_train_batch_size * max(1, args.n_gpu) train_sampler = RandomSampler(train_dataset) if args.local_rank == -1 els...
[ "def", "train", "(", "args", ",", "train_dataset", ",", "model", ",", "tokenizer", ",", "teacher", "=", "None", ")", ":", "if", "args", ".", "local_rank", "in", "[", "-", "1", ",", "0", "]", ":", "tb_writer", "=", "SummaryWriter", "(", ")", "args", ...
[ 93, 0 ]
[ 312, 45 ]
python
en
['en', 'it', 'en']
True
airsensor_fixture
()
Return a default air quality fixture.
Return a default air quality fixture.
def airsensor_fixture(): """Return a default air quality fixture.""" feature = mock_feature( "air_qualities", blebox_uniapi.air_quality.AirQuality, unique_id="BleBox-airSensor-1afe34db9437-0.air", full_name="airSensor-0.air", device_class=None, pm1=None, p...
[ "def", "airsensor_fixture", "(", ")", ":", "feature", "=", "mock_feature", "(", "\"air_qualities\"", ",", "blebox_uniapi", ".", "air_quality", ".", "AirQuality", ",", "unique_id", "=", "\"BleBox-airSensor-1afe34db9437-0.air\"", ",", "full_name", "=", "\"airSensor-0.air\...
[ 16, 0 ]
[ 31, 51 ]
python
en
['en', 'ca', 'en']
True
test_init
(airsensor, hass, config)
Test airSensor default state.
Test airSensor default state.
async def test_init(airsensor, hass, config): """Test airSensor default state.""" _, entity_id = airsensor entry = await async_setup_entity(hass, config, entity_id) assert entry.unique_id == "BleBox-airSensor-1afe34db9437-0.air" state = hass.states.get(entity_id) assert state.name == "airSenso...
[ "async", "def", "test_init", "(", "airsensor", ",", "hass", ",", "config", ")", ":", "_", ",", "entity_id", "=", "airsensor", "entry", "=", "await", "async_setup_entity", "(", "hass", ",", "config", ",", "entity_id", ")", "assert", "entry", ".", "unique_id...
[ 34, 0 ]
[ 59, 38 ]
python
da
['nl', 'da', 'en']
False
test_update
(airsensor, hass, config)
Test air quality sensor state after update.
Test air quality sensor state after update.
async def test_update(airsensor, hass, config): """Test air quality sensor state after update.""" feature_mock, entity_id = airsensor def initial_update(): feature_mock.pm1 = 49 feature_mock.pm2_5 = 222 feature_mock.pm10 = 333 feature_mock.async_update = AsyncMock(side_effect=...
[ "async", "def", "test_update", "(", "airsensor", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "airsensor", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "pm1", "=", "49", "feature_mock", ".", "pm2_5", "=", "22...
[ 62, 0 ]
[ 81, 31 ]
python
en
['en', 'en', 'en']
True
test_update_failure
(airsensor, hass, config, caplog)
Test that update failures are logged.
Test that update failures are logged.
async def test_update_failure(airsensor, hass, config, caplog): """Test that update failures are logged.""" caplog.set_level(logging.ERROR) feature_mock, entity_id = airsensor feature_mock.async_update = AsyncMock(side_effect=blebox_uniapi.error.ClientError) await async_setup_entity(hass, config, ...
[ "async", "def", "test_update_failure", "(", "airsensor", ",", "hass", ",", "config", ",", "caplog", ")", ":", "caplog", ".", "set_level", "(", "logging", ".", "ERROR", ")", "feature_mock", ",", "entity_id", "=", "airsensor", "feature_mock", ".", "async_update"...
[ 84, 0 ]
[ 93, 73 ]
python
en
['en', 'en', 'en']
True
mock_elk
(invalid_auth=None, sync_complete=None)
Mock m1lib Elk.
Mock m1lib Elk.
def mock_elk(invalid_auth=None, sync_complete=None): """Mock m1lib Elk.""" def handler_callbacks(type_, callback): nonlocal invalid_auth, sync_complete if type_ == "login": if invalid_auth is not None: callback(not invalid_auth) elif type_ == "sync_complete"...
[ "def", "mock_elk", "(", "invalid_auth", "=", "None", ",", "sync_complete", "=", "None", ")", ":", "def", "handler_callbacks", "(", "type_", ",", "callback", ")", ":", "nonlocal", "invalid_auth", ",", "sync_complete", "if", "type_", "==", "\"login\"", ":", "i...
[ 8, 0 ]
[ 23, 21 ]
python
hu
['hu', 'ms', 'ur']
False
test_form_user_with_secure_elk
(hass)
Test we can setup a secure elk.
Test we can setup a secure elk.
async def test_form_user_with_secure_elk(hass): """Test we can setup a secure elk.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "...
[ "async", "def", "test_form_user_with_secure_elk", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".",...
[ 26, 0 ]
[ 70, 48 ]
python
en
['en', 'da', 'en']
True
test_form_user_with_non_secure_elk
(hass)
Test we can setup a non-secure elk.
Test we can setup a non-secure elk.
async def test_form_user_with_non_secure_elk(hass): """Test we can setup a non-secure elk.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["typ...
[ "async", "def", "test_form_user_with_non_secure_elk", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ...
[ 73, 0 ]
[ 115, 48 ]
python
en
['en', 'en', 'en']
True
test_form_user_with_serial_elk
(hass)
Test we can setup a serial elk.
Test we can setup a serial elk.
async def test_form_user_with_serial_elk(hass): """Test we can setup a serial elk.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "...
[ "async", "def", "test_form_user_with_serial_elk", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".",...
[ 118, 0 ]
[ 160, 48 ]
python
en
['en', 'da', 'en']
True
test_form_cannot_connect
(hass)
Test we handle cannot connect error.
Test we handle cannot connect error.
async def test_form_cannot_connect(hass): """Test we handle cannot connect error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) mocked_elk = mock_elk(invalid_auth=None, sync_complete=None) with patch( "homeassistant....
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", "...
[ 163, 0 ]
[ 191, 58 ]
python
en
['en', 'en', 'en']
True
test_form_invalid_auth
(hass)
Test we handle invalid auth error.
Test we handle invalid auth error.
async def test_form_invalid_auth(hass): """Test we handle invalid auth error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) mocked_elk = mock_elk(invalid_auth=True, sync_complete=True) with patch( "homeassistant.comp...
[ "async", "def", "test_form_invalid_auth", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")"...
[ 194, 0 ]
[ 219, 56 ]
python
de
['de', 'et', 'en']
False
test_form_import
(hass)
Test we get the form with import source.
Test we get the form with import source.
async def test_form_import(hass): """Test we get the form with import source.""" await setup.async_setup_component(hass, "persistent_notification", {}) mocked_elk = mock_elk(invalid_auth=False, sync_complete=True) with patch( "homeassistant.components.elkm1.config_flow.elkm1.Elk", retur...
[ "async", "def", "test_form_import", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "mocked_elk", "=", "mock_elk", "(", "invalid_auth", "=", "False", ",", "sync_complete"...
[ 222, 0 ]
[ 288, 48 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Home Connect switch.
Set up the Home Connect switch.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Home Connect switch.""" def get_entities(): """Get a list of entities.""" entities = [] hc_api = hass.data[DOMAIN][config_entry.entry_id] for device_dict in hc_api.devices: entity_dict...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "def", "get_entities", "(", ")", ":", "\"\"\"Get a list of entities.\"\"\"", "entities", "=", "[", "]", "hc_api", "=", "hass", ".", "data", "[", "DOMAIN",...
[ 19, 0 ]
[ 33, 77 ]
python
en
['en', 'en', 'en']
True
HomeConnectProgramSwitch.__init__
(self, device, program_name)
Initialize the entity.
Initialize the entity.
def __init__(self, device, program_name): """Initialize the entity.""" desc = " ".join(["Program", program_name.split(".")[-1]]) super().__init__(device, desc) self.program_name = program_name self._state = None self._remote_allowed = None
[ "def", "__init__", "(", "self", ",", "device", ",", "program_name", ")", ":", "desc", "=", "\" \"", ".", "join", "(", "[", "\"Program\"", ",", "program_name", ".", "split", "(", "\".\"", ")", "[", "-", "1", "]", "]", ")", "super", "(", ")", ".", ...
[ 39, 4 ]
[ 45, 35 ]
python
en
['en', 'en', 'en']
True
HomeConnectProgramSwitch.is_on
(self)
Return true if the switch is on.
Return true if the switch is on.
def is_on(self): """Return true if the switch is on.""" return bool(self._state)
[ "def", "is_on", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "_state", ")" ]
[ 48, 4 ]
[ 50, 32 ]
python
en
['en', 'en', 'en']
True
HomeConnectProgramSwitch.available
(self)
Return true if the entity is available.
Return true if the entity is available.
def available(self): """Return true if the entity is available.""" return True
[ "def", "available", "(", "self", ")", ":", "return", "True" ]
[ 53, 4 ]
[ 55, 19 ]
python
en
['en', 'en', 'en']
True
HomeConnectProgramSwitch.async_turn_on
(self, **kwargs)
Start the program.
Start the program.
async def async_turn_on(self, **kwargs): """Start the program.""" _LOGGER.debug("Tried to turn on program %s", self.program_name) try: await self.hass.async_add_executor_job( self.device.appliance.start_program, self.program_name ) except HomeConne...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "_LOGGER", ".", "debug", "(", "\"Tried to turn on program %s\"", ",", "self", ".", "program_name", ")", "try", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", ...
[ 57, 4 ]
[ 66, 34 ]
python
en
['en', 'no', 'en']
True
HomeConnectProgramSwitch.async_turn_off
(self, **kwargs)
Stop the program.
Stop the program.
async def async_turn_off(self, **kwargs): """Stop the program.""" _LOGGER.debug("Tried to stop program %s", self.program_name) try: await self.hass.async_add_executor_job(self.device.appliance.stop_program) except HomeConnectError as err: _LOGGER.error("Error whil...
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "_LOGGER", ".", "debug", "(", "\"Tried to stop program %s\"", ",", "self", ".", "program_name", ")", "try", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(...
[ 68, 4 ]
[ 75, 34 ]
python
en
['en', 'sr', 'en']
True
HomeConnectProgramSwitch.async_update
(self)
Update the switch's status.
Update the switch's status.
async def async_update(self): """Update the switch's status.""" state = self.device.appliance.status.get(BSH_ACTIVE_PROGRAM, {}) if state.get("value") == self.program_name: self._state = True else: self._state = False _LOGGER.debug("Updated, new state: %s"...
[ "async", "def", "async_update", "(", "self", ")", ":", "state", "=", "self", ".", "device", ".", "appliance", ".", "status", ".", "get", "(", "BSH_ACTIVE_PROGRAM", ",", "{", "}", ")", "if", "state", ".", "get", "(", "\"value\"", ")", "==", "self", "....
[ 77, 4 ]
[ 84, 60 ]
python
en
['en', 'en', 'en']
True
HomeConnectPowerSwitch.__init__
(self, device)
Inititialize the entity.
Inititialize the entity.
def __init__(self, device): """Inititialize the entity.""" super().__init__(device, "Power") self._state = None
[ "def", "__init__", "(", "self", ",", "device", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ",", "\"Power\"", ")", "self", ".", "_state", "=", "None" ]
[ 90, 4 ]
[ 93, 26 ]
python
en
['en', 'en', 'en']
True
HomeConnectPowerSwitch.is_on
(self)
Return true if the switch is on.
Return true if the switch is on.
def is_on(self): """Return true if the switch is on.""" return bool(self._state)
[ "def", "is_on", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "_state", ")" ]
[ 96, 4 ]
[ 98, 32 ]
python
en
['en', 'en', 'en']
True
HomeConnectPowerSwitch.async_turn_on
(self, **kwargs)
Switch the device on.
Switch the device on.
async def async_turn_on(self, **kwargs): """Switch the device on.""" _LOGGER.debug("Tried to switch on %s", self.name) try: await self.hass.async_add_executor_job( self.device.appliance.set_setting, BSH_POWER_STATE, BSH_POWER_ON, ...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "_LOGGER", ".", "debug", "(", "\"Tried to switch on %s\"", ",", "self", ".", "name", ")", "try", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self",...
[ 100, 4 ]
[ 112, 34 ]
python
en
['en', 'en', 'en']
True
HomeConnectPowerSwitch.async_turn_off
(self, **kwargs)
Switch the device off.
Switch the device off.
async def async_turn_off(self, **kwargs): """Switch the device off.""" _LOGGER.debug("tried to switch off %s", self.name) try: await self.hass.async_add_executor_job( self.device.appliance.set_setting, BSH_POWER_STATE, self.device.power...
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "_LOGGER", ".", "debug", "(", "\"tried to switch off %s\"", ",", "self", ".", "name", ")", "try", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self...
[ 114, 4 ]
[ 126, 34 ]
python
en
['en', 'en', 'en']
True
HomeConnectPowerSwitch.async_update
(self)
Update the switch's status.
Update the switch's status.
async def async_update(self): """Update the switch's status.""" if ( self.device.appliance.status.get(BSH_POWER_STATE, {}).get("value") == BSH_POWER_ON ): self._state = True elif ( self.device.appliance.status.get(BSH_POWER_STATE, {}).get("...
[ "async", "def", "async_update", "(", "self", ")", ":", "if", "(", "self", ".", "device", ".", "appliance", ".", "status", ".", "get", "(", "BSH_POWER_STATE", ",", "{", "}", ")", ".", "get", "(", "\"value\"", ")", "==", "BSH_POWER_ON", ")", ":", "self...
[ 128, 4 ]
[ 159, 60 ]
python
en
['en', 'en', 'en']
True
test_binary_sensor
( hass: HomeAssistant, component_factory: ComponentFactory )
Test binary sensor.
Test binary sensor.
async def test_binary_sensor( hass: HomeAssistant, component_factory: ComponentFactory ) -> None: """Test binary sensor.""" in_bed_attribute = WITHINGS_MEASUREMENTS_MAP[Measurement.IN_BED] person0 = new_profile_config("person0", 0) person1 = new_profile_config("person1", 1) entity_registry: Ent...
[ "async", "def", "test_binary_sensor", "(", "hass", ":", "HomeAssistant", ",", "component_factory", ":", "ComponentFactory", ")", "->", "None", ":", "in_bed_attribute", "=", "WITHINGS_MEASUREMENTS_MAP", "[", "Measurement", ".", "IN_BED", "]", "person0", "=", "new_pro...
[ 15, 0 ]
[ 63, 43 ]
python
en
['en', 'bs', 'en']
True
DataPipeline.download
(self, is_force: bool, fall_back: callable = None)
Download the original data file. Args: is_force(bool): If forced re-download the data file. fall_back(callable): (optional) Fallback function to execute when download failed.
Download the original data file.
def download(self, is_force: bool, fall_back: callable = None): """Download the original data file. Args: is_force(bool): If forced re-download the data file. fall_back(callable): (optional) Fallback function to execute when download failed. """ self._new_folder_...
[ "def", "download", "(", "self", ",", "is_force", ":", "bool", ",", "fall_back", ":", "callable", "=", "None", ")", ":", "self", ".", "_new_folder_list", ".", "append", "(", "self", ".", "_download_folder", ")", "os", ".", "makedirs", "(", "self", ".", ...
[ 75, 4 ]
[ 99, 75 ]
python
en
['en', 'id', 'en']
True
DataPipeline.clean
(self)
Clean the original data file.
Clean the original data file.
def clean(self): """Clean the original data file.""" self._new_folder_list.append(self._clean_folder) os.makedirs(self._clean_folder, exist_ok=True) self._new_folder_list.append(self._build_folder) os.makedirs(self._build_folder, exist_ok=True)
[ "def", "clean", "(", "self", ")", ":", "self", ".", "_new_folder_list", ".", "append", "(", "self", ".", "_clean_folder", ")", "os", ".", "makedirs", "(", "self", ".", "_clean_folder", ",", "exist_ok", "=", "True", ")", "self", ".", "_new_folder_list", "...
[ 101, 4 ]
[ 106, 54 ]
python
en
['en', 'co', 'en']
True
DataPipeline.build
(self)
Build the cleaned data file to binary data file.
Build the cleaned data file to binary data file.
def build(self): """Build the cleaned data file to binary data file.""" self._new_file_list.append(self._build_file) if os.path.exists(self._clean_file): logger.info_green(f"Building binary data from {self._clean_file} to {self._build_file}.") convert(meta=self._build_met...
[ "def", "build", "(", "self", ")", ":", "self", ".", "_new_file_list", ".", "append", "(", "self", ".", "_build_file", ")", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "_clean_file", ")", ":", "logger", ".", "info_green", "(", "f\"Building...
[ 108, 4 ]
[ 115, 81 ]
python
en
['en', 'en', 'en']
True
DataPipeline.remove_file
(self)
Remove the temporary files.
Remove the temporary files.
def remove_file(self): """Remove the temporary files.""" for new_file in self._new_file_list: if os.path.exists(new_file): os.remove(new_file) self._new_file_list.clear()
[ "def", "remove_file", "(", "self", ")", ":", "for", "new_file", "in", "self", ".", "_new_file_list", ":", "if", "os", ".", "path", ".", "exists", "(", "new_file", ")", ":", "os", ".", "remove", "(", "new_file", ")", "self", ".", "_new_file_list", ".", ...
[ 117, 4 ]
[ 122, 35 ]
python
en
['en', 'en', 'en']
True
DataPipeline.remove_folder
(self)
Remove the temporary folders.
Remove the temporary folders.
def remove_folder(self): """Remove the temporary folders.""" for new_folder in self._new_folder_list: if os.path.exists(new_folder): shutil.rmtree(new_folder) self._new_folder_list.clear()
[ "def", "remove_folder", "(", "self", ")", ":", "for", "new_folder", "in", "self", ".", "_new_folder_list", ":", "if", "os", ".", "path", ".", "exists", "(", "new_folder", ")", ":", "shutil", ".", "rmtree", "(", "new_folder", ")", "self", ".", "_new_folde...
[ 124, 4 ]
[ 129, 37 ]
python
en
['en', 'en', 'en']
True
DataTopology.get_build_folders
(self)
Get the build file folders of all data pipelines for the topology. Returns: dict: Dictionary of build folders, keys are data pipeline names, values are paths of the build folders.
Get the build file folders of all data pipelines for the topology.
def get_build_folders(self) -> dict: """Get the build file folders of all data pipelines for the topology. Returns: dict: Dictionary of build folders, keys are data pipeline names, values are paths of the build folders. """ ret = {} for pipeline in se...
[ "def", "get_build_folders", "(", "self", ")", "->", "dict", ":", "ret", "=", "{", "}", "for", "pipeline", "in", "self", ".", "_data_pipeline", ":", "ret", "[", "pipeline", "]", "=", "self", ".", "_data_pipeline", "[", "pipeline", "]", ".", "build_folder"...
[ 138, 4 ]
[ 148, 18 ]
python
en
['en', 'en', 'en']
True
DataTopology.download
(self, is_force: bool = False)
Download the original data files of all data pipelines. Args: is_force(bool): If forced re-download the data file.
Download the original data files of all data pipelines.
def download(self, is_force: bool = False): """Download the original data files of all data pipelines. Args: is_force(bool): If forced re-download the data file. """ for pipeline in self._data_pipeline: self._data_pipeline[pipeline].download(is_force)
[ "def", "download", "(", "self", ",", "is_force", ":", "bool", "=", "False", ")", ":", "for", "pipeline", "in", "self", ".", "_data_pipeline", ":", "self", ".", "_data_pipeline", "[", "pipeline", "]", ".", "download", "(", "is_force", ")" ]
[ 150, 4 ]
[ 157, 60 ]
python
en
['en', 'en', 'en']
True
DataTopology.clean
(self)
Clean the original data files of all data pipelines.
Clean the original data files of all data pipelines.
def clean(self): """Clean the original data files of all data pipelines.""" for pipeline in self._data_pipeline: self._data_pipeline[pipeline].clean()
[ "def", "clean", "(", "self", ")", ":", "for", "pipeline", "in", "self", ".", "_data_pipeline", ":", "self", ".", "_data_pipeline", "[", "pipeline", "]", ".", "clean", "(", ")" ]
[ 159, 4 ]
[ 162, 49 ]
python
en
['en', 'en', 'en']
True
DataTopology.build
(self)
Build the cleaned data files of all data pipelines to binary data file.
Build the cleaned data files of all data pipelines to binary data file.
def build(self): """Build the cleaned data files of all data pipelines to binary data file.""" for pipeline in self._data_pipeline: self._data_pipeline[pipeline].build()
[ "def", "build", "(", "self", ")", ":", "for", "pipeline", "in", "self", ".", "_data_pipeline", ":", "self", ".", "_data_pipeline", "[", "pipeline", "]", ".", "build", "(", ")" ]
[ 164, 4 ]
[ 167, 49 ]
python
en
['en', 'en', 'en']
True
DataTopology.remove
(self)
Remove the temporary files and folders of all data pipelines.
Remove the temporary files and folders of all data pipelines.
def remove(self): """Remove the temporary files and folders of all data pipelines.""" for pipeline in self._data_pipeline: self._data_pipeline[pipeline].remove_file() for pipeline in self._data_pipeline: self._data_pipeline[pipeline].remove_folder()
[ "def", "remove", "(", "self", ")", ":", "for", "pipeline", "in", "self", ".", "_data_pipeline", ":", "self", ".", "_data_pipeline", "[", "pipeline", "]", ".", "remove_file", "(", ")", "for", "pipeline", "in", "self", ".", "_data_pipeline", ":", "self", "...
[ 169, 4 ]
[ 174, 57 ]
python
en
['en', 'en', 'en']
True
get_engine
(hass, config, discovery_info=None)
Set up Amazon Polly speech component.
Set up Amazon Polly speech component.
def get_engine(hass, config, discovery_info=None): """Set up Amazon Polly speech component.""" output_format = config[CONF_OUTPUT_FORMAT] sample_rate = config.get(CONF_SAMPLE_RATE, DEFAULT_SAMPLE_RATES[output_format]) if sample_rate not in SUPPORTED_SAMPLE_RATES_MAP.get(output_format): _LOGGER.e...
[ "def", "get_engine", "(", "hass", ",", "config", ",", "discovery_info", "=", "None", ")", ":", "output_format", "=", "config", "[", "CONF_OUTPUT_FORMAT", "]", "sample_rate", "=", "config", ".", "get", "(", "CONF_SAMPLE_RATE", ",", "DEFAULT_SAMPLE_RATES", "[", ...
[ 148, 0 ]
[ 188, 85 ]
python
en
['en', 'en', 'en']
True
AmazonPollyProvider.__init__
(self, polly_client, config, supported_languages, all_voices)
Initialize Amazon Polly provider for TTS.
Initialize Amazon Polly provider for TTS.
def __init__(self, polly_client, config, supported_languages, all_voices): """Initialize Amazon Polly provider for TTS.""" self.client = polly_client self.config = config self.supported_langs = supported_languages self.all_voices = all_voices self.default_voice = self.con...
[ "def", "__init__", "(", "self", ",", "polly_client", ",", "config", ",", "supported_languages", ",", "all_voices", ")", ":", "self", ".", "client", "=", "polly_client", "self", ".", "config", "=", "config", "self", ".", "supported_langs", "=", "supported_langu...
[ 194, 4 ]
[ 201, 34 ]
python
en
['en', 'en', 'en']
True
AmazonPollyProvider.supported_languages
(self)
Return a list of supported languages.
Return a list of supported languages.
def supported_languages(self): """Return a list of supported languages.""" return self.supported_langs
[ "def", "supported_languages", "(", "self", ")", ":", "return", "self", ".", "supported_langs" ]
[ 204, 4 ]
[ 206, 35 ]
python
en
['en', 'en', 'en']
True
AmazonPollyProvider.default_language
(self)
Return the default language.
Return the default language.
def default_language(self): """Return the default language.""" return self.all_voices.get(self.default_voice).get("LanguageCode")
[ "def", "default_language", "(", "self", ")", ":", "return", "self", ".", "all_voices", ".", "get", "(", "self", ".", "default_voice", ")", ".", "get", "(", "\"LanguageCode\"", ")" ]
[ 209, 4 ]
[ 211, 74 ]
python
en
['en', 'et', 'en']
True
AmazonPollyProvider.default_options
(self)
Return dict include default options.
Return dict include default options.
def default_options(self): """Return dict include default options.""" return {CONF_VOICE: self.default_voice}
[ "def", "default_options", "(", "self", ")", ":", "return", "{", "CONF_VOICE", ":", "self", ".", "default_voice", "}" ]
[ 214, 4 ]
[ 216, 47 ]
python
en
['nl', 'en', 'en']
True
AmazonPollyProvider.supported_options
(self)
Return a list of supported options.
Return a list of supported options.
def supported_options(self): """Return a list of supported options.""" return [CONF_VOICE]
[ "def", "supported_options", "(", "self", ")", ":", "return", "[", "CONF_VOICE", "]" ]
[ 219, 4 ]
[ 221, 27 ]
python
en
['en', 'en', 'en']
True
AmazonPollyProvider.get_tts_audio
(self, message, language=None, options=None)
Request TTS file from Polly.
Request TTS file from Polly.
def get_tts_audio(self, message, language=None, options=None): """Request TTS file from Polly.""" voice_id = options.get(CONF_VOICE, self.default_voice) voice_in_dict = self.all_voices.get(voice_id) if language != voice_in_dict.get("LanguageCode"): _LOGGER.error("%s does not ...
[ "def", "get_tts_audio", "(", "self", ",", "message", ",", "language", "=", "None", ",", "options", "=", "None", ")", ":", "voice_id", "=", "options", ".", "get", "(", "CONF_VOICE", ",", "self", ".", "default_voice", ")", "voice_in_dict", "=", "self", "."...
[ 223, 4 ]
[ 243, 9 ]
python
en
['en', 'en', 'en']
True
is_alarm_code_necessary
(value)
Check if alarm code must be configured.
Check if alarm code must be configured.
def is_alarm_code_necessary(value): """Check if alarm code must be configured.""" if value.get(CONF_SWITCHABLE_OUTPUTS) and CONF_DEVICE_CODE not in value: raise vol.Invalid("You need to specify alarm code to use switchable_outputs") return value
[ "def", "is_alarm_code_necessary", "(", "value", ")", ":", "if", "value", ".", "get", "(", "CONF_SWITCHABLE_OUTPUTS", ")", "and", "CONF_DEVICE_CODE", "not", "in", "value", ":", "raise", "vol", ".", "Invalid", "(", "\"You need to specify alarm code to use switchable_out...
[ 61, 0 ]
[ 66, 16 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the Satel Integra component.
Set up the Satel Integra component.
async def async_setup(hass, config): """Set up the Satel Integra component.""" conf = config.get(DOMAIN) zones = conf.get(CONF_ZONES) outputs = conf.get(CONF_OUTPUTS) switchable_outputs = conf.get(CONF_SWITCHABLE_OUTPUTS) host = conf.get(CONF_HOST) port = conf.get(CONF_PORT) partitions ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", ".", "get", "(", "DOMAIN", ")", "zones", "=", "conf", ".", "get", "(", "CONF_ZONES", ")", "outputs", "=", "conf", ".", "get", "(", "CONF_OUTPUTS", ")", "switc...
[ 92, 0 ]
[ 178, 15 ]
python
en
['en', 'en', 'en']
True
test_manually_configured_platform
(hass)
Test that we do not set up an access point.
Test that we do not set up an access point.
async def test_manually_configured_platform(hass): """Test that we do not set up an access point.""" assert await async_setup_component( hass, SENSOR_DOMAIN, {SENSOR_DOMAIN: {"platform": HMIPC_DOMAIN}} ) assert not hass.data.get(HMIPC_DOMAIN)
[ "async", "def", "test_manually_configured_platform", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "SENSOR_DOMAIN", ",", "{", "SENSOR_DOMAIN", ":", "{", "\"platform\"", ":", "HMIPC_DOMAIN", "}", "}", ")", "assert", "not", "...
[ 38, 0 ]
[ 43, 42 ]
python
en
['en', 'en', 'en']
True
test_hmip_accesspoint_status
(hass, default_mock_hap_factory)
Test HomematicipSwitch.
Test HomematicipSwitch.
async def test_hmip_accesspoint_status(hass, default_mock_hap_factory): """Test HomematicipSwitch.""" entity_id = "sensor.home_control_access_point_duty_cycle" entity_name = "HOME_CONTROL_ACCESS_POINT Duty Cycle" device_model = "HmIP-HAP" mock_hap = await default_mock_hap_factory.async_get_mock_hap(...
[ "async", "def", "test_hmip_accesspoint_status", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.home_control_access_point_duty_cycle\"", "entity_name", "=", "\"HOME_CONTROL_ACCESS_POINT Duty Cycle\"", "device_model", "=", "\"HmIP-HAP\"", "mock_...
[ 46, 0 ]
[ 60, 70 ]
python
en
['en', 'en', 'en']
False
test_hmip_heating_thermostat
(hass, default_mock_hap_factory)
Test HomematicipHeatingThermostat.
Test HomematicipHeatingThermostat.
async def test_hmip_heating_thermostat(hass, default_mock_hap_factory): """Test HomematicipHeatingThermostat.""" entity_id = "sensor.heizkorperthermostat_heating" entity_name = "Heizkörperthermostat Heating" device_model = "HMIP-eTRV" mock_hap = await default_mock_hap_factory.async_get_mock_hap( ...
[ "async", "def", "test_hmip_heating_thermostat", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.heizkorperthermostat_heating\"", "entity_name", "=", "\"Heizkörperthermostat Heating\"", "device_model", "=", "\"HMIP-eTRV\"", "mock_hap", "=", ...
[ 63, 0 ]
[ 94, 63 ]
python
en
['en', 'zh', 'en']
False
test_hmip_humidity_sensor
(hass, default_mock_hap_factory)
Test HomematicipHumiditySensor.
Test HomematicipHumiditySensor.
async def test_hmip_humidity_sensor(hass, default_mock_hap_factory): """Test HomematicipHumiditySensor.""" entity_id = "sensor.bwth_1_humidity" entity_name = "BWTH 1 Humidity" device_model = "HmIP-BWTH" mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_devices=["BWTH 1"] ...
[ "async", "def", "test_hmip_humidity_sensor", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.bwth_1_humidity\"", "entity_name", "=", "\"BWTH 1 Humidity\"", "device_model", "=", "\"HmIP-BWTH\"", "mock_hap", "=", "await", "default_mock_hap_...
[ 97, 0 ]
[ 117, 53 ]
python
es
['es', 'xh', 'hi']
False
test_hmip_temperature_sensor1
(hass, default_mock_hap_factory)
Test HomematicipTemperatureSensor.
Test HomematicipTemperatureSensor.
async def test_hmip_temperature_sensor1(hass, default_mock_hap_factory): """Test HomematicipTemperatureSensor.""" entity_id = "sensor.bwth_1_temperature" entity_name = "BWTH 1 Temperature" device_model = "HmIP-BWTH" mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_devices=[...
[ "async", "def", "test_hmip_temperature_sensor1", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.bwth_1_temperature\"", "entity_name", "=", "\"BWTH 1 Temperature\"", "device_model", "=", "\"HmIP-BWTH\"", "mock_hap", "=", "await", "default...
[ 120, 0 ]
[ 142, 61 ]
python
es
['es', 'ro', 'it']
False
test_hmip_temperature_sensor2
(hass, default_mock_hap_factory)
Test HomematicipTemperatureSensor.
Test HomematicipTemperatureSensor.
async def test_hmip_temperature_sensor2(hass, default_mock_hap_factory): """Test HomematicipTemperatureSensor.""" entity_id = "sensor.heizkorperthermostat_temperature" entity_name = "Heizkörperthermostat Temperature" device_model = "HMIP-eTRV" mock_hap = await default_mock_hap_factory.async_get_mock...
[ "async", "def", "test_hmip_temperature_sensor2", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.heizkorperthermostat_temperature\"", "entity_name", "=", "\"Heizkörperthermostat Temperature\"", "device_model", "=", "\"HMIP-eTRV\"", "mock_hap", ...
[ 145, 0 ]
[ 167, 61 ]
python
es
['es', 'ro', 'it']
False
test_hmip_temperature_sensor3
(hass, default_mock_hap_factory)
Test HomematicipTemperatureSensor.
Test HomematicipTemperatureSensor.
async def test_hmip_temperature_sensor3(hass, default_mock_hap_factory): """Test HomematicipTemperatureSensor.""" entity_id = "sensor.raumbediengerat_analog_temperature" entity_name = "Raumbediengerät Analog Temperature" device_model = "ALPHA-IP-RBGa" mock_hap = await default_mock_hap_factory.async_...
[ "async", "def", "test_hmip_temperature_sensor3", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.raumbediengerat_analog_temperature\"", "entity_name", "=", "\"Raumbediengerät Analog Temperature\"", "device_model", "=", "\"ALPHA-IP-RBGa\"", "moc...
[ 170, 0 ]
[ 192, 61 ]
python
es
['es', 'ro', 'it']
False
test_hmip_power_sensor
(hass, default_mock_hap_factory)
Test HomematicipPowerSensor.
Test HomematicipPowerSensor.
async def test_hmip_power_sensor(hass, default_mock_hap_factory): """Test HomematicipPowerSensor.""" entity_id = "sensor.flur_oben_power" entity_name = "Flur oben Power" device_model = "HmIP-BSM" mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_devices=["Flur oben"] ) ...
[ "async", "def", "test_hmip_power_sensor", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.flur_oben_power\"", "entity_name", "=", "\"Flur oben Power\"", "device_model", "=", "\"HmIP-BSM\"", "mock_hap", "=", "await", "default_mock_hap_fact...
[ 195, 0 ]
[ 229, 51 ]
python
en
['es', 'lb', 'en']
False
test_hmip_illuminance_sensor1
(hass, default_mock_hap_factory)
Test HomematicipIlluminanceSensor.
Test HomematicipIlluminanceSensor.
async def test_hmip_illuminance_sensor1(hass, default_mock_hap_factory): """Test HomematicipIlluminanceSensor.""" entity_id = "sensor.wettersensor_illuminance" entity_name = "Wettersensor Illuminance" device_model = "HmIP-SWO-B" mock_hap = await default_mock_hap_factory.async_get_mock_hap( t...
[ "async", "def", "test_hmip_illuminance_sensor1", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.wettersensor_illuminance\"", "entity_name", "=", "\"Wettersensor Illuminance\"", "device_model", "=", "\"HmIP-SWO-B\"", "mock_hap", "=", "await...
[ 232, 0 ]
[ 249, 34 ]
python
it
['it', 'lb', 'it']
False
test_hmip_illuminance_sensor2
(hass, default_mock_hap_factory)
Test HomematicipIlluminanceSensor.
Test HomematicipIlluminanceSensor.
async def test_hmip_illuminance_sensor2(hass, default_mock_hap_factory): """Test HomematicipIlluminanceSensor.""" entity_id = "sensor.lichtsensor_nord_illuminance" entity_name = "Lichtsensor Nord Illuminance" device_model = "HmIP-SLO" mock_hap = await default_mock_hap_factory.async_get_mock_hap( ...
[ "async", "def", "test_hmip_illuminance_sensor2", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.lichtsensor_nord_illuminance\"", "entity_name", "=", "\"Lichtsensor Nord Illuminance\"", "device_model", "=", "\"HmIP-SLO\"", "mock_hap", "=", ...
[ 252, 0 ]
[ 272, 65 ]
python
it
['it', 'lb', 'it']
False
test_hmip_windspeed_sensor
(hass, default_mock_hap_factory)
Test HomematicipWindspeedSensor.
Test HomematicipWindspeedSensor.
async def test_hmip_windspeed_sensor(hass, default_mock_hap_factory): """Test HomematicipWindspeedSensor.""" entity_id = "sensor.wettersensor_pro_windspeed" entity_name = "Wettersensor - pro Windspeed" device_model = "HmIP-SWO-PR" mock_hap = await default_mock_hap_factory.async_get_mock_hap( ...
[ "async", "def", "test_hmip_windspeed_sensor", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.wettersensor_pro_windspeed\"", "entity_name", "=", "\"Wettersensor - pro Windspeed\"", "device_model", "=", "\"HmIP-SWO-PR\"", "mock_hap", "=", "a...
[ 275, 0 ]
[ 319, 62 ]
python
en
['es', 'lb', 'en']
False
test_hmip_today_rain_sensor
(hass, default_mock_hap_factory)
Test HomematicipTodayRainSensor.
Test HomematicipTodayRainSensor.
async def test_hmip_today_rain_sensor(hass, default_mock_hap_factory): """Test HomematicipTodayRainSensor.""" entity_id = "sensor.weather_sensor_plus_today_rain" entity_name = "Weather Sensor – plus Today Rain" device_model = "HmIP-SWO-PL" mock_hap = await default_mock_hap_factory.async_get_mock_hap...
[ "async", "def", "test_hmip_today_rain_sensor", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.weather_sensor_plus_today_rain\"", "entity_name", "=", "\"Weather Sensor – plus Today Rain\"", "device_model", "=", "\"HmIP-SWO-PL\"", "mock_hap", ...
[ 322, 0 ]
[ 339, 35 ]
python
en
['es', 'ky', 'en']
False
test_hmip_passage_detector_delta_counter
(hass, default_mock_hap_factory)
Test HomematicipPassageDetectorDeltaCounter.
Test HomematicipPassageDetectorDeltaCounter.
async def test_hmip_passage_detector_delta_counter(hass, default_mock_hap_factory): """Test HomematicipPassageDetectorDeltaCounter.""" entity_id = "sensor.spdr_1" entity_name = "SPDR_1" device_model = "HmIP-SPDR" mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_devices=[ent...
[ "async", "def", "test_hmip_passage_detector_delta_counter", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"sensor.spdr_1\"", "entity_name", "=", "\"SPDR_1\"", "device_model", "=", "\"HmIP-SPDR\"", "mock_hap", "=", "await", "default_mock_hap_fac...
[ 342, 0 ]
[ 360, 34 ]
python
en
['en', 'lb', 'en']
False
test_config_yaml_host_not_imported
(hass)
Test that we don't import a configured host.
Test that we don't import a configured host.
async def test_config_yaml_host_not_imported(hass): """Test that we don't import a configured host.""" MockConfigEntry(domain="tradfri", data={"host": "mock-host"}).add_to_hass(hass) with patch( "homeassistant.components.tradfri.load_json", return_value={} ), patch.object(hass.config_entries.fl...
[ "async", "def", "test_config_yaml_host_not_imported", "(", "hass", ")", ":", "MockConfigEntry", "(", "domain", "=", "\"tradfri\"", ",", "data", "=", "{", "\"host\"", ":", "\"mock-host\"", "}", ")", ".", "add_to_hass", "(", "hass", ")", "with", "patch", "(", ...
[ 12, 0 ]
[ 24, 41 ]
python
en
['en', 'en', 'en']
True
test_config_yaml_host_imported
(hass)
Test that we import a configured host.
Test that we import a configured host.
async def test_config_yaml_host_imported(hass): """Test that we import a configured host.""" with patch("homeassistant.components.tradfri.load_json", return_value={}): assert await async_setup_component( hass, "tradfri", {"tradfri": {"host": "mock-host"}} ) await hass.async_b...
[ "async", "def", "test_config_yaml_host_imported", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.tradfri.load_json\"", ",", "return_value", "=", "{", "}", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"tradfri\"", ...
[ 27, 0 ]
[ 38, 57 ]
python
en
['en', 'en', 'en']
True
test_config_json_host_not_imported
(hass)
Test that we don't import a configured host.
Test that we don't import a configured host.
async def test_config_json_host_not_imported(hass): """Test that we don't import a configured host.""" MockConfigEntry(domain="tradfri", data={"host": "mock-host"}).add_to_hass(hass) with patch( "homeassistant.components.tradfri.load_json", return_value={"mock-host": {"key": "some-info"}}, ...
[ "async", "def", "test_config_json_host_not_imported", "(", "hass", ")", ":", "MockConfigEntry", "(", "domain", "=", "\"tradfri\"", ",", "data", "=", "{", "\"host\"", ":", "\"mock-host\"", "}", ")", ".", "add_to_hass", "(", "hass", ")", "with", "patch", "(", ...
[ 41, 0 ]
[ 52, 41 ]
python
en
['en', 'en', 'en']
True
test_config_json_host_imported
( hass, mock_gateway_info, mock_entry_setup, gateway_id )
Test that we import a configured host.
Test that we import a configured host.
async def test_config_json_host_imported( hass, mock_gateway_info, mock_entry_setup, gateway_id ): """Test that we import a configured host.""" mock_gateway_info.side_effect = lambda hass, host, identity, key: { "host": host, "identity": identity, "key": key, "gateway_id": ga...
[ "async", "def", "test_config_json_host_imported", "(", "hass", ",", "mock_gateway_info", ",", "mock_entry_setup", ",", "gateway_id", ")", ":", "mock_gateway_info", ".", "side_effect", "=", "lambda", "hass", ",", "host", ",", "identity", ",", "key", ":", "{", "\"...
[ 55, 0 ]
[ 76, 44 ]
python
en
['en', 'en', 'en']
True
test_entry_setup_unload
(hass, api_factory, gateway_id)
Test config entry setup and unload.
Test config entry setup and unload.
async def test_entry_setup_unload(hass, api_factory, gateway_id): """Test config entry setup and unload.""" entry = MockConfigEntry( domain=tradfri.DOMAIN, data={ tradfri.CONF_HOST: "mock-host", tradfri.CONF_IDENTITY: "mock-identity", tradfri.CONF_KEY: "mock-k...
[ "async", "def", "test_entry_setup_unload", "(", "hass", ",", "api_factory", ",", "gateway_id", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "tradfri", ".", "DOMAIN", ",", "data", "=", "{", "tradfri", ".", "CONF_HOST", ":", "\"mock-host\"", ...
[ 79, 0 ]
[ 118, 51 ]
python
en
['en', 'en', 'en']
True
init_integration
( hass, config=None, options=None, entry_id="1", source="user", side_effect=None, usage=None, )
Set up the srp_energy integration in Home Assistant.
Set up the srp_energy integration in Home Assistant.
async def init_integration( hass, config=None, options=None, entry_id="1", source="user", side_effect=None, usage=None, ): """Set up the srp_energy integration in Home Assistant.""" if not config: config = ENTRY_CONFIG if not options: options = ENTRY_OPTIONS ...
[ "async", "def", "init_integration", "(", "hass", ",", "config", "=", "None", ",", "options", "=", "None", ",", "entry_id", "=", "\"1\"", ",", "source", "=", "\"user\"", ",", "side_effect", "=", "None", ",", "usage", "=", "None", ",", ")", ":", "if", ...
[ 19, 0 ]
[ 54, 23 ]
python
en
['en', 'en', 'en']
True