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_register_view_bad_data | (mock_cognito, cloud_client) | Test logging out. | Test logging out. | async def test_register_view_bad_data(mock_cognito, cloud_client):
"""Test logging out."""
req = await cloud_client.post(
"/api/cloud/register", json={"email": "hello@bla.com", "not_password": "falcon"}
)
assert req.status == 400
assert len(mock_cognito.logout.mock_calls) == 0 | [
"async",
"def",
"test_register_view_bad_data",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"req",
"=",
"await",
"cloud_client",
".",
"post",
"(",
"\"/api/cloud/register\"",
",",
"json",
"=",
"{",
"\"email\"",
":",
"\"hello@bla.com\"",
",",
"\"not_password\""... | [
219,
0
] | [
225,
51
] | python | en | ['it', 'en', 'en'] | True |
test_register_view_request_timeout | (mock_cognito, cloud_client) | Test timeout while logging out. | Test timeout while logging out. | async def test_register_view_request_timeout(mock_cognito, cloud_client):
"""Test timeout while logging out."""
mock_cognito.register.side_effect = asyncio.TimeoutError
req = await cloud_client.post(
"/api/cloud/register", json={"email": "hello@bla.com", "password": "falcon42"}
)
assert req.... | [
"async",
"def",
"test_register_view_request_timeout",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"mock_cognito",
".",
"register",
".",
"side_effect",
"=",
"asyncio",
".",
"TimeoutError",
"req",
"=",
"await",
"cloud_client",
".",
"post",
"(",
"\"/api/cloud/r... | [
228,
0
] | [
234,
28
] | python | en | ['en', 'en', 'en'] | True |
test_register_view_unknown_error | (mock_cognito, cloud_client) | Test unknown error while logging out. | Test unknown error while logging out. | async def test_register_view_unknown_error(mock_cognito, cloud_client):
"""Test unknown error while logging out."""
mock_cognito.register.side_effect = UnknownError
req = await cloud_client.post(
"/api/cloud/register", json={"email": "hello@bla.com", "password": "falcon42"}
)
assert req.stat... | [
"async",
"def",
"test_register_view_unknown_error",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"mock_cognito",
".",
"register",
".",
"side_effect",
"=",
"UnknownError",
"req",
"=",
"await",
"cloud_client",
".",
"post",
"(",
"\"/api/cloud/register\"",
",",
"... | [
237,
0
] | [
243,
28
] | python | en | ['en', 'en', 'en'] | True |
test_forgot_password_view | (mock_cognito, cloud_client) | Test logging out. | Test logging out. | async def test_forgot_password_view(mock_cognito, cloud_client):
"""Test logging out."""
req = await cloud_client.post(
"/api/cloud/forgot_password", json={"email": "hello@bla.com"}
)
assert req.status == 200
assert len(mock_cognito.initiate_forgot_password.mock_calls) == 1 | [
"async",
"def",
"test_forgot_password_view",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"req",
"=",
"await",
"cloud_client",
".",
"post",
"(",
"\"/api/cloud/forgot_password\"",
",",
"json",
"=",
"{",
"\"email\"",
":",
"\"hello@bla.com\"",
"}",
")",
"asser... | [
246,
0
] | [
252,
69
] | python | en | ['it', 'en', 'en'] | True |
test_forgot_password_view_bad_data | (mock_cognito, cloud_client) | Test logging out. | Test logging out. | async def test_forgot_password_view_bad_data(mock_cognito, cloud_client):
"""Test logging out."""
req = await cloud_client.post(
"/api/cloud/forgot_password", json={"not_email": "hello@bla.com"}
)
assert req.status == 400
assert len(mock_cognito.initiate_forgot_password.mock_calls) == 0 | [
"async",
"def",
"test_forgot_password_view_bad_data",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"req",
"=",
"await",
"cloud_client",
".",
"post",
"(",
"\"/api/cloud/forgot_password\"",
",",
"json",
"=",
"{",
"\"not_email\"",
":",
"\"hello@bla.com\"",
"}",
... | [
255,
0
] | [
261,
69
] | python | en | ['it', 'en', 'en'] | True |
test_forgot_password_view_request_timeout | (mock_cognito, cloud_client) | Test timeout while logging out. | Test timeout while logging out. | async def test_forgot_password_view_request_timeout(mock_cognito, cloud_client):
"""Test timeout while logging out."""
mock_cognito.initiate_forgot_password.side_effect = asyncio.TimeoutError
req = await cloud_client.post(
"/api/cloud/forgot_password", json={"email": "hello@bla.com"}
)
asser... | [
"async",
"def",
"test_forgot_password_view_request_timeout",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"mock_cognito",
".",
"initiate_forgot_password",
".",
"side_effect",
"=",
"asyncio",
".",
"TimeoutError",
"req",
"=",
"await",
"cloud_client",
".",
"post",
... | [
264,
0
] | [
270,
28
] | python | en | ['en', 'en', 'en'] | True |
test_forgot_password_view_unknown_error | (mock_cognito, cloud_client) | Test unknown error while logging out. | Test unknown error while logging out. | async def test_forgot_password_view_unknown_error(mock_cognito, cloud_client):
"""Test unknown error while logging out."""
mock_cognito.initiate_forgot_password.side_effect = UnknownError
req = await cloud_client.post(
"/api/cloud/forgot_password", json={"email": "hello@bla.com"}
)
assert re... | [
"async",
"def",
"test_forgot_password_view_unknown_error",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"mock_cognito",
".",
"initiate_forgot_password",
".",
"side_effect",
"=",
"UnknownError",
"req",
"=",
"await",
"cloud_client",
".",
"post",
"(",
"\"/api/cloud/... | [
273,
0
] | [
279,
28
] | python | en | ['en', 'en', 'en'] | True |
test_forgot_password_view_aiohttp_error | (mock_cognito, cloud_client) | Test unknown error while logging out. | Test unknown error while logging out. | async def test_forgot_password_view_aiohttp_error(mock_cognito, cloud_client):
"""Test unknown error while logging out."""
mock_cognito.initiate_forgot_password.side_effect = aiohttp.ClientResponseError(
Mock(), Mock()
)
req = await cloud_client.post(
"/api/cloud/forgot_password", json={... | [
"async",
"def",
"test_forgot_password_view_aiohttp_error",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"mock_cognito",
".",
"initiate_forgot_password",
".",
"side_effect",
"=",
"aiohttp",
".",
"ClientResponseError",
"(",
"Mock",
"(",
")",
",",
"Mock",
"(",
"... | [
282,
0
] | [
290,
28
] | python | en | ['en', 'en', 'en'] | True |
test_resend_confirm_view | (mock_cognito, cloud_client) | Test logging out. | Test logging out. | async def test_resend_confirm_view(mock_cognito, cloud_client):
"""Test logging out."""
req = await cloud_client.post(
"/api/cloud/resend_confirm", json={"email": "hello@bla.com"}
)
assert req.status == 200
assert len(mock_cognito.client.resend_confirmation_code.mock_calls) == 1 | [
"async",
"def",
"test_resend_confirm_view",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"req",
"=",
"await",
"cloud_client",
".",
"post",
"(",
"\"/api/cloud/resend_confirm\"",
",",
"json",
"=",
"{",
"\"email\"",
":",
"\"hello@bla.com\"",
"}",
")",
"assert"... | [
293,
0
] | [
299,
76
] | python | en | ['it', 'en', 'en'] | True |
test_resend_confirm_view_bad_data | (mock_cognito, cloud_client) | Test logging out. | Test logging out. | async def test_resend_confirm_view_bad_data(mock_cognito, cloud_client):
"""Test logging out."""
req = await cloud_client.post(
"/api/cloud/resend_confirm", json={"not_email": "hello@bla.com"}
)
assert req.status == 400
assert len(mock_cognito.client.resend_confirmation_code.mock_calls) == 0 | [
"async",
"def",
"test_resend_confirm_view_bad_data",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"req",
"=",
"await",
"cloud_client",
".",
"post",
"(",
"\"/api/cloud/resend_confirm\"",
",",
"json",
"=",
"{",
"\"not_email\"",
":",
"\"hello@bla.com\"",
"}",
")... | [
302,
0
] | [
308,
76
] | python | en | ['it', 'en', 'en'] | True |
test_resend_confirm_view_request_timeout | (mock_cognito, cloud_client) | Test timeout while logging out. | Test timeout while logging out. | async def test_resend_confirm_view_request_timeout(mock_cognito, cloud_client):
"""Test timeout while logging out."""
mock_cognito.client.resend_confirmation_code.side_effect = asyncio.TimeoutError
req = await cloud_client.post(
"/api/cloud/resend_confirm", json={"email": "hello@bla.com"}
)
... | [
"async",
"def",
"test_resend_confirm_view_request_timeout",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"mock_cognito",
".",
"client",
".",
"resend_confirmation_code",
".",
"side_effect",
"=",
"asyncio",
".",
"TimeoutError",
"req",
"=",
"await",
"cloud_client",
... | [
311,
0
] | [
317,
28
] | python | en | ['en', 'en', 'en'] | True |
test_resend_confirm_view_unknown_error | (mock_cognito, cloud_client) | Test unknown error while logging out. | Test unknown error while logging out. | async def test_resend_confirm_view_unknown_error(mock_cognito, cloud_client):
"""Test unknown error while logging out."""
mock_cognito.client.resend_confirmation_code.side_effect = UnknownError
req = await cloud_client.post(
"/api/cloud/resend_confirm", json={"email": "hello@bla.com"}
)
asse... | [
"async",
"def",
"test_resend_confirm_view_unknown_error",
"(",
"mock_cognito",
",",
"cloud_client",
")",
":",
"mock_cognito",
".",
"client",
".",
"resend_confirmation_code",
".",
"side_effect",
"=",
"UnknownError",
"req",
"=",
"await",
"cloud_client",
".",
"post",
"("... | [
320,
0
] | [
326,
28
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_status | (
hass, hass_ws_client, mock_cloud_fixture, mock_cloud_login
) | Test querying the status. | Test querying the status. | async def test_websocket_status(
hass, hass_ws_client, mock_cloud_fixture, mock_cloud_login
):
"""Test querying the status."""
hass.data[DOMAIN].iot.state = STATE_CONNECTED
client = await hass_ws_client(hass)
with patch.dict(
"homeassistant.components.google_assistant.const.DOMAIN_TO_GOOGLE... | [
"async",
"def",
"test_websocket_status",
"(",
"hass",
",",
"hass_ws_client",
",",
"mock_cloud_fixture",
",",
"mock_cloud_login",
")",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"iot",
".",
"state",
"=",
"STATE_CONNECTED",
"client",
"=",
"await",
"hass_... | [
329,
0
] | [
383,
5
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_status_not_logged_in | (hass, hass_ws_client) | Test querying the status. | Test querying the status. | async def test_websocket_status_not_logged_in(hass, hass_ws_client):
"""Test querying the status."""
client = await hass_ws_client(hass)
await client.send_json({"id": 5, "type": "cloud/status"})
response = await client.receive_json()
assert response["result"] == {"logged_in": False, "cloud": "discon... | [
"async",
"def",
"test_websocket_status_not_logged_in",
"(",
"hass",
",",
"hass_ws_client",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"await",
"client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"cloud/s... | [
386,
0
] | [
391,
78
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_subscription_reconnect | (
hass, hass_ws_client, aioclient_mock, mock_auth, mock_cloud_login
) | Test querying the status and connecting because valid account. | Test querying the status and connecting because valid account. | async def test_websocket_subscription_reconnect(
hass, hass_ws_client, aioclient_mock, mock_auth, mock_cloud_login
):
"""Test querying the status and connecting because valid account."""
aioclient_mock.get(SUBSCRIPTION_INFO_URL, json={"provider": "stripe"})
client = await hass_ws_client(hass)
with ... | [
"async",
"def",
"test_websocket_subscription_reconnect",
"(",
"hass",
",",
"hass_ws_client",
",",
"aioclient_mock",
",",
"mock_auth",
",",
"mock_cloud_login",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"SUBSCRIPTION_INFO_URL",
",",
"json",
"=",
"{",
"\"provider\"",
... | [
394,
0
] | [
409,
44
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_subscription_no_reconnect_if_connected | (
hass, hass_ws_client, aioclient_mock, mock_auth, mock_cloud_login
) | Test querying the status and not reconnecting because still expired. | Test querying the status and not reconnecting because still expired. | async def test_websocket_subscription_no_reconnect_if_connected(
hass, hass_ws_client, aioclient_mock, mock_auth, mock_cloud_login
):
"""Test querying the status and not reconnecting because still expired."""
aioclient_mock.get(SUBSCRIPTION_INFO_URL, json={"provider": "stripe"})
hass.data[DOMAIN].iot.st... | [
"async",
"def",
"test_websocket_subscription_no_reconnect_if_connected",
"(",
"hass",
",",
"hass_ws_client",
",",
"aioclient_mock",
",",
"mock_auth",
",",
"mock_cloud_login",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"SUBSCRIPTION_INFO_URL",
",",
"json",
"=",
"{",
... | [
412,
0
] | [
428,
44
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_subscription_no_reconnect_if_expired | (
hass, hass_ws_client, aioclient_mock, mock_auth, mock_cloud_login
) | Test querying the status and not reconnecting because still expired. | Test querying the status and not reconnecting because still expired. | async def test_websocket_subscription_no_reconnect_if_expired(
hass, hass_ws_client, aioclient_mock, mock_auth, mock_cloud_login
):
"""Test querying the status and not reconnecting because still expired."""
aioclient_mock.get(SUBSCRIPTION_INFO_URL, json={"provider": "stripe"})
client = await hass_ws_cli... | [
"async",
"def",
"test_websocket_subscription_no_reconnect_if_expired",
"(",
"hass",
",",
"hass_ws_client",
",",
"aioclient_mock",
",",
"mock_auth",
",",
"mock_cloud_login",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"SUBSCRIPTION_INFO_URL",
",",
"json",
"=",
"{",
"\... | [
431,
0
] | [
446,
44
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_subscription_fail | (
hass, hass_ws_client, aioclient_mock, mock_auth, mock_cloud_login
) | Test querying the status. | Test querying the status. | async def test_websocket_subscription_fail(
hass, hass_ws_client, aioclient_mock, mock_auth, mock_cloud_login
):
"""Test querying the status."""
aioclient_mock.get(SUBSCRIPTION_INFO_URL, status=HTTP_INTERNAL_SERVER_ERROR)
client = await hass_ws_client(hass)
await client.send_json({"id": 5, "type": "... | [
"async",
"def",
"test_websocket_subscription_fail",
"(",
"hass",
",",
"hass_ws_client",
",",
"aioclient_mock",
",",
"mock_auth",
",",
"mock_cloud_login",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"SUBSCRIPTION_INFO_URL",
",",
"status",
"=",
"HTTP_INTERNAL_SERVER_ERRO... | [
449,
0
] | [
459,
56
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_subscription_not_logged_in | (hass, hass_ws_client) | Test querying the status. | Test querying the status. | async def test_websocket_subscription_not_logged_in(hass, hass_ws_client):
"""Test querying the status."""
client = await hass_ws_client(hass)
with patch(
"hass_nabucasa.Cloud.fetch_subscription_info",
return_value={"return": "value"},
):
await client.send_json({"id": 5, "type": ... | [
"async",
"def",
"test_websocket_subscription_not_logged_in",
"(",
"hass",
",",
"hass_ws_client",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"hass_nabucasa.Cloud.fetch_subscription_info\"",
",",
"return_value",
"=",
"{",... | [
462,
0
] | [
473,
55
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_update_preferences | (
hass, hass_ws_client, aioclient_mock, setup_api, mock_cloud_login
) | Test updating preference. | Test updating preference. | async def test_websocket_update_preferences(
hass, hass_ws_client, aioclient_mock, setup_api, mock_cloud_login
):
"""Test updating preference."""
assert setup_api.google_enabled
assert setup_api.alexa_enabled
assert setup_api.google_secure_devices_pin is None
client = await hass_ws_client(hass)
... | [
"async",
"def",
"test_websocket_update_preferences",
"(",
"hass",
",",
"hass_ws_client",
",",
"aioclient_mock",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"assert",
"setup_api",
".",
"google_enabled",
"assert",
"setup_api",
".",
"alexa_enabled",
"assert",
"s... | [
476,
0
] | [
502,
71
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_update_preferences_require_relink | (
hass, hass_ws_client, aioclient_mock, setup_api, mock_cloud_login
) | Test updating preference requires relink. | Test updating preference requires relink. | async def test_websocket_update_preferences_require_relink(
hass, hass_ws_client, aioclient_mock, setup_api, mock_cloud_login
):
"""Test updating preference requires relink."""
client = await hass_ws_client(hass)
with patch(
"homeassistant.components.cloud.alexa_config.AlexaConfig"
".as... | [
"async",
"def",
"test_websocket_update_preferences_require_relink",
"(",
"hass",
",",
"hass_ws_client",
",",
"aioclient_mock",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"h... | [
505,
0
] | [
522,
54
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_update_preferences_no_token | (
hass, hass_ws_client, aioclient_mock, setup_api, mock_cloud_login
) | Test updating preference no token available. | Test updating preference no token available. | async def test_websocket_update_preferences_no_token(
hass, hass_ws_client, aioclient_mock, setup_api, mock_cloud_login
):
"""Test updating preference no token available."""
client = await hass_ws_client(hass)
with patch(
"homeassistant.components.cloud.alexa_config.AlexaConfig"
".async... | [
"async",
"def",
"test_websocket_update_preferences_no_token",
"(",
"hass",
",",
"hass_ws_client",
",",
"aioclient_mock",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"homeass... | [
525,
0
] | [
542,
54
] | python | en | ['en', 'en', 'en'] | True |
test_enabling_webhook | (hass, hass_ws_client, setup_api, mock_cloud_login) | Test we call right code to enable webhooks. | Test we call right code to enable webhooks. | async def test_enabling_webhook(hass, hass_ws_client, setup_api, mock_cloud_login):
"""Test we call right code to enable webhooks."""
client = await hass_ws_client(hass)
with patch(
"hass_nabucasa.cloudhooks.Cloudhooks.async_create", return_value={}
) as mock_enable:
await client.send_js... | [
"async",
"def",
"test_enabling_webhook",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"hass_nabucasa.cloudhooks.Cloudhooks.async_create\"",
... | [
545,
0
] | [
558,
63
] | python | en | ['en', 'en', 'en'] | True |
test_disabling_webhook | (hass, hass_ws_client, setup_api, mock_cloud_login) | Test we call right code to disable webhooks. | Test we call right code to disable webhooks. | async def test_disabling_webhook(hass, hass_ws_client, setup_api, mock_cloud_login):
"""Test we call right code to disable webhooks."""
client = await hass_ws_client(hass)
with patch("hass_nabucasa.cloudhooks.Cloudhooks.async_delete") as mock_disable:
await client.send_json(
{"id": 5, "t... | [
"async",
"def",
"test_disabling_webhook",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"hass_nabucasa.cloudhooks.Cloudhooks.async_delete\"",
... | [
561,
0
] | [
572,
64
] | python | en | ['en', 'en', 'en'] | True |
test_enabling_remote | (hass, hass_ws_client, setup_api, mock_cloud_login) | Test we call right code to enable remote UI. | Test we call right code to enable remote UI. | async def test_enabling_remote(hass, hass_ws_client, setup_api, mock_cloud_login):
"""Test we call right code to enable remote UI."""
client = await hass_ws_client(hass)
cloud = hass.data[DOMAIN]
with patch("hass_nabucasa.remote.RemoteUI.connect") as mock_connect:
await client.send_json({"id": ... | [
"async",
"def",
"test_enabling_remote",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"cloud",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"with",
"patch... | [
575,
0
] | [
586,
44
] | python | en | ['en', 'en', 'en'] | True |
test_disabling_remote | (hass, hass_ws_client, setup_api, mock_cloud_login) | Test we call right code to disable remote UI. | Test we call right code to disable remote UI. | async def test_disabling_remote(hass, hass_ws_client, setup_api, mock_cloud_login):
"""Test we call right code to disable remote UI."""
client = await hass_ws_client(hass)
cloud = hass.data[DOMAIN]
with patch("hass_nabucasa.remote.RemoteUI.disconnect") as mock_disconnect:
await client.send_json... | [
"async",
"def",
"test_disabling_remote",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"cloud",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"with",
"patc... | [
589,
0
] | [
600,
47
] | python | en | ['en', 'en', 'en'] | True |
test_enabling_remote_trusted_networks_local4 | (
hass, hass_ws_client, setup_api, mock_cloud_login
) | Test we cannot enable remote UI when trusted networks active. | Test we cannot enable remote UI when trusted networks active. | async def test_enabling_remote_trusted_networks_local4(
hass, hass_ws_client, setup_api, mock_cloud_login
):
"""Test we cannot enable remote UI when trusted networks active."""
# pylint: disable=protected-access
hass.auth._providers[
("trusted_networks", None)
] = tn_auth.TrustedNetworksAuth... | [
"async",
"def",
"test_enabling_remote_trusted_networks_local4",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"# pylint: disable=protected-access",
"hass",
".",
"auth",
".",
"_providers",
"[",
"(",
"\"trusted_networks\"",
",",
... | [
603,
0
] | [
633,
44
] | python | en | ['en', 'en', 'en'] | True |
test_enabling_remote_trusted_networks_local6 | (
hass, hass_ws_client, setup_api, mock_cloud_login
) | Test we cannot enable remote UI when trusted networks active. | Test we cannot enable remote UI when trusted networks active. | async def test_enabling_remote_trusted_networks_local6(
hass, hass_ws_client, setup_api, mock_cloud_login
):
"""Test we cannot enable remote UI when trusted networks active."""
# pylint: disable=protected-access
hass.auth._providers[
("trusted_networks", None)
] = tn_auth.TrustedNetworksAuth... | [
"async",
"def",
"test_enabling_remote_trusted_networks_local6",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"# pylint: disable=protected-access",
"hass",
".",
"auth",
".",
"_providers",
"[",
"(",
"\"trusted_networks\"",
",",
... | [
636,
0
] | [
666,
44
] | python | en | ['en', 'en', 'en'] | True |
test_enabling_remote_trusted_networks_other | (
hass, hass_ws_client, setup_api, mock_cloud_login
) | Test we can enable remote UI when trusted networks active. | Test we can enable remote UI when trusted networks active. | async def test_enabling_remote_trusted_networks_other(
hass, hass_ws_client, setup_api, mock_cloud_login
):
"""Test we can enable remote UI when trusted networks active."""
# pylint: disable=protected-access
hass.auth._providers[
("trusted_networks", None)
] = tn_auth.TrustedNetworksAuthProv... | [
"async",
"def",
"test_enabling_remote_trusted_networks_other",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"# pylint: disable=protected-access",
"hass",
".",
"auth",
".",
"_providers",
"[",
"(",
"\"trusted_networks\"",
",",
"... | [
669,
0
] | [
694,
44
] | python | en | ['en', 'en', 'en'] | True |
test_list_google_entities | (hass, hass_ws_client, setup_api, mock_cloud_login) | Test that we can list Google entities. | Test that we can list Google entities. | async def test_list_google_entities(hass, hass_ws_client, setup_api, mock_cloud_login):
"""Test that we can list Google entities."""
client = await hass_ws_client(hass)
entity = GoogleEntity(
hass, MockConfig(should_expose=lambda *_: False), State("light.kitchen", "on")
)
entity2 = GoogleEnt... | [
"async",
"def",
"test_list_google_entities",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"entity",
"=",
"GoogleEntity",
"(",
"hass",
",",
"MockConfig",
"(",
... | [
697,
0
] | [
726,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_google_entity | (hass, hass_ws_client, setup_api, mock_cloud_login) | Test that we can update config of a Google entity. | Test that we can update config of a Google entity. | async def test_update_google_entity(hass, hass_ws_client, setup_api, mock_cloud_login):
"""Test that we can update config of a Google entity."""
client = await hass_ws_client(hass)
await client.send_json(
{
"id": 5,
"type": "cloud/google_assistant/entities/update",
... | [
"async",
"def",
"test_update_google_entity",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"await",
"client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",... | [
729,
0
] | [
771,
5
] | python | en | ['en', 'en', 'en'] | True |
test_enabling_remote_trusted_proxies_local4 | (
hass, hass_ws_client, setup_api, mock_cloud_login
) | Test we cannot enable remote UI when trusted networks active. | Test we cannot enable remote UI when trusted networks active. | async def test_enabling_remote_trusted_proxies_local4(
hass, hass_ws_client, setup_api, mock_cloud_login
):
"""Test we cannot enable remote UI when trusted networks active."""
hass.http.trusted_proxies.append(ip_network("127.0.0.1"))
client = await hass_ws_client(hass)
with patch(
"hass_na... | [
"async",
"def",
"test_enabling_remote_trusted_proxies_local4",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"hass",
".",
"http",
".",
"trusted_proxies",
".",
"append",
"(",
"ip_network",
"(",
"\"127.0.0.1\"",
")",
")",
"... | [
774,
0
] | [
795,
44
] | python | en | ['en', 'en', 'en'] | True |
test_enabling_remote_trusted_proxies_local6 | (
hass, hass_ws_client, setup_api, mock_cloud_login
) | Test we cannot enable remote UI when trusted networks active. | Test we cannot enable remote UI when trusted networks active. | async def test_enabling_remote_trusted_proxies_local6(
hass, hass_ws_client, setup_api, mock_cloud_login
):
"""Test we cannot enable remote UI when trusted networks active."""
hass.http.trusted_proxies.append(ip_network("::1"))
client = await hass_ws_client(hass)
with patch(
"hass_nabucasa... | [
"async",
"def",
"test_enabling_remote_trusted_proxies_local6",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"hass",
".",
"http",
".",
"trusted_proxies",
".",
"append",
"(",
"ip_network",
"(",
"\"::1\"",
")",
")",
"client... | [
798,
0
] | [
819,
44
] | python | en | ['en', 'en', 'en'] | True |
test_list_alexa_entities | (hass, hass_ws_client, setup_api, mock_cloud_login) | Test that we can list Alexa entities. | Test that we can list Alexa entities. | async def test_list_alexa_entities(hass, hass_ws_client, setup_api, mock_cloud_login):
"""Test that we can list Alexa entities."""
client = await hass_ws_client(hass)
entity = LightCapabilities(
hass, MagicMock(entity_config={}), State("light.kitchen", "on")
)
with patch(
"homeassist... | [
"async",
"def",
"test_list_alexa_entities",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"entity",
"=",
"LightCapabilities",
"(",
"hass",
",",
"MagicMock",
"(... | [
822,
0
] | [
841,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_alexa_entity | (hass, hass_ws_client, setup_api, mock_cloud_login) | Test that we can update config of an Alexa entity. | Test that we can update config of an Alexa entity. | async def test_update_alexa_entity(hass, hass_ws_client, setup_api, mock_cloud_login):
"""Test that we can update config of an Alexa entity."""
client = await hass_ws_client(hass)
await client.send_json(
{
"id": 5,
"type": "cloud/alexa/entities/update",
"entity_id... | [
"async",
"def",
"test_update_alexa_entity",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"await",
"client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
... | [
844,
0
] | [
873,
81
] | python | en | ['en', 'en', 'en'] | True |
test_sync_alexa_entities_timeout | (
hass, hass_ws_client, setup_api, mock_cloud_login
) | Test that timeout syncing Alexa entities. | Test that timeout syncing Alexa entities. | async def test_sync_alexa_entities_timeout(
hass, hass_ws_client, setup_api, mock_cloud_login
):
"""Test that timeout syncing Alexa entities."""
client = await hass_ws_client(hass)
with patch(
"homeassistant.components.cloud.alexa_config.AlexaConfig"
".async_sync_entities",
side_... | [
"async",
"def",
"test_sync_alexa_entities_timeout",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"homeassistant.components.cloud.alexa_config.... | [
876,
0
] | [
890,
49
] | python | en | ['en', 'en', 'en'] | True |
test_sync_alexa_entities_no_token | (
hass, hass_ws_client, setup_api, mock_cloud_login
) | Test sync Alexa entities when we have no token. | Test sync Alexa entities when we have no token. | async def test_sync_alexa_entities_no_token(
hass, hass_ws_client, setup_api, mock_cloud_login
):
"""Test sync Alexa entities when we have no token."""
client = await hass_ws_client(hass)
with patch(
"homeassistant.components.cloud.alexa_config.AlexaConfig"
".async_sync_entities",
... | [
"async",
"def",
"test_sync_alexa_entities_no_token",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"homeassistant.components.cloud.alexa_config... | [
893,
0
] | [
907,
54
] | python | en | ['en', 'en', 'en'] | True |
test_enable_alexa_state_report_fail | (
hass, hass_ws_client, setup_api, mock_cloud_login
) | Test enable Alexa entities state reporting when no token available. | Test enable Alexa entities state reporting when no token available. | async def test_enable_alexa_state_report_fail(
hass, hass_ws_client, setup_api, mock_cloud_login
):
"""Test enable Alexa entities state reporting when no token available."""
client = await hass_ws_client(hass)
with patch(
"homeassistant.components.cloud.alexa_config.AlexaConfig"
".async_... | [
"async",
"def",
"test_enable_alexa_state_report_fail",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
",",
"mock_cloud_login",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"homeassistant.components.cloud.alexa_conf... | [
910,
0
] | [
924,
54
] | python | en | ['en', 'en', 'en'] | True |
test_thingtalk_convert | (hass, hass_ws_client, setup_api) | Test that we can convert a query. | Test that we can convert a query. | async def test_thingtalk_convert(hass, hass_ws_client, setup_api):
"""Test that we can convert a query."""
client = await hass_ws_client(hass)
with patch(
"homeassistant.components.cloud.http_api.thingtalk.async_convert",
return_value={"hello": "world"},
):
await client.send_jso... | [
"async",
"def",
"test_thingtalk_convert",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"homeassistant.components.cloud.http_api.thingtalk.async_convert\"",
",",
"retur... | [
927,
0
] | [
941,
51
] | python | en | ['en', 'en', 'en'] | True |
test_thingtalk_convert_timeout | (hass, hass_ws_client, setup_api) | Test that we can convert a query. | Test that we can convert a query. | async def test_thingtalk_convert_timeout(hass, hass_ws_client, setup_api):
"""Test that we can convert a query."""
client = await hass_ws_client(hass)
with patch(
"homeassistant.components.cloud.http_api.thingtalk.async_convert",
side_effect=asyncio.TimeoutError,
):
await client... | [
"async",
"def",
"test_thingtalk_convert_timeout",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"homeassistant.components.cloud.http_api.thingtalk.async_convert\"",
",",
... | [
944,
0
] | [
958,
49
] | python | en | ['en', 'en', 'en'] | True |
test_thingtalk_convert_internal | (hass, hass_ws_client, setup_api) | Test that we can convert a query. | Test that we can convert a query. | async def test_thingtalk_convert_internal(hass, hass_ws_client, setup_api):
"""Test that we can convert a query."""
client = await hass_ws_client(hass)
with patch(
"homeassistant.components.cloud.http_api.thingtalk.async_convert",
side_effect=thingtalk.ThingTalkConversionError("Did not unde... | [
"async",
"def",
"test_thingtalk_convert_internal",
"(",
"hass",
",",
"hass_ws_client",
",",
"setup_api",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"homeassistant.components.cloud.http_api.thingtalk.async_convert\"",
",",... | [
961,
0
] | [
976,
63
] | python | en | ['en', 'en', 'en'] | True |
test_duplicate_error | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test that errors are shown when duplicates are added. | Test that errors are shown when duplicates are added. | async def test_duplicate_error(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test that errors are shown when duplicates are added."""
await setup_integration(hass, aioclient_mock, skip_entry_setup=True)
mock_connection(aioclient_mock)
user_input = {CONF_HOST: HOST}
... | [
"async",
"def",
"test_duplicate_error",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
",",
"skip_entry_setup",
"=",
"True",
")",
"... | [
23,
0
] | [
52,
51
] | python | en | ['en', 'en', 'en'] | True |
test_form | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test the user step. | Test the user step. | async def test_form(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the user step."""
await async_setup_component(hass, "persistent_notification", {})
mock_connection(aioclient_mock)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={CONF_S... | [
"async",
"def",
"test_form",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"mock_connection",
... | [
55,
0
] | [
87,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_cannot_connect | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test we handle cannot connect roku error. | Test we handle cannot connect roku error. | async def test_form_cannot_connect(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test we handle cannot connect roku error."""
mock_connection(aioclient_mock, error=True)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={CONF_SOURCE: SOURCE_USER}
... | [
"async",
"def",
"test_form_cannot_connect",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"mock_connection",
"(",
"aioclient_mock",
",",
"error",
"=",
"True",
")",
"result",
"=",
"await",
"hass",
... | [
90,
0
] | [
105,
57
] | python | en | ['en', 'en', 'en'] | True |
test_form_unknown_error | (hass: HomeAssistantType) | Test we handle unknown error. | Test we handle unknown error. | async def test_form_unknown_error(hass: HomeAssistantType) -> None:
"""Test we handle unknown error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={CONF_SOURCE: SOURCE_USER}
)
user_input = {CONF_HOST: HOST}
with patch(
"homeassistant.components.roku.config_f... | [
"async",
"def",
"test_form_unknown_error",
"(",
"hass",
":",
"HomeAssistantType",
")",
"->",
"None",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"CONF_SOURCE",
":",
"SOU... | [
108,
0
] | [
127,
51
] | python | en | ['en', 'de', 'en'] | True |
test_ssdp_cannot_connect | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test we abort SSDP flow on connection error. | Test we abort SSDP flow on connection error. | async def test_ssdp_cannot_connect(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test we abort SSDP flow on connection error."""
mock_connection(aioclient_mock, error=True)
discovery_info = MOCK_SSDP_DISCOVERY_INFO.copy()
result = await hass.config_entries.flow.async_i... | [
"async",
"def",
"test_ssdp_cannot_connect",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"mock_connection",
"(",
"aioclient_mock",
",",
"error",
"=",
"True",
")",
"discovery_info",
"=",
"MOCK_SSDP_... | [
130,
0
] | [
144,
47
] | python | en | ['en', 'de', 'en'] | True |
test_ssdp_unknown_error | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test we abort SSDP flow on unknown error. | Test we abort SSDP flow on unknown error. | async def test_ssdp_unknown_error(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test we abort SSDP flow on unknown error."""
discovery_info = MOCK_SSDP_DISCOVERY_INFO.copy()
with patch(
"homeassistant.components.roku.config_flow.Roku.update",
side_effect=Exc... | [
"async",
"def",
"test_ssdp_unknown_error",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"discovery_info",
"=",
"MOCK_SSDP_DISCOVERY_INFO",
".",
"copy",
"(",
")",
"with",
"patch",
"(",
"\"homeassist... | [
147,
0
] | [
163,
40
] | python | en | ['en', 'de', 'en'] | True |
test_ssdp_discovery | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test the SSDP discovery flow. | Test the SSDP discovery flow. | async def test_ssdp_discovery(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the SSDP discovery flow."""
mock_connection(aioclient_mock)
discovery_info = MOCK_SSDP_DISCOVERY_INFO.copy()
result = await hass.config_entries.flow.async_init(
DOMAIN, context={CO... | [
"async",
"def",
"test_ssdp_discovery",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"mock_connection",
"(",
"aioclient_mock",
")",
"discovery_info",
"=",
"MOCK_SSDP_DISCOVERY_INFO",
".",
"copy",
"(",... | [
166,
0
] | [
200,
48
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Dyson 360 Eye robot vacuum platform. | Set up the Dyson 360 Eye robot vacuum platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Dyson 360 Eye robot vacuum platform."""
_LOGGER.debug("Creating new Dyson 360 Eye robot vacuum")
if DYSON_360_EYE_DEVICES not in hass.data:
hass.data[DYSON_360_EYE_DEVICES] = []
# Get Dyson Devices from parent co... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Creating new Dyson 360 Eye robot vacuum\"",
")",
"if",
"DYSON_360_EYE_DEVICES",
"not",
"in",
"hass",
".",
"data... | [
41,
0
] | [
53,
15
] | python | en | ['en', 'hu', 'en'] | True |
Dyson360EyeDevice.__init__ | (self, device) | Dyson 360 Eye robot vacuum device. | Dyson 360 Eye robot vacuum device. | def __init__(self, device):
"""Dyson 360 Eye robot vacuum device."""
_LOGGER.debug("Creating device %s", device.name)
self._device = device | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Creating device %s\"",
",",
"device",
".",
"name",
")",
"self",
".",
"_device",
"=",
"device"
] | [
59,
4
] | [
62,
29
] | python | en | ['la', 'ht', 'en'] | False |
Dyson360EyeDevice.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self._device.add_message_listener(self.on_message) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_device",
".",
"add_message_listener",
"(",
"self",
".",
"on_message",
")"
] | [
64,
4
] | [
66,
58
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.on_message | (self, message) | Handle a new messages that was received from the vacuum. | Handle a new messages that was received from the vacuum. | def on_message(self, message):
"""Handle a new messages that was received from the vacuum."""
_LOGGER.debug("Message received for %s device: %s", self.name, message)
self.schedule_update_ha_state() | [
"def",
"on_message",
"(",
"self",
",",
"message",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Message received for %s device: %s\"",
",",
"self",
".",
"name",
",",
"message",
")",
"self",
".",
"schedule_update_ha_state",
"(",
")"
] | [
68,
4
] | [
71,
39
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.should_poll | (self) | Return True if entity has to be polled for state.
False if entity pushes its state to HA.
| Return True if entity has to be polled for state. | def should_poll(self) -> bool:
"""Return True if entity has to be polled for state.
False if entity pushes its state to HA.
"""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
74,
4
] | [
79,
20
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return self._device.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"name"
] | [
82,
4
] | [
84,
32
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.status | (self) | Return the status of the vacuum cleaner. | Return the status of the vacuum cleaner. | def status(self):
"""Return the status of the vacuum cleaner."""
dyson_labels = {
Dyson360EyeMode.INACTIVE_CHARGING: "Stopped - Charging",
Dyson360EyeMode.INACTIVE_CHARGED: "Stopped - Charged",
Dyson360EyeMode.FULL_CLEAN_PAUSED: "Paused",
Dyson360EyeMode.F... | [
"def",
"status",
"(",
"self",
")",
":",
"dyson_labels",
"=",
"{",
"Dyson360EyeMode",
".",
"INACTIVE_CHARGING",
":",
"\"Stopped - Charging\"",
",",
"Dyson360EyeMode",
".",
"INACTIVE_CHARGED",
":",
"\"Stopped - Charged\"",
",",
"Dyson360EyeMode",
".",
"FULL_CLEAN_PAUSED",... | [
87,
4
] | [
101,
83
] | python | en | ['en', 'la', 'en'] | True |
Dyson360EyeDevice.battery_level | (self) | Return the battery level of the vacuum cleaner. | Return the battery level of the vacuum cleaner. | def battery_level(self):
"""Return the battery level of the vacuum cleaner."""
return self._device.state.battery_level | [
"def",
"battery_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"battery_level"
] | [
104,
4
] | [
106,
47
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.fan_speed | (self) | Return the fan speed of the vacuum cleaner. | Return the fan speed of the vacuum cleaner. | def fan_speed(self):
"""Return the fan speed of the vacuum cleaner."""
speed_labels = {PowerMode.MAX: "Max", PowerMode.QUIET: "Quiet"}
return speed_labels[self._device.state.power_mode] | [
"def",
"fan_speed",
"(",
"self",
")",
":",
"speed_labels",
"=",
"{",
"PowerMode",
".",
"MAX",
":",
"\"Max\"",
",",
"PowerMode",
".",
"QUIET",
":",
"\"Quiet\"",
"}",
"return",
"speed_labels",
"[",
"self",
".",
"_device",
".",
"state",
".",
"power_mode",
"... | [
109,
4
] | [
112,
58
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.fan_speed_list | (self) | Get the list of available fan speed steps of the vacuum cleaner. | Get the list of available fan speed steps of the vacuum cleaner. | def fan_speed_list(self):
"""Get the list of available fan speed steps of the vacuum cleaner."""
return ["Quiet", "Max"] | [
"def",
"fan_speed_list",
"(",
"self",
")",
":",
"return",
"[",
"\"Quiet\"",
",",
"\"Max\"",
"]"
] | [
115,
4
] | [
117,
31
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.device_state_attributes | (self) | Return the specific state attributes of this vacuum cleaner. | Return the specific state attributes of this vacuum cleaner. | def device_state_attributes(self):
"""Return the specific state attributes of this vacuum cleaner."""
return {ATTR_POSITION: str(self._device.state.position)} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_POSITION",
":",
"str",
"(",
"self",
".",
"_device",
".",
"state",
".",
"position",
")",
"}"
] | [
120,
4
] | [
122,
64
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.is_on | (self) | Return True if entity is on. | Return True if entity is on. | def is_on(self) -> bool:
"""Return True if entity is on."""
return self._device.state.state in [
Dyson360EyeMode.FULL_CLEAN_INITIATED,
Dyson360EyeMode.FULL_CLEAN_ABORTED,
Dyson360EyeMode.FULL_CLEAN_RUNNING,
] | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"state",
"in",
"[",
"Dyson360EyeMode",
".",
"FULL_CLEAN_INITIATED",
",",
"Dyson360EyeMode",
".",
"FULL_CLEAN_ABORTED",
",",
"Dyson360EyeMode",
".",
"FULL_... | [
125,
4
] | [
131,
9
] | python | en | ['en', 'cy', 'en'] | True |
Dyson360EyeDevice.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return True | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
134,
4
] | [
136,
19
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.supported_features | (self) | Flag vacuum cleaner robot features that are supported. | Flag vacuum cleaner robot features that are supported. | def supported_features(self):
"""Flag vacuum cleaner robot features that are supported."""
return SUPPORT_DYSON | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_DYSON"
] | [
139,
4
] | [
141,
28
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.battery_icon | (self) | Return the battery icon for the vacuum cleaner. | Return the battery icon for the vacuum cleaner. | def battery_icon(self):
"""Return the battery icon for the vacuum cleaner."""
charging = self._device.state.state in [Dyson360EyeMode.INACTIVE_CHARGING]
return icon_for_battery_level(
battery_level=self.battery_level, charging=charging
) | [
"def",
"battery_icon",
"(",
"self",
")",
":",
"charging",
"=",
"self",
".",
"_device",
".",
"state",
".",
"state",
"in",
"[",
"Dyson360EyeMode",
".",
"INACTIVE_CHARGING",
"]",
"return",
"icon_for_battery_level",
"(",
"battery_level",
"=",
"self",
".",
"battery... | [
144,
4
] | [
149,
9
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.turn_on | (self, **kwargs) | Turn the vacuum on. | Turn the vacuum on. | def turn_on(self, **kwargs):
"""Turn the vacuum on."""
_LOGGER.debug("Turn on device %s", self.name)
if self._device.state.state in [Dyson360EyeMode.FULL_CLEAN_PAUSED]:
self._device.resume()
else:
self._device.start() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn on device %s\"",
",",
"self",
".",
"name",
")",
"if",
"self",
".",
"_device",
".",
"state",
".",
"state",
"in",
"[",
"Dyson360EyeMode",
".",
"FULL_C... | [
151,
4
] | [
157,
32
] | python | en | ['en', 'et', 'en'] | True |
Dyson360EyeDevice.turn_off | (self, **kwargs) | Turn the vacuum off and return to home. | Turn the vacuum off and return to home. | def turn_off(self, **kwargs):
"""Turn the vacuum off and return to home."""
_LOGGER.debug("Turn off device %s", self.name)
self._device.pause() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn off device %s\"",
",",
"self",
".",
"name",
")",
"self",
".",
"_device",
".",
"pause",
"(",
")"
] | [
159,
4
] | [
162,
28
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.stop | (self, **kwargs) | Stop the vacuum cleaner. | Stop the vacuum cleaner. | def stop(self, **kwargs):
"""Stop the vacuum cleaner."""
_LOGGER.debug("Stop device %s", self.name)
self._device.pause() | [
"def",
"stop",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Stop device %s\"",
",",
"self",
".",
"name",
")",
"self",
".",
"_device",
".",
"pause",
"(",
")"
] | [
164,
4
] | [
167,
28
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.set_fan_speed | (self, fan_speed, **kwargs) | Set fan speed. | Set fan speed. | def set_fan_speed(self, fan_speed, **kwargs):
"""Set fan speed."""
_LOGGER.debug("Set fan speed %s on device %s", fan_speed, self.name)
power_modes = {"Quiet": PowerMode.QUIET, "Max": PowerMode.MAX}
self._device.set_power_mode(power_modes[fan_speed]) | [
"def",
"set_fan_speed",
"(",
"self",
",",
"fan_speed",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Set fan speed %s on device %s\"",
",",
"fan_speed",
",",
"self",
".",
"name",
")",
"power_modes",
"=",
"{",
"\"Quiet\"",
":",
"PowerMod... | [
169,
4
] | [
173,
59
] | python | fy | ['sv', 'fy', 'ur'] | False |
Dyson360EyeDevice.start_pause | (self, **kwargs) | Start, pause or resume the cleaning task. | Start, pause or resume the cleaning task. | def start_pause(self, **kwargs):
"""Start, pause or resume the cleaning task."""
if self._device.state.state in [Dyson360EyeMode.FULL_CLEAN_PAUSED]:
_LOGGER.debug("Resume device %s", self.name)
self._device.resume()
elif self._device.state.state in [
Dyson360E... | [
"def",
"start_pause",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_device",
".",
"state",
".",
"state",
"in",
"[",
"Dyson360EyeMode",
".",
"FULL_CLEAN_PAUSED",
"]",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Resume device %s\"",
",",
"... | [
175,
4
] | [
188,
32
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.return_to_base | (self, **kwargs) | Set the vacuum cleaner to return to the dock. | Set the vacuum cleaner to return to the dock. | def return_to_base(self, **kwargs):
"""Set the vacuum cleaner to return to the dock."""
_LOGGER.debug("Return to base device %s", self.name)
self._device.abort() | [
"def",
"return_to_base",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Return to base device %s\"",
",",
"self",
".",
"name",
")",
"self",
".",
"_device",
".",
"abort",
"(",
")"
] | [
190,
4
] | [
193,
28
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Splunk component. | Set up the Splunk component. | async def async_setup(hass, config):
"""Set up the Splunk component."""
conf = config[DOMAIN]
host = conf.get(CONF_HOST)
port = conf.get(CONF_PORT)
token = conf.get(CONF_TOKEN)
use_ssl = conf[CONF_SSL]
verify_ssl = conf.get(CONF_VERIFY_SSL)
name = conf.get(CONF_NAME)
entity_filter = ... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"host",
"=",
"conf",
".",
"get",
"(",
"CONF_HOST",
")",
"port",
"=",
"conf",
".",
"get",
"(",
"CONF_PORT",
")",
"token",
"=",
"conf",
".... | [
53,
0
] | [
126,
15
] | python | en | ['en', 'en', 'en'] | True |
test_refresh_library | (hass, mock_plex_server, setup_plex_server) | Test refresh_library service call. | Test refresh_library service call. | async def test_refresh_library(hass, mock_plex_server, setup_plex_server):
"""Test refresh_library service call."""
# Test with non-existent server
with patch.object(MockPlexLibrarySection, "update") as mock_update:
assert await hass.services.async_call(
DOMAIN,
SERVICE_REFRE... | [
"async",
"def",
"test_refresh_library",
"(",
"hass",
",",
"mock_plex_server",
",",
"setup_plex_server",
")",
":",
"# Test with non-existent server",
"with",
"patch",
".",
"object",
"(",
"MockPlexLibrarySection",
",",
"\"update\"",
")",
"as",
"mock_update",
":",
"asser... | [
24,
0
] | [
80,
37
] | python | en | ['en', 'en', 'en'] | True |
test_scan_clients | (hass, mock_plex_server) | Test scan_for_clients service call. | Test scan_for_clients service call. | async def test_scan_clients(hass, mock_plex_server):
"""Test scan_for_clients service call."""
assert await hass.services.async_call(
DOMAIN,
SERVICE_SCAN_CLIENTS,
blocking=True,
) | [
"async",
"def",
"test_scan_clients",
"(",
"hass",
",",
"mock_plex_server",
")",
":",
"assert",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"DOMAIN",
",",
"SERVICE_SCAN_CLIENTS",
",",
"blocking",
"=",
"True",
",",
")"
] | [
83,
0
] | [
89,
5
] | python | en | ['en', 'en', 'en'] | True |
global_mutable_counting | () |
A program level counter starting from 1.
|
A program level counter starting from 1.
| def global_mutable_counting():
"""
A program level counter starting from 1.
"""
global _counter
_counter += 1
return _counter | [
"def",
"global_mutable_counting",
"(",
")",
":",
"global",
"_counter",
"_counter",
"+=",
"1",
"return",
"_counter"
] | [
14,
0
] | [
20,
19
] | python | en | ['en', 'error', 'th'] | False |
_reset_global_mutable_counting | () |
Reset the global mutable counting to count from 1. Useful when defining multiple models with default keys.
|
Reset the global mutable counting to count from 1. Useful when defining multiple models with default keys.
| def _reset_global_mutable_counting():
"""
Reset the global mutable counting to count from 1. Useful when defining multiple models with default keys.
"""
global _counter
_counter = 0 | [
"def",
"_reset_global_mutable_counting",
"(",
")",
":",
"global",
"_counter",
"_counter",
"=",
"0"
] | [
23,
0
] | [
28,
16
] | python | en | ['en', 'error', 'th'] | False |
to_device | (obj, device) |
Move a tensor, tuple, list, or dict onto device.
|
Move a tensor, tuple, list, or dict onto device.
| def to_device(obj, device):
"""
Move a tensor, tuple, list, or dict onto device.
"""
if torch.is_tensor(obj):
return obj.to(device)
if isinstance(obj, tuple):
return tuple(to_device(t, device) for t in obj)
if isinstance(obj, list):
return [to_device(t, device) for t in o... | [
"def",
"to_device",
"(",
"obj",
",",
"device",
")",
":",
"if",
"torch",
".",
"is_tensor",
"(",
"obj",
")",
":",
"return",
"obj",
".",
"to",
"(",
"device",
")",
"if",
"isinstance",
"(",
"obj",
",",
"tuple",
")",
":",
"return",
"tuple",
"(",
"to_devi... | [
31,
0
] | [
45,
73
] | python | en | ['en', 'error', 'th'] | False |
AverageMeterGroup.update | (self, data) |
Update the meter group with a dict of metrics.
Non-exist average meters will be automatically created.
|
Update the meter group with a dict of metrics.
Non-exist average meters will be automatically created.
| def update(self, data):
"""
Update the meter group with a dict of metrics.
Non-exist average meters will be automatically created.
"""
for k, v in data.items():
if k not in self.meters:
self.meters[k] = AverageMeter(k, ":4f")
self.meters[k]... | [
"def",
"update",
"(",
"self",
",",
"data",
")",
":",
"for",
"k",
",",
"v",
"in",
"data",
".",
"items",
"(",
")",
":",
"if",
"k",
"not",
"in",
"self",
".",
"meters",
":",
"self",
".",
"meters",
"[",
"k",
"]",
"=",
"AverageMeter",
"(",
"k",
","... | [
66,
4
] | [
74,
36
] | python | en | ['en', 'error', 'th'] | False |
AverageMeterGroup.summary | (self) |
Return a summary string of group data.
|
Return a summary string of group data.
| def summary(self):
"""
Return a summary string of group data.
"""
return " ".join(v.summary() for v in self.meters.values()) | [
"def",
"summary",
"(",
"self",
")",
":",
"return",
"\" \"",
".",
"join",
"(",
"v",
".",
"summary",
"(",
")",
"for",
"v",
"in",
"self",
".",
"meters",
".",
"values",
"(",
")",
")"
] | [
85,
4
] | [
89,
67
] | python | en | ['en', 'error', 'th'] | False |
AverageMeter.reset | (self) |
Reset the meter.
|
Reset the meter.
| def reset(self):
"""
Reset the meter.
"""
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0 | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"val",
"=",
"0",
"self",
".",
"avg",
"=",
"0",
"self",
".",
"sum",
"=",
"0",
"self",
".",
"count",
"=",
"0"
] | [
109,
4
] | [
116,
22
] | python | en | ['en', 'error', 'th'] | False |
AverageMeter.update | (self, val, n=1) |
Update with value and weight.
Parameters
----------
val : float or int
The new value to be accounted in.
n : int
The weight of the new value.
|
Update with value and weight. | def update(self, val, n=1):
"""
Update with value and weight.
Parameters
----------
val : float or int
The new value to be accounted in.
n : int
The weight of the new value.
"""
self.val = val
self.sum += val * n
se... | [
"def",
"update",
"(",
"self",
",",
"val",
",",
"n",
"=",
"1",
")",
":",
"self",
".",
"val",
"=",
"val",
"self",
".",
"sum",
"+=",
"val",
"*",
"n",
"self",
".",
"count",
"+=",
"n",
"self",
".",
"avg",
"=",
"self",
".",
"sum",
"/",
"self",
".... | [
118,
4
] | [
132,
40
] | python | en | ['en', 'error', 'th'] | False |
StructuredMutableTreeNode.add_child | (self, mutable) |
Add a tree node to the children list of current node.
|
Add a tree node to the children list of current node.
| def add_child(self, mutable):
"""
Add a tree node to the children list of current node.
"""
self.children.append(StructuredMutableTreeNode(mutable))
return self.children[-1] | [
"def",
"add_child",
"(",
"self",
",",
"mutable",
")",
":",
"self",
".",
"children",
".",
"append",
"(",
"StructuredMutableTreeNode",
"(",
"mutable",
")",
")",
"return",
"self",
".",
"children",
"[",
"-",
"1",
"]"
] | [
161,
4
] | [
166,
32
] | python | en | ['en', 'error', 'th'] | False |
StructuredMutableTreeNode.type | (self) |
Return the ``type`` of mutable content.
|
Return the ``type`` of mutable content.
| def type(self):
"""
Return the ``type`` of mutable content.
"""
return type(self.mutable) | [
"def",
"type",
"(",
"self",
")",
":",
"return",
"type",
"(",
"self",
".",
"mutable",
")"
] | [
168,
4
] | [
172,
33
] | python | en | ['en', 'error', 'th'] | False |
StructuredMutableTreeNode.traverse | (self, order="pre", deduplicate=True, memo=None) |
Return a generator that generates a list of mutables in this tree.
Parameters
----------
order : str
pre or post. If pre, current mutable is yield before children. Otherwise after.
deduplicate : bool
If true, mutables with the same key will not appear af... |
Return a generator that generates a list of mutables in this tree. | def traverse(self, order="pre", deduplicate=True, memo=None):
"""
Return a generator that generates a list of mutables in this tree.
Parameters
----------
order : str
pre or post. If pre, current mutable is yield before children. Otherwise after.
deduplicate ... | [
"def",
"traverse",
"(",
"self",
",",
"order",
"=",
"\"pre\"",
",",
"deduplicate",
"=",
"True",
",",
"memo",
"=",
"None",
")",
":",
"if",
"memo",
"is",
"None",
":",
"memo",
"=",
"set",
"(",
")",
"assert",
"order",
"in",
"[",
"\"pre\"",
",",
"\"post\... | [
177,
4
] | [
209,
38
] | python | en | ['en', 'error', 'th'] | False |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Volkszaehler sensors. | Set up the Volkszaehler sensors. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Volkszaehler sensors."""
host = config[CONF_HOST]
name = config[CONF_NAME]
port = config[CONF_PORT]
uuid = config[CONF_UUID]
conditions = config[CONF_MONITORED_CONDITIONS]
session = async_g... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"host",
"=",
"config",
"[",
"CONF_HOST",
"]",
"name",
"=",
"config",
"[",
"CONF_NAME",
"]",
"port",
"=",
"config",
... | [
53,
0
] | [
76,
33
] | python | en | ['en', 'af', 'en'] | True |
VolkszaehlerSensor.__init__ | (self, vz_api, name, sensor_type) | Initialize the Volkszaehler sensor. | Initialize the Volkszaehler sensor. | def __init__(self, vz_api, name, sensor_type):
"""Initialize the Volkszaehler sensor."""
self.vz_api = vz_api
self._name = name
self.type = sensor_type
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"vz_api",
",",
"name",
",",
"sensor_type",
")",
":",
"self",
".",
"vz_api",
"=",
"vz_api",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"type",
"=",
"sensor_type",
"self",
".",
"_state",
"=",
"None"
] | [
82,
4
] | [
87,
26
] | python | en | ['en', 'sr', 'nl'] | False |
VolkszaehlerSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return "{} {}".format(self._name, SENSOR_TYPES[self.type][0]) | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"\"{} {}\"",
".",
"format",
"(",
"self",
".",
"_name",
",",
"SENSOR_TYPES",
"[",
"self",
".",
"type",
"]",
"[",
"0",
"]",
")"
] | [
90,
4
] | [
92,
69
] | python | en | ['en', 'mi', 'en'] | True |
VolkszaehlerSensor.icon | (self) | Icon to use in the frontend, if any. | Icon to use in the frontend, if any. | def icon(self):
"""Icon to use in the frontend, if any."""
return SENSOR_TYPES[self.type][2] | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"type",
"]",
"[",
"2",
"]"
] | [
95,
4
] | [
97,
41
] | python | en | ['en', 'en', 'en'] | True |
VolkszaehlerSensor.unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def unit_of_measurement(self):
"""Return the unit the value is expressed in."""
return SENSOR_TYPES[self.type][1] | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"type",
"]",
"[",
"1",
"]"
] | [
100,
4
] | [
102,
41
] | python | en | ['en', 'en', 'en'] | True |
VolkszaehlerSensor.available | (self) | Could the device be accessed during the last update call. | Could the device be accessed during the last update call. | def available(self):
"""Could the device be accessed during the last update call."""
return self.vz_api.available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"vz_api",
".",
"available"
] | [
105,
4
] | [
107,
36
] | python | en | ['en', 'en', 'en'] | True |
VolkszaehlerSensor.state | (self) | Return the state of the resources. | Return the state of the resources. | def state(self):
"""Return the state of the resources."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
110,
4
] | [
112,
26
] | python | en | ['en', 'en', 'en'] | True |
VolkszaehlerSensor.async_update | (self) | Get the latest data from REST API. | Get the latest data from REST API. | async def async_update(self):
"""Get the latest data from REST API."""
await self.vz_api.async_update()
if self.vz_api.api.data is not None:
self._state = round(getattr(self.vz_api.api, self.type), 2) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"vz_api",
".",
"async_update",
"(",
")",
"if",
"self",
".",
"vz_api",
".",
"api",
".",
"data",
"is",
"not",
"None",
":",
"self",
".",
"_state",
"=",
"round",
"(",
"getattr",... | [
114,
4
] | [
119,
71
] | python | en | ['en', 'en', 'en'] | True |
VolkszaehlerData.__init__ | (self, api) | Initialize the data object. | Initialize the data object. | def __init__(self, api):
"""Initialize the data object."""
self.api = api
self.available = True | [
"def",
"__init__",
"(",
"self",
",",
"api",
")",
":",
"self",
".",
"api",
"=",
"api",
"self",
".",
"available",
"=",
"True"
] | [
125,
4
] | [
128,
29
] | python | en | ['en', 'en', 'en'] | True |
VolkszaehlerData.async_update | (self) | Get the latest data from the Volkszaehler REST API. | Get the latest data from the Volkszaehler REST API. | async def async_update(self):
"""Get the latest data from the Volkszaehler REST API."""
try:
await self.api.get_data()
self.available = True
except VolkszaehlerApiConnectionError:
_LOGGER.error("Unable to fetch data from the Volkszaehler API")
sel... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"await",
"self",
".",
"api",
".",
"get_data",
"(",
")",
"self",
".",
"available",
"=",
"True",
"except",
"VolkszaehlerApiConnectionError",
":",
"_LOGGER",
".",
"error",
"(",
"\"Unable to fetc... | [
131,
4
] | [
139,
34
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the GeoNet NZ Quakes component. | Set up the GeoNet NZ Quakes component. | async def async_setup(hass, config):
"""Set up the GeoNet NZ Quakes component."""
if DOMAIN not in config:
return True
conf = config[DOMAIN]
latitude = conf.get(CONF_LATITUDE, hass.config.latitude)
longitude = conf.get(CONF_LONGITUDE, hass.config.longitude)
mmi = conf[CONF_MMI]
scan... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"if",
"DOMAIN",
"not",
"in",
"config",
":",
"return",
"True",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"latitude",
"=",
"conf",
".",
"get",
"(",
"CONF_LATITUDE",
",",
"hass",
".",
... | [
61,
0
] | [
87,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry) | Set up the GeoNet NZ Quakes component as config entry. | Set up the GeoNet NZ Quakes component as config entry. | async def async_setup_entry(hass, config_entry):
"""Set up the GeoNet NZ Quakes component as config entry."""
hass.data.setdefault(DOMAIN, {})
feeds = hass.data[DOMAIN].setdefault(FEED, {})
radius = config_entry.data[CONF_RADIUS]
if hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL:
radiu... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"feeds",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"setdefault",
"(",
"FEED",
",",
"{... | [
90,
0
] | [
103,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, config_entry) | Unload an GeoNet NZ Quakes component config entry. | Unload an GeoNet NZ Quakes component config entry. | async def async_unload_entry(hass, config_entry):
"""Unload an GeoNet NZ Quakes component config entry."""
manager = hass.data[DOMAIN][FEED].pop(config_entry.entry_id)
await manager.async_stop()
await asyncio.wait(
[
hass.config_entries.async_forward_entry_unload(config_entry, domain... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"manager",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"FEED",
"]",
".",
"pop",
"(",
"config_entry",
".",
"entry_id",
")",
"await",
"manager",
".",
"async_stop",
"("... | [
106,
0
] | [
116,
15
] | python | en | ['en', 'en', 'en'] | True |
GeonetnzQuakesFeedEntityManager.__init__ | (self, hass, config_entry, radius_in_km) | Initialize the Feed Entity Manager. | Initialize the Feed Entity Manager. | def __init__(self, hass, config_entry, radius_in_km):
"""Initialize the Feed Entity Manager."""
self._hass = hass
self._config_entry = config_entry
coordinates = (
config_entry.data[CONF_LATITUDE],
config_entry.data[CONF_LONGITUDE],
)
websession = ... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"config_entry",
",",
"radius_in_km",
")",
":",
"self",
".",
"_hass",
"=",
"hass",
"self",
".",
"_config_entry",
"=",
"config_entry",
"coordinates",
"=",
"(",
"config_entry",
".",
"data",
"[",
"CONF_LATITUDE",... | [
122,
4
] | [
147,
27
] | python | en | ['en', 'en', 'en'] | True |
GeonetnzQuakesFeedEntityManager.async_init | (self) | Schedule initial and regular updates based on configured time interval. | Schedule initial and regular updates based on configured time interval. | async def async_init(self):
"""Schedule initial and regular updates based on configured time interval."""
for domain in PLATFORMS:
self._hass.async_create_task(
self._hass.config_entries.async_forward_entry_setup(
self._config_entry, domain
... | [
"async",
"def",
"async_init",
"(",
"self",
")",
":",
"for",
"domain",
"in",
"PLATFORMS",
":",
"self",
".",
"_hass",
".",
"async_create_task",
"(",
"self",
".",
"_hass",
".",
"config_entries",
".",
"async_forward_entry_setup",
"(",
"self",
".",
"_config_entry",... | [
149,
4
] | [
168,
56
] | python | en | ['en', 'en', 'en'] | True |
GeonetnzQuakesFeedEntityManager.async_update | (self) | Refresh data. | Refresh data. | async def async_update(self):
"""Refresh data."""
await self._feed_manager.update()
_LOGGER.debug("Feed entity manager updated") | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"_feed_manager",
".",
"update",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Feed entity manager updated\"",
")"
] | [
170,
4
] | [
173,
52
] | python | de | ['de', 'sn', 'en'] | False |
GeonetnzQuakesFeedEntityManager.async_stop | (self) | Stop this feed entity manager from refreshing. | Stop this feed entity manager from refreshing. | async def async_stop(self):
"""Stop this feed entity manager from refreshing."""
for unsub_dispatcher in self.listeners:
unsub_dispatcher()
self.listeners = []
if self._track_time_remove_callback:
self._track_time_remove_callback()
_LOGGER.debug("Feed enti... | [
"async",
"def",
"async_stop",
"(",
"self",
")",
":",
"for",
"unsub_dispatcher",
"in",
"self",
".",
"listeners",
":",
"unsub_dispatcher",
"(",
")",
"self",
".",
"listeners",
"=",
"[",
"]",
"if",
"self",
".",
"_track_time_remove_callback",
":",
"self",
".",
... | [
175,
4
] | [
182,
52
] | python | en | ['en', 'en', 'en'] | True |
GeonetnzQuakesFeedEntityManager.async_event_new_entity | (self) | Return manager specific event to signal new entity. | Return manager specific event to signal new entity. | def async_event_new_entity(self):
"""Return manager specific event to signal new entity."""
return f"geonetnz_quakes_new_geolocation_{self._config_entry_id}" | [
"def",
"async_event_new_entity",
"(",
"self",
")",
":",
"return",
"f\"geonetnz_quakes_new_geolocation_{self._config_entry_id}\""
] | [
185,
4
] | [
187,
73
] | 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.