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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Coronavirus from a config entry. | Set up Coronavirus from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Coronavirus from a config entry."""
if isinstance(entry.data["country"], int):
hass.config_entries.async_update_entry(
entry, data={**entry.data, "country": entry.title}
)
@callback
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"if",
"isinstance",
"(",
"entry",
".",
"data",
"[",
"\"country\"",
"]",
",",
"int",
")",
":",
"hass",
".",
"config_entries",
... | [
24,
0
] | [
52,
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."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"return",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLATFORMS",
")"
] | [
55,
0
] | [
57,
77
] | python | en | ['en', 'es', 'en'] | True |
get_coordinator | (
hass: HomeAssistant,
) | Get the data update coordinator. | Get the data update coordinator. | async def get_coordinator(
hass: HomeAssistant,
) -> update_coordinator.DataUpdateCoordinator:
"""Get the data update coordinator."""
if DOMAIN in hass.data:
return hass.data[DOMAIN]
async def async_get_cases():
with async_timeout.timeout(10):
return {
case.c... | [
"async",
"def",
"get_coordinator",
"(",
"hass",
":",
"HomeAssistant",
",",
")",
"->",
"update_coordinator",
".",
"DataUpdateCoordinator",
":",
"if",
"DOMAIN",
"in",
"hass",
".",
"data",
":",
"return",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"async",
"def",
... | [
60,
0
] | [
84,
28
] | python | en | ['en', 'nl', 'en'] | True |
test_caching_data | (hass) | Test that we cache data. | Test that we cache data. | async def test_caching_data(hass):
"""Test that we cache data."""
now = dt_util.utcnow()
stored_states = [
StoredState(State("input_boolean.b0", "on"), now),
StoredState(State("input_boolean.b1", "on"), now),
StoredState(State("input_boolean.b2", "on"), now),
]
data = await ... | [
"async",
"def",
"test_caching_data",
"(",
"hass",
")",
":",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"stored_states",
"=",
"[",
"StoredState",
"(",
"State",
"(",
"\"input_boolean.b0\"",
",",
"\"on\"",
")",
",",
"now",
")",
",",
"StoredState",
"(",
... | [
20,
0
] | [
51,
33
] | python | en | ['en', 'de', 'en'] | True |
test_periodic_write | (hass) | Test that we write periodiclly but not after stop. | Test that we write periodiclly but not after stop. | async def test_periodic_write(hass):
"""Test that we write periodiclly but not after stop."""
data = await RestoreStateData.async_get_instance(hass)
await hass.async_block_till_done()
await data.store.async_save([])
# Emulate a fresh load
hass.data[DATA_RESTORE_STATE_TASK] = None
entity = ... | [
"async",
"def",
"test_periodic_write",
"(",
"hass",
")",
":",
"data",
"=",
"await",
"RestoreStateData",
".",
"async_get_instance",
"(",
"hass",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"data",
".",
"store",
".",
"async_save",
"(",... | [
54,
0
] | [
97,
37
] | python | en | ['en', 'en', 'en'] | True |
test_save_persistent_states | (hass) | Test that we cancel the currently running job, save the data, and verify the perdiodic job continues. | Test that we cancel the currently running job, save the data, and verify the perdiodic job continues. | async def test_save_persistent_states(hass):
"""Test that we cancel the currently running job, save the data, and verify the perdiodic job continues."""
data = await RestoreStateData.async_get_instance(hass)
await hass.async_block_till_done()
await data.store.async_save([])
# Emulate a fresh load
... | [
"async",
"def",
"test_save_persistent_states",
"(",
"hass",
")",
":",
"data",
"=",
"await",
"RestoreStateData",
".",
"async_get_instance",
"(",
"hass",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"data",
".",
"store",
".",
"async_save"... | [
100,
0
] | [
153,
33
] | python | en | ['en', 'en', 'en'] | True |
test_hass_starting | (hass) | Test that we cache data. | Test that we cache data. | async def test_hass_starting(hass):
"""Test that we cache data."""
hass.state = CoreState.starting
now = dt_util.utcnow()
stored_states = [
StoredState(State("input_boolean.b0", "on"), now),
StoredState(State("input_boolean.b1", "on"), now),
StoredState(State("input_boolean.b2",... | [
"async",
"def",
"test_hass_starting",
"(",
"hass",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"starting",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"stored_states",
"=",
"[",
"StoredState",
"(",
"State",
"(",
"\"input_boolean.b0\"",
",",
... | [
156,
0
] | [
201,
33
] | python | en | ['en', 'de', 'en'] | True |
test_dump_data | (hass) | Test that we cache data. | Test that we cache data. | async def test_dump_data(hass):
"""Test that we cache data."""
states = [
State("input_boolean.b0", "on"),
State("input_boolean.b1", "on"),
State("input_boolean.b2", "on"),
State("input_boolean.b5", "unavailable", {"restored": True}),
]
entity = Entity()
entity.hass ... | [
"async",
"def",
"test_dump_data",
"(",
"hass",
")",
":",
"states",
"=",
"[",
"State",
"(",
"\"input_boolean.b0\"",
",",
"\"on\"",
")",
",",
"State",
"(",
"\"input_boolean.b1\"",
",",
"\"on\"",
")",
",",
"State",
"(",
"\"input_boolean.b2\"",
",",
"\"on\"",
")... | [
204,
0
] | [
275,
55
] | python | en | ['en', 'de', 'en'] | True |
test_dump_error | (hass) | Test that we cache data. | Test that we cache data. | async def test_dump_error(hass):
"""Test that we cache data."""
states = [
State("input_boolean.b0", "on"),
State("input_boolean.b1", "on"),
State("input_boolean.b2", "on"),
]
entity = Entity()
entity.hass = hass
entity.entity_id = "input_boolean.b0"
await entity.asy... | [
"async",
"def",
"test_dump_error",
"(",
"hass",
")",
":",
"states",
"=",
"[",
"State",
"(",
"\"input_boolean.b0\"",
",",
"\"on\"",
")",
",",
"State",
"(",
"\"input_boolean.b1\"",
",",
"\"on\"",
")",
",",
"State",
"(",
"\"input_boolean.b2\"",
",",
"\"on\"",
"... | [
278,
0
] | [
304,
33
] | python | en | ['en', 'de', 'en'] | True |
test_load_error | (hass) | Test that we cache data. | Test that we cache data. | async def test_load_error(hass):
"""Test that we cache data."""
entity = RestoreEntity()
entity.hass = hass
entity.entity_id = "input_boolean.b1"
with patch(
"homeassistant.helpers.storage.Store.async_load",
side_effect=HomeAssistantError,
):
state = await entity.async_g... | [
"async",
"def",
"test_load_error",
"(",
"hass",
")",
":",
"entity",
"=",
"RestoreEntity",
"(",
")",
"entity",
".",
"hass",
"=",
"hass",
"entity",
".",
"entity_id",
"=",
"\"input_boolean.b1\"",
"with",
"patch",
"(",
"\"homeassistant.helpers.storage.Store.async_load\"... | [
307,
0
] | [
319,
24
] | python | en | ['en', 'de', 'en'] | True |
test_state_saved_on_remove | (hass) | Test that we save entity state on removal. | Test that we save entity state on removal. | async def test_state_saved_on_remove(hass):
"""Test that we save entity state on removal."""
entity = RestoreEntity()
entity.hass = hass
entity.entity_id = "input_boolean.b0"
await entity.async_internal_added_to_hass()
now = dt_util.utcnow()
hass.states.async_set(
"input_boolean.b0"... | [
"async",
"def",
"test_state_saved_on_remove",
"(",
"hass",
")",
":",
"entity",
"=",
"RestoreEntity",
"(",
")",
"entity",
".",
"hass",
"=",
"hass",
"entity",
".",
"entity_id",
"=",
"\"input_boolean.b0\"",
"await",
"entity",
".",
"async_internal_added_to_hass",
"(",... | [
322,
0
] | [
345,
83
] | python | en | ['en', 'en', 'en'] | True |
test_restoring_invalid_entity_id | (hass, hass_storage) | Test restoring invalid entity IDs. | Test restoring invalid entity IDs. | async def test_restoring_invalid_entity_id(hass, hass_storage):
"""Test restoring invalid entity IDs."""
entity = RestoreEntity()
entity.hass = hass
entity.entity_id = "test.invalid__entity_id"
now = dt_util.utcnow().isoformat()
hass_storage[STORAGE_KEY] = {
"version": 1,
"key": ... | [
"async",
"def",
"test_restoring_invalid_entity_id",
"(",
"hass",
",",
"hass_storage",
")",
":",
"entity",
"=",
"RestoreEntity",
"(",
")",
"entity",
".",
"hass",
"=",
"hass",
"entity",
".",
"entity_id",
"=",
"\"test.invalid__entity_id\"",
"now",
"=",
"dt_util",
"... | [
348,
0
] | [
376,
24
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.setup_method | (self) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setup_method(self):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self._base_url = "https://tts.voicetech.yandex.net/generate?"
asyncio.run_coroutine_threadsafe(
async_process_ha_core_config(
self.hass, {"inte... | [
"def",
"setup_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"self",
".",
"_base_url",
"=",
"\"https://tts.voicetech.yandex.net/generate?\"",
"asyncio",
".",
"run_coroutine_threadsafe",
"(",
"async_process_ha_core_config",
... | [
23,
4
] | [
33,
9
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.teardown_method | (self) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self):
"""Stop everything that was started."""
default_tts = self.hass.config.path(tts.DEFAULT_CACHE_DIR)
if os.path.isdir(default_tts):
shutil.rmtree(default_tts)
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
")",
":",
"default_tts",
"=",
"self",
".",
"hass",
".",
"config",
".",
"path",
"(",
"tts",
".",
"DEFAULT_CACHE_DIR",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"default_tts",
")",
":",
"shutil",
".",
"rmtree... | [
35,
4
] | [
41,
24
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_setup_component | (self) | Test setup component. | Test setup component. | def test_setup_component(self):
"""Test setup component."""
config = {tts.DOMAIN: {"platform": "yandextts", "api_key": "1234567xx"}}
with assert_setup_component(1, tts.DOMAIN):
setup_component(self.hass, tts.DOMAIN, config) | [
"def",
"test_setup_component",
"(",
"self",
")",
":",
"config",
"=",
"{",
"tts",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"yandextts\"",
",",
"\"api_key\"",
":",
"\"1234567xx\"",
"}",
"}",
"with",
"assert_setup_component",
"(",
"1",
",",
"tts",
".",
... | [
43,
4
] | [
48,
58
] | python | en | ['en', 'da', 'en'] | True |
TestTTSYandexPlatform.test_setup_component_without_api_key | (self) | Test setup component without api key. | Test setup component without api key. | def test_setup_component_without_api_key(self):
"""Test setup component without api key."""
config = {tts.DOMAIN: {"platform": "yandextts"}}
with assert_setup_component(0, tts.DOMAIN):
setup_component(self.hass, tts.DOMAIN, config) | [
"def",
"test_setup_component_without_api_key",
"(",
"self",
")",
":",
"config",
"=",
"{",
"tts",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"yandextts\"",
"}",
"}",
"with",
"assert_setup_component",
"(",
"0",
",",
"tts",
".",
"DOMAIN",
")",
":",
"setup_... | [
50,
4
] | [
55,
58
] | python | en | ['en', 'haw', 'en'] | True |
TestTTSYandexPlatform.test_service_say | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zahar",
"fo... | [
"def",
"test_service_say",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"\"lang\"",
":"... | [
57,
4
] | [
87,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_russian_config | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_russian_config(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "ru-RU",
"key": "1234567xx",
"speaker": "zahar",
... | [
"def",
"test_service_say_russian_config",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"\... | [
89,
4
] | [
125,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_russian_service | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_russian_service(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "ru-RU",
"key": "1234567xx",
"speaker": "zahar",... | [
"def",
"test_service_say_russian_service",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"... | [
127,
4
] | [
161,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_timeout | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_timeout(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zahar",
... | [
"def",
"test_service_say_timeout",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"\"lang\"... | [
163,
4
] | [
193,
50
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_http_error | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_http_error(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zahar",
... | [
"def",
"test_service_say_http_error",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"\"lan... | [
195,
4
] | [
224,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_specified_speaker | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_specified_speaker(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "alyss... | [
"def",
"test_service_say_specified_speaker",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
... | [
226,
4
] | [
262,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_specified_emotion | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_specified_emotion(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zahar... | [
"def",
"test_service_say_specified_emotion",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
... | [
264,
4
] | [
300,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_specified_low_speed | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_specified_low_speed(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zah... | [
"def",
"test_service_say_specified_low_speed",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",... | [
302,
4
] | [
334,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_specified_speed | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_specified_speed(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zahar",... | [
"def",
"test_service_say_specified_speed",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"... | [
336,
4
] | [
368,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_specified_options | (self, aioclient_mock) | Test service call say with options. | Test service call say with options. | def test_service_say_specified_options(self, aioclient_mock):
"""Test service call say with options."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"spe... | [
"def",
"test_service_say_specified_options",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
... | [
370,
4
] | [
403,
30
] | python | en | ['en', 'en', 'en'] | True |
service_update_mock | (ipv6, zeroconf, services, handlers, *, limit_service=None) | Call service update handler. | Call service update handler. | def service_update_mock(ipv6, zeroconf, services, handlers, *, limit_service=None):
"""Call service update handler."""
for service in services:
if limit_service is not None and service != limit_service:
continue
handlers[0](zeroconf, service, f"_name.{service}", ServiceStateChange.Ad... | [
"def",
"service_update_mock",
"(",
"ipv6",
",",
"zeroconf",
",",
"services",
",",
"handlers",
",",
"*",
",",
"limit_service",
"=",
"None",
")",
":",
"for",
"service",
"in",
"services",
":",
"if",
"limit_service",
"is",
"not",
"None",
"and",
"service",
"!="... | [
33,
0
] | [
38,
84
] | python | en | ['en', 'lb', 'en'] | True |
get_service_info_mock | (service_type, name, *args, **kwargs) | Return service info for get_service_info. | Return service info for get_service_info. | def get_service_info_mock(service_type, name, *args, **kwargs):
"""Return service info for get_service_info."""
return AsyncServiceInfo(
service_type,
name,
addresses=[b"\n\x00\x00\x14"],
port=80,
weight=0,
priority=0,
server="name.local.",
propert... | [
"def",
"get_service_info_mock",
"(",
"service_type",
",",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"AsyncServiceInfo",
"(",
"service_type",
",",
"name",
",",
"addresses",
"=",
"[",
"b\"\\n\\x00\\x00\\x14\"",
"]",
",",
"port",
"=... | [
41,
0
] | [
52,
5
] | python | en | ['da', 'en', 'en'] | True |
get_service_info_mock_without_an_address | (service_type, name) | Return service info for get_service_info without any addresses. | Return service info for get_service_info without any addresses. | def get_service_info_mock_without_an_address(service_type, name):
"""Return service info for get_service_info without any addresses."""
return AsyncServiceInfo(
service_type,
name,
addresses=[],
port=80,
weight=0,
priority=0,
server="name.local.",
... | [
"def",
"get_service_info_mock_without_an_address",
"(",
"service_type",
",",
"name",
")",
":",
"return",
"AsyncServiceInfo",
"(",
"service_type",
",",
"name",
",",
"addresses",
"=",
"[",
"]",
",",
"port",
"=",
"80",
",",
"weight",
"=",
"0",
",",
"priority",
... | [
55,
0
] | [
66,
5
] | python | en | ['en', 'en', 'en'] | True |
get_homekit_info_mock | (model, pairing_status) | Return homekit info for get_service_info for an homekit device. | Return homekit info for get_service_info for an homekit device. | def get_homekit_info_mock(model, pairing_status):
"""Return homekit info for get_service_info for an homekit device."""
def mock_homekit_info(service_type, name):
return AsyncServiceInfo(
service_type,
name,
addresses=[b"\n\x00\x00\x14"],
port=80,
... | [
"def",
"get_homekit_info_mock",
"(",
"model",
",",
"pairing_status",
")",
":",
"def",
"mock_homekit_info",
"(",
"service_type",
",",
"name",
")",
":",
"return",
"AsyncServiceInfo",
"(",
"service_type",
",",
"name",
",",
"addresses",
"=",
"[",
"b\"\\n\\x00\\x00\\x1... | [
69,
0
] | [
84,
28
] | python | br | ['br', 'lb', 'en'] | False |
get_zeroconf_info_mock | (macaddress) | Return info for get_service_info for an zeroconf device. | Return info for get_service_info for an zeroconf device. | def get_zeroconf_info_mock(macaddress):
"""Return info for get_service_info for an zeroconf device."""
def mock_zc_info(service_type, name):
return AsyncServiceInfo(
service_type,
name,
addresses=[b"\n\x00\x00\x14"],
port=80,
weight=0,
... | [
"def",
"get_zeroconf_info_mock",
"(",
"macaddress",
")",
":",
"def",
"mock_zc_info",
"(",
"service_type",
",",
"name",
")",
":",
"return",
"AsyncServiceInfo",
"(",
"service_type",
",",
"name",
",",
"addresses",
"=",
"[",
"b\"\\n\\x00\\x00\\x14\"",
"]",
",",
"por... | [
87,
0
] | [
102,
23
] | python | en | ['de', 'en', 'en'] | True |
get_zeroconf_info_mock_manufacturer | (manufacturer) | Return info for get_service_info for an zeroconf device. | Return info for get_service_info for an zeroconf device. | def get_zeroconf_info_mock_manufacturer(manufacturer):
"""Return info for get_service_info for an zeroconf device."""
def mock_zc_info(service_type, name):
return AsyncServiceInfo(
service_type,
name,
addresses=[b"\n\x00\x00\x14"],
port=80,
we... | [
"def",
"get_zeroconf_info_mock_manufacturer",
"(",
"manufacturer",
")",
":",
"def",
"mock_zc_info",
"(",
"service_type",
",",
"name",
")",
":",
"return",
"AsyncServiceInfo",
"(",
"service_type",
",",
"name",
",",
"addresses",
"=",
"[",
"b\"\\n\\x00\\x00\\x14\"",
"]"... | [
105,
0
] | [
120,
23
] | python | en | ['de', 'en', 'en'] | True |
test_setup | (hass, mock_async_zeroconf) | Test configured options for a device are loaded via config entry. | Test configured options for a device are loaded via config entry. | async def test_setup(hass, mock_async_zeroconf):
"""Test configured options for a device are loaded via config entry."""
with patch.object(
hass.config_entries.flow, "async_init"
) as mock_config_flow, patch.object(
zeroconf, "HaAsyncServiceBrowser", side_effect=service_update_mock
) as ... | [
"async",
"def",
"test_setup",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"config_entries",
".",
"flow",
",",
"\"async_init\"",
")",
"as",
"mock_config_flow",
",",
"patch",
".",
"object",
"(",
"zerocon... | [
123,
0
] | [
151,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setup_with_overly_long_url_and_name | (hass, mock_async_zeroconf, caplog) | Test we still setup with long urls and names. | Test we still setup with long urls and names. | async def test_setup_with_overly_long_url_and_name(hass, mock_async_zeroconf, caplog):
"""Test we still setup with long urls and names."""
with patch.object(hass.config_entries.flow, "async_init"), patch.object(
zeroconf, "HaAsyncServiceBrowser", side_effect=service_update_mock
), patch(
"ho... | [
"async",
"def",
"test_setup_with_overly_long_url_and_name",
"(",
"hass",
",",
"mock_async_zeroconf",
",",
"caplog",
")",
":",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"config_entries",
".",
"flow",
",",
"\"async_init\"",
")",
",",
"patch",
".",
"object"... | [
154,
0
] | [
173,
41
] | python | en | ['en', 'en', 'en'] | True |
test_setup_with_default_interface | (hass, mock_async_zeroconf) | Test default interface config. | Test default interface config. | async def test_setup_with_default_interface(hass, mock_async_zeroconf):
"""Test default interface config."""
with patch.object(hass.config_entries.flow, "async_init"), patch.object(
zeroconf, "HaAsyncServiceBrowser", side_effect=service_update_mock
), patch(
"homeassistant.components.zerocon... | [
"async",
"def",
"test_setup_with_default_interface",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"config_entries",
".",
"flow",
",",
"\"async_init\"",
")",
",",
"patch",
".",
"object",
"(",
"zeroconf",
"... | [
176,
0
] | [
190,
84
] | python | fr | ['fr', 'fr', 'en'] | True |
test_setup_without_default_interface | (hass, mock_async_zeroconf) | Test without default interface config. | Test without default interface config. | async def test_setup_without_default_interface(hass, mock_async_zeroconf):
"""Test without default interface config."""
with patch.object(hass.config_entries.flow, "async_init"), patch.object(
zeroconf, "HaAsyncServiceBrowser", side_effect=service_update_mock
), patch(
"homeassistant.compone... | [
"async",
"def",
"test_setup_without_default_interface",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"config_entries",
".",
"flow",
",",
"\"async_init\"",
")",
",",
"patch",
".",
"object",
"(",
"zeroconf",
... | [
193,
0
] | [
205,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_without_ipv6 | (hass, mock_async_zeroconf) | Test without ipv6. | Test without ipv6. | async def test_setup_without_ipv6(hass, mock_async_zeroconf):
"""Test without ipv6."""
with patch.object(hass.config_entries.flow, "async_init"), patch.object(
zeroconf, "HaAsyncServiceBrowser", side_effect=service_update_mock
), patch(
"homeassistant.components.zeroconf.AsyncServiceInfo",
... | [
"async",
"def",
"test_setup_without_ipv6",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"config_entries",
".",
"flow",
",",
"\"async_init\"",
")",
",",
"patch",
".",
"object",
"(",
"zeroconf",
",",
"\"H... | [
208,
0
] | [
222,
71
] | python | en | ['en', 'en', 'en'] | True |
test_setup_with_ipv6 | (hass, mock_async_zeroconf) | Test without ipv6. | Test without ipv6. | async def test_setup_with_ipv6(hass, mock_async_zeroconf):
"""Test without ipv6."""
with patch.object(hass.config_entries.flow, "async_init"), patch.object(
zeroconf, "HaAsyncServiceBrowser", side_effect=service_update_mock
), patch(
"homeassistant.components.zeroconf.AsyncServiceInfo",
... | [
"async",
"def",
"test_setup_with_ipv6",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"config_entries",
".",
"flow",
",",
"\"async_init\"",
")",
",",
"patch",
".",
"object",
"(",
"zeroconf",
",",
"\"HaAs... | [
225,
0
] | [
239,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_with_ipv6_default | (hass, mock_async_zeroconf) | Test without ipv6 as default. | Test without ipv6 as default. | async def test_setup_with_ipv6_default(hass, mock_async_zeroconf):
"""Test without ipv6 as default."""
with patch.object(hass.config_entries.flow, "async_init"), patch.object(
zeroconf, "HaAsyncServiceBrowser", side_effect=service_update_mock
), patch(
"homeassistant.components.zeroconf.Asyn... | [
"async",
"def",
"test_setup_with_ipv6_default",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"config_entries",
".",
"flow",
",",
"\"async_init\"",
")",
",",
"patch",
".",
"object",
"(",
"zeroconf",
",",
... | [
242,
0
] | [
254,
44
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_match_macaddress | (hass, mock_async_zeroconf) | Test configured options for a device are loaded via config entry. | Test configured options for a device are loaded via config entry. | async def test_zeroconf_match_macaddress(hass, mock_async_zeroconf):
"""Test configured options for a device are loaded via config entry."""
def http_only_service_update_mock(ipv6, zeroconf, services, handlers):
"""Call service update handler."""
handlers[0](
zeroconf,
"... | [
"async",
"def",
"test_zeroconf_match_macaddress",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"def",
"http_only_service_update_mock",
"(",
"ipv6",
",",
"zeroconf",
",",
"services",
",",
"handlers",
")",
":",
"\"\"\"Call service update handler.\"\"\"",
"handlers",
... | [
257,
0
] | [
291,
59
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_match_manufacturer | (hass, mock_async_zeroconf) | Test configured options for a device are loaded via config entry. | Test configured options for a device are loaded via config entry. | async def test_zeroconf_match_manufacturer(hass, mock_async_zeroconf):
"""Test configured options for a device are loaded via config entry."""
def http_only_service_update_mock(ipv6, zeroconf, services, handlers):
"""Call service update handler."""
handlers[0](
zeroconf,
... | [
"async",
"def",
"test_zeroconf_match_manufacturer",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"def",
"http_only_service_update_mock",
"(",
"ipv6",
",",
"zeroconf",
",",
"services",
",",
"handlers",
")",
":",
"\"\"\"Call service update handler.\"\"\"",
"handlers",... | [
294,
0
] | [
324,
62
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_match_manufacturer_not_present | (hass, mock_async_zeroconf) | Test matchers reject when a property is missing. | Test matchers reject when a property is missing. | async def test_zeroconf_match_manufacturer_not_present(hass, mock_async_zeroconf):
"""Test matchers reject when a property is missing."""
def http_only_service_update_mock(ipv6, zeroconf, services, handlers):
"""Call service update handler."""
handlers[0](
zeroconf,
"_ai... | [
"async",
"def",
"test_zeroconf_match_manufacturer_not_present",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"def",
"http_only_service_update_mock",
"(",
"ipv6",
",",
"zeroconf",
",",
"services",
",",
"handlers",
")",
":",
"\"\"\"Call service update handler.\"\"\"",
... | [
327,
0
] | [
356,
48
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_no_match | (hass, mock_async_zeroconf) | Test configured options for a device are loaded via config entry. | Test configured options for a device are loaded via config entry. | async def test_zeroconf_no_match(hass, mock_async_zeroconf):
"""Test configured options for a device are loaded via config entry."""
def http_only_service_update_mock(ipv6, zeroconf, services, handlers):
"""Call service update handler."""
handlers[0](
zeroconf,
"_http._t... | [
"async",
"def",
"test_zeroconf_no_match",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"def",
"http_only_service_update_mock",
"(",
"ipv6",
",",
"zeroconf",
",",
"services",
",",
"handlers",
")",
":",
"\"\"\"Call service update handler.\"\"\"",
"handlers",
"[",
... | [
359,
0
] | [
388,
48
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_no_match_manufacturer | (hass, mock_async_zeroconf) | Test configured options for a device are loaded via config entry. | Test configured options for a device are loaded via config entry. | async def test_zeroconf_no_match_manufacturer(hass, mock_async_zeroconf):
"""Test configured options for a device are loaded via config entry."""
def http_only_service_update_mock(ipv6, zeroconf, services, handlers):
"""Call service update handler."""
handlers[0](
zeroconf,
... | [
"async",
"def",
"test_zeroconf_no_match_manufacturer",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"def",
"http_only_service_update_mock",
"(",
"ipv6",
",",
"zeroconf",
",",
"services",
",",
"handlers",
")",
":",
"\"\"\"Call service update handler.\"\"\"",
"handler... | [
391,
0
] | [
420,
48
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_match_partial_space | (hass, mock_async_zeroconf) | Test configured options for a device are loaded via config entry. | Test configured options for a device are loaded via config entry. | async def test_homekit_match_partial_space(hass, mock_async_zeroconf):
"""Test configured options for a device are loaded via config entry."""
with patch.dict(
zc_gen.ZEROCONF,
{"_hap._tcp.local.": [{"domain": "homekit_controller"}]},
clear=True,
), patch.object(
hass.config_... | [
"async",
"def",
"test_homekit_match_partial_space",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"dict",
"(",
"zc_gen",
".",
"ZEROCONF",
",",
"{",
"\"_hap._tcp.local.\"",
":",
"[",
"{",
"\"domain\"",
":",
"\"homekit_controller\"",
"}",
... | [
423,
0
] | [
447,
57
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_match_partial_dash | (hass, mock_async_zeroconf) | Test configured options for a device are loaded via config entry. | Test configured options for a device are loaded via config entry. | async def test_homekit_match_partial_dash(hass, mock_async_zeroconf):
"""Test configured options for a device are loaded via config entry."""
with patch.dict(
zc_gen.ZEROCONF,
{"_hap._udp.local.": [{"domain": "homekit_controller"}]},
clear=True,
), patch.object(
hass.config_e... | [
"async",
"def",
"test_homekit_match_partial_dash",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"dict",
"(",
"zc_gen",
".",
"ZEROCONF",
",",
"{",
"\"_hap._udp.local.\"",
":",
"[",
"{",
"\"domain\"",
":",
"\"homekit_controller\"",
"}",
... | [
450,
0
] | [
474,
59
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_match_partial_fnmatch | (hass, mock_async_zeroconf) | Test matching homekit devices with fnmatch. | Test matching homekit devices with fnmatch. | async def test_homekit_match_partial_fnmatch(hass, mock_async_zeroconf):
"""Test matching homekit devices with fnmatch."""
with patch.dict(
zc_gen.ZEROCONF,
{"_hap._tcp.local.": [{"domain": "homekit_controller"}]},
clear=True,
), patch.dict(zc_gen.HOMEKIT, {"YLDP*": "yeelight"}, clea... | [
"async",
"def",
"test_homekit_match_partial_fnmatch",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"dict",
"(",
"zc_gen",
".",
"ZEROCONF",
",",
"{",
"\"_hap._tcp.local.\"",
":",
"[",
"{",
"\"domain\"",
":",
"\"homekit_controller\"",
"}"... | [
477,
0
] | [
501,
61
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_match_full | (hass, mock_async_zeroconf) | Test configured options for a device are loaded via config entry. | Test configured options for a device are loaded via config entry. | async def test_homekit_match_full(hass, mock_async_zeroconf):
"""Test configured options for a device are loaded via config entry."""
with patch.dict(
zc_gen.ZEROCONF,
{"_hap._udp.local.": [{"domain": "homekit_controller"}]},
clear=True,
), patch.object(
hass.config_entries.f... | [
"async",
"def",
"test_homekit_match_full",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"dict",
"(",
"zc_gen",
".",
"ZEROCONF",
",",
"{",
"\"_hap._udp.local.\"",
":",
"[",
"{",
"\"domain\"",
":",
"\"homekit_controller\"",
"}",
"]",
... | [
504,
0
] | [
528,
56
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_already_paired | (hass, mock_async_zeroconf) | Test that an already paired device is sent to homekit_controller. | Test that an already paired device is sent to homekit_controller. | async def test_homekit_already_paired(hass, mock_async_zeroconf):
"""Test that an already paired device is sent to homekit_controller."""
with patch.dict(
zc_gen.ZEROCONF,
{"_hap._tcp.local.": [{"domain": "homekit_controller"}]},
clear=True,
), patch.object(
hass.config_entri... | [
"async",
"def",
"test_homekit_already_paired",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"dict",
"(",
"zc_gen",
".",
"ZEROCONF",
",",
"{",
"\"_hap._tcp.local.\"",
":",
"[",
"{",
"\"domain\"",
":",
"\"homekit_controller\"",
"}",
"]"... | [
531,
0
] | [
556,
71
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_invalid_paring_status | (hass, mock_async_zeroconf) | Test that missing paring data is not sent to homekit_controller. | Test that missing paring data is not sent to homekit_controller. | async def test_homekit_invalid_paring_status(hass, mock_async_zeroconf):
"""Test that missing paring data is not sent to homekit_controller."""
with patch.dict(
zc_gen.ZEROCONF,
{"_hap._tcp.local.": [{"domain": "homekit_controller"}]},
clear=True,
), patch.object(
hass.config... | [
"async",
"def",
"test_homekit_invalid_paring_status",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"dict",
"(",
"zc_gen",
".",
"ZEROCONF",
",",
"{",
"\"_hap._tcp.local.\"",
":",
"[",
"{",
"\"domain\"",
":",
"\"homekit_controller\"",
"}"... | [
559,
0
] | [
583,
57
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_not_paired | (hass, mock_async_zeroconf) | Test that an not paired device is sent to homekit_controller. | Test that an not paired device is sent to homekit_controller. | async def test_homekit_not_paired(hass, mock_async_zeroconf):
"""Test that an not paired device is sent to homekit_controller."""
with patch.dict(
zc_gen.ZEROCONF,
{"_hap._tcp.local.": [{"domain": "homekit_controller"}]},
clear=True,
), patch.object(
hass.config_entries.flow,... | [
"async",
"def",
"test_homekit_not_paired",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
".",
"dict",
"(",
"zc_gen",
".",
"ZEROCONF",
",",
"{",
"\"_hap._tcp.local.\"",
":",
"[",
"{",
"\"domain\"",
":",
"\"homekit_controller\"",
"}",
"]",
... | [
586,
0
] | [
608,
71
] | python | en | ['en', 'en', 'en'] | True |
test_info_from_service_non_utf8 | (hass) | Test info_from_service handles non UTF-8 property keys and values correctly. | Test info_from_service handles non UTF-8 property keys and values correctly. | async def test_info_from_service_non_utf8(hass):
"""Test info_from_service handles non UTF-8 property keys and values correctly."""
service_type = "_test._tcp.local."
info = zeroconf.info_from_service(
get_service_info_mock(service_type, f"test.{service_type}")
)
raw_info = info["properties"... | [
"async",
"def",
"test_info_from_service_non_utf8",
"(",
"hass",
")",
":",
"service_type",
"=",
"\"_test._tcp.local.\"",
"info",
"=",
"zeroconf",
".",
"info_from_service",
"(",
"get_service_info_mock",
"(",
"service_type",
",",
"f\"test.{service_type}\"",
")",
")",
"raw_... | [
611,
0
] | [
623,
55
] | python | en | ['en', 'en', 'en'] | True |
test_info_from_service_with_addresses | (hass) | Test info_from_service does not throw when there are no addresses. | Test info_from_service does not throw when there are no addresses. | async def test_info_from_service_with_addresses(hass):
"""Test info_from_service does not throw when there are no addresses."""
service_type = "_test._tcp.local."
info = zeroconf.info_from_service(
get_service_info_mock_without_an_address(service_type, f"test.{service_type}")
)
assert info i... | [
"async",
"def",
"test_info_from_service_with_addresses",
"(",
"hass",
")",
":",
"service_type",
"=",
"\"_test._tcp.local.\"",
"info",
"=",
"zeroconf",
".",
"info_from_service",
"(",
"get_service_info_mock_without_an_address",
"(",
"service_type",
",",
"f\"test.{service_type}\... | [
626,
0
] | [
632,
23
] | python | en | ['en', 'en', 'en'] | True |
test_get_instance | (hass, mock_async_zeroconf) | Test we get an instance. | Test we get an instance. | async def test_get_instance(hass, mock_async_zeroconf):
"""Test we get an instance."""
assert await async_setup_component(hass, zeroconf.DOMAIN, {zeroconf.DOMAIN: {}})
assert (
await hass.components.zeroconf.async_get_async_instance() is mock_async_zeroconf
)
hass.bus.async_fire(EVENT_HOMEAS... | [
"async",
"def",
"test_get_instance",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"zeroconf",
".",
"DOMAIN",
",",
"{",
"zeroconf",
".",
"DOMAIN",
":",
"{",
"}",
"}",
")",
"assert",
"(",
"a... | [
635,
0
] | [
643,
66
] | python | en | ['en', 'lb', 'en'] | True |
test_removed_ignored | (hass, mock_async_zeroconf) | Test we remove it when a zeroconf entry is removed. | Test we remove it when a zeroconf entry is removed. | async def test_removed_ignored(hass, mock_async_zeroconf):
"""Test we remove it when a zeroconf entry is removed."""
def service_update_mock(ipv6, zeroconf, services, handlers):
"""Call service update handler."""
handlers[0](
zeroconf,
"_service.added.local.",
... | [
"async",
"def",
"test_removed_ignored",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"def",
"service_update_mock",
"(",
"ipv6",
",",
"zeroconf",
",",
"services",
",",
"handlers",
")",
":",
"\"\"\"Call service update handler.\"\"\"",
"handlers",
"[",
"0",
"]",
... | [
646,
0
] | [
685,
77
] | python | en | ['en', 'en', 'en'] | True |
test_async_detect_interfaces_setting_non_loopback_route | (
hass, mock_async_zeroconf
) | Test without default interface config and the route returns a non-loopback address. | Test without default interface config and the route returns a non-loopback address. | async def test_async_detect_interfaces_setting_non_loopback_route(
hass, mock_async_zeroconf
):
"""Test without default interface config and the route returns a non-loopback address."""
with patch("homeassistant.components.zeroconf.HaZeroconf") as mock_zc, patch.object(
hass.config_entries.flow, "as... | [
"async",
"def",
"test_async_detect_interfaces_setting_non_loopback_route",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.zeroconf.HaZeroconf\"",
")",
"as",
"mock_zc",
",",
"patch",
".",
"object",
"(",
"hass",
".",
"... | [
700,
0
] | [
721,
5
] | python | en | ['en', 'en', 'en'] | True |
test_async_detect_interfaces_setting_empty_route | (hass, mock_async_zeroconf) | Test without default interface config and the route returns nothing. | Test without default interface config and the route returns nothing. | async def test_async_detect_interfaces_setting_empty_route(hass, mock_async_zeroconf):
"""Test without default interface config and the route returns nothing."""
with patch("homeassistant.components.zeroconf.HaZeroconf") as mock_zc, patch.object(
hass.config_entries.flow, "async_init"
), patch.objec... | [
"async",
"def",
"test_async_detect_interfaces_setting_empty_route",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.zeroconf.HaZeroconf\"",
")",
"as",
"mock_zc",
",",
"patch",
".",
"object",
"(",
"hass",
".",
"config_... | [
784,
0
] | [
809,
5
] | python | en | ['en', 'en', 'en'] | True |
test_get_announced_addresses | (hass, mock_async_zeroconf) | Test addresses for mDNS announcement. | Test addresses for mDNS announcement. | async def test_get_announced_addresses(hass, mock_async_zeroconf):
"""Test addresses for mDNS announcement."""
expected = {
ip_address(ip).packed
for ip in [
"fe80::1234:5678:9abc:def0",
"2001:db8::",
"192.168.1.5",
"fe80::dead:beef:dead:beef",
... | [
"async",
"def",
"test_get_announced_addresses",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"expected",
"=",
"{",
"ip_address",
"(",
"ip",
")",
".",
"packed",
"for",
"ip",
"in",
"[",
"\"fe80::1234:5678:9abc:def0\"",
",",
"\"2001:db8::\"",
",",
"\"192.168.1.... | [
812,
0
] | [
830,
60
] | python | en | ['en', 'en', 'en'] | True |
test_async_detect_interfaces_explicitly_set_ipv6 | (hass, mock_async_zeroconf) | Test interfaces are explicitly set when IPv6 is present. | Test interfaces are explicitly set when IPv6 is present. | async def test_async_detect_interfaces_explicitly_set_ipv6(hass, mock_async_zeroconf):
"""Test interfaces are explicitly set when IPv6 is present."""
with patch("homeassistant.components.zeroconf.HaZeroconf") as mock_zc, patch.object(
hass.config_entries.flow, "async_init"
), patch.object(
z... | [
"async",
"def",
"test_async_detect_interfaces_explicitly_set_ipv6",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.zeroconf.HaZeroconf\"",
")",
"as",
"mock_zc",
",",
"patch",
".",
"object",
"(",
"hass",
".",
"config_... | [
853,
0
] | [
873,
5
] | python | en | ['en', 'en', 'en'] | True |
test_no_name | (hass, mock_async_zeroconf) | Test fallback to Home for mDNS announcement if the name is missing. | Test fallback to Home for mDNS announcement if the name is missing. | async def test_no_name(hass, mock_async_zeroconf):
"""Test fallback to Home for mDNS announcement if the name is missing."""
hass.config.location_name = ""
with patch("homeassistant.components.zeroconf.HaZeroconf"):
assert await async_setup_component(hass, zeroconf.DOMAIN, {zeroconf.DOMAIN: {}})
... | [
"async",
"def",
"test_no_name",
"(",
"hass",
",",
"mock_async_zeroconf",
")",
":",
"hass",
".",
"config",
".",
"location_name",
"=",
"\"\"",
"with",
"patch",
"(",
"\"homeassistant.components.zeroconf.HaZeroconf\"",
")",
":",
"assert",
"await",
"async_setup_component",... | [
876,
0
] | [
886,
58
] | python | en | ['en', 'en', 'en'] | True |
Control4Validator.__init__ | (self, host, username, password, hass) | Initialize. | Initialize. | def __init__(self, host, username, password, hass):
"""Initialize."""
self.host = host
self.username = username
self.password = password
self.controller_unique_id = None
self.director_bearer_token = None
self.hass = hass | [
"def",
"__init__",
"(",
"self",
",",
"host",
",",
"username",
",",
"password",
",",
"hass",
")",
":",
"self",
".",
"host",
"=",
"host",
"self",
".",
"username",
"=",
"username",
"self",
".",
"password",
"=",
"password",
"self",
".",
"controller_unique_id... | [
42,
4
] | [
49,
24
] | python | en | ['en', 'en', 'it'] | False |
Control4Validator.authenticate | (self) | Test if we can authenticate with the Control4 account API. | Test if we can authenticate with the Control4 account API. | async def authenticate(self) -> bool:
"""Test if we can authenticate with the Control4 account API."""
try:
account_session = aiohttp_client.async_get_clientsession(self.hass)
account = C4Account(self.username, self.password, account_session)
# Authenticate with Contr... | [
"async",
"def",
"authenticate",
"(",
"self",
")",
"->",
"bool",
":",
"try",
":",
"account_session",
"=",
"aiohttp_client",
".",
"async_get_clientsession",
"(",
"self",
".",
"hass",
")",
"account",
"=",
"C4Account",
"(",
"self",
".",
"username",
",",
"self",
... | [
51,
4
] | [
69,
24
] | python | en | ['en', 'en', 'en'] | True |
Control4Validator.connect_to_director | (self) | Test if we can connect to the local Control4 Director. | Test if we can connect to the local Control4 Director. | async def connect_to_director(self) -> bool:
"""Test if we can connect to the local Control4 Director."""
try:
director_session = aiohttp_client.async_get_clientsession(
self.hass, verify_ssl=False
)
director = C4Director(
self.host, se... | [
"async",
"def",
"connect_to_director",
"(",
"self",
")",
"->",
"bool",
":",
"try",
":",
"director_session",
"=",
"aiohttp_client",
".",
"async_get_clientsession",
"(",
"self",
".",
"hass",
",",
"verify_ssl",
"=",
"False",
")",
"director",
"=",
"C4Director",
"(... | [
71,
4
] | [
84,
24
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_user | (self, user_input=None) | Handle the initial step. | Handle the initial step. | async def async_step_user(self, user_input=None):
"""Handle the initial step."""
errors = {}
if user_input is not None:
hub = Control4Validator(
user_input["host"],
user_input["username"],
user_input["password"],
self.h... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"hub",
"=",
"Control4Validator",
"(",
"user_input",
"[",
"\"host\"",
"]",
",",
"user_input",
... | [
92,
4
] | [
134,
9
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_get_options_flow | (config_entry) | Get the options flow for this handler. | Get the options flow for this handler. | def async_get_options_flow(config_entry):
"""Get the options flow for this handler."""
return OptionsFlowHandler(config_entry) | [
"def",
"async_get_options_flow",
"(",
"config_entry",
")",
":",
"return",
"OptionsFlowHandler",
"(",
"config_entry",
")"
] | [
138,
4
] | [
140,
47
] | python | en | ['en', 'en', 'en'] | True |
OptionsFlowHandler.__init__ | (self, config_entry: config_entries.ConfigEntry) | Initialize options flow. | Initialize options flow. | def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize options flow."""
self.config_entry = config_entry | [
"def",
"__init__",
"(",
"self",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
"->",
"None",
":",
"self",
".",
"config_entry",
"=",
"config_entry"
] | [
146,
4
] | [
148,
40
] | python | en | ['en', 'en', 'en'] | True |
OptionsFlowHandler.async_step_init | (self, user_input=None) | Handle options flow. | Handle options flow. | async def async_step_init(self, user_input=None):
"""Handle options flow."""
if user_input is not None:
return self.async_create_entry(title="", data=user_input)
data_schema = vol.Schema(
{
vol.Optional(
CONF_SCAN_INTERVAL,
... | [
"async",
"def",
"async_step_init",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"return",
"self",
".",
"async_create_entry",
"(",
"title",
"=",
"\"\"",
",",
"data",
"=",
"user_input",
")",
"data_schem... | [
150,
4
] | [
165,
76
] | python | en | ['en', 'nl', 'en'] | True |
build_item_response | (
client: XboxLiveClient,
device_id: str,
tv_configured: bool,
media_content_type: str,
media_content_id: str,
) | Create response payload for the provided media query. | Create response payload for the provided media query. | async def build_item_response(
client: XboxLiveClient,
device_id: str,
tv_configured: bool,
media_content_type: str,
media_content_id: str,
) -> BrowseMedia | None:
"""Create response payload for the provided media query."""
apps: InstalledPackagesList = await client.smartglass.get_installed... | [
"async",
"def",
"build_item_response",
"(",
"client",
":",
"XboxLiveClient",
",",
"device_id",
":",
"str",
",",
"tv_configured",
":",
"bool",
",",
"media_content_type",
":",
"str",
",",
"media_content_id",
":",
"str",
",",
")",
"->",
"BrowseMedia",
"|",
"None"... | [
37,
0
] | [
148,
5
] | python | en | ['en', 'en', 'en'] | True |
item_payload | (item: InstalledPackage, images: dict[str, list[Image]]) | Create response payload for a single media item. | Create response payload for a single media item. | def item_payload(item: InstalledPackage, images: dict[str, list[Image]]):
"""Create response payload for a single media item."""
thumbnail = None
image = _find_media_image(images.get(item.one_store_product_id, []))
if image is not None:
thumbnail = image.uri
if thumbnail[0] == "/":
... | [
"def",
"item_payload",
"(",
"item",
":",
"InstalledPackage",
",",
"images",
":",
"dict",
"[",
"str",
",",
"list",
"[",
"Image",
"]",
"]",
")",
":",
"thumbnail",
"=",
"None",
"image",
"=",
"_find_media_image",
"(",
"images",
".",
"get",
"(",
"item",
"."... | [
151,
0
] | [
168,
5
] | python | en | ['en', 'en', 'en'] | True |
ix_ | (*args) |
Construct an open mesh from multiple sequences.
This function takes N 1-D sequences and returns N outputs with N
dimensions each, such that the shape is 1 in all but one dimension
and the dimension with the non-unit shape value cycles through all
N dimensions.
Using `ix_` one can quickly cons... |
Construct an open mesh from multiple sequences. | def ix_(*args):
"""
Construct an open mesh from multiple sequences.
This function takes N 1-D sequences and returns N outputs with N
dimensions each, such that the shape is 1 in all but one dimension
and the dimension with the non-unit shape value cycles through all
N dimensions.
Using `ix... | [
"def",
"ix_",
"(",
"*",
"args",
")",
":",
"out",
"=",
"[",
"]",
"nd",
"=",
"len",
"(",
"args",
")",
"for",
"k",
",",
"new",
"in",
"enumerate",
"(",
"args",
")",
":",
"if",
"not",
"isinstance",
"(",
"new",
",",
"_nx",
".",
"ndarray",
")",
":",... | [
34,
0
] | [
105,
21
] | python | en | ['en', 'error', 'th'] | False |
fill_diagonal | (a, val, wrap=False) | Fill the main diagonal of the given array of any dimensionality.
For an array `a` with ``a.ndim >= 2``, the diagonal is the list of
locations with indices ``a[i, ..., i]`` all identical. This function
modifies the input array in-place, it does not return a value.
Parameters
----------
a : arra... | Fill the main diagonal of the given array of any dimensionality. | def fill_diagonal(a, val, wrap=False):
"""Fill the main diagonal of the given array of any dimensionality.
For an array `a` with ``a.ndim >= 2``, the diagonal is the list of
locations with indices ``a[i, ..., i]`` all identical. This function
modifies the input array in-place, it does not return a valu... | [
"def",
"fill_diagonal",
"(",
"a",
",",
"val",
",",
"wrap",
"=",
"False",
")",
":",
"if",
"a",
".",
"ndim",
"<",
"2",
":",
"raise",
"ValueError",
"(",
"\"array must be at least 2-d\"",
")",
"end",
"=",
"None",
"if",
"a",
".",
"ndim",
"==",
"2",
":",
... | [
747,
0
] | [
875,
27
] | python | en | ['en', 'en', 'en'] | True |
diag_indices | (n, ndim=2) |
Return the indices to access the main diagonal of an array.
This returns a tuple of indices that can be used to access the main
diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape
(n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for
``a.ndim > 2`` this is the set of in... |
Return the indices to access the main diagonal of an array. | def diag_indices(n, ndim=2):
"""
Return the indices to access the main diagonal of an array.
This returns a tuple of indices that can be used to access the main
diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape
(n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for
... | [
"def",
"diag_indices",
"(",
"n",
",",
"ndim",
"=",
"2",
")",
":",
"idx",
"=",
"arange",
"(",
"n",
")",
"return",
"(",
"idx",
",",
")",
"*",
"ndim"
] | [
879,
0
] | [
944,
24
] | python | en | ['en', 'error', 'th'] | False |
diag_indices_from | (arr) |
Return the indices to access the main diagonal of an n-dimensional array.
See `diag_indices` for full details.
Parameters
----------
arr : array, at least 2-D
See Also
--------
diag_indices
Notes
-----
.. versionadded:: 1.4.0
|
Return the indices to access the main diagonal of an n-dimensional array. | def diag_indices_from(arr):
"""
Return the indices to access the main diagonal of an n-dimensional array.
See `diag_indices` for full details.
Parameters
----------
arr : array, at least 2-D
See Also
--------
diag_indices
Notes
-----
.. versionadded:: 1.4.0
"""
... | [
"def",
"diag_indices_from",
"(",
"arr",
")",
":",
"if",
"not",
"arr",
".",
"ndim",
">=",
"2",
":",
"raise",
"ValueError",
"(",
"\"input array must be at least 2-d\"",
")",
"# For more than d=2, the strided formula is only valid for arrays with",
"# all dimensions equal, so we... | [
952,
0
] | [
979,
47
] | python | en | ['en', 'error', 'th'] | False |
DynaliteFlowHandler.__init__ | (self) | Initialize the Dynalite flow. | Initialize the Dynalite flow. | def __init__(self) -> None:
"""Initialize the Dynalite flow."""
self.host = None | [
"def",
"__init__",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"host",
"=",
"None"
] | [
18,
4
] | [
20,
24
] | python | en | ['en', 'pl', 'en'] | True |
DynaliteFlowHandler.async_step_import | (self, import_info: dict[str, Any]) | Import a new bridge as a config entry. | Import a new bridge as a config entry. | async def async_step_import(self, import_info: dict[str, Any]) -> Any:
"""Import a new bridge as a config entry."""
LOGGER.debug("Starting async_step_import - %s", import_info)
host = import_info[CONF_HOST]
for entry in self._async_current_entries():
if entry.data[CONF_HOST] ... | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"import_info",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Any",
":",
"LOGGER",
".",
"debug",
"(",
"\"Starting async_step_import - %s\"",
",",
"import_info",
")",
"host",
"=",
"import_info",
"[... | [
22,
4
] | [
39,
68
] | python | en | ['en', 'gl', 'en'] | True |
test_ecobee_date_with_valid_input | () | Test that the date function returns the expected result. | Test that the date function returns the expected result. | async def test_ecobee_date_with_valid_input():
"""Test that the date function returns the expected result."""
test_input = "2019-09-27"
assert ecobee_date(test_input) == test_input | [
"async",
"def",
"test_ecobee_date_with_valid_input",
"(",
")",
":",
"test_input",
"=",
"\"2019-09-27\"",
"assert",
"ecobee_date",
"(",
"test_input",
")",
"==",
"test_input"
] | [
7,
0
] | [
11,
48
] | python | en | ['en', 'en', 'en'] | True |
test_ecobee_date_with_invalid_input | () | Test that the date function raises the expected exception. | Test that the date function raises the expected exception. | async def test_ecobee_date_with_invalid_input():
"""Test that the date function raises the expected exception."""
test_input = "20190927"
with pytest.raises(vol.Invalid):
ecobee_date(test_input) | [
"async",
"def",
"test_ecobee_date_with_invalid_input",
"(",
")",
":",
"test_input",
"=",
"\"20190927\"",
"with",
"pytest",
".",
"raises",
"(",
"vol",
".",
"Invalid",
")",
":",
"ecobee_date",
"(",
"test_input",
")"
] | [
14,
0
] | [
19,
31
] | python | en | ['en', 'en', 'en'] | True |
test_ecobee_time_with_valid_input | () | Test that the time function returns the expected result. | Test that the time function returns the expected result. | async def test_ecobee_time_with_valid_input():
"""Test that the time function returns the expected result."""
test_input = "20:55:15"
assert ecobee_time(test_input) == test_input | [
"async",
"def",
"test_ecobee_time_with_valid_input",
"(",
")",
":",
"test_input",
"=",
"\"20:55:15\"",
"assert",
"ecobee_time",
"(",
"test_input",
")",
"==",
"test_input"
] | [
22,
0
] | [
26,
48
] | python | en | ['en', 'en', 'en'] | True |
test_ecobee_time_with_invalid_input | () | Test that the time function raises the expected exception. | Test that the time function raises the expected exception. | async def test_ecobee_time_with_invalid_input():
"""Test that the time function raises the expected exception."""
test_input = "20:55"
with pytest.raises(vol.Invalid):
ecobee_time(test_input) | [
"async",
"def",
"test_ecobee_time_with_invalid_input",
"(",
")",
":",
"test_input",
"=",
"\"20:55\"",
"with",
"pytest",
".",
"raises",
"(",
"vol",
".",
"Invalid",
")",
":",
"ecobee_time",
"(",
"test_input",
")"
] | [
29,
0
] | [
34,
31
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up a sensor for a raincloud device. | Set up a sensor for a raincloud device. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up a sensor for a raincloud device."""
raincloud = hass.data[DATA_RAINCLOUD].data
default_watering_timer = config.get(CONF_WATERING_TIME)
sensors = []
for sensor_type in config.get(CONF_MONITORED_CONDITIONS):
# crea... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"raincloud",
"=",
"hass",
".",
"data",
"[",
"DATA_RAINCLOUD",
"]",
".",
"data",
"default_watering_timer",
"=",
"config",
".",
"get",
"(",
... | [
33,
0
] | [
44,
31
] | python | en | ['en', 'ca', 'en'] | True |
RainCloudSwitch.__init__ | (self, default_watering_timer, *args) | Initialize a switch for raincloud device. | Initialize a switch for raincloud device. | def __init__(self, default_watering_timer, *args):
"""Initialize a switch for raincloud device."""
super().__init__(*args)
self._default_watering_timer = default_watering_timer | [
"def",
"__init__",
"(",
"self",
",",
"default_watering_timer",
",",
"*",
"args",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"args",
")",
"self",
".",
"_default_watering_timer",
"=",
"default_watering_timer"
] | [
50,
4
] | [
53,
61
] | python | en | ['en', 'en', 'en'] | True |
RainCloudSwitch.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
56,
4
] | [
58,
26
] | python | en | ['en', 'fy', 'en'] | True |
RainCloudSwitch.turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | def turn_on(self, **kwargs):
"""Turn the device on."""
if self._sensor_type == "manual_watering":
self.data.watering_time = self._default_watering_timer
elif self._sensor_type == "auto_watering":
self.data.auto_watering = True
self._state = True | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_sensor_type",
"==",
"\"manual_watering\"",
":",
"self",
".",
"data",
".",
"watering_time",
"=",
"self",
".",
"_default_watering_timer",
"elif",
"self",
".",
"_sensor_type"... | [
60,
4
] | [
66,
26
] | python | en | ['en', 'en', 'en'] | True |
RainCloudSwitch.turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | def turn_off(self, **kwargs):
"""Turn the device off."""
if self._sensor_type == "manual_watering":
self.data.watering_time = "off"
elif self._sensor_type == "auto_watering":
self.data.auto_watering = False
self._state = False | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_sensor_type",
"==",
"\"manual_watering\"",
":",
"self",
".",
"data",
".",
"watering_time",
"=",
"\"off\"",
"elif",
"self",
".",
"_sensor_type",
"==",
"\"auto_watering\"",... | [
68,
4
] | [
74,
27
] | python | en | ['en', 'en', 'en'] | True |
RainCloudSwitch.update | (self) | Update device state. | Update device state. | def update(self):
"""Update device state."""
_LOGGER.debug("Updating RainCloud switch: %s", self._name)
if self._sensor_type == "manual_watering":
self._state = bool(self.data.watering_time)
elif self._sensor_type == "auto_watering":
self._state = self.data.auto_w... | [
"def",
"update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating RainCloud switch: %s\"",
",",
"self",
".",
"_name",
")",
"if",
"self",
".",
"_sensor_type",
"==",
"\"manual_watering\"",
":",
"self",
".",
"_state",
"=",
"bool",
"(",
"self",
... | [
76,
4
] | [
82,
49
] | python | en | ['fr', 'en', 'en'] | True |
RainCloudSwitch.extra_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def extra_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
"default_manual_timer": self._default_watering_timer,
"identifier": self.data.serial,
} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
",",
"\"default_manual_timer\"",
":",
"self",
".",
"_default_watering_timer",
",",
"\"identifier\"",
":",
"self",
".",
"data",
".",
"serial",
",",
"}"
] | [
85,
4
] | [
91,
9
] | python | en | ['en', 'en', 'en'] | True |
is_on | (hass, entity_id) | Return if the humidifier is on based on the statemachine.
Async friendly.
| Return if the humidifier is on based on the statemachine. | def is_on(hass, entity_id):
"""Return if the humidifier is on based on the statemachine.
Async friendly.
"""
return hass.states.is_state(entity_id, STATE_ON) | [
"def",
"is_on",
"(",
"hass",
",",
"entity_id",
")",
":",
"return",
"hass",
".",
"states",
".",
"is_state",
"(",
"entity_id",
",",
"STATE_ON",
")"
] | [
55,
0
] | [
60,
52
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: ConfigType) | Set up humidifier devices. | Set up humidifier devices. | async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up humidifier devices."""
component = hass.data[DOMAIN] = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
)
await component.async_setup(config)
component.async_register_entity_service(SERVICE_TURN_ON, {}, "... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"component",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
","... | [
63,
0
] | [
89,
15
] | python | en | ['fr', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up a config entry. | Set up a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up a config entry."""
component: EntityComponent = hass.data[DOMAIN]
return await component.async_setup_entry(entry) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"component",
":",
"EntityComponent",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"return",
"await",
"component",
".",
"async_s... | [
92,
0
] | [
95,
51
] | 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."""
component: EntityComponent = hass.data[DOMAIN]
return await component.async_unload_entry(entry) | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"component",
":",
"EntityComponent",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"return",
"await",
"component",
".",
"async_... | [
98,
0
] | [
101,
52
] | python | en | ['en', 'es', 'en'] | True |
HumidifierEntity.capability_attributes | (self) | Return capability attributes. | Return capability attributes. | def capability_attributes(self) -> dict[str, Any]:
"""Return capability attributes."""
supported_features = self.supported_features or 0
data = {
ATTR_MIN_HUMIDITY: self.min_humidity,
ATTR_MAX_HUMIDITY: self.max_humidity,
}
if supported_features & SUPPORT... | [
"def",
"capability_attributes",
"(",
"self",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
":",
"supported_features",
"=",
"self",
".",
"supported_features",
"or",
"0",
"data",
"=",
"{",
"ATTR_MIN_HUMIDITY",
":",
"self",
".",
"min_humidity",
",",
"ATTR_MAX... | [
120,
4
] | [
131,
19
] | python | en | ['en', 'la', 'en'] | True |
HumidifierEntity.state_attributes | (self) | Return the optional state attributes. | Return the optional state attributes. | def state_attributes(self) -> dict[str, Any]:
"""Return the optional state attributes."""
supported_features = self.supported_features or 0
data = {}
if self.target_humidity is not None:
data[ATTR_HUMIDITY] = self.target_humidity
if supported_features & SUPPORT_MODE... | [
"def",
"state_attributes",
"(",
"self",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
":",
"supported_features",
"=",
"self",
".",
"supported_features",
"or",
"0",
"data",
"=",
"{",
"}",
"if",
"self",
".",
"target_humidity",
"is",
"not",
"None",
":",
... | [
135,
4
] | [
146,
19
] | python | en | ['en', 'en', 'en'] | True |
HumidifierEntity.target_humidity | (self) | Return the humidity we try to reach. | Return the humidity we try to reach. | def target_humidity(self) -> int | None:
"""Return the humidity we try to reach."""
return self._attr_target_humidity | [
"def",
"target_humidity",
"(",
"self",
")",
"->",
"int",
"|",
"None",
":",
"return",
"self",
".",
"_attr_target_humidity"
] | [
149,
4
] | [
151,
41
] | python | en | ['en', 'en', 'en'] | True |
HumidifierEntity.mode | (self) | Return the current mode, e.g., home, auto, baby.
Requires SUPPORT_MODES.
| Return the current mode, e.g., home, auto, baby. | def mode(self) -> str | None:
"""Return the current mode, e.g., home, auto, baby.
Requires SUPPORT_MODES.
"""
return self._attr_mode | [
"def",
"mode",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"self",
".",
"_attr_mode"
] | [
154,
4
] | [
159,
30
] | python | en | ['en', 'en', 'en'] | True |
HumidifierEntity.available_modes | (self) | Return a list of available modes.
Requires SUPPORT_MODES.
| Return a list of available modes. | def available_modes(self) -> list[str] | None:
"""Return a list of available modes.
Requires SUPPORT_MODES.
"""
return self._attr_available_modes | [
"def",
"available_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
"|",
"None",
":",
"return",
"self",
".",
"_attr_available_modes"
] | [
162,
4
] | [
167,
41
] | python | en | ['en', 'en', 'en'] | True |
HumidifierEntity.set_humidity | (self, humidity: int) | Set new target humidity. | Set new target humidity. | def set_humidity(self, humidity: int) -> None:
"""Set new target humidity."""
raise NotImplementedError() | [
"def",
"set_humidity",
"(",
"self",
",",
"humidity",
":",
"int",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
169,
4
] | [
171,
35
] | python | en | ['en', 'en', 'en'] | True |
HumidifierEntity.async_set_humidity | (self, humidity: int) | Set new target humidity. | Set new target humidity. | async def async_set_humidity(self, humidity: int) -> None:
"""Set new target humidity."""
await self.hass.async_add_executor_job(self.set_humidity, humidity) | [
"async",
"def",
"async_set_humidity",
"(",
"self",
",",
"humidity",
":",
"int",
")",
"->",
"None",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"set_humidity",
",",
"humidity",
")"
] | [
173,
4
] | [
175,
75
] | python | en | ['en', 'en', 'en'] | True |
HumidifierEntity.set_mode | (self, mode: str) | Set new mode. | Set new mode. | def set_mode(self, mode: str) -> None:
"""Set new mode."""
raise NotImplementedError() | [
"def",
"set_mode",
"(",
"self",
",",
"mode",
":",
"str",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
177,
4
] | [
179,
35
] | python | en | ['en', 'yi', 'en'] | True |
HumidifierEntity.async_set_mode | (self, mode: str) | Set new mode. | Set new mode. | async def async_set_mode(self, mode: str) -> None:
"""Set new mode."""
await self.hass.async_add_executor_job(self.set_mode, mode) | [
"async",
"def",
"async_set_mode",
"(",
"self",
",",
"mode",
":",
"str",
")",
"->",
"None",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"set_mode",
",",
"mode",
")"
] | [
181,
4
] | [
183,
67
] | python | en | ['en', 'yi', 'en'] | True |
HumidifierEntity.min_humidity | (self) | Return the minimum humidity. | Return the minimum humidity. | def min_humidity(self) -> int:
"""Return the minimum humidity."""
return self._attr_min_humidity | [
"def",
"min_humidity",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_attr_min_humidity"
] | [
186,
4
] | [
188,
38
] | python | en | ['en', 'et', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.