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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
HumidifierEntity.max_humidity | (self) | Return the maximum humidity. | Return the maximum humidity. | def max_humidity(self) -> int:
"""Return the maximum humidity."""
return self._attr_max_humidity | [
"def",
"max_humidity",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_attr_max_humidity"
] | [
191,
4
] | [
193,
38
] | python | en | ['en', 'la', 'en'] | True |
test_reproducing_states | (hass, caplog) | Test reproducing Water heater states. | Test reproducing Water heater states. | async def test_reproducing_states(hass, caplog):
"""Test reproducing Water heater states."""
hass.states.async_set("water_heater.entity_off", STATE_OFF, {})
hass.states.async_set("water_heater.entity_on", STATE_ON, {ATTR_TEMPERATURE: 45})
hass.states.async_set("water_heater.entity_away", STATE_ON, {ATTR... | [
"async",
"def",
"test_reproducing_states",
"(",
"hass",
",",
"caplog",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"water_heater.entity_off\"",
",",
"STATE_OFF",
",",
"{",
"}",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"water_heater.en... | [
17,
0
] | [
121,
42
] | python | en | ['da', 'en', 'en'] | True |
setup_comp | (hass, mqtt_mock) | Initialize components. | Initialize components. | def setup_comp(hass, mqtt_mock):
"""Initialize components."""
yaml_devices = hass.config.path(YAML_DEVICES)
yield
if os.path.isfile(yaml_devices):
os.remove(yaml_devices) | [
"def",
"setup_comp",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"yaml_devices",
"=",
"hass",
".",
"config",
".",
"path",
"(",
"YAML_DEVICES",
")",
"yield",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"yaml_devices",
")",
":",
"os",
".",
"remove",
"(",
... | [
28,
0
] | [
33,
31
] | python | en | ['de', 'en', 'en'] | False |
test_ensure_device_tracker_platform_validation | (hass) | Test if platform validation was done. | Test if platform validation was done. | async def test_ensure_device_tracker_platform_validation(hass):
"""Test if platform validation was done."""
async def mock_setup_scanner(hass, config, see, discovery_info=None):
"""Check that Qos was added by validation."""
assert "qos" in config
with patch(
"homeassistant.componen... | [
"async",
"def",
"test_ensure_device_tracker_platform_validation",
"(",
"hass",
")",
":",
"async",
"def",
"mock_setup_scanner",
"(",
"hass",
",",
"config",
",",
"see",
",",
"discovery_info",
"=",
"None",
")",
":",
"\"\"\"Check that Qos was added by validation.\"\"\"",
"a... | [
36,
0
] | [
56,
38
] | python | en | ['en', 'de', 'en'] | True |
test_json_message | (hass) | Test json location message. | Test json location message. | async def test_json_message(hass):
"""Test json location message."""
dev_id = "zanzito"
topic = "location/zanzito"
location = json.dumps(LOCATION_MESSAGE)
assert await async_setup_component(
hass,
DT_DOMAIN,
{DT_DOMAIN: {CONF_PLATFORM: "mqtt_json", "devices": {dev_id: topic}... | [
"async",
"def",
"test_json_message",
"(",
"hass",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"topic",
"=",
"\"location/zanzito\"",
"location",
"=",
"json",
".",
"dumps",
"(",
"LOCATION_MESSAGE",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DT... | [
59,
0
] | [
74,
51
] | python | en | ['es', 'fr', 'en'] | False |
test_non_json_message | (hass, caplog) | Test receiving a non JSON message. | Test receiving a non JSON message. | async def test_non_json_message(hass, caplog):
"""Test receiving a non JSON message."""
dev_id = "zanzito"
topic = "location/zanzito"
location = "home"
assert await async_setup_component(
hass,
DT_DOMAIN,
{DT_DOMAIN: {CONF_PLATFORM: "mqtt_json", "devices": {dev_id: topic}}},... | [
"async",
"def",
"test_non_json_message",
"(",
"hass",
",",
"caplog",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"topic",
"=",
"\"location/zanzito\"",
"location",
"=",
"\"home\"",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DT_DOMAIN",
",",
"{",
"... | [
77,
0
] | [
93,
60
] | python | en | ['en', 'fr', 'en'] | True |
test_incomplete_message | (hass, caplog) | Test receiving an incomplete message. | Test receiving an incomplete message. | async def test_incomplete_message(hass, caplog):
"""Test receiving an incomplete message."""
dev_id = "zanzito"
topic = "location/zanzito"
location = json.dumps(LOCATION_MESSAGE_INCOMPLETE)
assert await async_setup_component(
hass,
DT_DOMAIN,
{DT_DOMAIN: {CONF_PLATFORM: "mqt... | [
"async",
"def",
"test_incomplete_message",
"(",
"hass",
",",
"caplog",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"topic",
"=",
"\"location/zanzito\"",
"location",
"=",
"json",
".",
"dumps",
"(",
"LOCATION_MESSAGE_INCOMPLETE",
")",
"assert",
"await",
"async_setup_compo... | [
96,
0
] | [
115,
5
] | python | en | ['en', 'en', 'en'] | True |
test_single_level_wildcard_topic | (hass) | Test single level wildcard topic. | Test single level wildcard topic. | async def test_single_level_wildcard_topic(hass):
"""Test single level wildcard topic."""
dev_id = "zanzito"
subscription = "location/+/zanzito"
topic = "location/room/zanzito"
location = json.dumps(LOCATION_MESSAGE)
assert await async_setup_component(
hass,
DT_DOMAIN,
{... | [
"async",
"def",
"test_single_level_wildcard_topic",
"(",
"hass",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"subscription",
"=",
"\"location/+/zanzito\"",
"topic",
"=",
"\"location/room/zanzito\"",
"location",
"=",
"json",
".",
"dumps",
"(",
"LOCATION_MESSAGE",
")",
"ass... | [
118,
0
] | [
134,
51
] | python | en | ['en', 'en', 'en'] | True |
test_multi_level_wildcard_topic | (hass) | Test multi level wildcard topic. | Test multi level wildcard topic. | async def test_multi_level_wildcard_topic(hass):
"""Test multi level wildcard topic."""
dev_id = "zanzito"
subscription = "location/#"
topic = "location/zanzito"
location = json.dumps(LOCATION_MESSAGE)
assert await async_setup_component(
hass,
DT_DOMAIN,
{DT_DOMAIN: {CON... | [
"async",
"def",
"test_multi_level_wildcard_topic",
"(",
"hass",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"subscription",
"=",
"\"location/#\"",
"topic",
"=",
"\"location/zanzito\"",
"location",
"=",
"json",
".",
"dumps",
"(",
"LOCATION_MESSAGE",
")",
"assert",
"await... | [
137,
0
] | [
153,
51
] | python | en | ['en', 'en', 'en'] | True |
test_single_level_wildcard_topic_not_matching | (hass) | Test not matching single level wildcard topic. | Test not matching single level wildcard topic. | async def test_single_level_wildcard_topic_not_matching(hass):
"""Test not matching single level wildcard topic."""
dev_id = "zanzito"
entity_id = f"{DT_DOMAIN}.{dev_id}"
subscription = "location/+/zanzito"
topic = "location/zanzito"
location = json.dumps(LOCATION_MESSAGE)
assert await asyn... | [
"async",
"def",
"test_single_level_wildcard_topic_not_matching",
"(",
"hass",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"entity_id",
"=",
"f\"{DT_DOMAIN}.{dev_id}\"",
"subscription",
"=",
"\"location/+/zanzito\"",
"topic",
"=",
"\"location/zanzito\"",
"location",
"=",
"json",... | [
156,
0
] | [
171,
45
] | python | en | ['en', 'en', 'en'] | True |
test_multi_level_wildcard_topic_not_matching | (hass) | Test not matching multi level wildcard topic. | Test not matching multi level wildcard topic. | async def test_multi_level_wildcard_topic_not_matching(hass):
"""Test not matching multi level wildcard topic."""
dev_id = "zanzito"
entity_id = f"{DT_DOMAIN}.{dev_id}"
subscription = "location/#"
topic = "somewhere/zanzito"
location = json.dumps(LOCATION_MESSAGE)
assert await async_setup_c... | [
"async",
"def",
"test_multi_level_wildcard_topic_not_matching",
"(",
"hass",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"entity_id",
"=",
"f\"{DT_DOMAIN}.{dev_id}\"",
"subscription",
"=",
"\"location/#\"",
"topic",
"=",
"\"somewhere/zanzito\"",
"location",
"=",
"json",
".",
... | [
174,
0
] | [
189,
45
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.__init__ | (self, enum_string=None, enum_string_required=None, enum_integer=None, enum_number=None, outer_enum=None, local_vars_configuration=None) | EnumTest - a model defined in OpenAPI | EnumTest - a model defined in OpenAPI | def __init__(self, enum_string=None, enum_string_required=None, enum_integer=None, enum_number=None, outer_enum=None, local_vars_configuration=None): # noqa: E501
"""EnumTest - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Config... | [
"def",
"__init__",
"(",
"self",
",",
"enum_string",
"=",
"None",
",",
"enum_string_required",
"=",
"None",
",",
"enum_integer",
"=",
"None",
",",
"enum_number",
"=",
"None",
",",
"outer_enum",
"=",
"None",
",",
"local_vars_configuration",
"=",
"None",
")",
"... | [
50,
4
] | [
71,
40
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.enum_string | (self) | Gets the enum_string of this EnumTest. # noqa: E501
:return: The enum_string of this EnumTest. # noqa: E501
:rtype: str
| Gets the enum_string of this EnumTest. # noqa: E501 | def enum_string(self):
"""Gets the enum_string of this EnumTest. # noqa: E501
:return: The enum_string of this EnumTest. # noqa: E501
:rtype: str
"""
return self._enum_string | [
"def",
"enum_string",
"(",
"self",
")",
":",
"return",
"self",
".",
"_enum_string"
] | [
74,
4
] | [
81,
32
] | python | en | ['en', 'la', 'en'] | True |
EnumTest.enum_string | (self, enum_string) | Sets the enum_string of this EnumTest.
:param enum_string: The enum_string of this EnumTest. # noqa: E501
:type enum_string: str
| Sets the enum_string of this EnumTest. | def enum_string(self, enum_string):
"""Sets the enum_string of this EnumTest.
:param enum_string: The enum_string of this EnumTest. # noqa: E501
:type enum_string: str
"""
allowed_values = ["UPPER", "lower", ""] # noqa: E501
if self.local_vars_configuration.client_sid... | [
"def",
"enum_string",
"(",
"self",
",",
"enum_string",
")",
":",
"allowed_values",
"=",
"[",
"\"UPPER\"",
",",
"\"lower\"",
",",
"\"\"",
"]",
"# noqa: E501",
"if",
"self",
".",
"local_vars_configuration",
".",
"client_side_validation",
"and",
"enum_string",
"not",... | [
84,
4
] | [
98,
39
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.enum_string_required | (self) | Gets the enum_string_required of this EnumTest. # noqa: E501
:return: The enum_string_required of this EnumTest. # noqa: E501
:rtype: str
| Gets the enum_string_required of this EnumTest. # noqa: E501 | def enum_string_required(self):
"""Gets the enum_string_required of this EnumTest. # noqa: E501
:return: The enum_string_required of this EnumTest. # noqa: E501
:rtype: str
"""
return self._enum_string_required | [
"def",
"enum_string_required",
"(",
"self",
")",
":",
"return",
"self",
".",
"_enum_string_required"
] | [
101,
4
] | [
108,
41
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.enum_string_required | (self, enum_string_required) | Sets the enum_string_required of this EnumTest.
:param enum_string_required: The enum_string_required of this EnumTest. # noqa: E501
:type enum_string_required: str
| Sets the enum_string_required of this EnumTest. | def enum_string_required(self, enum_string_required):
"""Sets the enum_string_required of this EnumTest.
:param enum_string_required: The enum_string_required of this EnumTest. # noqa: E501
:type enum_string_required: str
"""
if self.local_vars_configuration.client_side_valida... | [
"def",
"enum_string_required",
"(",
"self",
",",
"enum_string_required",
")",
":",
"if",
"self",
".",
"local_vars_configuration",
".",
"client_side_validation",
"and",
"enum_string_required",
"is",
"None",
":",
"# noqa: E501",
"raise",
"ValueError",
"(",
"\"Invalid valu... | [
111,
4
] | [
127,
57
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.enum_integer | (self) | Gets the enum_integer of this EnumTest. # noqa: E501
:return: The enum_integer of this EnumTest. # noqa: E501
:rtype: int
| Gets the enum_integer of this EnumTest. # noqa: E501 | def enum_integer(self):
"""Gets the enum_integer of this EnumTest. # noqa: E501
:return: The enum_integer of this EnumTest. # noqa: E501
:rtype: int
"""
return self._enum_integer | [
"def",
"enum_integer",
"(",
"self",
")",
":",
"return",
"self",
".",
"_enum_integer"
] | [
130,
4
] | [
137,
33
] | python | en | ['en', 'ca', 'en'] | True |
EnumTest.enum_integer | (self, enum_integer) | Sets the enum_integer of this EnumTest.
:param enum_integer: The enum_integer of this EnumTest. # noqa: E501
:type enum_integer: int
| Sets the enum_integer of this EnumTest. | def enum_integer(self, enum_integer):
"""Sets the enum_integer of this EnumTest.
:param enum_integer: The enum_integer of this EnumTest. # noqa: E501
:type enum_integer: int
"""
allowed_values = [1, -1] # noqa: E501
if self.local_vars_configuration.client_side_validat... | [
"def",
"enum_integer",
"(",
"self",
",",
"enum_integer",
")",
":",
"allowed_values",
"=",
"[",
"1",
",",
"-",
"1",
"]",
"# noqa: E501",
"if",
"self",
".",
"local_vars_configuration",
".",
"client_side_validation",
"and",
"enum_integer",
"not",
"in",
"allowed_val... | [
140,
4
] | [
154,
41
] | python | en | ['en', 'fr', 'en'] | True |
EnumTest.enum_number | (self) | Gets the enum_number of this EnumTest. # noqa: E501
:return: The enum_number of this EnumTest. # noqa: E501
:rtype: float
| Gets the enum_number of this EnumTest. # noqa: E501 | def enum_number(self):
"""Gets the enum_number of this EnumTest. # noqa: E501
:return: The enum_number of this EnumTest. # noqa: E501
:rtype: float
"""
return self._enum_number | [
"def",
"enum_number",
"(",
"self",
")",
":",
"return",
"self",
".",
"_enum_number"
] | [
157,
4
] | [
164,
32
] | python | en | ['en', 'la', 'en'] | True |
EnumTest.enum_number | (self, enum_number) | Sets the enum_number of this EnumTest.
:param enum_number: The enum_number of this EnumTest. # noqa: E501
:type enum_number: float
| Sets the enum_number of this EnumTest. | def enum_number(self, enum_number):
"""Sets the enum_number of this EnumTest.
:param enum_number: The enum_number of this EnumTest. # noqa: E501
:type enum_number: float
"""
allowed_values = [1.1, -1.2] # noqa: E501
if self.local_vars_configuration.client_side_validat... | [
"def",
"enum_number",
"(",
"self",
",",
"enum_number",
")",
":",
"allowed_values",
"=",
"[",
"1.1",
",",
"-",
"1.2",
"]",
"# noqa: E501",
"if",
"self",
".",
"local_vars_configuration",
".",
"client_side_validation",
"and",
"enum_number",
"not",
"in",
"allowed_va... | [
167,
4
] | [
181,
39
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.outer_enum | (self) | Gets the outer_enum of this EnumTest. # noqa: E501
:return: The outer_enum of this EnumTest. # noqa: E501
:rtype: OuterEnum
| Gets the outer_enum of this EnumTest. # noqa: E501 | def outer_enum(self):
"""Gets the outer_enum of this EnumTest. # noqa: E501
:return: The outer_enum of this EnumTest. # noqa: E501
:rtype: OuterEnum
"""
return self._outer_enum | [
"def",
"outer_enum",
"(",
"self",
")",
":",
"return",
"self",
".",
"_outer_enum"
] | [
184,
4
] | [
191,
31
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.outer_enum | (self, outer_enum) | Sets the outer_enum of this EnumTest.
:param outer_enum: The outer_enum of this EnumTest. # noqa: E501
:type outer_enum: OuterEnum
| Sets the outer_enum of this EnumTest. | def outer_enum(self, outer_enum):
"""Sets the outer_enum of this EnumTest.
:param outer_enum: The outer_enum of this EnumTest. # noqa: E501
:type outer_enum: OuterEnum
"""
self._outer_enum = outer_enum | [
"def",
"outer_enum",
"(",
"self",
",",
"outer_enum",
")",
":",
"self",
".",
"_outer_enum",
"=",
"outer_enum"
] | [
194,
4
] | [
202,
37
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.to_dict | (self, serialize=False) | Returns the model properties as a dict | Returns the model properties as a dict | def to_dict(self, serialize=False):
"""Returns the model properties as a dict"""
result = {}
def convert(x):
if hasattr(x, "to_dict"):
args = inspect.getargspec(x.to_dict).args
if len(args) == 1:
return x.to_dict()
... | [
"def",
"to_dict",
"(",
"self",
",",
"serialize",
"=",
"False",
")",
":",
"result",
"=",
"{",
"}",
"def",
"convert",
"(",
"x",
")",
":",
"if",
"hasattr",
"(",
"x",
",",
"\"to_dict\"",
")",
":",
"args",
"=",
"inspect",
".",
"getargspec",
"(",
"x",
... | [
204,
4
] | [
234,
21
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.to_str | (self) | Returns the string representation of the model | Returns the string representation of the model | def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | [
236,
4
] | [
238,
45
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.__repr__ | (self) | For `print` and `pprint` | For `print` and `pprint` | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | [
240,
4
] | [
242,
28
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.__eq__ | (self, other) | Returns true if both objects are equal | Returns true if both objects are equal | def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, EnumTest):
return False
return self.to_dict() == other.to_dict() | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"EnumTest",
")",
":",
"return",
"False",
"return",
"self",
".",
"to_dict",
"(",
")",
"==",
"other",
".",
"to_dict",
"(",
")"
] | [
244,
4
] | [
249,
48
] | python | en | ['en', 'en', 'en'] | True |
EnumTest.__ne__ | (self, other) | Returns true if both objects are not equal | Returns true if both objects are not equal | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, EnumTest):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"EnumTest",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | [
251,
4
] | [
256,
48
] | python | en | ['en', 'en', 'en'] | True |
_check_for_node_def | (
hass_isy_data: dict, node: Group | Node, single_platform: str = None
) | Check if the node matches the node_def_id for any platforms.
This is only present on the 5.0 ISY firmware, and is the most reliable
way to determine a device's type.
| Check if the node matches the node_def_id for any platforms. | def _check_for_node_def(
hass_isy_data: dict, node: Group | Node, single_platform: str = None
) -> bool:
"""Check if the node matches the node_def_id for any platforms.
This is only present on the 5.0 ISY firmware, and is the most reliable
way to determine a device's type.
"""
if not hasattr(no... | [
"def",
"_check_for_node_def",
"(",
"hass_isy_data",
":",
"dict",
",",
"node",
":",
"Group",
"|",
"Node",
",",
"single_platform",
":",
"str",
"=",
"None",
")",
"->",
"bool",
":",
"if",
"not",
"hasattr",
"(",
"node",
",",
"\"node_def_id\"",
")",
"or",
"nod... | [
59,
0
] | [
79,
16
] | python | en | ['en', 'en', 'en'] | True |
_check_for_insteon_type | (
hass_isy_data: dict, node: Group | Node, single_platform: str = None
) | Check if the node matches the Insteon type for any platforms.
This is for (presumably) every version of the ISY firmware, but only
works for Insteon device. "Node Server" (v5+) and Z-Wave and others will
not have a type.
| Check if the node matches the Insteon type for any platforms. | def _check_for_insteon_type(
hass_isy_data: dict, node: Group | Node, single_platform: str = None
) -> bool:
"""Check if the node matches the Insteon type for any platforms.
This is for (presumably) every version of the ISY firmware, but only
works for Insteon device. "Node Server" (v5+) and Z-Wave and... | [
"def",
"_check_for_insteon_type",
"(",
"hass_isy_data",
":",
"dict",
",",
"node",
":",
"Group",
"|",
"Node",
",",
"single_platform",
":",
"str",
"=",
"None",
")",
"->",
"bool",
":",
"if",
"not",
"hasattr",
"(",
"node",
",",
"\"protocol\"",
")",
"or",
"no... | [
82,
0
] | [
144,
16
] | python | en | ['en', 'en', 'en'] | True |
_check_for_zwave_cat | (
hass_isy_data: dict, node: Group | Node, single_platform: str = None
) | Check if the node matches the ISY Z-Wave Category for any platforms.
This is for (presumably) every version of the ISY firmware, but only
works for Z-Wave Devices with the devtype.cat property.
| Check if the node matches the ISY Z-Wave Category for any platforms. | def _check_for_zwave_cat(
hass_isy_data: dict, node: Group | Node, single_platform: str = None
) -> bool:
"""Check if the node matches the ISY Z-Wave Category for any platforms.
This is for (presumably) every version of the ISY firmware, but only
works for Z-Wave Devices with the devtype.cat property.
... | [
"def",
"_check_for_zwave_cat",
"(",
"hass_isy_data",
":",
"dict",
",",
"node",
":",
"Group",
"|",
"Node",
",",
"single_platform",
":",
"str",
"=",
"None",
")",
"->",
"bool",
":",
"if",
"not",
"hasattr",
"(",
"node",
",",
"\"protocol\"",
")",
"or",
"node"... | [
147,
0
] | [
172,
16
] | python | en | ['en', 'en', 'en'] | True |
_check_for_uom_id | (
hass_isy_data: dict,
node: Group | Node,
single_platform: str = None,
uom_list: list = None,
) | Check if a node's uom matches any of the platforms uom filter.
This is used for versions of the ISY firmware that report uoms as a single
ID. We can often infer what type of device it is by that ID.
| Check if a node's uom matches any of the platforms uom filter. | def _check_for_uom_id(
hass_isy_data: dict,
node: Group | Node,
single_platform: str = None,
uom_list: list = None,
) -> bool:
"""Check if a node's uom matches any of the platforms uom filter.
This is used for versions of the ISY firmware that report uoms as a single
ID. We can often infer ... | [
"def",
"_check_for_uom_id",
"(",
"hass_isy_data",
":",
"dict",
",",
"node",
":",
"Group",
"|",
"Node",
",",
"single_platform",
":",
"str",
"=",
"None",
",",
"uom_list",
":",
"list",
"=",
"None",
",",
")",
"->",
"bool",
":",
"if",
"not",
"hasattr",
"(",... | [
175,
0
] | [
207,
16
] | python | en | ['en', 'en', 'en'] | True |
_check_for_states_in_uom | (
hass_isy_data: dict,
node: Group | Node,
single_platform: str = None,
states_list: list = None,
) | Check if a list of uoms matches two possible filters.
This is for versions of the ISY firmware that report uoms as a list of all
possible "human readable" states. This filter passes if all of the possible
states fit inside the given filter.
| Check if a list of uoms matches two possible filters. | def _check_for_states_in_uom(
hass_isy_data: dict,
node: Group | Node,
single_platform: str = None,
states_list: list = None,
) -> bool:
"""Check if a list of uoms matches two possible filters.
This is for versions of the ISY firmware that report uoms as a list of all
possible "human readab... | [
"def",
"_check_for_states_in_uom",
"(",
"hass_isy_data",
":",
"dict",
",",
"node",
":",
"Group",
"|",
"Node",
",",
"single_platform",
":",
"str",
"=",
"None",
",",
"states_list",
":",
"list",
"=",
"None",
",",
")",
"->",
"bool",
":",
"if",
"not",
"hasatt... | [
210,
0
] | [
244,
16
] | python | en | ['en', 'en', 'en'] | True |
_is_sensor_a_binary_sensor | (hass_isy_data: dict, node: Group | Node) | Determine if the given sensor node should be a binary_sensor. | Determine if the given sensor node should be a binary_sensor. | def _is_sensor_a_binary_sensor(hass_isy_data: dict, node: Group | Node) -> bool:
"""Determine if the given sensor node should be a binary_sensor."""
if _check_for_node_def(hass_isy_data, node, single_platform=BINARY_SENSOR):
return True
if _check_for_insteon_type(hass_isy_data, node, single_platform... | [
"def",
"_is_sensor_a_binary_sensor",
"(",
"hass_isy_data",
":",
"dict",
",",
"node",
":",
"Group",
"|",
"Node",
")",
"->",
"bool",
":",
"if",
"_check_for_node_def",
"(",
"hass_isy_data",
",",
"node",
",",
"single_platform",
"=",
"BINARY_SENSOR",
")",
":",
"ret... | [
247,
0
] | [
270,
16
] | python | en | ['en', 'ca', 'en'] | True |
_categorize_nodes | (
hass_isy_data: dict, nodes: Nodes, ignore_identifier: str, sensor_identifier: str
) | Sort the nodes to their proper platforms. | Sort the nodes to their proper platforms. | def _categorize_nodes(
hass_isy_data: dict, nodes: Nodes, ignore_identifier: str, sensor_identifier: str
) -> None:
"""Sort the nodes to their proper platforms."""
for (path, node) in nodes:
ignored = ignore_identifier in path or ignore_identifier in node.name
if ignored:
# Don't... | [
"def",
"_categorize_nodes",
"(",
"hass_isy_data",
":",
"dict",
",",
"nodes",
":",
"Nodes",
",",
"ignore_identifier",
":",
"str",
",",
"sensor_identifier",
":",
"str",
")",
"->",
"None",
":",
"for",
"(",
"path",
",",
"node",
")",
"in",
"nodes",
":",
"igno... | [
273,
0
] | [
310,
56
] | python | en | ['en', 'en', 'en'] | True |
_categorize_programs | (hass_isy_data: dict, programs: Programs) | Categorize the ISY994 programs. | Categorize the ISY994 programs. | def _categorize_programs(hass_isy_data: dict, programs: Programs) -> None:
"""Categorize the ISY994 programs."""
for platform in PROGRAM_PLATFORMS:
folder = programs.get_by_name(f"{DEFAULT_PROGRAM_STRING}{platform}")
if not folder:
continue
for dtype, _, node_id in folder.ch... | [
"def",
"_categorize_programs",
"(",
"hass_isy_data",
":",
"dict",
",",
"programs",
":",
"Programs",
")",
"->",
"None",
":",
"for",
"platform",
"in",
"PROGRAM_PLATFORMS",
":",
"folder",
"=",
"programs",
".",
"get_by_name",
"(",
"f\"{DEFAULT_PROGRAM_STRING}{platform}\... | [
313,
0
] | [
346,
67
] | python | en | ['en', 'cs', 'en'] | True |
_categorize_variables | (
hass_isy_data: dict, variables: Variables, identifier: str
) | Gather the ISY994 Variables to be added as sensors. | Gather the ISY994 Variables to be added as sensors. | def _categorize_variables(
hass_isy_data: dict, variables: Variables, identifier: str
) -> None:
"""Gather the ISY994 Variables to be added as sensors."""
try:
var_to_add = [
(vtype, vname, vid)
for (vtype, vname, vid) in variables.children
if identifier in vname
... | [
"def",
"_categorize_variables",
"(",
"hass_isy_data",
":",
"dict",
",",
"variables",
":",
"Variables",
",",
"identifier",
":",
"str",
")",
"->",
"None",
":",
"try",
":",
"var_to_add",
"=",
"[",
"(",
"vtype",
",",
"vname",
",",
"vid",
")",
"for",
"(",
"... | [
349,
0
] | [
363,
78
] | python | en | ['en', 'en', 'en'] | True |
migrate_old_unique_ids | (
hass: HomeAssistant, platform: str, devices: list[Any] | None
) | Migrate to new controller-specific unique ids. | Migrate to new controller-specific unique ids. | async def migrate_old_unique_ids(
hass: HomeAssistant, platform: str, devices: list[Any] | None
) -> None:
"""Migrate to new controller-specific unique ids."""
registry = await async_get_registry(hass)
for device in devices:
old_entity_id = registry.async_get_entity_id(
platform, DO... | [
"async",
"def",
"migrate_old_unique_ids",
"(",
"hass",
":",
"HomeAssistant",
",",
"platform",
":",
"str",
",",
"devices",
":",
"list",
"[",
"Any",
"]",
"|",
"None",
")",
"->",
"None",
":",
"registry",
"=",
"await",
"async_get_registry",
"(",
"hass",
")",
... | [
366,
0
] | [
395,
13
] | python | en | ['en', 'en', 'en'] | True |
convert_isy_value_to_hass | (
value: int | float | None,
uom: str,
precision: int | str,
fallback_precision: int | None = None,
) | Fix ISY Reported Values.
ISY provides float values as an integer and precision component.
Correct by shifting the decimal place left by the value of precision.
(e.g. value=2345, prec="2" == 23.45)
Insteon Thermostats report temperature in 0.5-deg precision as an int
by sending a value of 2 times t... | Fix ISY Reported Values. | def convert_isy_value_to_hass(
value: int | float | None,
uom: str,
precision: int | str,
fallback_precision: int | None = None,
) -> float | int:
"""Fix ISY Reported Values.
ISY provides float values as an integer and precision component.
Correct by shifting the decimal place left by the v... | [
"def",
"convert_isy_value_to_hass",
"(",
"value",
":",
"int",
"|",
"float",
"|",
"None",
",",
"uom",
":",
"str",
",",
"precision",
":",
"int",
"|",
"str",
",",
"fallback_precision",
":",
"int",
"|",
"None",
"=",
"None",
",",
")",
"->",
"float",
"|",
... | [
398,
0
] | [
421,
16
] | python | en | ['de', 'en', 'en'] | True |
test_default_setup | (hass, monkeypatch) | Test all basic functionality of the rflink sensor component. | Test all basic functionality of the rflink sensor component. | async def test_default_setup(hass, monkeypatch):
"""Test all basic functionality of the rflink sensor component."""
# setup mocking rflink module
event_callback, create, _, _ = await mock_rflink(hass, CONFIG, DOMAIN, monkeypatch)
# make sure arguments are passed
assert create.call_args_list[0][1]["... | [
"async",
"def",
"test_default_setup",
"(",
"hass",
",",
"monkeypatch",
")",
":",
"# setup mocking rflink module",
"event_callback",
",",
"create",
",",
"_",
",",
"_",
"=",
"await",
"mock_rflink",
"(",
"hass",
",",
"CONFIG",
",",
"DOMAIN",
",",
"monkeypatch",
"... | [
37,
0
] | [
70,
61
] | python | en | ['en', 'en', 'en'] | True |
test_disable_automatic_add | (hass, monkeypatch) | If disabled new devices should not be automatically added. | If disabled new devices should not be automatically added. | async def test_disable_automatic_add(hass, monkeypatch):
"""If disabled new devices should not be automatically added."""
config = {
"rflink": {"port": "/dev/ttyABC0"},
DOMAIN: {"platform": "rflink", "automatic_add": False},
}
# setup mocking rflink module
event_callback, _, _, _ = ... | [
"async",
"def",
"test_disable_automatic_add",
"(",
"hass",
",",
"monkeypatch",
")",
":",
"config",
"=",
"{",
"\"rflink\"",
":",
"{",
"\"port\"",
":",
"\"/dev/ttyABC0\"",
"}",
",",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"rflink\"",
",",
"\"automatic_add\"",
... | [
73,
0
] | [
90,
46
] | python | en | ['en', 'en', 'en'] | True |
test_entity_availability | (hass, monkeypatch) | If Rflink device is disconnected, entities should become unavailable. | If Rflink device is disconnected, entities should become unavailable. | async def test_entity_availability(hass, monkeypatch):
"""If Rflink device is disconnected, entities should become unavailable."""
# Make sure Rflink mock does not 'recover' to quickly from the
# disconnect or else the unavailability cannot be measured
config = CONFIG
failures = [True, True]
con... | [
"async",
"def",
"test_entity_availability",
"(",
"hass",
",",
"monkeypatch",
")",
":",
"# Make sure Rflink mock does not 'recover' to quickly from the",
"# disconnect or else the unavailability cannot be measured",
"config",
"=",
"CONFIG",
"failures",
"=",
"[",
"True",
",",
"Tr... | [
93,
0
] | [
125,
64
] | python | en | ['en', 'en', 'en'] | True |
test_aliases | (hass, monkeypatch) | Validate the response to sensor's alias (with aliases). | Validate the response to sensor's alias (with aliases). | async def test_aliases(hass, monkeypatch):
"""Validate the response to sensor's alias (with aliases)."""
config = {
"rflink": {"port": "/dev/ttyABC0"},
DOMAIN: {
"platform": "rflink",
"devices": {
"test_02": {
"name": "test_02",
... | [
"async",
"def",
"test_aliases",
"(",
"hass",
",",
"monkeypatch",
")",
":",
"config",
"=",
"{",
"\"rflink\"",
":",
"{",
"\"port\"",
":",
"\"/dev/ttyABC0\"",
"}",
",",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"rflink\"",
",",
"\"devices\"",
":",
"{",
"\"te... | [
128,
0
] | [
167,
76
] | python | en | ['en', 'lt', 'en'] | True |
test_race_condition | (hass, monkeypatch) | Test race condition for unknown components. | Test race condition for unknown components. | async def test_race_condition(hass, monkeypatch):
"""Test race condition for unknown components."""
config = {"rflink": {"port": "/dev/ttyABC0"}, DOMAIN: {"platform": "rflink"}}
tmp_entity = TMP_ENTITY.format("test3")
# setup mocking rflink module
event_callback, _, _, _ = await mock_rflink(hass, c... | [
"async",
"def",
"test_race_condition",
"(",
"hass",
",",
"monkeypatch",
")",
":",
"config",
"=",
"{",
"\"rflink\"",
":",
"{",
"\"port\"",
":",
"\"/dev/ttyABC0\"",
"}",
",",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"rflink\"",
"}",
"}",
"tmp_entity",
"=",
... | [
170,
0
] | [
206,
35
] | python | en | ['en', 'en', 'en'] | True |
test_sensors | (
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) | Test the creation and values of the Modern Forms sensors. | Test the creation and values of the Modern Forms sensors. | async def test_sensors(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the creation and values of the Modern Forms sensors."""
# await init_integration(hass, aioclient_mock)
await init_integration(hass, aioclient_mock)
er.async_get(hass)
# Light timer remaining tim... | [
"async",
"def",
"test_sensors",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"# await init_integration(hass, aioclient_mock)",
"await",
"init_integration",
"(",
"hass",
",",
"aioclient_mock",
")",
"er",
... | [
11,
0
] | [
32,
35
] | python | en | ['en', 'en', 'en'] | True |
test_active_sensors | (
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) | Test the creation and values of the Modern Forms sensors. | Test the creation and values of the Modern Forms sensors. | async def test_active_sensors(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the creation and values of the Modern Forms sensors."""
# await init_integration(hass, aioclient_mock)
await init_integration(hass, aioclient_mock, mock_type=modern_forms_timers_set_mock)
er.a... | [
"async",
"def",
"test_active_sensors",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"# await init_integration(hass, aioclient_mock)",
"await",
"init_integration",
"(",
"hass",
",",
"aioclient_mock",
",",
"... | [
35,
0
] | [
56,
39
] | python | en | ['en', 'en', 'en'] | True |
test_user_form | (hass, canary_config_flow) | Test we get the user initiated form. | Test we get the user initiated form. | async def test_user_form(hass, canary_config_flow):
"""Test we get the user initiated form."""
await async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == RESULT_TYPE_... | [
"async",
"def",
"test_user_form",
"(",
"hass",
",",
"canary_config_flow",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
... | [
23,
0
] | [
45,
48
] | python | en | ['en', 'en', 'en'] | True |
test_user_form_cannot_connect | (hass, canary_config_flow) | Test we handle errors that should trigger the cannot connect error. | Test we handle errors that should trigger the cannot connect error. | async def test_user_form_cannot_connect(hass, canary_config_flow):
"""Test we handle errors that should trigger the cannot connect error."""
canary_config_flow.side_effect = HTTPError()
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
result = a... | [
"async",
"def",
"test_user_form_cannot_connect",
"(",
"hass",
",",
"canary_config_flow",
")",
":",
"canary_config_flow",
".",
"side_effect",
"=",
"HTTPError",
"(",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"... | [
48,
0
] | [
72,
57
] | python | en | ['en', 'en', 'en'] | True |
test_user_form_unexpected_exception | (hass, canary_config_flow) | Test we handle unexpected exception. | Test we handle unexpected exception. | async def test_user_form_unexpected_exception(hass, canary_config_flow):
"""Test we handle unexpected exception."""
canary_config_flow.side_effect = Exception()
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
result = await hass.config_entries.... | [
"async",
"def",
"test_user_form_unexpected_exception",
"(",
"hass",
",",
"canary_config_flow",
")",
":",
"canary_config_flow",
".",
"side_effect",
"=",
"Exception",
"(",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(... | [
75,
0
] | [
89,
40
] | python | en | ['de', 'en', 'en'] | True |
test_user_form_single_instance_allowed | (hass, canary_config_flow) | Test that configuring more than one instance is rejected. | Test that configuring more than one instance is rejected. | async def test_user_form_single_instance_allowed(hass, canary_config_flow):
"""Test that configuring more than one instance is rejected."""
await init_integration(hass, skip_entry_setup=True)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
... | [
"async",
"def",
"test_user_form_single_instance_allowed",
"(",
"hass",
",",
"canary_config_flow",
")",
":",
"await",
"init_integration",
"(",
"hass",
",",
"skip_entry_setup",
"=",
"True",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
"."... | [
92,
0
] | [
102,
56
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow | (hass, canary) | Test updating options. | Test updating options. | async def test_options_flow(hass, canary):
"""Test updating options."""
with patch("homeassistant.components.canary.PLATFORMS", []):
entry = await init_integration(hass)
assert entry.options[CONF_FFMPEG_ARGUMENTS] == DEFAULT_FFMPEG_ARGUMENTS
assert entry.options[CONF_TIMEOUT] == DEFAULT_TIMEOUT... | [
"async",
"def",
"test_options_flow",
"(",
"hass",
",",
"canary",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.canary.PLATFORMS\"",
",",
"[",
"]",
")",
":",
"entry",
"=",
"await",
"init_integration",
"(",
"hass",
")",
"assert",
"entry",
".",
"opt... | [
105,
0
] | [
126,
44
] | python | en | ['en', 'en', 'en'] | True |
coordinator | (hass, zigpy_device_mock, zha_device_joined) | Test zha light platform. | Test zha light platform. | async def coordinator(hass, zigpy_device_mock, zha_device_joined):
"""Test zha light platform."""
zigpy_device = zigpy_device_mock(
{
1: {
SIG_EP_INPUT: [general.Groups.cluster_id],
SIG_EP_OUTPUT: [],
SIG_EP_TYPE: zha.DeviceType.COLOR_DIMMABLE... | [
"async",
"def",
"coordinator",
"(",
"hass",
",",
"zigpy_device_mock",
",",
"zha_device_joined",
")",
":",
"zigpy_device",
"=",
"zigpy_device_mock",
"(",
"{",
"1",
":",
"{",
"SIG_EP_INPUT",
":",
"[",
"general",
".",
"Groups",
".",
"cluster_id",
"]",
",",
"SIG... | [
79,
0
] | [
97,
21
] | python | cs | ['cs', 'lb', 'pl'] | False |
device_light_1 | (hass, zigpy_device_mock, zha_device_joined) | Test zha light platform. | Test zha light platform. | async def device_light_1(hass, zigpy_device_mock, zha_device_joined):
"""Test zha light platform."""
zigpy_device = zigpy_device_mock(
{
1: {
SIG_EP_INPUT: [
general.OnOff.cluster_id,
general.LevelControl.cluster_id,
... | [
"async",
"def",
"device_light_1",
"(",
"hass",
",",
"zigpy_device_mock",
",",
"zha_device_joined",
")",
":",
"zigpy_device",
"=",
"zigpy_device_mock",
"(",
"{",
"1",
":",
"{",
"SIG_EP_INPUT",
":",
"[",
"general",
".",
"OnOff",
".",
"cluster_id",
",",
"general"... | [
101,
0
] | [
124,
21
] | python | cs | ['cs', 'lb', 'pl'] | False |
device_light_2 | (hass, zigpy_device_mock, zha_device_joined) | Test zha light platform. | Test zha light platform. | async def device_light_2(hass, zigpy_device_mock, zha_device_joined):
"""Test zha light platform."""
zigpy_device = zigpy_device_mock(
{
1: {
SIG_EP_INPUT: [
general.OnOff.cluster_id,
general.LevelControl.cluster_id,
... | [
"async",
"def",
"device_light_2",
"(",
"hass",
",",
"zigpy_device_mock",
",",
"zha_device_joined",
")",
":",
"zigpy_device",
"=",
"zigpy_device_mock",
"(",
"{",
"1",
":",
"{",
"SIG_EP_INPUT",
":",
"[",
"general",
".",
"OnOff",
".",
"cluster_id",
",",
"general"... | [
128,
0
] | [
151,
21
] | python | cs | ['cs', 'lb', 'pl'] | False |
device_light_3 | (hass, zigpy_device_mock, zha_device_joined) | Test zha light platform. | Test zha light platform. | async def device_light_3(hass, zigpy_device_mock, zha_device_joined):
"""Test zha light platform."""
zigpy_device = zigpy_device_mock(
{
1: {
SIG_EP_INPUT: [
general.OnOff.cluster_id,
general.LevelControl.cluster_id,
... | [
"async",
"def",
"device_light_3",
"(",
"hass",
",",
"zigpy_device_mock",
",",
"zha_device_joined",
")",
":",
"zigpy_device",
"=",
"zigpy_device_mock",
"(",
"{",
"1",
":",
"{",
"SIG_EP_INPUT",
":",
"[",
"general",
".",
"OnOff",
".",
"cluster_id",
",",
"general"... | [
155,
0
] | [
178,
21
] | python | cs | ['cs', 'lb', 'pl'] | False |
test_light_refresh | (hass, zigpy_device_mock, zha_device_joined_restored) | Test zha light platform refresh. | Test zha light platform refresh. | async def test_light_refresh(hass, zigpy_device_mock, zha_device_joined_restored):
"""Test zha light platform refresh."""
# create zigpy devices
zigpy_device = zigpy_device_mock(LIGHT_ON_OFF)
on_off_cluster = zigpy_device.endpoints[1].on_off
on_off_cluster.PLUGGED_ATTR_READS = {"on_off": 0}
zha... | [
"async",
"def",
"test_light_refresh",
"(",
"hass",
",",
"zigpy_device_mock",
",",
"zha_device_joined_restored",
")",
":",
"# create zigpy devices",
"zigpy_device",
"=",
"zigpy_device_mock",
"(",
"LIGHT_ON_OFF",
")",
"on_off_cluster",
"=",
"zigpy_device",
".",
"endpoints",... | [
181,
0
] | [
216,
56
] | python | cs | ['cs', 'ru-Latn', 'pl'] | False |
test_light | (
hass, zigpy_device_mock, zha_device_joined_restored, device, reporting
) | Test zha light platform. | Test zha light platform. | async def test_light(
hass, zigpy_device_mock, zha_device_joined_restored, device, reporting
):
"""Test zha light platform."""
# create zigpy devices
zigpy_device = zigpy_device_mock(device)
zha_device = await zha_device_joined_restored(zigpy_device)
entity_id = await find_entity_id(DOMAIN, zha... | [
"async",
"def",
"test_light",
"(",
"hass",
",",
"zigpy_device_mock",
",",
"zha_device_joined_restored",
",",
"device",
",",
"reporting",
")",
":",
"# create zigpy devices",
"zigpy_device",
"=",
"zigpy_device_mock",
"(",
"device",
")",
"zha_device",
"=",
"await",
"zh... | [
239,
0
] | [
300,
87
] | python | cs | ['cs', 'lb', 'pl'] | False |
async_test_on_off_from_light | (hass, cluster, entity_id) | Test on off functionality from the light. | Test on off functionality from the light. | async def async_test_on_off_from_light(hass, cluster, entity_id):
"""Test on off functionality from the light."""
# turn on at light
await send_attributes_report(hass, cluster, {1: 0, 0: 1, 2: 3})
await async_wait_for_updates(hass)
assert hass.states.get(entity_id).state == STATE_ON
# turn off ... | [
"async",
"def",
"async_test_on_off_from_light",
"(",
"hass",
",",
"cluster",
",",
"entity_id",
")",
":",
"# turn on at light",
"await",
"send_attributes_report",
"(",
"hass",
",",
"cluster",
",",
"{",
"1",
":",
"0",
",",
"0",
":",
"1",
",",
"2",
":",
"3",
... | [
303,
0
] | [
313,
56
] | python | en | ['en', 'en', 'en'] | True |
async_test_on_from_light | (hass, cluster, entity_id) | Test on off functionality from the light. | Test on off functionality from the light. | async def async_test_on_from_light(hass, cluster, entity_id):
"""Test on off functionality from the light."""
# turn on at light
await send_attributes_report(hass, cluster, {1: -1, 0: 1, 2: 2})
await async_wait_for_updates(hass)
assert hass.states.get(entity_id).state == STATE_ON | [
"async",
"def",
"async_test_on_from_light",
"(",
"hass",
",",
"cluster",
",",
"entity_id",
")",
":",
"# turn on at light",
"await",
"send_attributes_report",
"(",
"hass",
",",
"cluster",
",",
"{",
"1",
":",
"-",
"1",
",",
"0",
":",
"1",
",",
"2",
":",
"2... | [
316,
0
] | [
321,
55
] | python | en | ['en', 'en', 'en'] | True |
async_test_on_off_from_hass | (hass, cluster, entity_id) | Test on off functionality from hass. | Test on off functionality from hass. | async def async_test_on_off_from_hass(hass, cluster, entity_id):
"""Test on off functionality from hass."""
# turn on via UI
cluster.request.reset_mock()
await hass.services.async_call(
DOMAIN, "turn_on", {"entity_id": entity_id}, blocking=True
)
assert cluster.request.call_count == 1
... | [
"async",
"def",
"async_test_on_off_from_hass",
"(",
"hass",
",",
"cluster",
",",
"entity_id",
")",
":",
"# turn on via UI",
"cluster",
".",
"request",
".",
"reset_mock",
"(",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"DOMAIN",
",",
"\"turn... | [
324,
0
] | [
337,
60
] | python | en | ['en', 'en', 'en'] | True |
async_test_off_from_hass | (hass, cluster, entity_id) | Test turning off the light from Home Assistant. | Test turning off the light from Home Assistant. | async def async_test_off_from_hass(hass, cluster, entity_id):
"""Test turning off the light from Home Assistant."""
# turn off via UI
cluster.request.reset_mock()
await hass.services.async_call(
DOMAIN, "turn_off", {"entity_id": entity_id}, blocking=True
)
assert cluster.request.call_co... | [
"async",
"def",
"async_test_off_from_hass",
"(",
"hass",
",",
"cluster",
",",
"entity_id",
")",
":",
"# turn off via UI",
"cluster",
".",
"request",
".",
"reset_mock",
"(",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"DOMAIN",
",",
"\"turn_o... | [
340,
0
] | [
352,
5
] | python | en | ['en', 'en', 'en'] | True |
async_test_level_on_off_from_hass | (
hass, on_off_cluster, level_cluster, entity_id
) | Test on off functionality from hass. | Test on off functionality from hass. | async def async_test_level_on_off_from_hass(
hass, on_off_cluster, level_cluster, entity_id
):
"""Test on off functionality from hass."""
on_off_cluster.request.reset_mock()
level_cluster.request.reset_mock()
# turn on via UI
await hass.services.async_call(
DOMAIN, "turn_on", {"entity_i... | [
"async",
"def",
"async_test_level_on_off_from_hass",
"(",
"hass",
",",
"on_off_cluster",
",",
"level_cluster",
",",
"entity_id",
")",
":",
"on_off_cluster",
".",
"request",
".",
"reset_mock",
"(",
")",
"level_cluster",
".",
"request",
".",
"reset_mock",
"(",
")",
... | [
355,
0
] | [
422,
67
] | python | en | ['en', 'en', 'en'] | True |
async_test_dimmer_from_light | (hass, cluster, entity_id, level, expected_state) | Test dimmer functionality from the light. | Test dimmer functionality from the light. | async def async_test_dimmer_from_light(hass, cluster, entity_id, level, expected_state):
"""Test dimmer functionality from the light."""
await send_attributes_report(
hass, cluster, {1: level + 10, 0: level, 2: level - 10 or 22}
)
await async_wait_for_updates(hass)
assert hass.states.get(en... | [
"async",
"def",
"async_test_dimmer_from_light",
"(",
"hass",
",",
"cluster",
",",
"entity_id",
",",
"level",
",",
"expected_state",
")",
":",
"await",
"send_attributes_report",
"(",
"hass",
",",
"cluster",
",",
"{",
"1",
":",
"level",
"+",
"10",
",",
"0",
... | [
425,
0
] | [
436,
75
] | python | en | ['en', 'en', 'en'] | True |
async_test_flash_from_hass | (hass, cluster, entity_id, flash) | Test flash functionality from hass. | Test flash functionality from hass. | async def async_test_flash_from_hass(hass, cluster, entity_id, flash):
"""Test flash functionality from hass."""
# turn on via UI
cluster.request.reset_mock()
await hass.services.async_call(
DOMAIN, "turn_on", {"entity_id": entity_id, "flash": flash}, blocking=True
)
assert cluster.reque... | [
"async",
"def",
"async_test_flash_from_hass",
"(",
"hass",
",",
"cluster",
",",
"entity_id",
",",
"flash",
")",
":",
"# turn on via UI",
"cluster",
".",
"request",
".",
"reset_mock",
"(",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"DOMAIN",... | [
439,
0
] | [
458,
5
] | python | en | ['en', 'en', 'en'] | True |
test_zha_group_light_entity | (
hass, device_light_1, device_light_2, device_light_3, coordinator
) | Test the light entity for a ZHA group. | Test the light entity for a ZHA group. | async def test_zha_group_light_entity(
hass, device_light_1, device_light_2, device_light_3, coordinator
):
"""Test the light entity for a ZHA group."""
zha_gateway = get_zha_gateway(hass)
assert zha_gateway is not None
zha_gateway.coordinator_zha_device = coordinator
coordinator._zha_gateway = ... | [
"async",
"def",
"test_zha_group_light_entity",
"(",
"hass",
",",
"device_light_1",
",",
"device_light_2",
",",
"device_light_3",
",",
"coordinator",
")",
":",
"zha_gateway",
"=",
"get_zha_gateway",
"(",
"hass",
")",
"assert",
"zha_gateway",
"is",
"not",
"None",
"z... | [
481,
0
] | [
672,
76
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities_callback, discovery_info=None) | Set up Kankun Wifi switches. | Set up Kankun Wifi switches. | def setup_platform(hass, config, add_entities_callback, discovery_info=None):
"""Set up Kankun Wifi switches."""
switches = config.get("switches", {})
devices = []
for dev_name, properties in switches.items():
devices.append(
KankunSwitch(
hass,
prope... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities_callback",
",",
"discovery_info",
"=",
"None",
")",
":",
"switches",
"=",
"config",
".",
"get",
"(",
"\"switches\"",
",",
"{",
"}",
")",
"devices",
"=",
"[",
"]",
"for",
"dev_name",
... | [
39,
0
] | [
57,
34
] | python | en | ['en', 'el-Latn', 'en'] | True |
KankunSwitch.__init__ | (self, hass, name, host, port, path, user, passwd) | Initialize the device. | Initialize the device. | def __init__(self, hass, name, host, port, path, user, passwd):
"""Initialize the device."""
self._hass = hass
self._name = name
self._state = False
self._url = f"http://{host}:{port}{path}"
if user is not None:
self._auth = (user, passwd)
else:
... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"name",
",",
"host",
",",
"port",
",",
"path",
",",
"user",
",",
"passwd",
")",
":",
"self",
".",
"_hass",
"=",
"hass",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_state",
"=",
"False",
"sel... | [
63,
4
] | [
72,
29
] | python | en | ['en', 'en', 'en'] | True |
KankunSwitch._switch | (self, newstate) | Switch on or off. | Switch on or off. | def _switch(self, newstate):
"""Switch on or off."""
_LOGGER.info("Switching to state: %s", newstate)
try:
req = requests.get(
f"{self._url}?set={newstate}", auth=self._auth, timeout=5
)
return req.json()["ok"]
except requests.RequestE... | [
"def",
"_switch",
"(",
"self",
",",
"newstate",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"Switching to state: %s\"",
",",
"newstate",
")",
"try",
":",
"req",
"=",
"requests",
".",
"get",
"(",
"f\"{self._url}?set={newstate}\"",
",",
"auth",
"=",
"self",
".",
... | [
74,
4
] | [
84,
45
] | python | en | ['en', 'en', 'en'] | True |
KankunSwitch._query_state | (self) | Query switch state. | Query switch state. | def _query_state(self):
"""Query switch state."""
_LOGGER.info("Querying state from: %s", self._url)
try:
req = requests.get(f"{self._url}?get=state", auth=self._auth, timeout=5)
return req.json()["state"] == "on"
except requests.RequestException:
_LO... | [
"def",
"_query_state",
"(",
"self",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"Querying state from: %s\"",
",",
"self",
".",
"_url",
")",
"try",
":",
"req",
"=",
"requests",
".",
"get",
"(",
"f\"{self._url}?get=state\"",
",",
"auth",
"=",
"self",
".",
"_aut... | [
86,
4
] | [
94,
47
] | python | en | ['en', 'en', 'en'] | True |
KankunSwitch.name | (self) | Return the name of the switch. | Return the name of the switch. | def name(self):
"""Return the name of the switch."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
97,
4
] | [
99,
25
] | python | en | ['en', 'en', 'en'] | True |
KankunSwitch.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
102,
4
] | [
104,
26
] | python | en | ['en', 'fy', 'en'] | True |
KankunSwitch.update | (self) | Update device state. | Update device state. | def update(self):
"""Update device state."""
self._state = self._query_state() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"self",
".",
"_query_state",
"(",
")"
] | [
106,
4
] | [
108,
41
] | python | en | ['fr', 'en', 'en'] | True |
KankunSwitch.turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | def turn_on(self, **kwargs):
"""Turn the device on."""
if self._switch("on"):
self._state = True | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_switch",
"(",
"\"on\"",
")",
":",
"self",
".",
"_state",
"=",
"True"
] | [
110,
4
] | [
113,
30
] | python | en | ['en', 'en', 'en'] | True |
KankunSwitch.turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | def turn_off(self, **kwargs):
"""Turn the device off."""
if self._switch("off"):
self._state = False | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_switch",
"(",
"\"off\"",
")",
":",
"self",
".",
"_state",
"=",
"False"
] | [
115,
4
] | [
118,
31
] | python | en | ['en', 'en', 'en'] | True |
Hashes.__init__ | (self, hashes=None) |
:param hashes: A dict of algorithm names pointing to lists of allowed
hex digests
|
:param hashes: A dict of algorithm names pointing to lists of allowed
hex digests
| def __init__(self, hashes=None):
# type: (Dict[str, List[str]]) -> None
"""
:param hashes: A dict of algorithm names pointing to lists of allowed
hex digests
"""
self._allowed = {} if hashes is None else hashes | [
"def",
"__init__",
"(",
"self",
",",
"hashes",
"=",
"None",
")",
":",
"# type: (Dict[str, List[str]]) -> None",
"self",
".",
"_allowed",
"=",
"{",
"}",
"if",
"hashes",
"is",
"None",
"else",
"hashes"
] | [
40,
4
] | [
46,
56
] | python | en | ['en', 'error', 'th'] | False |
Hashes.is_hash_allowed | (
self,
hash_name, # type: str
hex_digest, # type: str
) | Return whether the given hex digest is allowed. | Return whether the given hex digest is allowed. | def is_hash_allowed(
self,
hash_name, # type: str
hex_digest, # type: str
):
# type: (...) -> bool
"""Return whether the given hex digest is allowed."""
return hex_digest in self._allowed.get(hash_name, []) | [
"def",
"is_hash_allowed",
"(",
"self",
",",
"hash_name",
",",
"# type: str",
"hex_digest",
",",
"# type: str",
")",
":",
"# type: (...) -> bool",
"return",
"hex_digest",
"in",
"self",
".",
"_allowed",
".",
"get",
"(",
"hash_name",
",",
"[",
"]",
")"
] | [
65,
4
] | [
72,
61
] | python | en | ['en', 'en', 'en'] | True |
Hashes.check_against_chunks | (self, chunks) | Check good hashes against ones built from iterable of chunks of
data.
Raise HashMismatch if none match.
| Check good hashes against ones built from iterable of chunks of
data. | def check_against_chunks(self, chunks):
# type: (Iterator[bytes]) -> None
"""Check good hashes against ones built from iterable of chunks of
data.
Raise HashMismatch if none match.
"""
gots = {}
for hash_name in iterkeys(self._allowed):
try:
... | [
"def",
"check_against_chunks",
"(",
"self",
",",
"chunks",
")",
":",
"# type: (Iterator[bytes]) -> None",
"gots",
"=",
"{",
"}",
"for",
"hash_name",
"in",
"iterkeys",
"(",
"self",
".",
"_allowed",
")",
":",
"try",
":",
"gots",
"[",
"hash_name",
"]",
"=",
"... | [
74,
4
] | [
98,
25
] | python | en | ['en', 'en', 'en'] | True |
Hashes.check_against_file | (self, file) | Check good hashes against a file-like object
Raise HashMismatch if none match.
| Check good hashes against a file-like object | def check_against_file(self, file):
# type: (BinaryIO) -> None
"""Check good hashes against a file-like object
Raise HashMismatch if none match.
"""
return self.check_against_chunks(read_chunks(file)) | [
"def",
"check_against_file",
"(",
"self",
",",
"file",
")",
":",
"# type: (BinaryIO) -> None",
"return",
"self",
".",
"check_against_chunks",
"(",
"read_chunks",
"(",
"file",
")",
")"
] | [
104,
4
] | [
111,
59
] | python | en | ['en', 'en', 'en'] | True |
Hashes.__nonzero__ | (self) | Return whether I know any known-good hashes. | Return whether I know any known-good hashes. | def __nonzero__(self):
# type: () -> bool
"""Return whether I know any known-good hashes."""
return bool(self._allowed) | [
"def",
"__nonzero__",
"(",
"self",
")",
":",
"# type: () -> bool",
"return",
"bool",
"(",
"self",
".",
"_allowed",
")"
] | [
118,
4
] | [
121,
34
] | python | en | ['en', 'en', 'en'] | True |
MissingHashes.__init__ | (self) | Don't offer the ``hashes`` kwarg. | Don't offer the ``hashes`` kwarg. | def __init__(self):
# type: () -> None
"""Don't offer the ``hashes`` kwarg."""
# Pass our favorite hash in to generate a "gotten hash". With the
# empty list, it will never match, so an error will always raise.
super(MissingHashes, self).__init__(hashes={FAVORITE_HASH: []}) | [
"def",
"__init__",
"(",
"self",
")",
":",
"# type: () -> None",
"# Pass our favorite hash in to generate a \"gotten hash\". With the",
"# empty list, it will never match, so an error will always raise.",
"super",
"(",
"MissingHashes",
",",
"self",
")",
".",
"__init__",
"(",
"hash... | [
135,
4
] | [
140,
71
] | python | en | ['en', 'en', 'sw'] | True |
ConfigFlow.__init__ | (self) | Initialize the Panasonic Viera config flow. | Initialize the Panasonic Viera config flow. | def __init__(self):
"""Initialize the Panasonic Viera config flow."""
self._data = {
CONF_HOST: None,
CONF_NAME: None,
CONF_PORT: None,
CONF_ON_ACTION: None,
ATTR_DEVICE_INFO: None,
}
self._remote = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_data",
"=",
"{",
"CONF_HOST",
":",
"None",
",",
"CONF_NAME",
":",
"None",
",",
"CONF_PORT",
":",
"None",
",",
"CONF_ON_ACTION",
":",
"None",
",",
"ATTR_DEVICE_INFO",
":",
"None",
",",
"}",
"self"... | [
32,
4
] | [
42,
27
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_user | (self, user_input=None) | Handle the initial step. | Handle the initial step. | async def async_step_user(self, user_input=None):
"""Handle the initial step."""
errors = {}
if user_input is not None:
await self.async_load_data(user_input)
try:
self._remote = await self.hass.async_add_executor_job(
partial(RemoteCo... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"await",
"self",
".",
"async_load_data",
"(",
"user_input",
")",
"try",
":",
"self",
".",
"... | [
44,
4
] | [
101,
9
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_pairing | (self, user_input=None) | Handle the pairing step. | Handle the pairing step. | async def async_step_pairing(self, user_input=None):
"""Handle the pairing step."""
errors = {}
if user_input is not None:
pin = user_input[CONF_PIN]
try:
await self.hass.async_add_executor_job(
partial(self._remote.authorize_pin_code,... | [
"async",
"def",
"async_step_pairing",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"pin",
"=",
"user_input",
"[",
"CONF_PIN",
"]",
"try",
":",
"await",
"self",
".",
"hass"... | [
103,
4
] | [
151,
9
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_import | (self, import_config) | Import a config entry from configuration.yaml. | Import a config entry from configuration.yaml. | async def async_step_import(self, import_config):
"""Import a config entry from configuration.yaml."""
return await self.async_step_user(user_input=import_config) | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"import_config",
")",
":",
"return",
"await",
"self",
".",
"async_step_user",
"(",
"user_input",
"=",
"import_config",
")"
] | [
153,
4
] | [
155,
67
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_load_data | (self, config) | Load the data. | Load the data. | async def async_load_data(self, config):
"""Load the data."""
self._data = config
self._data[CONF_PORT] = (
self._data[CONF_PORT] if CONF_PORT in self._data else DEFAULT_PORT
)
self._data[CONF_ON_ACTION] = (
self._data[CONF_ON_ACTION] if CONF_ON_ACTION in... | [
"async",
"def",
"async_load_data",
"(",
"self",
",",
"config",
")",
":",
"self",
".",
"_data",
"=",
"config",
"self",
".",
"_data",
"[",
"CONF_PORT",
"]",
"=",
"(",
"self",
".",
"_data",
"[",
"CONF_PORT",
"]",
"if",
"CONF_PORT",
"in",
"self",
".",
"_... | [
157,
4
] | [
169,
45
] | python | en | ['en', 'en', 'en'] | True |
idfn | (val) | Provide IDs for pytest parametrize. | Provide IDs for pytest parametrize. | def idfn(val):
"""Provide IDs for pytest parametrize."""
if isinstance(val, (datetime)):
return val.strftime("%Y%m%d") | [
"def",
"idfn",
"(",
"val",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"(",
"datetime",
")",
")",
":",
"return",
"val",
".",
"strftime",
"(",
"\"%Y%m%d\"",
")"
] | [
60,
0
] | [
63,
37
] | python | en | ['en', 'no', 'en'] | True |
test_season_northern_hemisphere | (hass, type, day, expected) | Test that season should be summer. | Test that season should be summer. | async def test_season_northern_hemisphere(hass, type, day, expected):
"""Test that season should be summer."""
hass.config.latitude = HEMISPHERE_NORTHERN["homeassistant"]["latitude"]
config = {
**HEMISPHERE_NORTHERN,
"sensor": {"platform": "season", "type": type},
}
with patch("hom... | [
"async",
"def",
"test_season_northern_hemisphere",
"(",
"hass",
",",
"type",
",",
"day",
",",
"expected",
")",
":",
"hass",
".",
"config",
".",
"latitude",
"=",
"HEMISPHERE_NORTHERN",
"[",
"\"homeassistant\"",
"]",
"[",
"\"latitude\"",
"]",
"config",
"=",
"{",... | [
67,
0
] | [
82,
34
] | python | en | ['en', 'en', 'en'] | True |
test_season_southern_hemisphere | (hass, type, day, expected) | Test that season should be summer. | Test that season should be summer. | async def test_season_southern_hemisphere(hass, type, day, expected):
"""Test that season should be summer."""
hass.config.latitude = HEMISPHERE_SOUTHERN["homeassistant"]["latitude"]
config = {
**HEMISPHERE_SOUTHERN,
"sensor": {"platform": "season", "type": type},
}
with patch("hom... | [
"async",
"def",
"test_season_southern_hemisphere",
"(",
"hass",
",",
"type",
",",
"day",
",",
"expected",
")",
":",
"hass",
".",
"config",
".",
"latitude",
"=",
"HEMISPHERE_SOUTHERN",
"[",
"\"homeassistant\"",
"]",
"[",
"\"latitude\"",
"]",
"config",
"=",
"{",... | [
86,
0
] | [
101,
34
] | python | en | ['en', 'en', 'en'] | True |
test_season_equator | (hass) | Test that season should be unknown for equator. | Test that season should be unknown for equator. | async def test_season_equator(hass):
"""Test that season should be unknown for equator."""
hass.config.latitude = HEMISPHERE_EQUATOR["homeassistant"]["latitude"]
day = datetime(2017, 9, 3, 0, 0)
with patch("homeassistant.components.season.sensor.utcnow", return_value=day):
assert await async_se... | [
"async",
"def",
"test_season_equator",
"(",
"hass",
")",
":",
"hass",
".",
"config",
".",
"latitude",
"=",
"HEMISPHERE_EQUATOR",
"[",
"\"homeassistant\"",
"]",
"[",
"\"latitude\"",
"]",
"day",
"=",
"datetime",
"(",
"2017",
",",
"9",
",",
"3",
",",
"0",
"... | [
104,
0
] | [
115,
39
] | python | en | ['en', 'en', 'en'] | True |
test_setup_hemisphere_empty | (hass) | Test platform setup of missing latlong. | Test platform setup of missing latlong. | async def test_setup_hemisphere_empty(hass):
"""Test platform setup of missing latlong."""
hass.config.latitude = None
assert await async_setup_component(hass, "sensor", HEMISPHERE_EMPTY)
await hass.async_block_till_done()
assert hass.config.as_dict()["latitude"] is None | [
"async",
"def",
"test_setup_hemisphere_empty",
"(",
"hass",
")",
":",
"hass",
".",
"config",
".",
"latitude",
"=",
"None",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"sensor\"",
",",
"HEMISPHERE_EMPTY",
")",
"await",
"hass",
".",
"async_bloc... | [
118,
0
] | [
123,
52
] | python | en | ['en', 'da', 'en'] | True |
test_switch_set_state | (hass, hk_driver, events) | Test if accessory and HA are updated accordingly. | Test if accessory and HA are updated accordingly. | async def test_switch_set_state(hass, hk_driver, events):
"""Test if accessory and HA are updated accordingly."""
code = "1234"
config = {ATTR_CODE: code}
entity_id = "alarm_control_panel.test"
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = SecuritySystem(ha... | [
"async",
"def",
"test_switch_set_state",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"code",
"=",
"\"1234\"",
"config",
"=",
"{",
"ATTR_CODE",
":",
"code",
"}",
"entity_id",
"=",
"\"alarm_control_panel.test\"",
"hass",
".",
"states",
".",
"async_se... | [
29,
0
] | [
117,
46
] | python | en | ['en', 'en', 'en'] | True |
test_no_alarm_code | (hass, hk_driver, config, events) | Test accessory if security_system doesn't require an alarm_code. | Test accessory if security_system doesn't require an alarm_code. | async def test_no_alarm_code(hass, hk_driver, config, events):
"""Test accessory if security_system doesn't require an alarm_code."""
entity_id = "alarm_control_panel.test"
hass.states.async_set(entity_id, None)
await hass.async_block_till_done()
acc = SecuritySystem(hass, hk_driver, "SecuritySyste... | [
"async",
"def",
"test_no_alarm_code",
"(",
"hass",
",",
"hk_driver",
",",
"config",
",",
"events",
")",
":",
"entity_id",
"=",
"\"alarm_control_panel.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"None",
")",
"await",
"hass",
".",
... | [
121,
0
] | [
139,
46
] | python | en | ['en', 'en', 'en'] | True |
test_arming | (hass, hk_driver, events) | Test to make sure arming sets the right state. | Test to make sure arming sets the right state. | async def test_arming(hass, hk_driver, events):
"""Test to make sure arming sets the right state."""
entity_id = "alarm_control_panel.test"
hass.states.async_set(entity_id, None)
acc = SecuritySystem(hass, hk_driver, "SecuritySystem", entity_id, 2, {})
await acc.run()
await hass.async_block_ti... | [
"async",
"def",
"test_arming",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"alarm_control_panel.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"None",
")",
"acc",
"=",
"SecuritySystem",
"(",
"hass",
"... | [
142,
0
] | [
190,
44
] | python | en | ['en', 'en', 'en'] | True |
test_supported_states | (hass, hk_driver, events) | Test different supported states. | Test different supported states. | async def test_supported_states(hass, hk_driver, events):
"""Test different supported states."""
code = "1234"
config = {ATTR_CODE: code}
entity_id = "alarm_control_panel.test"
loader = get_loader()
default_current_states = loader.get_char(
"SecuritySystemCurrentState"
).properties.... | [
"async",
"def",
"test_supported_states",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"code",
"=",
"\"1234\"",
"config",
"=",
"{",
"ATTR_CODE",
":",
"code",
"}",
"entity_id",
"=",
"\"alarm_control_panel.test\"",
"loader",
"=",
"get_loader",
"(",
")"... | [
193,
0
] | [
303,
58
] | python | en | ['de', 'en', 'en'] | True |
test_reload | (hass) | Verify we can reload trend sensors. | Verify we can reload trend sensors. | async def test_reload(hass):
"""Verify we can reload trend sensors."""
hass.states.async_set("sensor.test_state", 1234)
await setup.async_setup_component(
hass,
"binary_sensor",
{
"binary_sensor": {
"platform": "trend",
"sensors": {"test_t... | [
"async",
"def",
"test_reload",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.test_state\"",
",",
"1234",
")",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"binary_sensor\"",
",",
"{",
"\"binary_sensor\"",
... | [
377,
0
] | [
414,
68
] | python | en | ['en', 'en', 'en'] | True |
TestTrendBinarySensor.setup_method | (self, method) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setup_method(self, method):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant() | [
"def",
"setup_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")"
] | [
18,
4
] | [
20,
45
] | python | en | ['en', 'en', 'en'] | True |
TestTrendBinarySensor.teardown_method | (self, method) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self, method):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
22,
4
] | [
24,
24
] | python | en | ['en', 'en', 'en'] | True |
TestTrendBinarySensor.test_up | (self) | Test up trend. | Test up trend. | def test_up(self):
"""Test up trend."""
assert setup.setup_component(
self.hass,
"binary_sensor",
{
"binary_sensor": {
"platform": "trend",
"sensors": {
"test_trend_sensor": {"entity_id": ... | [
"def",
"test_up",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"{",
"\"binary_sensor\"",
":",
"{",
"\"platform\"",
":",
"\"trend\"",
",",
"\"sensors\"",
":",
"{",
"\"test_trend_senso... | [
26,
4
] | [
47,
34
] | python | en | ['en', 'en', 'en'] | True |
TestTrendBinarySensor.test_up_using_trendline | (self) | Test up trend using multiple samples and trendline calculation. | Test up trend using multiple samples and trendline calculation. | def test_up_using_trendline(self):
"""Test up trend using multiple samples and trendline calculation."""
assert setup.setup_component(
self.hass,
"binary_sensor",
{
"binary_sensor": {
"platform": "trend",
"sensor... | [
"def",
"test_up_using_trendline",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"{",
"\"binary_sensor\"",
":",
"{",
"\"platform\"",
":",
"\"trend\"",
",",
"\"sensors\"",
":",
"{",
"\"... | [
49,
4
] | [
88,
35
] | python | en | ['en', 'en', 'en'] | True |
TestTrendBinarySensor.test_down_using_trendline | (self) | Test down trend using multiple samples and trendline calculation. | Test down trend using multiple samples and trendline calculation. | def test_down_using_trendline(self):
"""Test down trend using multiple samples and trendline calculation."""
assert setup.setup_component(
self.hass,
"binary_sensor",
{
"binary_sensor": {
"platform": "trend",
"se... | [
"def",
"test_down_using_trendline",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"{",
"\"binary_sensor\"",
":",
"{",
"\"platform\"",
":",
"\"trend\"",
",",
"\"sensors\"",
":",
"{",
"... | [
90,
4
] | [
129,
35
] | python | en | ['en', 'en', 'en'] | True |
TestTrendBinarySensor.test_down | (self) | Test down trend. | Test down trend. | def test_down(self):
"""Test down trend."""
assert setup.setup_component(
self.hass,
"binary_sensor",
{
"binary_sensor": {
"platform": "trend",
"sensors": {
"test_trend_sensor": {"entity_i... | [
"def",
"test_down",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"{",
"\"binary_sensor\"",
":",
"{",
"\"platform\"",
":",
"\"trend\"",
",",
"\"sensors\"",
":",
"{",
"\"test_trend_sen... | [
131,
4
] | [
152,
35
] | 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.