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_entity_device_info_update | (hass, mqtt_mock) | Test device registry update. | Test device registry update. | async def test_entity_device_info_update(hass, mqtt_mock):
"""Test device registry update."""
await help_test_entity_device_info_update(
hass, mqtt_mock, select.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"select",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
355,
0
] | [
359,
5
] | python | en | ['fr', 'fy', 'en'] | False |
test_entity_device_info_remove | (hass, mqtt_mock) | Test device registry remove. | Test device registry remove. | async def test_entity_device_info_remove(hass, mqtt_mock):
"""Test device registry remove."""
await help_test_entity_device_info_remove(
hass, mqtt_mock, select.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"select",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
362,
0
] | [
366,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_entity_id_update_subscriptions | (hass, mqtt_mock) | Test MQTT subscriptions are managed when entity_id is updated. | Test MQTT subscriptions are managed when entity_id is updated. | async def test_entity_id_update_subscriptions(hass, mqtt_mock):
"""Test MQTT subscriptions are managed when entity_id is updated."""
await help_test_entity_id_update_subscriptions(
hass, mqtt_mock, select.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
",",
"select",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
369,
0
] | [
373,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_id_update_discovery_update | (hass, mqtt_mock) | Test MQTT discovery update when entity_id is updated. | Test MQTT discovery update when entity_id is updated. | async def test_entity_id_update_discovery_update(hass, mqtt_mock):
"""Test MQTT discovery update when entity_id is updated."""
await help_test_entity_id_update_discovery_update(
hass, mqtt_mock, select.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"select",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
376,
0
] | [
380,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_debug_info_message | (hass, mqtt_mock) | Test MQTT debug info. | Test MQTT debug info. | async def test_entity_debug_info_message(hass, mqtt_mock):
"""Test MQTT debug info."""
await help_test_entity_debug_info_message(
hass, mqtt_mock, select.DOMAIN, DEFAULT_CONFIG, payload="milk"
) | [
"async",
"def",
"test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"select",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
",",
"payload",
"=",
"\"milk\"",
")"
] | [
383,
0
] | [
387,
5
] | python | es | ['es', 'mt', 'it'] | False |
test_options_attributes | (hass, mqtt_mock) | Test options attribute. | Test options attribute. | async def test_options_attributes(hass, mqtt_mock):
"""Test options attribute."""
topic = "test/select"
await async_setup_component(
hass,
"select",
{
"select": {
"platform": "mqtt",
"state_topic": topic,
"command_topic": to... | [
"async",
"def",
"test_options_attributes",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"topic",
"=",
"\"test/select\"",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"select\"",
",",
"{",
"\"select\"",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"stat... | [
390,
0
] | [
409,
65
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_options | (hass, caplog, mqtt_mock) | Test invalid options. | Test invalid options. | async def test_invalid_options(hass, caplog, mqtt_mock):
"""Test invalid options."""
topic = "test/select"
await async_setup_component(
hass,
"select",
{
"select": {
"platform": "mqtt",
"state_topic": topic,
"command_topic":... | [
"async",
"def",
"test_invalid_options",
"(",
"hass",
",",
"caplog",
",",
"mqtt_mock",
")",
":",
"topic",
"=",
"\"test/select\"",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"select\"",
",",
"{",
"\"select\"",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
... | [
412,
0
] | [
430,
77
] | python | en | ['en', 'et', 'en'] | True |
test_mqtt_payload_not_an_option_warning | (hass, caplog, mqtt_mock) | Test warning for MQTT payload which is not a valid option. | Test warning for MQTT payload which is not a valid option. | async def test_mqtt_payload_not_an_option_warning(hass, caplog, mqtt_mock):
"""Test warning for MQTT payload which is not a valid option."""
topic = "test/select"
await async_setup_component(
hass,
"select",
{
"select": {
"platform": "mqtt",
... | [
"async",
"def",
"test_mqtt_payload_not_an_option_warning",
"(",
"hass",
",",
"caplog",
",",
"mqtt_mock",
")",
":",
"topic",
"=",
"\"test/select\"",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"select\"",
",",
"{",
"\"select\"",
":",
"{",
"\"platform\"",
... | [
433,
0
] | [
458,
5
] | python | en | ['en', 'en', 'en'] | True |
init_integration | (
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
skip_setup: bool = False,
) | Set up the BSBLan integration in Home Assistant. | Set up the BSBLan integration in Home Assistant. | async def init_integration(
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
skip_setup: bool = False,
) -> MockConfigEntry:
"""Set up the BSBLan integration in Home Assistant."""
aioclient_mock.post(
"http://example.local:80/1234/JQ?Parameter=6224,6225,6226",
params={"Para... | [
"async",
"def",
"init_integration",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
"skip_setup",
":",
"bool",
"=",
"False",
",",
")",
"->",
"MockConfigEntry",
":",
"aioclient_mock",
".",
"post",
"(",
"\"http://example.lo... | [
20,
0
] | [
53,
16
] | python | en | ['en', 'en', 'en'] | True |
init_integration_without_auth | (
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
skip_setup: bool = False,
) | Set up the BSBLan integration in Home Assistant. | Set up the BSBLan integration in Home Assistant. | async def init_integration_without_auth(
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
skip_setup: bool = False,
) -> MockConfigEntry:
"""Set up the BSBLan integration in Home Assistant."""
aioclient_mock.post(
"http://example.local:80/1234/JQ?Parameter=6224,6225,6226",
... | [
"async",
"def",
"init_integration_without_auth",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
"skip_setup",
":",
"bool",
"=",
"False",
",",
")",
"->",
"MockConfigEntry",
":",
"aioclient_mock",
".",
"post",
"(",
"\"http... | [
56,
0
] | [
87,
16
] | python | en | ['en', 'en', 'en'] | True |
init_integration | (
hass,
*,
data: dict = ENTRY_CONFIG,
options: dict = ENTRY_OPTIONS,
unique_id: str = MOCK_ZONE,
skip_setup: bool = False,
) | Set up the Cloudflare integration in Home Assistant. | Set up the Cloudflare integration in Home Assistant. | async def init_integration(
hass,
*,
data: dict = ENTRY_CONFIG,
options: dict = ENTRY_OPTIONS,
unique_id: str = MOCK_ZONE,
skip_setup: bool = False,
) -> MockConfigEntry:
"""Set up the Cloudflare integration in Home Assistant."""
entry = MockConfigEntry(
domain=DOMAIN,
da... | [
"async",
"def",
"init_integration",
"(",
"hass",
",",
"*",
",",
"data",
":",
"dict",
"=",
"ENTRY_CONFIG",
",",
"options",
":",
"dict",
"=",
"ENTRY_OPTIONS",
",",
"unique_id",
":",
"str",
"=",
"MOCK_ZONE",
",",
"skip_setup",
":",
"bool",
"=",
"False",
","... | [
55,
0
] | [
76,
16
] | python | en | ['en', 'en', 'en'] | True |
generic_device | (name: str) | Create a generic device with given name. | Create a generic device with given name. | def generic_device(name: str):
"""Create a generic device with given name."""
return {"name": name, "type": DeviceType.GENERIC_DEVICE} | [
"def",
"generic_device",
"(",
"name",
":",
"str",
")",
":",
"return",
"{",
"\"name\"",
":",
"name",
",",
"\"type\"",
":",
"DeviceType",
".",
"GENERIC_DEVICE",
"}"
] | [
30,
0
] | [
32,
60
] | python | en | ['en', 'en', 'en'] | True |
test_entity_registry | (hass: core.HomeAssistant) | Tests that the devices are registered in the entity registry. | Tests that the devices are registered in the entity registry. | async def test_entity_registry(hass: core.HomeAssistant):
"""Tests that the devices are registered in the entity registry."""
await setup_platform(
hass,
SWITCH_DOMAIN,
generic_device("name-1"),
bond_version={"bondid": "test-hub-id"},
bond_device_id="test-device-id",
... | [
"async",
"def",
"test_entity_registry",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"SWITCH_DOMAIN",
",",
"generic_device",
"(",
"\"name-1\"",
")",
",",
"bond_version",
"=",
"{",
"\"bondid\"",
":",
"\"... | [
35,
0
] | [
47,
59
] | python | en | ['en', 'en', 'en'] | True |
test_turn_on_switch | (hass: core.HomeAssistant) | Tests that turn on command delegates to API. | Tests that turn on command delegates to API. | async def test_turn_on_switch(hass: core.HomeAssistant):
"""Tests that turn on command delegates to API."""
await setup_platform(
hass, SWITCH_DOMAIN, generic_device("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_turn_on, patch_bond_device_state():
await h... | [
"async",
"def",
"test_turn_on_switch",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"SWITCH_DOMAIN",
",",
"generic_device",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")",
"... | [
50,
0
] | [
65,
76
] | python | en | ['en', 'en', 'en'] | True |
test_turn_off_switch | (hass: core.HomeAssistant) | Tests that turn off command delegates to API. | Tests that turn off command delegates to API. | async def test_turn_off_switch(hass: core.HomeAssistant):
"""Tests that turn off command delegates to API."""
await setup_platform(
hass, SWITCH_DOMAIN, generic_device("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_turn_off, patch_bond_device_state():
awai... | [
"async",
"def",
"test_turn_off_switch",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"SWITCH_DOMAIN",
",",
"generic_device",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")",
... | [
68,
0
] | [
83,
78
] | python | en | ['en', 'en', 'en'] | True |
test_switch_set_power_belief | (hass: core.HomeAssistant) | Tests that the set power belief service delegates to API. | Tests that the set power belief service delegates to API. | async def test_switch_set_power_belief(hass: core.HomeAssistant):
"""Tests that the set power belief service delegates to API."""
await setup_platform(
hass, SWITCH_DOMAIN, generic_device("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_bond_action, patch_bond_devic... | [
"async",
"def",
"test_switch_set_power_belief",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"SWITCH_DOMAIN",
",",
"generic_device",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
... | [
86,
0
] | [
103,
5
] | python | en | ['en', 'en', 'en'] | True |
test_switch_set_power_belief_api_error | (hass: core.HomeAssistant) | Tests that the set power belief service throws HomeAssistantError in the event of an api error. | Tests that the set power belief service throws HomeAssistantError in the event of an api error. | async def test_switch_set_power_belief_api_error(hass: core.HomeAssistant):
"""Tests that the set power belief service throws HomeAssistantError in the event of an api error."""
await setup_platform(
hass, SWITCH_DOMAIN, generic_device("name-1"), bond_device_id="test-device-id"
)
with pytest.ra... | [
"async",
"def",
"test_switch_set_power_belief_api_error",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"SWITCH_DOMAIN",
",",
"generic_device",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-devic... | [
106,
0
] | [
121,
42
] | python | en | ['en', 'en', 'en'] | True |
test_update_reports_switch_is_on | (hass: core.HomeAssistant) | Tests that update command sets correct state when Bond API reports the device is on. | Tests that update command sets correct state when Bond API reports the device is on. | async def test_update_reports_switch_is_on(hass: core.HomeAssistant):
"""Tests that update command sets correct state when Bond API reports the device is on."""
await setup_platform(hass, SWITCH_DOMAIN, generic_device("name-1"))
with patch_bond_device_state(return_value={"power": 1}):
async_fire_ti... | [
"async",
"def",
"test_update_reports_switch_is_on",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"SWITCH_DOMAIN",
",",
"generic_device",
"(",
"\"name-1\"",
")",
")",
"with",
"patch_bond_device_state",
"(",
... | [
124,
0
] | [
132,
57
] | python | en | ['en', 'en', 'en'] | True |
test_update_reports_switch_is_off | (hass: core.HomeAssistant) | Tests that update command sets correct state when Bond API reports the device is off. | Tests that update command sets correct state when Bond API reports the device is off. | async def test_update_reports_switch_is_off(hass: core.HomeAssistant):
"""Tests that update command sets correct state when Bond API reports the device is off."""
await setup_platform(hass, SWITCH_DOMAIN, generic_device("name-1"))
with patch_bond_device_state(return_value={"power": 0}):
async_fire_... | [
"async",
"def",
"test_update_reports_switch_is_off",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"SWITCH_DOMAIN",
",",
"generic_device",
"(",
"\"name-1\"",
")",
")",
"with",
"patch_bond_device_state",
"(",
... | [
135,
0
] | [
143,
58
] | python | en | ['en', 'en', 'en'] | True |
test_switch_available | (hass: core.HomeAssistant) | Tests that available state is updated based on API errors. | Tests that available state is updated based on API errors. | async def test_switch_available(hass: core.HomeAssistant):
"""Tests that available state is updated based on API errors."""
await help_test_entity_available(
hass, SWITCH_DOMAIN, generic_device("name-1"), "switch.name_1"
) | [
"async",
"def",
"test_switch_available",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"help_test_entity_available",
"(",
"hass",
",",
"SWITCH_DOMAIN",
",",
"generic_device",
"(",
"\"name-1\"",
")",
",",
"\"switch.name_1\"",
")"
] | [
146,
0
] | [
150,
5
] | python | en | ['en', 'en', 'en'] | True |
SimpleQuadrilateral.additional_properties_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
|
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 additional_properties_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
"""
lazy_import()
return (bool, date, datetime, dict, float, int, list, str, none_type,) | [
"def",
"additional_properties_type",
"(",
")",
":",
"lazy_import",
"(",
")",
"return",
"(",
"bool",
",",
"date",
",",
"datetime",
",",
"dict",
",",
"float",
",",
"int",
",",
"list",
",",
"str",
",",
"none_type",
",",
")"
] | [
66,
4
] | [
72,
78
] | python | en | ['en', 'error', 'th'] | False |
SimpleQuadrilateral.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",
"{",
"'shape_type'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"'quadrilateral_type'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"}"
] | [
77,
4
] | [
90,
9
] | python | en | ['en', 'error', 'th'] | False |
SimpleQuadrilateral.__init__ | (self, shape_type, quadrilateral_type, *args, **kwargs) | SimpleQuadrilateral - a model defined in OpenAPI
Args:
shape_type (str):
quadrilateral_type (str):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
... | SimpleQuadrilateral - a model defined in OpenAPI | def __init__(self, shape_type, quadrilateral_type, *args, **kwargs): # noqa: E501
"""SimpleQuadrilateral - a model defined in OpenAPI
Args:
shape_type (str):
quadrilateral_type (str):
Keyword Args:
_check_type (bool): if True, values for parameters in opena... | [
"def",
"__init__",
"(",
"self",
",",
"shape_type",
",",
"quadrilateral_type",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_naming",
"=",... | [
115,
4
] | [
208,
46
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Wink cover platform. | Set up the Wink cover platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Wink cover platform."""
for shade in pywink.get_shades():
_id = shade.object_id() + shade.name()
if _id not in hass.data[DOMAIN]["unique_ids"]:
add_entities([WinkCoverEntity(shade, hass)])
for sha... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"for",
"shade",
"in",
"pywink",
".",
"get_shades",
"(",
")",
":",
"_id",
"=",
"shade",
".",
"object_id",
"(",
")",
"+",
"shade",
"."... | [
8,
0
] | [
22,
55
] | python | en | ['en', 'da', 'en'] | True |
WinkCoverEntity.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self.hass.data[DOMAIN]["entities"]["cover"].append(self) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"\"entities\"",
"]",
"[",
"\"cover\"",
"]",
".",
"append",
"(",
"self",
")"
] | [
28,
4
] | [
30,
64
] | python | en | ['en', 'en', 'en'] | True |
WinkCoverEntity.close_cover | (self, **kwargs) | Close the cover. | Close the cover. | def close_cover(self, **kwargs):
"""Close the cover."""
self.wink.set_state(0) | [
"def",
"close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"wink",
".",
"set_state",
"(",
"0",
")"
] | [
32,
4
] | [
34,
30
] | python | en | ['en', 'en', 'en'] | True |
WinkCoverEntity.open_cover | (self, **kwargs) | Open the cover. | Open the cover. | def open_cover(self, **kwargs):
"""Open the cover."""
self.wink.set_state(1) | [
"def",
"open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"wink",
".",
"set_state",
"(",
"1",
")"
] | [
36,
4
] | [
38,
30
] | python | en | ['en', 'en', 'en'] | True |
WinkCoverEntity.set_cover_position | (self, **kwargs) | Move the cover shutter to a specific position. | Move the cover shutter to a specific position. | def set_cover_position(self, **kwargs):
"""Move the cover shutter to a specific position."""
position = kwargs.get(ATTR_POSITION)
self.wink.set_state(position / 100) | [
"def",
"set_cover_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"position",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_POSITION",
")",
"self",
".",
"wink",
".",
"set_state",
"(",
"position",
"/",
"100",
")"
] | [
40,
4
] | [
43,
43
] | python | en | ['en', 'en', 'en'] | True |
WinkCoverEntity.current_cover_position | (self) | Return the current position of cover shutter. | Return the current position of cover shutter. | def current_cover_position(self):
"""Return the current position of cover shutter."""
if self.wink.state() is not None:
return int(self.wink.state() * 100)
return None | [
"def",
"current_cover_position",
"(",
"self",
")",
":",
"if",
"self",
".",
"wink",
".",
"state",
"(",
")",
"is",
"not",
"None",
":",
"return",
"int",
"(",
"self",
".",
"wink",
".",
"state",
"(",
")",
"*",
"100",
")",
"return",
"None"
] | [
46,
4
] | [
50,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkCoverEntity.is_closed | (self) | Return if the cover is closed. | Return if the cover is closed. | def is_closed(self):
"""Return if the cover is closed."""
state = self.wink.state()
return bool(state == 0) | [
"def",
"is_closed",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"wink",
".",
"state",
"(",
")",
"return",
"bool",
"(",
"state",
"==",
"0",
")"
] | [
53,
4
] | [
56,
31
] | python | en | ['en', 'en', 'en'] | True |
test_setup_with_no_config | (setup_component, hass, smarttub_api) | Test that we do not discover anything. | Test that we do not discover anything. | async def test_setup_with_no_config(setup_component, hass, smarttub_api):
"""Test that we do not discover anything."""
# No flows started
assert len(hass.config_entries.flow.async_progress()) == 0
smarttub_api.login.assert_not_called() | [
"async",
"def",
"test_setup_with_no_config",
"(",
"setup_component",
",",
"hass",
",",
"smarttub_api",
")",
":",
"# No flows started",
"assert",
"len",
"(",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_progress",
"(",
")",
")",
"==",
"0",
"smarttub_ap... | [
13,
0
] | [
19,
42
] | python | en | ['en', 'en', 'en'] | True |
test_setup_entry_not_ready | (setup_component, hass, config_entry, smarttub_api) | Test setup when the entry is not ready. | Test setup when the entry is not ready. | async def test_setup_entry_not_ready(setup_component, hass, config_entry, smarttub_api):
"""Test setup when the entry is not ready."""
smarttub_api.login.side_effect = asyncio.TimeoutError
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
assert config_entr... | [
"async",
"def",
"test_setup_entry_not_ready",
"(",
"setup_component",
",",
"hass",
",",
"config_entry",
",",
"smarttub_api",
")",
":",
"smarttub_api",
".",
"login",
".",
"side_effect",
"=",
"asyncio",
".",
"TimeoutError",
"config_entry",
".",
"add_to_hass",
"(",
"... | [
22,
0
] | [
28,
61
] | python | en | ['en', 'en', 'en'] | True |
test_setup_auth_failed | (setup_component, hass, config_entry, smarttub_api) | Test setup when the credentials are invalid. | Test setup when the credentials are invalid. | async def test_setup_auth_failed(setup_component, hass, config_entry, smarttub_api):
"""Test setup when the credentials are invalid."""
smarttub_api.login.side_effect = LoginFailed
config_entry.add_to_hass(hass)
with patch.object(hass.config_entries.flow, "async_init") as mock_flow_init:
await ... | [
"async",
"def",
"test_setup_auth_failed",
"(",
"setup_component",
",",
"hass",
",",
"config_entry",
",",
"smarttub_api",
")",
":",
"smarttub_api",
".",
"login",
".",
"side_effect",
"=",
"LoginFailed",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"with",
... | [
31,
0
] | [
47,
9
] | python | en | ['en', 'en', 'en'] | True |
test_config_passed_to_config_entry | (hass, config_entry, config_data) | Test that configured options are loaded via config entry. | Test that configured options are loaded via config entry. | async def test_config_passed_to_config_entry(hass, config_entry, config_data):
"""Test that configured options are loaded via config entry."""
config_entry.add_to_hass(hass)
assert await async_setup_component(hass, smarttub.DOMAIN, config_data) | [
"async",
"def",
"test_config_passed_to_config_entry",
"(",
"hass",
",",
"config_entry",
",",
"config_data",
")",
":",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"smarttub",
".",
"DOMAIN",
","... | [
50,
0
] | [
53,
74
] | python | en | ['en', 'en', 'en'] | True |
test_unload_entry | (hass, config_entry) | Test being able to unload an entry. | Test being able to unload an entry. | async def test_unload_entry(hass, config_entry):
"""Test being able to unload an entry."""
config_entry.add_to_hass(hass)
assert await async_setup_component(hass, smarttub.DOMAIN, {}) is True
assert await hass.config_entries.async_unload(config_entry.entry_id) | [
"async",
"def",
"test_unload_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"smarttub",
".",
"DOMAIN",
",",
"{",
"}",
")",
"is",
"True",
... | [
56,
0
] | [
62,
72
] | python | en | ['en', 'en', 'en'] | True |
generate_and_validate | (integrations: dict[str, Integration]) | Validate and generate MQTT data. | Validate and generate MQTT data. | def generate_and_validate(integrations: dict[str, Integration]):
"""Validate and generate MQTT data."""
data = defaultdict(list)
for domain in sorted(integrations):
integration = integrations[domain]
if not integration.manifest or not integration.config_flow:
continue
... | [
"def",
"generate_and_validate",
"(",
"integrations",
":",
"dict",
"[",
"str",
",",
"Integration",
"]",
")",
":",
"data",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"domain",
"in",
"sorted",
"(",
"integrations",
")",
":",
"integration",
"=",
"integrations",... | [
20,
0
] | [
39,
50
] | python | en | ['en', 'co', 'en'] | True |
validate | (integrations: dict[str, Integration], config: Config) | Validate MQTT file. | Validate MQTT file. | def validate(integrations: dict[str, Integration], config: Config):
"""Validate MQTT file."""
mqtt_path = config.root / "homeassistant/generated/mqtt.py"
config.cache["mqtt"] = content = generate_and_validate(integrations)
if config.specific_integrations:
return
with open(str(mqtt_path)) a... | [
"def",
"validate",
"(",
"integrations",
":",
"dict",
"[",
"str",
",",
"Integration",
"]",
",",
"config",
":",
"Config",
")",
":",
"mqtt_path",
"=",
"config",
".",
"root",
"/",
"\"homeassistant/generated/mqtt.py\"",
"config",
".",
"cache",
"[",
"\"mqtt\"",
"]... | [
42,
0
] | [
57,
14
] | python | co | ['en', 'co', 'hi'] | False |
generate | (integrations: dict[str, Integration], config: Config) | Generate MQTT file. | Generate MQTT file. | def generate(integrations: dict[str, Integration], config: Config):
"""Generate MQTT file."""
mqtt_path = config.root / "homeassistant/generated/mqtt.py"
with open(str(mqtt_path), "w") as fp:
fp.write(f"{config.cache['mqtt']}\n") | [
"def",
"generate",
"(",
"integrations",
":",
"dict",
"[",
"str",
",",
"Integration",
"]",
",",
"config",
":",
"Config",
")",
":",
"mqtt_path",
"=",
"config",
".",
"root",
"/",
"\"homeassistant/generated/mqtt.py\"",
"with",
"open",
"(",
"str",
"(",
"mqtt_path... | [
60,
0
] | [
64,
45
] | python | co | ['en', 'co', 'it'] | False |
FloDeviceDataUpdateCoordinator.__init__ | (
self, hass: HomeAssistant, api_client: API, location_id: str, device_id: str
) | Initialize the device. | Initialize the device. | def __init__(
self, hass: HomeAssistant, api_client: API, location_id: str, device_id: str
) -> None:
"""Initialize the device."""
self.hass: HomeAssistant = hass
self.api_client: API = api_client
self._flo_location_id: str = location_id
self._flo_device_id: str = dev... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"api_client",
":",
"API",
",",
"location_id",
":",
"str",
",",
"device_id",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"hass",
":",
"HomeAssistant",
"=",
"hass",
"self",
".",... | [
21,
4
] | [
37,
9
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator._async_update_data | (self) | Update data via library. | Update data via library. | async def _async_update_data(self):
"""Update data via library."""
try:
async with timeout(10):
await asyncio.gather(
*[self._update_device(), self._update_consumption_data()]
)
except (RequestError) as error:
raise Upda... | [
"async",
"def",
"_async_update_data",
"(",
"self",
")",
":",
"try",
":",
"async",
"with",
"timeout",
"(",
"10",
")",
":",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"self",
".",
"_update_device",
"(",
")",
",",
"self",
".",
"_update_consumption_da... | [
39,
4
] | [
47,
48
] | python | en | ['fr', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.location_id | (self) | Return Flo location id. | Return Flo location id. | def location_id(self) -> str:
"""Return Flo location id."""
return self._flo_location_id | [
"def",
"location_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_flo_location_id"
] | [
50,
4
] | [
52,
36
] | python | en | ['it', 'et', 'en'] | False |
FloDeviceDataUpdateCoordinator.id | (self) | Return Flo device id. | Return Flo device id. | def id(self) -> str:
"""Return Flo device id."""
return self._flo_device_id | [
"def",
"id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_flo_device_id"
] | [
55,
4
] | [
57,
34
] | python | en | ['it', 'et', 'en'] | False |
FloDeviceDataUpdateCoordinator.device_name | (self) | Return device name. | Return device name. | def device_name(self) -> str:
"""Return device name."""
return self._device_information.get(
"nickname", f"{self.manufacturer} {self.model}"
) | [
"def",
"device_name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
".",
"get",
"(",
"\"nickname\"",
",",
"f\"{self.manufacturer} {self.model}\"",
")"
] | [
60,
4
] | [
64,
9
] | python | en | ['es', 'sl', 'en'] | False |
FloDeviceDataUpdateCoordinator.manufacturer | (self) | Return manufacturer for device. | Return manufacturer for device. | def manufacturer(self) -> str:
"""Return manufacturer for device."""
return self._manufacturer | [
"def",
"manufacturer",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_manufacturer"
] | [
67,
4
] | [
69,
33
] | python | da | ['da', 'da', 'en'] | True |
FloDeviceDataUpdateCoordinator.mac_address | (self) | Return ieee address for device. | Return ieee address for device. | def mac_address(self) -> str:
"""Return ieee address for device."""
return self._device_information["macAddress"] | [
"def",
"mac_address",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"macAddress\"",
"]"
] | [
72,
4
] | [
74,
53
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.model | (self) | Return model for device. | Return model for device. | def model(self) -> str:
"""Return model for device."""
return self._device_information["deviceModel"] | [
"def",
"model",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"deviceModel\"",
"]"
] | [
77,
4
] | [
79,
54
] | python | da | ['da', 'no', 'en'] | False |
FloDeviceDataUpdateCoordinator.rssi | (self) | Return rssi for device. | Return rssi for device. | def rssi(self) -> float:
"""Return rssi for device."""
return self._device_information["connectivity"]["rssi"] | [
"def",
"rssi",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"connectivity\"",
"]",
"[",
"\"rssi\"",
"]"
] | [
82,
4
] | [
84,
63
] | python | en | ['da', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.last_heard_from_time | (self) | Return lastHeardFromTime for device. | Return lastHeardFromTime for device. | def last_heard_from_time(self) -> str:
"""Return lastHeardFromTime for device."""
return self._device_information["lastHeardFromTime"] | [
"def",
"last_heard_from_time",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"lastHeardFromTime\"",
"]"
] | [
87,
4
] | [
89,
60
] | python | en | ['es', 'no', 'en'] | False |
FloDeviceDataUpdateCoordinator.device_type | (self) | Return the device type for the device. | Return the device type for the device. | def device_type(self) -> str:
"""Return the device type for the device."""
return self._device_information["deviceType"] | [
"def",
"device_type",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"deviceType\"",
"]"
] | [
92,
4
] | [
94,
53
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.available | (self) | Return True if device is available. | Return True if device is available. | def available(self) -> bool:
"""Return True if device is available."""
return self.last_update_success and self._device_information["isConnected"] | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"last_update_success",
"and",
"self",
".",
"_device_information",
"[",
"\"isConnected\"",
"]"
] | [
97,
4
] | [
99,
83
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.current_system_mode | (self) | Return the current system mode. | Return the current system mode. | def current_system_mode(self) -> str:
"""Return the current system mode."""
return self._device_information["systemMode"]["lastKnown"] | [
"def",
"current_system_mode",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"systemMode\"",
"]",
"[",
"\"lastKnown\"",
"]"
] | [
102,
4
] | [
104,
66
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.target_system_mode | (self) | Return the target system mode. | Return the target system mode. | def target_system_mode(self) -> str:
"""Return the target system mode."""
return self._device_information["systemMode"]["target"] | [
"def",
"target_system_mode",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"systemMode\"",
"]",
"[",
"\"target\"",
"]"
] | [
107,
4
] | [
109,
63
] | python | en | ['en', 'da', 'en'] | True |
FloDeviceDataUpdateCoordinator.current_flow_rate | (self) | Return current flow rate in gpm. | Return current flow rate in gpm. | def current_flow_rate(self) -> float:
"""Return current flow rate in gpm."""
return self._device_information["telemetry"]["current"]["gpm"] | [
"def",
"current_flow_rate",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"telemetry\"",
"]",
"[",
"\"current\"",
"]",
"[",
"\"gpm\"",
"]"
] | [
112,
4
] | [
114,
70
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.current_psi | (self) | Return the current pressure in psi. | Return the current pressure in psi. | def current_psi(self) -> float:
"""Return the current pressure in psi."""
return self._device_information["telemetry"]["current"]["psi"] | [
"def",
"current_psi",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"telemetry\"",
"]",
"[",
"\"current\"",
"]",
"[",
"\"psi\"",
"]"
] | [
117,
4
] | [
119,
70
] | python | en | ['en', 'co', 'en'] | True |
FloDeviceDataUpdateCoordinator.temperature | (self) | Return the current temperature in degrees F. | Return the current temperature in degrees F. | def temperature(self) -> float:
"""Return the current temperature in degrees F."""
return self._device_information["telemetry"]["current"]["tempF"] | [
"def",
"temperature",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"telemetry\"",
"]",
"[",
"\"current\"",
"]",
"[",
"\"tempF\"",
"]"
] | [
122,
4
] | [
124,
72
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.humidity | (self) | Return the current humidity in percent (0-100). | Return the current humidity in percent (0-100). | def humidity(self) -> float:
"""Return the current humidity in percent (0-100)."""
return self._device_information["telemetry"]["current"]["humidity"] | [
"def",
"humidity",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"telemetry\"",
"]",
"[",
"\"current\"",
"]",
"[",
"\"humidity\"",
"]"
] | [
127,
4
] | [
129,
75
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.consumption_today | (self) | Return the current consumption for today in gallons. | Return the current consumption for today in gallons. | def consumption_today(self) -> float:
"""Return the current consumption for today in gallons."""
return self._water_usage["aggregations"]["sumTotalGallonsConsumed"] | [
"def",
"consumption_today",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_water_usage",
"[",
"\"aggregations\"",
"]",
"[",
"\"sumTotalGallonsConsumed\"",
"]"
] | [
132,
4
] | [
134,
75
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.firmware_version | (self) | Return the firmware version for the device. | Return the firmware version for the device. | def firmware_version(self) -> str:
"""Return the firmware version for the device."""
return self._device_information["fwVersion"] | [
"def",
"firmware_version",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"fwVersion\"",
"]"
] | [
137,
4
] | [
139,
52
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.serial_number | (self) | Return the serial number for the device. | Return the serial number for the device. | def serial_number(self) -> str:
"""Return the serial number for the device."""
return self._device_information["serialNumber"] | [
"def",
"serial_number",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"serialNumber\"",
"]"
] | [
142,
4
] | [
144,
55
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.pending_info_alerts_count | (self) | Return the number of pending info alerts for the device. | Return the number of pending info alerts for the device. | def pending_info_alerts_count(self) -> int:
"""Return the number of pending info alerts for the device."""
return self._device_information["notifications"]["pending"]["infoCount"] | [
"def",
"pending_info_alerts_count",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"notifications\"",
"]",
"[",
"\"pending\"",
"]",
"[",
"\"infoCount\"",
"]"
] | [
147,
4
] | [
149,
80
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.pending_warning_alerts_count | (self) | Return the number of pending warning alerts for the device. | Return the number of pending warning alerts for the device. | def pending_warning_alerts_count(self) -> int:
"""Return the number of pending warning alerts for the device."""
return self._device_information["notifications"]["pending"]["warningCount"] | [
"def",
"pending_warning_alerts_count",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"notifications\"",
"]",
"[",
"\"pending\"",
"]",
"[",
"\"warningCount\"",
"]"
] | [
152,
4
] | [
154,
83
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.pending_critical_alerts_count | (self) | Return the number of pending critical alerts for the device. | Return the number of pending critical alerts for the device. | def pending_critical_alerts_count(self) -> int:
"""Return the number of pending critical alerts for the device."""
return self._device_information["notifications"]["pending"]["criticalCount"] | [
"def",
"pending_critical_alerts_count",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"notifications\"",
"]",
"[",
"\"pending\"",
"]",
"[",
"\"criticalCount\"",
"]"
] | [
157,
4
] | [
159,
84
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.has_alerts | (self) | Return True if any alert counts are greater than zero. | Return True if any alert counts are greater than zero. | def has_alerts(self) -> bool:
"""Return True if any alert counts are greater than zero."""
return bool(
self.pending_info_alerts_count
or self.pending_warning_alerts_count
or self.pending_warning_alerts_count
) | [
"def",
"has_alerts",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"pending_info_alerts_count",
"or",
"self",
".",
"pending_warning_alerts_count",
"or",
"self",
".",
"pending_warning_alerts_count",
")"
] | [
162,
4
] | [
168,
9
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.water_detected | (self) | Return whether water is detected, for leak detectors. | Return whether water is detected, for leak detectors. | def water_detected(self) -> bool:
"""Return whether water is detected, for leak detectors."""
return self._device_information["fwProperties"]["telemetry_water"] | [
"def",
"water_detected",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"fwProperties\"",
"]",
"[",
"\"telemetry_water\"",
"]"
] | [
171,
4
] | [
173,
74
] | python | en | ['en', 'af', 'en'] | True |
FloDeviceDataUpdateCoordinator.last_known_valve_state | (self) | Return the last known valve state for the device. | Return the last known valve state for the device. | def last_known_valve_state(self) -> str:
"""Return the last known valve state for the device."""
return self._device_information["valve"]["lastKnown"] | [
"def",
"last_known_valve_state",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"valve\"",
"]",
"[",
"\"lastKnown\"",
"]"
] | [
176,
4
] | [
178,
61
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.target_valve_state | (self) | Return the target valve state for the device. | Return the target valve state for the device. | def target_valve_state(self) -> str:
"""Return the target valve state for the device."""
return self._device_information["valve"]["target"] | [
"def",
"target_valve_state",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"valve\"",
"]",
"[",
"\"target\"",
"]"
] | [
181,
4
] | [
183,
58
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.battery_level | (self) | Return the battery level for battery-powered device, e.g. leak detectors. | Return the battery level for battery-powered device, e.g. leak detectors. | def battery_level(self) -> float:
"""Return the battery level for battery-powered device, e.g. leak detectors."""
return self._device_information["battery"]["level"] | [
"def",
"battery_level",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device_information",
"[",
"\"battery\"",
"]",
"[",
"\"level\"",
"]"
] | [
186,
4
] | [
188,
59
] | python | en | ['en', 'no', 'en'] | True |
FloDeviceDataUpdateCoordinator.async_set_mode_home | (self) | Set the Flo location to home mode. | Set the Flo location to home mode. | async def async_set_mode_home(self):
"""Set the Flo location to home mode."""
await self.api_client.location.set_mode_home(self._flo_location_id) | [
"async",
"def",
"async_set_mode_home",
"(",
"self",
")",
":",
"await",
"self",
".",
"api_client",
".",
"location",
".",
"set_mode_home",
"(",
"self",
".",
"_flo_location_id",
")"
] | [
190,
4
] | [
192,
75
] | python | en | ['en', 'pt', 'en'] | True |
FloDeviceDataUpdateCoordinator.async_set_mode_away | (self) | Set the Flo location to away mode. | Set the Flo location to away mode. | async def async_set_mode_away(self):
"""Set the Flo location to away mode."""
await self.api_client.location.set_mode_away(self._flo_location_id) | [
"async",
"def",
"async_set_mode_away",
"(",
"self",
")",
":",
"await",
"self",
".",
"api_client",
".",
"location",
".",
"set_mode_away",
"(",
"self",
".",
"_flo_location_id",
")"
] | [
194,
4
] | [
196,
75
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator.async_set_mode_sleep | (self, sleep_minutes, revert_to_mode) | Set the Flo location to sleep mode. | Set the Flo location to sleep mode. | async def async_set_mode_sleep(self, sleep_minutes, revert_to_mode):
"""Set the Flo location to sleep mode."""
await self.api_client.location.set_mode_sleep(
self._flo_location_id, sleep_minutes, revert_to_mode
) | [
"async",
"def",
"async_set_mode_sleep",
"(",
"self",
",",
"sleep_minutes",
",",
"revert_to_mode",
")",
":",
"await",
"self",
".",
"api_client",
".",
"location",
".",
"set_mode_sleep",
"(",
"self",
".",
"_flo_location_id",
",",
"sleep_minutes",
",",
"revert_to_mode... | [
198,
4
] | [
202,
9
] | python | en | ['en', 'el-Latn', 'en'] | True |
FloDeviceDataUpdateCoordinator.async_run_health_test | (self) | Run a Flo device health test. | Run a Flo device health test. | async def async_run_health_test(self):
"""Run a Flo device health test."""
await self.api_client.device.run_health_test(self._flo_device_id) | [
"async",
"def",
"async_run_health_test",
"(",
"self",
")",
":",
"await",
"self",
".",
"api_client",
".",
"device",
".",
"run_health_test",
"(",
"self",
".",
"_flo_device_id",
")"
] | [
204,
4
] | [
206,
73
] | python | en | ['it', 'ga', 'en'] | False |
FloDeviceDataUpdateCoordinator._update_device | (self, *_) | Update the device information from the API. | Update the device information from the API. | async def _update_device(self, *_) -> None:
"""Update the device information from the API."""
self._device_information = await self.api_client.device.get_info(
self._flo_device_id
)
LOGGER.debug("Flo device data: %s", self._device_information) | [
"async",
"def",
"_update_device",
"(",
"self",
",",
"*",
"_",
")",
"->",
"None",
":",
"self",
".",
"_device_information",
"=",
"await",
"self",
".",
"api_client",
".",
"device",
".",
"get_info",
"(",
"self",
".",
"_flo_device_id",
")",
"LOGGER",
".",
"de... | [
208,
4
] | [
213,
69
] | python | en | ['en', 'en', 'en'] | True |
FloDeviceDataUpdateCoordinator._update_consumption_data | (self, *_) | Update water consumption data from the API. | Update water consumption data from the API. | async def _update_consumption_data(self, *_) -> None:
"""Update water consumption data from the API."""
today = dt_util.now().date()
start_date = datetime(today.year, today.month, today.day, 0, 0)
end_date = datetime(today.year, today.month, today.day, 23, 59, 59, 999000)
self._w... | [
"async",
"def",
"_update_consumption_data",
"(",
"self",
",",
"*",
"_",
")",
"->",
"None",
":",
"today",
"=",
"dt_util",
".",
"now",
"(",
")",
".",
"date",
"(",
")",
"start_date",
"=",
"datetime",
"(",
"today",
".",
"year",
",",
"today",
".",
"month"... | [
215,
4
] | [
223,
75
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_units | () | Test errors are raised when invalid units are passed in. | Test errors are raised when invalid units are passed in. | def test_invalid_units():
"""Test errors are raised when invalid units are passed in."""
with pytest.raises(ValueError):
UnitSystem(
SYSTEM_NAME,
INVALID_UNIT,
LENGTH_METERS,
VOLUME_LITERS,
MASS_GRAMS,
PRESSURE_PA,
)
wi... | [
"def",
"test_invalid_units",
"(",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"ValueError",
")",
":",
"UnitSystem",
"(",
"SYSTEM_NAME",
",",
"INVALID_UNIT",
",",
"LENGTH_METERS",
",",
"VOLUME_LITERS",
",",
"MASS_GRAMS",
",",
"PRESSURE_PA",
",",
")",
"with"... | [
22,
0
] | [
72,
9
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_value | () | Test no conversion happens if value is non-numeric. | Test no conversion happens if value is non-numeric. | def test_invalid_value():
"""Test no conversion happens if value is non-numeric."""
with pytest.raises(TypeError):
METRIC_SYSTEM.length("25a", LENGTH_KILOMETERS)
with pytest.raises(TypeError):
METRIC_SYSTEM.temperature("50K", TEMP_CELSIUS)
with pytest.raises(TypeError):
METRIC_SY... | [
"def",
"test_invalid_value",
"(",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"TypeError",
")",
":",
"METRIC_SYSTEM",
".",
"length",
"(",
"\"25a\"",
",",
"LENGTH_KILOMETERS",
")",
"with",
"pytest",
".",
"raises",
"(",
"TypeError",
")",
":",
"METRIC_SYSTE... | [
75,
0
] | [
84,
51
] | python | en | ['en', 'en', 'en'] | True |
test_as_dict | () | Test that the as_dict() method returns the expected dictionary. | Test that the as_dict() method returns the expected dictionary. | def test_as_dict():
"""Test that the as_dict() method returns the expected dictionary."""
expected = {
LENGTH: LENGTH_KILOMETERS,
TEMPERATURE: TEMP_CELSIUS,
VOLUME: VOLUME_LITERS,
MASS: MASS_GRAMS,
PRESSURE: PRESSURE_PA,
}
assert expected == METRIC_SYSTEM.as_dict... | [
"def",
"test_as_dict",
"(",
")",
":",
"expected",
"=",
"{",
"LENGTH",
":",
"LENGTH_KILOMETERS",
",",
"TEMPERATURE",
":",
"TEMP_CELSIUS",
",",
"VOLUME",
":",
"VOLUME_LITERS",
",",
"MASS",
":",
"MASS_GRAMS",
",",
"PRESSURE",
":",
"PRESSURE_PA",
",",
"}",
"asse... | [
87,
0
] | [
97,
46
] | python | en | ['en', 'en', 'en'] | True |
test_temperature_same_unit | () | Test no conversion happens if to unit is same as from unit. | Test no conversion happens if to unit is same as from unit. | def test_temperature_same_unit():
"""Test no conversion happens if to unit is same as from unit."""
assert METRIC_SYSTEM.temperature(5, METRIC_SYSTEM.temperature_unit) == 5 | [
"def",
"test_temperature_same_unit",
"(",
")",
":",
"assert",
"METRIC_SYSTEM",
".",
"temperature",
"(",
"5",
",",
"METRIC_SYSTEM",
".",
"temperature_unit",
")",
"==",
"5"
] | [
100,
0
] | [
102,
76
] | python | en | ['en', 'en', 'en'] | True |
test_temperature_unknown_unit | () | Test no conversion happens if unknown unit. | Test no conversion happens if unknown unit. | def test_temperature_unknown_unit():
"""Test no conversion happens if unknown unit."""
with pytest.raises(ValueError):
METRIC_SYSTEM.temperature(5, "abc") | [
"def",
"test_temperature_unknown_unit",
"(",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"ValueError",
")",
":",
"METRIC_SYSTEM",
".",
"temperature",
"(",
"5",
",",
"\"abc\"",
")"
] | [
105,
0
] | [
108,
43
] | python | en | ['en', 'fr', 'en'] | True |
test_temperature_to_metric | () | Test temperature conversion to metric system. | Test temperature conversion to metric system. | def test_temperature_to_metric():
"""Test temperature conversion to metric system."""
assert METRIC_SYSTEM.temperature(25, METRIC_SYSTEM.temperature_unit) == 25
assert (
round(METRIC_SYSTEM.temperature(80, IMPERIAL_SYSTEM.temperature_unit), 1)
== 26.7
) | [
"def",
"test_temperature_to_metric",
"(",
")",
":",
"assert",
"METRIC_SYSTEM",
".",
"temperature",
"(",
"25",
",",
"METRIC_SYSTEM",
".",
"temperature_unit",
")",
"==",
"25",
"assert",
"(",
"round",
"(",
"METRIC_SYSTEM",
".",
"temperature",
"(",
"80",
",",
"IMP... | [
111,
0
] | [
117,
5
] | python | en | ['en', 'en', 'en'] | True |
test_temperature_to_imperial | () | Test temperature conversion to imperial system. | Test temperature conversion to imperial system. | def test_temperature_to_imperial():
"""Test temperature conversion to imperial system."""
assert IMPERIAL_SYSTEM.temperature(77, IMPERIAL_SYSTEM.temperature_unit) == 77
assert IMPERIAL_SYSTEM.temperature(25, METRIC_SYSTEM.temperature_unit) == 77 | [
"def",
"test_temperature_to_imperial",
"(",
")",
":",
"assert",
"IMPERIAL_SYSTEM",
".",
"temperature",
"(",
"77",
",",
"IMPERIAL_SYSTEM",
".",
"temperature_unit",
")",
"==",
"77",
"assert",
"IMPERIAL_SYSTEM",
".",
"temperature",
"(",
"25",
",",
"METRIC_SYSTEM",
".... | [
120,
0
] | [
123,
80
] | python | en | ['en', 'en', 'en'] | True |
test_length_unknown_unit | () | Test length conversion with unknown from unit. | Test length conversion with unknown from unit. | def test_length_unknown_unit():
"""Test length conversion with unknown from unit."""
with pytest.raises(ValueError):
METRIC_SYSTEM.length(5, "fr") | [
"def",
"test_length_unknown_unit",
"(",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"ValueError",
")",
":",
"METRIC_SYSTEM",
".",
"length",
"(",
"5",
",",
"\"fr\"",
")"
] | [
126,
0
] | [
129,
37
] | python | en | ['en', 'en', 'en'] | True |
test_length_to_metric | () | Test length conversion to metric system. | Test length conversion to metric system. | def test_length_to_metric():
"""Test length conversion to metric system."""
assert METRIC_SYSTEM.length(100, METRIC_SYSTEM.length_unit) == 100
assert METRIC_SYSTEM.length(5, IMPERIAL_SYSTEM.length_unit) == 8.04672 | [
"def",
"test_length_to_metric",
"(",
")",
":",
"assert",
"METRIC_SYSTEM",
".",
"length",
"(",
"100",
",",
"METRIC_SYSTEM",
".",
"length_unit",
")",
"==",
"100",
"assert",
"METRIC_SYSTEM",
".",
"length",
"(",
"5",
",",
"IMPERIAL_SYSTEM",
".",
"length_unit",
")"... | [
132,
0
] | [
135,
74
] | python | en | ['en', 'en', 'en'] | True |
test_length_to_imperial | () | Test length conversion to imperial system. | Test length conversion to imperial system. | def test_length_to_imperial():
"""Test length conversion to imperial system."""
assert IMPERIAL_SYSTEM.length(100, IMPERIAL_SYSTEM.length_unit) == 100
assert IMPERIAL_SYSTEM.length(5, METRIC_SYSTEM.length_unit) == 3.106855 | [
"def",
"test_length_to_imperial",
"(",
")",
":",
"assert",
"IMPERIAL_SYSTEM",
".",
"length",
"(",
"100",
",",
"IMPERIAL_SYSTEM",
".",
"length_unit",
")",
"==",
"100",
"assert",
"IMPERIAL_SYSTEM",
".",
"length",
"(",
"5",
",",
"METRIC_SYSTEM",
".",
"length_unit",... | [
138,
0
] | [
141,
75
] | python | en | ['en', 'en', 'en'] | True |
test_pressure_same_unit | () | Test no conversion happens if to unit is same as from unit. | Test no conversion happens if to unit is same as from unit. | def test_pressure_same_unit():
"""Test no conversion happens if to unit is same as from unit."""
assert METRIC_SYSTEM.pressure(5, METRIC_SYSTEM.pressure_unit) == 5 | [
"def",
"test_pressure_same_unit",
"(",
")",
":",
"assert",
"METRIC_SYSTEM",
".",
"pressure",
"(",
"5",
",",
"METRIC_SYSTEM",
".",
"pressure_unit",
")",
"==",
"5"
] | [
144,
0
] | [
146,
70
] | python | en | ['en', 'en', 'en'] | True |
test_pressure_unknown_unit | () | Test no conversion happens if unknown unit. | Test no conversion happens if unknown unit. | def test_pressure_unknown_unit():
"""Test no conversion happens if unknown unit."""
with pytest.raises(ValueError):
METRIC_SYSTEM.pressure(5, "K") | [
"def",
"test_pressure_unknown_unit",
"(",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"ValueError",
")",
":",
"METRIC_SYSTEM",
".",
"pressure",
"(",
"5",
",",
"\"K\"",
")"
] | [
149,
0
] | [
152,
38
] | python | en | ['en', 'fr', 'en'] | True |
test_pressure_to_metric | () | Test pressure conversion to metric system. | Test pressure conversion to metric system. | def test_pressure_to_metric():
"""Test pressure conversion to metric system."""
assert METRIC_SYSTEM.pressure(25, METRIC_SYSTEM.pressure_unit) == 25
assert METRIC_SYSTEM.pressure(14.7, IMPERIAL_SYSTEM.pressure_unit) == pytest.approx(
101352.932, abs=1e-1
) | [
"def",
"test_pressure_to_metric",
"(",
")",
":",
"assert",
"METRIC_SYSTEM",
".",
"pressure",
"(",
"25",
",",
"METRIC_SYSTEM",
".",
"pressure_unit",
")",
"==",
"25",
"assert",
"METRIC_SYSTEM",
".",
"pressure",
"(",
"14.7",
",",
"IMPERIAL_SYSTEM",
".",
"pressure_u... | [
155,
0
] | [
160,
5
] | python | en | ['en', 'en', 'en'] | True |
test_pressure_to_imperial | () | Test pressure conversion to imperial system. | Test pressure conversion to imperial system. | def test_pressure_to_imperial():
"""Test pressure conversion to imperial system."""
assert IMPERIAL_SYSTEM.pressure(77, IMPERIAL_SYSTEM.pressure_unit) == 77
assert IMPERIAL_SYSTEM.pressure(
101352.932, METRIC_SYSTEM.pressure_unit
) == pytest.approx(14.7, abs=1e-4) | [
"def",
"test_pressure_to_imperial",
"(",
")",
":",
"assert",
"IMPERIAL_SYSTEM",
".",
"pressure",
"(",
"77",
",",
"IMPERIAL_SYSTEM",
".",
"pressure_unit",
")",
"==",
"77",
"assert",
"IMPERIAL_SYSTEM",
".",
"pressure",
"(",
"101352.932",
",",
"METRIC_SYSTEM",
".",
... | [
163,
0
] | [
168,
38
] | python | en | ['en', 'en', 'en'] | True |
test_properties | () | Test the unit properties are returned as expected. | Test the unit properties are returned as expected. | def test_properties():
"""Test the unit properties are returned as expected."""
assert METRIC_SYSTEM.length_unit == LENGTH_KILOMETERS
assert METRIC_SYSTEM.temperature_unit == TEMP_CELSIUS
assert METRIC_SYSTEM.mass_unit == MASS_GRAMS
assert METRIC_SYSTEM.volume_unit == VOLUME_LITERS
assert METRIC... | [
"def",
"test_properties",
"(",
")",
":",
"assert",
"METRIC_SYSTEM",
".",
"length_unit",
"==",
"LENGTH_KILOMETERS",
"assert",
"METRIC_SYSTEM",
".",
"temperature_unit",
"==",
"TEMP_CELSIUS",
"assert",
"METRIC_SYSTEM",
".",
"mass_unit",
"==",
"MASS_GRAMS",
"assert",
"MET... | [
171,
0
] | [
177,
53
] | python | en | ['en', 'en', 'en'] | True |
test_is_metric | () | Test the is metric flag. | Test the is metric flag. | def test_is_metric():
"""Test the is metric flag."""
assert METRIC_SYSTEM.is_metric
assert not IMPERIAL_SYSTEM.is_metric | [
"def",
"test_is_metric",
"(",
")",
":",
"assert",
"METRIC_SYSTEM",
".",
"is_metric",
"assert",
"not",
"IMPERIAL_SYSTEM",
".",
"is_metric"
] | [
180,
0
] | [
183,
40
] | python | en | ['en', 'en', 'en'] | True |
get_ip_mode | (host) | Get the 'mode' used to retrieve the MAC address. | Get the 'mode' used to retrieve the MAC address. | def get_ip_mode(host):
"""Get the 'mode' used to retrieve the MAC address."""
try:
if ipaddress.ip_address(host).version == 6:
return "ip6"
return "ip"
except ValueError:
return "hostname" | [
"def",
"get_ip_mode",
"(",
"host",
")",
":",
"try",
":",
"if",
"ipaddress",
".",
"ip_address",
"(",
"host",
")",
".",
"version",
"==",
"6",
":",
"return",
"\"ip6\"",
"return",
"\"ip\"",
"except",
"ValueError",
":",
"return",
"\"hostname\""
] | [
87,
0
] | [
94,
25
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the KEF platform. | Set up the KEF platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the KEF platform."""
if DOMAIN not in hass.data:
hass.data[DOMAIN] = {}
host = config[CONF_HOST]
speaker_type = config[CONF_TYPE]
port = config[CONF_PORT]
name = config[CONF_NAME]
maximu... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"DOMAIN",
"not",
"in",
"hass",
".",
"data",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
... | [
97,
0
] | [
182,
53
] | python | en | ['en', 'da', 'en'] | True |
KefMediaPlayer.__init__ | (
self,
name,
host,
port,
maximum_volume,
volume_step,
standby_time,
inverse_speaker_mode,
supports_on,
sources,
speaker_type,
loop,
unique_id,
) | Initialize the media player. | Initialize the media player. | def __init__(
self,
name,
host,
port,
maximum_volume,
volume_step,
standby_time,
inverse_speaker_mode,
supports_on,
sources,
speaker_type,
loop,
unique_id,
):
"""Initialize the media player."""
se... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"host",
",",
"port",
",",
"maximum_volume",
",",
"volume_step",
",",
"standby_time",
",",
"inverse_speaker_mode",
",",
"supports_on",
",",
"sources",
",",
"speaker_type",
",",
"loop",
",",
"unique_id",
",",
"... | [
188,
4
] | [
225,
44
] | python | en | ['en', 'en', 'en'] | True |
KefMediaPlayer.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
228,
4
] | [
230,
25
] | python | en | ['en', 'en', 'en'] | True |
KefMediaPlayer.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"
] | [
233,
4
] | [
235,
26
] | python | en | ['en', 'en', 'en'] | True |
KefMediaPlayer.async_update | (self) | Update latest state. | Update latest state. | async def async_update(self):
"""Update latest state."""
_LOGGER.debug("Running async_update")
try:
self._is_online = await self._speaker.is_online()
if self._is_online:
(
self._volume,
self._muted,
)... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Running async_update\"",
")",
"try",
":",
"self",
".",
"_is_online",
"=",
"await",
"self",
".",
"_speaker",
".",
"is_online",
"(",
")",
"if",
"self",
".",
"_is_online",... | [
237,
4
] | [
260,
30
] | python | co | ['es', 'co', 'en'] | False |
KefMediaPlayer.volume_level | (self) | Volume level of the media player (0..1). | Volume level of the media player (0..1). | def volume_level(self):
"""Volume level of the media player (0..1)."""
return self._volume | [
"def",
"volume_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_volume"
] | [
263,
4
] | [
265,
27
] | python | en | ['en', 'en', 'en'] | True |
KefMediaPlayer.is_volume_muted | (self) | Boolean if volume is currently muted. | Boolean if volume is currently muted. | def is_volume_muted(self):
"""Boolean if volume is currently muted."""
return self._muted | [
"def",
"is_volume_muted",
"(",
"self",
")",
":",
"return",
"self",
".",
"_muted"
] | [
268,
4
] | [
270,
26
] | python | en | ['en', 'en', 'en'] | True |
KefMediaPlayer.supported_features | (self) | Flag media player features that are supported. | Flag media player features that are supported. | def supported_features(self):
"""Flag media player features that are supported."""
support_kef = (
SUPPORT_VOLUME_SET
| SUPPORT_VOLUME_STEP
| SUPPORT_VOLUME_MUTE
| SUPPORT_SELECT_SOURCE
| SUPPORT_TURN_OFF
| SUPPORT_NEXT_TRACK # onl... | [
"def",
"supported_features",
"(",
"self",
")",
":",
"support_kef",
"=",
"(",
"SUPPORT_VOLUME_SET",
"|",
"SUPPORT_VOLUME_STEP",
"|",
"SUPPORT_VOLUME_MUTE",
"|",
"SUPPORT_SELECT_SOURCE",
"|",
"SUPPORT_TURN_OFF",
"|",
"SUPPORT_NEXT_TRACK",
"# only in Bluetooth and Wifi",
"|",
... | [
273,
4
] | [
289,
26
] | python | en | ['en', 'en', 'en'] | True |
KefMediaPlayer.source | (self) | Name of the current input source. | Name of the current input source. | def source(self):
"""Name of the current input source."""
return self._source | [
"def",
"source",
"(",
"self",
")",
":",
"return",
"self",
".",
"_source"
] | [
292,
4
] | [
294,
27
] | python | en | ['en', 'en', 'en'] | True |
KefMediaPlayer.source_list | (self) | List of available input sources. | List of available input sources. | def source_list(self):
"""List of available input sources."""
return self._sources | [
"def",
"source_list",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sources"
] | [
297,
4
] | [
299,
28
] | 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.