Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
test_load_yaml_config_preserves_key_order | () | Test removal of library. | Test removal of library. | def test_load_yaml_config_preserves_key_order():
"""Test removal of library."""
with open(YAML_PATH, "w") as fp:
fp.write("hello: 2\n")
fp.write("world: 1\n")
assert [("hello", 2), ("world", 1)] == list(
config_util.load_yaml_config_file(YAML_PATH).items()
) | [
"def",
"test_load_yaml_config_preserves_key_order",
"(",
")",
":",
"with",
"open",
"(",
"YAML_PATH",
",",
"\"w\"",
")",
"as",
"fp",
":",
"fp",
".",
"write",
"(",
"\"hello: 2\\n\"",
")",
"fp",
".",
"write",
"(",
"\"world: 1\\n\"",
")",
"assert",
"[",
"(",
"... | [
151,
0
] | [
159,
5
] | python | en | ['en', 'en', 'en'] | True |
test_create_default_config_returns_none_if_write_error | (hass) | Test the writing of a default configuration.
Non existing folder returns None.
| Test the writing of a default configuration. | async def test_create_default_config_returns_none_if_write_error(hass):
"""Test the writing of a default configuration.
Non existing folder returns None.
"""
hass.config.config_dir = os.path.join(CONFIG_DIR, "non_existing_dir/")
with patch("builtins.print") as mock_print:
assert await confi... | [
"async",
"def",
"test_create_default_config_returns_none_if_write_error",
"(",
"hass",
")",
":",
"hass",
".",
"config",
".",
"config_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"CONFIG_DIR",
",",
"\"non_existing_dir/\"",
")",
"with",
"patch",
"(",
"\"builtins.... | [
162,
0
] | [
170,
28
] | python | en | ['en', 'en', 'en'] | True |
test_core_config_schema | () | Test core config schema. | Test core config schema. | def test_core_config_schema():
"""Test core config schema."""
for value in (
{CONF_UNIT_SYSTEM: "K"},
{"time_zone": "non-exist"},
{"latitude": "91"},
{"longitude": -181},
{"external_url": "not an url"},
{"internal_url": "not an url"},
{"customize": "bla"},... | [
"def",
"test_core_config_schema",
"(",
")",
":",
"for",
"value",
"in",
"(",
"{",
"CONF_UNIT_SYSTEM",
":",
"\"K\"",
"}",
",",
"{",
"\"time_zone\"",
":",
"\"non-exist\"",
"}",
",",
"{",
"\"latitude\"",
":",
"\"91\"",
"}",
",",
"{",
"\"longitude\"",
":",
"-",... | [
173,
0
] | [
199,
5
] | python | de | ['de', 'de', 'en'] | True |
test_customize_dict_schema | () | Test basic customize config validation. | Test basic customize config validation. | def test_customize_dict_schema():
"""Test basic customize config validation."""
values = ({ATTR_FRIENDLY_NAME: None}, {ATTR_ASSUMED_STATE: "2"})
for val in values:
print(val)
with pytest.raises(MultipleInvalid):
config_util.CUSTOMIZE_DICT_SCHEMA(val)
assert config_util.CUST... | [
"def",
"test_customize_dict_schema",
"(",
")",
":",
"values",
"=",
"(",
"{",
"ATTR_FRIENDLY_NAME",
":",
"None",
"}",
",",
"{",
"ATTR_ASSUMED_STATE",
":",
"\"2\"",
"}",
")",
"for",
"val",
"in",
"values",
":",
"print",
"(",
"val",
")",
"with",
"pytest",
".... | [
202,
0
] | [
213,
61
] | python | en | ['en', 'zu', 'en'] | True |
test_customize_glob_is_ordered | () | Test that customize_glob preserves order. | Test that customize_glob preserves order. | def test_customize_glob_is_ordered():
"""Test that customize_glob preserves order."""
conf = config_util.CORE_CONFIG_SCHEMA({"customize_glob": OrderedDict()})
assert isinstance(conf["customize_glob"], OrderedDict) | [
"def",
"test_customize_glob_is_ordered",
"(",
")",
":",
"conf",
"=",
"config_util",
".",
"CORE_CONFIG_SCHEMA",
"(",
"{",
"\"customize_glob\"",
":",
"OrderedDict",
"(",
")",
"}",
")",
"assert",
"isinstance",
"(",
"conf",
"[",
"\"customize_glob\"",
"]",
",",
"Orde... | [
216,
0
] | [
219,
58
] | python | en | ['en', 'en', 'en'] | True |
test_entity_customization | (hass) | Test entity customization through configuration. | Test entity customization through configuration. | async def test_entity_customization(hass):
"""Test entity customization through configuration."""
config = {
CONF_LATITUDE: 50,
CONF_LONGITUDE: 50,
CONF_NAME: "Test",
CONF_CUSTOMIZE: {"test.test": {"hidden": True}},
}
state = await _compute_state(hass, config)
asser... | [
"async",
"def",
"test_entity_customization",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"CONF_LATITUDE",
":",
"50",
",",
"CONF_LONGITUDE",
":",
"50",
",",
"CONF_NAME",
":",
"\"Test\"",
",",
"CONF_CUSTOMIZE",
":",
"{",
"\"test.test\"",
":",
"{",
"\"hidden\"",
... | [
235,
0
] | [
246,
37
] | python | en | ['en', 'el-Latn', 'en'] | True |
test_remove_lib_on_upgrade | (mock_docker, mock_os, mock_shutil, hass) | Test removal of library on upgrade from before 0.50. | Test removal of library on upgrade from before 0.50. | def test_remove_lib_on_upgrade(mock_docker, mock_os, mock_shutil, hass):
"""Test removal of library on upgrade from before 0.50."""
ha_version = "0.49.0"
mock_os.path.isdir = mock.Mock(return_value=True)
mock_open = mock.mock_open()
with patch("homeassistant.config.open", mock_open, create=True):
... | [
"def",
"test_remove_lib_on_upgrade",
"(",
"mock_docker",
",",
"mock_os",
",",
"mock_shutil",
",",
"hass",
")",
":",
"ha_version",
"=",
"\"0.49.0\"",
"mock_os",
".",
"path",
".",
"isdir",
"=",
"mock",
".",
"Mock",
"(",
"return_value",
"=",
"True",
")",
"mock_... | [
252,
0
] | [
268,
67
] | python | en | ['en', 'en', 'en'] | True |
test_remove_lib_on_upgrade_94 | (mock_docker, mock_os, mock_shutil, hass) | Test removal of library on upgrade from before 0.94 and in Docker. | Test removal of library on upgrade from before 0.94 and in Docker. | def test_remove_lib_on_upgrade_94(mock_docker, mock_os, mock_shutil, hass):
"""Test removal of library on upgrade from before 0.94 and in Docker."""
ha_version = "0.93.0.dev0"
mock_os.path.isdir = mock.Mock(return_value=True)
mock_open = mock.mock_open()
with patch("homeassistant.config.open", mock_... | [
"def",
"test_remove_lib_on_upgrade_94",
"(",
"mock_docker",
",",
"mock_os",
",",
"mock_shutil",
",",
"hass",
")",
":",
"ha_version",
"=",
"\"0.93.0.dev0\"",
"mock_os",
".",
"path",
".",
"isdir",
"=",
"mock",
".",
"Mock",
"(",
"return_value",
"=",
"True",
")",
... | [
274,
0
] | [
290,
67
] | python | en | ['en', 'en', 'en'] | True |
test_process_config_upgrade | (hass) | Test update of version on upgrade. | Test update of version on upgrade. | def test_process_config_upgrade(hass):
"""Test update of version on upgrade."""
ha_version = "0.92.0"
mock_open = mock.mock_open()
with patch("homeassistant.config.open", mock_open, create=True), patch.object(
config_util, "__version__", "0.91.0"
):
opened_file = mock_open.return_va... | [
"def",
"test_process_config_upgrade",
"(",
"hass",
")",
":",
"ha_version",
"=",
"\"0.92.0\"",
"mock_open",
"=",
"mock",
".",
"mock_open",
"(",
")",
"with",
"patch",
"(",
"\"homeassistant.config.open\"",
",",
"mock_open",
",",
"create",
"=",
"True",
")",
",",
"... | [
293,
0
] | [
308,
65
] | python | en | ['en', 'en', 'en'] | True |
test_config_upgrade_same_version | (hass) | Test no update of version on no upgrade. | Test no update of version on no upgrade. | def test_config_upgrade_same_version(hass):
"""Test no update of version on no upgrade."""
ha_version = __version__
mock_open = mock.mock_open()
with patch("homeassistant.config.open", mock_open, create=True):
opened_file = mock_open.return_value
# pylint: disable=no-member
open... | [
"def",
"test_config_upgrade_same_version",
"(",
"hass",
")",
":",
"ha_version",
"=",
"__version__",
"mock_open",
"=",
"mock",
".",
"mock_open",
"(",
")",
"with",
"patch",
"(",
"\"homeassistant.config.open\"",
",",
"mock_open",
",",
"create",
"=",
"True",
")",
":... | [
311,
0
] | [
323,
48
] | python | en | ['en', 'de', 'en'] | True |
test_config_upgrade_no_file | (hass) | Test update of version on upgrade, with no version file. | Test update of version on upgrade, with no version file. | def test_config_upgrade_no_file(hass):
"""Test update of version on upgrade, with no version file."""
mock_open = mock.mock_open()
mock_open.side_effect = [FileNotFoundError(), mock.DEFAULT, mock.DEFAULT]
with patch("homeassistant.config.open", mock_open, create=True):
opened_file = mock_open.re... | [
"def",
"test_config_upgrade_no_file",
"(",
"hass",
")",
":",
"mock_open",
"=",
"mock",
".",
"mock_open",
"(",
")",
"mock_open",
".",
"side_effect",
"=",
"[",
"FileNotFoundError",
"(",
")",
",",
"mock",
".",
"DEFAULT",
",",
"mock",
".",
"DEFAULT",
"]",
"wit... | [
326,
0
] | [
335,
68
] | python | en | ['en', 'en', 'en'] | True |
test_loading_configuration_from_storage | (hass, hass_storage) | Test loading core config onto hass object. | Test loading core config onto hass object. | async def test_loading_configuration_from_storage(hass, hass_storage):
"""Test loading core config onto hass object."""
hass_storage["core.config"] = {
"data": {
"elevation": 10,
"latitude": 55,
"location_name": "Home",
"longitude": 13,
"time_z... | [
"async",
"def",
"test_loading_configuration_from_storage",
"(",
"hass",
",",
"hass_storage",
")",
":",
"hass_storage",
"[",
"\"core.config\"",
"]",
"=",
"{",
"\"data\"",
":",
"{",
"\"elevation\"",
":",
"10",
",",
"\"latitude\"",
":",
"55",
",",
"\"location_name\""... | [
338,
0
] | [
368,
54
] | python | en | ['en', 'en', 'en'] | True |
test_loading_configuration_from_storage_with_yaml_only | (hass, hass_storage) | Test loading core and YAML config onto hass object. | Test loading core and YAML config onto hass object. | async def test_loading_configuration_from_storage_with_yaml_only(hass, hass_storage):
"""Test loading core and YAML config onto hass object."""
hass_storage["core.config"] = {
"data": {
"elevation": 10,
"latitude": 55,
"location_name": "Home",
"longitude":... | [
"async",
"def",
"test_loading_configuration_from_storage_with_yaml_only",
"(",
"hass",
",",
"hass_storage",
")",
":",
"hass_storage",
"[",
"\"core.config\"",
"]",
"=",
"{",
"\"data\"",
":",
"{",
"\"elevation\"",
":",
"10",
",",
"\"latitude\"",
":",
"55",
",",
"\"l... | [
371,
0
] | [
398,
54
] | python | en | ['en', 'en', 'en'] | True |
test_updating_configuration | (hass, hass_storage) | Test updating configuration stores the new configuration. | Test updating configuration stores the new configuration. | async def test_updating_configuration(hass, hass_storage):
"""Test updating configuration stores the new configuration."""
core_data = {
"data": {
"elevation": 10,
"latitude": 55,
"location_name": "Home",
"longitude": 13,
"time_zone": "Europe/C... | [
"async",
"def",
"test_updating_configuration",
"(",
"hass",
",",
"hass_storage",
")",
":",
"core_data",
"=",
"{",
"\"data\"",
":",
"{",
"\"elevation\"",
":",
"10",
",",
"\"latitude\"",
":",
"55",
",",
"\"location_name\"",
":",
"\"Home\"",
",",
"\"longitude\"",
... | [
401,
0
] | [
426,
37
] | python | en | ['en', 'en', 'en'] | True |
test_override_stored_configuration | (hass, hass_storage) | Test loading core and YAML config onto hass object. | Test loading core and YAML config onto hass object. | async def test_override_stored_configuration(hass, hass_storage):
"""Test loading core and YAML config onto hass object."""
hass_storage["core.config"] = {
"data": {
"elevation": 10,
"latitude": 55,
"location_name": "Home",
"longitude": 13,
"ti... | [
"async",
"def",
"test_override_stored_configuration",
"(",
"hass",
",",
"hass_storage",
")",
":",
"hass_storage",
"[",
"\"core.config\"",
"]",
"=",
"{",
"\"data\"",
":",
"{",
"\"elevation\"",
":",
"10",
",",
"\"latitude\"",
":",
"55",
",",
"\"location_name\"",
"... | [
429,
0
] | [
455,
63
] | python | en | ['en', 'en', 'en'] | True |
test_loading_configuration | (hass) | Test loading core config onto hass object. | Test loading core config onto hass object. | async def test_loading_configuration(hass):
"""Test loading core config onto hass object."""
await config_util.async_process_ha_core_config(
hass,
{
"latitude": 60,
"longitude": 50,
"elevation": 25,
"name": "Huis",
CONF_UNIT_SYSTEM: CON... | [
"async",
"def",
"test_loading_configuration",
"(",
"hass",
")",
":",
"await",
"config_util",
".",
"async_process_ha_core_config",
"(",
"hass",
",",
"{",
"\"latitude\"",
":",
"60",
",",
"\"longitude\"",
":",
"50",
",",
"\"elevation\"",
":",
"25",
",",
"\"name\"",... | [
458,
0
] | [
490,
47
] | python | en | ['en', 'en', 'en'] | True |
test_loading_configuration_temperature_unit | (hass) | Test backward compatibility when loading core config. | Test backward compatibility when loading core config. | async def test_loading_configuration_temperature_unit(hass):
"""Test backward compatibility when loading core config."""
await config_util.async_process_ha_core_config(
hass,
{
"latitude": 60,
"longitude": 50,
"elevation": 25,
"name": "Huis",
... | [
"async",
"def",
"test_loading_configuration_temperature_unit",
"(",
"hass",
")",
":",
"await",
"config_util",
".",
"async_process_ha_core_config",
"(",
"hass",
",",
"{",
"\"latitude\"",
":",
"60",
",",
"\"longitude\"",
":",
"50",
",",
"\"elevation\"",
":",
"25",
"... | [
493,
0
] | [
517,
63
] | python | en | ['en', 'en', 'en'] | True |
test_loading_configuration_default_media_dirs_docker | (hass) | Test loading core config onto hass object. | Test loading core config onto hass object. | async def test_loading_configuration_default_media_dirs_docker(hass):
"""Test loading core config onto hass object."""
with patch("homeassistant.config.is_docker_env", return_value=True):
await config_util.async_process_ha_core_config(
hass,
{
"name": "Huis",
... | [
"async",
"def",
"test_loading_configuration_default_media_dirs_docker",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.config.is_docker_env\"",
",",
"return_value",
"=",
"True",
")",
":",
"await",
"config_util",
".",
"async_process_ha_core_config",
"(",
"ha... | [
520,
0
] | [
533,
56
] | python | en | ['en', 'en', 'en'] | True |
test_loading_configuration_from_packages | (hass) | Test loading packages config onto hass object config. | Test loading packages config onto hass object config. | async def test_loading_configuration_from_packages(hass):
"""Test loading packages config onto hass object config."""
await config_util.async_process_ha_core_config(
hass,
{
"latitude": 39,
"longitude": -1,
"elevation": 500,
"name": "Huis",
... | [
"async",
"def",
"test_loading_configuration_from_packages",
"(",
"hass",
")",
":",
"await",
"config_util",
".",
"async_process_ha_core_config",
"(",
"hass",
",",
"{",
"\"latitude\"",
":",
"39",
",",
"\"longitude\"",
":",
"-",
"1",
",",
"\"elevation\"",
":",
"500",... | [
536,
0
] | [
573,
9
] | python | en | ['en', 'en', 'en'] | True |
test_check_ha_config_file_correct | (mock_check, hass) | Check that restart propagates to stop. | Check that restart propagates to stop. | async def test_check_ha_config_file_correct(mock_check, hass):
"""Check that restart propagates to stop."""
mock_check.return_value = check_config.HomeAssistantConfig()
assert await config_util.async_check_ha_config_file(hass) is None | [
"async",
"def",
"test_check_ha_config_file_correct",
"(",
"mock_check",
",",
"hass",
")",
":",
"mock_check",
".",
"return_value",
"=",
"check_config",
".",
"HomeAssistantConfig",
"(",
")",
"assert",
"await",
"config_util",
".",
"async_check_ha_config_file",
"(",
"hass... | [
577,
0
] | [
580,
69
] | python | en | ['en', 'en', 'en'] | True |
test_check_ha_config_file_wrong | (mock_check, hass) | Check that restart with a bad config doesn't propagate to stop. | Check that restart with a bad config doesn't propagate to stop. | async def test_check_ha_config_file_wrong(mock_check, hass):
"""Check that restart with a bad config doesn't propagate to stop."""
mock_check.return_value = check_config.HomeAssistantConfig()
mock_check.return_value.add_error("bad")
assert await config_util.async_check_ha_config_file(hass) == "bad" | [
"async",
"def",
"test_check_ha_config_file_wrong",
"(",
"mock_check",
",",
"hass",
")",
":",
"mock_check",
".",
"return_value",
"=",
"check_config",
".",
"HomeAssistantConfig",
"(",
")",
"mock_check",
".",
"return_value",
".",
"add_error",
"(",
"\"bad\"",
")",
"as... | [
584,
0
] | [
589,
70
] | python | en | ['en', 'en', 'en'] | True |
test_async_hass_config_yaml_merge | (merge_log_err, hass) | Test merge during async config reload. | Test merge during async config reload. | async def test_async_hass_config_yaml_merge(merge_log_err, hass):
"""Test merge during async config reload."""
config = {
config_util.CONF_CORE: {
config_util.CONF_PACKAGES: {"pack_dict": {"input_boolean": {"ib1": None}}}
},
"input_boolean": {"ib2": None},
"light": {"... | [
"async",
"def",
"test_async_hass_config_yaml_merge",
"(",
"merge_log_err",
",",
"hass",
")",
":",
"config",
"=",
"{",
"config_util",
".",
"CONF_CORE",
":",
"{",
"config_util",
".",
"CONF_PACKAGES",
":",
"{",
"\"pack_dict\"",
":",
"{",
"\"input_boolean\"",
":",
"... | [
593,
0
] | [
611,
34
] | python | en | ['fr', 'en', 'en'] | True |
merge_log_err | (hass) | Patch _merge_log_error from packages. | Patch _merge_log_error from packages. | def merge_log_err(hass):
"""Patch _merge_log_error from packages."""
with patch("homeassistant.config._LOGGER.error") as logerr:
yield logerr | [
"def",
"merge_log_err",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.config._LOGGER.error\"",
")",
"as",
"logerr",
":",
"yield",
"logerr"
] | [
616,
0
] | [
619,
20
] | python | en | ['en', 'en', 'en'] | True |
test_merge | (merge_log_err, hass) | Test if we can merge packages. | Test if we can merge packages. | async def test_merge(merge_log_err, hass):
"""Test if we can merge packages."""
packages = {
"pack_dict": {"input_boolean": {"ib1": None}},
"pack_11": {"input_select": {"is1": None}},
"pack_list": {"light": {"platform": "test"}},
"pack_list2": {"light": [{"platform": "test"}]},
... | [
"async",
"def",
"test_merge",
"(",
"merge_log_err",
",",
"hass",
")",
":",
"packages",
"=",
"{",
"\"pack_dict\"",
":",
"{",
"\"input_boolean\"",
":",
"{",
"\"ib1\"",
":",
"None",
"}",
"}",
",",
"\"pack_11\"",
":",
"{",
"\"input_select\"",
":",
"{",
"\"is1\... | [
622,
0
] | [
643,
57
] | python | en | ['id', 'en', 'en'] | True |
test_merge_try_falsy | (merge_log_err, hass) | Ensure we don't add falsy items like empty OrderedDict() to list. | Ensure we don't add falsy items like empty OrderedDict() to list. | async def test_merge_try_falsy(merge_log_err, hass):
"""Ensure we don't add falsy items like empty OrderedDict() to list."""
packages = {
"pack_falsy_to_lst": {"automation": OrderedDict()},
"pack_list2": {"light": OrderedDict()},
}
config = {
config_util.CONF_CORE: {config_util.C... | [
"async",
"def",
"test_merge_try_falsy",
"(",
"merge_log_err",
",",
"hass",
")",
":",
"packages",
"=",
"{",
"\"pack_falsy_to_lst\"",
":",
"{",
"\"automation\"",
":",
"OrderedDict",
"(",
")",
"}",
",",
"\"pack_list2\"",
":",
"{",
"\"light\"",
":",
"OrderedDict",
... | [
646,
0
] | [
662,
36
] | python | en | ['en', 'en', 'en'] | True |
test_merge_new | (merge_log_err, hass) | Test adding new components to outer scope. | Test adding new components to outer scope. | async def test_merge_new(merge_log_err, hass):
"""Test adding new components to outer scope."""
packages = {
"pack_1": {"light": [{"platform": "one"}]},
"pack_11": {"input_select": {"ib1": None}},
"pack_2": {
"light": {"platform": "one"},
"panel_custom": {"pan1": ... | [
"async",
"def",
"test_merge_new",
"(",
"merge_log_err",
",",
"hass",
")",
":",
"packages",
"=",
"{",
"\"pack_1\"",
":",
"{",
"\"light\"",
":",
"[",
"{",
"\"platform\"",
":",
"\"one\"",
"}",
"]",
"}",
",",
"\"pack_11\"",
":",
"{",
"\"input_select\"",
":",
... | [
665,
0
] | [
683,
43
] | python | en | ['en', 'en', 'en'] | True |
test_merge_type_mismatch | (merge_log_err, hass) | Test if we have a type mismatch for packages. | Test if we have a type mismatch for packages. | async def test_merge_type_mismatch(merge_log_err, hass):
"""Test if we have a type mismatch for packages."""
packages = {
"pack_1": {"input_boolean": [{"ib1": None}]},
"pack_11": {"input_select": {"ib1": None}},
"pack_2": {"light": {"ib1": None}}, # light gets merged - ensure_list
}... | [
"async",
"def",
"test_merge_type_mismatch",
"(",
"merge_log_err",
",",
"hass",
")",
":",
"packages",
"=",
"{",
"\"pack_1\"",
":",
"{",
"\"input_boolean\"",
":",
"[",
"{",
"\"ib1\"",
":",
"None",
"}",
"]",
"}",
",",
"\"pack_11\"",
":",
"{",
"\"input_select\""... | [
686,
0
] | [
704,
36
] | python | en | ['en', 'en', 'en'] | True |
test_merge_once_only_keys | (merge_log_err, hass) | Test if we have a merge for a comp that may occur only once. Keys. | Test if we have a merge for a comp that may occur only once. Keys. | async def test_merge_once_only_keys(merge_log_err, hass):
"""Test if we have a merge for a comp that may occur only once. Keys."""
packages = {"pack_2": {"api": None}}
config = {config_util.CONF_CORE: {config_util.CONF_PACKAGES: packages}, "api": None}
await config_util.merge_packages_config(hass, confi... | [
"async",
"def",
"test_merge_once_only_keys",
"(",
"merge_log_err",
",",
"hass",
")",
":",
"packages",
"=",
"{",
"\"pack_2\"",
":",
"{",
"\"api\"",
":",
"None",
"}",
"}",
"config",
"=",
"{",
"config_util",
".",
"CONF_CORE",
":",
"{",
"config_util",
".",
"CO... | [
707,
0
] | [
729,
40
] | python | en | ['en', 'en', 'en'] | True |
test_merge_once_only_lists | (hass) | Test if we have a merge for a comp that may occur only once. Lists. | Test if we have a merge for a comp that may occur only once. Lists. | async def test_merge_once_only_lists(hass):
"""Test if we have a merge for a comp that may occur only once. Lists."""
packages = {
"pack_2": {
"api": {"list_1": ["item_2", "item_3"], "list_2": ["item_4"], "list_3": []}
}
}
config = {
config_util.CONF_CORE: {config_uti... | [
"async",
"def",
"test_merge_once_only_lists",
"(",
"hass",
")",
":",
"packages",
"=",
"{",
"\"pack_2\"",
":",
"{",
"\"api\"",
":",
"{",
"\"list_1\"",
":",
"[",
"\"item_2\"",
",",
"\"item_3\"",
"]",
",",
"\"list_2\"",
":",
"[",
"\"item_4\"",
"]",
",",
"\"li... | [
732,
0
] | [
748,
5
] | python | en | ['en', 'en', 'en'] | True |
test_merge_once_only_dictionaries | (hass) | Test if we have a merge for a comp that may occur only once. Dicts. | Test if we have a merge for a comp that may occur only once. Dicts. | async def test_merge_once_only_dictionaries(hass):
"""Test if we have a merge for a comp that may occur only once. Dicts."""
packages = {
"pack_2": {
"api": {
"dict_1": {"key_2": 2, "dict_1.1": {"key_1.2": 1.2}},
"dict_2": {"key_1": 1},
"dict_3... | [
"async",
"def",
"test_merge_once_only_dictionaries",
"(",
"hass",
")",
":",
"packages",
"=",
"{",
"\"pack_2\"",
":",
"{",
"\"api\"",
":",
"{",
"\"dict_1\"",
":",
"{",
"\"key_2\"",
":",
"2",
",",
"\"dict_1.1\"",
":",
"{",
"\"key_1.2\"",
":",
"1.2",
"}",
"}"... | [
751,
0
] | [
774,
5
] | python | en | ['en', 'en', 'en'] | True |
test_merge_id_schema | (hass) | Test if we identify the config schemas correctly. | Test if we identify the config schemas correctly. | async def test_merge_id_schema(hass):
"""Test if we identify the config schemas correctly."""
types = {
"panel_custom": "list",
"group": "dict",
"script": "dict",
"input_boolean": "dict",
"shell_command": "dict",
"qwikswitch": "dict",
}
for domain, expecte... | [
"async",
"def",
"test_merge_id_schema",
"(",
"hass",
")",
":",
"types",
"=",
"{",
"\"panel_custom\"",
":",
"\"list\"",
",",
"\"group\"",
":",
"\"dict\"",
",",
"\"script\"",
":",
"\"dict\"",
",",
"\"input_boolean\"",
":",
"\"dict\"",
",",
"\"shell_command\"",
":"... | [
777,
0
] | [
791,
84
] | python | en | ['en', 'en', 'en'] | True |
test_merge_duplicate_keys | (merge_log_err, hass) | Test if keys in dicts are duplicates. | Test if keys in dicts are duplicates. | async def test_merge_duplicate_keys(merge_log_err, hass):
"""Test if keys in dicts are duplicates."""
packages = {"pack_1": {"input_select": {"ib1": None}}}
config = {
config_util.CONF_CORE: {config_util.CONF_PACKAGES: packages},
"input_select": {"ib1": 1},
}
await config_util.merge_... | [
"async",
"def",
"test_merge_duplicate_keys",
"(",
"merge_log_err",
",",
"hass",
")",
":",
"packages",
"=",
"{",
"\"pack_1\"",
":",
"{",
"\"input_select\"",
":",
"{",
"\"ib1\"",
":",
"None",
"}",
"}",
"}",
"config",
"=",
"{",
"config_util",
".",
"CONF_CORE",
... | [
794,
0
] | [
805,
43
] | python | en | ['en', 'en', 'en'] | True |
test_merge_customize | (hass) | Test loading core config onto hass object. | Test loading core config onto hass object. | async def test_merge_customize(hass):
"""Test loading core config onto hass object."""
core_config = {
"latitude": 60,
"longitude": 50,
"elevation": 25,
"name": "Huis",
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
"time_zone": "GMT",
"customize": {"a.a": {... | [
"async",
"def",
"test_merge_customize",
"(",
"hass",
")",
":",
"core_config",
"=",
"{",
"\"latitude\"",
":",
"60",
",",
"\"longitude\"",
":",
"50",
",",
"\"elevation\"",
":",
"25",
",",
"\"name\"",
":",
"\"Huis\"",
",",
"CONF_UNIT_SYSTEM",
":",
"CONF_UNIT_SYST... | [
808,
0
] | [
824,
86
] | python | en | ['en', 'en', 'en'] | True |
test_auth_provider_config | (hass) | Test loading auth provider config onto hass object. | Test loading auth provider config onto hass object. | async def test_auth_provider_config(hass):
"""Test loading auth provider config onto hass object."""
core_config = {
"latitude": 60,
"longitude": 50,
"elevation": 25,
"name": "Huis",
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
"time_zone": "GMT",
CONF_AUT... | [
"async",
"def",
"test_auth_provider_config",
"(",
"hass",
")",
":",
"core_config",
"=",
"{",
"\"latitude\"",
":",
"60",
",",
"\"longitude\"",
":",
"50",
",",
"\"elevation\"",
":",
"25",
",",
"\"name\"",
":",
"\"Huis\"",
",",
"CONF_UNIT_SYSTEM",
":",
"CONF_UNIT... | [
827,
0
] | [
851,
55
] | python | en | ['en', 'en', 'en'] | True |
test_auth_provider_config_default | (hass) | Test loading default auth provider config. | Test loading default auth provider config. | async def test_auth_provider_config_default(hass):
"""Test loading default auth provider config."""
core_config = {
"latitude": 60,
"longitude": 50,
"elevation": 25,
"name": "Huis",
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
"time_zone": "GMT",
}
if hasa... | [
"async",
"def",
"test_auth_provider_config_default",
"(",
"hass",
")",
":",
"core_config",
"=",
"{",
"\"latitude\"",
":",
"60",
",",
"\"longitude\"",
":",
"50",
",",
"\"elevation\"",
":",
"25",
",",
"\"name\"",
":",
"\"Huis\"",
",",
"CONF_UNIT_SYSTEM",
":",
"C... | [
854,
0
] | [
871,
53
] | python | en | ['de', 'en', 'en'] | True |
test_disallowed_auth_provider_config | (hass) | Test loading insecure example auth provider is disallowed. | Test loading insecure example auth provider is disallowed. | async def test_disallowed_auth_provider_config(hass):
"""Test loading insecure example auth provider is disallowed."""
core_config = {
"latitude": 60,
"longitude": 50,
"elevation": 25,
"name": "Huis",
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
"time_zone": "GMT"... | [
"async",
"def",
"test_disallowed_auth_provider_config",
"(",
"hass",
")",
":",
"core_config",
"=",
"{",
"\"latitude\"",
":",
"60",
",",
"\"longitude\"",
":",
"50",
",",
"\"elevation\"",
":",
"25",
",",
"\"name\"",
":",
"\"Huis\"",
",",
"CONF_UNIT_SYSTEM",
":",
... | [
874,
0
] | [
897,
73
] | python | en | ['en', 'en', 'en'] | True |
test_disallowed_duplicated_auth_provider_config | (hass) | Test loading insecure example auth provider is disallowed. | Test loading insecure example auth provider is disallowed. | async def test_disallowed_duplicated_auth_provider_config(hass):
"""Test loading insecure example auth provider is disallowed."""
core_config = {
"latitude": 60,
"longitude": 50,
"elevation": 25,
"name": "Huis",
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
"time_z... | [
"async",
"def",
"test_disallowed_duplicated_auth_provider_config",
"(",
"hass",
")",
":",
"core_config",
"=",
"{",
"\"latitude\"",
":",
"60",
",",
"\"longitude\"",
":",
"50",
",",
"\"elevation\"",
":",
"25",
",",
"\"name\"",
":",
"\"Huis\"",
",",
"CONF_UNIT_SYSTEM... | [
900,
0
] | [
912,
73
] | python | en | ['en', 'en', 'en'] | True |
test_disallowed_auth_mfa_module_config | (hass) | Test loading insecure example auth mfa module is disallowed. | Test loading insecure example auth mfa module is disallowed. | async def test_disallowed_auth_mfa_module_config(hass):
"""Test loading insecure example auth mfa module is disallowed."""
core_config = {
"latitude": 60,
"longitude": 50,
"elevation": 25,
"name": "Huis",
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
"time_zone": "... | [
"async",
"def",
"test_disallowed_auth_mfa_module_config",
"(",
"hass",
")",
":",
"core_config",
"=",
"{",
"\"latitude\"",
":",
"60",
",",
"\"longitude\"",
":",
"50",
",",
"\"elevation\"",
":",
"25",
",",
"\"name\"",
":",
"\"Huis\"",
",",
"CONF_UNIT_SYSTEM",
":",... | [
915,
0
] | [
932,
73
] | python | en | ['en', 'en', 'en'] | True |
test_disallowed_duplicated_auth_mfa_module_config | (hass) | Test loading insecure example auth mfa module is disallowed. | Test loading insecure example auth mfa module is disallowed. | async def test_disallowed_duplicated_auth_mfa_module_config(hass):
"""Test loading insecure example auth mfa module is disallowed."""
core_config = {
"latitude": 60,
"longitude": 50,
"elevation": 25,
"name": "Huis",
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
"ti... | [
"async",
"def",
"test_disallowed_duplicated_auth_mfa_module_config",
"(",
"hass",
")",
":",
"core_config",
"=",
"{",
"\"latitude\"",
":",
"60",
",",
"\"longitude\"",
":",
"50",
",",
"\"elevation\"",
":",
"25",
",",
"\"name\"",
":",
"\"Huis\"",
",",
"CONF_UNIT_SYST... | [
935,
0
] | [
947,
73
] | python | en | ['en', 'en', 'en'] | True |
test_merge_split_component_definition | (hass) | Test components with trailing description in packages are merged. | Test components with trailing description in packages are merged. | async def test_merge_split_component_definition(hass):
"""Test components with trailing description in packages are merged."""
packages = {
"pack_1": {"light one": {"l1": None}},
"pack_2": {"light two": {"l2": None}, "light three": {"l3": None}},
}
config = {config_util.CONF_CORE: {confi... | [
"async",
"def",
"test_merge_split_component_definition",
"(",
"hass",
")",
":",
"packages",
"=",
"{",
"\"pack_1\"",
":",
"{",
"\"light one\"",
":",
"{",
"\"l1\"",
":",
"None",
"}",
"}",
",",
"\"pack_2\"",
":",
"{",
"\"light two\"",
":",
"{",
"\"l2\"",
":",
... | [
950,
0
] | [
962,
42
] | python | en | ['en', 'en', 'en'] | True |
test_component_config_exceptions | (hass, caplog) | Test unexpected exceptions validating component config. | Test unexpected exceptions validating component config. | async def test_component_config_exceptions(hass, caplog):
"""Test unexpected exceptions validating component config."""
# Config validator
assert (
await config_util.async_process_component_config(
hass,
{},
integration=Mock(
domain="test_domain",
... | [
"async",
"def",
"test_component_config_exceptions",
"(",
"hass",
",",
"caplog",
")",
":",
"# Config validator",
"assert",
"(",
"await",
"config_util",
".",
"async_process_component_config",
"(",
"hass",
",",
"{",
"}",
",",
"integration",
"=",
"Mock",
"(",
"domain"... | [
965,
0
] | [
1088,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_identify_config_schema | (domain, schema, expected) | Test identify config schema. | Test identify config schema. | def test_identify_config_schema(domain, schema, expected):
"""Test identify config schema."""
assert (
config_util._identify_config_schema(Mock(DOMAIN=domain, CONFIG_SCHEMA=schema))
== expected
) | [
"def",
"test_identify_config_schema",
"(",
"domain",
",",
"schema",
",",
"expected",
")",
":",
"assert",
"(",
"config_util",
".",
"_identify_config_schema",
"(",
"Mock",
"(",
"DOMAIN",
"=",
"domain",
",",
"CONFIG_SCHEMA",
"=",
"schema",
")",
")",
"==",
"expect... | [
1121,
0
] | [
1126,
5
] | python | de | ['de', 'de', 'en'] | True |
assert_tensors_close | (a, b, atol=1e-12, prefix="") | If tensors have different shapes, different values or a and b are not both tensors, raise a nice Assertion error. | If tensors have different shapes, different values or a and b are not both tensors, raise a nice Assertion error. | def assert_tensors_close(a, b, atol=1e-12, prefix=""):
"""If tensors have different shapes, different values or a and b are not both tensors, raise a nice Assertion error."""
if a is None and b is None:
return True
try:
if torch.allclose(a, b, atol=atol):
return True
rais... | [
"def",
"assert_tensors_close",
"(",
"a",
",",
"b",
",",
"atol",
"=",
"1e-12",
",",
"prefix",
"=",
"\"\"",
")",
":",
"if",
"a",
"is",
"None",
"and",
"b",
"is",
"None",
":",
"return",
"True",
"try",
":",
"if",
"torch",
".",
"allclose",
"(",
"a",
",... | [
249,
0
] | [
265,
33
] | python | en | ['en', 'en', 'en'] | True |
test_reproducing_states | (hass, caplog) | Test reproducing Automation states. | Test reproducing Automation states. | async def test_reproducing_states(hass, caplog):
"""Test reproducing Automation states."""
hass.states.async_set("automation.entity_off", "off", {})
hass.states.async_set("automation.entity_on", "on", {})
turn_on_calls = async_mock_service(hass, "automation", "turn_on")
turn_off_calls = async_mock_... | [
"async",
"def",
"test_reproducing_states",
"(",
"hass",
",",
"caplog",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"automation.entity_off\"",
",",
"\"off\"",
",",
"{",
"}",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"automation.entity_o... | [
6,
0
] | [
47,
74
] | python | en | ['en', 'en', 'en'] | True |
TestSetupImageProcessing.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() | [
"def",
"setup_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")"
] | [
20,
4
] | [
22,
45
] | python | en | ['en', 'en', 'en'] | True |
TestSetupImageProcessing.teardown_method | (self) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
24,
4
] | [
26,
24
] | python | en | ['en', 'en', 'en'] | True |
TestSetupImageProcessing.test_setup_component | (self) | Set up demo platform on image_process component. | Set up demo platform on image_process component. | def test_setup_component(self):
"""Set up demo platform on image_process component."""
config = {ip.DOMAIN: {"platform": "demo"}}
with assert_setup_component(1, ip.DOMAIN):
setup_component(self.hass, ip.DOMAIN, config) | [
"def",
"test_setup_component",
"(",
"self",
")",
":",
"config",
"=",
"{",
"ip",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
"}",
"with",
"assert_setup_component",
"(",
"1",
",",
"ip",
".",
"DOMAIN",
")",
":",
"setup_component",
"(",
"s... | [
28,
4
] | [
33,
57
] | python | en | ['en', 'da', 'en'] | True |
TestSetupImageProcessing.test_setup_component_with_service | (self) | Set up demo platform on image_process component test service. | Set up demo platform on image_process component test service. | def test_setup_component_with_service(self):
"""Set up demo platform on image_process component test service."""
config = {ip.DOMAIN: {"platform": "demo"}}
with assert_setup_component(1, ip.DOMAIN):
setup_component(self.hass, ip.DOMAIN, config)
assert self.hass.services.has... | [
"def",
"test_setup_component_with_service",
"(",
"self",
")",
":",
"config",
"=",
"{",
"ip",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
"}",
"with",
"assert_setup_component",
"(",
"1",
",",
"ip",
".",
"DOMAIN",
")",
":",
"setup_component"... | [
35,
4
] | [
42,
64
] | python | en | ['en', 'da', 'en'] | True |
TestImageProcessing.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()
setup_component(
self.hass,
http.DOMAIN,
{http.DOMAIN: {http.CONF_SERVER_PORT: get_test_instance_port()}},
)
config = {ip.DOMA... | [
"def",
"setup_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"setup_component",
"(",
"self",
".",
"hass",
",",
"http",
".",
"DOMAIN",
",",
"{",
"http",
".",
"DOMAIN",
":",
"{",
"http",
".",
"CONF_SERVER_POR... | [
48,
4
] | [
64,
96
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessing.teardown_method | (self) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
66,
4
] | [
68,
24
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessing.test_get_image_from_camera | (self, mock_camera_read) | Grab an image from camera entity. | Grab an image from camera entity. | def test_get_image_from_camera(self, mock_camera_read):
"""Grab an image from camera entity."""
common.scan(self.hass, entity_id="image_processing.test")
self.hass.block_till_done()
state = self.hass.states.get("image_processing.test")
assert mock_camera_read.called
ass... | [
"def",
"test_get_image_from_camera",
"(",
"self",
",",
"mock_camera_read",
")",
":",
"common",
".",
"scan",
"(",
"self",
".",
"hass",
",",
"entity_id",
"=",
"\"image_processing.test\"",
")",
"self",
".",
"hass",
".",
"block_till_done",
"(",
")",
"state",
"=",
... | [
74,
4
] | [
83,
51
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessing.test_get_image_without_exists_camera | (self, mock_image) | Try to get image without exists camera. | Try to get image without exists camera. | def test_get_image_without_exists_camera(self, mock_image):
"""Try to get image without exists camera."""
self.hass.states.remove("camera.demo_camera")
common.scan(self.hass, entity_id="image_processing.test")
self.hass.block_till_done()
state = self.hass.states.get("image_proc... | [
"def",
"test_get_image_without_exists_camera",
"(",
"self",
",",
"mock_image",
")",
":",
"self",
".",
"hass",
".",
"states",
".",
"remove",
"(",
"\"camera.demo_camera\"",
")",
"common",
".",
"scan",
"(",
"self",
".",
"hass",
",",
"entity_id",
"=",
"\"image_pro... | [
89,
4
] | [
99,
33
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessingAlpr.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()
config = {ip.DOMAIN: {"platform": "demo"}, "camera": {"platform": "demo"}}
with patch(
"homeassistant.components.demo.image_processing."
"DemoImag... | [
"def",
"setup_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"config",
"=",
"{",
"ip",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
",",
"\"camera\"",
":",
"{",
"\"platform\"",
":",
"\"dem... | [
105,
4
] | [
129,
77
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessingAlpr.teardown_method | (self) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
131,
4
] | [
133,
24
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessingAlpr.test_alpr_event_single_call | (self, aioclient_mock) | Set up and scan a picture and test plates from event. | Set up and scan a picture and test plates from event. | def test_alpr_event_single_call(self, aioclient_mock):
"""Set up and scan a picture and test plates from event."""
aioclient_mock.get(self.url, content=b"image")
common.scan(self.hass, entity_id="image_processing.demo_alpr")
self.hass.block_till_done()
state = self.hass.states.... | [
"def",
"test_alpr_event_single_call",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"self",
".",
"url",
",",
"content",
"=",
"b\"image\"",
")",
"common",
".",
"scan",
"(",
"self",
".",
"hass",
",",
"entity_id",
"=",
"\"im... | [
135,
4
] | [
155,
73
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessingAlpr.test_alpr_event_double_call | (self, aioclient_mock) | Set up and scan a picture and test plates from event. | Set up and scan a picture and test plates from event. | def test_alpr_event_double_call(self, aioclient_mock):
"""Set up and scan a picture and test plates from event."""
aioclient_mock.get(self.url, content=b"image")
common.scan(self.hass, entity_id="image_processing.demo_alpr")
common.scan(self.hass, entity_id="image_processing.demo_alpr")... | [
"def",
"test_alpr_event_double_call",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"self",
".",
"url",
",",
"content",
"=",
"b\"image\"",
")",
"common",
".",
"scan",
"(",
"self",
".",
"hass",
",",
"entity_id",
"=",
"\"im... | [
157,
4
] | [
178,
73
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessingAlpr.test_alpr_event_single_call_confidence | (self, confidence_mock, aioclient_mock) | Set up and scan a picture and test plates from event. | Set up and scan a picture and test plates from event. | def test_alpr_event_single_call_confidence(self, confidence_mock, aioclient_mock):
"""Set up and scan a picture and test plates from event."""
aioclient_mock.get(self.url, content=b"image")
common.scan(self.hass, entity_id="image_processing.demo_alpr")
self.hass.block_till_done()
... | [
"def",
"test_alpr_event_single_call_confidence",
"(",
"self",
",",
"confidence_mock",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"self",
".",
"url",
",",
"content",
"=",
"b\"image\"",
")",
"common",
".",
"scan",
"(",
"self",
".",
"hass... | [
185,
4
] | [
205,
73
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessingFace.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()
config = {ip.DOMAIN: {"platform": "demo"}, "camera": {"platform": "demo"}}
with patch(
"homeassistant.components.demo.image_processing."
"DemoImag... | [
"def",
"setup_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"config",
"=",
"{",
"ip",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
",",
"\"camera\"",
":",
"{",
"\"platform\"",
":",
"\"dem... | [
211,
4
] | [
235,
77
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessingFace.teardown_method | (self) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
237,
4
] | [
239,
24
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessingFace.test_face_event_call | (self, aioclient_mock) | Set up and scan a picture and test faces from event. | Set up and scan a picture and test faces from event. | def test_face_event_call(self, aioclient_mock):
"""Set up and scan a picture and test faces from event."""
aioclient_mock.get(self.url, content=b"image")
common.scan(self.hass, entity_id="image_processing.demo_face")
self.hass.block_till_done()
state = self.hass.states.get("ima... | [
"def",
"test_face_event_call",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"self",
".",
"url",
",",
"content",
"=",
"b\"image\"",
")",
"common",
".",
"scan",
"(",
"self",
".",
"hass",
",",
"entity_id",
"=",
"\"image_pro... | [
241,
4
] | [
261,
73
] | python | en | ['en', 'en', 'en'] | True |
TestImageProcessingFace.test_face_event_call_no_confidence | (self, mock_config, aioclient_mock) | Set up and scan a picture and test faces from event. | Set up and scan a picture and test faces from event. | def test_face_event_call_no_confidence(self, mock_config, aioclient_mock):
"""Set up and scan a picture and test faces from event."""
aioclient_mock.get(self.url, content=b"image")
common.scan(self.hass, entity_id="image_processing.demo_face")
self.hass.block_till_done()
state ... | [
"def",
"test_face_event_call_no_confidence",
"(",
"self",
",",
"mock_config",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"self",
".",
"url",
",",
"content",
"=",
"b\"image\"",
")",
"common",
".",
"scan",
"(",
"self",
".",
"hass",
","... | [
268,
4
] | [
288,
73
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the API streams platform. | Set up the API streams platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the API streams platform."""
entity = APICount()
async_add_entities([entity]) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"entity",
"=",
"APICount",
"(",
")",
"async_add_entities",
"(",
"[",
"entity",
"]",
")"
] | [
14,
0
] | [
18,
32
] | python | en | ['en', 'pt', 'en'] | True |
APICount.__init__ | (self) | Initialize the API count. | Initialize the API count. | def __init__(self):
"""Initialize the API count."""
self.count = 0 | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"count",
"=",
"0"
] | [
24,
4
] | [
26,
22
] | python | en | ['en', 'en', 'en'] | True |
APICount.async_added_to_hass | (self) | Added to hass. | Added to hass. | async def async_added_to_hass(self):
"""Added to hass."""
self.async_on_remove(
self.hass.helpers.dispatcher.async_dispatcher_connect(
SIGNAL_WEBSOCKET_CONNECTED, self._update_count
)
)
self.async_on_remove(
self.hass.helpers.dispatcher... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"self",
".",
"hass",
".",
"helpers",
".",
"dispatcher",
".",
"async_dispatcher_connect",
"(",
"SIGNAL_WEBSOCKET_CONNECTED",
",",
"self",
".",
"_update_count",
")",
... | [
28,
4
] | [
39,
9
] | python | en | ['en', 'en', 'en'] | True |
APICount.name | (self) | Return name of entity. | Return name of entity. | def name(self):
"""Return name of entity."""
return "Connected clients" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"\"Connected clients\""
] | [
42,
4
] | [
44,
34
] | python | en | ['en', 'ig', 'en'] | True |
APICount.state | (self) | Return current API count. | Return current API count. | def state(self):
"""Return current API count."""
return self.count | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"count"
] | [
47,
4
] | [
49,
25
] | python | en | ['en', 'la', 'en'] | True |
APICount.unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def unit_of_measurement(self):
"""Return the unit of measurement."""
return "clients" | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"\"clients\""
] | [
52,
4
] | [
54,
24
] | python | en | ['en', 'la', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Version sensor platform. | Set up the Version sensor platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Version sensor platform."""
beta = config.get(CONF_BETA)
image = config.get(CONF_IMAGE)
name = config.get(CONF_NAME)
source = config.get(CONF_SOURCE)
session = async_get_clientsession(hass)
... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"beta",
"=",
"config",
".",
"get",
"(",
"CONF_BETA",
")",
"image",
"=",
"config",
".",
"get",
"(",
"CONF_IMAGE",
")... | [
61,
0
] | [
93,
62
] | python | en | ['en', 'da', 'en'] | True |
VersionSensor.__init__ | (self, haversion, name) | Initialize the Version sensor. | Initialize the Version sensor. | def __init__(self, haversion, name):
"""Initialize the Version sensor."""
self.haversion = haversion
self._name = name
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"haversion",
",",
"name",
")",
":",
"self",
".",
"haversion",
"=",
"haversion",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_state",
"=",
"None"
] | [
99,
4
] | [
103,
26
] | python | en | ['en', 'en', 'en'] | True |
VersionSensor.async_update | (self) | Get the latest version information. | Get the latest version information. | async def async_update(self):
"""Get the latest version information."""
await self.haversion.async_update() | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"haversion",
".",
"async_update",
"(",
")"
] | [
105,
4
] | [
107,
43
] | python | en | ['en', 'en', 'en'] | True |
VersionSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
110,
4
] | [
112,
25
] | python | en | ['en', 'mi', 'en'] | True |
VersionSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self.haversion.api.version | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"haversion",
".",
"api",
".",
"version"
] | [
115,
4
] | [
117,
41
] | python | en | ['en', 'en', 'en'] | True |
VersionSensor.device_state_attributes | (self) | Return attributes for the sensor. | Return attributes for the sensor. | def device_state_attributes(self):
"""Return attributes for the sensor."""
return self.haversion.api.version_data | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"haversion",
".",
"api",
".",
"version_data"
] | [
120,
4
] | [
122,
46
] | python | en | ['en', 'no', 'en'] | True |
VersionSensor.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 ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"ICON"
] | [
125,
4
] | [
127,
19
] | python | en | ['en', 'en', 'en'] | True |
VersionData.__init__ | (self, api) | Initialize the data object. | Initialize the data object. | def __init__(self, api):
"""Initialize the data object."""
self.api = api | [
"def",
"__init__",
"(",
"self",
",",
"api",
")",
":",
"self",
".",
"api",
"=",
"api"
] | [
133,
4
] | [
135,
22
] | python | en | ['en', 'en', 'en'] | True |
VersionData.async_update | (self) | Get the latest version information. | Get the latest version information. | async def async_update(self):
"""Get the latest version information."""
await self.api.get_version() | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"api",
".",
"get_version",
"(",
")"
] | [
138,
4
] | [
140,
36
] | python | en | ['en', 'en', 'en'] | True |
track_connected | (hass) | Track connected and disconnected events. | Track connected and disconnected events. | def track_connected(hass):
"""Track connected and disconnected events."""
connected_evt = []
@callback
def track_connected():
connected_evt.append(1)
hass.helpers.dispatcher.async_dispatcher_connect(
SIGNAL_WEBSOCKET_CONNECTED, track_connected
)
disconnected_evt = []
@... | [
"def",
"track_connected",
"(",
"hass",
")",
":",
"connected_evt",
"=",
"[",
"]",
"@",
"callback",
"def",
"track_connected",
"(",
")",
":",
"connected_evt",
".",
"append",
"(",
"1",
")",
"hass",
".",
"helpers",
".",
"dispatcher",
".",
"async_dispatcher_connec... | [
23,
0
] | [
44,
73
] | python | en | ['en', 'en', 'en'] | True |
test_auth_events | (
hass, no_auth_websocket_client, legacy_auth, hass_access_token, track_connected
) | Test authenticating. | Test authenticating. | async def test_auth_events(
hass, no_auth_websocket_client, legacy_auth, hass_access_token, track_connected
):
"""Test authenticating."""
await test_auth_active_with_token(hass, no_auth_websocket_client, hass_access_token)
assert len(track_connected["connected"]) == 1
assert not track_connected["d... | [
"async",
"def",
"test_auth_events",
"(",
"hass",
",",
"no_auth_websocket_client",
",",
"legacy_auth",
",",
"hass_access_token",
",",
"track_connected",
")",
":",
"await",
"test_auth_active_with_token",
"(",
"hass",
",",
"no_auth_websocket_client",
",",
"hass_access_token"... | [
47,
0
] | [
60,
52
] | python | en | ['de', 'en', 'en'] | False |
test_auth_via_msg_incorrect_pass | (no_auth_websocket_client) | Test authenticating. | Test authenticating. | async def test_auth_via_msg_incorrect_pass(no_auth_websocket_client):
"""Test authenticating."""
with patch(
"homeassistant.components.websocket_api.auth.process_wrong_login",
return_value=mock_coro(),
) as mock_process_wrong_login:
await no_auth_websocket_client.send_json(
... | [
"async",
"def",
"test_auth_via_msg_incorrect_pass",
"(",
"no_auth_websocket_client",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.websocket_api.auth.process_wrong_login\"",
",",
"return_value",
"=",
"mock_coro",
"(",
")",
",",
")",
"as",
"mock_process_wrong_log... | [
63,
0
] | [
77,
63
] | python | en | ['de', 'en', 'en'] | False |
test_auth_events_incorrect_pass | (no_auth_websocket_client, track_connected) | Test authenticating. | Test authenticating. | async def test_auth_events_incorrect_pass(no_auth_websocket_client, track_connected):
"""Test authenticating."""
await test_auth_via_msg_incorrect_pass(no_auth_websocket_client)
assert not track_connected["connected"]
assert not track_connected["disconnected"]
await no_auth_websocket_client.close... | [
"async",
"def",
"test_auth_events_incorrect_pass",
"(",
"no_auth_websocket_client",
",",
"track_connected",
")",
":",
"await",
"test_auth_via_msg_incorrect_pass",
"(",
"no_auth_websocket_client",
")",
"assert",
"not",
"track_connected",
"[",
"\"connected\"",
"]",
"assert",
... | [
80,
0
] | [
91,
46
] | python | en | ['de', 'en', 'en'] | False |
test_pre_auth_only_auth_allowed | (no_auth_websocket_client) | Verify that before authentication, only auth messages are allowed. | Verify that before authentication, only auth messages are allowed. | async def test_pre_auth_only_auth_allowed(no_auth_websocket_client):
"""Verify that before authentication, only auth messages are allowed."""
await no_auth_websocket_client.send_json(
{
"type": "call_service",
"domain": "domain_test",
"service": "test_service",
... | [
"async",
"def",
"test_pre_auth_only_auth_allowed",
"(",
"no_auth_websocket_client",
")",
":",
"await",
"no_auth_websocket_client",
".",
"send_json",
"(",
"{",
"\"type\"",
":",
"\"call_service\"",
",",
"\"domain\"",
":",
"\"domain_test\"",
",",
"\"service\"",
":",
"\"tes... | [
94,
0
] | [
108,
74
] | python | en | ['en', 'en', 'en'] | True |
test_auth_active_with_token | (
hass, no_auth_websocket_client, hass_access_token
) | Test authenticating with a token. | Test authenticating with a token. | async def test_auth_active_with_token(
hass, no_auth_websocket_client, hass_access_token
):
"""Test authenticating with a token."""
await no_auth_websocket_client.send_json(
{"type": TYPE_AUTH, "access_token": hass_access_token}
)
auth_msg = await no_auth_websocket_client.receive_json()
... | [
"async",
"def",
"test_auth_active_with_token",
"(",
"hass",
",",
"no_auth_websocket_client",
",",
"hass_access_token",
")",
":",
"await",
"no_auth_websocket_client",
".",
"send_json",
"(",
"{",
"\"type\"",
":",
"TYPE_AUTH",
",",
"\"access_token\"",
":",
"hass_access_tok... | [
111,
0
] | [
120,
43
] | python | en | ['en', 'en', 'en'] | True |
test_auth_active_user_inactive | (hass, aiohttp_client, hass_access_token) | Test authenticating with a token. | Test authenticating with a token. | async def test_auth_active_user_inactive(hass, aiohttp_client, hass_access_token):
"""Test authenticating with a token."""
refresh_token = await hass.auth.async_validate_access_token(hass_access_token)
refresh_token.user.is_active = False
assert await async_setup_component(hass, "websocket_api", {})
... | [
"async",
"def",
"test_auth_active_user_inactive",
"(",
"hass",
",",
"aiohttp_client",
",",
"hass_access_token",
")",
":",
"refresh_token",
"=",
"await",
"hass",
".",
"auth",
".",
"async_validate_access_token",
"(",
"hass_access_token",
")",
"refresh_token",
".",
"user... | [
123,
0
] | [
139,
52
] | python | en | ['en', 'en', 'en'] | True |
test_auth_active_with_password_not_allow | (hass, aiohttp_client) | Test authenticating with a token. | Test authenticating with a token. | async def test_auth_active_with_password_not_allow(hass, aiohttp_client):
"""Test authenticating with a token."""
assert await async_setup_component(hass, "websocket_api", {})
await hass.async_block_till_done()
client = await aiohttp_client(hass.http.app)
async with client.ws_connect(URL) as ws:
... | [
"async",
"def",
"test_auth_active_with_password_not_allow",
"(",
"hass",
",",
"aiohttp_client",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"websocket_api\"",
",",
"{",
"}",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
... | [
142,
0
] | [
156,
52
] | python | en | ['en', 'en', 'en'] | True |
test_auth_legacy_support_with_password | (hass, aiohttp_client, legacy_auth) | Test authenticating with a token. | Test authenticating with a token. | async def test_auth_legacy_support_with_password(hass, aiohttp_client, legacy_auth):
"""Test authenticating with a token."""
assert await async_setup_component(hass, "websocket_api", {})
await hass.async_block_till_done()
client = await aiohttp_client(hass.http.app)
async with client.ws_connect(UR... | [
"async",
"def",
"test_auth_legacy_support_with_password",
"(",
"hass",
",",
"aiohttp_client",
",",
"legacy_auth",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"websocket_api\"",
",",
"{",
"}",
")",
"await",
"hass",
".",
"async_block_till... | [
159,
0
] | [
173,
52
] | python | en | ['en', 'en', 'en'] | True |
test_auth_with_invalid_token | (hass, aiohttp_client) | Test authenticating with a token. | Test authenticating with a token. | async def test_auth_with_invalid_token(hass, aiohttp_client):
"""Test authenticating with a token."""
assert await async_setup_component(hass, "websocket_api", {})
await hass.async_block_till_done()
client = await aiohttp_client(hass.http.app)
async with client.ws_connect(URL) as ws:
auth_... | [
"async",
"def",
"test_auth_with_invalid_token",
"(",
"hass",
",",
"aiohttp_client",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"websocket_api\"",
",",
"{",
"}",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"client",
... | [
176,
0
] | [
190,
52
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: dict) | Set up the Firmata domain. | Set up the Firmata domain. | async def async_setup(hass: HomeAssistant, config: dict) -> bool:
"""Set up the Firmata domain."""
# Delete specific entries that no longer exist in the config
if hass.config_entries.async_entries(DOMAIN):
for entry in hass.config_entries.async_entries(DOMAIN):
remove = True
... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
"->",
"bool",
":",
"# Delete specific entries that no longer exist in the config",
"if",
"hass",
".",
"config_entries",
".",
"async_entries",
"(",
"DOMAIN",
")",
":",
... | [
124,
0
] | [
156,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, config_entry: config_entries.ConfigEntry
) | Set up a Firmata board for a config entry. | Set up a Firmata board for a config entry. | async def async_setup_entry(
hass: HomeAssistant, config_entry: config_entries.ConfigEntry
) -> bool:
"""Set up a Firmata board for a config entry."""
if DOMAIN not in hass.data:
hass.data[DOMAIN] = {}
_LOGGER.debug(
"Setting up Firmata id %s, name %s, config %s",
config_entry.e... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
"->",
"bool",
":",
"if",
"DOMAIN",
"not",
"in",
"hass",
".",
"data",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
... | [
159,
0
] | [
203,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (
hass: HomeAssistant, config_entry: config_entries.ConfigEntry
) | Shutdown and close a Firmata board for a config entry. | Shutdown and close a Firmata board for a config entry. | async def async_unload_entry(
hass: HomeAssistant, config_entry: config_entries.ConfigEntry
) -> None:
"""Shutdown and close a Firmata board for a config entry."""
_LOGGER.debug("Closing Firmata board %s", config_entry.data[CONF_NAME])
unload_entries = []
for (conf, platform) in CONF_PLATFORM_MAP.i... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Closing Firmata board %s\"",
",",
"config_entry",
".",
"data",
"[",
... | [
206,
0
] | [
223,
31
] | python | en | ['en', 'en', 'en'] | True |
async_get_triggers | (hass: HomeAssistant, device_id: str) | List device triggers for Arcam FMJ Receiver control devices. | List device triggers for Arcam FMJ Receiver control devices. | async def async_get_triggers(hass: HomeAssistant, device_id: str) -> List[dict]:
"""List device triggers for Arcam FMJ Receiver control devices."""
registry = await entity_registry.async_get_registry(hass)
triggers = []
# Get all the integrations entities for this device
for entry in entity_registr... | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"List",
"[",
"dict",
"]",
":",
"registry",
"=",
"await",
"entity_registry",
".",
"async_get_registry",
"(",
"hass",
")",
"triggers",
"=",
"[",
... | [
30,
0
] | [
48,
19
] | python | en | ['da', 'en', 'en'] | True |
async_attach_trigger | (
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: dict,
) | Attach a trigger. | Attach a trigger. | async def async_attach_trigger(
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: dict,
) -> CALLBACK_TYPE:
"""Attach a trigger."""
config = TRIGGER_SCHEMA(config)
job = HassJob(action)
if config[CONF_TYPE] == "turn_on":
entity_id = config[C... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"action",
":",
"AutomationActionType",
",",
"automation_info",
":",
"dict",
",",
")",
"->",
"CALLBACK_TYPE",
":",
"config",
"=",
"TRIGGER_SCHEMA",
"... | [
51,
0
] | [
75,
23
] | python | en | ['en', 'lb', 'en'] | True |
assert_tensors_close | (a, b, atol=1e-12, prefix="") | If tensors have different shapes, different values or a and b are not both tensors, raise a nice Assertion error. | If tensors have different shapes, different values or a and b are not both tensors, raise a nice Assertion error. | def assert_tensors_close(a, b, atol=1e-12, prefix=""):
"""If tensors have different shapes, different values or a and b are not both tensors, raise a nice Assertion error."""
if a is None and b is None:
return True
try:
if torch.allclose(a, b, atol=atol):
return True
rais... | [
"def",
"assert_tensors_close",
"(",
"a",
",",
"b",
",",
"atol",
"=",
"1e-12",
",",
"prefix",
"=",
"\"\"",
")",
":",
"if",
"a",
"is",
"None",
"and",
"b",
"is",
"None",
":",
"return",
"True",
"try",
":",
"if",
"torch",
".",
"allclose",
"(",
"a",
",... | [
246,
0
] | [
262,
33
] | python | en | ['en', 'en', 'en'] | True |
get_service | (hass, config, discovery_info=None) | Get the GNTP notification service. | Get the GNTP notification service. | def get_service(hass, config, discovery_info=None):
"""Get the GNTP notification service."""
logging.getLogger("gntp").setLevel(logging.ERROR)
if config.get(CONF_APP_ICON) is None:
icon_file = os.path.join(
os.path.dirname(__file__),
"..",
"frontend",
... | [
"def",
"get_service",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"logging",
".",
"getLogger",
"(",
"\"gntp\"",
")",
".",
"setLevel",
"(",
"logging",
".",
"ERROR",
")",
"if",
"config",
".",
"get",
"(",
"CONF_APP_ICON",
")",
... | [
38,
0
] | [
62,
5
] | python | en | ['en', 'en', 'en'] | True |
GNTPNotificationService.__init__ | (self, app_name, app_icon, hostname, password, port) | Initialize the service. | Initialize the service. | def __init__(self, app_name, app_icon, hostname, password, port):
"""Initialize the service."""
self.gntp = gntp.notifier.GrowlNotifier(
applicationName=app_name,
notifications=["Notification"],
applicationIcon=app_icon,
hostname=hostname,
pass... | [
"def",
"__init__",
"(",
"self",
",",
"app_name",
",",
"app_icon",
",",
"hostname",
",",
"password",
",",
"port",
")",
":",
"self",
".",
"gntp",
"=",
"gntp",
".",
"notifier",
".",
"GrowlNotifier",
"(",
"applicationName",
"=",
"app_name",
",",
"notifications... | [
68,
4
] | [
82,
18
] | python | en | ['en', 'en', 'en'] | True |
GNTPNotificationService.send_message | (self, message="", **kwargs) | Send a message to a user. | Send a message to a user. | def send_message(self, message="", **kwargs):
"""Send a message to a user."""
self.gntp.notify(
noteType="Notification",
title=kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT),
description=message,
) | [
"def",
"send_message",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"gntp",
".",
"notify",
"(",
"noteType",
"=",
"\"Notification\"",
",",
"title",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TITLE",
",",
"ATTR_TIT... | [
84,
4
] | [
90,
9
] | python | en | ['en', 'en', 'en'] | True |
get_dataset_max_and_min | (dataset: Dataset) |
This utility function is used early on to determine the *data_max* and *data_min* parameters that are added to the
configuratron to properly create the Deep1010 mapping.
Parameters
----------
dataset: Dataset
Returns
-------
max, min
|
This utility function is used early on to determine the *data_max* and *data_min* parameters that are added to the
configuratron to properly create the Deep1010 mapping. | def get_dataset_max_and_min(dataset: Dataset):
"""
This utility function is used early on to determine the *data_max* and *data_min* parameters that are added to the
configuratron to properly create the Deep1010 mapping.
Parameters
----------
dataset: Dataset
Returns
-------
max, m... | [
"def",
"get_dataset_max_and_min",
"(",
"dataset",
":",
"Dataset",
")",
":",
"dmax",
"=",
"None",
"dmin",
"=",
"None",
"pbar",
"=",
"tqdm",
".",
"tqdm",
"(",
"dataset",
")",
"for",
"data",
"in",
"pbar",
":",
"data",
"=",
"data",
"[",
"0",
"]",
"_max",... | [
73,
0
] | [
102,
21
] | python | en | ['en', 'error', 'th'] | False |
get_largest_trial_id | (dataset: Dataset, trial_id_offset=-2) |
This utility is for determining the largest trial id from a dataset.
Parameters
----------
dataset: Dataset
trial_id_offset: int
The offset from the returned data that the trial_id value is expected (likely -1 for Raw recordings
and -2 for epoched).
Ret... |
This utility is for determining the largest trial id from a dataset. | def get_largest_trial_id(dataset: Dataset, trial_id_offset=-2):
"""
This utility is for determining the largest trial id from a dataset.
Parameters
----------
dataset: Dataset
trial_id_offset: int
The offset from the returned data that the trial_id value is expected (likely ... | [
"def",
"get_largest_trial_id",
"(",
"dataset",
":",
"Dataset",
",",
"trial_id_offset",
"=",
"-",
"2",
")",
":",
"old_return_trial_id",
"=",
"dataset",
".",
"return_trial_id",
"dataset",
".",
"update_id_returns",
"(",
"trial",
"=",
"True",
")",
"max_trial_id",
"=... | [
105,
0
] | [
132,
23
] | python | en | ['en', 'error', 'th'] | False |
MultiDatasetContainer.__init__ | (self, *datasets, oversample=False, return_dataset_ids=False, max_artificial_size=None) |
This integrates the loading of multiple datasets, and facilitates over-sampling smaller ones to prevent larger
datasets from crowding smaller ones.
Parameters
----------
datasets :
A number of datasets to select from.
oversample : bool
... |
This integrates the loading of multiple datasets, and facilitates over-sampling smaller ones to prevent larger
datasets from crowding smaller ones. | def __init__(self, *datasets, oversample=False, return_dataset_ids=False, max_artificial_size=None):
"""
This integrates the loading of multiple datasets, and facilitates over-sampling smaller ones to prevent larger
datasets from crowding smaller ones.
Parameters
----------
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"datasets",
",",
"oversample",
"=",
"False",
",",
"return_dataset_ids",
"=",
"False",
",",
"max_artificial_size",
"=",
"None",
")",
":",
"self",
".",
"datasets",
"=",
"datasets",
"self",
".",
"return_dataset_ids",
"=... | [
7,
4
] | [
49,
61
] | python | en | ['en', 'error', 'th'] | False |
SingleStatisticSpanRejection.__init__ | (self, dataset, mask_ind=-1, stat_fn=_trial_stdev, **dataloader_kwargs) |
With larger datasets, it may be prudent to triage the data based on global statistics. Here spans of time are
rejected based on a provided statistic (default stdev) by creating a report readable by the :any:`Configuratron`
Parameters
----------
dataset
mask_ind
... |
With larger datasets, it may be prudent to triage the data based on global statistics. Here spans of time are
rejected based on a provided statistic (default stdev) by creating a report readable by the :any:`Configuratron` | def __init__(self, dataset, mask_ind=-1, stat_fn=_trial_stdev, **dataloader_kwargs):
"""
With larger datasets, it may be prudent to triage the data based on global statistics. Here spans of time are
rejected based on a provided statistic (default stdev) by creating a report readable by the :any:... | [
"def",
"__init__",
"(",
"self",
",",
"dataset",
",",
"mask_ind",
"=",
"-",
"1",
",",
"stat_fn",
"=",
"_trial_stdev",
",",
"*",
"*",
"dataloader_kwargs",
")",
":",
"assert",
"callable",
"(",
"stat_fn",
")",
"self",
".",
"stat_fn",
"=",
"stat_fn",
"self",
... | [
141,
4
] | [
162,
20
] | python | en | ['en', 'error', 'th'] | False |
SingleStatisticSpanRejection.keep_window | (self, low=None, high=None) |
Rejects any statistics that lie outside the specified windown limits of low and high. If one is not specified,
one side of the window is ignored.
Parameters
----------
low : float, None
The lowest acceptable stat value. If None, no low threshold.
high: flo... |
Rejects any statistics that lie outside the specified windown limits of low and high. If one is not specified,
one side of the window is ignored. | def keep_window(self, low=None, high=None):
"""
Rejects any statistics that lie outside the specified windown limits of low and high. If one is not specified,
one side of the window is ignored.
Parameters
----------
low : float, None
The lowest acceptable s... | [
"def",
"keep_window",
"(",
"self",
",",
"low",
"=",
"None",
",",
"high",
"=",
"None",
")",
":",
"if",
"low",
"is",
"None",
"and",
"high",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"One of 'low' or 'high' needs to be specified.\"",
")",
"stats",
"=",
... | [
265,
4
] | [
292,
29
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.