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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ISYProgramEntity.device_state_attributes | (self) | Get the state attributes for the device. | Get the state attributes for the device. | def device_state_attributes(self) -> Dict:
"""Get the state attributes for the device."""
attr = {}
if self._actions:
attr["actions_enabled"] = self._actions.enabled
if self._actions.last_finished != EMPTY_TIME:
attr["actions_last_finished"] = self._action... | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Dict",
":",
"attr",
"=",
"{",
"}",
"if",
"self",
".",
"_actions",
":",
"attr",
"[",
"\"actions_enabled\"",
"]",
"=",
"self",
".",
"_actions",
".",
"enabled",
"if",
"self",
".",
"_actions",
".",
... | [
186,
4
] | [
208,
19
] | python | en | ['en', 'en', 'en'] | True |
test_setup_entry | (hass: HomeAssistant) | Test integration setup from entry. | Test integration setup from entry. | async def test_setup_entry(hass: HomeAssistant) -> None:
"""Test integration setup from entry."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_DSN: "http://public@example.com/1", CONF_ENVIRONMENT: "production"},
)
entry.add_to_hass(hass)
with patch(
"homeassistant.comp... | [
"async",
"def",
"test_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_DSN",
":",
"\"http://public@example.com/1\"",
",",
"CONF_ENVIRONMENT",
":",... | [
23,
0
] | [
73,
35
] | python | en | ['en', 'da', 'en'] | True |
test_setup_entry_with_tracing | (hass: HomeAssistant) | Test integration setup from entry with tracing enabled. | Test integration setup from entry with tracing enabled. | async def test_setup_entry_with_tracing(hass: HomeAssistant) -> None:
"""Test integration setup from entry with tracing enabled."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_DSN: "http://public@example.com/1"},
options={CONF_TRACING: True, CONF_TRACING_SAMPLE_RATE: 0.5},
)
... | [
"async",
"def",
"test_setup_entry_with_tracing",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_DSN",
":",
"\"http://public@example.com/1\"",
"}",
",",
"optio... | [
76,
0
] | [
102,
49
] | python | en | ['en', 'en', 'en'] | True |
test_get_channel | (version, channel) | Test if channel detection works from Home Assistant version number. | Test if channel detection works from Home Assistant version number. | async def test_get_channel(version, channel) -> None:
"""Test if channel detection works from Home Assistant version number."""
assert get_channel(version) == channel | [
"async",
"def",
"test_get_channel",
"(",
"version",
",",
"channel",
")",
"->",
"None",
":",
"assert",
"get_channel",
"(",
"version",
")",
"==",
"channel"
] | [
114,
0
] | [
116,
42
] | python | en | ['en', 'en', 'en'] | True |
test_process_before_send | (hass: HomeAssistant) | Test regular use of the Sentry process before sending function. | Test regular use of the Sentry process before sending function. | async def test_process_before_send(hass: HomeAssistant):
"""Test regular use of the Sentry process before sending function."""
hass.config.components.add("puppies")
hass.config.components.add("a_integration")
# These should not show up in the result.
hass.config.components.add("puppies.light")
... | [
"async",
"def",
"test_process_before_send",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"hass",
".",
"config",
".",
"components",
".",
"add",
"(",
"\"puppies\"",
")",
"hass",
".",
"config",
".",
"components",
".",
"add",
"(",
"\"a_integration\"",
")",
"# Th... | [
119,
0
] | [
155,
32
] | python | en | ['en', 'en', 'en'] | True |
test_event_with_platform_context | (hass: HomeAssistant) | Test extraction of platform context information during Sentry events. | Test extraction of platform context information during Sentry events. | async def test_event_with_platform_context(hass: HomeAssistant):
"""Test extraction of platform context information during Sentry events."""
current_platform_mock = Mock()
current_platform_mock.get().platform_name = "hue"
current_platform_mock.get().domain = "light"
with patch(
"homeassist... | [
"async",
"def",
"test_event_with_platform_context",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"current_platform_mock",
"=",
"Mock",
"(",
")",
"current_platform_mock",
".",
"get",
"(",
")",
".",
"platform_name",
"=",
"\"hue\"",
"current_platform_mock",
".",
"get",... | [
158,
0
] | [
206,
54
] | python | en | ['en', 'en', 'en'] | True |
test_logger_event_extraction | (hass: HomeAssistant, logger, tags) | Test extraction of information from Sentry logger events. | Test extraction of information from Sentry logger events. | async def test_logger_event_extraction(hass: HomeAssistant, logger, tags):
"""Test extraction of information from Sentry logger events."""
result = process_before_send(
hass,
options={
CONF_EVENT_CUSTOM_COMPONENTS: True,
CONF_EVENT_THIRD_PARTY_PACKAGES: True,
},
... | [
"async",
"def",
"test_logger_event_extraction",
"(",
"hass",
":",
"HomeAssistant",
",",
"logger",
",",
"tags",
")",
":",
"result",
"=",
"process_before_send",
"(",
"hass",
",",
"options",
"=",
"{",
"CONF_EVENT_CUSTOM_COMPONENTS",
":",
"True",
",",
"CONF_EVENT_THIR... | [
237,
0
] | [
260,
5
] | python | en | ['en', 'en', 'en'] | True |
test_filter_log_events | (hass: HomeAssistant, logger, options, event) | Test filtering of events based on configuration options. | Test filtering of events based on configuration options. | async def test_filter_log_events(hass: HomeAssistant, logger, options, event):
"""Test filtering of events based on configuration options."""
result = process_before_send(
hass,
options=options,
channel="test",
huuid="12345",
system_info={"installation_type": "pytest"},
... | [
"async",
"def",
"test_filter_log_events",
"(",
"hass",
":",
"HomeAssistant",
",",
"logger",
",",
"options",
",",
"event",
")",
":",
"result",
"=",
"process_before_send",
"(",
"hass",
",",
"options",
"=",
"options",
",",
"channel",
"=",
"\"test\"",
",",
"huui... | [
280,
0
] | [
296,
29
] | python | en | ['en', 'en', 'en'] | True |
test_filter_handled_events | (hass: HomeAssistant, handled, options, event) | Tests filtering of handled events based on configuration options. | Tests filtering of handled events based on configuration options. | async def test_filter_handled_events(hass: HomeAssistant, handled, options, event):
"""Tests filtering of handled events based on configuration options."""
event_mock = MagicMock()
event_mock.__iter__ = ["tags"]
event_mock.__contains__ = lambda _, val: val == "tags"
event_mock.tags = {"handled": ha... | [
"async",
"def",
"test_filter_handled_events",
"(",
"hass",
":",
"HomeAssistant",
",",
"handled",
",",
"options",
",",
"event",
")",
":",
"event_mock",
"=",
"MagicMock",
"(",
")",
"event_mock",
".",
"__iter__",
"=",
"[",
"\"tags\"",
"]",
"event_mock",
".",
"_... | [
308,
0
] | [
330,
29
] | python | en | ['en', 'en', 'en'] | True |
get_service | (hass, config, discovery_info=None) | Get the Apprise notification service. | Get the Apprise notification service. | def get_service(hass, config, discovery_info=None):
"""Get the Apprise notification service."""
# Create our Apprise Instance (reference our asset)
a_obj = apprise.Apprise()
if config.get(CONF_FILE):
# Sourced from a Configuration File
a_config = apprise.AppriseConfig()
if not a... | [
"def",
"get_service",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"# Create our Apprise Instance (reference our asset)",
"a_obj",
"=",
"apprise",
".",
"Apprise",
"(",
")",
"if",
"config",
".",
"get",
"(",
"CONF_FILE",
")",
":",
"#... | [
28,
0
] | [
50,
44
] | python | en | ['en', 'en', 'en'] | True |
AppriseNotificationService.__init__ | (self, a_obj) | Initialize the service. | Initialize the service. | def __init__(self, a_obj):
"""Initialize the service."""
self.apprise = a_obj | [
"def",
"__init__",
"(",
"self",
",",
"a_obj",
")",
":",
"self",
".",
"apprise",
"=",
"a_obj"
] | [
56,
4
] | [
58,
28
] | python | en | ['en', 'en', 'en'] | True |
AppriseNotificationService.send_message | (self, message="", **kwargs) | Send a message to a specified target.
If no target/tags are specified, then services are notified as is
However, if any tags are specified, then they will be applied
to the notification causing filtering (if set up that way).
| Send a message to a specified target. | def send_message(self, message="", **kwargs):
"""Send a message to a specified target.
If no target/tags are specified, then services are notified as is
However, if any tags are specified, then they will be applied
to the notification causing filtering (if set up that way).
"""
... | [
"def",
"send_message",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"targets",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TARGET",
")",
"title",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TITLE",
",",
"ATTR_TITLE_DEFAULT",
")",
"s... | [
60,
4
] | [
69,
67
] | python | en | ['en', 'en', 'en'] | True |
test_make_filter | () | Test filter. | Test filter. | def test_make_filter():
"""Test filter."""
callsigns = ["CALLSIGN1", "callsign2"]
res = device_tracker.make_filter(callsigns)
assert res == "b/CALLSIGN1 b/CALLSIGN2" | [
"def",
"test_make_filter",
"(",
")",
":",
"callsigns",
"=",
"[",
"\"CALLSIGN1\"",
",",
"\"callsign2\"",
"]",
"res",
"=",
"device_tracker",
".",
"make_filter",
"(",
"callsigns",
")",
"assert",
"res",
"==",
"\"b/CALLSIGN1 b/CALLSIGN2\""
] | [
18,
0
] | [
22,
43
] | python | en | ['en', 'da', 'en'] | False |
test_gps_accuracy_0 | () | Test GPS accuracy level 0. | Test GPS accuracy level 0. | def test_gps_accuracy_0():
"""Test GPS accuracy level 0."""
acc = device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, 0)
assert acc == 0 | [
"def",
"test_gps_accuracy_0",
"(",
")",
":",
"acc",
"=",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"0",
")",
"assert",
"acc",
"==",
"0"
] | [
25,
0
] | [
28,
19
] | python | en | ['en', 'ga', 'en'] | True |
test_gps_accuracy_1 | () | Test GPS accuracy level 1. | Test GPS accuracy level 1. | def test_gps_accuracy_1():
"""Test GPS accuracy level 1."""
acc = device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, 1)
assert acc == 186 | [
"def",
"test_gps_accuracy_1",
"(",
")",
":",
"acc",
"=",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"1",
")",
"assert",
"acc",
"==",
"186"
] | [
31,
0
] | [
34,
21
] | python | en | ['en', 'ga', 'en'] | True |
test_gps_accuracy_2 | () | Test GPS accuracy level 2. | Test GPS accuracy level 2. | def test_gps_accuracy_2():
"""Test GPS accuracy level 2."""
acc = device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, 2)
assert acc == 1855 | [
"def",
"test_gps_accuracy_2",
"(",
")",
":",
"acc",
"=",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"2",
")",
"assert",
"acc",
"==",
"1855"
] | [
37,
0
] | [
40,
22
] | python | en | ['en', 'ga', 'en'] | True |
test_gps_accuracy_3 | () | Test GPS accuracy level 3. | Test GPS accuracy level 3. | def test_gps_accuracy_3():
"""Test GPS accuracy level 3."""
acc = device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, 3)
assert acc == 18553 | [
"def",
"test_gps_accuracy_3",
"(",
")",
":",
"acc",
"=",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"3",
")",
"assert",
"acc",
"==",
"18553"
] | [
43,
0
] | [
46,
23
] | python | en | ['en', 'ga', 'en'] | True |
test_gps_accuracy_4 | () | Test GPS accuracy level 4. | Test GPS accuracy level 4. | def test_gps_accuracy_4():
"""Test GPS accuracy level 4."""
acc = device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, 4)
assert acc == 111319 | [
"def",
"test_gps_accuracy_4",
"(",
")",
":",
"acc",
"=",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"4",
")",
"assert",
"acc",
"==",
"111319"
] | [
49,
0
] | [
52,
24
] | python | en | ['en', 'ga', 'en'] | True |
test_gps_accuracy_invalid_int | () | Test GPS accuracy with invalid input. | Test GPS accuracy with invalid input. | def test_gps_accuracy_invalid_int():
"""Test GPS accuracy with invalid input."""
level = 5
try:
device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, level)
assert False, "No exception."
except ValueError:
pass | [
"def",
"test_gps_accuracy_invalid_int",
"(",
")",
":",
"level",
"=",
"5",
"try",
":",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"level",
")",
"assert",
"False",
",",
"\"No exception.\"",
"except",
"ValueError",
":",
"pass"
] | [
55,
0
] | [
63,
12
] | python | en | ['en', 'en', 'en'] | True |
test_gps_accuracy_invalid_string | () | Test GPS accuracy with invalid input. | Test GPS accuracy with invalid input. | def test_gps_accuracy_invalid_string():
"""Test GPS accuracy with invalid input."""
level = "not an int"
try:
device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, level)
assert False, "No exception."
except ValueError:
pass | [
"def",
"test_gps_accuracy_invalid_string",
"(",
")",
":",
"level",
"=",
"\"not an int\"",
"try",
":",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"level",
")",
"assert",
"False",
",",
"\"No exception.\"",
"except",
"ValueError",
":",
... | [
66,
0
] | [
74,
12
] | python | en | ['en', 'en', 'en'] | True |
test_gps_accuracy_invalid_float | () | Test GPS accuracy with invalid input. | Test GPS accuracy with invalid input. | def test_gps_accuracy_invalid_float():
"""Test GPS accuracy with invalid input."""
level = 1.2
try:
device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, level)
assert False, "No exception."
except ValueError:
pass | [
"def",
"test_gps_accuracy_invalid_float",
"(",
")",
":",
"level",
"=",
"1.2",
"try",
":",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"level",
")",
"assert",
"False",
",",
"\"No exception.\"",
"except",
"ValueError",
":",
"pass"
] | [
77,
0
] | [
85,
12
] | python | en | ['en', 'en', 'en'] | True |
test_aprs_listener | () | Test listener thread. | Test listener thread. | def test_aprs_listener():
"""Test listener thread."""
with patch("aprslib.IS") as mock_ais:
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER
port = DEFAULT_PORT
see = Mock()
listener = device_tracker.AprsListe... | [
"def",
"test_aprs_listener",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS\"",
")",
"as",
"mock_ais",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_PASSWORD",
"host",
"=",
"TEST_HOST",
"server_filter",
"=",
"TEST_FILTER",
"port",
"=",
"DEFAU... | [
88,
0
] | [
110,
84
] | python | en | ['en', 'de', 'en'] | True |
test_aprs_listener_start_fail | () | Test listener thread start failure. | Test listener thread start failure. | def test_aprs_listener_start_fail():
"""Test listener thread start failure."""
with patch(
"aprslib.IS.connect", side_effect=aprslib.ConnectionError("Unable to connect.")
):
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER... | [
"def",
"test_aprs_listener_start_fail",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS.connect\"",
",",
"side_effect",
"=",
"aprslib",
".",
"ConnectionError",
"(",
"\"Unable to connect.\"",
")",
")",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_... | [
113,
0
] | [
135,
61
] | python | en | ['en', 'de', 'en'] | True |
test_aprs_listener_stop | () | Test listener thread stop. | Test listener thread stop. | def test_aprs_listener_stop():
"""Test listener thread stop."""
with patch("aprslib.IS"):
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER
see = Mock()
listener = device_tracker.AprsListenerThread(
callsig... | [
"def",
"test_aprs_listener_stop",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS\"",
")",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_PASSWORD",
"host",
"=",
"TEST_HOST",
"server_filter",
"=",
"TEST_FILTER",
"see",
"=",
"Mock",
"(",
")",
... | [
138,
0
] | [
161,
47
] | python | en | ['en', 'de', 'en'] | True |
test_aprs_listener_rx_msg | () | Test rx_msg. | Test rx_msg. | def test_aprs_listener_rx_msg():
"""Test rx_msg."""
with patch("aprslib.IS"):
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER
see = Mock()
sample_msg = {
device_tracker.ATTR_FORMAT: "uncompressed",
... | [
"def",
"test_aprs_listener_rx_msg",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS\"",
")",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_PASSWORD",
"host",
"=",
"TEST_HOST",
"server_filter",
"=",
"TEST_FILTER",
"see",
"=",
"Mock",
"(",
")",
... | [
164,
0
] | [
198,
9
] | python | en | ['en', 'en', 'hi'] | False |
test_aprs_listener_rx_msg_ambiguity | () | Test rx_msg with posambiguity. | Test rx_msg with posambiguity. | def test_aprs_listener_rx_msg_ambiguity():
"""Test rx_msg with posambiguity."""
with patch("aprslib.IS"):
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER
see = Mock()
sample_msg = {
device_tracker.ATTR_FO... | [
"def",
"test_aprs_listener_rx_msg_ambiguity",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS\"",
")",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_PASSWORD",
"host",
"=",
"TEST_HOST",
"server_filter",
"=",
"TEST_FILTER",
"see",
"=",
"Mock",
"(... | [
201,
0
] | [
235,
9
] | python | en | ['en', 'en', 'en'] | True |
test_aprs_listener_rx_msg_ambiguity_invalid | () | Test rx_msg with invalid posambiguity. | Test rx_msg with invalid posambiguity. | def test_aprs_listener_rx_msg_ambiguity_invalid():
"""Test rx_msg with invalid posambiguity."""
with patch("aprslib.IS"):
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER
see = Mock()
sample_msg = {
device... | [
"def",
"test_aprs_listener_rx_msg_ambiguity_invalid",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS\"",
")",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_PASSWORD",
"host",
"=",
"TEST_HOST",
"server_filter",
"=",
"TEST_FILTER",
"see",
"=",
"Moc... | [
238,
0
] | [
270,
9
] | python | en | ['en', 'en', 'en'] | True |
test_aprs_listener_rx_msg_no_position | () | Test rx_msg with non-position report. | Test rx_msg with non-position report. | def test_aprs_listener_rx_msg_no_position():
"""Test rx_msg with non-position report."""
with patch("aprslib.IS"):
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER
see = Mock()
sample_msg = {device_tracker.ATTR_FORMAT... | [
"def",
"test_aprs_listener_rx_msg_no_position",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS\"",
")",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_PASSWORD",
"host",
"=",
"TEST_HOST",
"server_filter",
"=",
"TEST_FILTER",
"see",
"=",
"Mock",
... | [
273,
0
] | [
297,
31
] | python | en | ['en', 'en', 'en'] | True |
test_setup_scanner | () | Test setup_scanner. | Test setup_scanner. | def test_setup_scanner():
"""Test setup_scanner."""
with patch(
"homeassistant.components.aprs.device_tracker.AprsListenerThread"
) as listener:
hass = get_test_home_assistant()
hass.start()
config = {
"username": TEST_CALLSIGN,
"password": TEST_PASSW... | [
"def",
"test_setup_scanner",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.aprs.device_tracker.AprsListenerThread\"",
")",
"as",
"listener",
":",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"hass",
".",
"start",
"(",
")",
"config",
"=",
"{",... | [
300,
0
] | [
323,
9
] | python | en | ['en', 'da', 'en'] | False |
test_setup_scanner_timeout | () | Test setup_scanner failure from timeout. | Test setup_scanner failure from timeout. | def test_setup_scanner_timeout():
"""Test setup_scanner failure from timeout."""
hass = get_test_home_assistant()
hass.start()
config = {
"username": TEST_CALLSIGN,
"password": TEST_PASSWORD,
"host": "localhost",
"timeout": 0.01,
"callsigns": ["XX0FOO*", "YY0BAR-... | [
"def",
"test_setup_scanner_timeout",
"(",
")",
":",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"hass",
".",
"start",
"(",
")",
"config",
"=",
"{",
"\"username\"",
":",
"TEST_CALLSIGN",
",",
"\"password\"",
":",
"TEST_PASSWORD",
",",
"\"host\"",
":",
"\"... | [
326,
0
] | [
343,
19
] | python | en | ['en', 'en', 'en'] | True |
Distiller.prepare_batch_mlm | (self, batch) |
Prepare the batch: from the token_ids and the lengths, compute the attention mask and the masked label for MLM.
Input:
------
batch: `Tuple`
token_ids: `torch.tensor(bs, seq_length)` - The token ids for each of the sequence. It is padded.
lengths: `t... |
Prepare the batch: from the token_ids and the lengths, compute the attention mask and the masked label for MLM. | def prepare_batch_mlm(self, batch):
"""
Prepare the batch: from the token_ids and the lengths, compute the attention mask and the masked label for MLM.
Input:
------
batch: `Tuple`
token_ids: `torch.tensor(bs, seq_length)` - The token ids for each of the sequ... | [
"def",
"prepare_batch_mlm",
"(",
"self",
",",
"batch",
")",
":",
"token_ids",
",",
"lengths",
"=",
"batch",
"token_ids",
",",
"lengths",
"=",
"self",
".",
"round_batch",
"(",
"x",
"=",
"token_ids",
",",
"lengths",
"=",
"lengths",
")",
"assert",
"token_ids"... | [
188,
4
] | [
251,
47
] | python | en | ['en', 'error', 'th'] | False |
Distiller.prepare_batch_clm | (self, batch) |
Prepare the batch: from the token_ids and the lengths, compute the attention mask and the labels for CLM.
Input:
------
batch: `Tuple`
token_ids: `torch.tensor(bs, seq_length)` - The token ids for each of the sequence. It is padded.
lengths: `torch.t... |
Prepare the batch: from the token_ids and the lengths, compute the attention mask and the labels for CLM. | def prepare_batch_clm(self, batch):
"""
Prepare the batch: from the token_ids and the lengths, compute the attention mask and the labels for CLM.
Input:
------
batch: `Tuple`
token_ids: `torch.tensor(bs, seq_length)` - The token ids for each of the sequence. ... | [
"def",
"prepare_batch_clm",
"(",
"self",
",",
"batch",
")",
":",
"token_ids",
",",
"lengths",
"=",
"batch",
"token_ids",
",",
"lengths",
"=",
"self",
".",
"round_batch",
"(",
"x",
"=",
"token_ids",
",",
"lengths",
"=",
"lengths",
")",
"assert",
"token_ids"... | [
253,
4
] | [
280,
47
] | python | en | ['en', 'error', 'th'] | False |
Distiller.round_batch | (self, x: torch.tensor, lengths: torch.tensor) |
For float16 only.
Sub-sample sentences in a batch, and add padding, so that each dimension is a multiple of 8.
Input:
------
x: `torch.tensor(bs, seq_length)` - The token ids.
lengths: `torch.tensor(bs, seq_length)` - The lengths of each of the sequence in the b... |
For float16 only.
Sub-sample sentences in a batch, and add padding, so that each dimension is a multiple of 8. | def round_batch(self, x: torch.tensor, lengths: torch.tensor):
"""
For float16 only.
Sub-sample sentences in a batch, and add padding, so that each dimension is a multiple of 8.
Input:
------
x: `torch.tensor(bs, seq_length)` - The token ids.
lengths: `to... | [
"def",
"round_batch",
"(",
"self",
",",
"x",
":",
"torch",
".",
"tensor",
",",
"lengths",
":",
"torch",
".",
"tensor",
")",
":",
"if",
"not",
"self",
".",
"fp16",
"or",
"len",
"(",
"lengths",
")",
"<",
"8",
":",
"return",
"x",
",",
"lengths",
"# ... | [
282,
4
] | [
327,
25
] | python | en | ['en', 'error', 'th'] | False |
Distiller.train | (self) |
The real training loop.
|
The real training loop.
| def train(self):
"""
The real training loop.
"""
if self.is_master:
logger.info("Starting training")
self.last_log = time.time()
self.student.train()
self.teacher.eval()
for _ in range(self.params.n_epoch):
if self.is_master:
... | [
"def",
"train",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_master",
":",
"logger",
".",
"info",
"(",
"\"Starting training\"",
")",
"self",
".",
"last_log",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"student",
".",
"train",
"(",
")",
"self",... | [
329,
4
] | [
369,
47
] | python | en | ['en', 'error', 'th'] | False |
Distiller.step | (self, input_ids: torch.tensor, attention_mask: torch.tensor, lm_labels: torch.tensor) |
One optimization step: forward of student AND teacher, backward on the loss (for gradient accumulation),
and possibly a parameter update (depending on the gradient accumulation).
Input:
------
input_ids: `torch.tensor(bs, seq_length)` - The token ids.
attention_mask: `t... |
One optimization step: forward of student AND teacher, backward on the loss (for gradient accumulation),
and possibly a parameter update (depending on the gradient accumulation). | def step(self, input_ids: torch.tensor, attention_mask: torch.tensor, lm_labels: torch.tensor):
"""
One optimization step: forward of student AND teacher, backward on the loss (for gradient accumulation),
and possibly a parameter update (depending on the gradient accumulation).
Input:
... | [
"def",
"step",
"(",
"self",
",",
"input_ids",
":",
"torch",
".",
"tensor",
",",
"attention_mask",
":",
"torch",
".",
"tensor",
",",
"lm_labels",
":",
"torch",
".",
"tensor",
")",
":",
"if",
"self",
".",
"mlm",
":",
"s_logits",
",",
"s_hidden_states",
"... | [
371,
4
] | [
465,
51
] | python | en | ['en', 'error', 'th'] | False |
Distiller.optimize | (self, loss) |
Normalization on the loss (gradient accumulation or distributed training), followed by
backward pass on the loss, possibly followed by a parameter update (depending on the gradient accumulation).
Also update the metrics for tensorboard.
|
Normalization on the loss (gradient accumulation or distributed training), followed by
backward pass on the loss, possibly followed by a parameter update (depending on the gradient accumulation).
Also update the metrics for tensorboard.
| def optimize(self, loss):
"""
Normalization on the loss (gradient accumulation or distributed training), followed by
backward pass on the loss, possibly followed by a parameter update (depending on the gradient accumulation).
Also update the metrics for tensorboard.
"""
#... | [
"def",
"optimize",
"(",
"self",
",",
"loss",
")",
":",
"# Check for NaN",
"if",
"(",
"loss",
"!=",
"loss",
")",
".",
"data",
".",
"any",
"(",
")",
":",
"logger",
".",
"error",
"(",
"\"NaN detected\"",
")",
"exit",
"(",
")",
"if",
"self",
".",
"mult... | [
467,
4
] | [
499,
33
] | python | en | ['en', 'error', 'th'] | False |
Distiller.iter | (self) |
Update global counts, write to tensorboard and save checkpoint.
|
Update global counts, write to tensorboard and save checkpoint.
| def iter(self):
"""
Update global counts, write to tensorboard and save checkpoint.
"""
self.n_iter += 1
self.n_total_iter += 1
if self.n_total_iter % self.params.log_interval == 0:
self.log_tensorboard()
self.last_log = time.time()
if sel... | [
"def",
"iter",
"(",
"self",
")",
":",
"self",
".",
"n_iter",
"+=",
"1",
"self",
".",
"n_total_iter",
"+=",
"1",
"if",
"self",
".",
"n_total_iter",
"%",
"self",
".",
"params",
".",
"log_interval",
"==",
"0",
":",
"self",
".",
"log_tensorboard",
"(",
"... | [
501,
4
] | [
512,
34
] | python | en | ['en', 'error', 'th'] | False |
Distiller.log_tensorboard | (self) |
Log into tensorboard. Only by the master process.
|
Log into tensorboard. Only by the master process.
| def log_tensorboard(self):
"""
Log into tensorboard. Only by the master process.
"""
if not self.is_master:
return
for param_name, param in self.student.named_parameters():
self.tensorboard.add_scalar(
tag="parameter_mean/" + param_name, s... | [
"def",
"log_tensorboard",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_master",
":",
"return",
"for",
"param_name",
",",
"param",
"in",
"self",
".",
"student",
".",
"named_parameters",
"(",
")",
":",
"self",
".",
"tensorboard",
".",
"add_scalar",
... | [
514,
4
] | [
573,
9
] | python | en | ['en', 'error', 'th'] | False |
Distiller.end_epoch | (self) |
Finally arrived at the end of epoch (full pass on dataset).
Do some tensorboard logging and checkpoint saving.
|
Finally arrived at the end of epoch (full pass on dataset).
Do some tensorboard logging and checkpoint saving.
| def end_epoch(self):
"""
Finally arrived at the end of epoch (full pass on dataset).
Do some tensorboard logging and checkpoint saving.
"""
logger.info(f"{self.n_sequences_epoch} sequences have been trained during this epoch.")
if self.is_master:
self.save_ch... | [
"def",
"end_epoch",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"f\"{self.n_sequences_epoch} sequences have been trained during this epoch.\"",
")",
"if",
"self",
".",
"is_master",
":",
"self",
".",
"save_checkpoint",
"(",
"checkpoint_name",
"=",
"f\"model_epoch_... | [
575,
4
] | [
591,
33
] | python | en | ['en', 'error', 'th'] | False |
Distiller.save_checkpoint | (self, checkpoint_name: str = "checkpoint.pth") |
Save the current state. Only by the master process.
|
Save the current state. Only by the master process.
| def save_checkpoint(self, checkpoint_name: str = "checkpoint.pth"):
"""
Save the current state. Only by the master process.
"""
if not self.is_master:
return
mdl_to_save = self.student.module if hasattr(self.student, "module") else self.student
mdl_to_save.con... | [
"def",
"save_checkpoint",
"(",
"self",
",",
"checkpoint_name",
":",
"str",
"=",
"\"checkpoint.pth\"",
")",
":",
"if",
"not",
"self",
".",
"is_master",
":",
"return",
"mdl_to_save",
"=",
"self",
".",
"student",
".",
"module",
"if",
"hasattr",
"(",
"self",
"... | [
593,
4
] | [
602,
77
] | python | en | ['en', 'error', 'th'] | False |
PilightBaseDevice.__init__ | (self, hass, name, config) | Initialize a device. | Initialize a device. | def __init__(self, hass, name, config):
"""Initialize a device."""
self._hass = hass
self._name = config.get(CONF_NAME, name)
self._is_on = False
self._code_on = config.get(CONF_ON_CODE)
self._code_off = config.get(CONF_OFF_CODE)
code_on_receive = config.get(CONF... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"name",
",",
"config",
")",
":",
"self",
".",
"_hass",
"=",
"hass",
"self",
".",
"_name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
",",
"name",
")",
"self",
".",
"_is_on",
"=",
"False",
"self",
... | [
58,
4
] | [
83,
30
] | python | en | ['es', 'en', 'en'] | True |
PilightBaseDevice.async_added_to_hass | (self) | Call when entity about to be added to hass. | Call when entity about to be added to hass. | async def async_added_to_hass(self):
"""Call when entity about to be added to hass."""
await super().async_added_to_hass()
state = await self.async_get_last_state()
if state:
self._is_on = state.state == STATE_ON
self._brightness = state.attributes.get("brightness... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"state",
"=",
"await",
"self",
".",
"async_get_last_state",
"(",
")",
"if",
"state",
":",
"self",
".",
"_is_on",
"=",
"state",
... | [
85,
4
] | [
91,
65
] | python | en | ['en', 'en', 'en'] | True |
PilightBaseDevice.name | (self) | Get the name of the switch. | Get the name of the switch. | def name(self):
"""Get the name of the switch."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
94,
4
] | [
96,
25
] | python | en | ['en', 'en', 'en'] | True |
PilightBaseDevice.should_poll | (self) | No polling needed, state set when correct code is received. | No polling needed, state set when correct code is received. | def should_poll(self):
"""No polling needed, state set when correct code is received."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
99,
4
] | [
101,
20
] | python | en | ['en', 'en', 'en'] | True |
PilightBaseDevice.assumed_state | (self) | Return True if unable to access real state of the entity. | Return True if unable to access real state of the entity. | def assumed_state(self):
"""Return True if unable to access real state of the entity."""
return True | [
"def",
"assumed_state",
"(",
"self",
")",
":",
"return",
"True"
] | [
104,
4
] | [
106,
19
] | python | en | ['en', 'en', 'en'] | True |
PilightBaseDevice.is_on | (self) | Return true if switch is on. | Return true if switch is on. | def is_on(self):
"""Return true if switch is on."""
return self._is_on | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_on"
] | [
109,
4
] | [
111,
26
] | python | en | ['en', 'fy', 'en'] | True |
PilightBaseDevice._handle_code | (self, call) | Check if received code by the pilight-daemon.
If the code matches the receive on/off codes of this switch the switch
state is changed accordingly.
| Check if received code by the pilight-daemon. | def _handle_code(self, call):
"""Check if received code by the pilight-daemon.
If the code matches the receive on/off codes of this switch the switch
state is changed accordingly.
"""
# - True if off_code/on_code is contained in received code dict, not
# all items have... | [
"def",
"_handle_code",
"(",
"self",
",",
"call",
")",
":",
"# - True if off_code/on_code is contained in received code dict, not",
"# all items have to match.",
"# - Call turn on/off only once, even if more than one code is received",
"if",
"any",
"(",
"self",
".",
"_code_on_receiv... | [
113,
4
] | [
132,
25
] | python | en | ['en', 'en', 'en'] | True |
PilightBaseDevice.set_state | (self, turn_on, send_code=True, dimlevel=None) | Set the state of the switch.
This sets the state of the switch. If send_code is set to True, then
it will call the pilight.send service to actually send the codes
to the pilight daemon.
| Set the state of the switch. | def set_state(self, turn_on, send_code=True, dimlevel=None):
"""Set the state of the switch.
This sets the state of the switch. If send_code is set to True, then
it will call the pilight.send service to actually send the codes
to the pilight daemon.
"""
if send_code:
... | [
"def",
"set_state",
"(",
"self",
",",
"turn_on",
",",
"send_code",
"=",
"True",
",",
"dimlevel",
"=",
"None",
")",
":",
"if",
"send_code",
":",
"if",
"turn_on",
":",
"code",
"=",
"self",
".",
"_code_on",
"if",
"dimlevel",
"is",
"not",
"None",
":",
"c... | [
134,
4
] | [
154,
39
] | python | en | ['en', 'en', 'en'] | True |
PilightBaseDevice.turn_on | (self, **kwargs) | Turn the switch on by calling pilight.send service with on code. | Turn the switch on by calling pilight.send service with on code. | def turn_on(self, **kwargs):
"""Turn the switch on by calling pilight.send service with on code."""
self.set_state(turn_on=True) | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"set_state",
"(",
"turn_on",
"=",
"True",
")"
] | [
156,
4
] | [
158,
36
] | python | en | ['en', 'en', 'en'] | True |
PilightBaseDevice.turn_off | (self, **kwargs) | Turn the switch on by calling pilight.send service with off code. | Turn the switch on by calling pilight.send service with off code. | def turn_off(self, **kwargs):
"""Turn the switch on by calling pilight.send service with off code."""
self.set_state(turn_on=False) | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"set_state",
"(",
"turn_on",
"=",
"False",
")"
] | [
160,
4
] | [
162,
37
] | python | en | ['en', 'en', 'en'] | True |
_ReceiveHandle.__init__ | (self, config, echo) | Initialize the handle. | Initialize the handle. | def __init__(self, config, echo):
"""Initialize the handle."""
self.config_items = config.items()
self.echo = echo | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"echo",
")",
":",
"self",
".",
"config_items",
"=",
"config",
".",
"items",
"(",
")",
"self",
".",
"echo",
"=",
"echo"
] | [
166,
4
] | [
169,
24
] | python | en | ['en', 'en', 'en'] | True |
_ReceiveHandle.match | (self, code) | Test if the received code matches the configured values.
The received values have to be a subset of the configured options.
| Test if the received code matches the configured values. | def match(self, code):
"""Test if the received code matches the configured values.
The received values have to be a subset of the configured options.
"""
return self.config_items <= code.items() | [
"def",
"match",
"(",
"self",
",",
"code",
")",
":",
"return",
"self",
".",
"config_items",
"<=",
"code",
".",
"items",
"(",
")"
] | [
171,
4
] | [
176,
48
] | python | en | ['en', 'en', 'en'] | True |
_ReceiveHandle.run | (self, switch, turn_on) | Change the state of the switch. | Change the state of the switch. | def run(self, switch, turn_on):
"""Change the state of the switch."""
switch.set_state(turn_on=turn_on, send_code=self.echo) | [
"def",
"run",
"(",
"self",
",",
"switch",
",",
"turn_on",
")",
":",
"switch",
".",
"set_state",
"(",
"turn_on",
"=",
"turn_on",
",",
"send_code",
"=",
"self",
".",
"echo",
")"
] | [
178,
4
] | [
180,
62
] | python | en | ['en', 'en', 'en'] | True |
BatchTransform.__init__ | (self, only_trial_data=True) |
Batch transforms are operations that are performed on trial tensors after being accumulated into batches via the
:meth:`__call__` method. Ideally this is implemented with pytorch operations for ease of execution graph
integration.
|
Batch transforms are operations that are performed on trial tensors after being accumulated into batches via the
:meth:`__call__` method. Ideally this is implemented with pytorch operations for ease of execution graph
integration.
| def __init__(self, only_trial_data=True):
"""
Batch transforms are operations that are performed on trial tensors after being accumulated into batches via the
:meth:`__call__` method. Ideally this is implemented with pytorch operations for ease of execution graph
integration.
"""... | [
"def",
"__init__",
"(",
"self",
",",
"only_trial_data",
"=",
"True",
")",
":",
"self",
".",
"only_trial_data",
"=",
"only_trial_data"
] | [
6,
4
] | [
12,
46
] | python | en | ['en', 'error', 'th'] | False |
BatchTransform.__call__ | (self, *x, training=False) |
Modifies a batch of tensors.
Parameters
----------
x : torch.Tensor, tuple
A batch of trial instance tensor. If initialized with `only_trial_data=False`, then this includes batches
of all other loaded tensors as well.
training: bool
Ind... |
Modifies a batch of tensors. | def __call__(self, *x, training=False):
"""
Modifies a batch of tensors.
Parameters
----------
x : torch.Tensor, tuple
A batch of trial instance tensor. If initialized with `only_trial_data=False`, then this includes batches
of all other loaded tensors as... | [
"def",
"__call__",
"(",
"self",
",",
"*",
"x",
",",
"training",
"=",
"False",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
17,
4
] | [
35,
35
] | python | en | ['en', 'error', 'th'] | False |
RandomTemporalCrop.__init__ | (self, max_crop_frac=0.25, temporal_axis=1) |
Uniformly crops the time-dimensions of a batch.
Parameters
----------
max_crop_frac: float
The is the maximum fraction to crop off of the trial.
|
Uniformly crops the time-dimensions of a batch. | def __init__(self, max_crop_frac=0.25, temporal_axis=1):
"""
Uniformly crops the time-dimensions of a batch.
Parameters
----------
max_crop_frac: float
The is the maximum fraction to crop off of the trial.
"""
super(RandomTemporalCrop, self... | [
"def",
"__init__",
"(",
"self",
",",
"max_crop_frac",
"=",
"0.25",
",",
"temporal_axis",
"=",
"1",
")",
":",
"super",
"(",
"RandomTemporalCrop",
",",
"self",
")",
".",
"__init__",
"(",
"only_trial_data",
"=",
"True",
")",
"assert",
"0",
"<",
"max_crop_frac... | [
40,
4
] | [
52,
42
] | python | en | ['en', 'error', 'th'] | False |
RandomTemporalEndCrop.__init__ | (self, end_crop_frac=0.25, crop_weights=None, temporal_axis=1) |
Crops the time dimension of an entire batch.
Parameters
----------
end_crop_frac: float
If this is specified (and `crop_weights` is not), a crop end is selected uniformly from the
last `max_crop_frac` indices.
crop_weights: list, a... |
Crops the time dimension of an entire batch. | def __init__(self, end_crop_frac=0.25, crop_weights=None, temporal_axis=1):
"""
Crops the time dimension of an entire batch.
Parameters
----------
end_crop_frac: float
If this is specified (and `crop_weights` is not), a crop end is selected uniformly from ... | [
"def",
"__init__",
"(",
"self",
",",
"end_crop_frac",
"=",
"0.25",
",",
"crop_weights",
"=",
"None",
",",
"temporal_axis",
"=",
"1",
")",
":",
"super",
"(",
"RandomTemporalEndCrop",
",",
"self",
")",
".",
"__init__",
"(",
"only_trial_data",
"=",
"True",
")... | [
67,
4
] | [
83,
42
] | python | en | ['en', 'error', 'th'] | False |
test_async_setup_entry_default | (hass) | Test async_setup_entry. | Test async_setup_entry. | async def test_async_setup_entry_default(hass):
"""Test async_setup_entry."""
udn = "uuid:device_1"
mock_device = MockDevice(udn)
discovery_infos = [
{
DISCOVERY_UDN: mock_device.udn,
DISCOVERY_ST: mock_device.device_type,
DISCOVERY_LOCATION: "http://192.168.1... | [
"async",
"def",
"test_async_setup_entry_default",
"(",
"hass",
")",
":",
"udn",
"=",
"\"uuid:device_1\"",
"mock_device",
"=",
"MockDevice",
"(",
"udn",
")",
"discovery_infos",
"=",
"[",
"{",
"DISCOVERY_UDN",
":",
"mock_device",
".",
"udn",
",",
"DISCOVERY_ST",
"... | [
18,
0
] | [
52,
42
] | python | en | ['en', 'be', 'en'] | False |
SimpleStore.capacity | (self) | Store capacity.
If negative, the store grows without bound. Otherwise, the number of items in the store will not exceed
this capacity.
| Store capacity. | def capacity(self):
"""Store capacity.
If negative, the store grows without bound. Otherwise, the number of items in the store will not exceed
this capacity.
"""
return self._capacity | [
"def",
"capacity",
"(",
"self",
")",
":",
"return",
"self",
".",
"_capacity"
] | [
68,
4
] | [
74,
29
] | python | en | ['en', 'sn', 'en'] | False |
SimpleStore.overwrite_type | (self) | An ``OverwriteType`` member indicating the overwrite behavior when the store capacity is exceeded. | An ``OverwriteType`` member indicating the overwrite behavior when the store capacity is exceeded. | def overwrite_type(self):
"""An ``OverwriteType`` member indicating the overwrite behavior when the store capacity is exceeded."""
return self._overwrite_type | [
"def",
"overwrite_type",
"(",
"self",
")",
":",
"return",
"self",
".",
"_overwrite_type"
] | [
77,
4
] | [
79,
35
] | python | en | ['en', 'en', 'en'] | True |
SimpleStore.put | (self, contents: Dict[str, List], overwrite_indexes: list = None) | Put new contents in the store.
Args:
contents (dict): Dictionary of items to add to the store. If the store is not empty, this must have the
same keys as the store itself. Otherwise an ``StoreMisalignment`` will be raised.
overwrite_indexes (list, optional): Indexes wher... | Put new contents in the store. | def put(self, contents: Dict[str, List], overwrite_indexes: list = None) -> List[int]:
"""Put new contents in the store.
Args:
contents (dict): Dictionary of items to add to the store. If the store is not empty, this must have the
same keys as the store itself. Otherwise an ... | [
"def",
"put",
"(",
"self",
",",
"contents",
":",
"Dict",
"[",
"str",
",",
"List",
"]",
",",
"overwrite_indexes",
":",
"list",
"=",
"None",
")",
"->",
"List",
"[",
"int",
"]",
":",
"if",
"len",
"(",
"self",
".",
"_store",
")",
">",
"0",
"and",
"... | [
84,
4
] | [
111,
32
] | python | en | ['en', 'en', 'en'] | True |
SimpleStore.update | (self, indexes: list, contents: Dict[str, List]) |
Update contents at given positions.
Args:
indexes (list): Positions where updates are to be made.
contents (dict): Contents to write to the internal store at given positions. It is subject to
uniformity checks to ensure that all values have the same length.
... |
Update contents at given positions. | def update(self, indexes: list, contents: Dict[str, List]):
"""
Update contents at given positions.
Args:
indexes (list): Positions where updates are to be made.
contents (dict): Contents to write to the internal store at given positions. It is subject to
... | [
"def",
"update",
"(",
"self",
",",
"indexes",
":",
"list",
",",
"contents",
":",
"Dict",
"[",
"str",
",",
"List",
"]",
")",
":",
"self",
".",
"validate",
"(",
"contents",
")",
"for",
"key",
",",
"val",
"in",
"contents",
".",
"items",
"(",
")",
":... | [
113,
4
] | [
130,
22
] | python | en | ['en', 'error', 'th'] | False |
SimpleStore.apply_multi_filters | (self, filters: List[Callable]) | Multi-filter method.
The input to one filter is the output from its predecessor in the sequence.
Args:
filters (List[Callable]): Filter list, each item is a lambda function,
e.g., [lambda d: d['a'] == 1 and d['b'] == 1].
Returns:
Filtered indexes and... | Multi-filter method. | def apply_multi_filters(self, filters: List[Callable]):
"""Multi-filter method.
The input to one filter is the output from its predecessor in the sequence.
Args:
filters (List[Callable]): Filter list, each item is a lambda function,
e.g., [lambda d: d['a'] == 1 ... | [
"def",
"apply_multi_filters",
"(",
"self",
",",
"filters",
":",
"List",
"[",
"Callable",
"]",
")",
":",
"indexes",
"=",
"range",
"(",
"self",
".",
"_size",
")",
"for",
"f",
"in",
"filters",
":",
"indexes",
"=",
"[",
"i",
"for",
"i",
"in",
"indexes",
... | [
132,
4
] | [
147,
41
] | python | en | ['en', 'et', 'en'] | False |
SimpleStore.apply_multi_samplers | (self, samplers: list, replace: bool = True) | Multi-samplers method.
This implements chained sampling where the input to one sampler is the output from its predecessor in
the sequence.
Args:
samplers (list): A sequence of weight functions for computing the sampling weights of the items
in the store,
... | Multi-samplers method. | def apply_multi_samplers(self, samplers: list, replace: bool = True) -> Tuple:
"""Multi-samplers method.
This implements chained sampling where the input to one sampler is the output from its predecessor in
the sequence.
Args:
samplers (list): A sequence of weight functions... | [
"def",
"apply_multi_samplers",
"(",
"self",
",",
"samplers",
":",
"list",
",",
"replace",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
":",
"indexes",
"=",
"range",
"(",
"self",
".",
"_size",
")",
"for",
"weight_fn",
",",
"sample_size",
"in",
"samplers"... | [
149,
4
] | [
168,
41
] | python | en | ['en', 'et', 'en'] | False |
SimpleStore.sample | (self, size, weights: Union[list, np.ndarray] = None, replace: bool = True) |
Obtain a random sample from the experience pool.
Args:
size (int): Sample sizes for each round of sampling in the chain. If this is a single integer, it is
used as the sample size for all samplers in the chain.
weights (Union[list, np.ndarray]): Sampling... |
Obtain a random sample from the experience pool. | def sample(self, size, weights: Union[list, np.ndarray] = None, replace: bool = True):
"""
Obtain a random sample from the experience pool.
Args:
size (int): Sample sizes for each round of sampling in the chain. If this is a single integer, it is
used as the ... | [
"def",
"sample",
"(",
"self",
",",
"size",
",",
"weights",
":",
"Union",
"[",
"list",
",",
"np",
".",
"ndarray",
"]",
"=",
"None",
",",
"replace",
":",
"bool",
"=",
"True",
")",
":",
"if",
"weights",
"is",
"not",
"None",
":",
"weights",
"=",
"np"... | [
170,
4
] | [
187,
41
] | python | en | ['en', 'error', 'th'] | False |
SimpleStore.sample_by_key | (self, key, size: int, replace: bool = True) |
Obtain a random sample from the store using one of the columns as sampling weights.
Args:
key: The column whose values are to be used as sampling weights.
size (int): Sample size.
replace (bool): If True, sampling is performed with replacement.
Returns:
... |
Obtain a random sample from the store using one of the columns as sampling weights. | def sample_by_key(self, key, size: int, replace: bool = True):
"""
Obtain a random sample from the store using one of the columns as sampling weights.
Args:
key: The column whose values are to be used as sampling weights.
size (int): Sample size.
replace (boo... | [
"def",
"sample_by_key",
"(",
"self",
",",
"key",
",",
"size",
":",
"int",
",",
"replace",
":",
"bool",
"=",
"True",
")",
":",
"weights",
"=",
"np",
".",
"asarray",
"(",
"self",
".",
"_store",
"[",
"key",
"]",
"[",
":",
"self",
".",
"_size",
"]",
... | [
189,
4
] | [
202,
41
] | python | en | ['en', 'error', 'th'] | False |
SimpleStore.sample_by_keys | (self, keys: list, sizes: list, replace: bool = True) |
Obtain a random sample from the store by chained sampling using multiple columns as sampling weights.
Args:
keys (list): The column whose values are to be used as sampling weights.
sizes (list): Sample size.
replace (bool): If True, sampling is performed with replac... |
Obtain a random sample from the store by chained sampling using multiple columns as sampling weights. | def sample_by_keys(self, keys: list, sizes: list, replace: bool = True):
"""
Obtain a random sample from the store by chained sampling using multiple columns as sampling weights.
Args:
keys (list): The column whose values are to be used as sampling weights.
sizes (list):... | [
"def",
"sample_by_keys",
"(",
"self",
",",
"keys",
":",
"list",
",",
"sizes",
":",
"list",
",",
"replace",
":",
"bool",
"=",
"True",
")",
":",
"if",
"len",
"(",
"keys",
")",
"!=",
"len",
"(",
"sizes",
")",
":",
"raise",
"ValueError",
"(",
"f\"expec... | [
204,
4
] | [
223,
41
] | python | en | ['en', 'error', 'th'] | False |
SimpleStore.clear | (self) | Empty the store. | Empty the store. | def clear(self):
"""Empty the store."""
self._store = {key: [] if self._capacity < 0 else [None] * self._capacity for key in self._keys}
self._size = 0
self._iter_index = 0 | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_store",
"=",
"{",
"key",
":",
"[",
"]",
"if",
"self",
".",
"_capacity",
"<",
"0",
"else",
"[",
"None",
"]",
"*",
"self",
".",
"_capacity",
"for",
"key",
"in",
"self",
".",
"_keys",
"}",
"sel... | [
225,
4
] | [
229,
28
] | python | en | ['en', 'sr', 'en'] | True |
SimpleStore.dumps | (self) | Return a deep copy of store contents. | Return a deep copy of store contents. | def dumps(self):
"""Return a deep copy of store contents."""
return clone(dict(self._store)) | [
"def",
"dumps",
"(",
"self",
")",
":",
"return",
"clone",
"(",
"dict",
"(",
"self",
".",
"_store",
")",
")"
] | [
231,
4
] | [
233,
39
] | python | en | ['en', 'ca', 'en'] | True |
SimpleStore.get_by_key | (self, key) | Get the contents of the store corresponding to ``key``. | Get the contents of the store corresponding to ``key``. | def get_by_key(self, key):
"""Get the contents of the store corresponding to ``key``."""
return self._store[key] | [
"def",
"get_by_key",
"(",
"self",
",",
"key",
")",
":",
"return",
"self",
".",
"_store",
"[",
"key",
"]"
] | [
235,
4
] | [
237,
31
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (
hass, hass_config, async_add_entities, discovery_info=None
) | Set up the LCN climate platform. | Set up the LCN climate platform. | async def async_setup_platform(
hass, hass_config, async_add_entities, discovery_info=None
):
"""Set up the LCN climate platform."""
if discovery_info is None:
return
devices = []
for config in discovery_info:
address, connection_id = config[CONF_ADDRESS]
addr = pypck.lcn_ad... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"hass_config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"devices",
"=",
"[",
"]",
"for",
"config",
"in",
"discovery_i... | [
20,
0
] | [
37,
31
] | python | en | ['en', 'da', 'en'] | True |
LcnClimate.__init__ | (self, config, address_connection) | Initialize of a LCN climate device. | Initialize of a LCN climate device. | def __init__(self, config, address_connection):
"""Initialize of a LCN climate device."""
super().__init__(config, address_connection)
self.variable = pypck.lcn_defs.Var[config[CONF_SOURCE]]
self.setpoint = pypck.lcn_defs.Var[config[CONF_SETPOINT]]
self.unit = pypck.lcn_defs.Var... | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"address_connection",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"config",
",",
"address_connection",
")",
"self",
".",
"variable",
"=",
"pypck",
".",
"lcn_defs",
".",
"Var",
"[",
"config",
"[",... | [
43,
4
] | [
58,
26
] | python | en | ['en', 'en', 'en'] | True |
LcnClimate.async_added_to_hass | (self) | Run when entity about to be added to hass. | Run when entity about to be added to hass. | async def async_added_to_hass(self):
"""Run when entity about to be added to hass."""
await super().async_added_to_hass()
await self.address_connection.activate_status_request_handler(self.variable)
await self.address_connection.activate_status_request_handler(self.setpoint) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"await",
"self",
".",
"address_connection",
".",
"activate_status_request_handler",
"(",
"self",
".",
"variable",
")",
"await",
"self"... | [
60,
4
] | [
64,
84
] | python | en | ['en', 'en', 'en'] | True |
LcnClimate.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
return const.SUPPORT_TARGET_TEMPERATURE | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"const",
".",
"SUPPORT_TARGET_TEMPERATURE"
] | [
67,
4
] | [
69,
47
] | python | en | ['en', 'en', 'en'] | True |
LcnClimate.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
return self.unit.value | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"self",
".",
"unit",
".",
"value"
] | [
72,
4
] | [
74,
30
] | python | en | ['en', 'la', 'en'] | True |
LcnClimate.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._current_temperature | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_temperature"
] | [
77,
4
] | [
79,
40
] | python | en | ['en', 'la', 'en'] | True |
LcnClimate.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
return self._target_temperature | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_target_temperature"
] | [
82,
4
] | [
84,
39
] | python | en | ['en', 'en', 'en'] | True |
LcnClimate.hvac_mode | (self) | Return hvac operation ie. heat, cool mode.
Need to be one of HVAC_MODE_*.
| Return hvac operation ie. heat, cool mode. | def hvac_mode(self):
"""Return hvac operation ie. heat, cool mode.
Need to be one of HVAC_MODE_*.
"""
if self._is_on:
return const.HVAC_MODE_HEAT
return const.HVAC_MODE_OFF | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_on",
":",
"return",
"const",
".",
"HVAC_MODE_HEAT",
"return",
"const",
".",
"HVAC_MODE_OFF"
] | [
87,
4
] | [
94,
34
] | python | bg | ['en', 'bg', 'bg'] | True |
LcnClimate.hvac_modes | (self) | Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
| Return the list of available hvac operation modes. | def hvac_modes(self):
"""Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
"""
modes = [const.HVAC_MODE_HEAT]
if self.is_lockable:
modes.append(const.HVAC_MODE_OFF)
return modes | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"modes",
"=",
"[",
"const",
".",
"HVAC_MODE_HEAT",
"]",
"if",
"self",
".",
"is_lockable",
":",
"modes",
".",
"append",
"(",
"const",
".",
"HVAC_MODE_OFF",
")",
"return",
"modes"
] | [
97,
4
] | [
105,
20
] | python | en | ['en', 'en', 'en'] | True |
LcnClimate.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
return self._max_temp | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_max_temp"
] | [
108,
4
] | [
110,
29
] | python | en | ['en', 'la', 'en'] | True |
LcnClimate.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
return self._min_temp | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_min_temp"
] | [
113,
4
] | [
115,
29
] | python | en | ['en', 'la', 'en'] | True |
LcnClimate.async_set_hvac_mode | (self, hvac_mode) | Set new target hvac mode. | Set new target hvac mode. | async def async_set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
if hvac_mode == const.HVAC_MODE_HEAT:
self._is_on = True
self.address_connection.lock_regulator(self.regulator_id, False)
elif hvac_mode == const.HVAC_MODE_OFF:
self._is_on = False... | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"if",
"hvac_mode",
"==",
"const",
".",
"HVAC_MODE_HEAT",
":",
"self",
".",
"_is_on",
"=",
"True",
"self",
".",
"address_connection",
".",
"lock_regulator",
"(",
"self",
".",
"reg... | [
117,
4
] | [
127,
35
] | python | da | ['da', 'su', 'en'] | False |
LcnClimate.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
temperature = kwargs.get(ATTR_TEMPERATURE)
if temperature is None:
return
self._target_temperature = temperature
self.address_connection.var_abs(
self.setpoint, self._targe... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"temperature",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"if",
"temperature",
"is",
"None",
":",
"return",
"self",
".",
"_target_temperature",
"=",
"tempe... | [
129,
4
] | [
139,
35
] | python | en | ['en', 'ca', 'en'] | True |
LcnClimate.input_received | (self, input_obj) | Set temperature value when LCN input object is received. | Set temperature value when LCN input object is received. | def input_received(self, input_obj):
"""Set temperature value when LCN input object is received."""
if not isinstance(input_obj, pypck.inputs.ModStatusVar):
return
if input_obj.get_var() == self.variable:
self._current_temperature = input_obj.get_value().to_var_unit(self... | [
"def",
"input_received",
"(",
"self",
",",
"input_obj",
")",
":",
"if",
"not",
"isinstance",
"(",
"input_obj",
",",
"pypck",
".",
"inputs",
".",
"ModStatusVar",
")",
":",
"return",
"if",
"input_obj",
".",
"get_var",
"(",
")",
"==",
"self",
".",
"variable... | [
141,
4
] | [
153,
35
] | python | en | ['en', 'en', 'en'] | True |
MockStartPairingResponse.__init__ | (self, ch_type: int, token: int) | Initialize mock start pairing response. | Initialize mock start pairing response. | def __init__(self, ch_type: int, token: int) -> None:
"""Initialize mock start pairing response."""
self.ch_type = ch_type
self.token = token | [
"def",
"__init__",
"(",
"self",
",",
"ch_type",
":",
"int",
",",
"token",
":",
"int",
")",
"->",
"None",
":",
"self",
".",
"ch_type",
"=",
"ch_type",
"self",
".",
"token",
"=",
"token"
] | [
48,
4
] | [
51,
26
] | python | en | ['fr', 'jv', 'en'] | False |
MockCompletePairingResponse.__init__ | (self, auth_token: str) | Initialize mock complete pairing response. | Initialize mock complete pairing response. | def __init__(self, auth_token: str) -> None:
"""Initialize mock complete pairing response."""
self.auth_token = auth_token | [
"def",
"__init__",
"(",
"self",
",",
"auth_token",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"auth_token",
"=",
"auth_token"
] | [
57,
4
] | [
59,
36
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up a sensor for an Lupusec device. | Set up a sensor for an Lupusec device. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up a sensor for an Lupusec device."""
if discovery_info is None:
return
data = hass.data[LUPUSEC_DOMAIN]
device_types = [CONST.TYPE_OPENING]
devices = []
for device in data.lupusec.get_devices(generic_type=dev... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"data",
"=",
"hass",
".",
"data",
"[",
"LUPUSEC_DOMAIN",
"]",
"device_types",
"=",
... | [
12,
0
] | [
25,
25
] | python | en | ['en', 'su', 'en'] | True |
LupusecBinarySensor.is_on | (self) | Return True if the binary sensor is on. | Return True if the binary sensor is on. | def is_on(self):
"""Return True if the binary sensor is on."""
return self._device.is_on | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"is_on"
] | [
32,
4
] | [
34,
33
] | python | en | ['en', 'fy', 'en'] | True |
LupusecBinarySensor.device_class | (self) | Return the class of the binary sensor. | Return the class of the binary sensor. | def device_class(self):
"""Return the class of the binary sensor."""
if self._device.generic_type not in DEVICE_CLASSES:
return None
return self._device.generic_type | [
"def",
"device_class",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
".",
"generic_type",
"not",
"in",
"DEVICE_CLASSES",
":",
"return",
"None",
"return",
"self",
".",
"_device",
".",
"generic_type"
] | [
37,
4
] | [
41,
40
] | python | en | ['en', 'tg', 'en'] | True |
device_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def device_reg(hass):
"""Return an empty, loaded, registry."""
return mock_device_registry(hass) | [
"def",
"device_reg",
"(",
"hass",
")",
":",
"return",
"mock_device_registry",
"(",
"hass",
")"
] | [
27,
0
] | [
29,
37
] | python | en | ['en', 'fy', 'en'] | True |
entity_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def entity_reg(hass):
"""Return an empty, loaded, registry."""
return mock_registry(hass) | [
"def",
"entity_reg",
"(",
"hass",
")",
":",
"return",
"mock_registry",
"(",
"hass",
")"
] | [
33,
0
] | [
35,
30
] | python | en | ['en', 'fy', 'en'] | True |
calls | (hass) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
")",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
39,
0
] | [
41,
57
] | python | en | ['en', 'en', 'en'] | True |
setup_zone | (hass) | Create test zone. | Create test zone. | def setup_zone(hass):
"""Create test zone."""
hass.loop.run_until_complete(
async_setup_component(
hass,
zone.DOMAIN,
{
"zone": {
"name": "test",
"latitude": HOME_LATITUDE,
"longitude": HOME_L... | [
"def",
"setup_zone",
"(",
"hass",
")",
":",
"hass",
".",
"loop",
".",
"run_until_complete",
"(",
"async_setup_component",
"(",
"hass",
",",
"zone",
".",
"DOMAIN",
",",
"{",
"\"zone\"",
":",
"{",
"\"name\"",
":",
"\"test\"",
",",
"\"latitude\"",
":",
"HOME_... | [
45,
0
] | [
60,
5
] | python | co | ['pl', 'co', 'en'] | False |
test_get_triggers | (hass, device_reg, entity_reg) | Test we get the expected triggers from a device_tracker. | Test we get the expected triggers from a device_tracker. | async def test_get_triggers(hass, device_reg, entity_reg):
"""Test we get the expected triggers from a device_tracker."""
config_entry = MockConfigEntry(domain="test", data={})
config_entry.add_to_hass(hass)
device_entry = device_reg.async_get_or_create(
config_entry_id=config_entry.entry_id,
... | [
"async",
"def",
"test_get_triggers",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"test\"",
",",
"data",
"=",
"{",
"}",
")",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
... | [
63,
0
] | [
89,
50
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_zone_change | (hass, calls) | Test for enter and leave triggers firing. | Test for enter and leave triggers firing. | async def test_if_fires_on_zone_change(hass, calls):
"""Test for enter and leave triggers firing."""
hass.states.async_set(
"device_tracker.entity",
"state",
{"latitude": AWAY_LATITUDE, "longitude": AWAY_LONGITUDE},
)
assert await async_setup_component(
hass,
aut... | [
"async",
"def",
"test_if_fires_on_zone_change",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"device_tracker.entity\"",
",",
"\"state\"",
",",
"{",
"\"latitude\"",
":",
"AWAY_LATITUDE",
",",
"\"longitude\"",
":",
"AWAY_LONGI... | [
92,
0
] | [
171,
5
] | python | en | ['en', 'en', 'en'] | True |
test_get_trigger_capabilities | (hass, device_reg, entity_reg) | Test we get the expected capabilities from a device_tracker trigger. | Test we get the expected capabilities from a device_tracker trigger. | async def test_get_trigger_capabilities(hass, device_reg, entity_reg):
"""Test we get the expected capabilities from a device_tracker trigger."""
config_entry = MockConfigEntry(domain="test", data={})
config_entry.add_to_hass(hass)
device_entry = device_reg.async_get_or_create(
config_entry_id=c... | [
"async",
"def",
"test_get_trigger_capabilities",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"test\"",
",",
"data",
"=",
"{",
"}",
")",
"config_entry",
".",
"add_to_hass",
"(",
"has... | [
174,
0
] | [
204,
5
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the ecoal sensors. | Set up the ecoal sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the ecoal sensors."""
if discovery_info is None:
return
devices = []
ecoal_contr = hass.data[DATA_ECOAL_BOILER]
for sensor_id in discovery_info:
name = AVAILABLE_SENSORS[sensor_id]
devices.append(E... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"devices",
"=",
"[",
"]",
"ecoal_contr",
"=",
"hass",
".",
"data",
"[",
"DATA_ECOAL... | [
7,
0
] | [
16,
31
] | python | en | ['en', 'bg', 'en'] | True |
EcoalTempSensor.__init__ | (self, ecoal_contr, name, status_attr) | Initialize the sensor. | Initialize the sensor. | def __init__(self, ecoal_contr, name, status_attr):
"""Initialize the sensor."""
self._ecoal_contr = ecoal_contr
self._name = name
self._status_attr = status_attr
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"ecoal_contr",
",",
"name",
",",
"status_attr",
")",
":",
"self",
".",
"_ecoal_contr",
"=",
"ecoal_contr",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_status_attr",
"=",
"status_attr",
"self",
".",
"_state",
"=",
... | [
22,
4
] | [
27,
26
] | python | en | ['en', 'en', 'en'] | True |
EcoalTempSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
30,
4
] | [
32,
25
] | python | en | ['en', 'mi', 'en'] | True |
EcoalTempSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
35,
4
] | [
37,
26
] | 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.