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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
wait_for_write | (sock, timeout=None) | Waits for writing to be available on a given socket.
Returns True if the socket is readable, or False if the timeout expired.
| Waits for writing to be available on a given socket.
Returns True if the socket is readable, or False if the timeout expired.
| def wait_for_write(sock, timeout=None):
""" Waits for writing to be available on a given socket.
Returns True if the socket is readable, or False if the timeout expired.
"""
return wait_for_socket(sock, write=True, timeout=timeout) | [
"def",
"wait_for_write",
"(",
"sock",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"wait_for_socket",
"(",
"sock",
",",
"write",
"=",
"True",
",",
"timeout",
"=",
"timeout",
")"
] | [
148,
0
] | [
152,
61
] | python | en | ['en', 'en', 'en'] | True |
_setup | (config) | Perform common setup tasks for the tests. | Perform common setup tasks for the tests. | def _setup(config):
"""Perform common setup tasks for the tests."""
if CONF_ADB_SERVER_IP not in config[DOMAIN]:
patch_key = "python"
else:
patch_key = "server"
if config[DOMAIN].get(CONF_DEVICE_CLASS) != "firetv":
entity_id = "media_player.android_tv"
else:
entity_i... | [
"def",
"_setup",
"(",
"config",
")",
":",
"if",
"CONF_ADB_SERVER_IP",
"not",
"in",
"config",
"[",
"DOMAIN",
"]",
":",
"patch_key",
"=",
"\"python\"",
"else",
":",
"patch_key",
"=",
"\"server\"",
"if",
"config",
"[",
"DOMAIN",
"]",
".",
"get",
"(",
"CONF_... | [
109,
0
] | [
121,
31
] | python | en | ['en', 'en', 'en'] | True |
_test_reconnect | (hass, caplog, config) | Test that the error and reconnection attempts are logged correctly.
"Handles device/service unavailable. Log a warning once when
unavailable, log once when reconnected."
https://developers.home-assistant.io/docs/en/integration_quality_scale_index.html
| Test that the error and reconnection attempts are logged correctly. | async def _test_reconnect(hass, caplog, config):
"""Test that the error and reconnection attempts are logged correctly.
"Handles device/service unavailable. Log a warning once when
unavailable, log once when reconnected."
https://developers.home-assistant.io/docs/en/integration_quality_scale_index.htm... | [
"async",
"def",
"_test_reconnect",
"(",
"hass",
",",
"caplog",
",",
"config",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"config",
")",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connect",
"(",
"True",
")"... | [
124,
0
] | [
184,
15
] | python | en | ['en', 'en', 'en'] | True |
_test_adb_shell_returns_none | (hass, config) | Test the case that the ADB shell command returns `None`.
The state should be `None` and the device should be unavailable.
| Test the case that the ADB shell command returns `None`. | async def _test_adb_shell_returns_none(hass, config):
"""Test the case that the ADB shell command returns `None`.
The state should be `None` and the device should be unavailable.
"""
patch_key, entity_id = _setup(config)
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
pat... | [
"async",
"def",
"_test_adb_shell_returns_none",
"(",
"hass",
",",
"config",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"config",
")",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connect",
"(",
"True",
")",
"[... | [
187,
0
] | [
214,
15
] | python | en | ['en', 'en', 'en'] | True |
test_reconnect_androidtv_python_adb | (hass, caplog) | Test that the error and reconnection attempts are logged correctly.
* Device type: Android TV
* ADB connection method: Python ADB implementation
| Test that the error and reconnection attempts are logged correctly. | async def test_reconnect_androidtv_python_adb(hass, caplog):
"""Test that the error and reconnection attempts are logged correctly.
* Device type: Android TV
* ADB connection method: Python ADB implementation
"""
assert await _test_reconnect(hass, caplog, CONFIG_ANDROIDTV_PYTHON_ADB) | [
"async",
"def",
"test_reconnect_androidtv_python_adb",
"(",
"hass",
",",
"caplog",
")",
":",
"assert",
"await",
"_test_reconnect",
"(",
"hass",
",",
"caplog",
",",
"CONFIG_ANDROIDTV_PYTHON_ADB",
")"
] | [
217,
0
] | [
224,
75
] | python | en | ['en', 'en', 'en'] | True |
test_adb_shell_returns_none_androidtv_python_adb | (hass) | Test the case that the ADB shell command returns `None`.
* Device type: Android TV
* ADB connection method: Python ADB implementation
| Test the case that the ADB shell command returns `None`. | async def test_adb_shell_returns_none_androidtv_python_adb(hass):
"""Test the case that the ADB shell command returns `None`.
* Device type: Android TV
* ADB connection method: Python ADB implementation
"""
assert await _test_adb_shell_returns_none(hass, CONFIG_ANDROIDTV_PYTHON_ADB) | [
"async",
"def",
"test_adb_shell_returns_none_androidtv_python_adb",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_adb_shell_returns_none",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_PYTHON_ADB",
")"
] | [
227,
0
] | [
234,
80
] | python | en | ['en', 'en', 'en'] | True |
test_reconnect_firetv_python_adb | (hass, caplog) | Test that the error and reconnection attempts are logged correctly.
* Device type: Fire TV
* ADB connection method: Python ADB implementation
| Test that the error and reconnection attempts are logged correctly. | async def test_reconnect_firetv_python_adb(hass, caplog):
"""Test that the error and reconnection attempts are logged correctly.
* Device type: Fire TV
* ADB connection method: Python ADB implementation
"""
assert await _test_reconnect(hass, caplog, CONFIG_FIRETV_PYTHON_ADB) | [
"async",
"def",
"test_reconnect_firetv_python_adb",
"(",
"hass",
",",
"caplog",
")",
":",
"assert",
"await",
"_test_reconnect",
"(",
"hass",
",",
"caplog",
",",
"CONFIG_FIRETV_PYTHON_ADB",
")"
] | [
237,
0
] | [
244,
72
] | python | en | ['en', 'en', 'en'] | True |
test_adb_shell_returns_none_firetv_python_adb | (hass) | Test the case that the ADB shell command returns `None`.
* Device type: Fire TV
* ADB connection method: Python ADB implementation
| Test the case that the ADB shell command returns `None`. | async def test_adb_shell_returns_none_firetv_python_adb(hass):
"""Test the case that the ADB shell command returns `None`.
* Device type: Fire TV
* ADB connection method: Python ADB implementation
"""
assert await _test_adb_shell_returns_none(hass, CONFIG_FIRETV_PYTHON_ADB) | [
"async",
"def",
"test_adb_shell_returns_none_firetv_python_adb",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_adb_shell_returns_none",
"(",
"hass",
",",
"CONFIG_FIRETV_PYTHON_ADB",
")"
] | [
247,
0
] | [
254,
77
] | python | en | ['en', 'en', 'en'] | True |
test_reconnect_androidtv_adb_server | (hass, caplog) | Test that the error and reconnection attempts are logged correctly.
* Device type: Android TV
* ADB connection method: ADB server
| Test that the error and reconnection attempts are logged correctly. | async def test_reconnect_androidtv_adb_server(hass, caplog):
"""Test that the error and reconnection attempts are logged correctly.
* Device type: Android TV
* ADB connection method: ADB server
"""
assert await _test_reconnect(hass, caplog, CONFIG_ANDROIDTV_ADB_SERVER) | [
"async",
"def",
"test_reconnect_androidtv_adb_server",
"(",
"hass",
",",
"caplog",
")",
":",
"assert",
"await",
"_test_reconnect",
"(",
"hass",
",",
"caplog",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
")"
] | [
257,
0
] | [
264,
75
] | python | en | ['en', 'en', 'en'] | True |
test_adb_shell_returns_none_androidtv_adb_server | (hass) | Test the case that the ADB shell command returns `None`.
* Device type: Android TV
* ADB connection method: ADB server
| Test the case that the ADB shell command returns `None`. | async def test_adb_shell_returns_none_androidtv_adb_server(hass):
"""Test the case that the ADB shell command returns `None`.
* Device type: Android TV
* ADB connection method: ADB server
"""
assert await _test_adb_shell_returns_none(hass, CONFIG_ANDROIDTV_ADB_SERVER) | [
"async",
"def",
"test_adb_shell_returns_none_androidtv_adb_server",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_adb_shell_returns_none",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
")"
] | [
267,
0
] | [
274,
80
] | python | en | ['en', 'en', 'en'] | True |
test_reconnect_firetv_adb_server | (hass, caplog) | Test that the error and reconnection attempts are logged correctly.
* Device type: Fire TV
* ADB connection method: ADB server
| Test that the error and reconnection attempts are logged correctly. | async def test_reconnect_firetv_adb_server(hass, caplog):
"""Test that the error and reconnection attempts are logged correctly.
* Device type: Fire TV
* ADB connection method: ADB server
"""
assert await _test_reconnect(hass, caplog, CONFIG_FIRETV_ADB_SERVER) | [
"async",
"def",
"test_reconnect_firetv_adb_server",
"(",
"hass",
",",
"caplog",
")",
":",
"assert",
"await",
"_test_reconnect",
"(",
"hass",
",",
"caplog",
",",
"CONFIG_FIRETV_ADB_SERVER",
")"
] | [
277,
0
] | [
284,
72
] | python | en | ['en', 'en', 'en'] | True |
test_adb_shell_returns_none_firetv_adb_server | (hass) | Test the case that the ADB shell command returns `None`.
* Device type: Fire TV
* ADB connection method: ADB server
| Test the case that the ADB shell command returns `None`. | async def test_adb_shell_returns_none_firetv_adb_server(hass):
"""Test the case that the ADB shell command returns `None`.
* Device type: Fire TV
* ADB connection method: ADB server
"""
assert await _test_adb_shell_returns_none(hass, CONFIG_FIRETV_ADB_SERVER) | [
"async",
"def",
"test_adb_shell_returns_none_firetv_adb_server",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_adb_shell_returns_none",
"(",
"hass",
",",
"CONFIG_FIRETV_ADB_SERVER",
")"
] | [
287,
0
] | [
294,
77
] | python | en | ['en', 'en', 'en'] | True |
test_setup_with_adbkey | (hass) | Test that setup succeeds when using an ADB key. | Test that setup succeeds when using an ADB key. | async def test_setup_with_adbkey(hass):
"""Test that setup succeeds when using an ADB key."""
config = copy.deepcopy(CONFIG_ANDROIDTV_PYTHON_ADB)
config[DOMAIN][CONF_ADBKEY] = hass.config.path("user_provided_adbkey")
patch_key, entity_id = _setup(config)
with patchers.PATCH_ADB_DEVICE_TCP, patchers... | [
"async",
"def",
"test_setup_with_adbkey",
"(",
"hass",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"CONFIG_ANDROIDTV_PYTHON_ADB",
")",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_ADBKEY",
"]",
"=",
"hass",
".",
"config",
".",
"path",
"(",
"\"user_pro... | [
297,
0
] | [
313,
39
] | python | en | ['en', 'lb', 'en'] | True |
_test_sources | (hass, config0) | Test that sources (i.e., apps) are handled correctly for Android TV and Fire TV devices. | Test that sources (i.e., apps) are handled correctly for Android TV and Fire TV devices. | async def _test_sources(hass, config0):
"""Test that sources (i.e., apps) are handled correctly for Android TV and Fire TV devices."""
config = copy.deepcopy(config0)
config[DOMAIN][CONF_APPS] = {
"com.app.test1": "TEST 1",
"com.app.test3": None,
"com.app.test4": SHELL_RESPONSE_OFF,
... | [
"async",
"def",
"_test_sources",
"(",
"hass",
",",
"config0",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"config0",
")",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_APPS",
"]",
"=",
"{",
"\"com.app.test1\"",
":",
"\"TEST 1\"",
",",
"\"com.app.test... | [
316,
0
] | [
388,
15
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_sources | (hass) | Test that sources (i.e., apps) are handled correctly for Android TV devices. | Test that sources (i.e., apps) are handled correctly for Android TV devices. | async def test_androidtv_sources(hass):
"""Test that sources (i.e., apps) are handled correctly for Android TV devices."""
assert await _test_sources(hass, CONFIG_ANDROIDTV_ADB_SERVER) | [
"async",
"def",
"test_androidtv_sources",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_sources",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
")"
] | [
391,
0
] | [
393,
65
] | python | en | ['en', 'en', 'en'] | True |
test_firetv_sources | (hass) | Test that sources (i.e., apps) are handled correctly for Fire TV devices. | Test that sources (i.e., apps) are handled correctly for Fire TV devices. | async def test_firetv_sources(hass):
"""Test that sources (i.e., apps) are handled correctly for Fire TV devices."""
assert await _test_sources(hass, CONFIG_FIRETV_ADB_SERVER) | [
"async",
"def",
"test_firetv_sources",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_sources",
"(",
"hass",
",",
"CONFIG_FIRETV_ADB_SERVER",
")"
] | [
396,
0
] | [
398,
62
] | python | en | ['en', 'en', 'en'] | True |
_test_exclude_sources | (hass, config0, expected_sources) | Test that sources (i.e., apps) are handled correctly when the `exclude_unnamed_apps` config parameter is provided. | Test that sources (i.e., apps) are handled correctly when the `exclude_unnamed_apps` config parameter is provided. | async def _test_exclude_sources(hass, config0, expected_sources):
"""Test that sources (i.e., apps) are handled correctly when the `exclude_unnamed_apps` config parameter is provided."""
config = copy.deepcopy(config0)
config[DOMAIN][CONF_APPS] = {
"com.app.test1": "TEST 1",
"com.app.test3":... | [
"async",
"def",
"_test_exclude_sources",
"(",
"hass",
",",
"config0",
",",
"expected_sources",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"config0",
")",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_APPS",
"]",
"=",
"{",
"\"com.app.test1\"",
":",
"... | [
401,
0
] | [
459,
15
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_exclude_sources | (hass) | Test that sources (i.e., apps) are handled correctly for Android TV devices when the `exclude_unnamed_apps` config parameter is provided as true. | Test that sources (i.e., apps) are handled correctly for Android TV devices when the `exclude_unnamed_apps` config parameter is provided as true. | async def test_androidtv_exclude_sources(hass):
"""Test that sources (i.e., apps) are handled correctly for Android TV devices when the `exclude_unnamed_apps` config parameter is provided as true."""
config = copy.deepcopy(CONFIG_ANDROIDTV_ADB_SERVER)
config[DOMAIN][CONF_EXCLUDE_UNNAMED_APPS] = True
ass... | [
"async",
"def",
"test_androidtv_exclude_sources",
"(",
"hass",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_EXCLUDE_UNNAMED_APPS",
"]",
"=",
"True",
"assert",
"await",
"_test_ex... | [
462,
0
] | [
466,
64
] | python | en | ['en', 'en', 'en'] | True |
test_firetv_exclude_sources | (hass) | Test that sources (i.e., apps) are handled correctly for Fire TV devices when the `exclude_unnamed_apps` config parameter is provided as true. | Test that sources (i.e., apps) are handled correctly for Fire TV devices when the `exclude_unnamed_apps` config parameter is provided as true. | async def test_firetv_exclude_sources(hass):
"""Test that sources (i.e., apps) are handled correctly for Fire TV devices when the `exclude_unnamed_apps` config parameter is provided as true."""
config = copy.deepcopy(CONFIG_FIRETV_ADB_SERVER)
config[DOMAIN][CONF_EXCLUDE_UNNAMED_APPS] = True
assert await... | [
"async",
"def",
"test_firetv_exclude_sources",
"(",
"hass",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"CONFIG_FIRETV_ADB_SERVER",
")",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_EXCLUDE_UNNAMED_APPS",
"]",
"=",
"True",
"assert",
"await",
"_test_exclude_... | [
469,
0
] | [
473,
64
] | python | en | ['en', 'en', 'en'] | True |
_test_select_source | (hass, config0, source, expected_arg, method_patch) | Test that the methods for launching and stopping apps are called correctly when selecting a source. | Test that the methods for launching and stopping apps are called correctly when selecting a source. | async def _test_select_source(hass, config0, source, expected_arg, method_patch):
"""Test that the methods for launching and stopping apps are called correctly when selecting a source."""
config = copy.deepcopy(config0)
config[DOMAIN][CONF_APPS] = {
"com.app.test1": "TEST 1",
"com.app.test3"... | [
"async",
"def",
"_test_select_source",
"(",
"hass",
",",
"config0",
",",
"source",
",",
"expected_arg",
",",
"method_patch",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"config0",
")",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_APPS",
"]",
"=",
... | [
476,
0
] | [
505,
15
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_select_source_launch_app_id | (hass) | Test that an app can be launched using its app ID. | Test that an app can be launched using its app ID. | async def test_androidtv_select_source_launch_app_id(hass):
"""Test that an app can be launched using its app ID."""
assert await _test_select_source(
hass,
CONFIG_ANDROIDTV_ADB_SERVER,
"com.app.test1",
"com.app.test1",
patchers.PATCH_LAUNCH_APP,
) | [
"async",
"def",
"test_androidtv_select_source_launch_app_id",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
",",
"\"com.app.test1\"",
",",
"\"com.app.test1\"",
",",
"patchers",
".",
"PATCH_LAUNCH_APP",
",... | [
508,
0
] | [
516,
5
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_select_source_launch_app_name | (hass) | Test that an app can be launched using its friendly name. | Test that an app can be launched using its friendly name. | async def test_androidtv_select_source_launch_app_name(hass):
"""Test that an app can be launched using its friendly name."""
assert await _test_select_source(
hass,
CONFIG_ANDROIDTV_ADB_SERVER,
"TEST 1",
"com.app.test1",
patchers.PATCH_LAUNCH_APP,
) | [
"async",
"def",
"test_androidtv_select_source_launch_app_name",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
",",
"\"TEST 1\"",
",",
"\"com.app.test1\"",
",",
"patchers",
".",
"PATCH_LAUNCH_APP",
",",
... | [
519,
0
] | [
527,
5
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_select_source_launch_app_id_no_name | (hass) | Test that an app can be launched using its app ID when it has no friendly name. | Test that an app can be launched using its app ID when it has no friendly name. | async def test_androidtv_select_source_launch_app_id_no_name(hass):
"""Test that an app can be launched using its app ID when it has no friendly name."""
assert await _test_select_source(
hass,
CONFIG_ANDROIDTV_ADB_SERVER,
"com.app.test2",
"com.app.test2",
patchers.PATCH_... | [
"async",
"def",
"test_androidtv_select_source_launch_app_id_no_name",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
",",
"\"com.app.test2\"",
",",
"\"com.app.test2\"",
",",
"patchers",
".",
"PATCH_LAUNCH_AP... | [
530,
0
] | [
538,
5
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_select_source_launch_app_hidden | (hass) | Test that an app can be launched using its app ID when it is hidden from the sources list. | Test that an app can be launched using its app ID when it is hidden from the sources list. | async def test_androidtv_select_source_launch_app_hidden(hass):
"""Test that an app can be launched using its app ID when it is hidden from the sources list."""
assert await _test_select_source(
hass,
CONFIG_ANDROIDTV_ADB_SERVER,
"com.app.test3",
"com.app.test3",
patchers... | [
"async",
"def",
"test_androidtv_select_source_launch_app_hidden",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
",",
"\"com.app.test3\"",
",",
"\"com.app.test3\"",
",",
"patchers",
".",
"PATCH_LAUNCH_APP",
... | [
541,
0
] | [
549,
5
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_select_source_overridden_app_name | (hass) | Test that when an app name is overridden via the `apps` configuration parameter, the app is launched correctly. | Test that when an app name is overridden via the `apps` configuration parameter, the app is launched correctly. | async def test_androidtv_select_source_overridden_app_name(hass):
"""Test that when an app name is overridden via the `apps` configuration parameter, the app is launched correctly."""
# Evidence that the default YouTube app ID will be overridden
assert "YouTube" in ANDROIDTV_APPS.values()
assert "com.yo... | [
"async",
"def",
"test_androidtv_select_source_overridden_app_name",
"(",
"hass",
")",
":",
"# Evidence that the default YouTube app ID will be overridden",
"assert",
"\"YouTube\"",
"in",
"ANDROIDTV_APPS",
".",
"values",
"(",
")",
"assert",
"\"com.youtube.test\"",
"not",
"in",
... | [
552,
0
] | [
563,
5
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_select_source_stop_app_id | (hass) | Test that an app can be stopped using its app ID. | Test that an app can be stopped using its app ID. | async def test_androidtv_select_source_stop_app_id(hass):
"""Test that an app can be stopped using its app ID."""
assert await _test_select_source(
hass,
CONFIG_ANDROIDTV_ADB_SERVER,
"!com.app.test1",
"com.app.test1",
patchers.PATCH_STOP_APP,
) | [
"async",
"def",
"test_androidtv_select_source_stop_app_id",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
",",
"\"!com.app.test1\"",
",",
"\"com.app.test1\"",
",",
"patchers",
".",
"PATCH_STOP_APP",
",",
... | [
566,
0
] | [
574,
5
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_select_source_stop_app_name | (hass) | Test that an app can be stopped using its friendly name. | Test that an app can be stopped using its friendly name. | async def test_androidtv_select_source_stop_app_name(hass):
"""Test that an app can be stopped using its friendly name."""
assert await _test_select_source(
hass,
CONFIG_ANDROIDTV_ADB_SERVER,
"!TEST 1",
"com.app.test1",
patchers.PATCH_STOP_APP,
) | [
"async",
"def",
"test_androidtv_select_source_stop_app_name",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
",",
"\"!TEST 1\"",
",",
"\"com.app.test1\"",
",",
"patchers",
".",
"PATCH_STOP_APP",
",",
")"... | [
577,
0
] | [
585,
5
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_select_source_stop_app_id_no_name | (hass) | Test that an app can be stopped using its app ID when it has no friendly name. | Test that an app can be stopped using its app ID when it has no friendly name. | async def test_androidtv_select_source_stop_app_id_no_name(hass):
"""Test that an app can be stopped using its app ID when it has no friendly name."""
assert await _test_select_source(
hass,
CONFIG_ANDROIDTV_ADB_SERVER,
"!com.app.test2",
"com.app.test2",
patchers.PATCH_ST... | [
"async",
"def",
"test_androidtv_select_source_stop_app_id_no_name",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
",",
"\"!com.app.test2\"",
",",
"\"com.app.test2\"",
",",
"patchers",
".",
"PATCH_STOP_APP",... | [
588,
0
] | [
596,
5
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_select_source_stop_app_hidden | (hass) | Test that an app can be stopped using its app ID when it is hidden from the sources list. | Test that an app can be stopped using its app ID when it is hidden from the sources list. | async def test_androidtv_select_source_stop_app_hidden(hass):
"""Test that an app can be stopped using its app ID when it is hidden from the sources list."""
assert await _test_select_source(
hass,
CONFIG_ANDROIDTV_ADB_SERVER,
"!com.app.test3",
"com.app.test3",
patchers.P... | [
"async",
"def",
"test_androidtv_select_source_stop_app_hidden",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_ADB_SERVER",
",",
"\"!com.app.test3\"",
",",
"\"com.app.test3\"",
",",
"patchers",
".",
"PATCH_STOP_APP",
"... | [
599,
0
] | [
607,
5
] | python | en | ['en', 'en', 'en'] | True |
test_firetv_select_source_launch_app_id | (hass) | Test that an app can be launched using its app ID. | Test that an app can be launched using its app ID. | async def test_firetv_select_source_launch_app_id(hass):
"""Test that an app can be launched using its app ID."""
assert await _test_select_source(
hass,
CONFIG_FIRETV_ADB_SERVER,
"com.app.test1",
"com.app.test1",
patchers.PATCH_LAUNCH_APP,
) | [
"async",
"def",
"test_firetv_select_source_launch_app_id",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_FIRETV_ADB_SERVER",
",",
"\"com.app.test1\"",
",",
"\"com.app.test1\"",
",",
"patchers",
".",
"PATCH_LAUNCH_APP",
",",
"... | [
610,
0
] | [
618,
5
] | python | en | ['en', 'en', 'en'] | True |
test_firetv_select_source_launch_app_name | (hass) | Test that an app can be launched using its friendly name. | Test that an app can be launched using its friendly name. | async def test_firetv_select_source_launch_app_name(hass):
"""Test that an app can be launched using its friendly name."""
assert await _test_select_source(
hass,
CONFIG_FIRETV_ADB_SERVER,
"TEST 1",
"com.app.test1",
patchers.PATCH_LAUNCH_APP,
) | [
"async",
"def",
"test_firetv_select_source_launch_app_name",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_FIRETV_ADB_SERVER",
",",
"\"TEST 1\"",
",",
"\"com.app.test1\"",
",",
"patchers",
".",
"PATCH_LAUNCH_APP",
",",
")"
] | [
621,
0
] | [
629,
5
] | python | en | ['en', 'en', 'en'] | True |
test_firetv_select_source_launch_app_id_no_name | (hass) | Test that an app can be launched using its app ID when it has no friendly name. | Test that an app can be launched using its app ID when it has no friendly name. | async def test_firetv_select_source_launch_app_id_no_name(hass):
"""Test that an app can be launched using its app ID when it has no friendly name."""
assert await _test_select_source(
hass,
CONFIG_FIRETV_ADB_SERVER,
"com.app.test2",
"com.app.test2",
patchers.PATCH_LAUNCH... | [
"async",
"def",
"test_firetv_select_source_launch_app_id_no_name",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_FIRETV_ADB_SERVER",
",",
"\"com.app.test2\"",
",",
"\"com.app.test2\"",
",",
"patchers",
".",
"PATCH_LAUNCH_APP",
... | [
632,
0
] | [
640,
5
] | python | en | ['en', 'en', 'en'] | True |
test_firetv_select_source_launch_app_hidden | (hass) | Test that an app can be launched using its app ID when it is hidden from the sources list. | Test that an app can be launched using its app ID when it is hidden from the sources list. | async def test_firetv_select_source_launch_app_hidden(hass):
"""Test that an app can be launched using its app ID when it is hidden from the sources list."""
assert await _test_select_source(
hass,
CONFIG_FIRETV_ADB_SERVER,
"com.app.test3",
"com.app.test3",
patchers.PATCH... | [
"async",
"def",
"test_firetv_select_source_launch_app_hidden",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_FIRETV_ADB_SERVER",
",",
"\"com.app.test3\"",
",",
"\"com.app.test3\"",
",",
"patchers",
".",
"PATCH_LAUNCH_APP",
",",... | [
643,
0
] | [
651,
5
] | python | en | ['en', 'en', 'en'] | True |
test_firetv_select_source_stop_app_id | (hass) | Test that an app can be stopped using its app ID. | Test that an app can be stopped using its app ID. | async def test_firetv_select_source_stop_app_id(hass):
"""Test that an app can be stopped using its app ID."""
assert await _test_select_source(
hass,
CONFIG_FIRETV_ADB_SERVER,
"!com.app.test1",
"com.app.test1",
patchers.PATCH_STOP_APP,
) | [
"async",
"def",
"test_firetv_select_source_stop_app_id",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_FIRETV_ADB_SERVER",
",",
"\"!com.app.test1\"",
",",
"\"com.app.test1\"",
",",
"patchers",
".",
"PATCH_STOP_APP",
",",
")"
... | [
654,
0
] | [
662,
5
] | python | en | ['en', 'en', 'en'] | True |
test_firetv_select_source_stop_app_name | (hass) | Test that an app can be stopped using its friendly name. | Test that an app can be stopped using its friendly name. | async def test_firetv_select_source_stop_app_name(hass):
"""Test that an app can be stopped using its friendly name."""
assert await _test_select_source(
hass,
CONFIG_FIRETV_ADB_SERVER,
"!TEST 1",
"com.app.test1",
patchers.PATCH_STOP_APP,
) | [
"async",
"def",
"test_firetv_select_source_stop_app_name",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_FIRETV_ADB_SERVER",
",",
"\"!TEST 1\"",
",",
"\"com.app.test1\"",
",",
"patchers",
".",
"PATCH_STOP_APP",
",",
")"
] | [
665,
0
] | [
673,
5
] | python | en | ['en', 'en', 'en'] | True |
test_firetv_select_source_stop_app_id_no_name | (hass) | Test that an app can be stopped using its app ID when it has no friendly name. | Test that an app can be stopped using its app ID when it has no friendly name. | async def test_firetv_select_source_stop_app_id_no_name(hass):
"""Test that an app can be stopped using its app ID when it has no friendly name."""
assert await _test_select_source(
hass,
CONFIG_FIRETV_ADB_SERVER,
"!com.app.test2",
"com.app.test2",
patchers.PATCH_STOP_APP... | [
"async",
"def",
"test_firetv_select_source_stop_app_id_no_name",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_FIRETV_ADB_SERVER",
",",
"\"!com.app.test2\"",
",",
"\"com.app.test2\"",
",",
"patchers",
".",
"PATCH_STOP_APP",
","... | [
676,
0
] | [
684,
5
] | python | en | ['en', 'en', 'en'] | True |
test_firetv_select_source_stop_hidden | (hass) | Test that an app can be stopped using its app ID when it is hidden from the sources list. | Test that an app can be stopped using its app ID when it is hidden from the sources list. | async def test_firetv_select_source_stop_hidden(hass):
"""Test that an app can be stopped using its app ID when it is hidden from the sources list."""
assert await _test_select_source(
hass,
CONFIG_FIRETV_ADB_SERVER,
"!com.app.test3",
"com.app.test3",
patchers.PATCH_STOP_... | [
"async",
"def",
"test_firetv_select_source_stop_hidden",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_select_source",
"(",
"hass",
",",
"CONFIG_FIRETV_ADB_SERVER",
",",
"\"!com.app.test3\"",
",",
"\"com.app.test3\"",
",",
"patchers",
".",
"PATCH_STOP_APP",
",",
")"
... | [
687,
0
] | [
695,
5
] | python | en | ['en', 'en', 'en'] | True |
_test_setup_fail | (hass, config) | Test that the entity is not created when the ADB connection is not established. | Test that the entity is not created when the ADB connection is not established. | async def _test_setup_fail(hass, config):
"""Test that the entity is not created when the ADB connection is not established."""
patch_key, entity_id = _setup(config)
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(False)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[
... | [
"async",
"def",
"_test_setup_fail",
"(",
"hass",
",",
"config",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"config",
")",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connect",
"(",
"False",
")",
"[",
"patch... | [
698,
0
] | [
713,
15
] | python | en | ['en', 'en', 'en'] | True |
test_setup_fail_androidtv | (hass) | Test that the Android TV entity is not created when the ADB connection is not established. | Test that the Android TV entity is not created when the ADB connection is not established. | async def test_setup_fail_androidtv(hass):
"""Test that the Android TV entity is not created when the ADB connection is not established."""
assert await _test_setup_fail(hass, CONFIG_ANDROIDTV_PYTHON_ADB) | [
"async",
"def",
"test_setup_fail_androidtv",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_setup_fail",
"(",
"hass",
",",
"CONFIG_ANDROIDTV_PYTHON_ADB",
")"
] | [
716,
0
] | [
718,
68
] | python | en | ['en', 'en', 'en'] | True |
test_setup_fail_firetv | (hass) | Test that the Fire TV entity is not created when the ADB connection is not established. | Test that the Fire TV entity is not created when the ADB connection is not established. | async def test_setup_fail_firetv(hass):
"""Test that the Fire TV entity is not created when the ADB connection is not established."""
assert await _test_setup_fail(hass, CONFIG_FIRETV_PYTHON_ADB) | [
"async",
"def",
"test_setup_fail_firetv",
"(",
"hass",
")",
":",
"assert",
"await",
"_test_setup_fail",
"(",
"hass",
",",
"CONFIG_FIRETV_PYTHON_ADB",
")"
] | [
721,
0
] | [
723,
65
] | python | en | ['en', 'en', 'en'] | True |
test_setup_two_devices | (hass) | Test that two devices can be set up. | Test that two devices can be set up. | async def test_setup_two_devices(hass):
"""Test that two devices can be set up."""
config = {
DOMAIN: [
CONFIG_ANDROIDTV_ADB_SERVER[DOMAIN],
copy.deepcopy(CONFIG_FIRETV_ADB_SERVER[DOMAIN]),
]
}
config[DOMAIN][1][CONF_HOST] = "127.0.0.2"
patch_key = "server"
... | [
"async",
"def",
"test_setup_two_devices",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"DOMAIN",
":",
"[",
"CONFIG_ANDROIDTV_ADB_SERVER",
"[",
"DOMAIN",
"]",
",",
"copy",
".",
"deepcopy",
"(",
"CONFIG_FIRETV_ADB_SERVER",
"[",
"DOMAIN",
"]",
")",
",",
"]",
"}",... | [
726,
0
] | [
747,
43
] | python | en | ['en', 'en', 'en'] | True |
test_setup_same_device_twice | (hass) | Test that setup succeeds with a duplicated config entry. | Test that setup succeeds with a duplicated config entry. | async def test_setup_same_device_twice(hass):
"""Test that setup succeeds with a duplicated config entry."""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_ADB_SERVER)
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_k... | [
"async",
"def",
"test_setup_same_device_twice",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connect",
"(",
"True",
")",
... | [
750,
0
] | [
768,
42
] | python | en | ['en', 'en', 'en'] | True |
test_adb_command | (hass) | Test sending a command via the `androidtv.adb_command` service. | Test sending a command via the `androidtv.adb_command` service. | async def test_adb_command(hass):
"""Test sending a command via the `androidtv.adb_command` service."""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_ADB_SERVER)
command = "test command"
response = "test response"
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
... | [
"async",
"def",
"test_adb_command",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"command",
"=",
"\"test command\"",
"response",
"=",
"\"test response\"",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",... | [
771,
0
] | [
796,
59
] | python | en | ['en', 'en', 'en'] | True |
test_adb_command_unicode_decode_error | (hass) | Test sending a command via the `androidtv.adb_command` service that raises a UnicodeDecodeError exception. | Test sending a command via the `androidtv.adb_command` service that raises a UnicodeDecodeError exception. | async def test_adb_command_unicode_decode_error(hass):
"""Test sending a command via the `androidtv.adb_command` service that raises a UnicodeDecodeError exception."""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_ADB_SERVER)
command = "test command"
response = b"test response"
with patchers.PATCH... | [
"async",
"def",
"test_adb_command_unicode_decode_error",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"command",
"=",
"\"test command\"",
"response",
"=",
"b\"test response\"",
"with",
"patchers",
".",
"... | [
799,
0
] | [
825,
55
] | python | en | ['en', 'en', 'en'] | True |
test_adb_command_key | (hass) | Test sending a key command via the `androidtv.adb_command` service. | Test sending a key command via the `androidtv.adb_command` service. | async def test_adb_command_key(hass):
"""Test sending a key command via the `androidtv.adb_command` service."""
patch_key = "server"
entity_id = "media_player.android_tv"
command = "HOME"
response = None
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], ... | [
"async",
"def",
"test_adb_command_key",
"(",
"hass",
")",
":",
"patch_key",
"=",
"\"server\"",
"entity_id",
"=",
"\"media_player.android_tv\"",
"command",
"=",
"\"HOME\"",
"response",
"=",
"None",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
"."... | [
828,
0
] | [
854,
55
] | python | en | ['en', 'pt', 'en'] | True |
test_adb_command_get_properties | (hass) | Test sending the "GET_PROPERTIES" command via the `androidtv.adb_command` service. | Test sending the "GET_PROPERTIES" command via the `androidtv.adb_command` service. | async def test_adb_command_get_properties(hass):
"""Test sending the "GET_PROPERTIES" command via the `androidtv.adb_command` service."""
patch_key = "server"
entity_id = "media_player.android_tv"
command = "GET_PROPERTIES"
response = {"test key": "test value"}
with patchers.PATCH_ADB_DEVICE_TC... | [
"async",
"def",
"test_adb_command_get_properties",
"(",
"hass",
")",
":",
"patch_key",
"=",
"\"server\"",
"entity_id",
"=",
"\"media_player.android_tv\"",
"command",
"=",
"\"GET_PROPERTIES\"",
"response",
"=",
"{",
"\"test key\"",
":",
"\"test value\"",
"}",
"with",
"... | [
857,
0
] | [
884,
64
] | python | en | ['en', 'en', 'en'] | True |
test_learn_sendevent | (hass) | Test the `androidtv.learn_sendevent` service. | Test the `androidtv.learn_sendevent` service. | async def test_learn_sendevent(hass):
"""Test the `androidtv.learn_sendevent` service."""
patch_key = "server"
entity_id = "media_player.android_tv"
response = "sendevent 1 2 3 4"
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_R... | [
"async",
"def",
"test_learn_sendevent",
"(",
"hass",
")",
":",
"patch_key",
"=",
"\"server\"",
"entity_id",
"=",
"\"media_player.android_tv\"",
"response",
"=",
"\"sendevent 1 2 3 4\"",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connec... | [
887,
0
] | [
913,
63
] | python | en | ['en', 'en', 'en'] | True |
test_update_lock_not_acquired | (hass) | Test that the state does not get updated when a `LockNotAcquiredException` is raised. | Test that the state does not get updated when a `LockNotAcquiredException` is raised. | async def test_update_lock_not_acquired(hass):
"""Test that the state does not get updated when a `LockNotAcquiredException` is raised."""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_ADB_SERVER)
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_she... | [
"async",
"def",
"test_update_lock_not_acquired",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connect",
"(",
"True",
")",
... | [
916,
0
] | [
945,
43
] | python | en | ['en', 'en', 'en'] | True |
test_download | (hass) | Test the `androidtv.download` service. | Test the `androidtv.download` service. | async def test_download(hass):
"""Test the `androidtv.download` service."""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_ADB_SERVER)
device_path = "device/path"
local_path = "local/path"
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shel... | [
"async",
"def",
"test_download",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"device_path",
"=",
"\"device/path\"",
"local_path",
"=",
"\"local/path\"",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
... | [
948,
0
] | [
988,
62
] | python | en | ['en', 'en', 'en'] | True |
test_upload | (hass) | Test the `androidtv.upload` service. | Test the `androidtv.upload` service. | async def test_upload(hass):
"""Test the `androidtv.upload` service."""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_ADB_SERVER)
device_path = "device/path"
local_path = "local/path"
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SH... | [
"async",
"def",
"test_upload",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"device_path",
"=",
"\"device/path\"",
"local_path",
"=",
"\"local/path\"",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
... | [
991,
0
] | [
1031,
62
] | python | en | ['en', 'en', 'en'] | True |
test_androidtv_volume_set | (hass) | Test setting the volume for an Android TV device. | Test setting the volume for an Android TV device. | async def test_androidtv_volume_set(hass):
"""Test setting the volume for an Android TV device."""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_ADB_SERVER)
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
... | [
"async",
"def",
"test_androidtv_volume_set",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connect",
"(",
"True",
")",
"["... | [
1034,
0
] | [
1054,
54
] | python | en | ['en', 'en', 'en'] | True |
test_get_image | (hass, hass_ws_client) | Test taking a screen capture.
This is based on `test_get_image` in tests/components/media_player/test_init.py.
| Test taking a screen capture. | async def test_get_image(hass, hass_ws_client):
"""Test taking a screen capture.
This is based on `test_get_image` in tests/components/media_player/test_init.py.
"""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_ADB_SERVER)
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
... | [
"async",
"def",
"test_get_image",
"(",
"hass",
",",
"hass_ws_client",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connect",
"(",
"Tru... | [
1057,
0
] | [
1103,
47
] | python | en | ['en', 'en', 'en'] | True |
_test_service | (
hass,
entity_id,
ha_service_name,
androidtv_method,
additional_service_data=None,
return_value=None,
) | Test generic Android TV media player entity service. | Test generic Android TV media player entity service. | async def _test_service(
hass,
entity_id,
ha_service_name,
androidtv_method,
additional_service_data=None,
return_value=None,
):
"""Test generic Android TV media player entity service."""
service_data = {ATTR_ENTITY_ID: entity_id}
if additional_service_data:
service_data.upda... | [
"async",
"def",
"_test_service",
"(",
"hass",
",",
"entity_id",
",",
"ha_service_name",
",",
"androidtv_method",
",",
"additional_service_data",
"=",
"None",
",",
"return_value",
"=",
"None",
",",
")",
":",
"service_data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entit... | [
1106,
0
] | [
1133,
34
] | python | en | ['en', 'en', 'en'] | True |
test_services_androidtv | (hass) | Test media player services for an Android TV device. | Test media player services for an Android TV device. | async def test_services_androidtv(hass):
"""Test media player services for an Android TV device."""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_ADB_SERVER)
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[patch_key]:
with patchers.patch_shell(SHELL_RESPONSE_OFF)[patch_key]:
... | [
"async",
"def",
"test_services_androidtv",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connect",
"(",
"True",
")",
"[",
... | [
1136,
0
] | [
1182,
13
] | python | en | ['en', 'en', 'en'] | True |
test_services_firetv | (hass) | Test media player services for a Fire TV device. | Test media player services for a Fire TV device. | async def test_services_firetv(hass):
"""Test media player services for a Fire TV device."""
patch_key, entity_id = _setup(CONFIG_FIRETV_ADB_SERVER)
config = copy.deepcopy(CONFIG_FIRETV_ADB_SERVER)
config[DOMAIN][CONF_TURN_OFF_COMMAND] = "test off"
config[DOMAIN][CONF_TURN_ON_COMMAND] = "test on"
... | [
"async",
"def",
"test_services_firetv",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_FIRETV_ADB_SERVER",
")",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"CONFIG_FIRETV_ADB_SERVER",
")",
"config",
"[",
"DOMAIN",
"]",
"[",
... | [
1185,
0
] | [
1200,
78
] | python | en | ['en', 'en', 'en'] | True |
test_connection_closed_on_ha_stop | (hass) | Test that the ADB socket connection is closed when HA stops. | Test that the ADB socket connection is closed when HA stops. | async def test_connection_closed_on_ha_stop(hass):
"""Test that the ADB socket connection is closed when HA stops."""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_ADB_SERVER)
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
patch_key
], patchers.patch_shell(SHELL_RESPONSE_OFF... | [
"async",
"def",
"test_connection_closed_on_ha_stop",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_ADB_SERVER",
")",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connect",
"(",
"True",
")... | [
1203,
0
] | [
1218,
35
] | python | en | ['en', 'en', 'en'] | True |
test_exception | (hass) | Test that the ADB connection gets closed when there is an unforeseen exception.
HA will attempt to reconnect on the next update.
| Test that the ADB connection gets closed when there is an unforeseen exception. | async def test_exception(hass):
"""Test that the ADB connection gets closed when there is an unforeseen exception.
HA will attempt to reconnect on the next update.
"""
patch_key, entity_id = _setup(CONFIG_ANDROIDTV_PYTHON_ADB)
with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[
... | [
"async",
"def",
"test_exception",
"(",
"hass",
")",
":",
"patch_key",
",",
"entity_id",
"=",
"_setup",
"(",
"CONFIG_ANDROIDTV_PYTHON_ADB",
")",
"with",
"patchers",
".",
"PATCH_ADB_DEVICE_TCP",
",",
"patchers",
".",
"patch_connect",
"(",
"True",
")",
"[",
"patch_... | [
1221,
0
] | [
1252,
39
] | python | en | ['en', 'en', 'en'] | True |
SearchScope.create | (
cls,
find_links, # type: List[str]
index_urls, # type: List[str]
) |
Create a SearchScope object after normalizing the `find_links`.
|
Create a SearchScope object after normalizing the `find_links`.
| def create(
cls,
find_links, # type: List[str]
index_urls, # type: List[str]
):
# type: (...) -> SearchScope
"""
Create a SearchScope object after normalizing the `find_links`.
"""
# Build find_links. If an argument starts with ~, it may be
#... | [
"def",
"create",
"(",
"cls",
",",
"find_links",
",",
"# type: List[str]",
"index_urls",
",",
"# type: List[str]",
")",
":",
"# type: (...) -> SearchScope",
"# Build find_links. If an argument starts with ~, it may be",
"# a local file relative to a home directory. So try normalizing",
... | [
29,
4
] | [
67,
9
] | python | en | ['en', 'error', 'th'] | False |
SearchScope.get_index_urls_locations | (self, project_name) | Returns the locations found via self.index_urls
Checks the url_name on the main (first in the list) index and
use this url_name to produce all locations
| Returns the locations found via self.index_urls | def get_index_urls_locations(self, project_name):
# type: (str) -> List[str]
"""Returns the locations found via self.index_urls
Checks the url_name on the main (first in the list) index and
use this url_name to produce all locations
"""
def mkurl_pypi_url(url):
... | [
"def",
"get_index_urls_locations",
"(",
"self",
",",
"project_name",
")",
":",
"# type: (str) -> List[str]",
"def",
"mkurl_pypi_url",
"(",
"url",
")",
":",
"# type: (str) -> str",
"loc",
"=",
"posixpath",
".",
"join",
"(",
"url",
",",
"urllib_parse",
".",
"quote",... | [
112,
4
] | [
134,
63
] | python | en | ['en', 'la', 'en'] | True |
test_form_user | (hass) | Test we get the form. | Test we get the form. | async def test_form_user(hass):
"""Test we get the form."""
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"] == "form"
assert result["e... | [
"async",
"def",
"test_form_user",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",... | [
18,
0
] | [
51,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_user_already_configured | (hass) | Test we abort if already configured. | Test we abort if already configured. | async def test_form_user_already_configured(hass):
"""Test we abort if already configured."""
await setup.async_setup_component(hass, "persistent_notification", {})
config_entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_HOST: "1.1.1.1", CONF_PORT: 12, CONF_SYSTEM_ID: 46},
)
confi... | [
"async",
"def",
"test_form_user_already_configured",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
"... | [
54,
0
] | [
87,
48
] | python | en | ['en', 'de', 'en'] | True |
test_form_invalid_auth | (hass) | Test we handle invalid auth. | Test we handle invalid auth. | async def test_form_invalid_auth(hass):
"""Test we handle invalid auth."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.somfy_mylink.config_flow.SomfyMyLinkSynergy.status_info",
... | [
"async",
"def",
"test_form_invalid_auth",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")"... | [
90,
0
] | [
114,
56
] | python | en | ['en', 'en', '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}
)
with patch(
"homeassistant.components.somfy_mylink.config_flow.SomfyMyLinkSynergy.status_info... | [
"async",
"def",
"test_form_cannot_connect",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
"... | [
117,
0
] | [
137,
58
] | python | en | ['en', 'en', 'en'] | True |
test_form_unknown_error | (hass) | Test we handle broad exception. | Test we handle broad exception. | async def test_form_unknown_error(hass):
"""Test we handle broad exception."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.somfy_mylink.config_flow.SomfyMyLinkSynergy.status_info",
... | [
"async",
"def",
"test_form_unknown_error",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")... | [
140,
0
] | [
160,
51
] | python | en | ['en', 'en', 'en'] | True |
test_options_not_loaded | (hass) | Test options will not display until loaded. | Test options will not display until loaded. | async def test_options_not_loaded(hass):
"""Test options will not display until loaded."""
await setup.async_setup_component(hass, "persistent_notification", {})
config_entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_HOST: "1.1.1.1", CONF_PORT: 12, CONF_SYSTEM_ID: "46"},
)
config... | [
"async",
"def",
"test_options_not_loaded",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"dat... | [
163,
0
] | [
179,
66
] | python | en | ['en', 'en', 'en'] | True |
test_options_with_targets | (hass, reversed) | Test we can configure reverse for a target. | Test we can configure reverse for a target. | async def test_options_with_targets(hass, reversed):
"""Test we can configure reverse for a target."""
await setup.async_setup_component(hass, "persistent_notification", {})
config_entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_HOST: "1.1.1.1", CONF_PORT: 12, CONF_SYSTEM_ID: "46"},
... | [
"async",
"def",
"test_options_with_targets",
"(",
"hass",
",",
"reversed",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
... | [
183,
0
] | [
235,
42
] | python | en | ['en', 'en', 'en'] | True |
test_form_user_already_configured_from_dhcp | (hass) | Test we abort if already configured from dhcp. | Test we abort if already configured from dhcp. | async def test_form_user_already_configured_from_dhcp(hass):
"""Test we abort if already configured from dhcp."""
await setup.async_setup_component(hass, "persistent_notification", {})
config_entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_HOST: "1.1.1.1", CONF_PORT: 12, CONF_SYSTEM_ID: ... | [
"async",
"def",
"test_form_user_already_configured_from_dhcp",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DO... | [
238,
0
] | [
268,
48
] | python | en | ['en', 'en', 'en'] | True |
test_already_configured_with_ignored | (hass) | Test ignored entries do not break checking for existing entries. | Test ignored entries do not break checking for existing entries. | async def test_already_configured_with_ignored(hass):
"""Test ignored entries do not break checking for existing entries."""
await setup.async_setup_component(hass, "persistent_notification", {})
config_entry = MockConfigEntry(
domain=DOMAIN, data={}, source=config_entries.SOURCE_IGNORE
)
c... | [
"async",
"def",
"test_already_configured_with_ignored",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
... | [
271,
0
] | [
289,
35
] | python | en | ['en', 'en', 'en'] | True |
test_dhcp_discovery | (hass) | Test we can process the discovery from dhcp. | Test we can process the discovery from dhcp. | async def test_dhcp_discovery(hass):
"""Test we can process the discovery from dhcp."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_DHCP},
data={
... | [
"async",
"def",
"test_dhcp_discovery",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_i... | [
292,
0
] | [
331,
48
] | python | en | ['en', 'en', 'en'] | True |
User.get_absolute_url | (self) | Get url for user's detail view.
Returns:
str: URL for user detail.
| Get url for user's detail view. | def get_absolute_url(self):
"""Get url for user's detail view.
Returns:
str: URL for user detail.
"""
return reverse("users:detail", kwargs={"username": self.username}) | [
"def",
"get_absolute_url",
"(",
"self",
")",
":",
"return",
"reverse",
"(",
"\"users:detail\"",
",",
"kwargs",
"=",
"{",
"\"username\"",
":",
"self",
".",
"username",
"}",
")"
] | [
36,
4
] | [
43,
74
] | python | en | ['da', 'en', 'en'] | True |
newer | (source, target) | Return true if 'source' exists and is more recently modified than
'target', or if 'source' exists and 'target' doesn't. Return false if
both exist and 'target' is the same age or younger than 'source'.
Raise DistutilsFileError if 'source' does not exist.
| Return true if 'source' exists and is more recently modified than
'target', or if 'source' exists and 'target' doesn't. Return false if
both exist and 'target' is the same age or younger than 'source'.
Raise DistutilsFileError if 'source' does not exist.
| def newer (source, target):
"""Return true if 'source' exists and is more recently modified than
'target', or if 'source' exists and 'target' doesn't. Return false if
both exist and 'target' is the same age or younger than 'source'.
Raise DistutilsFileError if 'source' does not exist.
"""
if no... | [
"def",
"newer",
"(",
"source",
",",
"target",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"source",
")",
":",
"raise",
"DistutilsFileError",
"(",
"\"file '%s' does not exist\"",
"%",
"os",
".",
"path",
".",
"abspath",
"(",
"source",
")"... | [
10,
0
] | [
26,
26
] | python | en | ['en', 'en', 'en'] | True |
newer_pairwise | (sources, targets) | Walk two filename lists in parallel, testing if each source is newer
than its corresponding target. Return a pair of lists (sources,
targets) where source is newer than target, according to the semantics
of 'newer()'.
| Walk two filename lists in parallel, testing if each source is newer
than its corresponding target. Return a pair of lists (sources,
targets) where source is newer than target, according to the semantics
of 'newer()'.
| def newer_pairwise (sources, targets):
"""Walk two filename lists in parallel, testing if each source is newer
than its corresponding target. Return a pair of lists (sources,
targets) where source is newer than target, according to the semantics
of 'newer()'.
"""
if len(sources) != len(targets)... | [
"def",
"newer_pairwise",
"(",
"sources",
",",
"targets",
")",
":",
"if",
"len",
"(",
"sources",
")",
"!=",
"len",
"(",
"targets",
")",
":",
"raise",
"ValueError",
"(",
"\"'sources' and 'targets' must be same length\"",
")",
"# build a pair of lists (sources, targets) ... | [
31,
0
] | [
48,
33
] | python | en | ['en', 'en', 'en'] | True |
newer_group | (sources, target, missing='error') | Return true if 'target' is out-of-date with respect to any file
listed in 'sources'. In other words, if 'target' exists and is newer
than every file in 'sources', return false; otherwise return true.
'missing' controls what we do when a source file is missing; the
default ("error") is to blow up with a... | Return true if 'target' is out-of-date with respect to any file
listed in 'sources'. In other words, if 'target' exists and is newer
than every file in 'sources', return false; otherwise return true.
'missing' controls what we do when a source file is missing; the
default ("error") is to blow up with a... | def newer_group (sources, target, missing='error'):
"""Return true if 'target' is out-of-date with respect to any file
listed in 'sources'. In other words, if 'target' exists and is newer
than every file in 'sources', return false; otherwise return true.
'missing' controls what we do when a source file... | [
"def",
"newer_group",
"(",
"sources",
",",
"target",
",",
"missing",
"=",
"'error'",
")",
":",
"# If the target doesn't even exist, then it's definitely out-of-date.",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"target",
")",
":",
"return",
"1",
"# Otherw... | [
53,
0
] | [
89,
16
] | python | en | ['en', 'en', 'en'] | True |
LitterRobotEntity.__init__ | (self, robot: Robot, entity_type: str, hub: LitterRobotHub) | Pass coordinator to CoordinatorEntity. | Pass coordinator to CoordinatorEntity. | def __init__(self, robot: Robot, entity_type: str, hub: LitterRobotHub) -> None:
"""Pass coordinator to CoordinatorEntity."""
super().__init__(hub.coordinator)
self.robot = robot
self.entity_type = entity_type
self.hub = hub | [
"def",
"__init__",
"(",
"self",
",",
"robot",
":",
"Robot",
",",
"entity_type",
":",
"str",
",",
"hub",
":",
"LitterRobotHub",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hub",
".",
"coordinator",
")",
"self",
".",
"robot",
"=",... | [
28,
4
] | [
33,
22
] | python | en | ['en', 'ky', 'en'] | True |
LitterRobotEntity.name | (self) | Return the name of this entity. | Return the name of this entity. | def name(self) -> str:
"""Return the name of this entity."""
return f"{self.robot.name} {self.entity_type}" | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{self.robot.name} {self.entity_type}\""
] | [
36,
4
] | [
38,
54
] | python | en | ['en', 'en', 'en'] | True |
LitterRobotEntity.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self) -> str:
"""Return a unique ID."""
return f"{self.robot.serial}-{self.entity_type}" | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{self.robot.serial}-{self.entity_type}\""
] | [
41,
4
] | [
43,
56
] | python | ca | ['fr', 'ca', 'en'] | False |
LitterRobotEntity.device_info | (self) | Return the device information for a Litter-Robot. | Return the device information for a Litter-Robot. | def device_info(self) -> DeviceInfo:
"""Return the device information for a Litter-Robot."""
return {
"identifiers": {(DOMAIN, self.robot.serial)},
"name": self.robot.name,
"manufacturer": "Litter-Robot",
"model": self.robot.model,
} | [
"def",
"device_info",
"(",
"self",
")",
"->",
"DeviceInfo",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"robot",
".",
"serial",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"robot",
".",
"name",
",",
"\"manufacture... | [
46,
4
] | [
53,
9
] | python | en | ['en', 'en', 'en'] | True |
LitterRobotControlEntity.__init__ | (self, robot: Robot, entity_type: str, hub: LitterRobotHub) | Init a Litter-Robot control entity. | Init a Litter-Robot control entity. | def __init__(self, robot: Robot, entity_type: str, hub: LitterRobotHub) -> None:
"""Init a Litter-Robot control entity."""
super().__init__(robot=robot, entity_type=entity_type, hub=hub)
self._refresh_callback = None | [
"def",
"__init__",
"(",
"self",
",",
"robot",
":",
"Robot",
",",
"entity_type",
":",
"str",
",",
"hub",
":",
"LitterRobotHub",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"robot",
"=",
"robot",
",",
"entity_type",
"=",
"entity_type... | [
59,
4
] | [
62,
37
] | python | en | ['en', 'en', 'en'] | True |
LitterRobotControlEntity.perform_action_and_refresh | (
self, action: MethodType, *args: Any, **kwargs: Any
) | Perform an action and initiates a refresh of the robot data after a few seconds. | Perform an action and initiates a refresh of the robot data after a few seconds. | async def perform_action_and_refresh(
self, action: MethodType, *args: Any, **kwargs: Any
) -> bool:
"""Perform an action and initiates a refresh of the robot data after a few seconds."""
try:
await action(*args, **kwargs)
except InvalidCommandException as ex: # pragma:... | [
"async",
"def",
"perform_action_and_refresh",
"(",
"self",
",",
"action",
":",
"MethodType",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"bool",
":",
"try",
":",
"await",
"action",
"(",
"*",
"args",
",",
"*",
"*",
... | [
64,
4
] | [
80,
19
] | python | en | ['en', 'en', 'en'] | True |
LitterRobotControlEntity.async_call_later_callback | (self, *_) | Perform refresh request on callback. | Perform refresh request on callback. | async def async_call_later_callback(self, *_) -> None:
"""Perform refresh request on callback."""
self._refresh_callback = None
await self.coordinator.async_request_refresh() | [
"async",
"def",
"async_call_later_callback",
"(",
"self",
",",
"*",
"_",
")",
"->",
"None",
":",
"self",
".",
"_refresh_callback",
"=",
"None",
"await",
"self",
".",
"coordinator",
".",
"async_request_refresh",
"(",
")"
] | [
82,
4
] | [
85,
54
] | python | en | ['en', 'en', 'en'] | True |
LitterRobotControlEntity.async_will_remove_from_hass | (self) | Cancel refresh callback when entity is being removed from hass. | Cancel refresh callback when entity is being removed from hass. | async def async_will_remove_from_hass(self) -> None:
"""Cancel refresh callback when entity is being removed from hass."""
self.async_cancel_refresh_callback() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"async_cancel_refresh_callback",
"(",
")"
] | [
87,
4
] | [
89,
44
] | python | en | ['en', 'en', 'en'] | True |
LitterRobotControlEntity.async_cancel_refresh_callback | (self) | Clear the refresh callback if it has not already fired. | Clear the refresh callback if it has not already fired. | def async_cancel_refresh_callback(self):
"""Clear the refresh callback if it has not already fired."""
if self._refresh_callback is not None:
self._refresh_callback()
self._refresh_callback = None | [
"def",
"async_cancel_refresh_callback",
"(",
"self",
")",
":",
"if",
"self",
".",
"_refresh_callback",
"is",
"not",
"None",
":",
"self",
".",
"_refresh_callback",
"(",
")",
"self",
".",
"_refresh_callback",
"=",
"None"
] | [
92,
4
] | [
96,
41
] | python | en | ['en', 'en', 'en'] | True |
LitterRobotControlEntity.parse_time_at_default_timezone | (time_str: str) | Parse a time string and add default timezone. | Parse a time string and add default timezone. | def parse_time_at_default_timezone(time_str: str) -> time | None:
"""Parse a time string and add default timezone."""
parsed_time = dt_util.parse_time(time_str)
if parsed_time is None:
return None
return (
dt_util.start_of_local_day()
.replace(
... | [
"def",
"parse_time_at_default_timezone",
"(",
"time_str",
":",
"str",
")",
"->",
"time",
"|",
"None",
":",
"parsed_time",
"=",
"dt_util",
".",
"parse_time",
"(",
"time_str",
")",
"if",
"parsed_time",
"is",
"None",
":",
"return",
"None",
"return",
"(",
"dt_ut... | [
99,
4
] | [
114,
9
] | python | en | ['en', 'en', 'en'] | True |
store | (hass) | Mock store. | Mock store. | def store(hass):
"""Mock store."""
return auth_store.AuthStore(hass) | [
"def",
"store",
"(",
"hass",
")",
":",
"return",
"auth_store",
".",
"AuthStore",
"(",
"hass",
")"
] | [
16,
0
] | [
18,
37
] | python | en | ['en', 'fy', 'en'] | False |
provider | (hass, store) | Mock provider. | Mock provider. | def provider(hass, store):
"""Mock provider."""
return tn_auth.TrustedNetworksAuthProvider(
hass,
store,
tn_auth.CONFIG_SCHEMA(
{
"type": "trusted_networks",
"trusted_networks": [
"192.168.0.1",
"192.168.... | [
"def",
"provider",
"(",
"hass",
",",
"store",
")",
":",
"return",
"tn_auth",
".",
"TrustedNetworksAuthProvider",
"(",
"hass",
",",
"store",
",",
"tn_auth",
".",
"CONFIG_SCHEMA",
"(",
"{",
"\"type\"",
":",
"\"trusted_networks\"",
",",
"\"trusted_networks\"",
":",... | [
22,
0
] | [
38,
5
] | python | en | ['en', 'sv', 'en'] | False |
provider_with_user | (hass, store) | Mock provider with trusted users config. | Mock provider with trusted users config. | def provider_with_user(hass, store):
"""Mock provider with trusted users config."""
return tn_auth.TrustedNetworksAuthProvider(
hass,
store,
tn_auth.CONFIG_SCHEMA(
{
"type": "trusted_networks",
"trusted_networks": [
"192.168... | [
"def",
"provider_with_user",
"(",
"hass",
",",
"store",
")",
":",
"return",
"tn_auth",
".",
"TrustedNetworksAuthProvider",
"(",
"hass",
",",
"store",
",",
"tn_auth",
".",
"CONFIG_SCHEMA",
"(",
"{",
"\"type\"",
":",
"\"trusted_networks\"",
",",
"\"trusted_networks\... | [
42,
0
] | [
64,
5
] | python | en | ['en', 'en', 'en'] | True |
provider_bypass_login | (hass, store) | Mock provider with allow_bypass_login config. | Mock provider with allow_bypass_login config. | def provider_bypass_login(hass, store):
"""Mock provider with allow_bypass_login config."""
return tn_auth.TrustedNetworksAuthProvider(
hass,
store,
tn_auth.CONFIG_SCHEMA(
{
"type": "trusted_networks",
"trusted_networks": [
... | [
"def",
"provider_bypass_login",
"(",
"hass",
",",
"store",
")",
":",
"return",
"tn_auth",
".",
"TrustedNetworksAuthProvider",
"(",
"hass",
",",
"store",
",",
"tn_auth",
".",
"CONFIG_SCHEMA",
"(",
"{",
"\"type\"",
":",
"\"trusted_networks\"",
",",
"\"trusted_networ... | [
68,
0
] | [
85,
5
] | python | en | ['en', 'en', 'en'] | True |
manager | (hass, store, provider) | Mock manager. | Mock manager. | def manager(hass, store, provider):
"""Mock manager."""
return auth.AuthManager(hass, store, {(provider.type, provider.id): provider}, {}) | [
"def",
"manager",
"(",
"hass",
",",
"store",
",",
"provider",
")",
":",
"return",
"auth",
".",
"AuthManager",
"(",
"hass",
",",
"store",
",",
"{",
"(",
"provider",
".",
"type",
",",
"provider",
".",
"id",
")",
":",
"provider",
"}",
",",
"{",
"}",
... | [
89,
0
] | [
91,
86
] | python | da | ['id', 'da', 'en'] | False |
manager_with_user | (hass, store, provider_with_user) | Mock manager with trusted user. | Mock manager with trusted user. | def manager_with_user(hass, store, provider_with_user):
"""Mock manager with trusted user."""
return auth.AuthManager(
hass,
store,
{(provider_with_user.type, provider_with_user.id): provider_with_user},
{},
) | [
"def",
"manager_with_user",
"(",
"hass",
",",
"store",
",",
"provider_with_user",
")",
":",
"return",
"auth",
".",
"AuthManager",
"(",
"hass",
",",
"store",
",",
"{",
"(",
"provider_with_user",
".",
"type",
",",
"provider_with_user",
".",
"id",
")",
":",
"... | [
95,
0
] | [
102,
5
] | python | en | ['en', 'en', 'en'] | True |
manager_bypass_login | (hass, store, provider_bypass_login) | Mock manager with allow bypass login. | Mock manager with allow bypass login. | def manager_bypass_login(hass, store, provider_bypass_login):
"""Mock manager with allow bypass login."""
return auth.AuthManager(
hass,
store,
{(provider_bypass_login.type, provider_bypass_login.id): provider_bypass_login},
{},
) | [
"def",
"manager_bypass_login",
"(",
"hass",
",",
"store",
",",
"provider_bypass_login",
")",
":",
"return",
"auth",
".",
"AuthManager",
"(",
"hass",
",",
"store",
",",
"{",
"(",
"provider_bypass_login",
".",
"type",
",",
"provider_bypass_login",
".",
"id",
")"... | [
106,
0
] | [
113,
5
] | python | en | ['en', 'en', 'en'] | True |
test_trusted_networks_credentials | (manager, provider) | Test trusted_networks credentials related functions. | Test trusted_networks credentials related functions. | async def test_trusted_networks_credentials(manager, provider):
"""Test trusted_networks credentials related functions."""
owner = await manager.async_create_user("test-owner")
tn_owner_cred = await provider.async_get_or_create_credentials({"user": owner.id})
assert tn_owner_cred.is_new is False
ass... | [
"async",
"def",
"test_trusted_networks_credentials",
"(",
"manager",
",",
"provider",
")",
":",
"owner",
"=",
"await",
"manager",
".",
"async_create_user",
"(",
"\"test-owner\"",
")",
"tn_owner_cred",
"=",
"await",
"provider",
".",
"async_get_or_create_credentials",
"... | [
116,
0
] | [
130,
80
] | python | en | ['en', 'en', 'en'] | True |
test_validate_access | (provider) | Test validate access from trusted networks. | Test validate access from trusted networks. | async def test_validate_access(provider):
"""Test validate access from trusted networks."""
provider.async_validate_access(ip_address("192.168.0.1"))
provider.async_validate_access(ip_address("192.168.128.10"))
provider.async_validate_access(ip_address("::1"))
provider.async_validate_access(ip_addre... | [
"async",
"def",
"test_validate_access",
"(",
"provider",
")",
":",
"provider",
".",
"async_validate_access",
"(",
"ip_address",
"(",
"\"192.168.0.1\"",
")",
")",
"provider",
".",
"async_validate_access",
"(",
"ip_address",
"(",
"\"192.168.128.10\"",
")",
")",
"provi... | [
133,
0
] | [
145,
76
] | python | en | ['en', 'en', 'en'] | True |
test_validate_access_proxy | (hass, provider) | Test validate access from trusted networks are blocked from proxy. | Test validate access from trusted networks are blocked from proxy. | async def test_validate_access_proxy(hass, provider):
"""Test validate access from trusted networks are blocked from proxy."""
await async_setup_component(
hass,
"http",
{
"http": {
CONF_TRUSTED_PROXIES: ["192.168.128.0/31", "fd00::1"],
CONF_U... | [
"async",
"def",
"test_validate_access_proxy",
"(",
"hass",
",",
"provider",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"\"http\"",
":",
"{",
"CONF_TRUSTED_PROXIES",
":",
"[",
"\"192.168.128.0/31\"",
",",
"\"fd00::1\"",
"]",... | [
148,
0
] | [
168,
61
] | python | en | ['en', 'en', 'en'] | True |
test_validate_refresh_token | (provider) | Verify re-validation of refresh token. | Verify re-validation of refresh token. | async def test_validate_refresh_token(provider):
"""Verify re-validation of refresh token."""
with patch.object(provider, "async_validate_access") as mock:
with pytest.raises(tn_auth.InvalidAuthError):
provider.async_validate_refresh_token(Mock(), None)
provider.async_validate_refre... | [
"async",
"def",
"test_validate_refresh_token",
"(",
"provider",
")",
":",
"with",
"patch",
".",
"object",
"(",
"provider",
",",
"\"async_validate_access\"",
")",
"as",
"mock",
":",
"with",
"pytest",
".",
"raises",
"(",
"tn_auth",
".",
"InvalidAuthError",
")",
... | [
171,
0
] | [
178,
61
] | python | en | ['en', 'sv', 'en'] | True |
test_login_flow | (manager, provider) | Test login flow. | Test login flow. | async def test_login_flow(manager, provider):
"""Test login flow."""
owner = await manager.async_create_user("test-owner")
user = await manager.async_create_user("test-user")
# not from trusted network
flow = await provider.async_login_flow({"ip_address": ip_address("127.0.0.1")})
step = await ... | [
"async",
"def",
"test_login_flow",
"(",
"manager",
",",
"provider",
")",
":",
"owner",
"=",
"await",
"manager",
".",
"async_create_user",
"(",
"\"test-owner\"",
")",
"user",
"=",
"await",
"manager",
".",
"async_create_user",
"(",
"\"test-user\"",
")",
"# not fro... | [
181,
0
] | [
205,
42
] | python | en | ['en', 'fy', 'en'] | True |
test_trusted_users_login | (manager_with_user, provider_with_user) | Test available user list changed per different IP. | Test available user list changed per different IP. | async def test_trusted_users_login(manager_with_user, provider_with_user):
"""Test available user list changed per different IP."""
owner = await manager_with_user.async_create_user("test-owner")
sys_user = await manager_with_user.async_create_system_user(
"test-sys-user"
) # system user will n... | [
"async",
"def",
"test_trusted_users_login",
"(",
"manager_with_user",
",",
"provider_with_user",
")",
":",
"owner",
"=",
"await",
"manager_with_user",
".",
"async_create_user",
"(",
"\"test-owner\"",
")",
"sys_user",
"=",
"await",
"manager_with_user",
".",
"async_create... | [
208,
0
] | [
285,
44
] | python | en | ['no', 'en', 'en'] | True |
test_trusted_group_login | (manager_with_user, provider_with_user) | Test config trusted_user with group_id. | Test config trusted_user with group_id. | async def test_trusted_group_login(manager_with_user, provider_with_user):
"""Test config trusted_user with group_id."""
owner = await manager_with_user.async_create_user("test-owner")
# create a user in user group
user = await manager_with_user.async_create_user("test-user")
await manager_with_user... | [
"async",
"def",
"test_trusted_group_login",
"(",
"manager_with_user",
",",
"provider_with_user",
")",
":",
"owner",
"=",
"await",
"manager_with_user",
".",
"async_create_user",
"(",
"\"test-owner\"",
")",
"# create a user in user group",
"user",
"=",
"await",
"manager_wit... | [
288,
0
] | [
338,
36
] | python | en | ['en', 'en', 'en'] | True |
test_bypass_login_flow | (manager_bypass_login, provider_bypass_login) | Test login flow can be bypass if only one user available. | Test login flow can be bypass if only one user available. | async def test_bypass_login_flow(manager_bypass_login, provider_bypass_login):
"""Test login flow can be bypass if only one user available."""
owner = await manager_bypass_login.async_create_user("test-owner")
# not from trusted network
flow = await provider_bypass_login.async_login_flow(
{"ip_... | [
"async",
"def",
"test_bypass_login_flow",
"(",
"manager_bypass_login",
",",
"provider_bypass_login",
")",
":",
"owner",
"=",
"await",
"manager_bypass_login",
".",
"async_create_user",
"(",
"\"test-owner\"",
")",
"# not from trusted network",
"flow",
"=",
"await",
"provide... | [
341,
0
] | [
371,
36
] | python | en | ['en', 'en', 'en'] | True |
validate_input | (hass: core.HomeAssistant, data) | Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
| Validate the user input allows us to connect. | async def validate_input(hass: core.HomeAssistant, data):
"""Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
"""
try:
tado = await hass.async_add_executor_job(
Tado, data[CONF_USERNAME], data[CONF_PASSWORD]
... | [
"async",
"def",
"validate_input",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"data",
")",
":",
"try",
":",
"tado",
"=",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"Tado",
",",
"data",
"[",
"CONF_USERNAME",
"]",
",",
"data",
"[",
"CONF... | [
20,
0
] | [
47,
48
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_user | (self, user_input=None) | Handle the initial step. | Handle the initial step. | async def async_step_user(self, user_input=None):
"""Handle the initial step."""
errors = {}
if user_input is not None:
try:
validated = await validate_input(self.hass, user_input)
except CannotConnect:
errors["base"] = "cannot_connect"
... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"try",
":",
"validated",
"=",
"await",
"validate_input",
"(",
"self",
".",
"hass",
",",
"us... | [
55,
4
] | [
80,
9
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.