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_pairing | (hass, mock_tv_pairable, mock_setup_entry) | Test we get the form. | Test we get the form. | async def test_pairing(hass, mock_tv_pairable, mock_setup_entry):
"""Test we get the form."""
mock_tv = mock_tv_pairable
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["errors"] =... | [
"async",
"def",
"test_pairing",
"(",
"hass",
",",
"mock_tv_pairable",
",",
"mock_setup_entry",
")",
":",
"mock_tv",
"=",
"mock_tv_pairable",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"... | [
123,
0
] | [
162,
48
] | python | en | ['en', 'en', 'en'] | True |
test_pair_request_failed | (hass, mock_tv_pairable, mock_setup_entry) | Test we get the form. | Test we get the form. | async def test_pair_request_failed(hass, mock_tv_pairable, mock_setup_entry):
"""Test we get the form."""
mock_tv = mock_tv_pairable
mock_tv.pairRequest.side_effect = PairingFailure({})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
... | [
"async",
"def",
"test_pair_request_failed",
"(",
"hass",
",",
"mock_tv_pairable",
",",
"mock_setup_entry",
")",
":",
"mock_tv",
"=",
"mock_tv_pairable",
"mock_tv",
".",
"pairRequest",
".",
"side_effect",
"=",
"PairingFailure",
"(",
"{",
"}",
")",
"result",
"=",
... | [
165,
0
] | [
187,
5
] | python | en | ['en', 'en', 'en'] | True |
test_pair_grant_failed | (hass, mock_tv_pairable, mock_setup_entry) | Test we get the form. | Test we get the form. | async def test_pair_grant_failed(hass, mock_tv_pairable, mock_setup_entry):
"""Test we get the form."""
mock_tv = mock_tv_pairable
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["... | [
"async",
"def",
"test_pair_grant_failed",
"(",
"hass",
",",
"mock_tv_pairable",
",",
"mock_setup_entry",
")",
":",
"mock_tv",
"=",
"mock_tv_pairable",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"con... | [
190,
0
] | [
231,
5
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow | (hass) | Test config flow options. | Test config flow options. | async def test_options_flow(hass):
"""Test config flow options."""
config_entry = MockConfigEntry(
domain=DOMAIN,
unique_id="123456",
data=MOCK_CONFIG_PAIRED,
)
config_entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.... | [
"async",
"def",
"test_options_flow",
"(",
"hass",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"\"123456\"",
",",
"data",
"=",
"MOCK_CONFIG_PAIRED",
",",
")",
"config_entry",
".",
"add_to_hass",
"(",
"h... | [
234,
0
] | [
256,
60
] | python | en | ['en', 'fr', 'en'] | True |
GmFruit.openapi_types | () |
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
|
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
lazy... | [
"def",
"openapi_types",
"(",
")",
":",
"lazy_import",
"(",
")",
"return",
"{",
"'color'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"'cultivar'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"'origin'",
":",
"(",
"str",
",",
")",
",",
"# noq... | [
81,
4
] | [
96,
9
] | python | en | ['en', 'error', 'th'] | False |
GmFruit.__init__ | (self, *args, **kwargs) | GmFruit - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defa... | GmFruit - a model defined in OpenAPI | def __init__(self, *args, **kwargs): # noqa: E501
"""GmFruit - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_naming",
"=",
"kwargs",
".",
"pop",
"(",
"'_spec_property... | [
123,
4
] | [
214,
46
] | python | en | ['en', 'en', 'en'] | True |
SetEnvVar | (env_var, value) | Sets the env variable to 'value'; unsets it when 'value' is None. | Sets the env variable to 'value'; unsets it when 'value' is None. | def SetEnvVar(env_var, value):
"""Sets the env variable to 'value'; unsets it when 'value' is None."""
if value is not None:
os.environ[env_var] = value
elif env_var in os.environ:
del os.environ[env_var] | [
"def",
"SetEnvVar",
"(",
"env_var",
",",
"value",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"os",
".",
"environ",
"[",
"env_var",
"]",
"=",
"value",
"elif",
"env_var",
"in",
"os",
".",
"environ",
":",
"del",
"os",
".",
"environ",
"[",
"env... | [
43,
0
] | [
49,
27
] | python | en | ['en', 'en', 'en'] | True |
UsesColor | (term, color_env_var, color_flag) | Runs googletest-color-test_ and returns its exit code. | Runs googletest-color-test_ and returns its exit code. | def UsesColor(term, color_env_var, color_flag):
"""Runs googletest-color-test_ and returns its exit code."""
SetEnvVar('TERM', term)
SetEnvVar(COLOR_ENV_VAR, color_env_var)
if color_flag is None:
args = []
else:
args = ['--%s=%s' % (COLOR_FLAG, color_flag)]
p = gtest_test_utils.Subprocess([COMMAND... | [
"def",
"UsesColor",
"(",
"term",
",",
"color_env_var",
",",
"color_flag",
")",
":",
"SetEnvVar",
"(",
"'TERM'",
",",
"term",
")",
"SetEnvVar",
"(",
"COLOR_ENV_VAR",
",",
"color_env_var",
")",
"if",
"color_flag",
"is",
"None",
":",
"args",
"=",
"[",
"]",
... | [
52,
0
] | [
63,
36
] | python | en | ['en', 'en', 'en'] | True |
GTestColorTest.testNoEnvVarNoFlag | (self) | Tests the case when there's neither GTEST_COLOR nor --gtest_color. | Tests the case when there's neither GTEST_COLOR nor --gtest_color. | def testNoEnvVarNoFlag(self):
"""Tests the case when there's neither GTEST_COLOR nor --gtest_color."""
if not IS_WINDOWS:
self.assert_(not UsesColor('dumb', None, None))
self.assert_(not UsesColor('emacs', None, None))
self.assert_(not UsesColor('xterm-mono', None, None))
self.assert_(n... | [
"def",
"testNoEnvVarNoFlag",
"(",
"self",
")",
":",
"if",
"not",
"IS_WINDOWS",
":",
"self",
".",
"assert_",
"(",
"not",
"UsesColor",
"(",
"'dumb'",
",",
"None",
",",
"None",
")",
")",
"self",
".",
"assert_",
"(",
"not",
"UsesColor",
"(",
"'emacs'",
","... | [
67,
2
] | [
80,
57
] | python | en | ['en', 'en', 'en'] | True |
GTestColorTest.testFlagOnly | (self) | Tests the case when there's --gtest_color but not GTEST_COLOR. | Tests the case when there's --gtest_color but not GTEST_COLOR. | def testFlagOnly(self):
"""Tests the case when there's --gtest_color but not GTEST_COLOR."""
self.assert_(not UsesColor('dumb', None, 'no'))
self.assert_(not UsesColor('xterm-color', None, 'no'))
if not IS_WINDOWS:
self.assert_(not UsesColor('emacs', None, 'auto'))
self.assert_(UsesColor('xte... | [
"def",
"testFlagOnly",
"(",
"self",
")",
":",
"self",
".",
"assert_",
"(",
"not",
"UsesColor",
"(",
"'dumb'",
",",
"None",
",",
"'no'",
")",
")",
"self",
".",
"assert_",
"(",
"not",
"UsesColor",
"(",
"'xterm-color'",
",",
"None",
",",
"'no'",
")",
")... | [
82,
2
] | [
91,
49
] | python | en | ['en', 'en', 'en'] | True |
GTestColorTest.testEnvVarOnly | (self) | Tests the case when there's GTEST_COLOR but not --gtest_color. | Tests the case when there's GTEST_COLOR but not --gtest_color. | def testEnvVarOnly(self):
"""Tests the case when there's GTEST_COLOR but not --gtest_color."""
self.assert_(not UsesColor('dumb', 'no', None))
self.assert_(not UsesColor('xterm-color', 'no', None))
if not IS_WINDOWS:
self.assert_(not UsesColor('dumb', 'auto', None))
self.assert_(UsesColor('xt... | [
"def",
"testEnvVarOnly",
"(",
"self",
")",
":",
"self",
".",
"assert_",
"(",
"not",
"UsesColor",
"(",
"'dumb'",
",",
"'no'",
",",
"None",
")",
")",
"self",
".",
"assert_",
"(",
"not",
"UsesColor",
"(",
"'xterm-color'",
",",
"'no'",
",",
"None",
")",
... | [
93,
2
] | [
102,
55
] | python | en | ['en', 'en', 'en'] | True |
GTestColorTest.testEnvVarAndFlag | (self) | Tests the case when there are both GTEST_COLOR and --gtest_color. | Tests the case when there are both GTEST_COLOR and --gtest_color. | def testEnvVarAndFlag(self):
"""Tests the case when there are both GTEST_COLOR and --gtest_color."""
self.assert_(not UsesColor('xterm-color', 'no', 'no'))
self.assert_(UsesColor('dumb', 'no', 'yes'))
self.assert_(UsesColor('xterm-color', 'no', 'auto')) | [
"def",
"testEnvVarAndFlag",
"(",
"self",
")",
":",
"self",
".",
"assert_",
"(",
"not",
"UsesColor",
"(",
"'xterm-color'",
",",
"'no'",
",",
"'no'",
")",
")",
"self",
".",
"assert_",
"(",
"UsesColor",
"(",
"'dumb'",
",",
"'no'",
",",
"'yes'",
")",
")",
... | [
104,
2
] | [
109,
56
] | python | en | ['en', 'en', 'en'] | True |
GTestColorTest.testAliasesOfYesAndNo | (self) | Tests using aliases in specifying --gtest_color. | Tests using aliases in specifying --gtest_color. | def testAliasesOfYesAndNo(self):
"""Tests using aliases in specifying --gtest_color."""
self.assert_(UsesColor('dumb', None, 'true'))
self.assert_(UsesColor('dumb', None, 'YES'))
self.assert_(UsesColor('dumb', None, 'T'))
self.assert_(UsesColor('dumb', None, '1'))
self.assert_(not UsesColor('x... | [
"def",
"testAliasesOfYesAndNo",
"(",
"self",
")",
":",
"self",
".",
"assert_",
"(",
"UsesColor",
"(",
"'dumb'",
",",
"None",
",",
"'true'",
")",
")",
"self",
".",
"assert_",
"(",
"UsesColor",
"(",
"'dumb'",
",",
"None",
",",
"'YES'",
")",
")",
"self",
... | [
111,
2
] | [
122,
57
] | python | en | ['en', 'en', 'en'] | True |
test_methods | (hass) | Test if methods call the services as expected. | Test if methods call the services as expected. | async def test_methods(hass):
"""Test if methods call the services as expected."""
# Test is_on
hass.states.async_set("light.test", STATE_ON)
assert light.is_on(hass, "light.test")
hass.states.async_set("light.test", STATE_OFF)
assert not light.is_on(hass, "light.test")
# Test turn_on
... | [
"async",
"def",
"test_methods",
"(",
"hass",
")",
":",
"# Test is_on",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.test\"",
",",
"STATE_ON",
")",
"assert",
"light",
".",
"is_on",
"(",
"hass",
",",
"\"light.test\"",
")",
"hass",
".",
"states",
".... | [
26,
0
] | [
105,
63
] | python | en | ['en', 'en', 'en'] | True |
test_services | (hass, mock_light_profiles, enable_custom_integrations) | Test the provided services. | Test the provided services. | async def test_services(hass, mock_light_profiles, enable_custom_integrations):
"""Test the provided services."""
platform = getattr(hass.components, "test.light")
platform.init()
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await has... | [
"async",
"def",
"test_services",
"(",
"hass",
",",
"mock_light_profiles",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
")",
"assert",
"await",
... | [
108,
0
] | [
438,
21
] | python | en | ['en', 'en', 'en'] | True |
test_light_profiles | (
hass,
mock_light_profiles,
profile_name,
expected_data,
last_call,
enable_custom_integrations,
) | Test light profiles. | Test light profiles. | async def test_light_profiles(
hass,
mock_light_profiles,
profile_name,
expected_data,
last_call,
enable_custom_integrations,
):
"""Test light profiles."""
platform = getattr(hass.components, "test.light")
platform.init()
profile_mock_data = {
"test": (0.4, 0.6, 100, 0),... | [
"async",
"def",
"test_light_profiles",
"(",
"hass",
",",
"mock_light_profiles",
",",
"profile_name",
",",
"expected_data",
",",
"last_call",
",",
"enable_custom_integrations",
",",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.... | [
508,
0
] | [
557,
32
] | python | en | ['en', 'zh', 'en'] | True |
test_default_profiles_group | (
hass, mock_light_profiles, enable_custom_integrations
) | Test default turn-on light profile for all lights. | Test default turn-on light profile for all lights. | async def test_default_profiles_group(
hass, mock_light_profiles, enable_custom_integrations
):
"""Test default turn-on light profile for all lights."""
platform = getattr(hass.components, "test.light")
platform.init()
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {... | [
"async",
"def",
"test_default_profiles_group",
"(",
"hass",
",",
"mock_light_profiles",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
")",
"assert"... | [
560,
0
] | [
587,
5
] | python | en | ['en', 'da', 'en'] | True |
test_default_profiles_light | (
hass,
mock_light_profiles,
extra_call_params,
enable_custom_integrations,
expected_params_state_was_off,
expected_params_state_was_on,
) | Test default turn-on light profile for a specific light. | Test default turn-on light profile for a specific light. | async def test_default_profiles_light(
hass,
mock_light_profiles,
extra_call_params,
enable_custom_integrations,
expected_params_state_was_off,
expected_params_state_was_on,
):
"""Test default turn-on light profile for a specific light."""
platform = getattr(hass.components, "test.light"... | [
"async",
"def",
"test_default_profiles_light",
"(",
"hass",
",",
"mock_light_profiles",
",",
"extra_call_params",
",",
"enable_custom_integrations",
",",
"expected_params_state_was_off",
",",
"expected_params_state_was_on",
",",
")",
":",
"platform",
"=",
"getattr",
"(",
... | [
660,
0
] | [
723,
5
] | python | en | ['en', 'en', 'en'] | True |
test_light_context | (hass, hass_admin_user, enable_custom_integrations) | Test that light context works. | Test that light context works. | async def test_light_context(hass, hass_admin_user, enable_custom_integrations):
"""Test that light context works."""
platform = getattr(hass.components, "test.light")
platform.init()
assert await async_setup_component(hass, "light", {"light": {"platform": "test"}})
await hass.async_block_till_done(... | [
"async",
"def",
"test_light_context",
"(",
"hass",
",",
"hass_admin_user",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
")",
"assert",
"await",
... | [
726,
0
] | [
747,
55
] | python | en | ['en', 'en', 'en'] | True |
test_light_turn_on_auth | (hass, hass_admin_user, enable_custom_integrations) | Test that light context works. | Test that light context works. | async def test_light_turn_on_auth(hass, hass_admin_user, enable_custom_integrations):
"""Test that light context works."""
platform = getattr(hass.components, "test.light")
platform.init()
assert await async_setup_component(hass, "light", {"light": {"platform": "test"}})
await hass.async_block_till_... | [
"async",
"def",
"test_light_turn_on_auth",
"(",
"hass",
",",
"hass_admin_user",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
")",
"assert",
"awa... | [
750,
0
] | [
769,
9
] | python | en | ['en', 'en', 'en'] | True |
test_light_brightness_step | (hass, enable_custom_integrations) | Test that light context works. | Test that light context works. | async def test_light_brightness_step(hass, enable_custom_integrations):
"""Test that light context works."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("Test_0", STATE_ON))
platform.ENTITIES.append(platform.MockLight("Test_... | [
"async",
"def",
"test_light_brightness_step",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
... | [
772,
0
] | [
831,
33
] | python | en | ['en', 'en', 'en'] | True |
test_light_brightness_pct_conversion | (hass, enable_custom_integrations) | Test that light brightness percent conversion. | Test that light brightness percent conversion. | async def test_light_brightness_pct_conversion(hass, enable_custom_integrations):
"""Test that light brightness percent conversion."""
platform = getattr(hass.components, "test.light")
platform.init()
entity = platform.ENTITIES[0]
entity.supported_features = light.SUPPORT_BRIGHTNESS
entity.brigh... | [
"async",
"def",
"test_light_brightness_pct_conversion",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
")",
"entity",
"=",
"platform",
... | [
834,
0
] | [
896,
36
] | python | en | ['en', 'yi', 'en'] | True |
test_deprecated_base_class | (caplog) | Test deprecated base class. | Test deprecated base class. | def test_deprecated_base_class(caplog):
"""Test deprecated base class."""
class CustomLight(light.Light):
pass
CustomLight()
assert "Light is deprecated, modify CustomLight" in caplog.text | [
"def",
"test_deprecated_base_class",
"(",
"caplog",
")",
":",
"class",
"CustomLight",
"(",
"light",
".",
"Light",
")",
":",
"pass",
"CustomLight",
"(",
")",
"assert",
"\"Light is deprecated, modify CustomLight\"",
"in",
"caplog",
".",
"text"
] | [
899,
0
] | [
906,
67
] | python | en | ['en', 'en', 'en'] | True |
test_profiles | (hass) | Test profiles loading. | Test profiles loading. | async def test_profiles(hass):
"""Test profiles loading."""
profiles = orig_Profiles(hass)
await profiles.async_initialize()
assert profiles.data == {
"concentrate": light.Profile("concentrate", 0.5119, 0.4147, 219, None),
"energize": light.Profile("energize", 0.368, 0.3686, 203, None),
... | [
"async",
"def",
"test_profiles",
"(",
"hass",
")",
":",
"profiles",
"=",
"orig_Profiles",
"(",
"hass",
")",
"await",
"profiles",
".",
"async_initialize",
"(",
")",
"assert",
"profiles",
".",
"data",
"==",
"{",
"\"concentrate\"",
":",
"light",
".",
"Profile",... | [
909,
0
] | [
922,
62
] | python | en | ['fr', 'ja', 'en'] | False |
test_profile_load_optional_hs_color | (hass) | Test profile loading with profiles containing no xy color. | Test profile loading with profiles containing no xy color. | async def test_profile_load_optional_hs_color(hass):
"""Test profile loading with profiles containing no xy color."""
csv_file = """the first line is skipped
no_color,,,100,1
no_color_no_transition,,,110
color,0.5119,0.4147,120,2
color_no_transition,0.4448,0.4066,130
color_and_brightness,0.4448,0.4066,170,
onl... | [
"async",
"def",
"test_profile_load_optional_hs_color",
"(",
"hass",
")",
":",
"csv_file",
"=",
"\"\"\"the first line is skipped\nno_color,,,100,1\nno_color_no_transition,,,110\ncolor,0.5119,0.4147,120,2\ncolor_no_transition,0.4448,0.4066,130\ncolor_and_brightness,0.4448,0.4066,170,\nonly_brightnes... | [
926,
0
] | [
995,
56
] | python | en | ['en', 'en', 'en'] | True |
test_light_backwards_compatibility_supported_color_modes | (
hass, light_state, enable_custom_integrations
) | Test supported_color_modes if not implemented by the entity. | Test supported_color_modes if not implemented by the entity. | async def test_light_backwards_compatibility_supported_color_modes(
hass, light_state, enable_custom_integrations
):
"""Test supported_color_modes if not implemented by the entity."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockL... | [
"async",
"def",
"test_light_backwards_compatibility_supported_color_modes",
"(",
"hass",
",",
"light_state",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"... | [
999,
0
] | [
1103,
73
] | python | en | ['en', 'en', 'en'] | True |
test_light_backwards_compatibility_color_mode | (
hass, enable_custom_integrations
) | Test color_mode if not implemented by the entity. | Test color_mode if not implemented by the entity. | async def test_light_backwards_compatibility_color_mode(
hass, enable_custom_integrations
):
"""Test color_mode if not implemented by the entity."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("Test_0", STATE_ON))
platf... | [
"async",
"def",
"test_light_backwards_compatibility_color_mode",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
"... | [
1106,
0
] | [
1184,
64
] | python | en | ['en', 'en', 'en'] | True |
test_light_service_call_rgbw | (hass, enable_custom_integrations) | Test backwards compatibility for rgbw functionality in service calls. | Test backwards compatibility for rgbw functionality in service calls. | async def test_light_service_call_rgbw(hass, enable_custom_integrations):
"""Test backwards compatibility for rgbw functionality in service calls."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("Test_legacy_white_value", STATE_... | [
"async",
"def",
"test_light_service_call_rgbw",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",... | [
1187,
0
] | [
1229,
70
] | python | en | ['en', 'en', 'en'] | True |
test_light_state_rgbw | (hass, enable_custom_integrations) | Test rgbw color conversion in state updates. | Test rgbw color conversion in state updates. | async def test_light_state_rgbw(hass, enable_custom_integrations):
"""Test rgbw color conversion in state updates."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("Test_legacy_white_value", STATE_ON))
platform.ENTITIES.appen... | [
"async",
"def",
"test_light_state_rgbw",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
".",... | [
1232,
0
] | [
1287,
5
] | python | en | ['en', 'en', 'en'] | True |
test_light_state_rgbww | (hass, enable_custom_integrations) | Test rgbww color conversion in state updates. | Test rgbww color conversion in state updates. | async def test_light_state_rgbww(hass, enable_custom_integrations):
"""Test rgbww color conversion in state updates."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("Test_rgbww", STATE_ON))
entity0 = platform.ENTITIES[0]
... | [
"async",
"def",
"test_light_state_rgbww",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platform",
"."... | [
1290,
0
] | [
1320,
5
] | python | en | ['en', 'en', 'en'] | True |
test_light_service_call_color_conversion | (hass, enable_custom_integrations) | Test color conversion in service calls. | Test color conversion in service calls. | async def test_light_service_call_color_conversion(hass, enable_custom_integrations):
"""Test color conversion in service calls."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("Test_hs", STATE_ON))
platform.ENTITIES.append(... | [
"async",
"def",
"test_light_service_call_color_conversion",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
... | [
1323,
0
] | [
1588,
77
] | python | en | ['en', 'it', 'en'] | True |
test_light_service_call_color_temp_emulation | (
hass, enable_custom_integrations
) | Test color conversion in service calls. | Test color conversion in service calls. | async def test_light_service_call_color_temp_emulation(
hass, enable_custom_integrations
):
"""Test color conversion in service calls."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("Test_hs_ct", STATE_ON))
platform.ENT... | [
"async",
"def",
"test_light_service_call_color_temp_emulation",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")... | [
1591,
0
] | [
1648,
68
] | python | en | ['en', 'it', 'en'] | True |
test_light_service_call_white_mode | (hass, enable_custom_integrations) | Test color_mode white in service calls. | Test color_mode white in service calls. | async def test_light_service_call_white_mode(hass, enable_custom_integrations):
"""Test color_mode white in service calls."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("Test_white", STATE_ON))
entity0 = platform.ENTITIES[... | [
"async",
"def",
"test_light_service_call_white_mode",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"plat... | [
1651,
0
] | [
1730,
21
] | python | en | ['en', 'en', 'en'] | True |
test_light_state_color_conversion | (hass, enable_custom_integrations) | Test color conversion in state updates. | Test color conversion in state updates. | async def test_light_state_color_conversion(hass, enable_custom_integrations):
"""Test color conversion in state updates."""
platform = getattr(hass.components, "test.light")
platform.init(empty=True)
platform.ENTITIES.append(platform.MockLight("Test_hs", STATE_ON))
platform.ENTITIES.append(platfor... | [
"async",
"def",
"test_light_state_color_conversion",
"(",
"hass",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
"empty",
"=",
"True",
")",
"platf... | [
1733,
0
] | [
1793,
56
] | python | en | ['en', 'en', 'en'] | True |
test_services_filter_parameters | (
hass, mock_light_profiles, enable_custom_integrations
) | Test turn_on and turn_off filters unsupported parameters. | Test turn_on and turn_off filters unsupported parameters. | async def test_services_filter_parameters(
hass, mock_light_profiles, enable_custom_integrations
):
"""Test turn_on and turn_off filters unsupported parameters."""
platform = getattr(hass.components, "test.light")
platform.init()
assert await async_setup_component(
hass, light.DOMAIN, {ligh... | [
"async",
"def",
"test_services_filter_parameters",
"(",
"hass",
",",
"mock_light_profiles",
",",
"enable_custom_integrations",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"\"test.light\"",
")",
"platform",
".",
"init",
"(",
")",
"ass... | [
1796,
0
] | [
1947,
21
] | python | en | ['en', 'en', 'en'] | True |
test_valid_supported_color_modes | () | Test valid_supported_color_modes. | Test valid_supported_color_modes. | def test_valid_supported_color_modes():
"""Test valid_supported_color_modes."""
supported = {light.COLOR_MODE_HS}
assert light.valid_supported_color_modes(supported) == supported
# Supported color modes must not be empty
supported = set()
with pytest.raises(vol.Error):
light.valid_suppo... | [
"def",
"test_valid_supported_color_modes",
"(",
")",
":",
"supported",
"=",
"{",
"light",
".",
"COLOR_MODE_HS",
"}",
"assert",
"light",
".",
"valid_supported_color_modes",
"(",
"supported",
")",
"==",
"supported",
"# Supported color modes must not be empty",
"supported",
... | [
1950,
0
] | [
1986,
52
] | python | en | ['en', 'en', 'en'] | False |
test_default_setup | (hass, aioclient_mock) | Test the default setup. | Test the default setup. | async def test_default_setup(hass, aioclient_mock):
"""Test the default setup."""
aioclient_mock.get(
re.compile("api.foobot.io/v2/owner/.*"),
text=load_fixture("foobot_devices.json"),
)
aioclient_mock.get(
re.compile("api.foobot.io/v2/device/.*"), text=load_fixture("foobot_data.... | [
"async",
"def",
"test_default_setup",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"re",
".",
"compile",
"(",
"\"api.foobot.io/v2/owner/.*\"",
")",
",",
"text",
"=",
"load_fixture",
"(",
"\"foobot_devices.json\"",
")",
",",
")... | [
31,
0
] | [
55,
70
] | python | en | ['en', 'da', 'en'] | True |
test_setup_timeout_error | (hass, aioclient_mock) | Expected failures caused by a timeout in API response. | Expected failures caused by a timeout in API response. | async def test_setup_timeout_error(hass, aioclient_mock):
"""Expected failures caused by a timeout in API response."""
fake_async_add_entities = MagicMock()
aioclient_mock.get(
re.compile("api.foobot.io/v2/owner/.*"), exc=asyncio.TimeoutError()
)
with pytest.raises(PlatformNotReady):
... | [
"async",
"def",
"test_setup_timeout_error",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"fake_async_add_entities",
"=",
"MagicMock",
"(",
")",
"aioclient_mock",
".",
"get",
"(",
"re",
".",
"compile",
"(",
"\"api.foobot.io/v2/owner/.*\"",
")",
",",
"exc",
"=",
... | [
58,
0
] | [
68,
9
] | python | en | ['en', 'en', 'en'] | True |
test_setup_permanent_error | (hass, aioclient_mock) | Expected failures caused by permanent errors in API response. | Expected failures caused by permanent errors in API response. | async def test_setup_permanent_error(hass, aioclient_mock):
"""Expected failures caused by permanent errors in API response."""
fake_async_add_entities = MagicMock()
errors = [400, 401, HTTP_FORBIDDEN]
for error in errors:
aioclient_mock.get(re.compile("api.foobot.io/v2/owner/.*"), status=error... | [
"async",
"def",
"test_setup_permanent_error",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"fake_async_add_entities",
"=",
"MagicMock",
"(",
")",
"errors",
"=",
"[",
"400",
",",
"401",
",",
"HTTP_FORBIDDEN",
"]",
"for",
"error",
"in",
"errors",
":",
"aioclien... | [
71,
0
] | [
81,
29
] | python | en | ['en', 'en', 'en'] | True |
test_setup_temporary_error | (hass, aioclient_mock) | Expected failures caused by temporary errors in API response. | Expected failures caused by temporary errors in API response. | async def test_setup_temporary_error(hass, aioclient_mock):
"""Expected failures caused by temporary errors in API response."""
fake_async_add_entities = MagicMock()
errors = [429, HTTP_INTERNAL_SERVER_ERROR]
for error in errors:
aioclient_mock.get(re.compile("api.foobot.io/v2/owner/.*"), statu... | [
"async",
"def",
"test_setup_temporary_error",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"fake_async_add_entities",
"=",
"MagicMock",
"(",
")",
"errors",
"=",
"[",
"429",
",",
"HTTP_INTERNAL_SERVER_ERROR",
"]",
"for",
"error",
"in",
"errors",
":",
"aioclient_mo... | [
84,
0
] | [
94,
13
] | python | en | ['en', 'en', 'en'] | True |
test_mapping_integrity | () | Test ensures the map dicts have proper integrity. | Test ensures the map dicts have proper integrity. | async def test_mapping_integrity():
"""Test ensures the map dicts have proper integrity."""
# Ensure every CAPABILITY_TO_ATTRIB key is in CAPABILITIES
# Ensure every CAPABILITY_TO_ATTRIB value is in ATTRIB_TO_CLASS keys
for capability, attrib in binary_sensor.CAPABILITY_TO_ATTRIB.items():
assert... | [
"async",
"def",
"test_mapping_integrity",
"(",
")",
":",
"# Ensure every CAPABILITY_TO_ATTRIB key is in CAPABILITIES",
"# Ensure every CAPABILITY_TO_ATTRIB value is in ATTRIB_TO_CLASS keys",
"for",
"capability",
",",
"attrib",
"in",
"binary_sensor",
".",
"CAPABILITY_TO_ATTRIB",
".",
... | [
22,
0
] | [
33,
59
] | python | en | ['en', 'en', 'en'] | True |
test_entity_state | (hass, device_factory) | Tests the state attributes properly match the light types. | Tests the state attributes properly match the light types. | async def test_entity_state(hass, device_factory):
"""Tests the state attributes properly match the light types."""
device = device_factory(
"Motion Sensor 1", [Capability.motion_sensor], {Attribute.motion: "inactive"}
)
await setup_platform(hass, BINARY_SENSOR_DOMAIN, devices=[device])
stat... | [
"async",
"def",
"test_entity_state",
"(",
"hass",
",",
"device_factory",
")",
":",
"device",
"=",
"device_factory",
"(",
"\"Motion Sensor 1\"",
",",
"[",
"Capability",
".",
"motion_sensor",
"]",
",",
"{",
"Attribute",
".",
"motion",
":",
"\"inactive\"",
"}",
"... | [
36,
0
] | [
44,
87
] | python | en | ['en', 'en', 'en'] | True |
test_entity_and_device_attributes | (hass, device_factory) | Test the attributes of the entity are correct. | Test the attributes of the entity are correct. | async def test_entity_and_device_attributes(hass, device_factory):
"""Test the attributes of the entity are correct."""
# Arrange
device = device_factory(
"Motion Sensor 1", [Capability.motion_sensor], {Attribute.motion: "inactive"}
)
entity_registry = er.async_get(hass)
device_registry ... | [
"async",
"def",
"test_entity_and_device_attributes",
"(",
"hass",
",",
"device_factory",
")",
":",
"# Arrange",
"device",
"=",
"device_factory",
"(",
"\"Motion Sensor 1\"",
",",
"[",
"Capability",
".",
"motion_sensor",
"]",
",",
"{",
"Attribute",
".",
"motion",
":... | [
47,
0
] | [
65,
46
] | python | en | ['en', 'en', 'en'] | True |
test_update_from_signal | (hass, device_factory) | Test the binary_sensor updates when receiving a signal. | Test the binary_sensor updates when receiving a signal. | async def test_update_from_signal(hass, device_factory):
"""Test the binary_sensor updates when receiving a signal."""
# Arrange
device = device_factory(
"Motion Sensor 1", [Capability.motion_sensor], {Attribute.motion: "inactive"}
)
await setup_platform(hass, BINARY_SENSOR_DOMAIN, devices=[... | [
"async",
"def",
"test_update_from_signal",
"(",
"hass",
",",
"device_factory",
")",
":",
"# Arrange",
"device",
"=",
"device_factory",
"(",
"\"Motion Sensor 1\"",
",",
"[",
"Capability",
".",
"motion_sensor",
"]",
",",
"{",
"Attribute",
".",
"motion",
":",
"\"in... | [
68,
0
] | [
84,
30
] | python | en | ['en', 'lb', 'en'] | True |
test_unload_config_entry | (hass, device_factory) | Test the binary_sensor is removed when the config entry is unloaded. | Test the binary_sensor is removed when the config entry is unloaded. | async def test_unload_config_entry(hass, device_factory):
"""Test the binary_sensor is removed when the config entry is unloaded."""
# Arrange
device = device_factory(
"Motion Sensor 1", [Capability.motion_sensor], {Attribute.motion: "inactive"}
)
config_entry = await setup_platform(hass, BI... | [
"async",
"def",
"test_unload_config_entry",
"(",
"hass",
",",
"device_factory",
")",
":",
"# Arrange",
"device",
"=",
"device_factory",
"(",
"\"Motion Sensor 1\"",
",",
"[",
"Capability",
".",
"motion_sensor",
"]",
",",
"{",
"Attribute",
".",
"motion",
":",
"\"i... | [
87,
0
] | [
101,
5
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_user | (self, user_input=None) | Handle a flow initialized by the user. | Handle a flow initialized by the user. | async def async_step_user(self, user_input=None):
"""Handle a flow initialized by the user."""
errors = {}
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
if user_input is not None:
try:
srp_client = S... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"self",
".",
"_async_current_entries",
"(",
")",
":",
"return",
"self",
".",
"async_abort",
"(",
"reason",
"=",
"\"single_instance_allowe... | [
27,
4
] | [
60,
9
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_import | (self, import_config) | Import from config. | Import from config. | async def async_step_import(self, import_config):
"""Import from config."""
# Validate config values
return await self.async_step_user(user_input=import_config) | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"import_config",
")",
":",
"# Validate config values",
"return",
"await",
"self",
".",
"async_step_user",
"(",
"user_input",
"=",
"import_config",
")"
] | [
62,
4
] | [
65,
67
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
) | Set up MQTT alarm control panel through configuration.yaml. | Set up MQTT alarm control panel through configuration.yaml. | async def async_setup_platform(
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
):
"""Set up MQTT alarm control panel through configuration.yaml."""
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
await _async_setup_entity(hass, async_add_entities, config) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"await",
"async_setup_reload_service",
"(",
"hass",
",",
"DOMAIN",
",",
"PLATFORMS... | [
103,
0
] | [
108,
63
] | python | en | ['en', 'ja', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up MQTT alarm control panel dynamically through MQTT discovery. | Set up MQTT alarm control panel dynamically through MQTT discovery. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up MQTT alarm control panel dynamically through MQTT discovery."""
setup = functools.partial(
_async_setup_entity, hass, async_add_entities, config_entry=config_entry
)
await async_setup_entry_helper(hass, alarm.DOMAIN, ... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"setup",
"=",
"functools",
".",
"partial",
"(",
"_async_setup_entity",
",",
"hass",
",",
"async_add_entities",
",",
"config_entry",
"=",
"config_entry",
")"... | [
111,
0
] | [
116,
78
] | python | en | ['en', 'en', 'en'] | True |
_async_setup_entity | (
hass, async_add_entities, config, config_entry=None, discovery_data=None
) | Set up the MQTT Alarm Control Panel platform. | Set up the MQTT Alarm Control Panel platform. | async def _async_setup_entity(
hass, async_add_entities, config, config_entry=None, discovery_data=None
):
"""Set up the MQTT Alarm Control Panel platform."""
async_add_entities([MqttAlarm(hass, config, config_entry, discovery_data)]) | [
"async",
"def",
"_async_setup_entity",
"(",
"hass",
",",
"async_add_entities",
",",
"config",
",",
"config_entry",
"=",
"None",
",",
"discovery_data",
"=",
"None",
")",
":",
"async_add_entities",
"(",
"[",
"MqttAlarm",
"(",
"hass",
",",
"config",
",",
"config_... | [
119,
0
] | [
123,
79
] | python | en | ['en', 'ca', 'en'] | True |
MqttAlarm.__init__ | (self, hass, config, config_entry, discovery_data) | Init the MQTT Alarm Control Panel. | Init the MQTT Alarm Control Panel. | def __init__(self, hass, config, config_entry, discovery_data):
"""Init the MQTT Alarm Control Panel."""
self._state = None
MqttEntity.__init__(self, hass, config, config_entry, discovery_data) | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"config",
",",
"config_entry",
",",
"discovery_data",
")",
":",
"self",
".",
"_state",
"=",
"None",
"MqttEntity",
".",
"__init__",
"(",
"self",
",",
"hass",
",",
"config",
",",
"config_entry",
",",
"disco... | [
131,
4
] | [
135,
77
] | python | en | ['en', 'ca', 'en'] | True |
MqttAlarm.config_schema | () | Return the config schema. | Return the config schema. | def config_schema():
"""Return the config schema."""
return PLATFORM_SCHEMA | [
"def",
"config_schema",
"(",
")",
":",
"return",
"PLATFORM_SCHEMA"
] | [
138,
4
] | [
140,
30
] | python | en | ['en', 'de', 'en'] | True |
MqttAlarm._subscribe_topics | (self) | (Re)Subscribe to topics. | (Re)Subscribe to topics. | async def _subscribe_topics(self):
"""(Re)Subscribe to topics."""
@callback
@log_messages(self.hass, self.entity_id)
def message_received(msg):
"""Run when new MQTT message has been received."""
payload = msg.payload
value_template = self._config.get(... | [
"async",
"def",
"_subscribe_topics",
"(",
"self",
")",
":",
"@",
"callback",
"@",
"log_messages",
"(",
"self",
".",
"hass",
",",
"self",
".",
"entity_id",
")",
"def",
"message_received",
"(",
"msg",
")",
":",
"\"\"\"Run when new MQTT message has been received.\"\"... | [
149,
4
] | [
189,
9
] | python | en | ['en', 'en', 'en'] | True |
MqttAlarm.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
192,
4
] | [
194,
26
] | python | en | ['en', 'en', 'en'] | True |
MqttAlarm.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self) -> int:
"""Return the list of supported features."""
return (
SUPPORT_ALARM_ARM_HOME
| SUPPORT_ALARM_ARM_AWAY
| SUPPORT_ALARM_ARM_NIGHT
| SUPPORT_ALARM_ARM_VACATION
| SUPPORT_ALARM_ARM_CUSTOM_BYPASS
) | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"(",
"SUPPORT_ALARM_ARM_HOME",
"|",
"SUPPORT_ALARM_ARM_AWAY",
"|",
"SUPPORT_ALARM_ARM_NIGHT",
"|",
"SUPPORT_ALARM_ARM_VACATION",
"|",
"SUPPORT_ALARM_ARM_CUSTOM_BYPASS",
")"
] | [
197,
4
] | [
205,
9
] | python | en | ['en', 'en', 'en'] | True |
MqttAlarm.code_format | (self) | Return one or more digits/characters. | Return one or more digits/characters. | def code_format(self):
"""Return one or more digits/characters."""
code = self._config.get(CONF_CODE)
if code is None:
return None
if isinstance(code, str) and re.search("^\\d+$", code):
return alarm.FORMAT_NUMBER
return alarm.FORMAT_TEXT | [
"def",
"code_format",
"(",
"self",
")",
":",
"code",
"=",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_CODE",
")",
"if",
"code",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"code",
",",
"str",
")",
"and",
"re",
".",
"search",
"(... | [
208,
4
] | [
215,
32
] | python | en | ['en', 'en', 'en'] | True |
MqttAlarm.code_arm_required | (self) | Whether the code is required for arm actions. | Whether the code is required for arm actions. | def code_arm_required(self):
"""Whether the code is required for arm actions."""
code_required = self._config.get(CONF_CODE_ARM_REQUIRED)
return code_required | [
"def",
"code_arm_required",
"(",
"self",
")",
":",
"code_required",
"=",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_CODE_ARM_REQUIRED",
")",
"return",
"code_required"
] | [
218,
4
] | [
221,
28
] | python | en | ['en', 'en', 'en'] | True |
MqttAlarm.async_alarm_disarm | (self, code=None) | Send disarm command.
This method is a coroutine.
| Send disarm command. | async def async_alarm_disarm(self, code=None):
"""Send disarm command.
This method is a coroutine.
"""
code_required = self._config[CONF_CODE_DISARM_REQUIRED]
if code_required and not self._validate_code(code, "disarming"):
return
payload = self._config[CONF_... | [
"async",
"def",
"async_alarm_disarm",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"code_required",
"=",
"self",
".",
"_config",
"[",
"CONF_CODE_DISARM_REQUIRED",
"]",
"if",
"code_required",
"and",
"not",
"self",
".",
"_validate_code",
"(",
"code",
",",
... | [
223,
4
] | [
232,
36
] | python | en | ['en', 'pt', 'en'] | True |
MqttAlarm.async_alarm_arm_home | (self, code=None) | Send arm home command.
This method is a coroutine.
| Send arm home command. | async def async_alarm_arm_home(self, code=None):
"""Send arm home command.
This method is a coroutine.
"""
code_required = self._config[CONF_CODE_ARM_REQUIRED]
if code_required and not self._validate_code(code, "arming home"):
return
action = self._config[CON... | [
"async",
"def",
"async_alarm_arm_home",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"code_required",
"=",
"self",
".",
"_config",
"[",
"CONF_CODE_ARM_REQUIRED",
"]",
"if",
"code_required",
"and",
"not",
"self",
".",
"_validate_code",
"(",
"code",
",",
"... | [
234,
4
] | [
243,
35
] | python | en | ['en', 'pt', 'en'] | True |
MqttAlarm.async_alarm_arm_away | (self, code=None) | Send arm away command.
This method is a coroutine.
| Send arm away command. | async def async_alarm_arm_away(self, code=None):
"""Send arm away command.
This method is a coroutine.
"""
code_required = self._config[CONF_CODE_ARM_REQUIRED]
if code_required and not self._validate_code(code, "arming away"):
return
action = self._config[CON... | [
"async",
"def",
"async_alarm_arm_away",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"code_required",
"=",
"self",
".",
"_config",
"[",
"CONF_CODE_ARM_REQUIRED",
"]",
"if",
"code_required",
"and",
"not",
"self",
".",
"_validate_code",
"(",
"code",
",",
"... | [
245,
4
] | [
254,
35
] | python | en | ['en', 'en', 'en'] | True |
MqttAlarm.async_alarm_arm_night | (self, code=None) | Send arm night command.
This method is a coroutine.
| Send arm night command. | async def async_alarm_arm_night(self, code=None):
"""Send arm night command.
This method is a coroutine.
"""
code_required = self._config[CONF_CODE_ARM_REQUIRED]
if code_required and not self._validate_code(code, "arming night"):
return
action = self._config[... | [
"async",
"def",
"async_alarm_arm_night",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"code_required",
"=",
"self",
".",
"_config",
"[",
"CONF_CODE_ARM_REQUIRED",
"]",
"if",
"code_required",
"and",
"not",
"self",
".",
"_validate_code",
"(",
"code",
",",
... | [
256,
4
] | [
265,
35
] | python | en | ['en', 'zh', 'en'] | True |
MqttAlarm.async_alarm_arm_vacation | (self, code=None) | Send arm vacation command.
This method is a coroutine.
| Send arm vacation command. | async def async_alarm_arm_vacation(self, code=None):
"""Send arm vacation command.
This method is a coroutine.
"""
code_required = self._config[CONF_CODE_ARM_REQUIRED]
if code_required and not self._validate_code(code, "arming vacation"):
return
action = self... | [
"async",
"def",
"async_alarm_arm_vacation",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"code_required",
"=",
"self",
".",
"_config",
"[",
"CONF_CODE_ARM_REQUIRED",
"]",
"if",
"code_required",
"and",
"not",
"self",
".",
"_validate_code",
"(",
"code",
",",... | [
267,
4
] | [
276,
35
] | python | en | ['en', 'en', 'en'] | True |
MqttAlarm.async_alarm_arm_custom_bypass | (self, code=None) | Send arm custom bypass command.
This method is a coroutine.
| Send arm custom bypass command. | async def async_alarm_arm_custom_bypass(self, code=None):
"""Send arm custom bypass command.
This method is a coroutine.
"""
code_required = self._config[CONF_CODE_ARM_REQUIRED]
if code_required and not self._validate_code(code, "arming custom bypass"):
return
... | [
"async",
"def",
"async_alarm_arm_custom_bypass",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"code_required",
"=",
"self",
".",
"_config",
"[",
"CONF_CODE_ARM_REQUIRED",
"]",
"if",
"code_required",
"and",
"not",
"self",
".",
"_validate_code",
"(",
"code",
... | [
278,
4
] | [
287,
35
] | python | en | ['en', 'ga', 'en'] | True |
MqttAlarm._publish | (self, code, action) | Publish via mqtt. | Publish via mqtt. | def _publish(self, code, action):
"""Publish via mqtt."""
command_template = self._config[CONF_COMMAND_TEMPLATE]
values = {"action": action, "code": code}
payload = command_template.async_render(**values, parse_result=False)
mqtt.async_publish(
self.hass,
... | [
"def",
"_publish",
"(",
"self",
",",
"code",
",",
"action",
")",
":",
"command_template",
"=",
"self",
".",
"_config",
"[",
"CONF_COMMAND_TEMPLATE",
"]",
"values",
"=",
"{",
"\"action\"",
":",
"action",
",",
"\"code\"",
":",
"code",
"}",
"payload",
"=",
... | [
289,
4
] | [
300,
9
] | python | ca | ['sv', 'ca', 'it'] | False |
MqttAlarm._validate_code | (self, code, state) | Validate given code. | Validate given code. | def _validate_code(self, code, state):
"""Validate given code."""
conf_code = self._config.get(CONF_CODE)
check = conf_code is None or code == conf_code
if not check:
_LOGGER.warning("Wrong code entered for %s", state)
return check | [
"def",
"_validate_code",
"(",
"self",
",",
"code",
",",
"state",
")",
":",
"conf_code",
"=",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_CODE",
")",
"check",
"=",
"conf_code",
"is",
"None",
"or",
"code",
"==",
"conf_code",
"if",
"not",
"check",
":",... | [
302,
4
] | [
308,
20
] | python | en | ['en', 'en', 'en'] | True |
RESTResponse.getheaders | (self) | Returns a CIMultiDictProxy of the response headers. | Returns a CIMultiDictProxy of the response headers. | def getheaders(self):
"""Returns a CIMultiDictProxy of the response headers."""
return self.tornado_response.headers | [
"def",
"getheaders",
"(",
"self",
")",
":",
"return",
"self",
".",
"tornado_response",
".",
"headers"
] | [
41,
4
] | [
43,
44
] | python | en | ['en', 'en', 'en'] | True |
RESTResponse.getheader | (self, name, default=None) | Returns a given response header. | Returns a given response header. | def getheader(self, name, default=None):
"""Returns a given response header."""
return self.tornado_response.headers.get(name, default) | [
"def",
"getheader",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"return",
"self",
".",
"tornado_response",
".",
"headers",
".",
"get",
"(",
"name",
",",
"default",
")"
] | [
45,
4
] | [
47,
63
] | python | en | ['en', 'en', 'en'] | True |
RESTClientObject.request | (self, method, url, query_params=None, headers=None, body=None,
post_params=None, _preload_content=True,
_request_timeout=None) | Execute Request
:param method: http request method
:param url: http request url
:param query_params: query parameters in the url
:param headers: http request headers
:param body: request json body, for `application/json`
:param post_params: request post parameters,
... | Execute Request | def request(self, method, url, query_params=None, headers=None, body=None,
post_params=None, _preload_content=True,
_request_timeout=None):
"""Execute Request
:param method: http request method
:param url: http request url
:param query_params: query param... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"url",
",",
"query_params",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"body",
"=",
"None",
",",
"post_params",
"=",
"None",
",",
"_preload_content",
"=",
"True",
",",
"_request_timeout",
"=",
"None"... | [
69,
4
] | [
152,
35
] | python | en | ['en', 'en', 'en'] | False |
is_on | (hass, entity_id) | Return if the script is on based on the statemachine. | Return if the script is on based on the statemachine. | def is_on(hass, entity_id):
"""Return if the script is on based on the statemachine."""
return hass.states.is_state(entity_id, STATE_ON) | [
"def",
"is_on",
"(",
"hass",
",",
"entity_id",
")",
":",
"return",
"hass",
".",
"states",
".",
"is_state",
"(",
"entity_id",
",",
"STATE_ON",
")"
] | [
70,
0
] | [
72,
52
] | python | en | ['en', 'en', 'en'] | True |
scripts_with_entity | (hass: HomeAssistant, entity_id: str) | Return all scripts that reference the entity. | Return all scripts that reference the entity. | def scripts_with_entity(hass: HomeAssistant, entity_id: str) -> list[str]:
"""Return all scripts that reference the entity."""
if DOMAIN not in hass.data:
return []
component = hass.data[DOMAIN]
return [
script_entity.entity_id
for script_entity in component.entities
if... | [
"def",
"scripts_with_entity",
"(",
"hass",
":",
"HomeAssistant",
",",
"entity_id",
":",
"str",
")",
"->",
"list",
"[",
"str",
"]",
":",
"if",
"DOMAIN",
"not",
"in",
"hass",
".",
"data",
":",
"return",
"[",
"]",
"component",
"=",
"hass",
".",
"data",
... | [
76,
0
] | [
87,
5
] | python | en | ['en', 'en', 'en'] | True |
entities_in_script | (hass: HomeAssistant, entity_id: str) | Return all entities in script. | Return all entities in script. | def entities_in_script(hass: HomeAssistant, entity_id: str) -> list[str]:
"""Return all entities in script."""
if DOMAIN not in hass.data:
return []
component = hass.data[DOMAIN]
script_entity = component.get_entity(entity_id)
if script_entity is None:
return []
return list(s... | [
"def",
"entities_in_script",
"(",
"hass",
":",
"HomeAssistant",
",",
"entity_id",
":",
"str",
")",
"->",
"list",
"[",
"str",
"]",
":",
"if",
"DOMAIN",
"not",
"in",
"hass",
".",
"data",
":",
"return",
"[",
"]",
"component",
"=",
"hass",
".",
"data",
"... | [
91,
0
] | [
103,
57
] | python | en | ['en', 'fy', 'en'] | True |
scripts_with_device | (hass: HomeAssistant, device_id: str) | Return all scripts that reference the device. | Return all scripts that reference the device. | def scripts_with_device(hass: HomeAssistant, device_id: str) -> list[str]:
"""Return all scripts that reference the device."""
if DOMAIN not in hass.data:
return []
component = hass.data[DOMAIN]
return [
script_entity.entity_id
for script_entity in component.entities
if... | [
"def",
"scripts_with_device",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"list",
"[",
"str",
"]",
":",
"if",
"DOMAIN",
"not",
"in",
"hass",
".",
"data",
":",
"return",
"[",
"]",
"component",
"=",
"hass",
".",
"data",
... | [
107,
0
] | [
118,
5
] | python | en | ['en', 'en', 'en'] | True |
devices_in_script | (hass: HomeAssistant, entity_id: str) | Return all devices in script. | Return all devices in script. | def devices_in_script(hass: HomeAssistant, entity_id: str) -> list[str]:
"""Return all devices in script."""
if DOMAIN not in hass.data:
return []
component = hass.data[DOMAIN]
script_entity = component.get_entity(entity_id)
if script_entity is None:
return []
return list(scr... | [
"def",
"devices_in_script",
"(",
"hass",
":",
"HomeAssistant",
",",
"entity_id",
":",
"str",
")",
"->",
"list",
"[",
"str",
"]",
":",
"if",
"DOMAIN",
"not",
"in",
"hass",
".",
"data",
":",
"return",
"[",
"]",
"component",
"=",
"hass",
".",
"data",
"[... | [
122,
0
] | [
134,
56
] | python | en | ['en', 'en', 'en'] | True |
scripts_with_area | (hass: HomeAssistant, area_id: str) | Return all scripts that reference the area. | Return all scripts that reference the area. | def scripts_with_area(hass: HomeAssistant, area_id: str) -> list[str]:
"""Return all scripts that reference the area."""
if DOMAIN not in hass.data:
return []
component = hass.data[DOMAIN]
return [
script_entity.entity_id
for script_entity in component.entities
if area_... | [
"def",
"scripts_with_area",
"(",
"hass",
":",
"HomeAssistant",
",",
"area_id",
":",
"str",
")",
"->",
"list",
"[",
"str",
"]",
":",
"if",
"DOMAIN",
"not",
"in",
"hass",
".",
"data",
":",
"return",
"[",
"]",
"component",
"=",
"hass",
".",
"data",
"[",... | [
138,
0
] | [
149,
5
] | python | en | ['en', 'en', 'en'] | True |
areas_in_script | (hass: HomeAssistant, entity_id: str) | Return all areas in a script. | Return all areas in a script. | def areas_in_script(hass: HomeAssistant, entity_id: str) -> list[str]:
"""Return all areas in a script."""
if DOMAIN not in hass.data:
return []
component = hass.data[DOMAIN]
script_entity = component.get_entity(entity_id)
if script_entity is None:
return []
return list(scrip... | [
"def",
"areas_in_script",
"(",
"hass",
":",
"HomeAssistant",
",",
"entity_id",
":",
"str",
")",
"->",
"list",
"[",
"str",
"]",
":",
"if",
"DOMAIN",
"not",
"in",
"hass",
".",
"data",
":",
"return",
"[",
"]",
"component",
"=",
"hass",
".",
"data",
"[",... | [
153,
0
] | [
165,
54
] | python | en | ['en', 'co', 'en'] | True |
async_setup | (hass, config) | Load the scripts from the configuration. | Load the scripts from the configuration. | async def async_setup(hass, config):
"""Load the scripts from the configuration."""
hass.data[DOMAIN] = component = EntityComponent(LOGGER, DOMAIN, hass)
# To register scripts as valid domain for Blueprint
async_get_blueprints(hass)
if not await _async_process_config(hass, config, component):
... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"component",
"=",
"EntityComponent",
"(",
"LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"# To register scripts as valid domain for Blueprint",
"async_... | [
168,
0
] | [
227,
15
] | python | en | ['en', 'en', 'en'] | True |
_async_process_config | (hass, config, component) | Process script configuration.
Return true, if Blueprints were used.
| Process script configuration. | async def _async_process_config(hass, config, component) -> bool:
"""Process script configuration.
Return true, if Blueprints were used.
"""
entities = []
blueprints_used = False
for config_key in extract_domain_configs(config, DOMAIN):
conf: dict[str, dict[str, Any] | BlueprintInputs]... | [
"async",
"def",
"_async_process_config",
"(",
"hass",
",",
"config",
",",
"component",
")",
"->",
"bool",
":",
"entities",
"=",
"[",
"]",
"blueprints_used",
"=",
"False",
"for",
"config_key",
"in",
"extract_domain_configs",
"(",
"config",
",",
"DOMAIN",
")",
... | [
230,
0
] | [
297,
26
] | python | en | ['en', 'fr', 'en'] | True |
ScriptEntity.__init__ | (self, hass, object_id, cfg, raw_config, blueprint_inputs) | Initialize the script. | Initialize the script. | def __init__(self, hass, object_id, cfg, raw_config, blueprint_inputs):
"""Initialize the script."""
self.object_id = object_id
self.icon = cfg.get(CONF_ICON)
self.description = cfg[CONF_DESCRIPTION]
self.fields = cfg[CONF_FIELDS]
self.entity_id = ENTITY_ID_FORMAT.format... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"object_id",
",",
"cfg",
",",
"raw_config",
",",
"blueprint_inputs",
")",
":",
"self",
".",
"object_id",
"=",
"object_id",
"self",
".",
"icon",
"=",
"cfg",
".",
"get",
"(",
"CONF_ICON",
")",
"self",
"."... | [
305,
4
] | [
329,
49
] | python | en | ['en', 'co', 'en'] | True |
ScriptEntity.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
332,
4
] | [
334,
20
] | python | en | ['en', 'en', 'en'] | True |
ScriptEntity.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self):
"""Return the name of the entity."""
return self.script.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"script",
".",
"name"
] | [
337,
4
] | [
339,
31
] | python | en | ['en', 'en', 'en'] | True |
ScriptEntity.extra_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def extra_state_attributes(self):
"""Return the state attributes."""
attrs = {
ATTR_LAST_TRIGGERED: self.script.last_triggered,
ATTR_MODE: self.script.script_mode,
ATTR_CUR: self.script.runs,
}
if self.script.supports_max:
attrs[ATTR_MAX] =... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"attrs",
"=",
"{",
"ATTR_LAST_TRIGGERED",
":",
"self",
".",
"script",
".",
"last_triggered",
",",
"ATTR_MODE",
":",
"self",
".",
"script",
".",
"script_mode",
",",
"ATTR_CUR",
":",
"self",
".",
"script"... | [
342,
4
] | [
353,
20
] | python | en | ['en', 'en', 'en'] | True |
ScriptEntity.is_on | (self) | Return true if script is on. | Return true if script is on. | def is_on(self):
"""Return true if script is on."""
return self.script.is_running | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"script",
".",
"is_running"
] | [
356,
4
] | [
358,
37
] | python | en | ['en', 'fy', 'en'] | True |
ScriptEntity.async_change_listener | (self) | Update state. | Update state. | def async_change_listener(self):
"""Update state."""
self.async_write_ha_state()
self._changed.set() | [
"def",
"async_change_listener",
"(",
"self",
")",
":",
"self",
".",
"async_write_ha_state",
"(",
")",
"self",
".",
"_changed",
".",
"set",
"(",
")"
] | [
361,
4
] | [
364,
27
] | python | en | ['en', 'co', 'en'] | False |
ScriptEntity.async_turn_on | (self, **kwargs) | Run the script.
Depending on the script's run mode, this may do nothing, restart the script or
fire an additional parallel run.
| Run the script. | async def async_turn_on(self, **kwargs):
"""Run the script.
Depending on the script's run mode, this may do nothing, restart the script or
fire an additional parallel run.
"""
variables = kwargs.get("variables")
context = kwargs.get("context")
wait = kwargs.get("... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"variables",
"=",
"kwargs",
".",
"get",
"(",
"\"variables\"",
")",
"context",
"=",
"kwargs",
".",
"get",
"(",
"\"context\"",
")",
"wait",
"=",
"kwargs",
".",
"get",
"(",
... | [
366,
4
] | [
391,
34
] | python | en | ['en', 'co', 'en'] | True |
ScriptEntity.async_turn_off | (self, **kwargs) | Stop running the script.
If multiple runs are in progress, all will be stopped.
| Stop running the script. | async def async_turn_off(self, **kwargs):
"""Stop running the script.
If multiple runs are in progress, all will be stopped.
"""
await self.script.async_stop() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"script",
".",
"async_stop",
"(",
")"
] | [
412,
4
] | [
417,
38
] | python | en | ['en', 'nl', 'en'] | True |
ScriptEntity.async_added_to_hass | (self) | Restore last triggered on startup. | Restore last triggered on startup. | async def async_added_to_hass(self) -> None:
"""Restore last triggered on startup."""
if state := await self.async_get_last_state():
if last_triggered := state.attributes.get("last_triggered"):
self.script.last_triggered = parse_datetime(last_triggered) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"if",
"state",
":=",
"await",
"self",
".",
"async_get_last_state",
"(",
")",
":",
"if",
"last_triggered",
":=",
"state",
".",
"attributes",
".",
"get",
"(",
"\"last_triggered\"",
")"... | [
419,
4
] | [
423,
75
] | python | en | ['en', 'en', 'en'] | True |
ScriptEntity.async_will_remove_from_hass | (self) | Stop script and remove service when it will be removed from Home Assistant. | Stop script and remove service when it will be removed from Home Assistant. | async def async_will_remove_from_hass(self):
"""Stop script and remove service when it will be removed from Home Assistant."""
await self.script.async_stop()
# remove service
self.hass.services.async_remove(DOMAIN, self.object_id) | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
":",
"await",
"self",
".",
"script",
".",
"async_stop",
"(",
")",
"# remove service",
"self",
".",
"hass",
".",
"services",
".",
"async_remove",
"(",
"DOMAIN",
",",
"self",
".",
"object_id",
")... | [
425,
4
] | [
430,
63
] | python | en | ['en', 'en', 'en'] | True |
mock_all | (aioclient_mock) | Mock all setup requests. | Mock all setup requests. | def mock_all(aioclient_mock):
"""Mock all setup requests."""
aioclient_mock.post("http://127.0.0.1/homeassistant/options", json={"result": "ok"})
aioclient_mock.get("http://127.0.0.1/supervisor/ping", json={"result": "ok"})
aioclient_mock.post("http://127.0.0.1/supervisor/options", json={"result": "ok"}... | [
"def",
"mock_all",
"(",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"post",
"(",
"\"http://127.0.0.1/homeassistant/options\"",
",",
"json",
"=",
"{",
"\"result\"",
":",
"\"ok\"",
"}",
")",
"aioclient_mock",
".",
"get",
"(",
"\"http://127.0.0.1/supervisor/ping\"... | [
7,
0
] | [
47,
5
] | python | en | ['en', 'bg', 'en'] | True |
setup | (hass, config) | Create the ViCare component. | Create the ViCare component. | def setup(hass, config):
"""Create the ViCare component."""
conf = config[DOMAIN]
params = {"token_file": hass.config.path(STORAGE_DIR, "vicare_token.save")}
if conf.get(CONF_CIRCUIT) is not None:
params["circuit"] = conf[CONF_CIRCUIT]
params["cacheDuration"] = conf.get(CONF_SCAN_INTERVAL)
... | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"params",
"=",
"{",
"\"token_file\"",
":",
"hass",
".",
"config",
".",
"path",
"(",
"STORAGE_DIR",
",",
"\"vicare_token.save\"",
")",
"}",
"if",
"conf",
".... | [
66,
0
] | [
100,
15
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Dyson 360 Eye robot vacuum platform. | Set up the Dyson 360 Eye robot vacuum platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Dyson 360 Eye robot vacuum platform."""
_LOGGER.debug("Creating new Dyson 360 Eye robot vacuum")
if DYSON_360_EYE_DEVICES not in hass.data:
hass.data[DYSON_360_EYE_DEVICES] = []
# Get Dyson Devices from parent co... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Creating new Dyson 360 Eye robot vacuum\"",
")",
"if",
"DYSON_360_EYE_DEVICES",
"not",
"in",
"hass",
".",
"data... | [
41,
0
] | [
53,
15
] | python | en | ['en', 'hu', 'en'] | True |
Dyson360EyeDevice.__init__ | (self, device) | Dyson 360 Eye robot vacuum device. | Dyson 360 Eye robot vacuum device. | def __init__(self, device):
"""Dyson 360 Eye robot vacuum device."""
super().__init__(device, None) | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
",",
"None",
")"
] | [
59,
4
] | [
61,
38
] | python | en | ['la', 'ht', 'en'] | False |
Dyson360EyeDevice.status | (self) | Return the status of the vacuum cleaner. | Return the status of the vacuum cleaner. | def status(self):
"""Return the status of the vacuum cleaner."""
dyson_labels = {
Dyson360EyeMode.INACTIVE_CHARGING: "Stopped - Charging",
Dyson360EyeMode.INACTIVE_CHARGED: "Stopped - Charged",
Dyson360EyeMode.FULL_CLEAN_PAUSED: "Paused",
Dyson360EyeMode.F... | [
"def",
"status",
"(",
"self",
")",
":",
"dyson_labels",
"=",
"{",
"Dyson360EyeMode",
".",
"INACTIVE_CHARGING",
":",
"\"Stopped - Charging\"",
",",
"Dyson360EyeMode",
".",
"INACTIVE_CHARGED",
":",
"\"Stopped - Charged\"",
",",
"Dyson360EyeMode",
".",
"FULL_CLEAN_PAUSED",... | [
64,
4
] | [
78,
83
] | python | en | ['en', 'la', 'en'] | True |
Dyson360EyeDevice.battery_level | (self) | Return the battery level of the vacuum cleaner. | Return the battery level of the vacuum cleaner. | def battery_level(self):
"""Return the battery level of the vacuum cleaner."""
return self._device.state.battery_level | [
"def",
"battery_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"battery_level"
] | [
81,
4
] | [
83,
47
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.fan_speed | (self) | Return the fan speed of the vacuum cleaner. | Return the fan speed of the vacuum cleaner. | def fan_speed(self):
"""Return the fan speed of the vacuum cleaner."""
speed_labels = {PowerMode.MAX: "Max", PowerMode.QUIET: "Quiet"}
return speed_labels[self._device.state.power_mode] | [
"def",
"fan_speed",
"(",
"self",
")",
":",
"speed_labels",
"=",
"{",
"PowerMode",
".",
"MAX",
":",
"\"Max\"",
",",
"PowerMode",
".",
"QUIET",
":",
"\"Quiet\"",
"}",
"return",
"speed_labels",
"[",
"self",
".",
"_device",
".",
"state",
".",
"power_mode",
"... | [
86,
4
] | [
89,
58
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.fan_speed_list | (self) | Get the list of available fan speed steps of the vacuum cleaner. | Get the list of available fan speed steps of the vacuum cleaner. | def fan_speed_list(self):
"""Get the list of available fan speed steps of the vacuum cleaner."""
return ["Quiet", "Max"] | [
"def",
"fan_speed_list",
"(",
"self",
")",
":",
"return",
"[",
"\"Quiet\"",
",",
"\"Max\"",
"]"
] | [
92,
4
] | [
94,
31
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.extra_state_attributes | (self) | Return the specific state attributes of this vacuum cleaner. | Return the specific state attributes of this vacuum cleaner. | def extra_state_attributes(self):
"""Return the specific state attributes of this vacuum cleaner."""
return {ATTR_POSITION: str(self._device.state.position)} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_POSITION",
":",
"str",
"(",
"self",
".",
"_device",
".",
"state",
".",
"position",
")",
"}"
] | [
97,
4
] | [
99,
64
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.is_on | (self) | Return True if entity is on. | Return True if entity is on. | def is_on(self) -> bool:
"""Return True if entity is on."""
return self._device.state.state in [
Dyson360EyeMode.FULL_CLEAN_INITIATED,
Dyson360EyeMode.FULL_CLEAN_ABORTED,
Dyson360EyeMode.FULL_CLEAN_RUNNING,
] | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"state",
"in",
"[",
"Dyson360EyeMode",
".",
"FULL_CLEAN_INITIATED",
",",
"Dyson360EyeMode",
".",
"FULL_CLEAN_ABORTED",
",",
"Dyson360EyeMode",
".",
"FULL_... | [
102,
4
] | [
108,
9
] | python | en | ['en', 'cy', 'en'] | True |
Dyson360EyeDevice.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return True | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
111,
4
] | [
113,
19
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.supported_features | (self) | Flag vacuum cleaner robot features that are supported. | Flag vacuum cleaner robot features that are supported. | def supported_features(self):
"""Flag vacuum cleaner robot features that are supported."""
return SUPPORT_DYSON | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_DYSON"
] | [
116,
4
] | [
118,
28
] | python | en | ['en', 'en', 'en'] | True |
Dyson360EyeDevice.battery_icon | (self) | Return the battery icon for the vacuum cleaner. | Return the battery icon for the vacuum cleaner. | def battery_icon(self):
"""Return the battery icon for the vacuum cleaner."""
charging = self._device.state.state in [Dyson360EyeMode.INACTIVE_CHARGING]
return icon_for_battery_level(
battery_level=self.battery_level, charging=charging
) | [
"def",
"battery_icon",
"(",
"self",
")",
":",
"charging",
"=",
"self",
".",
"_device",
".",
"state",
".",
"state",
"in",
"[",
"Dyson360EyeMode",
".",
"INACTIVE_CHARGING",
"]",
"return",
"icon_for_battery_level",
"(",
"battery_level",
"=",
"self",
".",
"battery... | [
121,
4
] | [
126,
9
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.