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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
storage_collection | (hass) | Return an empty storage collection. | Return an empty storage collection. | def storage_collection(hass):
"""Return an empty storage collection."""
id_manager = collection.IDManager()
return person.PersonStorageCollection(
person.PersonStore(hass, person.STORAGE_VERSION, person.STORAGE_KEY),
logging.getLogger(f"{person.__name__}.storage_collection"),
id_mana... | [
"def",
"storage_collection",
"(",
"hass",
")",
":",
"id_manager",
"=",
"collection",
".",
"IDManager",
"(",
")",
"return",
"person",
".",
"PersonStorageCollection",
"(",
"person",
".",
"PersonStore",
"(",
"hass",
",",
"person",
".",
"STORAGE_VERSION",
",",
"pe... | [
34,
0
] | [
44,
5
] | python | en | ['en', 'en', 'en'] | True |
storage_setup | (hass, hass_storage, hass_admin_user) | Storage setup. | Storage setup. | def storage_setup(hass, hass_storage, hass_admin_user):
"""Storage setup."""
hass_storage[DOMAIN] = {
"key": DOMAIN,
"version": 1,
"data": {
"persons": [
{
"id": "1234",
"name": "tracked person",
"use... | [
"def",
"storage_setup",
"(",
"hass",
",",
"hass_storage",
",",
"hass_admin_user",
")",
":",
"hass_storage",
"[",
"DOMAIN",
"]",
"=",
"{",
"\"key\"",
":",
"DOMAIN",
",",
"\"version\"",
":",
"1",
",",
"\"data\"",
":",
"{",
"\"persons\"",
":",
"[",
"{",
"\"... | [
48,
0
] | [
64,
80
] | python | en | ['en', 'bs', 'en'] | False |
test_minimal_setup | (hass) | Test minimal config with only name. | Test minimal config with only name. | async def test_minimal_setup(hass):
"""Test minimal config with only name."""
config = {DOMAIN: {"id": "1234", "name": "test person"}}
assert await async_setup_component(hass, DOMAIN, config)
state = hass.states.get("person.test_person")
assert state.state == STATE_UNKNOWN
assert state.attribut... | [
"async",
"def",
"test_minimal_setup",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"id\"",
":",
"\"1234\"",
",",
"\"name\"",
":",
"\"test person\"",
"}",
"}",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
... | [
67,
0
] | [
78,
60
] | python | en | ['en', 'en', 'en'] | True |
test_setup_no_id | (hass) | Test config with no id. | Test config with no id. | async def test_setup_no_id(hass):
"""Test config with no id."""
config = {DOMAIN: {"name": "test user"}}
assert not await async_setup_component(hass, DOMAIN, config) | [
"async",
"def",
"test_setup_no_id",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"name\"",
":",
"\"test user\"",
"}",
"}",
"assert",
"not",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"config",
")"
] | [
81,
0
] | [
84,
64
] | python | en | ['en', 'en', 'en'] | True |
test_setup_no_name | (hass) | Test config with no name. | Test config with no name. | async def test_setup_no_name(hass):
"""Test config with no name."""
config = {DOMAIN: {"id": "1234"}}
assert not await async_setup_component(hass, DOMAIN, config) | [
"async",
"def",
"test_setup_no_name",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"id\"",
":",
"\"1234\"",
"}",
"}",
"assert",
"not",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"config",
")"
] | [
87,
0
] | [
90,
64
] | python | en | ['en', 'en', 'en'] | True |
test_setup_user_id | (hass, hass_admin_user) | Test config with user id. | Test config with user id. | async def test_setup_user_id(hass, hass_admin_user):
"""Test config with user id."""
user_id = hass_admin_user.id
config = {DOMAIN: {"id": "1234", "name": "test person", "user_id": user_id}}
assert await async_setup_component(hass, DOMAIN, config)
state = hass.states.get("person.test_person")
a... | [
"async",
"def",
"test_setup_user_id",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"user_id",
"=",
"hass_admin_user",
".",
"id",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"id\"",
":",
"\"1234\"",
",",
"\"name\"",
":",
"\"test person\"",
",",
"\"user_id\"",
... | [
93,
0
] | [
105,
56
] | python | en | ['en', 'en', 'en'] | True |
test_valid_invalid_user_ids | (hass, hass_admin_user) | Test a person with valid user id and a person with invalid user id . | Test a person with valid user id and a person with invalid user id . | async def test_valid_invalid_user_ids(hass, hass_admin_user):
"""Test a person with valid user id and a person with invalid user id ."""
user_id = hass_admin_user.id
config = {
DOMAIN: [
{"id": "1234", "name": "test valid user", "user_id": user_id},
{"id": "5678", "name": "te... | [
"async",
"def",
"test_valid_invalid_user_ids",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"user_id",
"=",
"hass_admin_user",
".",
"id",
"config",
"=",
"{",
"DOMAIN",
":",
"[",
"{",
"\"id\"",
":",
"\"1234\"",
",",
"\"name\"",
":",
"\"test valid user\"",
","... | [
108,
0
] | [
127,
24
] | python | en | ['en', 'en', 'en'] | True |
test_setup_tracker | (hass, hass_admin_user) | Test set up person with one device tracker. | Test set up person with one device tracker. | async def test_setup_tracker(hass, hass_admin_user):
"""Test set up person with one device tracker."""
hass.state = CoreState.not_running
user_id = hass_admin_user.id
config = {
DOMAIN: {
"id": "1234",
"name": "tracked person",
"user_id": user_id,
... | [
"async",
"def",
"test_setup_tracker",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"not_running",
"user_id",
"=",
"hass_admin_user",
".",
"id",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"id\"",
":",
"\"1234\"",
... | [
130,
0
] | [
183,
56
] | python | en | ['en', 'en', 'en'] | True |
test_setup_two_trackers | (hass, hass_admin_user) | Test set up person with two device trackers. | Test set up person with two device trackers. | async def test_setup_two_trackers(hass, hass_admin_user):
"""Test set up person with two device trackers."""
hass.state = CoreState.not_running
user_id = hass_admin_user.id
config = {
DOMAIN: {
"id": "1234",
"name": "tracked person",
"user_id": user_id,
... | [
"async",
"def",
"test_setup_two_trackers",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"not_running",
"user_id",
"=",
"hass_admin_user",
".",
"id",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"id\"",
":",
"\"1234... | [
186,
0
] | [
269,
62
] | python | en | ['en', 'en', 'en'] | True |
test_ignore_unavailable_states | (hass, hass_admin_user) | Test set up person with two device trackers, one unavailable. | Test set up person with two device trackers, one unavailable. | async def test_ignore_unavailable_states(hass, hass_admin_user):
"""Test set up person with two device trackers, one unavailable."""
hass.state = CoreState.not_running
user_id = hass_admin_user.id
config = {
DOMAIN: {
"id": "1234",
"name": "tracked person",
"u... | [
"async",
"def",
"test_ignore_unavailable_states",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"not_running",
"user_id",
"=",
"hass_admin_user",
".",
"id",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"id\"",
":",
... | [
272,
0
] | [
312,
36
] | python | en | ['en', 'en', 'en'] | True |
test_restore_home_state | (hass, hass_admin_user) | Test that the state is restored for a person on startup. | Test that the state is restored for a person on startup. | async def test_restore_home_state(hass, hass_admin_user):
"""Test that the state is restored for a person on startup."""
user_id = hass_admin_user.id
attrs = {
ATTR_ID: "1234",
ATTR_LATITUDE: 10.12346,
ATTR_LONGITUDE: 11.12346,
ATTR_SOURCE: DEVICE_TRACKER,
ATTR_USER_I... | [
"async",
"def",
"test_restore_home_state",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"user_id",
"=",
"hass_admin_user",
".",
"id",
"attrs",
"=",
"{",
"ATTR_ID",
":",
"\"1234\"",
",",
"ATTR_LATITUDE",
":",
"10.12346",
",",
"ATTR_LONGITUDE",
":",
"11.12346",
... | [
315,
0
] | [
348,
62
] | python | en | ['en', 'en', 'en'] | True |
test_duplicate_ids | (hass, hass_admin_user) | Test we don't allow duplicate IDs. | Test we don't allow duplicate IDs. | async def test_duplicate_ids(hass, hass_admin_user):
"""Test we don't allow duplicate IDs."""
config = {
DOMAIN: [
{"id": "1234", "name": "test user 1"},
{"id": "1234", "name": "test user 2"},
]
}
assert await async_setup_component(hass, DOMAIN, config)
asser... | [
"async",
"def",
"test_duplicate_ids",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"config",
"=",
"{",
"DOMAIN",
":",
"[",
"{",
"\"id\"",
":",
"\"1234\"",
",",
"\"name\"",
":",
"\"test user 1\"",
"}",
",",
"{",
"\"id\"",
":",
"\"1234\"",
",",
"\"name\"",... | [
351,
0
] | [
363,
56
] | python | en | ['en', 'en', 'en'] | True |
test_create_person_during_run | (hass) | Test that person is updated if created while hass is running. | Test that person is updated if created while hass is running. | async def test_create_person_during_run(hass):
"""Test that person is updated if created while hass is running."""
config = {DOMAIN: {}}
assert await async_setup_component(hass, DOMAIN, config)
hass.states.async_set(DEVICE_TRACKER, "home")
await hass.async_block_till_done()
await hass.component... | [
"async",
"def",
"test_create_person_during_run",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"}",
"}",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"config",
")",
"hass",
".",
"states",
".",
"async_set",
"... | [
366,
0
] | [
379,
32
] | python | en | ['en', 'en', 'en'] | True |
test_load_person_storage | (hass, hass_admin_user, storage_setup) | Test set up person from storage. | Test set up person from storage. | async def test_load_person_storage(hass, hass_admin_user, storage_setup):
"""Test set up person from storage."""
state = hass.states.get("person.tracked_person")
assert state.state == STATE_UNKNOWN
assert state.attributes.get(ATTR_ID) == "1234"
assert state.attributes.get(ATTR_LATITUDE) is None
... | [
"async",
"def",
"test_load_person_storage",
"(",
"hass",
",",
"hass_admin_user",
",",
"storage_setup",
")",
":",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"person.tracked_person\"",
")",
"assert",
"state",
".",
"state",
"==",
"STATE_UNKNOWN",
"asse... | [
382,
0
] | [
403,
67
] | python | en | ['en', 'en', 'en'] | True |
test_load_person_storage_two_nonlinked | (hass, hass_storage) | Test loading two users with both not having a user linked. | Test loading two users with both not having a user linked. | async def test_load_person_storage_two_nonlinked(hass, hass_storage):
"""Test loading two users with both not having a user linked."""
hass_storage[DOMAIN] = {
"key": DOMAIN,
"version": 1,
"data": {
"persons": [
{
"id": "1234",
... | [
"async",
"def",
"test_load_person_storage_two_nonlinked",
"(",
"hass",
",",
"hass_storage",
")",
":",
"hass_storage",
"[",
"DOMAIN",
"]",
"=",
"{",
"\"key\"",
":",
"DOMAIN",
",",
"\"version\"",
":",
"1",
",",
"\"data\"",
":",
"{",
"\"persons\"",
":",
"[",
"{... | [
406,
0
] | [
432,
65
] | python | en | ['en', 'en', 'en'] | True |
test_ws_list | (hass, hass_ws_client, storage_setup) | Test listing via WS. | Test listing via WS. | async def test_ws_list(hass, hass_ws_client, storage_setup):
"""Test listing via WS."""
manager = hass.data[DOMAIN][1]
client = await hass_ws_client(hass)
resp = await client.send_json({"id": 6, "type": "person/list"})
resp = await client.receive_json()
assert resp["success"]
assert resp["... | [
"async",
"def",
"test_ws_list",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"manager",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"1",
"]",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"resp",
"=",
"await",
... | [
435,
0
] | [
446,
45
] | python | hmn | ['nl', 'hmn', 'it'] | False |
test_ws_create | (hass, hass_ws_client, storage_setup, hass_read_only_user) | Test creating via WS. | Test creating via WS. | async def test_ws_create(hass, hass_ws_client, storage_setup, hass_read_only_user):
"""Test creating via WS."""
manager = hass.data[DOMAIN][1]
client = await hass_ws_client(hass)
resp = await client.send_json(
{
"id": 6,
"type": "person/create",
"name": "Hel... | [
"async",
"def",
"test_ws_create",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
",",
"hass_read_only_user",
")",
":",
"manager",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"1",
"]",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
... | [
449,
0
] | [
471,
39
] | python | en | ['nl', 'gd', 'en'] | False |
test_ws_create_requires_admin | (
hass, hass_ws_client, storage_setup, hass_admin_user, hass_read_only_user
) | Test creating via WS requires admin. | Test creating via WS requires admin. | async def test_ws_create_requires_admin(
hass, hass_ws_client, storage_setup, hass_admin_user, hass_read_only_user
):
"""Test creating via WS requires admin."""
hass_admin_user.groups = []
manager = hass.data[DOMAIN][1]
client = await hass_ws_client(hass)
resp = await client.send_json(
... | [
"async",
"def",
"test_ws_create_requires_admin",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
",",
"hass_admin_user",
",",
"hass_read_only_user",
")",
":",
"hass_admin_user",
".",
"groups",
"=",
"[",
"]",
"manager",
"=",
"hass",
".",
"data",
"[",
"D... | [
474,
0
] | [
497,
30
] | python | en | ['nl', 'en', 'en'] | True |
test_ws_update | (hass, hass_ws_client, storage_setup) | Test updating via WS. | Test updating via WS. | async def test_ws_update(hass, hass_ws_client, storage_setup):
"""Test updating via WS."""
manager = hass.data[DOMAIN][1]
client = await hass_ws_client(hass)
persons = manager.async_items()
resp = await client.send_json(
{
"id": 6,
"type": "person/update",
... | [
"async",
"def",
"test_ws_update",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"manager",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"1",
"]",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"persons",
"=",
"man... | [
500,
0
] | [
544,
39
] | python | de | ['nl', 'de', 'en'] | False |
test_ws_update_require_admin | (
hass, hass_ws_client, storage_setup, hass_admin_user
) | Test updating via WS requires admin. | Test updating via WS requires admin. | async def test_ws_update_require_admin(
hass, hass_ws_client, storage_setup, hass_admin_user
):
"""Test updating via WS requires admin."""
hass_admin_user.groups = []
manager = hass.data[DOMAIN][1]
client = await hass_ws_client(hass)
original = dict(manager.async_items()[0])
resp = await c... | [
"async",
"def",
"test_ws_update_require_admin",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
",",
"hass_admin_user",
")",
":",
"hass_admin_user",
".",
"groups",
"=",
"[",
"]",
"manager",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"1",
"]... | [
547,
0
] | [
571,
34
] | python | en | ['nl', 'en', 'en'] | True |
test_ws_delete | (hass, hass_ws_client, storage_setup) | Test deleting via WS. | Test deleting via WS. | async def test_ws_delete(hass, hass_ws_client, storage_setup):
"""Test deleting via WS."""
manager = hass.data[DOMAIN][1]
client = await hass_ws_client(hass)
persons = manager.async_items()
resp = await client.send_json(
{"id": 6, "type": "person/delete", "person_id": persons[0]["id"]}
... | [
"async",
"def",
"test_ws_delete",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"manager",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"1",
"]",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"persons",
"=",
"man... | [
574,
0
] | [
592,
67
] | python | el-Latn | ['nl', 'el-Latn', 'it'] | False |
test_ws_delete_require_admin | (
hass, hass_ws_client, storage_setup, hass_admin_user
) | Test deleting via WS requires admin. | Test deleting via WS requires admin. | async def test_ws_delete_require_admin(
hass, hass_ws_client, storage_setup, hass_admin_user
):
"""Test deleting via WS requires admin."""
hass_admin_user.groups = []
manager = hass.data[DOMAIN][1]
client = await hass_ws_client(hass)
resp = await client.send_json(
{
"id": 6... | [
"async",
"def",
"test_ws_delete_require_admin",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
",",
"hass_admin_user",
")",
":",
"hass_admin_user",
".",
"groups",
"=",
"[",
"]",
"manager",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"1",
"]... | [
595,
0
] | [
618,
28
] | python | en | ['nl', 'en', 'en'] | True |
test_create_invalid_user_id | (hass, storage_collection) | Test we do not allow invalid user ID during creation. | Test we do not allow invalid user ID during creation. | async def test_create_invalid_user_id(hass, storage_collection):
"""Test we do not allow invalid user ID during creation."""
with pytest.raises(ValueError):
await storage_collection.async_create_item(
{"name": "Hello", "user_id": "non-existing"}
) | [
"async",
"def",
"test_create_invalid_user_id",
"(",
"hass",
",",
"storage_collection",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"ValueError",
")",
":",
"await",
"storage_collection",
".",
"async_create_item",
"(",
"{",
"\"name\"",
":",
"\"Hello\"",
",",
"... | [
621,
0
] | [
626,
9
] | python | en | ['en', 'en', 'en'] | True |
test_create_duplicate_user_id | (hass, hass_admin_user, storage_collection) | Test we do not allow duplicate user ID during creation. | Test we do not allow duplicate user ID during creation. | async def test_create_duplicate_user_id(hass, hass_admin_user, storage_collection):
"""Test we do not allow duplicate user ID during creation."""
await storage_collection.async_create_item(
{"name": "Hello", "user_id": hass_admin_user.id}
)
with pytest.raises(ValueError):
await storage_... | [
"async",
"def",
"test_create_duplicate_user_id",
"(",
"hass",
",",
"hass_admin_user",
",",
"storage_collection",
")",
":",
"await",
"storage_collection",
".",
"async_create_item",
"(",
"{",
"\"name\"",
":",
"\"Hello\"",
",",
"\"user_id\"",
":",
"hass_admin_user",
".",... | [
629,
0
] | [
638,
9
] | python | en | ['en', 'en', 'en'] | True |
test_update_double_user_id | (hass, hass_admin_user, storage_collection) | Test we do not allow double user ID during update. | Test we do not allow double user ID during update. | async def test_update_double_user_id(hass, hass_admin_user, storage_collection):
"""Test we do not allow double user ID during update."""
await storage_collection.async_create_item(
{"name": "Hello", "user_id": hass_admin_user.id}
)
person = await storage_collection.async_create_item({"name": "H... | [
"async",
"def",
"test_update_double_user_id",
"(",
"hass",
",",
"hass_admin_user",
",",
"storage_collection",
")",
":",
"await",
"storage_collection",
".",
"async_create_item",
"(",
"{",
"\"name\"",
":",
"\"Hello\"",
",",
"\"user_id\"",
":",
"hass_admin_user",
".",
... | [
641,
0
] | [
651,
9
] | python | en | ['en', 'en', 'en'] | True |
test_update_invalid_user_id | (hass, storage_collection) | Test updating to invalid user ID. | Test updating to invalid user ID. | async def test_update_invalid_user_id(hass, storage_collection):
"""Test updating to invalid user ID."""
person = await storage_collection.async_create_item({"name": "Hello"})
with pytest.raises(ValueError):
await storage_collection.async_update_item(
person["id"], {"user_id": "non-exis... | [
"async",
"def",
"test_update_invalid_user_id",
"(",
"hass",
",",
"storage_collection",
")",
":",
"person",
"=",
"await",
"storage_collection",
".",
"async_create_item",
"(",
"{",
"\"name\"",
":",
"\"Hello\"",
"}",
")",
"with",
"pytest",
".",
"raises",
"(",
"Valu... | [
654,
0
] | [
661,
9
] | python | en | ['en', 'en', 'en'] | True |
test_update_person_when_user_removed | (
hass, storage_setup, hass_read_only_user
) | Update person when user is removed. | Update person when user is removed. | async def test_update_person_when_user_removed(
hass, storage_setup, hass_read_only_user
):
"""Update person when user is removed."""
storage_collection = hass.data[DOMAIN][1]
person = await storage_collection.async_create_item(
{"name": "Hello", "user_id": hass_read_only_user.id}
)
aw... | [
"async",
"def",
"test_update_person_when_user_removed",
"(",
"hass",
",",
"storage_setup",
",",
"hass_read_only_user",
")",
":",
"storage_collection",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"1",
"]",
"person",
"=",
"await",
"storage_collection",
".",
... | [
664,
0
] | [
677,
67
] | python | en | ['en', 'en', 'en'] | True |
test_removing_device_tracker | (hass, storage_setup) | Test we automatically remove removed device trackers. | Test we automatically remove removed device trackers. | async def test_removing_device_tracker(hass, storage_setup):
"""Test we automatically remove removed device trackers."""
storage_collection = hass.data[DOMAIN][1]
reg = await entity_registry.async_get_registry(hass)
entry = reg.async_get_or_create(
"device_tracker", "mobile_app", "bla", suggeste... | [
"async",
"def",
"test_removing_device_tracker",
"(",
"hass",
",",
"storage_setup",
")",
":",
"storage_collection",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"1",
"]",
"reg",
"=",
"await",
"entity_registry",
".",
"async_get_registry",
"(",
"hass",
")",... | [
680,
0
] | [
695,
73
] | python | en | ['en', 'en', 'en'] | True |
test_add_user_device_tracker | (hass, storage_setup, hass_read_only_user) | Test adding a device tracker to a person tied to a user. | Test adding a device tracker to a person tied to a user. | async def test_add_user_device_tracker(hass, storage_setup, hass_read_only_user):
"""Test adding a device tracker to a person tied to a user."""
storage_collection = hass.data[DOMAIN][1]
pers = await storage_collection.async_create_item(
{
"name": "Hello",
"user_id": hass_rea... | [
"async",
"def",
"test_add_user_device_tracker",
"(",
"hass",
",",
"storage_setup",
",",
"hass_read_only_user",
")",
":",
"storage_collection",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"1",
"]",
"pers",
"=",
"await",
"storage_collection",
".",
"async_cr... | [
698,
0
] | [
716,
5
] | python | en | ['en', 'en', 'en'] | True |
test_reload | (hass, hass_admin_user) | Test reloading the YAML config. | Test reloading the YAML config. | async def test_reload(hass, hass_admin_user):
"""Test reloading the YAML config."""
assert await async_setup_component(
hass,
DOMAIN,
{
DOMAIN: [
{"name": "Person 1", "id": "id-1"},
{"name": "Person 2", "id": "id-2"},
]
},
... | [
"async",
"def",
"test_reload",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"[",
"{",
"\"name\"",
":",
"\"Person 1\"",
",",
"\"id\"",
":",
"\"id-1\"",
"}",
"... | [
719,
0
] | [
772,
37
] | python | en | ['en', 'en', 'en'] | True |
test_person_storage_fixing_device_trackers | (storage_collection) | Test None device trackers become lists. | Test None device trackers become lists. | async def test_person_storage_fixing_device_trackers(storage_collection):
"""Test None device trackers become lists."""
with patch.object(
storage_collection.store,
"async_load",
return_value={"items": [{"id": "bla", "name": "bla", "device_trackers": None}]},
):
await storage... | [
"async",
"def",
"test_person_storage_fixing_device_trackers",
"(",
"storage_collection",
")",
":",
"with",
"patch",
".",
"object",
"(",
"storage_collection",
".",
"store",
",",
"\"async_load\"",
",",
"return_value",
"=",
"{",
"\"items\"",
":",
"[",
"{",
"\"id\"",
... | [
775,
0
] | [
784,
66
] | python | en | ['it', 'en', 'en'] | True |
test_create_binary_sensors | (hass) | Test creation of binary sensors. | Test creation of binary sensors. | async def test_create_binary_sensors(hass):
"""Test creation of binary sensors."""
await async_init_integration(hass)
state = hass.states.get("binary_sensor.master_suite_blower_active")
assert state.state == STATE_ON
expected_attributes = {
"attribution": "Data provided by mynexia.com",
... | [
"async",
"def",
"test_create_binary_sensors",
"(",
"hass",
")",
":",
"await",
"async_init_integration",
"(",
"hass",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"binary_sensor.master_suite_blower_active\"",
")",
"assert",
"state",
".",
"state",
"=... | [
7,
0
] | [
34,
5
] | python | en | ['en', 'tg', 'en'] | True |
test_binary_sensors | (hass, config_entry, aioclient_mock_fixture) | Test Flo by Moen sensors. | Test Flo by Moen sensors. | async def test_binary_sensors(hass, config_entry, aioclient_mock_fixture):
"""Test Flo by Moen sensors."""
config_entry.add_to_hass(hass)
assert await async_setup_component(
hass, FLO_DOMAIN, {CONF_USERNAME: TEST_USER_ID, CONF_PASSWORD: TEST_PASSWORD}
)
await hass.async_block_till_done()
... | [
"async",
"def",
"test_binary_sensors",
"(",
"hass",
",",
"config_entry",
",",
"aioclient_mock_fixture",
")",
":",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"FLO_DOMAIN",
",",
"{",
"CONF_USER... | [
13,
0
] | [
29,
78
] | python | en | ['en', 'no', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the JuiceNet switches. | Set up the JuiceNet switches. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the JuiceNet switches."""
entities = []
juicenet_data = hass.data[DOMAIN][config_entry.entry_id]
api = juicenet_data[JUICENET_API]
coordinator = juicenet_data[JUICENET_COORDINATOR]
for device in api.devices:
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"entities",
"=",
"[",
"]",
"juicenet_data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"api",
"=",
"ju... | [
7,
0
] | [
16,
32
] | python | en | ['en', 'en', 'en'] | True |
JuiceNetChargeNowSwitch.__init__ | (self, device, coordinator) | Initialise the switch. | Initialise the switch. | def __init__(self, device, coordinator):
"""Initialise the switch."""
super().__init__(device, "charge_now", coordinator) | [
"def",
"__init__",
"(",
"self",
",",
"device",
",",
"coordinator",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
",",
"\"charge_now\"",
",",
"coordinator",
")"
] | [
22,
4
] | [
24,
59
] | python | en | ['en', 'en', 'en'] | True |
JuiceNetChargeNowSwitch.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return f"{self.device.name} Charge Now" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self.device.name} Charge Now\""
] | [
27,
4
] | [
29,
47
] | python | en | ['en', 'en', 'en'] | True |
JuiceNetChargeNowSwitch.is_on | (self) | Return true if switch is on. | Return true if switch is on. | def is_on(self):
"""Return true if switch is on."""
return self.device.override_time != 0 | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
".",
"override_time",
"!=",
"0"
] | [
32,
4
] | [
34,
45
] | python | en | ['en', 'fy', 'en'] | True |
JuiceNetChargeNowSwitch.async_turn_on | (self, **kwargs) | Charge now. | Charge now. | async def async_turn_on(self, **kwargs):
"""Charge now."""
await self.device.set_override(True) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"device",
".",
"set_override",
"(",
"True",
")"
] | [
36,
4
] | [
38,
44
] | python | en | ['en', 'en', 'en'] | False |
JuiceNetChargeNowSwitch.async_turn_off | (self, **kwargs) | Don't charge now. | Don't charge now. | async def async_turn_off(self, **kwargs):
"""Don't charge now."""
await self.device.set_override(False) | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"device",
".",
"set_override",
"(",
"False",
")"
] | [
40,
4
] | [
42,
45
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Netdata sensor. | Set up the Netdata sensor. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Netdata sensor."""
name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
resources = config.get(CONF_RESOURCES)
session = async_get_clientsession(hass)
netd... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"host",
"=",
"config",
".",
"get",
"(",
"CONF_HOST",
")",... | [
56,
0
] | [
96,
33
] | python | en | ['en', 'da', 'en'] | True |
NetdataSensor.__init__ | (self, netdata, name, sensor, sensor_name, element, icon, unit, invert) | Initialize the Netdata sensor. | Initialize the Netdata sensor. | def __init__(self, netdata, name, sensor, sensor_name, element, icon, unit, invert):
"""Initialize the Netdata sensor."""
self.netdata = netdata
self._state = None
self._sensor = sensor
self._element = element
self._sensor_name = self._sensor if sensor_name is None else s... | [
"def",
"__init__",
"(",
"self",
",",
"netdata",
",",
"name",
",",
"sensor",
",",
"sensor_name",
",",
"element",
",",
"icon",
",",
"unit",
",",
"invert",
")",
":",
"self",
".",
"netdata",
"=",
"netdata",
"self",
".",
"_state",
"=",
"None",
"self",
"."... | [
102,
4
] | [
112,
29
] | python | en | ['en', 'en', 'en'] | True |
NetdataSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return f"{self._name} {self._sensor_name}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self._name} {self._sensor_name}\""
] | [
115,
4
] | [
117,
50
] | python | en | ['en', 'mi', 'en'] | True |
NetdataSensor.unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def unit_of_measurement(self):
"""Return the unit the value is expressed in."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
120,
4
] | [
122,
40
] | python | en | ['en', 'en', 'en'] | True |
NetdataSensor.icon | (self) | Return the icon to use in the frontend, if any. | Return the icon to use in the frontend, if any. | def icon(self):
"""Return the icon to use in the frontend, if any."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
125,
4
] | [
127,
25
] | python | en | ['en', 'en', 'en'] | True |
NetdataSensor.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"
] | [
130,
4
] | [
132,
26
] | python | en | ['en', 'en', 'en'] | True |
NetdataSensor.available | (self) | Could the resource be accessed during the last update call. | Could the resource be accessed during the last update call. | def available(self):
"""Could the resource be accessed during the last update call."""
return self.netdata.available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"netdata",
".",
"available"
] | [
135,
4
] | [
137,
37
] | python | en | ['en', 'en', 'en'] | True |
NetdataSensor.async_update | (self) | Get the latest data from Netdata REST API. | Get the latest data from Netdata REST API. | async def async_update(self):
"""Get the latest data from Netdata REST API."""
await self.netdata.async_update()
resource_data = self.netdata.api.metrics.get(self._sensor)
self._state = round(resource_data["dimensions"][self._element]["value"], 2) * (
-1 if self._invert else ... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"netdata",
".",
"async_update",
"(",
")",
"resource_data",
"=",
"self",
".",
"netdata",
".",
"api",
".",
"metrics",
".",
"get",
"(",
"self",
".",
"_sensor",
")",
"self",
".",
... | [
139,
4
] | [
145,
9
] | python | en | ['en', 'en', 'en'] | True |
NetdataAlarms.__init__ | (self, netdata, name, host, port) | Initialize the Netdata alarm sensor. | Initialize the Netdata alarm sensor. | def __init__(self, netdata, name, host, port):
"""Initialize the Netdata alarm sensor."""
self.netdata = netdata
self._state = None
self._name = name
self._host = host
self._port = port | [
"def",
"__init__",
"(",
"self",
",",
"netdata",
",",
"name",
",",
"host",
",",
"port",
")",
":",
"self",
".",
"netdata",
"=",
"netdata",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_host",
"=",
"host",
"self... | [
151,
4
] | [
157,
25
] | python | en | ['en', 'da', 'en'] | True |
NetdataAlarms.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return f"{self._name} Alarms" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self._name} Alarms\""
] | [
160,
4
] | [
162,
37
] | python | en | ['en', 'mi', 'en'] | True |
NetdataAlarms.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"
] | [
165,
4
] | [
167,
26
] | python | en | ['en', 'en', 'en'] | True |
NetdataAlarms.icon | (self) | Status symbol if type is symbol. | Status symbol if type is symbol. | def icon(self):
"""Status symbol if type is symbol."""
if self._state == "ok":
return "mdi:check"
if self._state == "warning":
return "mdi:alert-outline"
if self._state == "critical":
return "mdi:alert"
return "mdi:crosshairs-question" | [
"def",
"icon",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
"==",
"\"ok\"",
":",
"return",
"\"mdi:check\"",
"if",
"self",
".",
"_state",
"==",
"\"warning\"",
":",
"return",
"\"mdi:alert-outline\"",
"if",
"self",
".",
"_state",
"==",
"\"critical\"",
... | [
170,
4
] | [
178,
40
] | python | en | ['en', 'la', 'en'] | True |
NetdataAlarms.available | (self) | Could the resource be accessed during the last update call. | Could the resource be accessed during the last update call. | def available(self):
"""Could the resource be accessed during the last update call."""
return self.netdata.available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"netdata",
".",
"available"
] | [
181,
4
] | [
183,
37
] | python | en | ['en', 'en', 'en'] | True |
NetdataAlarms.async_update | (self) | Get the latest alarms from Netdata REST API. | Get the latest alarms from Netdata REST API. | async def async_update(self):
"""Get the latest alarms from Netdata REST API."""
await self.netdata.async_update()
alarms = self.netdata.api.alarms["alarms"]
self._state = None
number_of_alarms = len(alarms)
number_of_relevant_alarms = number_of_alarms
_LOGGER.de... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"netdata",
".",
"async_update",
"(",
")",
"alarms",
"=",
"self",
".",
"netdata",
".",
"api",
".",
"alarms",
"[",
"\"alarms\"",
"]",
"self",
".",
"_state",
"=",
"None",
"number... | [
185,
4
] | [
207,
75
] | python | en | ['en', 'en', 'en'] | True |
NetdataData.__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"
] | [
213,
4
] | [
216,
29
] | python | en | ['en', 'en', 'en'] | True |
NetdataData.async_update | (self) | Get the latest data from the Netdata REST API. | Get the latest data from the Netdata REST API. | async def async_update(self):
"""Get the latest data from the Netdata REST API."""
try:
await self.api.get_allmetrics()
await self.api.get_alarms()
self.available = True
except NetdataError:
_LOGGER.error("Unable to retrieve data from Netdata")
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"await",
"self",
".",
"api",
".",
"get_allmetrics",
"(",
")",
"await",
"self",
".",
"api",
".",
"get_alarms",
"(",
")",
"self",
".",
"available",
"=",
"True",
"except",
"NetdataError",
... | [
219,
4
] | [
228,
34
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistantType, config: ConfigType) | Set up an input select. | Set up an input select. | async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Set up an input select."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
id_manager = collection.IDManager()
yaml_collection = collection.YamlCollection(
logging.getLogger(f"{__name__}.yaml_collection"), id_mana... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"id_manager",
"=",
"collection",
".",
"IDMan... | [
101,
0
] | [
157,
15
] | python | en | ['en', 'su', 'en'] | True |
TimerStorageCollection._process_create_data | (self, data: Dict) | Validate the config is valid. | Validate the config is valid. | async def _process_create_data(self, data: Dict) -> Dict:
"""Validate the config is valid."""
data = self.CREATE_SCHEMA(data)
# make duration JSON serializeable
data[CONF_DURATION] = _format_timedelta(data[CONF_DURATION])
return data | [
"async",
"def",
"_process_create_data",
"(",
"self",
",",
"data",
":",
"Dict",
")",
"->",
"Dict",
":",
"data",
"=",
"self",
".",
"CREATE_SCHEMA",
"(",
"data",
")",
"# make duration JSON serializeable",
"data",
"[",
"CONF_DURATION",
"]",
"=",
"_format_timedelta",... | [
166,
4
] | [
171,
19
] | python | en | ['en', 'en', 'en'] | True |
TimerStorageCollection._get_suggested_id | (self, info: Dict) | Suggest an ID based on the config. | Suggest an ID based on the config. | def _get_suggested_id(self, info: Dict) -> str:
"""Suggest an ID based on the config."""
return info[CONF_NAME] | [
"def",
"_get_suggested_id",
"(",
"self",
",",
"info",
":",
"Dict",
")",
"->",
"str",
":",
"return",
"info",
"[",
"CONF_NAME",
"]"
] | [
174,
4
] | [
176,
30
] | python | en | ['en', 'en', 'en'] | True |
TimerStorageCollection._update_data | (self, data: dict, update_data: Dict) | Return a new updated data object. | Return a new updated data object. | async def _update_data(self, data: dict, update_data: Dict) -> Dict:
"""Return a new updated data object."""
data = {**data, **self.UPDATE_SCHEMA(update_data)}
# make duration JSON serializeable
if CONF_DURATION in update_data:
data[CONF_DURATION] = _format_timedelta(data[CON... | [
"async",
"def",
"_update_data",
"(",
"self",
",",
"data",
":",
"dict",
",",
"update_data",
":",
"Dict",
")",
"->",
"Dict",
":",
"data",
"=",
"{",
"*",
"*",
"data",
",",
"*",
"*",
"self",
".",
"UPDATE_SCHEMA",
"(",
"update_data",
")",
"}",
"# make dur... | [
178,
4
] | [
184,
19
] | python | en | ['en', 'en', 'en'] | True |
Timer.__init__ | (self, config: Dict) | Initialize a timer. | Initialize a timer. | def __init__(self, config: Dict):
"""Initialize a timer."""
self._config: dict = config
self.editable: bool = True
self._state: str = STATUS_IDLE
self._duration = cv.time_period_str(config[CONF_DURATION])
self._remaining: Optional[timedelta] = None
self._end: Opti... | [
"def",
"__init__",
"(",
"self",
",",
"config",
":",
"Dict",
")",
":",
"self",
".",
"_config",
":",
"dict",
"=",
"config",
"self",
".",
"editable",
":",
"bool",
"=",
"True",
"self",
".",
"_state",
":",
"str",
"=",
"STATUS_IDLE",
"self",
".",
"_duratio... | [
190,
4
] | [
198,
29
] | python | en | ['en', 'en', 'it'] | True |
Timer.from_yaml | (cls, config: Dict) | Return entity instance initialized from yaml storage. | Return entity instance initialized from yaml storage. | def from_yaml(cls, config: Dict) -> "Timer":
"""Return entity instance initialized from yaml storage."""
timer = cls(config)
timer.entity_id = ENTITY_ID_FORMAT.format(config[CONF_ID])
timer.editable = False
return timer | [
"def",
"from_yaml",
"(",
"cls",
",",
"config",
":",
"Dict",
")",
"->",
"\"Timer\"",
":",
"timer",
"=",
"cls",
"(",
"config",
")",
"timer",
".",
"entity_id",
"=",
"ENTITY_ID_FORMAT",
".",
"format",
"(",
"config",
"[",
"CONF_ID",
"]",
")",
"timer",
".",
... | [
201,
4
] | [
206,
20
] | python | en | ['en', 'pl', 'en'] | True |
Timer.should_poll | (self) | If entity should be polled. | If entity should be polled. | def should_poll(self):
"""If entity should be polled."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
209,
4
] | [
211,
20
] | python | en | ['en', 'en', 'en'] | True |
Timer.force_update | (self) | Return True to fix restart issues. | Return True to fix restart issues. | def force_update(self) -> bool:
"""Return True to fix restart issues."""
return True | [
"def",
"force_update",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
214,
4
] | [
216,
19
] | python | en | ['en', 'mt', 'en'] | True |
Timer.name | (self) | Return name of the timer. | Return name of the timer. | def name(self):
"""Return name of the timer."""
return self._config.get(CONF_NAME) | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_NAME",
")"
] | [
219,
4
] | [
221,
42
] | python | en | ['en', 'en', 'en'] | True |
Timer.icon | (self) | Return the icon to be used for this entity. | Return the icon to be used for this entity. | def icon(self):
"""Return the icon to be used for this entity."""
return self._config.get(CONF_ICON) | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_ICON",
")"
] | [
224,
4
] | [
226,
42
] | python | en | ['en', 'en', 'en'] | True |
Timer.state | (self) | Return the current value of the timer. | Return the current value of the timer. | def state(self):
"""Return the current value of the timer."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
229,
4
] | [
231,
26
] | python | en | ['en', 'en', 'en'] | True |
Timer.state_attributes | (self) | Return the state attributes. | Return the state attributes. | def state_attributes(self):
"""Return the state attributes."""
attrs = {
ATTR_DURATION: _format_timedelta(self._duration),
ATTR_EDITABLE: self.editable,
}
if self._end is not None:
attrs[ATTR_FINISHES_AT] = self._end.isoformat()
if self._remain... | [
"def",
"state_attributes",
"(",
"self",
")",
":",
"attrs",
"=",
"{",
"ATTR_DURATION",
":",
"_format_timedelta",
"(",
"self",
".",
"_duration",
")",
",",
"ATTR_EDITABLE",
":",
"self",
".",
"editable",
",",
"}",
"if",
"self",
".",
"_end",
"is",
"not",
"Non... | [
234,
4
] | [
245,
20
] | python | en | ['en', 'en', 'en'] | True |
Timer.unique_id | (self) | Return unique id for the entity. | Return unique id for the entity. | def unique_id(self) -> Optional[str]:
"""Return unique id for the entity."""
return self._config[CONF_ID] | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_config",
"[",
"CONF_ID",
"]"
] | [
248,
4
] | [
250,
36
] | python | en | ['en', 'en', 'en'] | True |
Timer.async_added_to_hass | (self) | Call when entity is about to be added to Home Assistant. | Call when entity is about to be added to Home Assistant. | async def async_added_to_hass(self):
"""Call when entity is about to be added to Home Assistant."""
# If not None, we got an initial value.
if self._state is not None:
return
state = await self.async_get_last_state()
self._state = state and state.state == state | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"# If not None, we got an initial value.",
"if",
"self",
".",
"_state",
"is",
"not",
"None",
":",
"return",
"state",
"=",
"await",
"self",
".",
"async_get_last_state",
"(",
")",
"self",
".",
"_state",... | [
252,
4
] | [
259,
52
] | python | en | ['en', 'en', 'en'] | True |
Timer.async_start | (self, duration: timedelta) | Start a timer. | Start a timer. | def async_start(self, duration: timedelta):
"""Start a timer."""
if self._listener:
self._listener()
self._listener = None
newduration = None
if duration:
newduration = duration
event = EVENT_TIMER_STARTED
if self._state == STATUS_ACTI... | [
"def",
"async_start",
"(",
"self",
",",
"duration",
":",
"timedelta",
")",
":",
"if",
"self",
".",
"_listener",
":",
"self",
".",
"_listener",
"(",
")",
"self",
".",
"_listener",
"=",
"None",
"newduration",
"=",
"None",
"if",
"duration",
":",
"newduratio... | [
262,
4
] | [
295,
35
] | python | en | ['en', 'lb', 'en'] | True |
Timer.async_pause | (self) | Pause a timer. | Pause a timer. | def async_pause(self):
"""Pause a timer."""
if self._listener is None:
return
self._listener()
self._listener = None
self._remaining = self._end - dt_util.utcnow().replace(microsecond=0)
self._state = STATUS_PAUSED
self._end = None
self.hass.b... | [
"def",
"async_pause",
"(",
"self",
")",
":",
"if",
"self",
".",
"_listener",
"is",
"None",
":",
"return",
"self",
".",
"_listener",
"(",
")",
"self",
".",
"_listener",
"=",
"None",
"self",
".",
"_remaining",
"=",
"self",
".",
"_end",
"-",
"dt_util",
... | [
298,
4
] | [
309,
35
] | python | en | ['en', 'en', 'bg'] | True |
Timer.async_cancel | (self) | Cancel a timer. | Cancel a timer. | def async_cancel(self):
"""Cancel a timer."""
if self._listener:
self._listener()
self._listener = None
self._state = STATUS_IDLE
self._end = None
self._remaining = None
self.hass.bus.async_fire(EVENT_TIMER_CANCELLED, {"entity_id": self.entity_id})... | [
"def",
"async_cancel",
"(",
"self",
")",
":",
"if",
"self",
".",
"_listener",
":",
"self",
".",
"_listener",
"(",
")",
"self",
".",
"_listener",
"=",
"None",
"self",
".",
"_state",
"=",
"STATUS_IDLE",
"self",
".",
"_end",
"=",
"None",
"self",
".",
"_... | [
312,
4
] | [
321,
35
] | python | cy | ['hu', 'cy', 'en'] | False |
Timer.async_finish | (self) | Reset and updates the states, fire finished event. | Reset and updates the states, fire finished event. | def async_finish(self):
"""Reset and updates the states, fire finished event."""
if self._state != STATUS_ACTIVE:
return
self._listener = None
self._state = STATUS_IDLE
self._end = None
self._remaining = None
self.hass.bus.async_fire(EVENT_TIMER_FINIS... | [
"def",
"async_finish",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
"!=",
"STATUS_ACTIVE",
":",
"return",
"self",
".",
"_listener",
"=",
"None",
"self",
".",
"_state",
"=",
"STATUS_IDLE",
"self",
".",
"_end",
"=",
"None",
"self",
".",
"_remaining"... | [
324,
4
] | [
334,
35
] | python | en | ['en', 'en', 'en'] | True |
Timer._async_finished | (self, time) | Reset and updates the states, fire finished event. | Reset and updates the states, fire finished event. | def _async_finished(self, time):
"""Reset and updates the states, fire finished event."""
if self._state != STATUS_ACTIVE:
return
self._listener = None
self._state = STATUS_IDLE
self._end = None
self._remaining = None
self.hass.bus.async_fire(EVENT_TI... | [
"def",
"_async_finished",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"_state",
"!=",
"STATUS_ACTIVE",
":",
"return",
"self",
".",
"_listener",
"=",
"None",
"self",
".",
"_state",
"=",
"STATUS_IDLE",
"self",
".",
"_end",
"=",
"None",
"self",
... | [
337,
4
] | [
347,
35
] | python | en | ['en', 'en', 'en'] | True |
Timer.async_update_config | (self, config: Dict) | Handle when the config is updated. | Handle when the config is updated. | async def async_update_config(self, config: Dict) -> None:
"""Handle when the config is updated."""
self._config = config
self._duration = cv.time_period_str(config[CONF_DURATION])
self.async_write_ha_state() | [
"async",
"def",
"async_update_config",
"(",
"self",
",",
"config",
":",
"Dict",
")",
"->",
"None",
":",
"self",
".",
"_config",
"=",
"config",
"self",
".",
"_duration",
"=",
"cv",
".",
"time_period_str",
"(",
"config",
"[",
"CONF_DURATION",
"]",
")",
"se... | [
349,
4
] | [
353,
35
] | python | en | ['en', 'en', 'en'] | True |
mock_dev_track | (mock_device_tracker_conf) | Mock device tracker config loading. | Mock device tracker config loading. | def mock_dev_track(mock_device_tracker_conf):
"""Mock device tracker config loading."""
pass | [
"def",
"mock_dev_track",
"(",
"mock_device_tracker_conf",
")",
":",
"pass"
] | [
52,
0
] | [
54,
8
] | python | en | ['da', 'en', 'en'] | True |
test_missing_credentials | (eebrightbox_mock, hass) | Test missing credentials. | Test missing credentials. | async def test_missing_credentials(eebrightbox_mock, hass):
"""Test missing credentials."""
_configure_mock_get_devices(eebrightbox_mock)
result = await async_setup_component(
hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "ee_brightbox"}}
)
assert result
await hass.async_block_till_done()
... | [
"async",
"def",
"test_missing_credentials",
"(",
"eebrightbox_mock",
",",
"hass",
")",
":",
"_configure_mock_get_devices",
"(",
"eebrightbox_mock",
")",
"result",
"=",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"CON... | [
58,
0
] | [
72,
63
] | python | en | ['mt', 'la', 'en'] | False |
test_invalid_credentials | (eebrightbox_mock, hass) | Test invalid credentials. | Test invalid credentials. | async def test_invalid_credentials(eebrightbox_mock, hass):
"""Test invalid credentials."""
_configure_mock_failed_config_check(eebrightbox_mock)
result = await async_setup_component(
hass,
DOMAIN,
{DOMAIN: {CONF_PLATFORM: "ee_brightbox", CONF_PASSWORD: "test_password"}},
)
... | [
"async",
"def",
"test_invalid_credentials",
"(",
"eebrightbox_mock",
",",
"hass",
")",
":",
"_configure_mock_failed_config_check",
"(",
"eebrightbox_mock",
")",
"result",
"=",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{"... | [
76,
0
] | [
92,
63
] | python | en | ['en', 'la', 'en'] | True |
test_get_devices | (eebrightbox_mock, hass) | Test valid configuration. | Test valid configuration. | async def test_get_devices(eebrightbox_mock, hass):
"""Test valid configuration."""
_configure_mock_get_devices(eebrightbox_mock)
result = await async_setup_component(
hass,
DOMAIN,
{DOMAIN: {CONF_PLATFORM: "ee_brightbox", CONF_PASSWORD: "test_password"}},
)
assert result
... | [
"async",
"def",
"test_get_devices",
"(",
"eebrightbox_mock",
",",
"hass",
")",
":",
"_configure_mock_get_devices",
"(",
"eebrightbox_mock",
")",
"result",
"=",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"CONF_PLATFO... | [
96,
0
] | [
118,
77
] | python | en | ['nl', 'et', 'en'] | False |
async_setup | (hass: HomeAssistantType, config: dict) | Set up the Canary integration. | Set up the Canary integration. | async def async_setup(hass: HomeAssistantType, config: dict) -> bool:
"""Set up the Canary integration."""
hass.data.setdefault(DOMAIN, {})
if hass.config_entries.async_entries(DOMAIN):
return True
ffmpeg_arguments = DEFAULT_FFMPEG_ARGUMENTS
if CAMERA_DOMAIN in config:
camera_confi... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"dict",
")",
"->",
"bool",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"if",
"hass",
".",
"config_entries",
".",
"async_entries"... | [
46,
0
] | [
76,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Set up Canary from a config entry. | Set up Canary from a config entry. | async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Set up Canary from a config entry."""
if not entry.options:
options = {
CONF_FFMPEG_ARGUMENTS: entry.data.get(
CONF_FFMPEG_ARGUMENTS, DEFAULT_FFMPEG_ARGUMENTS
),
CONF_... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"if",
"not",
"entry",
".",
"options",
":",
"options",
"=",
"{",
"CONF_FFMPEG_ARGUMENTS",
":",
"entry",
".",
"data",
".",
"... | [
79,
0
] | [
114,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistantType, 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",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"asyn... | [
117,
0
] | [
132,
20
] | python | en | ['en', 'es', 'en'] | True |
_async_update_listener | (hass: HomeAssistantType, entry: ConfigEntry) | Handle options update. | Handle options update. | async def _async_update_listener(hass: HomeAssistantType, entry: ConfigEntry) -> None:
"""Handle options update."""
await hass.config_entries.async_reload(entry.entry_id) | [
"async",
"def",
"_async_update_listener",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"None",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_reload",
"(",
"entry",
".",
"entry_id",
")"
] | [
135,
0
] | [
137,
58
] | python | en | ['en', 'nl', 'en'] | True |
_get_canary_api_instance | (entry: ConfigEntry) | Initialize a new instance of CanaryApi. | Initialize a new instance of CanaryApi. | def _get_canary_api_instance(entry: ConfigEntry) -> Api:
"""Initialize a new instance of CanaryApi."""
canary = Api(
entry.data[CONF_USERNAME],
entry.data[CONF_PASSWORD],
entry.options.get(CONF_TIMEOUT, DEFAULT_TIMEOUT),
)
return canary | [
"def",
"_get_canary_api_instance",
"(",
"entry",
":",
"ConfigEntry",
")",
"->",
"Api",
":",
"canary",
"=",
"Api",
"(",
"entry",
".",
"data",
"[",
"CONF_USERNAME",
"]",
",",
"entry",
".",
"data",
"[",
"CONF_PASSWORD",
"]",
",",
"entry",
".",
"options",
".... | [
140,
0
] | [
148,
17
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersDiscovery.setup_method | (self, method) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setup_method(self, method):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant() | [
"def",
"setup_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")"
] | [
20,
4
] | [
22,
45
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersDiscovery.teardown_method | (self, method) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self, method):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
24,
4
] | [
26,
24
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersDiscovery.test_listen | (self, mock_setup_component) | Test discovery listen/discover combo. | Test discovery listen/discover combo. | def test_listen(self, mock_setup_component):
"""Test discovery listen/discover combo."""
helpers = self.hass.helpers
calls_single = []
calls_multi = []
@callback
def callback_single(service, info):
"""Service discovered callback."""
calls_single.a... | [
"def",
"test_listen",
"(",
"self",
",",
"mock_setup_component",
")",
":",
"helpers",
"=",
"self",
".",
"hass",
".",
"helpers",
"calls_single",
"=",
"[",
"]",
"calls_multi",
"=",
"[",
"]",
"@",
"callback",
"def",
"callback_single",
"(",
"service",
",",
"inf... | [
29,
4
] | [
65,
87
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersDiscovery.test_platform | (self, mock_setup_component) | Test discover platform method. | Test discover platform method. | def test_platform(self, mock_setup_component):
"""Test discover platform method."""
calls = []
@callback
def platform_callback(platform, info):
"""Platform callback method."""
calls.append((platform, info))
discovery.listen_platform(self.hass, "test_comp... | [
"def",
"test_platform",
"(",
"self",
",",
"mock_setup_component",
")",
":",
"calls",
"=",
"[",
"]",
"@",
"callback",
"def",
"platform_callback",
"(",
"platform",
",",
"info",
")",
":",
"\"\"\"Platform callback method.\"\"\"",
"calls",
".",
"append",
"(",
"(",
... | [
68,
4
] | [
117,
30
] | python | da | ['fr', 'da', 'en'] | False |
TestHelpersDiscovery.test_circular_import | (self) | Test we don't break doing circular import.
This test will have test_component discover the switch.test_circular
component while setting up.
The supplied config will load test_component and will load
switch.test_circular.
That means that after startup, we will have test_compone... | Test we don't break doing circular import. | def test_circular_import(self):
"""Test we don't break doing circular import.
This test will have test_component discover the switch.test_circular
component while setting up.
The supplied config will load test_component and will load
switch.test_circular.
That means th... | [
"def",
"test_circular_import",
"(",
"self",
")",
":",
"component_calls",
"=",
"[",
"]",
"platform_calls",
"=",
"[",
"]",
"def",
"component_setup",
"(",
"hass",
",",
"config",
")",
":",
"\"\"\"Set up mock component.\"\"\"",
"discovery",
".",
"load_platform",
"(",
... | [
119,
4
] | [
169,
54
] | python | en | ['en', 'no', 'en'] | True |
TestHelpersDiscovery.test_1st_discovers_2nd_component | (self, mock_signal) | Test that we don't break if one component discovers the other.
If the first component fires a discovery event to set up the
second component while the second component is about to be set up,
it should not set up the second component twice.
| Test that we don't break if one component discovers the other. | def test_1st_discovers_2nd_component(self, mock_signal):
"""Test that we don't break if one component discovers the other.
If the first component fires a discovery event to set up the
second component while the second component is about to be set up,
it should not set up the second comp... | [
"def",
"test_1st_discovers_2nd_component",
"(",
"self",
",",
"mock_signal",
")",
":",
"component_calls",
"=",
"[",
"]",
"def",
"component1_setup",
"(",
"hass",
",",
"config",
")",
":",
"\"\"\"Set up mock component.\"\"\"",
"print",
"(",
"\"component1 setup\"",
")",
... | [
172,
4
] | [
214,
40
] | python | en | ['en', 'en', 'en'] | True |
get_root | () | Get the project root directory.
We require that all commands are run from the project root, i.e. the
directory that contains setup.py, setup.cfg, and versioneer.py .
| Get the project root directory. | def get_root():
"""Get the project root directory.
We require that all commands are run from the project root, i.e. the
directory that contains setup.py, setup.cfg, and versioneer.py .
"""
root = os.path.realpath(os.path.abspath(os.getcwd()))
setup_py = os.path.join(root, "setup.py")
versio... | [
"def",
"get_root",
"(",
")",
":",
"root",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"getcwd",
"(",
")",
")",
")",
"setup_py",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"\"setup... | [
295,
0
] | [
331,
15
] | python | en | ['en', 'en', 'en'] | True |
get_config_from_root | (root) | Read the project setup.cfg file to determine Versioneer config. | Read the project setup.cfg file to determine Versioneer config. | def get_config_from_root(root):
"""Read the project setup.cfg file to determine Versioneer config."""
# This might raise EnvironmentError (if setup.cfg is missing), or
# configparser.NoSectionError (if it lacks a [versioneer] section), or
# configparser.NoOptionError (if it lacks "VCS="). See the docstr... | [
"def",
"get_config_from_root",
"(",
"root",
")",
":",
"# This might raise EnvironmentError (if setup.cfg is missing), or",
"# configparser.NoSectionError (if it lacks a [versioneer] section), or",
"# configparser.NoOptionError (if it lacks \"VCS=\"). See the docstring at",
"# the top of versioneer... | [
334,
0
] | [
360,
14
] | python | en | ['en', 'en', 'en'] | True |
register_vcs_handler | (vcs, method) | Decorator to mark a method as the handler for a particular VCS. | Decorator to mark a method as the handler for a particular VCS. | def register_vcs_handler(vcs, method): # decorator
"""Decorator to mark a method as the handler for a particular VCS."""
def decorate(f):
"""Store f in HANDLERS[vcs][method]."""
if vcs not in HANDLERS:
HANDLERS[vcs] = {}
HANDLERS[vcs][method] = f
return f
return ... | [
"def",
"register_vcs_handler",
"(",
"vcs",
",",
"method",
")",
":",
"# decorator",
"def",
"decorate",
"(",
"f",
")",
":",
"\"\"\"Store f in HANDLERS[vcs][method].\"\"\"",
"if",
"vcs",
"not",
"in",
"HANDLERS",
":",
"HANDLERS",
"[",
"vcs",
"]",
"=",
"{",
"}",
... | [
372,
0
] | [
380,
19
] | python | en | ['en', 'en', 'en'] | True |
run_command | (commands, args, cwd=None, verbose=False, hide_stderr=False,
env=None) | Call the given command(s). | Call the given command(s). | def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
env=None):
"""Call the given command(s)."""
assert isinstance(commands, list)
p = None
for c in commands:
try:
dispcmd = str([c] + args)
# remember shell=False, so use git.cmd on w... | [
"def",
"run_command",
"(",
"commands",
",",
"args",
",",
"cwd",
"=",
"None",
",",
"verbose",
"=",
"False",
",",
"hide_stderr",
"=",
"False",
",",
"env",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"commands",
",",
"list",
")",
"p",
"=",
"None... | [
383,
0
] | [
417,
31
] | python | en | ['en', 'en', 'en'] | True |
git_get_keywords | (versionfile_abs) | Extract version information from the given file. | Extract version information from the given file. | def git_get_keywords(versionfile_abs):
"""Extract version information from the given file."""
# the code embedded in _version.py can just fetch the value of these
# keywords. When used from setup.py, we don't want to import _version.py,
# so we do it with a regexp instead. This function is not used from... | [
"def",
"git_get_keywords",
"(",
"versionfile_abs",
")",
":",
"# the code embedded in _version.py can just fetch the value of these",
"# keywords. When used from setup.py, we don't want to import _version.py,",
"# so we do it with a regexp instead. This function is not used from",
"# _version.py.",... | [
944,
0
] | [
969,
19
] | python | en | ['en', 'en', 'en'] | True |
git_versions_from_keywords | (keywords, tag_prefix, verbose) | Get version information from git keywords. | Get version information from git keywords. | def git_versions_from_keywords(keywords, tag_prefix, verbose):
"""Get version information from git keywords."""
if not keywords:
raise NotThisMethod("no keywords at all, weird")
date = keywords.get("date")
if date is not None:
# git-2.2.0 added "%cI", which expands to an ISO-8601 -compli... | [
"def",
"git_versions_from_keywords",
"(",
"keywords",
",",
"tag_prefix",
",",
"verbose",
")",
":",
"if",
"not",
"keywords",
":",
"raise",
"NotThisMethod",
"(",
"\"no keywords at all, weird\"",
")",
"date",
"=",
"keywords",
".",
"get",
"(",
"\"date\"",
")",
"if",... | [
973,
0
] | [
1024,
70
] | python | en | ['en', 'da', 'en'] | True |
git_pieces_from_vcs | (tag_prefix, root, verbose, run_command=run_command) | Get version from 'git describe' in the root of the source tree.
This only gets called if the git-archive 'subst' keywords were *not*
expanded, and _version.py hasn't already been rewritten with a short
version string, meaning we're inside a checked out source tree.
| Get version from 'git describe' in the root of the source tree. | def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
"""Get version from 'git describe' in the root of the source tree.
This only gets called if the git-archive 'subst' keywords were *not*
expanded, and _version.py hasn't already been rewritten with a short
version string, meani... | [
"def",
"git_pieces_from_vcs",
"(",
"tag_prefix",
",",
"root",
",",
"verbose",
",",
"run_command",
"=",
"run_command",
")",
":",
"GITS",
"=",
"[",
"\"git\"",
"]",
"if",
"sys",
".",
"platform",
"==",
"\"win32\"",
":",
"GITS",
"=",
"[",
"\"git.cmd\"",
",",
... | [
1028,
0
] | [
1116,
17
] | python | en | ['en', 'en', 'en'] | True |
do_vcs_install | (manifest_in, versionfile_source, ipy) | Git-specific installation logic for Versioneer.
For Git, this means creating/changing .gitattributes to mark _version.py
for export-subst keyword substitution.
| Git-specific installation logic for Versioneer. | def do_vcs_install(manifest_in, versionfile_source, ipy):
"""Git-specific installation logic for Versioneer.
For Git, this means creating/changing .gitattributes to mark _version.py
for export-subst keyword substitution.
"""
GITS = ["git"]
if sys.platform == "win32":
GITS = ["git.cmd", ... | [
"def",
"do_vcs_install",
"(",
"manifest_in",
",",
"versionfile_source",
",",
"ipy",
")",
":",
"GITS",
"=",
"[",
"\"git\"",
"]",
"if",
"sys",
".",
"platform",
"==",
"\"win32\"",
":",
"GITS",
"=",
"[",
"\"git.cmd\"",
",",
"\"git.exe\"",
"]",
"files",
"=",
... | [
1119,
0
] | [
1154,
44
] | python | en | ['en', 'en', 'en'] | True |
versions_from_parentdir | (parentdir_prefix, root, verbose) | Try to determine the version from the parent directory name.
Source tarballs conventionally unpack into a directory that includes both
the project name and a version string. We will also support searching up
two directory levels for an appropriately named parent directory
| Try to determine the version from the parent directory name. | def versions_from_parentdir(parentdir_prefix, root, verbose):
"""Try to determine the version from the parent directory name.
Source tarballs conventionally unpack into a directory that includes both
the project name and a version string. We will also support searching up
two directory levels for an ap... | [
"def",
"versions_from_parentdir",
"(",
"parentdir_prefix",
",",
"root",
",",
"verbose",
")",
":",
"rootdirs",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"root",
")",
"if",
"d... | [
1157,
0
] | [
1179,
70
] | python | en | ['en', 'en', 'en'] | True |
versions_from_file | (filename) | Try to determine the version from _version.py if present. | Try to determine the version from _version.py if present. | def versions_from_file(filename):
"""Try to determine the version from _version.py if present."""
try:
with open(filename) as f:
contents = f.read()
except EnvironmentError:
raise NotThisMethod("unable to read _version.py")
mo = re.search(r"version_json = '''\n(.*)''' # END ... | [
"def",
"versions_from_file",
"(",
"filename",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"contents",
"=",
"f",
".",
"read",
"(",
")",
"except",
"EnvironmentError",
":",
"raise",
"NotThisMethod",
"(",
"\"unable to read _versio... | [
1200,
0
] | [
1214,
34
] | 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.