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_location_zone | (hass, requests_mock_truck_response, legacy_patchable_time) | Test that origin/destination supplied by a zone works. | Test that origin/destination supplied by a zone works. | async def test_location_zone(hass, requests_mock_truck_response, legacy_patchable_time):
"""Test that origin/destination supplied by a zone works."""
utcnow = dt_util.utcnow()
# Patching 'utcnow' to gain more control over the timed update.
with patch("homeassistant.util.dt.utcnow", return_value=utcnow):... | [
"async",
"def",
"test_location_zone",
"(",
"hass",
",",
"requests_mock_truck_response",
",",
"legacy_patchable_time",
")",
":",
"utcnow",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"# Patching 'utcnow' to gain more control over the timed update.",
"with",
"patch",
"(",
"\"h... | [
569,
0
] | [
617,
36
] | python | en | ['en', 'de', 'en'] | True |
test_location_sensor | (
hass, requests_mock_truck_response, legacy_patchable_time
) | Test that origin/destination supplied by a sensor works. | Test that origin/destination supplied by a sensor works. | async def test_location_sensor(
hass, requests_mock_truck_response, legacy_patchable_time
):
"""Test that origin/destination supplied by a sensor works."""
utcnow = dt_util.utcnow()
# Patching 'utcnow' to gain more control over the timed update.
with patch("homeassistant.util.dt.utcnow", return_valu... | [
"async",
"def",
"test_location_sensor",
"(",
"hass",
",",
"requests_mock_truck_response",
",",
"legacy_patchable_time",
")",
":",
"utcnow",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"# Patching 'utcnow' to gain more control over the timed update.",
"with",
"patch",
"(",
"\... | [
620,
0
] | [
659,
36
] | python | en | ['en', 'de', 'en'] | True |
test_location_person | (
hass, requests_mock_truck_response, legacy_patchable_time
) | Test that origin/destination supplied by a person works. | Test that origin/destination supplied by a person works. | async def test_location_person(
hass, requests_mock_truck_response, legacy_patchable_time
):
"""Test that origin/destination supplied by a person works."""
utcnow = dt_util.utcnow()
# Patching 'utcnow' to gain more control over the timed update.
with patch("homeassistant.util.dt.utcnow", return_valu... | [
"async",
"def",
"test_location_person",
"(",
"hass",
",",
"requests_mock_truck_response",
",",
"legacy_patchable_time",
")",
":",
"utcnow",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"# Patching 'utcnow' to gain more control over the timed update.",
"with",
"patch",
"(",
"\... | [
662,
0
] | [
710,
36
] | python | en | ['en', 'en', 'en'] | True |
test_location_device_tracker | (
hass, requests_mock_truck_response, legacy_patchable_time
) | Test that origin/destination supplied by a device_tracker works. | Test that origin/destination supplied by a device_tracker works. | async def test_location_device_tracker(
hass, requests_mock_truck_response, legacy_patchable_time
):
"""Test that origin/destination supplied by a device_tracker works."""
utcnow = dt_util.utcnow()
# Patching 'utcnow' to gain more control over the timed update.
with patch("homeassistant.util.dt.utcn... | [
"async",
"def",
"test_location_device_tracker",
"(",
"hass",
",",
"requests_mock_truck_response",
",",
"legacy_patchable_time",
")",
":",
"utcnow",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"# Patching 'utcnow' to gain more control over the timed update.",
"with",
"patch",
"... | [
713,
0
] | [
761,
36
] | python | en | ['en', 'en', 'en'] | True |
test_location_device_tracker_added_after_update | (
hass, requests_mock_truck_response, legacy_patchable_time, caplog
) | Test that device_tracker added after first update works. | Test that device_tracker added after first update works. | async def test_location_device_tracker_added_after_update(
hass, requests_mock_truck_response, legacy_patchable_time, caplog
):
"""Test that device_tracker added after first update works."""
caplog.set_level(logging.ERROR)
utcnow = dt_util.utcnow()
# Patching 'utcnow' to gain more control over the t... | [
"async",
"def",
"test_location_device_tracker_added_after_update",
"(",
"hass",
",",
"requests_mock_truck_response",
",",
"legacy_patchable_time",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"ERROR",
")",
"utcnow",
"=",
"dt_util",
".",
... | [
764,
0
] | [
817,
39
] | python | en | ['en', 'en', 'en'] | True |
test_location_device_tracker_in_zone | (
hass, requests_mock_truck_response, caplog
) | Test that device_tracker in zone uses device_tracker state works. | Test that device_tracker in zone uses device_tracker state works. | async def test_location_device_tracker_in_zone(
hass, requests_mock_truck_response, caplog
):
"""Test that device_tracker in zone uses device_tracker state works."""
caplog.set_level(logging.DEBUG)
zone_config = {
"zone": [
{
"name": "Origin",
"latitud... | [
"async",
"def",
"test_location_device_tracker_in_zone",
"(",
"hass",
",",
"requests_mock_truck_response",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"DEBUG",
")",
"zone_config",
"=",
"{",
"\"zone\"",
":",
"[",
"{",
"\"name\"",
":",... | [
820,
0
] | [
859,
51
] | python | en | ['en', 'en', 'en'] | True |
test_route_not_found | (hass, requests_mock_credentials_check, caplog) | Test that route not found error is correctly handled. | Test that route not found error is correctly handled. | async def test_route_not_found(hass, requests_mock_credentials_check, caplog):
"""Test that route not found error is correctly handled."""
caplog.set_level(logging.ERROR)
origin = "52.516,13.3779"
destination = "47.013399,-10.171986"
modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_CAR, TRAFFIC_MODE_DISABLE... | [
"async",
"def",
"test_route_not_found",
"(",
"hass",
",",
"requests_mock_credentials_check",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"ERROR",
")",
"origin",
"=",
"\"52.516,13.3779\"",
"destination",
"=",
"\"47.013399,-10.171986\"",
... | [
862,
0
] | [
892,
48
] | python | en | ['en', 'en', 'en'] | True |
test_pattern_origin | (hass, caplog) | Test that pattern matching the origin works. | Test that pattern matching the origin works. | async def test_pattern_origin(hass, caplog):
"""Test that pattern matching the origin works."""
caplog.set_level(logging.ERROR)
config = {
DOMAIN: {
"platform": PLATFORM,
"name": "test",
"origin_latitude": "138.90",
"origin_longitude": "-77.04833",
... | [
"async",
"def",
"test_pattern_origin",
"(",
"hass",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"ERROR",
")",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"PLATFORM",
",",
"\"name\"",
":",
"\"test\"",
",",
"\... | [
895,
0
] | [
912,
44
] | python | en | ['en', 'en', 'en'] | True |
test_pattern_destination | (hass, caplog) | Test that pattern matching the destination works. | Test that pattern matching the destination works. | async def test_pattern_destination(hass, caplog):
"""Test that pattern matching the destination works."""
caplog.set_level(logging.ERROR)
config = {
DOMAIN: {
"platform": PLATFORM,
"name": "test",
"origin_latitude": CAR_ORIGIN_LATITUDE,
"origin_longitu... | [
"async",
"def",
"test_pattern_destination",
"(",
"hass",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"ERROR",
")",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"PLATFORM",
",",
"\"name\"",
":",
"\"test\"",
",",... | [
915,
0
] | [
932,
44
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_credentials | (hass, requests_mock, caplog) | Test that invalid credentials error is correctly handled. | Test that invalid credentials error is correctly handled. | async def test_invalid_credentials(hass, requests_mock, caplog):
"""Test that invalid credentials error is correctly handled."""
caplog.set_level(logging.ERROR)
modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_CAR, TRAFFIC_MODE_DISABLED]
response_url = _build_mock_url(
",".join([CAR_ORIGIN_LATITUDE, CAR... | [
"async",
"def",
"test_invalid_credentials",
"(",
"hass",
",",
"requests_mock",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"ERROR",
")",
"modes",
"=",
"[",
"ROUTE_MODE_FASTEST",
",",
"TRAVEL_MODE_CAR",
",",
"TRAFFIC_MODE_DISABLED",
... | [
935,
0
] | [
964,
47
] | python | en | ['en', 'en', 'en'] | True |
test_attribution | (hass, requests_mock_credentials_check) | Test that attributions are correctly displayed. | Test that attributions are correctly displayed. | async def test_attribution(hass, requests_mock_credentials_check):
"""Test that attributions are correctly displayed."""
origin = "50.037751372637686,14.39233448220898"
destination = "50.07993838201255,14.42582157361062"
modes = [ROUTE_MODE_SHORTEST, TRAVEL_MODE_PUBLIC_TIME_TABLE, TRAFFIC_MODE_ENABLED]
... | [
"async",
"def",
"test_attribution",
"(",
"hass",
",",
"requests_mock_credentials_check",
")",
":",
"origin",
"=",
"\"50.037751372637686,14.39233448220898\"",
"destination",
"=",
"\"50.07993838201255,14.42582157361062\"",
"modes",
"=",
"[",
"ROUTE_MODE_SHORTEST",
",",
"TRAVEL_... | [
967,
0
] | [
1001,
5
] | python | en | ['en', 'en', 'en'] | True |
test_pattern_entity_state | (hass, requests_mock_truck_response, caplog) | Test that pattern matching the state of an entity works. | Test that pattern matching the state of an entity works. | async def test_pattern_entity_state(hass, requests_mock_truck_response, caplog):
"""Test that pattern matching the state of an entity works."""
caplog.set_level(logging.ERROR)
hass.states.async_set("sensor.origin", "invalid")
config = {
DOMAIN: {
"platform": PLATFORM,
"n... | [
"async",
"def",
"test_pattern_entity_state",
"(",
"hass",
",",
"requests_mock_truck_response",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"ERROR",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.origin\"",
",",
"\"inva... | [
1004,
0
] | [
1027,
61
] | python | en | ['en', 'en', 'en'] | True |
test_pattern_entity_state_with_space | (hass, requests_mock_truck_response) | Test that pattern matching the state including a space of an entity works. | Test that pattern matching the state including a space of an entity works. | async def test_pattern_entity_state_with_space(hass, requests_mock_truck_response):
"""Test that pattern matching the state including a space of an entity works."""
hass.states.async_set(
"sensor.origin", ", ".join([TRUCK_ORIGIN_LATITUDE, TRUCK_ORIGIN_LONGITUDE])
)
config = {
DOMAIN: {
... | [
"async",
"def",
"test_pattern_entity_state_with_space",
"(",
"hass",
",",
"requests_mock_truck_response",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.origin\"",
",",
"\", \"",
".",
"join",
"(",
"[",
"TRUCK_ORIGIN_LATITUDE",
",",
"TRUCK_ORIGIN_LON... | [
1030,
0
] | [
1048,
38
] | python | en | ['en', 'en', 'en'] | True |
test_delayed_update | (hass, requests_mock_truck_response, caplog) | Test that delayed update does not complain about missing entities. | Test that delayed update does not complain about missing entities. | async def test_delayed_update(hass, requests_mock_truck_response, caplog):
"""Test that delayed update does not complain about missing entities."""
caplog.set_level(logging.WARNING)
config = {
DOMAIN: {
"platform": PLATFORM,
"name": "test",
"origin_entity_id": "s... | [
"async",
"def",
"test_delayed_update",
"(",
"hass",
",",
"requests_mock_truck_response",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"WARNING",
")",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"PLATFORM",
",",
"... | [
1051,
0
] | [
1084,
53
] | python | en | ['en', 'en', 'en'] | True |
test_arrival | (hass, requests_mock_credentials_check) | Test that arrival works. | Test that arrival works. | async def test_arrival(hass, requests_mock_credentials_check):
"""Test that arrival works."""
origin = "41.9798,-87.8801"
destination = "41.9043,-87.9216"
arrival = "01:00:00"
arrival_isodate = convert_time_to_isodate(arrival)
modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_PUBLIC_TIME_TABLE, TRAFFIC_M... | [
"async",
"def",
"test_arrival",
"(",
"hass",
",",
"requests_mock_credentials_check",
")",
":",
"origin",
"=",
"\"41.9798,-87.8801\"",
"destination",
"=",
"\"41.9043,-87.9216\"",
"arrival",
"=",
"\"01:00:00\"",
"arrival_isodate",
"=",
"convert_time_to_isodate",
"(",
"arriv... | [
1087,
0
] | [
1122,
31
] | python | en | ['en', 'en', 'en'] | True |
test_departure | (hass, requests_mock_credentials_check) | Test that arrival works. | Test that arrival works. | async def test_departure(hass, requests_mock_credentials_check):
"""Test that arrival works."""
origin = "41.9798,-87.8801"
destination = "41.9043,-87.9216"
departure = "23:00:00"
departure_isodate = convert_time_to_isodate(departure)
modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_PUBLIC_TIME_TABLE, T... | [
"async",
"def",
"test_departure",
"(",
"hass",
",",
"requests_mock_credentials_check",
")",
":",
"origin",
"=",
"\"41.9798,-87.8801\"",
"destination",
"=",
"\"41.9043,-87.9216\"",
"departure",
"=",
"\"23:00:00\"",
"departure_isodate",
"=",
"convert_time_to_isodate",
"(",
... | [
1125,
0
] | [
1160,
31
] | python | en | ['en', 'en', 'en'] | True |
test_arrival_only_allowed_for_timetable | (hass, caplog) | Test that arrival is only allowed when mode is publicTransportTimeTable. | Test that arrival is only allowed when mode is publicTransportTimeTable. | async def test_arrival_only_allowed_for_timetable(hass, caplog):
"""Test that arrival is only allowed when mode is publicTransportTimeTable."""
caplog.set_level(logging.ERROR)
origin = "41.9798,-87.8801"
destination = "41.9043,-87.9216"
config = {
DOMAIN: {
"platform": PLATFORM,
... | [
"async",
"def",
"test_arrival_only_allowed_for_timetable",
"(",
"hass",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"ERROR",
")",
"origin",
"=",
"\"41.9798,-87.8801\"",
"destination",
"=",
"\"41.9043,-87.9216\"",
"config",
"=",
"{",
"... | [
1163,
0
] | [
1183,
58
] | python | en | ['en', 'en', 'en'] | True |
test_exclusive_arrival_and_departure | (hass, caplog) | Test that arrival and departure are exclusive. | Test that arrival and departure are exclusive. | async def test_exclusive_arrival_and_departure(hass, caplog):
"""Test that arrival and departure are exclusive."""
caplog.set_level(logging.ERROR)
origin = "41.9798,-87.8801"
destination = "41.9043,-87.9216"
config = {
DOMAIN: {
"platform": PLATFORM,
"name": "test",
... | [
"async",
"def",
"test_exclusive_arrival_and_departure",
"(",
"hass",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"ERROR",
")",
"origin",
"=",
"\"41.9798,-87.8801\"",
"destination",
"=",
"\"41.9043,-87.9216\"",
"config",
"=",
"{",
"DOM... | [
1186,
0
] | [
1208,
77
] | python | en | ['en', 'en', 'en'] | True |
test_client_connected | (hass) | Test client connected. | Test client connected. | async def test_client_connected(hass):
"""Test client connected."""
await init_integration(hass)
future = utcnow() + timedelta(minutes=60)
with patch(
"homeassistant.components.ruckus_unleashed.RuckusUnleashedDataUpdateCoordinator._fetch_clients",
return_value={
TEST_CLIENT[... | [
"async",
"def",
"test_client_connected",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"future",
"=",
"utcnow",
"(",
")",
"+",
"timedelta",
"(",
"minutes",
"=",
"60",
")",
"with",
"patch",
"(",
"\"homeassistant.components.ruckus_unleashed... | [
24,
0
] | [
40,
42
] | python | en | ['en', 'en', 'en'] | True |
test_client_disconnected | (hass) | Test client disconnected. | Test client disconnected. | async def test_client_disconnected(hass):
"""Test client disconnected."""
await init_integration(hass)
future = utcnow() + timedelta(minutes=60)
with patch(
"homeassistant.components.ruckus_unleashed.RuckusUnleashedDataUpdateCoordinator._fetch_clients",
return_value={},
):
a... | [
"async",
"def",
"test_client_disconnected",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"future",
"=",
"utcnow",
"(",
")",
"+",
"timedelta",
"(",
"minutes",
"=",
"60",
")",
"with",
"patch",
"(",
"\"homeassistant.components.ruckus_unleas... | [
43,
0
] | [
57,
50
] | python | en | ['fr', 'en', 'en'] | True |
test_clients_update_failed | (hass) | Test failed update. | Test failed update. | async def test_clients_update_failed(hass):
"""Test failed update."""
await init_integration(hass)
future = utcnow() + timedelta(minutes=60)
with patch(
"homeassistant.components.ruckus_unleashed.RuckusUnleashedDataUpdateCoordinator._fetch_clients",
side_effect=ConnectionError,
):
... | [
"async",
"def",
"test_clients_update_failed",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"future",
"=",
"utcnow",
"(",
")",
"+",
"timedelta",
"(",
"minutes",
"=",
"60",
")",
"with",
"patch",
"(",
"\"homeassistant.components.ruckus_unle... | [
60,
0
] | [
74,
53
] | python | en | ['en', 'lb', 'en'] | True |
test_restoring_clients | (hass) | Test restoring existing device_tracker entities if not detected on startup. | Test restoring existing device_tracker entities if not detected on startup. | async def test_restoring_clients(hass):
"""Test restoring existing device_tracker entities if not detected on startup."""
entry = mock_config_entry()
entry.add_to_hass(hass)
registry = await entity_registry.async_get_registry(hass)
registry.async_get_or_create(
"device_tracker",
DOM... | [
"async",
"def",
"test_restoring_clients",
"(",
"hass",
")",
":",
"entry",
"=",
"mock_config_entry",
"(",
")",
"entry",
".",
"add_to_hass",
"(",
"hass",
")",
"registry",
"=",
"await",
"entity_registry",
".",
"async_get_registry",
"(",
"hass",
")",
"registry",
"... | [
77,
0
] | [
113,
41
] | python | en | ['en', 'en', 'en'] | True |
test_client_device_setup | (hass) | Test a client device is created. | Test a client device is created. | async def test_client_device_setup(hass):
"""Test a client device is created."""
await init_integration(hass)
router_info = DEFAULT_AP_INFO[API_AP][API_ID]["1"]
device_registry = await hass.helpers.device_registry.async_get_registry()
client_device = device_registry.async_get_device(
ident... | [
"async",
"def",
"test_client_device_setup",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"router_info",
"=",
"DEFAULT_AP_INFO",
"[",
"API_AP",
"]",
"[",
"API_ID",
"]",
"[",
"\"1\"",
"]",
"device_registry",
"=",
"await",
"hass",
".",
... | [
116,
0
] | [
134,
58
] | python | en | ['en', 'en', 'en'] | True |
request_app_setup | (hass, config, add_entities, config_path, discovery_info=None) | Assist user with configuring the Fitbit dev application. | Assist user with configuring the Fitbit dev application. | def request_app_setup(hass, config, add_entities, config_path, discovery_info=None):
"""Assist user with configuring the Fitbit dev application."""
configurator = hass.components.configurator
def fitbit_configuration_callback(callback_data):
"""Handle configuration updates."""
config_path =... | [
"def",
"request_app_setup",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"config_path",
",",
"discovery_info",
"=",
"None",
")",
":",
"configurator",
"=",
"hass",
".",
"components",
".",
"configurator",
"def",
"fitbit_configuration_callback",
"(",
"callba... | [
167,
0
] | [
206,
5
] | python | en | ['en', 'en', 'en'] | True |
request_oauth_completion | (hass) | Request user complete Fitbit OAuth2 flow. | Request user complete Fitbit OAuth2 flow. | def request_oauth_completion(hass):
"""Request user complete Fitbit OAuth2 flow."""
configurator = hass.components.configurator
if "fitbit" in _CONFIGURING:
configurator.notify_errors(
_CONFIGURING["fitbit"], "Failed to register, please try again."
)
return
def fitb... | [
"def",
"request_oauth_completion",
"(",
"hass",
")",
":",
"configurator",
"=",
"hass",
".",
"components",
".",
"configurator",
"if",
"\"fitbit\"",
"in",
"_CONFIGURING",
":",
"configurator",
".",
"notify_errors",
"(",
"_CONFIGURING",
"[",
"\"fitbit\"",
"]",
",",
... | [
209,
0
] | [
231,
5
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Fitbit sensor. | Set up the Fitbit sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Fitbit sensor."""
config_path = hass.config.path(FITBIT_CONFIG_FILE)
if os.path.isfile(config_path):
config_file = load_json(config_path)
if config_file == DEFAULT_CONFIG:
request_app_setup(
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"config_path",
"=",
"hass",
".",
"config",
".",
"path",
"(",
"FITBIT_CONFIG_FILE",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"... | [
234,
0
] | [
332,
38
] | python | en | ['en', 'da', 'en'] | True |
FitbitAuthCallbackView.__init__ | (self, config, add_entities, oauth) | Initialize the OAuth callback view. | Initialize the OAuth callback view. | def __init__(self, config, add_entities, oauth):
"""Initialize the OAuth callback view."""
self.config = config
self.add_entities = add_entities
self.oauth = oauth | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"add_entities",
",",
"oauth",
")",
":",
"self",
".",
"config",
"=",
"config",
"self",
".",
"add_entities",
"=",
"add_entities",
"self",
".",
"oauth",
"=",
"oauth"
] | [
342,
4
] | [
346,
26
] | python | en | ['en', 'en', 'en'] | True |
FitbitAuthCallbackView.get | (self, request) | Finish OAuth callback request. | Finish OAuth callback request. | def get(self, request):
"""Finish OAuth callback request."""
hass = request.app["hass"]
data = request.query
response_message = """Fitbit has been successfully authorized!
You can close this window now!"""
result = None
if data.get("code") is not None:
... | [
"def",
"get",
"(",
"self",
",",
"request",
")",
":",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"data",
"=",
"request",
".",
"query",
"response_message",
"=",
"\"\"\"Fitbit has been successfully authorized!\n You can close this window now!\"\"\"",
... | [
349,
4
] | [
402,
28
] | python | en | ['en', 'en', 'en'] | True |
FitbitSensor.__init__ | (
self, client, config_path, resource_type, is_metric, clock_format, extra=None
) | Initialize the Fitbit sensor. | Initialize the Fitbit sensor. | def __init__(
self, client, config_path, resource_type, is_metric, clock_format, extra=None
):
"""Initialize the Fitbit sensor."""
self.client = client
self.config_path = config_path
self.resource_type = resource_type
self.is_metric = is_metric
self.clock_form... | [
"def",
"__init__",
"(",
"self",
",",
"client",
",",
"config_path",
",",
"resource_type",
",",
"is_metric",
",",
"clock_format",
",",
"extra",
"=",
"None",
")",
":",
"self",
".",
"client",
"=",
"client",
"self",
".",
"config_path",
"=",
"config_path",
"self... | [
408,
4
] | [
433,
23
] | python | en | ['en', 'en', 'en'] | True |
FitbitSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
436,
4
] | [
438,
25
] | python | en | ['en', 'mi', 'en'] | True |
FitbitSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
441,
4
] | [
443,
26
] | python | en | ['en', 'en', 'en'] | True |
FitbitSensor.unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
446,
4
] | [
448,
40
] | python | en | ['en', 'en', 'en'] | True |
FitbitSensor.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."""
if self.resource_type == "devices/battery" and self.extra:
battery_level = BATTERY_LEVELS[self.extra.get("battery")]
return icon_for_battery_level(battery_level=battery_level, charging=None)
return f"mdi:{FITBIT_R... | [
"def",
"icon",
"(",
"self",
")",
":",
"if",
"self",
".",
"resource_type",
"==",
"\"devices/battery\"",
"and",
"self",
".",
"extra",
":",
"battery_level",
"=",
"BATTERY_LEVELS",
"[",
"self",
".",
"extra",
".",
"get",
"(",
"\"battery\"",
")",
"]",
"return",
... | [
451,
4
] | [
456,
68
] | python | en | ['en', 'en', 'en'] | True |
FitbitSensor.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
attrs = {}
attrs[ATTR_ATTRIBUTION] = ATTRIBUTION
if self.extra:
attrs["model"] = self.extra.get("deviceVersion")
attrs["type"] = self.extra.get("type").lower()
return attrs | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"attrs",
"=",
"{",
"}",
"attrs",
"[",
"ATTR_ATTRIBUTION",
"]",
"=",
"ATTRIBUTION",
"if",
"self",
".",
"extra",
":",
"attrs",
"[",
"\"model\"",
"]",
"=",
"self",
".",
"extra",
".",
"get",
"(",
"\"... | [
459,
4
] | [
469,
20
] | python | en | ['en', 'en', 'en'] | True |
FitbitSensor.update | (self) | Get the latest data from the Fitbit API and update the states. | Get the latest data from the Fitbit API and update the states. | def update(self):
"""Get the latest data from the Fitbit API and update the states."""
if self.resource_type == "devices/battery" and self.extra:
registered_devs = self.client.get_devices()
device_id = self.extra.get("id")
self.extra = list(
filter(lam... | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"self",
".",
"resource_type",
"==",
"\"devices/battery\"",
"and",
"self",
".",
"extra",
":",
"registered_devs",
"=",
"self",
".",
"client",
".",
"get_devices",
"(",
")",
"device_id",
"=",
"self",
".",
"extra",
... | [
471,
4
] | [
530,
52
] | python | en | ['en', 'en', 'en'] | True |
get_checkpoint_callback | (output_dir, metric, save_top_k=1, lower_is_better=False) | Saves the best model by validation ROUGE2 score. | Saves the best model by validation ROUGE2 score. | def get_checkpoint_callback(output_dir, metric, save_top_k=1, lower_is_better=False):
"""Saves the best model by validation ROUGE2 score."""
if metric == "rouge2":
exp = "{val_avg_rouge2:.4f}-{step_count}"
elif metric == "bleu":
exp = "{val_avg_bleu:.4f}-{step_count}"
elif metric == "los... | [
"def",
"get_checkpoint_callback",
"(",
"output_dir",
",",
"metric",
",",
"save_top_k",
"=",
"1",
",",
"lower_is_better",
"=",
"False",
")",
":",
"if",
"metric",
"==",
"\"rouge2\"",
":",
"exp",
"=",
"\"{val_avg_rouge2:.4f}-{step_count}\"",
"elif",
"metric",
"==",
... | [
85,
0
] | [
105,
30
] | python | en | ['en', 'en', 'en'] | True |
format_mac | (mac: str) | Format the mac address string for entry into dev reg. | Format the mac address string for entry into dev reg. | def format_mac(mac: str) -> str:
"""Format the mac address string for entry into dev reg."""
to_test = mac
if len(to_test) == 17 and to_test.count(":") == 5:
return to_test.lower()
if len(to_test) == 17 and to_test.count("-") == 5:
to_test = to_test.replace("-", "")
elif len(to_tes... | [
"def",
"format_mac",
"(",
"mac",
":",
"str",
")",
"->",
"str",
":",
"to_test",
"=",
"mac",
"if",
"len",
"(",
"to_test",
")",
"==",
"17",
"and",
"to_test",
".",
"count",
"(",
"\":\"",
")",
"==",
"5",
":",
"return",
"to_test",
".",
"lower",
"(",
")... | [
80,
0
] | [
97,
14
] | python | en | ['en', 'kk', 'en'] | True |
async_get_registry | (hass: HomeAssistantType) | Create entity registry. | Create entity registry. | async def async_get_registry(hass: HomeAssistantType) -> DeviceRegistry:
"""Create entity registry."""
reg = DeviceRegistry(hass)
await reg.async_load()
return reg | [
"async",
"def",
"async_get_registry",
"(",
"hass",
":",
"HomeAssistantType",
")",
"->",
"DeviceRegistry",
":",
"reg",
"=",
"DeviceRegistry",
"(",
"hass",
")",
"await",
"reg",
".",
"async_load",
"(",
")",
"return",
"reg"
] | [
525,
0
] | [
529,
14
] | python | en | ['en', 'cy', 'en'] | True |
async_entries_for_area | (registry: DeviceRegistry, area_id: str) | Return entries that match an area. | Return entries that match an area. | def async_entries_for_area(registry: DeviceRegistry, area_id: str) -> List[DeviceEntry]:
"""Return entries that match an area."""
return [device for device in registry.devices.values() if device.area_id == area_id] | [
"def",
"async_entries_for_area",
"(",
"registry",
":",
"DeviceRegistry",
",",
"area_id",
":",
"str",
")",
"->",
"List",
"[",
"DeviceEntry",
"]",
":",
"return",
"[",
"device",
"for",
"device",
"in",
"registry",
".",
"devices",
".",
"values",
"(",
")",
"if",... | [
533,
0
] | [
535,
88
] | python | en | ['en', 'en', 'en'] | True |
async_entries_for_config_entry | (
registry: DeviceRegistry, config_entry_id: str
) | Return entries that match a config entry. | Return entries that match a config entry. | def async_entries_for_config_entry(
registry: DeviceRegistry, config_entry_id: str
) -> List[DeviceEntry]:
"""Return entries that match a config entry."""
return [
device
for device in registry.devices.values()
if config_entry_id in device.config_entries
] | [
"def",
"async_entries_for_config_entry",
"(",
"registry",
":",
"DeviceRegistry",
",",
"config_entry_id",
":",
"str",
")",
"->",
"List",
"[",
"DeviceEntry",
"]",
":",
"return",
"[",
"device",
"for",
"device",
"in",
"registry",
".",
"devices",
".",
"values",
"("... | [
539,
0
] | [
547,
5
] | python | en | ['en', 'en', 'en'] | True |
async_cleanup | (
hass: HomeAssistantType,
dev_reg: DeviceRegistry,
ent_reg: "entity_registry.EntityRegistry",
) | Clean up device registry. | Clean up device registry. | def async_cleanup(
hass: HomeAssistantType,
dev_reg: DeviceRegistry,
ent_reg: "entity_registry.EntityRegistry",
) -> None:
"""Clean up device registry."""
# Find all devices that are referenced by a config_entry.
config_entry_ids = {entry.entry_id for entry in hass.config_entries.async_entries()... | [
"def",
"async_cleanup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"dev_reg",
":",
"DeviceRegistry",
",",
"ent_reg",
":",
"\"entity_registry.EntityRegistry\"",
",",
")",
"->",
"None",
":",
"# Find all devices that are referenced by a config_entry.",
"config_entry_ids",
"="... | [
551,
0
] | [
581,
17
] | python | en | ['nl', 'en', 'en'] | True |
async_setup_cleanup | (hass: HomeAssistantType, dev_reg: DeviceRegistry) | Clean up device registry when entities removed. | Clean up device registry when entities removed. | def async_setup_cleanup(hass: HomeAssistantType, dev_reg: DeviceRegistry) -> None:
"""Clean up device registry when entities removed."""
from . import entity_registry # pylint: disable=import-outside-toplevel
async def cleanup():
"""Cleanup."""
ent_reg = await entity_registry.async_get_reg... | [
"def",
"async_setup_cleanup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"dev_reg",
":",
"DeviceRegistry",
")",
"->",
"None",
":",
"from",
".",
"import",
"entity_registry",
"# pylint: disable=import-outside-toplevel",
"async",
"def",
"cleanup",
"(",
")",
":",
"\"\"... | [
585,
0
] | [
621,
74
] | python | en | ['en', 'en', 'en'] | True |
_normalize_connections | (connections: set) | Normalize connections to ensure we can match mac addresses. | Normalize connections to ensure we can match mac addresses. | def _normalize_connections(connections: set) -> set:
"""Normalize connections to ensure we can match mac addresses."""
return {
(key, format_mac(value)) if key == CONNECTION_NETWORK_MAC else (key, value)
for key, value in connections
} | [
"def",
"_normalize_connections",
"(",
"connections",
":",
"set",
")",
"->",
"set",
":",
"return",
"{",
"(",
"key",
",",
"format_mac",
"(",
"value",
")",
")",
"if",
"key",
"==",
"CONNECTION_NETWORK_MAC",
"else",
"(",
"key",
",",
"value",
")",
"for",
"key"... | [
624,
0
] | [
629,
5
] | python | en | ['en', 'en', 'en'] | True |
_add_device_to_index | (
devices_index: dict, device: Union[DeviceEntry, DeletedDeviceEntry]
) | Add a device to the index. | Add a device to the index. | def _add_device_to_index(
devices_index: dict, device: Union[DeviceEntry, DeletedDeviceEntry]
) -> None:
"""Add a device to the index."""
for identifier in device.identifiers:
devices_index[IDX_IDENTIFIERS][identifier] = device.id
for connection in device.connections:
devices_index[IDX_C... | [
"def",
"_add_device_to_index",
"(",
"devices_index",
":",
"dict",
",",
"device",
":",
"Union",
"[",
"DeviceEntry",
",",
"DeletedDeviceEntry",
"]",
")",
"->",
"None",
":",
"for",
"identifier",
"in",
"device",
".",
"identifiers",
":",
"devices_index",
"[",
"IDX_... | [
632,
0
] | [
639,
62
] | python | en | ['en', 'en', 'en'] | True |
_remove_device_from_index | (
devices_index: dict, device: Union[DeviceEntry, DeletedDeviceEntry]
) | Remove a device from the index. | Remove a device from the index. | def _remove_device_from_index(
devices_index: dict, device: Union[DeviceEntry, DeletedDeviceEntry]
) -> None:
"""Remove a device from the index."""
for identifier in device.identifiers:
if identifier in devices_index[IDX_IDENTIFIERS]:
del devices_index[IDX_IDENTIFIERS][identifier]
fo... | [
"def",
"_remove_device_from_index",
"(",
"devices_index",
":",
"dict",
",",
"device",
":",
"Union",
"[",
"DeviceEntry",
",",
"DeletedDeviceEntry",
"]",
")",
"->",
"None",
":",
"for",
"identifier",
"in",
"device",
".",
"identifiers",
":",
"if",
"identifier",
"i... | [
642,
0
] | [
651,
58
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry.__init__ | (self, hass: HomeAssistantType) | Initialize the device registry. | Initialize the device registry. | def __init__(self, hass: HomeAssistantType) -> None:
"""Initialize the device registry."""
self.hass = hass
self._store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
self._clear_index() | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
")",
"->",
"None",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"_store",
"=",
"hass",
".",
"helpers",
".",
"storage",
".",
"Store",
"(",
"STORAGE_VERSION",
",",
"STORAGE_KEY",... | [
107,
4
] | [
111,
27
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry.async_get | (self, device_id: str) | Get device. | Get device. | def async_get(self, device_id: str) -> Optional[DeviceEntry]:
"""Get device."""
return self.devices.get(device_id) | [
"def",
"async_get",
"(",
"self",
",",
"device_id",
":",
"str",
")",
"->",
"Optional",
"[",
"DeviceEntry",
"]",
":",
"return",
"self",
".",
"devices",
".",
"get",
"(",
"device_id",
")"
] | [
114,
4
] | [
116,
42
] | python | en | ['fr', 'en', 'en'] | False |
DeviceRegistry.async_get_device | (
self, identifiers: set, connections: set
) | Check if device is registered. | Check if device is registered. | def async_get_device(
self, identifiers: set, connections: set
) -> Optional[DeviceEntry]:
"""Check if device is registered."""
device_id = self._async_get_device_id_from_index(
REGISTERED_DEVICE, identifiers, connections
)
if device_id is None:
return... | [
"def",
"async_get_device",
"(",
"self",
",",
"identifiers",
":",
"set",
",",
"connections",
":",
"set",
")",
"->",
"Optional",
"[",
"DeviceEntry",
"]",
":",
"device_id",
"=",
"self",
".",
"_async_get_device_id_from_index",
"(",
"REGISTERED_DEVICE",
",",
"identif... | [
119,
4
] | [
128,
38
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry._async_get_deleted_device | (
self, identifiers: set, connections: set
) | Check if device is deleted. | Check if device is deleted. | def _async_get_deleted_device(
self, identifiers: set, connections: set
) -> Optional[DeletedDeviceEntry]:
"""Check if device is deleted."""
device_id = self._async_get_device_id_from_index(
DELETED_DEVICE, identifiers, connections
)
if device_id is None:
... | [
"def",
"_async_get_deleted_device",
"(",
"self",
",",
"identifiers",
":",
"set",
",",
"connections",
":",
"set",
")",
"->",
"Optional",
"[",
"DeletedDeviceEntry",
"]",
":",
"device_id",
"=",
"self",
".",
"_async_get_device_id_from_index",
"(",
"DELETED_DEVICE",
",... | [
130,
4
] | [
139,
46
] | python | en | ['nl', 'en', 'en'] | True |
DeviceRegistry._async_get_device_id_from_index | (
self, index: str, identifiers: set, connections: set
) | Check if device has previously been registered. | Check if device has previously been registered. | def _async_get_device_id_from_index(
self, index: str, identifiers: set, connections: set
) -> Optional[str]:
"""Check if device has previously been registered."""
devices_index = self._devices_index[index]
for identifier in identifiers:
if identifier in devices_index[IDX... | [
"def",
"_async_get_device_id_from_index",
"(",
"self",
",",
"index",
":",
"str",
",",
"identifiers",
":",
"set",
",",
"connections",
":",
"set",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"devices_index",
"=",
"self",
".",
"_devices_index",
"[",
"index",
... | [
141,
4
] | [
154,
19
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry._add_device | (self, device: Union[DeviceEntry, DeletedDeviceEntry]) | Add a device and index it. | Add a device and index it. | def _add_device(self, device: Union[DeviceEntry, DeletedDeviceEntry]) -> None:
"""Add a device and index it."""
if isinstance(device, DeletedDeviceEntry):
devices_index = self._devices_index[DELETED_DEVICE]
self.deleted_devices[device.id] = device
else:
device... | [
"def",
"_add_device",
"(",
"self",
",",
"device",
":",
"Union",
"[",
"DeviceEntry",
",",
"DeletedDeviceEntry",
"]",
")",
"->",
"None",
":",
"if",
"isinstance",
"(",
"device",
",",
"DeletedDeviceEntry",
")",
":",
"devices_index",
"=",
"self",
".",
"_devices_i... | [
156,
4
] | [
165,
51
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry._remove_device | (self, device: Union[DeviceEntry, DeletedDeviceEntry]) | Remove a device and remove it from the index. | Remove a device and remove it from the index. | def _remove_device(self, device: Union[DeviceEntry, DeletedDeviceEntry]) -> None:
"""Remove a device and remove it from the index."""
if isinstance(device, DeletedDeviceEntry):
devices_index = self._devices_index[DELETED_DEVICE]
self.deleted_devices.pop(device.id)
else:
... | [
"def",
"_remove_device",
"(",
"self",
",",
"device",
":",
"Union",
"[",
"DeviceEntry",
",",
"DeletedDeviceEntry",
"]",
")",
"->",
"None",
":",
"if",
"isinstance",
"(",
"device",
",",
"DeletedDeviceEntry",
")",
":",
"devices_index",
"=",
"self",
".",
"_device... | [
167,
4
] | [
176,
56
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry._update_device | (self, old_device: DeviceEntry, new_device: DeviceEntry) | Update a device and the index. | Update a device and the index. | def _update_device(self, old_device: DeviceEntry, new_device: DeviceEntry) -> None:
"""Update a device and the index."""
self.devices[new_device.id] = new_device
devices_index = self._devices_index[REGISTERED_DEVICE]
_remove_device_from_index(devices_index, old_device)
_add_devi... | [
"def",
"_update_device",
"(",
"self",
",",
"old_device",
":",
"DeviceEntry",
",",
"new_device",
":",
"DeviceEntry",
")",
"->",
"None",
":",
"self",
".",
"devices",
"[",
"new_device",
".",
"id",
"]",
"=",
"new_device",
"devices_index",
"=",
"self",
".",
"_d... | [
178,
4
] | [
184,
55
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry._clear_index | (self) | Clear the index. | Clear the index. | def _clear_index(self):
"""Clear the index."""
self._devices_index = {
REGISTERED_DEVICE: {IDX_IDENTIFIERS: {}, IDX_CONNECTIONS: {}},
DELETED_DEVICE: {IDX_IDENTIFIERS: {}, IDX_CONNECTIONS: {}},
} | [
"def",
"_clear_index",
"(",
"self",
")",
":",
"self",
".",
"_devices_index",
"=",
"{",
"REGISTERED_DEVICE",
":",
"{",
"IDX_IDENTIFIERS",
":",
"{",
"}",
",",
"IDX_CONNECTIONS",
":",
"{",
"}",
"}",
",",
"DELETED_DEVICE",
":",
"{",
"IDX_IDENTIFIERS",
":",
"{"... | [
186,
4
] | [
191,
9
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry._rebuild_index | (self) | Create the index after loading devices. | Create the index after loading devices. | def _rebuild_index(self):
"""Create the index after loading devices."""
self._clear_index()
for device in self.devices.values():
_add_device_to_index(self._devices_index[REGISTERED_DEVICE], device)
for device in self.deleted_devices.values():
_add_device_to_index(... | [
"def",
"_rebuild_index",
"(",
"self",
")",
":",
"self",
".",
"_clear_index",
"(",
")",
"for",
"device",
"in",
"self",
".",
"devices",
".",
"values",
"(",
")",
":",
"_add_device_to_index",
"(",
"self",
".",
"_devices_index",
"[",
"REGISTERED_DEVICE",
"]",
"... | [
193,
4
] | [
199,
77
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry.async_get_or_create | (
self,
*,
config_entry_id,
connections=None,
identifiers=None,
manufacturer=_UNDEF,
model=_UNDEF,
name=_UNDEF,
default_manufacturer=_UNDEF,
default_model=_UNDEF,
default_name=_UNDEF,
sw_version=_UNDEF,
entry_type=_U... | Get device. Create if it doesn't exist. | Get device. Create if it doesn't exist. | def async_get_or_create(
self,
*,
config_entry_id,
connections=None,
identifiers=None,
manufacturer=_UNDEF,
model=_UNDEF,
name=_UNDEF,
default_manufacturer=_UNDEF,
default_model=_UNDEF,
default_name=_UNDEF,
sw_version=_UNDEF... | [
"def",
"async_get_or_create",
"(",
"self",
",",
"*",
",",
"config_entry_id",
",",
"connections",
"=",
"None",
",",
"identifiers",
"=",
"None",
",",
"manufacturer",
"=",
"_UNDEF",
",",
"model",
"=",
"_UNDEF",
",",
"name",
"=",
"_UNDEF",
",",
"default_manufact... | [
202,
4
] | [
269,
9
] | python | en | ['fr', 'en', 'en'] | True |
DeviceRegistry.async_update_device | (
self,
device_id,
*,
area_id=_UNDEF,
manufacturer=_UNDEF,
model=_UNDEF,
name=_UNDEF,
name_by_user=_UNDEF,
new_identifiers=_UNDEF,
sw_version=_UNDEF,
via_device_id=_UNDEF,
remove_config_entry_id=_UNDEF,
) | Update properties of a device. | Update properties of a device. | def async_update_device(
self,
device_id,
*,
area_id=_UNDEF,
manufacturer=_UNDEF,
model=_UNDEF,
name=_UNDEF,
name_by_user=_UNDEF,
new_identifiers=_UNDEF,
sw_version=_UNDEF,
via_device_id=_UNDEF,
remove_config_entry_id=_UNDEF... | [
"def",
"async_update_device",
"(",
"self",
",",
"device_id",
",",
"*",
",",
"area_id",
"=",
"_UNDEF",
",",
"manufacturer",
"=",
"_UNDEF",
",",
"model",
"=",
"_UNDEF",
",",
"name",
"=",
"_UNDEF",
",",
"name_by_user",
"=",
"_UNDEF",
",",
"new_identifiers",
"... | [
272,
4
] | [
298,
9
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry._async_update_device | (
self,
device_id,
*,
add_config_entry_id=_UNDEF,
remove_config_entry_id=_UNDEF,
merge_connections=_UNDEF,
merge_identifiers=_UNDEF,
new_identifiers=_UNDEF,
manufacturer=_UNDEF,
model=_UNDEF,
name=_UNDEF,
sw_version=_UNDEF,
... | Update device attributes. | Update device attributes. | def _async_update_device(
self,
device_id,
*,
add_config_entry_id=_UNDEF,
remove_config_entry_id=_UNDEF,
merge_connections=_UNDEF,
merge_identifiers=_UNDEF,
new_identifiers=_UNDEF,
manufacturer=_UNDEF,
model=_UNDEF,
name=_UNDEF,
... | [
"def",
"_async_update_device",
"(",
"self",
",",
"device_id",
",",
"*",
",",
"add_config_entry_id",
"=",
"_UNDEF",
",",
"remove_config_entry_id",
"=",
"_UNDEF",
",",
"merge_connections",
"=",
"_UNDEF",
",",
"merge_identifiers",
"=",
"_UNDEF",
",",
"new_identifiers",... | [
301,
4
] | [
392,
18
] | python | en | ['fr', 'en', 'en'] | True |
DeviceRegistry.async_remove_device | (self, device_id: str) | Remove a device from the device registry. | Remove a device from the device registry. | def async_remove_device(self, device_id: str) -> None:
"""Remove a device from the device registry."""
device = self.devices[device_id]
self._remove_device(device)
self._add_device(
DeletedDeviceEntry(
config_entries=device.config_entries,
conn... | [
"def",
"async_remove_device",
"(",
"self",
",",
"device_id",
":",
"str",
")",
"->",
"None",
":",
"device",
"=",
"self",
".",
"devices",
"[",
"device_id",
"]",
"self",
".",
"_remove_device",
"(",
"device",
")",
"self",
".",
"_add_device",
"(",
"DeletedDevic... | [
395,
4
] | [
410,
34
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry.async_load | (self) | Load the device registry. | Load the device registry. | async def async_load(self):
"""Load the device registry."""
async_setup_cleanup(self.hass, self)
data = await self._store.async_load()
devices = OrderedDict()
deleted_devices = OrderedDict()
if data is not None:
for device in data["devices"]:
... | [
"async",
"def",
"async_load",
"(",
"self",
")",
":",
"async_setup_cleanup",
"(",
"self",
".",
"hass",
",",
"self",
")",
"data",
"=",
"await",
"self",
".",
"_store",
".",
"async_load",
"(",
")",
"devices",
"=",
"OrderedDict",
"(",
")",
"deleted_devices",
... | [
412,
4
] | [
454,
29
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry.async_schedule_save | (self) | Schedule saving the device registry. | Schedule saving the device registry. | def async_schedule_save(self) -> None:
"""Schedule saving the device registry."""
self._store.async_delay_save(self._data_to_save, SAVE_DELAY) | [
"def",
"async_schedule_save",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_store",
".",
"async_delay_save",
"(",
"self",
".",
"_data_to_save",
",",
"SAVE_DELAY",
")"
] | [
457,
4
] | [
459,
68
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry._data_to_save | (self) | Return data of device registry to store in a file. | Return data of device registry to store in a file. | def _data_to_save(self) -> Dict[str, List[Dict[str, Any]]]:
"""Return data of device registry to store in a file."""
data = {}
data["devices"] = [
{
"config_entries": list(entry.config_entries),
"connections": list(entry.connections),
... | [
"def",
"_data_to_save",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
"]",
":",
"data",
"=",
"{",
"}",
"data",
"[",
"\"devices\"",
"]",
"=",
"[",
"{",
"\"config_entries\"",
":",
"list",
"(... | [
462,
4
] | [
493,
19
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry.async_clear_config_entry | (self, config_entry_id: str) | Clear config entry from registry entries. | Clear config entry from registry entries. | def async_clear_config_entry(self, config_entry_id: str) -> None:
"""Clear config entry from registry entries."""
for device in list(self.devices.values()):
self._async_update_device(device.id, remove_config_entry_id=config_entry_id)
for deleted_device in list(self.deleted_devices.va... | [
"def",
"async_clear_config_entry",
"(",
"self",
",",
"config_entry_id",
":",
"str",
")",
"->",
"None",
":",
"for",
"device",
"in",
"list",
"(",
"self",
".",
"devices",
".",
"values",
"(",
")",
")",
":",
"self",
".",
"_async_update_device",
"(",
"device",
... | [
496,
4
] | [
514,
38
] | python | en | ['en', 'en', 'en'] | True |
DeviceRegistry.async_clear_area_id | (self, area_id: str) | Clear area id from registry entries. | Clear area id from registry entries. | def async_clear_area_id(self, area_id: str) -> None:
"""Clear area id from registry entries."""
for dev_id, device in self.devices.items():
if area_id == device.area_id:
self._async_update_device(dev_id, area_id=None) | [
"def",
"async_clear_area_id",
"(",
"self",
",",
"area_id",
":",
"str",
")",
"->",
"None",
":",
"for",
"dev_id",
",",
"device",
"in",
"self",
".",
"devices",
".",
"items",
"(",
")",
":",
"if",
"area_id",
"==",
"device",
".",
"area_id",
":",
"self",
".... | [
517,
4
] | [
521,
63
] | python | en | ['en', 'en', 'en'] | True |
test_switch_state | (
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) | Test the creation and values of the WLED switches. | Test the creation and values of the WLED switches. | async def test_switch_state(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the creation and values of the WLED switches."""
await init_integration(hass, aioclient_mock)
entity_registry = await hass.helpers.entity_registry.async_get_registry()
state = hass.states.get("... | [
"async",
"def",
"test_switch_state",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"init_integration",
"(",
"hass",
",",
"aioclient_mock",
")",
"entity_registry",
"=",
"await",
"hass",
".",
... | [
26,
0
] | [
64,
57
] | python | en | ['en', 'en', 'en'] | True |
test_switch_change_state | (
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) | Test the change of state of the WLED switches. | Test the change of state of the WLED switches. | async def test_switch_change_state(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the change of state of the WLED switches."""
await init_integration(hass, aioclient_mock)
# Nightlight
with patch("wled.WLED.nightlight") as nightlight_mock:
await hass.services.a... | [
"async",
"def",
"test_switch_change_state",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"init_integration",
"(",
"hass",
",",
"aioclient_mock",
")",
"# Nightlight",
"with",
"patch",
"(",
"\... | [
67,
0
] | [
134,
55
] | python | en | ['en', 'en', 'en'] | True |
test_switch_error | (
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, caplog
) | Test error handling of the WLED switches. | Test error handling of the WLED switches. | async def test_switch_error(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, caplog
) -> None:
"""Test error handling of the WLED switches."""
aioclient_mock.post("http://192.168.1.123:80/json/state", text="", status=400)
await init_integration(hass, aioclient_mock)
with patch("homeassist... | [
"async",
"def",
"test_switch_error",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
"caplog",
")",
"->",
"None",
":",
"aioclient_mock",
".",
"post",
"(",
"\"http://192.168.1.123:80/json/state\"",
",",
"text",
"=",
"\"\"",
... | [
137,
0
] | [
155,
57
] | python | en | ['en', 'en', 'en'] | True |
test_switch_connection_error | (
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) | Test error handling of the WLED switches. | Test error handling of the WLED switches. | async def test_switch_connection_error(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test error handling of the WLED switches."""
await init_integration(hass, aioclient_mock)
with patch("homeassistant.components.wled.WLED.update"), patch(
"homeassistant.components.wled... | [
"async",
"def",
"test_switch_connection_error",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"init_integration",
"(",
"hass",
",",
"aioclient_mock",
")",
"with",
"patch",
"(",
"\"homeassistant... | [
158,
0
] | [
176,
47
] | python | en | ['en', 'en', 'en'] | True |
documentation_url | (value: str) | Validate that a documentation url has the correct path and domain. | Validate that a documentation url has the correct path and domain. | def documentation_url(value: str) -> str:
"""Validate that a documentation url has the correct path and domain."""
if value in DOCUMENTATION_URL_EXCEPTIONS:
return value
parsed_url = urlparse(value)
if parsed_url.scheme != DOCUMENTATION_URL_SCHEMA:
raise vol.Invalid("Documentation url i... | [
"def",
"documentation_url",
"(",
"value",
":",
"str",
")",
"->",
"str",
":",
"if",
"value",
"in",
"DOCUMENTATION_URL_EXCEPTIONS",
":",
"return",
"value",
"parsed_url",
"=",
"urlparse",
"(",
"value",
")",
"if",
"parsed_url",
".",
"scheme",
"!=",
"DOCUMENTATION_... | [
17,
0
] | [
32,
16
] | python | en | ['en', 'en', 'en'] | True |
validate_manifest | (integration: Integration) | Validate manifest. | Validate manifest. | def validate_manifest(integration: Integration):
"""Validate manifest."""
try:
MANIFEST_SCHEMA(integration.manifest)
except vol.Invalid as err:
integration.add_error(
"manifest", f"Invalid manifest: {humanize_error(integration.manifest, err)}"
)
integration.manife... | [
"def",
"validate_manifest",
"(",
"integration",
":",
"Integration",
")",
":",
"try",
":",
"MANIFEST_SCHEMA",
"(",
"integration",
".",
"manifest",
")",
"except",
"vol",
".",
"Invalid",
"as",
"err",
":",
"integration",
".",
"add_error",
"(",
"\"manifest\"",
",",... | [
73,
0
] | [
85,
75
] | python | bg | ['en', 'et', 'bg'] | False |
validate | (integrations: Dict[str, Integration], config) | Handle all integrations manifests. | Handle all integrations manifests. | def validate(integrations: Dict[str, Integration], config):
"""Handle all integrations manifests."""
for integration in integrations.values():
if integration.manifest:
validate_manifest(integration) | [
"def",
"validate",
"(",
"integrations",
":",
"Dict",
"[",
"str",
",",
"Integration",
"]",
",",
"config",
")",
":",
"for",
"integration",
"in",
"integrations",
".",
"values",
"(",
")",
":",
"if",
"integration",
".",
"manifest",
":",
"validate_manifest",
"("... | [
88,
0
] | [
92,
42
] | python | en | ['en', 'en', 'en'] | True |
list_containers | () | List the jobs in the cluster.
Returns:
None.
| List the jobs in the cluster. | def list_containers():
"""List the jobs in the cluster.
Returns:
None.
"""
name_to_container_details = redis_controller.get_name_to_container_details()
return list(name_to_container_details.values()) | [
"def",
"list_containers",
"(",
")",
":",
"name_to_container_details",
"=",
"redis_controller",
".",
"get_name_to_container_details",
"(",
")",
"return",
"list",
"(",
"name_to_container_details",
".",
"values",
"(",
")",
")"
] | [
19,
0
] | [
27,
51
] | python | en | ['en', 'en', 'en'] | True |
test_reproducing_states | (hass, caplog) | Test reproducing Input number states. | Test reproducing Input number states. | async def test_reproducing_states(hass, caplog):
"""Test reproducing Input number states."""
assert await async_setup_component(
hass,
"input_number",
{
"input_number": {
"test_number": {"min": "5", "max": "100", "initial": VALID_NUMBER1}
}
... | [
"async",
"def",
"test_reproducing_states",
"(",
"hass",
",",
"caplog",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"input_number\"",
",",
"{",
"\"input_number\"",
":",
"{",
"\"test_number\"",
":",
"{",
"\"min\"",
":",
"\"5\"",
",",
... | [
8,
0
] | [
58,
5
] | python | en | ['en', 'en', 'en'] | True |
test_already_configured | (hass, step) | Test config flow when iaqualink component is already setup. | Test config flow when iaqualink component is already setup. | async def test_already_configured(hass, step):
"""Test config flow when iaqualink component is already setup."""
MockConfigEntry(domain="iaqualink", data=DATA).add_to_hass(hass)
flow = config_flow.AqualinkFlowHandler()
flow.hass = hass
flow.context = {}
fname = f"async_step_{step}"
func = ... | [
"async",
"def",
"test_already_configured",
"(",
"hass",
",",
"step",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"\"iaqualink\"",
",",
"data",
"=",
"DATA",
")",
".",
"add_to_hass",
"(",
"hass",
")",
"flow",
"=",
"config_flow",
".",
"AqualinkFlowHandler",
... | [
14,
0
] | [
26,
36
] | python | en | ['en', 'en', 'en'] | True |
test_without_config | (hass, step) | Test with no configuration. | Test with no configuration. | async def test_without_config(hass, step):
"""Test with no configuration."""
flow = config_flow.AqualinkFlowHandler()
flow.hass = hass
flow.context = {}
fname = f"async_step_{step}"
func = getattr(flow, fname)
result = await func()
assert result["type"] == "form"
assert result["ste... | [
"async",
"def",
"test_without_config",
"(",
"hass",
",",
"step",
")",
":",
"flow",
"=",
"config_flow",
".",
"AqualinkFlowHandler",
"(",
")",
"flow",
".",
"hass",
"=",
"hass",
"flow",
".",
"context",
"=",
"{",
"}",
"fname",
"=",
"f\"async_step_{step}\"",
"f... | [
30,
0
] | [
42,
33
] | python | en | ['en', 'en', 'en'] | True |
test_with_invalid_credentials | (hass, step) | Test config flow with invalid username and/or password. | Test config flow with invalid username and/or password. | async def test_with_invalid_credentials(hass, step):
"""Test config flow with invalid username and/or password."""
flow = config_flow.AqualinkFlowHandler()
flow.hass = hass
fname = f"async_step_{step}"
func = getattr(flow, fname)
with patch(
"iaqualink.AqualinkClient.login", side_effect... | [
"async",
"def",
"test_with_invalid_credentials",
"(",
"hass",
",",
"step",
")",
":",
"flow",
"=",
"config_flow",
".",
"AqualinkFlowHandler",
"(",
")",
"flow",
".",
"hass",
"=",
"hass",
"fname",
"=",
"f\"async_step_{step}\"",
"func",
"=",
"getattr",
"(",
"flow"... | [
46,
0
] | [
60,
57
] | python | en | ['en', 'en', 'en'] | True |
test_with_existing_config | (hass, step) | Test with existing configuration. | Test with existing configuration. | async def test_with_existing_config(hass, step):
"""Test with existing configuration."""
flow = config_flow.AqualinkFlowHandler()
flow.hass = hass
flow.context = {}
fname = f"async_step_{step}"
func = getattr(flow, fname)
with patch("iaqualink.AqualinkClient.login", return_value=mock_coro(N... | [
"async",
"def",
"test_with_existing_config",
"(",
"hass",
",",
"step",
")",
":",
"flow",
"=",
"config_flow",
".",
"AqualinkFlowHandler",
"(",
")",
"flow",
".",
"hass",
"=",
"hass",
"flow",
".",
"context",
"=",
"{",
"}",
"fname",
"=",
"f\"async_step_{step}\""... | [
64,
0
] | [
77,
33
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType,
entry: ConfigEntry,
async_add_entities: Callable[[List[Entity], bool], None],
) | Set up WLED switch based on a config entry. | Set up WLED switch based on a config entry. | async def async_setup_entry(
hass: HomeAssistantType,
entry: ConfigEntry,
async_add_entities: Callable[[List[Entity], bool], None],
) -> None:
"""Set up WLED switch based on a config entry."""
coordinator: WLEDDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
switches = [
WLEDNi... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"Callable",
"[",
"[",
"List",
"[",
"Entity",
"]",
",",
"bool",
"]",
",",
"None",
"]",
",",
")",
"->",
"None",
":... | [
20,
0
] | [
33,
38
] | python | en | ['en', 'en', 'en'] | True |
WLEDSwitch.__init__ | (
self,
*,
entry_id: str,
coordinator: WLEDDataUpdateCoordinator,
name: str,
icon: str,
key: str,
) | Initialize WLED switch. | Initialize WLED switch. | def __init__(
self,
*,
entry_id: str,
coordinator: WLEDDataUpdateCoordinator,
name: str,
icon: str,
key: str,
) -> None:
"""Initialize WLED switch."""
self._key = key
super().__init__(
entry_id=entry_id, coordinator=coordina... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
",",
"name",
":",
"str",
",",
"icon",
":",
"str",
",",
"key",
":",
"str",
",",
")",
"->",
"None",
":",
"self",
".",
"_key",
... | [
39,
4
] | [
52,
9
] | python | en | ['en', 'pl', 'en'] | True |
WLEDSwitch.unique_id | (self) | Return the unique ID for this sensor. | Return the unique ID for this sensor. | def unique_id(self) -> str:
"""Return the unique ID for this sensor."""
return f"{self.coordinator.data.info.mac_address}_{self._key}" | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{self.coordinator.data.info.mac_address}_{self._key}\""
] | [
55,
4
] | [
57,
70
] | python | en | ['en', 'la', 'en'] | True |
WLEDNightlightSwitch.__init__ | (self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) | Initialize WLED nightlight switch. | Initialize WLED nightlight switch. | def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None:
"""Initialize WLED nightlight switch."""
super().__init__(
coordinator=coordinator,
entry_id=entry_id,
icon="mdi:weather-night",
key="nightlight",
name=f"{coordi... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"entry_id",
"=",
"entry_id",
",",
"i... | [
63,
4
] | [
71,
9
] | python | en | ['en', 'pl', 'en'] | True |
WLEDNightlightSwitch.device_state_attributes | (self) | Return the state attributes of the entity. | Return the state attributes of the entity. | def device_state_attributes(self) -> Optional[Dict[str, Any]]:
"""Return the state attributes of the entity."""
return {
ATTR_DURATION: self.coordinator.data.state.nightlight.duration,
ATTR_FADE: self.coordinator.data.state.nightlight.fade,
ATTR_TARGET_BRIGHTNESS: sel... | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"{",
"ATTR_DURATION",
":",
"self",
".",
"coordinator",
".",
"data",
".",
"state",
".",
"nightlight",
".",
"duration",
",",... | [
74,
4
] | [
80,
9
] | python | en | ['en', 'en', 'en'] | True |
WLEDNightlightSwitch.is_on | (self) | Return the state of the switch. | Return the state of the switch. | def is_on(self) -> bool:
"""Return the state of the switch."""
return bool(self.coordinator.data.state.nightlight.on) | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"coordinator",
".",
"data",
".",
"state",
".",
"nightlight",
".",
"on",
")"
] | [
83,
4
] | [
85,
62
] | python | en | ['en', 'en', 'en'] | True |
WLEDNightlightSwitch.async_turn_off | (self, **kwargs: Any) | Turn off the WLED nightlight switch. | Turn off the WLED nightlight switch. | async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the WLED nightlight switch."""
await self.coordinator.wled.nightlight(on=False) | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"await",
"self",
".",
"coordinator",
".",
"wled",
".",
"nightlight",
"(",
"on",
"=",
"False",
")"
] | [
88,
4
] | [
90,
56
] | python | en | ['en', 'en', 'en'] | True |
WLEDNightlightSwitch.async_turn_on | (self, **kwargs: Any) | Turn on the WLED nightlight switch. | Turn on the WLED nightlight switch. | async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the WLED nightlight switch."""
await self.coordinator.wled.nightlight(on=True) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"await",
"self",
".",
"coordinator",
".",
"wled",
".",
"nightlight",
"(",
"on",
"=",
"True",
")"
] | [
93,
4
] | [
95,
55
] | python | en | ['en', 'en', 'en'] | True |
WLEDSyncSendSwitch.__init__ | (self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) | Initialize WLED sync send switch. | Initialize WLED sync send switch. | def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None:
"""Initialize WLED sync send switch."""
super().__init__(
coordinator=coordinator,
entry_id=entry_id,
icon="mdi:upload-network-outline",
key="sync_send",
name=f"... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"entry_id",
"=",
"entry_id",
",",
"i... | [
101,
4
] | [
109,
9
] | python | en | ['en', 'en', 'en'] | True |
WLEDSyncSendSwitch.device_state_attributes | (self) | Return the state attributes of the entity. | Return the state attributes of the entity. | def device_state_attributes(self) -> Optional[Dict[str, Any]]:
"""Return the state attributes of the entity."""
return {ATTR_UDP_PORT: self.coordinator.data.info.udp_port} | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"{",
"ATTR_UDP_PORT",
":",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"udp_port",
"}"
] | [
112,
4
] | [
114,
67
] | python | en | ['en', 'en', 'en'] | True |
WLEDSyncSendSwitch.is_on | (self) | Return the state of the switch. | Return the state of the switch. | def is_on(self) -> bool:
"""Return the state of the switch."""
return bool(self.coordinator.data.state.sync.send) | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"coordinator",
".",
"data",
".",
"state",
".",
"sync",
".",
"send",
")"
] | [
117,
4
] | [
119,
58
] | python | en | ['en', 'en', 'en'] | True |
WLEDSyncSendSwitch.async_turn_off | (self, **kwargs: Any) | Turn off the WLED sync send switch. | Turn off the WLED sync send switch. | async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the WLED sync send switch."""
await self.coordinator.wled.sync(send=False) | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"await",
"self",
".",
"coordinator",
".",
"wled",
".",
"sync",
"(",
"send",
"=",
"False",
")"
] | [
122,
4
] | [
124,
52
] | python | en | ['en', 'en', 'en'] | True |
WLEDSyncSendSwitch.async_turn_on | (self, **kwargs: Any) | Turn on the WLED sync send switch. | Turn on the WLED sync send switch. | async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the WLED sync send switch."""
await self.coordinator.wled.sync(send=True) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"await",
"self",
".",
"coordinator",
".",
"wled",
".",
"sync",
"(",
"send",
"=",
"True",
")"
] | [
127,
4
] | [
129,
51
] | python | en | ['en', 'en', 'en'] | True |
WLEDSyncReceiveSwitch.__init__ | (self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) | Initialize WLED sync receive switch. | Initialize WLED sync receive switch. | def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator):
"""Initialize WLED sync receive switch."""
super().__init__(
coordinator=coordinator,
entry_id=entry_id,
icon="mdi:download-network-outline",
key="sync_receive",
name=f"... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"entry_id",
"=",
"entry_id",
",",
"icon",
"=",
"\"... | [
135,
4
] | [
143,
9
] | python | en | ['en', 'en', 'en'] | True |
WLEDSyncReceiveSwitch.device_state_attributes | (self) | Return the state attributes of the entity. | Return the state attributes of the entity. | def device_state_attributes(self) -> Optional[Dict[str, Any]]:
"""Return the state attributes of the entity."""
return {ATTR_UDP_PORT: self.coordinator.data.info.udp_port} | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"{",
"ATTR_UDP_PORT",
":",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"udp_port",
"}"
] | [
146,
4
] | [
148,
67
] | python | en | ['en', 'en', 'en'] | True |
WLEDSyncReceiveSwitch.is_on | (self) | Return the state of the switch. | Return the state of the switch. | def is_on(self) -> bool:
"""Return the state of the switch."""
return bool(self.coordinator.data.state.sync.receive) | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"coordinator",
".",
"data",
".",
"state",
".",
"sync",
".",
"receive",
")"
] | [
151,
4
] | [
153,
61
] | python | en | ['en', 'en', 'en'] | True |
WLEDSyncReceiveSwitch.async_turn_off | (self, **kwargs: Any) | Turn off the WLED sync receive switch. | Turn off the WLED sync receive switch. | async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the WLED sync receive switch."""
await self.coordinator.wled.sync(receive=False) | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"await",
"self",
".",
"coordinator",
".",
"wled",
".",
"sync",
"(",
"receive",
"=",
"False",
")"
] | [
156,
4
] | [
158,
55
] | python | en | ['en', 'en', 'en'] | True |
WLEDSyncReceiveSwitch.async_turn_on | (self, **kwargs: Any) | Turn on the WLED sync receive switch. | Turn on the WLED sync receive switch. | async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the WLED sync receive switch."""
await self.coordinator.wled.sync(receive=True) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"await",
"self",
".",
"coordinator",
".",
"wled",
".",
"sync",
"(",
"receive",
"=",
"True",
")"
] | [
161,
4
] | [
163,
54
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: dict) | Set up Home Connect component. | Set up Home Connect component. | async def async_setup(hass: HomeAssistant, config: dict) -> bool:
"""Set up Home Connect component."""
hass.data[DOMAIN] = {}
if DOMAIN not in config:
return True
config_flow.OAuth2FlowHandler.async_register_implementation(
hass,
config_entry_oauth2_flow.LocalOAuth2Implementati... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
"->",
"bool",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"if",
"DOMAIN",
"not",
"in",
"config",
":",
"return",
"True",
"config_flow",
... | [
37,
0
] | [
56,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Home Connect from a config entry. | Set up Home Connect from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Home Connect from a config entry."""
implementation = (
await config_entry_oauth2_flow.async_get_config_entry_implementation(
hass, entry
)
)
hc_api = api.ConfigEntryAuth(hass, entry, imp... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"implementation",
"=",
"(",
"await",
"config_entry_oauth2_flow",
".",
"async_get_config_entry_implementation",
"(",
"hass",
",",
"entry"... | [
59,
0
] | [
78,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
]
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"async_fo... | [
81,
0
] | [
94,
20
] | python | en | ['en', 'es', 'en'] | True |
update_all_devices | (hass, entry) | Update all the devices. | Update all the devices. | async def update_all_devices(hass, entry):
"""Update all the devices."""
data = hass.data[DOMAIN]
hc_api = data[entry.entry_id]
try:
await hass.async_add_executor_job(hc_api.get_devices)
for device_dict in hc_api.devices:
await hass.async_add_executor_job(device_dict["device"... | [
"async",
"def",
"update_all_devices",
"(",
"hass",
",",
"entry",
")",
":",
"data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"hc_api",
"=",
"data",
"[",
"entry",
".",
"entry_id",
"]",
"try",
":",
"await",
"hass",
".",
"async_add_executor_job",
"(",
... | [
98,
0
] | [
107,
78
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the PS4 Component. | Set up the PS4 Component. | async def async_setup(hass, config):
"""Set up the PS4 Component."""
hass.data[PS4_DATA] = PS4Data()
transport, protocol = await async_create_ddp_endpoint()
hass.data[PS4_DATA].protocol = protocol
_LOGGER.debug("PS4 DDP endpoint created: %s, %s", transport, protocol)
service_handle(hass)
re... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
"[",
"PS4_DATA",
"]",
"=",
"PS4Data",
"(",
")",
"transport",
",",
"protocol",
"=",
"await",
"async_create_ddp_endpoint",
"(",
")",
"hass",
".",
"data",
"[",
"PS4_DA... | [
51,
0
] | [
59,
15
] | 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.