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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
TestWorkdaySetup.test_config_remove_named_holidays_xmas | (self, mock_date) | Test if removed by name holidays are reported correctly. | Test if removed by name holidays are reported correctly. | def test_config_remove_named_holidays_xmas(self, mock_date):
"""Test if removed by name holidays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(
self.hass, "binary_sensor", self.config_remove_named_holidays
)
s... | [
"def",
"test_config_remove_named_holidays_xmas",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"conf... | [
335,
4
] | [
345,
35
] | python | en | ['en', 'en', 'en'] | True |
async_load_adapters | () | Load adapters. | Load adapters. | async def async_load_adapters() -> list[Adapter]:
"""Load adapters."""
source_ip = async_get_source_ip(MDNS_TARGET_IP)
source_ip_address = ip_address(source_ip) if source_ip else None
ha_adapters: list[Adapter] = [
_ifaddr_adapter_to_ha(adapter, source_ip_address)
for adapter in ifaddr.... | [
"async",
"def",
"async_load_adapters",
"(",
")",
"->",
"list",
"[",
"Adapter",
"]",
":",
"source_ip",
"=",
"async_get_source_ip",
"(",
"MDNS_TARGET_IP",
")",
"source_ip_address",
"=",
"ip_address",
"(",
"source_ip",
")",
"if",
"source_ip",
"else",
"None",
"ha_ad... | [
18,
0
] | [
33,
22
] | python | en | ['en', 'en', 'en'] | False |
enable_adapters | (adapters: list[Adapter], enabled_interfaces: list[str]) | Enable configured adapters. | Enable configured adapters. | def enable_adapters(adapters: list[Adapter], enabled_interfaces: list[str]) -> bool:
"""Enable configured adapters."""
_reset_enabled_adapters(adapters)
if not enabled_interfaces:
return False
found_adapter = False
for adapter in adapters:
if adapter["name"] in enabled_interfaces:
... | [
"def",
"enable_adapters",
"(",
"adapters",
":",
"list",
"[",
"Adapter",
"]",
",",
"enabled_interfaces",
":",
"list",
"[",
"str",
"]",
")",
"->",
"bool",
":",
"_reset_enabled_adapters",
"(",
"adapters",
")",
"if",
"not",
"enabled_interfaces",
":",
"return",
"... | [
36,
0
] | [
49,
24
] | python | en | ['en', 'en', 'en'] | True |
enable_auto_detected_adapters | (adapters: list[Adapter]) | Enable auto detected adapters. | Enable auto detected adapters. | def enable_auto_detected_adapters(adapters: list[Adapter]) -> None:
"""Enable auto detected adapters."""
enable_adapters(
adapters, [adapter["name"] for adapter in adapters if adapter["auto"]]
) | [
"def",
"enable_auto_detected_adapters",
"(",
"adapters",
":",
"list",
"[",
"Adapter",
"]",
")",
"->",
"None",
":",
"enable_adapters",
"(",
"adapters",
",",
"[",
"adapter",
"[",
"\"name\"",
"]",
"for",
"adapter",
"in",
"adapters",
"if",
"adapter",
"[",
"\"aut... | [
52,
0
] | [
56,
5
] | python | en | ['it', 'en', 'en'] | True |
adapters_with_exernal_addresses | (adapters: list[Adapter]) | Enable all interfaces with an external address. | Enable all interfaces with an external address. | def adapters_with_exernal_addresses(adapters: list[Adapter]) -> list[str]:
"""Enable all interfaces with an external address."""
return [
adapter["name"]
for adapter in adapters
if _adapter_has_external_address(adapter)
] | [
"def",
"adapters_with_exernal_addresses",
"(",
"adapters",
":",
"list",
"[",
"Adapter",
"]",
")",
"->",
"list",
"[",
"str",
"]",
":",
"return",
"[",
"adapter",
"[",
"\"name\"",
"]",
"for",
"adapter",
"in",
"adapters",
"if",
"_adapter_has_external_address",
"("... | [
59,
0
] | [
65,
5
] | python | en | ['en', 'en', 'en'] | True |
_adapter_has_external_address | (adapter: Adapter) | Adapter has a non-loopback and non-link-local address. | Adapter has a non-loopback and non-link-local address. | def _adapter_has_external_address(adapter: Adapter) -> bool:
"""Adapter has a non-loopback and non-link-local address."""
return any(
_has_external_address(v4_config["address"]) for v4_config in adapter["ipv4"]
) or any(
_has_external_address(v6_config["address"]) for v6_config in adapter["i... | [
"def",
"_adapter_has_external_address",
"(",
"adapter",
":",
"Adapter",
")",
"->",
"bool",
":",
"return",
"any",
"(",
"_has_external_address",
"(",
"v4_config",
"[",
"\"address\"",
"]",
")",
"for",
"v4_config",
"in",
"adapter",
"[",
"\"ipv4\"",
"]",
")",
"or",... | [
68,
0
] | [
74,
5
] | python | en | ['en', 'en', 'en'] | True |
_ifaddr_adapter_to_ha | (
adapter: ifaddr.Adapter, next_hop_address: None | IPv4Address | IPv6Address
) | Convert an ifaddr adapter to ha. | Convert an ifaddr adapter to ha. | def _ifaddr_adapter_to_ha(
adapter: ifaddr.Adapter, next_hop_address: None | IPv4Address | IPv6Address
) -> Adapter:
"""Convert an ifaddr adapter to ha."""
ip_v4s: list[IPv4ConfiguredAddress] = []
ip_v6s: list[IPv6ConfiguredAddress] = []
default = False
auto = False
for ip_config in adapter... | [
"def",
"_ifaddr_adapter_to_ha",
"(",
"adapter",
":",
"ifaddr",
".",
"Adapter",
",",
"next_hop_address",
":",
"None",
"|",
"IPv4Address",
"|",
"IPv6Address",
")",
"->",
"Adapter",
":",
"ip_v4s",
":",
"list",
"[",
"IPv4ConfiguredAddress",
"]",
"=",
"[",
"]",
"... | [
94,
0
] | [
124,
5
] | python | en | ['en', 'lb', 'en'] | True |
async_get_source_ip | (target_ip: str) | Return the source ip that will reach target_ip. | Return the source ip that will reach target_ip. | def async_get_source_ip(target_ip: str) -> str | None:
"""Return the source ip that will reach target_ip."""
test_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
test_sock.setblocking(False) # must be non-blocking for async
try:
test_sock.connect((target_ip, 1))
return cast(str,... | [
"def",
"async_get_source_ip",
"(",
"target_ip",
":",
"str",
")",
"->",
"str",
"|",
"None",
":",
"test_sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_DGRAM",
")",
"test_sock",
".",
"setblocking",
"(",
"False",
... | [
144,
0
] | [
158,
25
] | python | en | ['en', 'en', 'en'] | True |
mock_socket_fixture | () | Mock the socket. | Mock the socket. | def mock_socket_fixture():
"""Mock the socket."""
with patch(
"homeassistant.components.tcp.common.socket.socket"
) as mock_socket, patch(
"homeassistant.components.tcp.common.select.select",
return_value=(True, False, False),
):
# yield the return value of the socket con... | [
"def",
"mock_socket_fixture",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.tcp.common.socket.socket\"",
")",
"as",
"mock_socket",
",",
"patch",
"(",
"\"homeassistant.components.tcp.common.select.select\"",
",",
"return_value",
"=",
"(",
"True",
",",
"F... | [
19,
0
] | [
28,
61
] | python | en | ['en', 'fy', 'en'] | True |
now | () | Return datetime UTC now. | Return datetime UTC now. | def now():
"""Return datetime UTC now."""
return utcnow() | [
"def",
"now",
"(",
")",
":",
"return",
"utcnow",
"(",
")"
] | [
32,
0
] | [
34,
19
] | python | de | ['de', 'pl', 'en'] | False |
test_setup_platform_valid_config | (hass, mock_socket) | Check a valid configuration. | Check a valid configuration. | async def test_setup_platform_valid_config(hass, mock_socket):
"""Check a valid configuration."""
with assert_setup_component(1, "binary_sensor"):
assert await async_setup_component(hass, "binary_sensor", TEST_CONFIG)
await hass.async_block_till_done() | [
"async",
"def",
"test_setup_platform_valid_config",
"(",
"hass",
",",
"mock_socket",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"binary_sensor\"",
",",
"TE... | [
37,
0
] | [
41,
42
] | python | en | ['en', 'en', 'en'] | True |
test_setup_platform_invalid_config | (hass, mock_socket) | Check the invalid configuration. | Check the invalid configuration. | async def test_setup_platform_invalid_config(hass, mock_socket):
"""Check the invalid configuration."""
with assert_setup_component(0):
assert await async_setup_component(
hass,
"binary_sensor",
{"binary_sensor": {"platform": "tcp", "porrt": 1234}},
)
... | [
"async",
"def",
"test_setup_platform_invalid_config",
"(",
"hass",
",",
"mock_socket",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"binary_sensor\"",
",",
"{",
"\"binary_sensor\"",
"... | [
44,
0
] | [
52,
42
] | python | en | ['en', 'it', 'en'] | True |
test_state | (hass, mock_socket, now) | Check the state and update of the binary sensor. | Check the state and update of the binary sensor. | async def test_state(hass, mock_socket, now):
"""Check the state and update of the binary sensor."""
mock_socket.recv.return_value = b"off"
assert await async_setup_component(hass, "binary_sensor", TEST_CONFIG)
await hass.async_block_till_done()
state = hass.states.get(TEST_ENTITY)
assert stat... | [
"async",
"def",
"test_state",
"(",
"hass",
",",
"mock_socket",
",",
"now",
")",
":",
"mock_socket",
".",
"recv",
".",
"return_value",
"=",
"b\"off\"",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"binary_sensor\"",
",",
"TEST_CONFIG",
")",
"... | [
55,
0
] | [
82,
34
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up OVO Energy from a config entry. | Set up OVO Energy from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up OVO Energy from a config entry."""
client = OVOEnergy()
try:
authenticated = await client.authenticate(
entry.data[CONF_USERNAME], entry.data[CONF_PASSWORD]
)
except aiohttp.ClientError ... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"client",
"=",
"OVOEnergy",
"(",
")",
"try",
":",
"authenticated",
"=",
"await",
"client",
".",
"authenticate",
"(",
"entry",
... | [
30,
0
] | [
81,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigType) | Unload OVO Energy config entry. | Unload OVO Energy config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigType) -> bool:
"""Unload OVO Energy config entry."""
# Unload sensors
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
del hass.data[DOMAIN][entry.entry_id]
return unload_ok | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigType",
")",
"->",
"bool",
":",
"# Unload sensors",
"unload_ok",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLA... | [
84,
0
] | [
91,
20
] | python | en | ['hu', 'en', 'en'] | True |
OVOEnergyEntity.__init__ | (
self,
coordinator: DataUpdateCoordinator,
client: OVOEnergy,
) | Initialize the OVO Energy entity. | Initialize the OVO Energy entity. | def __init__(
self,
coordinator: DataUpdateCoordinator,
client: OVOEnergy,
) -> None:
"""Initialize the OVO Energy entity."""
super().__init__(coordinator)
self._client = client | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"DataUpdateCoordinator",
",",
"client",
":",
"OVOEnergy",
",",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_client",
"=",
"client"
] | [
97,
4
] | [
104,
29
] | python | en | ['en', 'en', 'en'] | True |
OVOEnergyDeviceEntity.device_info | (self) | Return device information about this OVO Energy instance. | Return device information about this OVO Energy instance. | def device_info(self) -> DeviceInfo:
"""Return device information about this OVO Energy instance."""
return {
"identifiers": {(DOMAIN, self._client.account_id)},
"manufacturer": "OVO Energy",
"name": self._client.username,
"entry_type": "service",
... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"DeviceInfo",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_client",
".",
"account_id",
")",
"}",
",",
"\"manufacturer\"",
":",
"\"OVO Energy\"",
",",
"\"name\"",
":",
"sel... | [
111,
4
] | [
118,
9
] | python | en | ['en', 'en', 'en'] | True |
get_config_entry | (hass) | Return a single config entry. | Return a single config entry. | def get_config_entry(hass):
"""Return a single config entry."""
entries = hass.config_entries.async_entries(DOMAIN)
assert len(entries) == 1
return entries[0] | [
"def",
"get_config_entry",
"(",
"hass",
")",
":",
"entries",
"=",
"hass",
".",
"config_entries",
".",
"async_entries",
"(",
"DOMAIN",
")",
"assert",
"len",
"(",
"entries",
")",
"==",
"1",
"return",
"entries",
"[",
"0",
"]"
] | [
29,
0
] | [
33,
21
] | python | en | ['en', 'cy', 'en'] | True |
oauth | (hass, aiohttp_client, aioclient_mock, current_request_with_host) | Create the simulated oauth flow. | Create the simulated oauth flow. | async def oauth(hass, aiohttp_client, aioclient_mock, current_request_with_host):
"""Create the simulated oauth flow."""
return OAuthFixture(hass, aiohttp_client, aioclient_mock) | [
"async",
"def",
"oauth",
"(",
"hass",
",",
"aiohttp_client",
",",
"aioclient_mock",
",",
"current_request_with_host",
")",
":",
"return",
"OAuthFixture",
"(",
"hass",
",",
"aiohttp_client",
",",
"aioclient_mock",
")"
] | [
88,
0
] | [
90,
61
] | python | en | ['en', 'en', 'en'] | True |
test_full_flow | (hass, oauth) | Check full flow. | Check full flow. | async def test_full_flow(hass, oauth):
"""Check full flow."""
assert await setup.async_setup_component(hass, DOMAIN, CONFIG)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
await oauth.async_oauth_flow(result)
entry = get_con... | [
"async",
"def",
"test_full_flow",
"(",
"hass",
",",
"oauth",
")",
":",
"assert",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"CONFIG",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async... | [
93,
0
] | [
112,
5
] | python | en | ['sv', 'no', 'en'] | False |
test_reauth | (hass, oauth) | Test Nest reauthentication. | Test Nest reauthentication. | async def test_reauth(hass, oauth):
"""Test Nest reauthentication."""
assert await setup.async_setup_component(hass, DOMAIN, CONFIG)
old_entry = MockConfigEntry(
domain=DOMAIN,
data={
"auth_implementation": DOMAIN,
"token": {
# Verify this is replace... | [
"async",
"def",
"test_reauth",
"(",
"hass",
",",
"oauth",
")",
":",
"assert",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"CONFIG",
")",
"old_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=... | [
115,
0
] | [
161,
5
] | python | de | ['de', 'fr', 'it'] | False |
test_single_config_entry | (hass) | Test that only a single config entry is allowed. | Test that only a single config entry is allowed. | async def test_single_config_entry(hass):
"""Test that only a single config entry is allowed."""
old_entry = MockConfigEntry(
domain=DOMAIN, data={"auth_implementation": DOMAIN, "sdm": {}}
)
old_entry.add_to_hass(hass)
assert await setup.async_setup_component(hass, DOMAIN, CONFIG)
resu... | [
"async",
"def",
"test_single_config_entry",
"(",
"hass",
")",
":",
"old_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"\"auth_implementation\"",
":",
"DOMAIN",
",",
"\"sdm\"",
":",
"{",
"}",
"}",
")",
"old_entry",
".",
... | [
164,
0
] | [
177,
56
] | python | en | ['en', 'en', 'en'] | True |
test_unexpected_existing_config_entries | (hass, oauth) | Test Nest reauthentication with multiple existing config entries. | Test Nest reauthentication with multiple existing config entries. | async def test_unexpected_existing_config_entries(hass, oauth):
"""Test Nest reauthentication with multiple existing config entries."""
# Note that this case will not happen in the future since only a single
# instance is now allowed, but this may have been allowed in the past.
# On reauth, only one ent... | [
"async",
"def",
"test_unexpected_existing_config_entries",
"(",
"hass",
",",
"oauth",
")",
":",
"# Note that this case will not happen in the future since only a single",
"# instance is now allowed, but this may have been allowed in the past.",
"# On reauth, only one entry is kept and the othe... | [
180,
0
] | [
224,
5
] | python | en | ['en', 'en', 'en'] | True |
OAuthFixture.__init__ | (self, hass, aiohttp_client, aioclient_mock) | Initialize OAuthFixture. | Initialize OAuthFixture. | def __init__(self, hass, aiohttp_client, aioclient_mock):
"""Initialize OAuthFixture."""
self.hass = hass
self.aiohttp_client = aiohttp_client
self.aioclient_mock = aioclient_mock | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"aiohttp_client",
",",
"aioclient_mock",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"aiohttp_client",
"=",
"aiohttp_client",
"self",
".",
"aioclient_mock",
"=",
"aioclient_mock"
] | [
39,
4
] | [
43,
44
] | python | en | ['en', 'eu', 'it'] | False |
OAuthFixture.async_oauth_flow | (self, result) | Invoke the oauth flow with fake responses. | Invoke the oauth flow with fake responses. | async def async_oauth_flow(self, result):
"""Invoke the oauth flow with fake responses."""
state = config_entry_oauth2_flow._encode_jwt(
self.hass,
{
"flow_id": result["flow_id"],
"redirect_uri": "https://example.com/auth/external/callback",
... | [
"async",
"def",
"async_oauth_flow",
"(",
"self",
",",
"result",
")",
":",
"state",
"=",
"config_entry_oauth2_flow",
".",
"_encode_jwt",
"(",
"self",
".",
"hass",
",",
"{",
"\"flow_id\"",
":",
"result",
"[",
"\"flow_id\"",
"]",
",",
"\"redirect_uri\"",
":",
"... | [
45,
4
] | [
84,
50
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Orange Pi GPIO component. | Set up the Orange Pi GPIO component. | async def async_setup(hass, config):
"""Set up the Orange Pi GPIO component."""
def cleanup_gpio(event):
"""Stuff to do before stopping."""
GPIO.cleanup()
def prepare_gpio(event):
"""Stuff to do when Home Assistant starts."""
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_S... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"def",
"cleanup_gpio",
"(",
"event",
")",
":",
"\"\"\"Stuff to do before stopping.\"\"\"",
"GPIO",
".",
"cleanup",
"(",
")",
"def",
"prepare_gpio",
"(",
"event",
")",
":",
"\"\"\"Stuff to do wh... | [
15,
0
] | [
27,
15
] | python | en | ['en', 'la', 'en'] | True |
setup_mode | (mode) | Set GPIO pin mode. | Set GPIO pin mode. | def setup_mode(mode):
"""Set GPIO pin mode."""
_LOGGER.debug("Setting GPIO pin mode as %s", PIN_MODES[mode])
GPIO.setmode(PIN_MODES[mode]) | [
"def",
"setup_mode",
"(",
"mode",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Setting GPIO pin mode as %s\"",
",",
"PIN_MODES",
"[",
"mode",
"]",
")",
"GPIO",
".",
"setmode",
"(",
"PIN_MODES",
"[",
"mode",
"]",
")"
] | [
30,
0
] | [
33,
33
] | python | en | ['en', 'el-Latn', 'en'] | True |
setup_input | (port) | Set up a GPIO as input. | Set up a GPIO as input. | def setup_input(port):
"""Set up a GPIO as input."""
_LOGGER.debug("Setting up GPIO pin %i as input", port)
GPIO.setup(port, GPIO.IN) | [
"def",
"setup_input",
"(",
"port",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Setting up GPIO pin %i as input\"",
",",
"port",
")",
"GPIO",
".",
"setup",
"(",
"port",
",",
"GPIO",
".",
"IN",
")"
] | [
36,
0
] | [
39,
29
] | python | en | ['en', 'haw', 'en'] | True |
read_input | (port) | Read a value from a GPIO. | Read a value from a GPIO. | def read_input(port):
"""Read a value from a GPIO."""
_LOGGER.debug("Reading GPIO pin %i", port)
return GPIO.input(port) | [
"def",
"read_input",
"(",
"port",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Reading GPIO pin %i\"",
",",
"port",
")",
"return",
"GPIO",
".",
"input",
"(",
"port",
")"
] | [
42,
0
] | [
45,
27
] | python | en | ['en', 'en', 'en'] | True |
edge_detect | (port, event_callback) | Add detection for RISING and FALLING events. | Add detection for RISING and FALLING events. | def edge_detect(port, event_callback):
"""Add detection for RISING and FALLING events."""
_LOGGER.debug("Add callback for GPIO pin %i", port)
GPIO.add_event_detect(port, GPIO.BOTH, callback=event_callback) | [
"def",
"edge_detect",
"(",
"port",
",",
"event_callback",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Add callback for GPIO pin %i\"",
",",
"port",
")",
"GPIO",
".",
"add_event_detect",
"(",
"port",
",",
"GPIO",
".",
"BOTH",
",",
"callback",
"=",
"event_callbac... | [
48,
0
] | [
51,
67
] | python | en | ['en', 'en', 'en'] | True |
_async_reproduce_state | (
hass: HomeAssistant,
state: State,
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) | Reproduce a single state. | Reproduce a single state. | async def _async_reproduce_state(
hass: HomeAssistant,
state: State,
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) -> None:
"""Reproduce a single state."""
cur_state = hass.states.get(state.entity_id)
if cur_state is None:
_LOGGER.warning(... | [
"async",
"def",
"_async_reproduce_state",
"(",
"hass",
":",
"HomeAssistant",
",",
"state",
":",
"State",
",",
"*",
",",
"context",
":",
"Context",
"|",
"None",
"=",
"None",
",",
"reproduce_options",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
... | [
44,
0
] | [
96,
9
] | python | en | ['en', 'en', 'en'] | True |
async_reproduce_states | (
hass: HomeAssistant,
states: Iterable[State],
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) | Reproduce Vacuum states. | Reproduce Vacuum states. | async def async_reproduce_states(
hass: HomeAssistant,
states: Iterable[State],
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) -> None:
"""Reproduce Vacuum states."""
# Reproduce states in parallel.
await asyncio.gather(
*(
_asyn... | [
"async",
"def",
"async_reproduce_states",
"(",
"hass",
":",
"HomeAssistant",
",",
"states",
":",
"Iterable",
"[",
"State",
"]",
",",
"*",
",",
"context",
":",
"Context",
"|",
"None",
"=",
"None",
",",
"reproduce_options",
":",
"dict",
"[",
"str",
",",
"A... | [
99,
0
] | [
115,
5
] | python | de | ['de', 'la', 'en'] | False |
namedtuple | (typename, field_names, verbose=False) | Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', 'x y')
>>> Point.__doc__ # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22) # instantiate with positional args or keywords
>>> p[0] + p[1] # indexabl... | Returns a new subclass of tuple with named fields. | def namedtuple(typename, field_names, verbose=False):
"""Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', 'x y')
>>> Point.__doc__ # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22) # instantiate with positional args o... | [
"def",
"namedtuple",
"(",
"typename",
",",
"field_names",
",",
"verbose",
"=",
"False",
")",
":",
"# Parse and validate the field names. Validation serves two purposes,",
"# generating informative error messages and preventing template injection attacks.",
"if",
"isinstance",
"(",
... | [
13,
0
] | [
109,
17
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.__init__ | (self, *args, **kwds) | Initialize an ordered dictionary. The signature is the same as
regular dictionaries, but keyword arguments are not recommended because
their insertion order is arbitrary.
| Initialize an ordered dictionary. The signature is the same as
regular dictionaries, but keyword arguments are not recommended because
their insertion order is arbitrary. | def __init__(self, *args, **kwds):
'''Initialize an ordered dictionary. The signature is the same as
regular dictionaries, but keyword arguments are not recommended because
their insertion order is arbitrary.
'''
if len(args) > 1:
raise TypeError('expected at most 1... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"len",
"(",
"args",
")",
">",
"1",
":",
"raise",
"TypeError",
"(",
"'expected at most 1 arguments, got %d'",
"%",
"len",
"(",
"args",
")",
")",
"try",
":",
"self... | [
124,
4
] | [
138,
36
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.__setitem__ | (self, key, value, dict_setitem=dict.__setitem__) | od.__setitem__(i, y) <==> od[i]=y | od.__setitem__(i, y) <==> od[i]=y | def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
'od.__setitem__(i, y) <==> od[i]=y'
# Setting a new item creates a new link at the end of the linked list,
# and the inherited dictionary is updated with the new key/value pair.
if key not in self:
root = self.... | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"value",
",",
"dict_setitem",
"=",
"dict",
".",
"__setitem__",
")",
":",
"# Setting a new item creates a new link at the end of the linked list,",
"# and the inherited dictionary is updated with the new key/value pair.",
"if",
... | [
140,
4
] | [
148,
45
] | python | cy | ['de', 'cy', 'es'] | False |
OrderedDict.__delitem__ | (self, key, dict_delitem=dict.__delitem__) | od.__delitem__(y) <==> del od[y] | od.__delitem__(y) <==> del od[y] | def __delitem__(self, key, dict_delitem=dict.__delitem__):
'od.__delitem__(y) <==> del od[y]'
# Deleting an existing item uses self.__map to find the link which gets
# removed by updating the links in the predecessor and successor nodes.
dict_delitem(self, key)
link_prev, link_ne... | [
"def",
"__delitem__",
"(",
"self",
",",
"key",
",",
"dict_delitem",
"=",
"dict",
".",
"__delitem__",
")",
":",
"# Deleting an existing item uses self.__map to find the link which gets",
"# removed by updating the links in the predecessor and successor nodes.",
"dict_delitem",
"(",
... | [
150,
4
] | [
157,
32
] | python | it | ['it', 'es', 'it'] | True |
OrderedDict.__iter__ | (self) | od.__iter__() <==> iter(od) | od.__iter__() <==> iter(od) | def __iter__(self):
'od.__iter__() <==> iter(od)'
# Traverse the linked list in order.
root = self.__root
curr = root[1] # start at the first node
while curr is not root:
yield curr[2] # yield the curr[KEY... | [
"def",
"__iter__",
"(",
"self",
")",
":",
"# Traverse the linked list in order.",
"root",
"=",
"self",
".",
"__root",
"curr",
"=",
"root",
"[",
"1",
"]",
"# start at the first node",
"while",
"curr",
"is",
"not",
"root",
":",
"yield",
"curr",
"[",
"2",
"]",
... | [
159,
4
] | [
166,
26
] | python | en | ['en', 'hr', 'ur'] | False |
OrderedDict.__reversed__ | (self) | od.__reversed__() <==> reversed(od) | od.__reversed__() <==> reversed(od) | def __reversed__(self):
'od.__reversed__() <==> reversed(od)'
# Traverse the linked list in reverse order.
root = self.__root
curr = root[0] # start at the last node
while curr is not root:
yield curr[2] #... | [
"def",
"__reversed__",
"(",
"self",
")",
":",
"# Traverse the linked list in reverse order.",
"root",
"=",
"self",
".",
"__root",
"curr",
"=",
"root",
"[",
"0",
"]",
"# start at the last node",
"while",
"curr",
"is",
"not",
"root",
":",
"yield",
"curr",
"[",
"... | [
168,
4
] | [
175,
26
] | python | en | ['en', 'no', 'en'] | True |
OrderedDict.clear | (self) | od.clear() -> None. Remove all items from od. | od.clear() -> None. Remove all items from od. | def clear(self):
'od.clear() -> None. Remove all items from od.'
root = self.__root
root[:] = [root, root, None]
self.__map.clear()
dict.clear(self) | [
"def",
"clear",
"(",
"self",
")",
":",
"root",
"=",
"self",
".",
"__root",
"root",
"[",
":",
"]",
"=",
"[",
"root",
",",
"root",
",",
"None",
"]",
"self",
".",
"__map",
".",
"clear",
"(",
")",
"dict",
".",
"clear",
"(",
"self",
")"
] | [
177,
4
] | [
182,
24
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.keys | (self) | od.keys() -> list of keys in od | od.keys() -> list of keys in od | def keys(self):
'od.keys() -> list of keys in od'
return list(self) | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
")"
] | [
186,
4
] | [
188,
25
] | python | en | ['en', 'fy', 'en'] | True |
OrderedDict.values | (self) | od.values() -> list of values in od | od.values() -> list of values in od | def values(self):
'od.values() -> list of values in od'
return [self[key] for key in self] | [
"def",
"values",
"(",
"self",
")",
":",
"return",
"[",
"self",
"[",
"key",
"]",
"for",
"key",
"in",
"self",
"]"
] | [
190,
4
] | [
192,
42
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.items | (self) | od.items() -> list of (key, value) pairs in od | od.items() -> list of (key, value) pairs in od | def items(self):
'od.items() -> list of (key, value) pairs in od'
return [(key, self[key]) for key in self] | [
"def",
"items",
"(",
"self",
")",
":",
"return",
"[",
"(",
"key",
",",
"self",
"[",
"key",
"]",
")",
"for",
"key",
"in",
"self",
"]"
] | [
194,
4
] | [
196,
49
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.iterkeys | (self) | od.iterkeys() -> an iterator over the keys in od | od.iterkeys() -> an iterator over the keys in od | def iterkeys(self):
'od.iterkeys() -> an iterator over the keys in od'
return iter(self) | [
"def",
"iterkeys",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"self",
")"
] | [
198,
4
] | [
200,
25
] | python | en | ['en', 'sv', 'en'] | True |
OrderedDict.itervalues | (self) | od.itervalues -> an iterator over the values in od | od.itervalues -> an iterator over the values in od | def itervalues(self):
'od.itervalues -> an iterator over the values in od'
for k in self:
yield self[k] | [
"def",
"itervalues",
"(",
"self",
")",
":",
"for",
"k",
"in",
"self",
":",
"yield",
"self",
"[",
"k",
"]"
] | [
202,
4
] | [
205,
25
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.iteritems | (self) | od.iteritems -> an iterator over the (key, value) pairs in od | od.iteritems -> an iterator over the (key, value) pairs in od | def iteritems(self):
'od.iteritems -> an iterator over the (key, value) pairs in od'
for k in self:
yield (k, self[k]) | [
"def",
"iteritems",
"(",
"self",
")",
":",
"for",
"k",
"in",
"self",
":",
"yield",
"(",
"k",
",",
"self",
"[",
"k",
"]",
")"
] | [
207,
4
] | [
210,
30
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.pop | (self, key, default=__marker) | od.pop(k[,d]) -> v, remove specified key and return the corresponding
value. If key is not found, d is returned if given, otherwise KeyError
is raised.
| od.pop(k[,d]) -> v, remove specified key and return the corresponding
value. If key is not found, d is returned if given, otherwise KeyError
is raised. | def pop(self, key, default=__marker):
'''od.pop(k[,d]) -> v, remove specified key and return the corresponding
value. If key is not found, d is returned if given, otherwise KeyError
is raised.
'''
if key in self:
result = self[key]
del self[key]
... | [
"def",
"pop",
"(",
"self",
",",
"key",
",",
"default",
"=",
"__marker",
")",
":",
"if",
"key",
"in",
"self",
":",
"result",
"=",
"self",
"[",
"key",
"]",
"del",
"self",
"[",
"key",
"]",
"return",
"result",
"if",
"default",
"is",
"self",
".",
"__m... | [
218,
4
] | [
230,
22
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.setdefault | (self, key, default=None) | od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od | od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od | def setdefault(self, key, default=None):
'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
if key in self:
return self[key]
self[key] = default
return default | [
"def",
"setdefault",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"self",
"[",
"key",
"]",
"self",
"[",
"key",
"]",
"=",
"default",
"return",
"default"
] | [
232,
4
] | [
237,
22
] | python | en | ['en', 'sl', 'en'] | True |
OrderedDict.popitem | (self, last=True) | od.popitem() -> (k, v), return and remove a (key, value) pair.
Pairs are returned in LIFO order if last is true or FIFO order if false.
| od.popitem() -> (k, v), return and remove a (key, value) pair.
Pairs are returned in LIFO order if last is true or FIFO order if false. | def popitem(self, last=True):
'''od.popitem() -> (k, v), return and remove a (key, value) pair.
Pairs are returned in LIFO order if last is true or FIFO order if false.
'''
if not self:
raise KeyError('dictionary is empty')
key = next(reversed(self) if last else iter... | [
"def",
"popitem",
"(",
"self",
",",
"last",
"=",
"True",
")",
":",
"if",
"not",
"self",
":",
"raise",
"KeyError",
"(",
"'dictionary is empty'",
")",
"key",
"=",
"next",
"(",
"reversed",
"(",
"self",
")",
"if",
"last",
"else",
"iter",
"(",
"self",
")"... | [
239,
4
] | [
248,
25
] | python | en | ['en', 'hi-Latn', 'en'] | True |
OrderedDict.__repr__ | (self, _repr_running={}) | od.__repr__() <==> repr(od) | od.__repr__() <==> repr(od) | def __repr__(self, _repr_running={}):
'od.__repr__() <==> repr(od)'
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return '%s()' % (self.__class__.__name__,)
... | [
"def",
"__repr__",
"(",
"self",
",",
"_repr_running",
"=",
"{",
"}",
")",
":",
"call_key",
"=",
"id",
"(",
"self",
")",
",",
"_get_ident",
"(",
")",
"if",
"call_key",
"in",
"_repr_running",
":",
"return",
"'...'",
"_repr_running",
"[",
"call_key",
"]",
... | [
250,
4
] | [
261,
39
] | python | en | ['en', 'it', 'hi'] | False |
OrderedDict.__reduce__ | (self) | Return state information for pickling | Return state information for pickling | def __reduce__(self):
'Return state information for pickling'
items = [[k, self[k]] for k in self]
inst_dict = vars(self).copy()
for k in vars(OrderedDict()):
inst_dict.pop(k, None)
if inst_dict:
return (self.__class__, (items,), inst_dict)
return ... | [
"def",
"__reduce__",
"(",
"self",
")",
":",
"items",
"=",
"[",
"[",
"k",
",",
"self",
"[",
"k",
"]",
"]",
"for",
"k",
"in",
"self",
"]",
"inst_dict",
"=",
"vars",
"(",
"self",
")",
".",
"copy",
"(",
")",
"for",
"k",
"in",
"vars",
"(",
"Ordere... | [
263,
4
] | [
271,
39
] | python | en | ['en', 'da', 'en'] | True |
OrderedDict.copy | (self) | od.copy() -> a shallow copy of od | od.copy() -> a shallow copy of od | def copy(self):
'od.copy() -> a shallow copy of od'
return self.__class__(self) | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
")"
] | [
273,
4
] | [
275,
35
] | python | en | ['en', 'cs', 'en'] | True |
OrderedDict.fromkeys | (cls, iterable, value=None) | OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.
If not specified, the value defaults to None.
| OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.
If not specified, the value defaults to None. | def fromkeys(cls, iterable, value=None):
'''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.
If not specified, the value defaults to None.
'''
self = cls()
for key in iterable:
self[key] = value
return self | [
"def",
"fromkeys",
"(",
"cls",
",",
"iterable",
",",
"value",
"=",
"None",
")",
":",
"self",
"=",
"cls",
"(",
")",
"for",
"key",
"in",
"iterable",
":",
"self",
"[",
"key",
"]",
"=",
"value",
"return",
"self"
] | [
278,
4
] | [
286,
19
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.__eq__ | (self, other) | od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive
while comparison to a regular mapping is order-insensitive.
| od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive
while comparison to a regular mapping is order-insensitive. | def __eq__(self, other):
'''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive
while comparison to a regular mapping is order-insensitive.
'''
if isinstance(other, OrderedDict):
return dict.__eq__(self, other) and all(_imap(_eq, self, other))
retur... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"OrderedDict",
")",
":",
"return",
"dict",
".",
"__eq__",
"(",
"self",
",",
"other",
")",
"and",
"all",
"(",
"_imap",
"(",
"_eq",
",",
"self",
",",
"other"... | [
288,
4
] | [
295,
39
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.__ne__ | (self, other) | od.__ne__(y) <==> od!=y | od.__ne__(y) <==> od!=y | def __ne__(self, other):
'od.__ne__(y) <==> od!=y'
return not self == other | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"self",
"==",
"other"
] | [
297,
4
] | [
299,
32
] | python | cy | ['de', 'cy', 'pl'] | False |
OrderedDict.viewkeys | (self) | od.viewkeys() -> a set-like object providing a view on od's keys | od.viewkeys() -> a set-like object providing a view on od's keys | def viewkeys(self):
"od.viewkeys() -> a set-like object providing a view on od's keys"
return KeysView(self) | [
"def",
"viewkeys",
"(",
"self",
")",
":",
"return",
"KeysView",
"(",
"self",
")"
] | [
303,
4
] | [
305,
29
] | python | en | ['en', 'cs', 'en'] | True |
OrderedDict.viewvalues | (self) | od.viewvalues() -> an object providing a view on od's values | od.viewvalues() -> an object providing a view on od's values | def viewvalues(self):
"od.viewvalues() -> an object providing a view on od's values"
return ValuesView(self) | [
"def",
"viewvalues",
"(",
"self",
")",
":",
"return",
"ValuesView",
"(",
"self",
")"
] | [
307,
4
] | [
309,
31
] | python | en | ['en', 'en', 'en'] | True |
OrderedDict.viewitems | (self) | od.viewitems() -> a set-like object providing a view on od's items | od.viewitems() -> a set-like object providing a view on od's items | def viewitems(self):
"od.viewitems() -> a set-like object providing a view on od's items"
return ItemsView(self) | [
"def",
"viewitems",
"(",
"self",
")",
":",
"return",
"ItemsView",
"(",
"self",
")"
] | [
311,
4
] | [
313,
30
] | python | en | ['en', 'haw', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) | Set up the FRITZ!SmartHome thermostat from ConfigEntry. | Set up the FRITZ!SmartHome thermostat from ConfigEntry. | async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up the FRITZ!SmartHome thermostat from ConfigEntry."""
coordinator = hass.data[FRITZBOX_DOMAIN][entry.entry_id][CONF_COORDINATOR]
async_add_entities(
[
Fri... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
")",
"->",
"None",
":",
"coordinator",
"=",
"hass",
".",
"data",
"[",
"FRITZBOX_DOMAIN",
"]",
"[",
... | [
54,
0
] | [
66,
5
] | python | en | ['en', 'en', 'en'] | True |
FritzboxThermostat.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self) -> int:
"""Return the list of supported features."""
return SUPPORT_FLAGS | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"SUPPORT_FLAGS"
] | [
73,
4
] | [
75,
28
] | python | en | ['en', 'en', 'en'] | True |
FritzboxThermostat.temperature_unit | (self) | Return the unit of measurement that is used. | Return the unit of measurement that is used. | def temperature_unit(self) -> str:
"""Return the unit of measurement that is used."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
"->",
"str",
":",
"return",
"TEMP_CELSIUS"
] | [
78,
4
] | [
80,
27
] | python | en | ['en', 'en', 'en'] | True |
FritzboxThermostat.precision | (self) | Return precision 0.5. | Return precision 0.5. | def precision(self) -> float:
"""Return precision 0.5."""
return PRECISION_HALVES | [
"def",
"precision",
"(",
"self",
")",
"->",
"float",
":",
"return",
"PRECISION_HALVES"
] | [
83,
4
] | [
85,
31
] | python | en | ['es', 'it', 'en'] | False |
FritzboxThermostat.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self) -> float:
"""Return the current temperature."""
return self.device.actual_temperature | [
"def",
"current_temperature",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"device",
".",
"actual_temperature"
] | [
88,
4
] | [
90,
45
] | python | en | ['en', 'la', 'en'] | True |
FritzboxThermostat.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self) -> float:
"""Return the temperature we try to reach."""
if self.device.target_temperature == ON_API_TEMPERATURE:
return ON_REPORT_SET_TEMPERATURE
if self.device.target_temperature == OFF_API_TEMPERATURE:
return OFF_REPORT_SET_TEMPERATURE
... | [
"def",
"target_temperature",
"(",
"self",
")",
"->",
"float",
":",
"if",
"self",
".",
"device",
".",
"target_temperature",
"==",
"ON_API_TEMPERATURE",
":",
"return",
"ON_REPORT_SET_TEMPERATURE",
"if",
"self",
".",
"device",
".",
"target_temperature",
"==",
"OFF_AP... | [
93,
4
] | [
99,
45
] | python | en | ['en', 'en', 'en'] | True |
FritzboxThermostat.async_set_temperature | (self, **kwargs: Any) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperature."""
if kwargs.get(ATTR_HVAC_MODE) is not None:
hvac_mode = kwargs[ATTR_HVAC_MODE]
await self.async_set_hvac_mode(hvac_mode)
elif kwargs.get(ATTR_TEMPERATURE) is not None:
... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"if",
"kwargs",
".",
"get",
"(",
"ATTR_HVAC_MODE",
")",
"is",
"not",
"None",
":",
"hvac_mode",
"=",
"kwargs",
"[",
"ATTR_HVAC_MODE",
"]",
... | [
101,
4
] | [
111,
46
] | python | en | ['en', 'ca', 'en'] | True |
FritzboxThermostat.hvac_mode | (self) | Return the current operation mode. | Return the current operation mode. | def hvac_mode(self) -> str:
"""Return the current operation mode."""
if (
self.device.target_temperature == OFF_REPORT_SET_TEMPERATURE
or self.device.target_temperature == OFF_API_TEMPERATURE
):
return HVAC_MODE_OFF
return HVAC_MODE_HEAT | [
"def",
"hvac_mode",
"(",
"self",
")",
"->",
"str",
":",
"if",
"(",
"self",
".",
"device",
".",
"target_temperature",
"==",
"OFF_REPORT_SET_TEMPERATURE",
"or",
"self",
".",
"device",
".",
"target_temperature",
"==",
"OFF_API_TEMPERATURE",
")",
":",
"return",
"H... | [
114,
4
] | [
122,
29
] | python | en | ['en', 'en', 'en'] | True |
FritzboxThermostat.hvac_modes | (self) | Return the list of available operation modes. | Return the list of available operation modes. | def hvac_modes(self) -> list[str]:
"""Return the list of available operation modes."""
return OPERATION_LIST | [
"def",
"hvac_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
":",
"return",
"OPERATION_LIST"
] | [
125,
4
] | [
127,
29
] | python | en | ['en', 'en', 'en'] | True |
FritzboxThermostat.async_set_hvac_mode | (self, hvac_mode: str) | Set new operation mode. | Set new operation mode. | async def async_set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new operation mode."""
if hvac_mode == HVAC_MODE_OFF:
await self.async_set_temperature(temperature=OFF_REPORT_SET_TEMPERATURE)
else:
await self.async_set_temperature(
temperature=self.devi... | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
":",
"str",
")",
"->",
"None",
":",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"await",
"self",
".",
"async_set_temperature",
"(",
"temperature",
"=",
"OFF_REPORT_SET_TEMPERATURE",
")",
"e... | [
129,
4
] | [
136,
13
] | python | en | ['en', 'ny', 'en'] | True |
FritzboxThermostat.preset_mode | (self) | Return current preset mode. | Return current preset mode. | def preset_mode(self) -> str | None:
"""Return current preset mode."""
if self.device.target_temperature == self.device.comfort_temperature:
return PRESET_COMFORT
if self.device.target_temperature == self.device.eco_temperature:
return PRESET_ECO
return None | [
"def",
"preset_mode",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"if",
"self",
".",
"device",
".",
"target_temperature",
"==",
"self",
".",
"device",
".",
"comfort_temperature",
":",
"return",
"PRESET_COMFORT",
"if",
"self",
".",
"device",
".",
"targ... | [
139,
4
] | [
145,
19
] | python | en | ['en', 'ca', 'en'] | True |
FritzboxThermostat.preset_modes | (self) | Return supported preset modes. | Return supported preset modes. | def preset_modes(self) -> list[str]:
"""Return supported preset modes."""
return [PRESET_ECO, PRESET_COMFORT] | [
"def",
"preset_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
":",
"return",
"[",
"PRESET_ECO",
",",
"PRESET_COMFORT",
"]"
] | [
148,
4
] | [
150,
43
] | python | en | ['en', 'en', 'en'] | True |
FritzboxThermostat.async_set_preset_mode | (self, preset_mode: str) | Set preset mode. | Set preset mode. | async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set preset mode."""
if preset_mode == PRESET_COMFORT:
await self.async_set_temperature(
temperature=self.device.comfort_temperature
)
elif preset_mode == PRESET_ECO:
await self... | [
"async",
"def",
"async_set_preset_mode",
"(",
"self",
",",
"preset_mode",
":",
"str",
")",
"->",
"None",
":",
"if",
"preset_mode",
"==",
"PRESET_COMFORT",
":",
"await",
"self",
".",
"async_set_temperature",
"(",
"temperature",
"=",
"self",
".",
"device",
".",
... | [
152,
4
] | [
159,
85
] | python | de | ['de', 'pt', 'it'] | False |
FritzboxThermostat.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self) -> int:
"""Return the minimum temperature."""
return MIN_TEMPERATURE | [
"def",
"min_temp",
"(",
"self",
")",
"->",
"int",
":",
"return",
"MIN_TEMPERATURE"
] | [
162,
4
] | [
164,
30
] | python | en | ['en', 'la', 'en'] | True |
FritzboxThermostat.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self) -> int:
"""Return the maximum temperature."""
return MAX_TEMPERATURE | [
"def",
"max_temp",
"(",
"self",
")",
"->",
"int",
":",
"return",
"MAX_TEMPERATURE"
] | [
167,
4
] | [
169,
30
] | python | en | ['en', 'la', 'en'] | True |
FritzboxThermostat.extra_state_attributes | (self) | Return the device specific state attributes. | Return the device specific state attributes. | def extra_state_attributes(self) -> ClimateExtraAttributes:
"""Return the device specific state attributes."""
attrs: ClimateExtraAttributes = {
ATTR_STATE_BATTERY_LOW: self.device.battery_low,
ATTR_STATE_DEVICE_LOCKED: self.device.device_lock,
ATTR_STATE_LOCKED: self... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
"->",
"ClimateExtraAttributes",
":",
"attrs",
":",
"ClimateExtraAttributes",
"=",
"{",
"ATTR_STATE_BATTERY_LOW",
":",
"self",
".",
"device",
".",
"battery_low",
",",
"ATTR_STATE_DEVICE_LOCKED",
":",
"self",
".",
"de... | [
172,
4
] | [
190,
20
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up Modern Forms binary sensors. | Set up Modern Forms binary sensors. | async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up Modern Forms binary sensors."""
coordinator: ModernFormsDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
binary_sensors: list[ModernFormsBinarySensor] = [... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"coordinator",
":",
"ModernFormsDataUpdateCoordinator",
"=",
"hass",
".",
... | [
13,
0
] | [
31,
38
] | python | en | ['en', 'lb', 'en'] | True |
ModernFormsBinarySensor.__init__ | (
self,
*,
entry_id: str,
coordinator: ModernFormsDataUpdateCoordinator,
name: str,
icon: str,
key: str,
) | Initialize Modern Forms switch. | Initialize Modern Forms switch. | def __init__(
self,
*,
entry_id: str,
coordinator: ModernFormsDataUpdateCoordinator,
name: str,
icon: str,
key: str,
) -> None:
"""Initialize Modern Forms switch."""
super().__init__(
entry_id=entry_id, coordinator=coordinator, name... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"ModernFormsDataUpdateCoordinator",
",",
"name",
":",
"str",
",",
"icon",
":",
"str",
",",
"key",
":",
"str",
",",
")",
"->",
"None",
":",
"super",
"(",
"... | [
37,
4
] | [
51,
75
] | python | en | ['en', 'en', 'en'] | True |
ModernFormsLightSleepTimerActive.__init__ | (
self, entry_id: str, coordinator: ModernFormsDataUpdateCoordinator
) | Initialize Modern Forms Light Sleep Timer Active sensor. | Initialize Modern Forms Light Sleep Timer Active sensor. | def __init__(
self, entry_id: str, coordinator: ModernFormsDataUpdateCoordinator
) -> None:
"""Initialize Modern Forms Light Sleep Timer Active sensor."""
super().__init__(
coordinator=coordinator,
entry_id=entry_id,
icon="mdi:av-timer",
key="l... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"ModernFormsDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"entry_id",
"=",
"entry_id",
",... | [
59,
4
] | [
69,
9
] | python | en | ['en', 'lb', 'en'] | True |
ModernFormsLightSleepTimerActive.is_on | (self) | Return the state of the timer. | Return the state of the timer. | def is_on(self) -> bool:
"""Return the state of the timer."""
return not (
self.coordinator.data.state.light_sleep_timer == CLEAR_TIMER
or (
dt_util.utc_from_timestamp(
self.coordinator.data.state.light_sleep_timer
)
... | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"not",
"(",
"self",
".",
"coordinator",
".",
"data",
".",
"state",
".",
"light_sleep_timer",
"==",
"CLEAR_TIMER",
"or",
"(",
"dt_util",
".",
"utc_from_timestamp",
"(",
"self",
".",
"coordinator... | [
72,
4
] | [
83,
9
] | python | en | ['en', 'en', 'en'] | True |
ModernFormsFanSleepTimerActive.__init__ | (
self, entry_id: str, coordinator: ModernFormsDataUpdateCoordinator
) | Initialize Modern Forms Fan Sleep Timer Active sensor. | Initialize Modern Forms Fan Sleep Timer Active sensor. | def __init__(
self, entry_id: str, coordinator: ModernFormsDataUpdateCoordinator
) -> None:
"""Initialize Modern Forms Fan Sleep Timer Active sensor."""
super().__init__(
coordinator=coordinator,
entry_id=entry_id,
icon="mdi:av-timer",
key="fan... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"ModernFormsDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"entry_id",
"=",
"entry_id",
",... | [
91,
4
] | [
101,
9
] | python | en | ['en', 'lb', 'en'] | True |
ModernFormsFanSleepTimerActive.is_on | (self) | Return the state of the timer. | Return the state of the timer. | def is_on(self) -> bool:
"""Return the state of the timer."""
return not (
self.coordinator.data.state.fan_sleep_timer == CLEAR_TIMER
or (
dt_util.utc_from_timestamp(self.coordinator.data.state.fan_sleep_timer)
- dt_util.utcnow()
).tota... | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"not",
"(",
"self",
".",
"coordinator",
".",
"data",
".",
"state",
".",
"fan_sleep_timer",
"==",
"CLEAR_TIMER",
"or",
"(",
"dt_util",
".",
"utc_from_timestamp",
"(",
"self",
".",
"coordinator",... | [
104,
4
] | [
113,
9
] | python | en | ['en', 'en', 'en'] | True |
condition_trace_append | (variables: TemplateVarsType, path: str) | Append a TraceElement to trace[path]. | Append a TraceElement to trace[path]. | def condition_trace_append(variables: TemplateVarsType, path: str) -> TraceElement:
"""Append a TraceElement to trace[path]."""
trace_element = TraceElement(variables, path)
trace_append_element(trace_element)
return trace_element | [
"def",
"condition_trace_append",
"(",
"variables",
":",
"TemplateVarsType",
",",
"path",
":",
"str",
")",
"->",
"TraceElement",
":",
"trace_element",
"=",
"TraceElement",
"(",
"variables",
",",
"path",
")",
"trace_append_element",
"(",
"trace_element",
")",
"retur... | [
85,
0
] | [
89,
24
] | python | en | ['en', 'en', 'en'] | True |
condition_trace_set_result | (result: bool, **kwargs: Any) | Set the result of TraceElement at the top of the stack. | Set the result of TraceElement at the top of the stack. | def condition_trace_set_result(result: bool, **kwargs: Any) -> None:
"""Set the result of TraceElement at the top of the stack."""
node = trace_stack_top(trace_stack_cv)
# The condition function may be called directly, in which case tracing
# is not setup
if not node:
return
node.set_r... | [
"def",
"condition_trace_set_result",
"(",
"result",
":",
"bool",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"node",
"=",
"trace_stack_top",
"(",
"trace_stack_cv",
")",
"# The condition function may be called directly, in which case tracing",
"# is not ... | [
92,
0
] | [
101,
44
] | python | en | ['en', 'en', 'en'] | True |
condition_trace_update_result | (**kwargs: Any) | Update the result of TraceElement at the top of the stack. | Update the result of TraceElement at the top of the stack. | def condition_trace_update_result(**kwargs: Any) -> None:
"""Update the result of TraceElement at the top of the stack."""
node = trace_stack_top(trace_stack_cv)
# The condition function may be called directly, in which case tracing
# is not setup
if not node:
return
node.update_result... | [
"def",
"condition_trace_update_result",
"(",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"node",
"=",
"trace_stack_top",
"(",
"trace_stack_cv",
")",
"# The condition function may be called directly, in which case tracing",
"# is not setup",
"if",
"not",
"node"... | [
104,
0
] | [
113,
32
] | python | en | ['en', 'en', 'en'] | True |
trace_condition | (variables: TemplateVarsType) | Trace condition evaluation. | Trace condition evaluation. | def trace_condition(variables: TemplateVarsType) -> Generator[TraceElement, None, None]:
"""Trace condition evaluation."""
should_pop = True
trace_element = trace_stack_top(trace_stack_cv)
if trace_element and trace_element.reuse_by_child:
should_pop = False
trace_element.reuse_by_child ... | [
"def",
"trace_condition",
"(",
"variables",
":",
"TemplateVarsType",
")",
"->",
"Generator",
"[",
"TraceElement",
",",
"None",
",",
"None",
"]",
":",
"should_pop",
"=",
"True",
"trace_element",
"=",
"trace_stack_top",
"(",
"trace_stack_cv",
")",
"if",
"trace_ele... | [
117,
0
] | [
134,
43
] | python | en | ['es', 'en', 'en'] | True |
trace_condition_function | (condition: ConditionCheckerType) | Wrap a condition function to enable basic tracing. | Wrap a condition function to enable basic tracing. | def trace_condition_function(condition: ConditionCheckerType) -> ConditionCheckerType:
"""Wrap a condition function to enable basic tracing."""
@ft.wraps(condition)
def wrapper(hass: HomeAssistant, variables: TemplateVarsType = None) -> bool:
"""Trace condition."""
with trace_condition(vari... | [
"def",
"trace_condition_function",
"(",
"condition",
":",
"ConditionCheckerType",
")",
"->",
"ConditionCheckerType",
":",
"@",
"ft",
".",
"wraps",
"(",
"condition",
")",
"def",
"wrapper",
"(",
"hass",
":",
"HomeAssistant",
",",
"variables",
":",
"TemplateVarsType"... | [
137,
0
] | [
148,
18
] | python | en | ['en', 'en', 'en'] | True |
async_from_config | (
hass: HomeAssistant,
config: ConfigType | Template,
config_validation: bool = True,
) | Turn a condition configuration into a method.
Should be run on the event loop.
| Turn a condition configuration into a method. | async def async_from_config(
hass: HomeAssistant,
config: ConfigType | Template,
config_validation: bool = True,
) -> ConditionCheckerType:
"""Turn a condition configuration into a method.
Should be run on the event loop.
"""
if isinstance(config, Template):
# We got a condition tem... | [
"async",
"def",
"async_from_config",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
"|",
"Template",
",",
"config_validation",
":",
"bool",
"=",
"True",
",",
")",
"->",
"ConditionCheckerType",
":",
"if",
"isinstance",
"(",
"config",
",",
... | [
151,
0
] | [
186,
73
] | python | en | ['it', 'en', 'en'] | True |
async_and_from_config | (
hass: HomeAssistant, config: ConfigType, config_validation: bool = True
) | Create multi condition matcher using 'AND'. | Create multi condition matcher using 'AND'. | async def async_and_from_config(
hass: HomeAssistant, config: ConfigType, config_validation: bool = True
) -> ConditionCheckerType:
"""Create multi condition matcher using 'AND'."""
if config_validation:
config = cv.AND_CONDITION_SCHEMA(config)
checks = [
await async_from_config(hass, en... | [
"async",
"def",
"async_and_from_config",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
"=",
"True",
")",
"->",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"cv",
".",
... | [
189,
0
] | [
221,
27
] | python | en | ['en', 'en', 'en'] | True |
async_or_from_config | (
hass: HomeAssistant, config: ConfigType, config_validation: bool = True
) | Create multi condition matcher using 'OR'. | Create multi condition matcher using 'OR'. | async def async_or_from_config(
hass: HomeAssistant, config: ConfigType, config_validation: bool = True
) -> ConditionCheckerType:
"""Create multi condition matcher using 'OR'."""
if config_validation:
config = cv.OR_CONDITION_SCHEMA(config)
checks = [
await async_from_config(hass, entry... | [
"async",
"def",
"async_or_from_config",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
"=",
"True",
")",
"->",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"cv",
".",
"... | [
224,
0
] | [
256,
26
] | python | en | ['fr', 'en', 'en'] | True |
async_not_from_config | (
hass: HomeAssistant, config: ConfigType, config_validation: bool = True
) | Create multi condition matcher using 'NOT'. | Create multi condition matcher using 'NOT'. | async def async_not_from_config(
hass: HomeAssistant, config: ConfigType, config_validation: bool = True
) -> ConditionCheckerType:
"""Create multi condition matcher using 'NOT'."""
if config_validation:
config = cv.NOT_CONDITION_SCHEMA(config)
checks = [
await async_from_config(hass, en... | [
"async",
"def",
"async_not_from_config",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
"=",
"True",
")",
"->",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"cv",
".",
... | [
259,
0
] | [
291,
27
] | python | en | ['fr', 'en', 'en'] | True |
numeric_state | (
hass: HomeAssistant,
entity: None | str | State,
below: float | str | None = None,
above: float | str | None = None,
value_template: Template | None = None,
variables: TemplateVarsType = None,
) | Test a numeric state condition. | Test a numeric state condition. | def numeric_state(
hass: HomeAssistant,
entity: None | str | State,
below: float | str | None = None,
above: float | str | None = None,
value_template: Template | None = None,
variables: TemplateVarsType = None,
) -> bool:
"""Test a numeric state condition."""
return run_callback_threads... | [
"def",
"numeric_state",
"(",
"hass",
":",
"HomeAssistant",
",",
"entity",
":",
"None",
"|",
"str",
"|",
"State",
",",
"below",
":",
"float",
"|",
"str",
"|",
"None",
"=",
"None",
",",
"above",
":",
"float",
"|",
"str",
"|",
"None",
"=",
"None",
","... | [
294,
0
] | [
312,
14
] | python | en | ['ro', 'en', 'en'] | True |
async_numeric_state | ( # noqa: C901
hass: HomeAssistant,
entity: None | str | State,
below: float | str | None = None,
above: float | str | None = None,
value_template: Template | None = None,
variables: TemplateVarsType = None,
attribute: str | None = None,
) | Test a numeric state condition. | Test a numeric state condition. | def async_numeric_state( # noqa: C901
hass: HomeAssistant,
entity: None | str | State,
below: float | str | None = None,
above: float | str | None = None,
value_template: Template | None = None,
variables: TemplateVarsType = None,
attribute: str | None = None,
) -> bool:
"""Test a numer... | [
"def",
"async_numeric_state",
"(",
"# noqa: C901",
"hass",
":",
"HomeAssistant",
",",
"entity",
":",
"None",
"|",
"str",
"|",
"State",
",",
"below",
":",
"float",
"|",
"str",
"|",
"None",
"=",
"None",
",",
"above",
":",
"float",
"|",
"str",
"|",
"None"... | [
315,
0
] | [
430,
15
] | python | en | ['ro', 'en', 'en'] | True |
async_numeric_state_from_config | (
config: ConfigType, config_validation: bool = True
) | Wrap action method with state based condition. | Wrap action method with state based condition. | def async_numeric_state_from_config(
config: ConfigType, config_validation: bool = True
) -> ConditionCheckerType:
"""Wrap action method with state based condition."""
if config_validation:
config = cv.NUMERIC_STATE_CONDITION_SCHEMA(config)
entity_ids = config.get(CONF_ENTITY_ID, [])
attribu... | [
"def",
"async_numeric_state_from_config",
"(",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
"=",
"True",
")",
"->",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"cv",
".",
"NUMERIC_STATE_CONDITION_SCHEMA",
"(",
"... | [
433,
0
] | [
480,
27
] | python | en | ['en', 'en', 'en'] | True |
state | (
hass: HomeAssistant,
entity: None | str | State,
req_state: Any,
for_period: timedelta | None = None,
attribute: str | None = None,
) | Test if state matches requirements.
Async friendly.
| Test if state matches requirements. | def state(
hass: HomeAssistant,
entity: None | str | State,
req_state: Any,
for_period: timedelta | None = None,
attribute: str | None = None,
) -> bool:
"""Test if state matches requirements.
Async friendly.
"""
if entity is None:
raise ConditionErrorMessage("state", "no en... | [
"def",
"state",
"(",
"hass",
":",
"HomeAssistant",
",",
"entity",
":",
"None",
"|",
"str",
"|",
"State",
",",
"req_state",
":",
"Any",
",",
"for_period",
":",
"timedelta",
"|",
"None",
"=",
"None",
",",
"attribute",
":",
"str",
"|",
"None",
"=",
"Non... | [
483,
0
] | [
545,
22
] | python | en | ['en', 'en', 'en'] | True |
state_from_config | (
config: ConfigType, config_validation: bool = True
) | Wrap action method with state based condition. | Wrap action method with state based condition. | def state_from_config(
config: ConfigType, config_validation: bool = True
) -> ConditionCheckerType:
"""Wrap action method with state based condition."""
if config_validation:
config = cv.STATE_CONDITION_SCHEMA(config)
entity_ids = config.get(CONF_ENTITY_ID, [])
req_states: str | list[str] =... | [
"def",
"state_from_config",
"(",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
"=",
"True",
")",
"->",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"cv",
".",
"STATE_CONDITION_SCHEMA",
"(",
"config",
")",
"ent... | [
548,
0
] | [
584,
19
] | python | en | ['en', 'en', 'en'] | True |
sun | (
hass: HomeAssistant,
before: str | None = None,
after: str | None = None,
before_offset: timedelta | None = None,
after_offset: timedelta | None = None,
) | Test if current time matches sun requirements. | Test if current time matches sun requirements. | def sun(
hass: HomeAssistant,
before: str | None = None,
after: str | None = None,
before_offset: timedelta | None = None,
after_offset: timedelta | None = None,
) -> bool:
"""Test if current time matches sun requirements."""
utcnow = dt_util.utcnow()
today = dt_util.as_local(utcnow).dat... | [
"def",
"sun",
"(",
"hass",
":",
"HomeAssistant",
",",
"before",
":",
"str",
"|",
"None",
"=",
"None",
",",
"after",
":",
"str",
"|",
"None",
"=",
"None",
",",
"before_offset",
":",
"timedelta",
"|",
"None",
"=",
"None",
",",
"after_offset",
":",
"tim... | [
587,
0
] | [
653,
15
] | python | en | ['en', 'en', 'en'] | True |
sun_from_config | (
config: ConfigType, config_validation: bool = True
) | Wrap action method with sun based condition. | Wrap action method with sun based condition. | def sun_from_config(
config: ConfigType, config_validation: bool = True
) -> ConditionCheckerType:
"""Wrap action method with sun based condition."""
if config_validation:
config = cv.SUN_CONDITION_SCHEMA(config)
before = config.get("before")
after = config.get("after")
before_offset = c... | [
"def",
"sun_from_config",
"(",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
"=",
"True",
")",
"->",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"cv",
".",
"SUN_CONDITION_SCHEMA",
"(",
"config",
")",
"before"... | [
656,
0
] | [
672,
17
] | python | en | ['en', 'en', 'en'] | True |
template | (
hass: HomeAssistant, value_template: Template, variables: TemplateVarsType = None
) | Test if template condition matches. | Test if template condition matches. | def template(
hass: HomeAssistant, value_template: Template, variables: TemplateVarsType = None
) -> bool:
"""Test if template condition matches."""
return run_callback_threadsafe(
hass.loop, async_template, hass, value_template, variables
).result() | [
"def",
"template",
"(",
"hass",
":",
"HomeAssistant",
",",
"value_template",
":",
"Template",
",",
"variables",
":",
"TemplateVarsType",
"=",
"None",
")",
"->",
"bool",
":",
"return",
"run_callback_threadsafe",
"(",
"hass",
".",
"loop",
",",
"async_template",
... | [
675,
0
] | [
681,
14
] | python | en | ['en', 'en', 'en'] | True |
async_template | (
hass: HomeAssistant,
value_template: Template,
variables: TemplateVarsType = None,
trace_result: bool = True,
) | Test if template condition matches. | Test if template condition matches. | def async_template(
hass: HomeAssistant,
value_template: Template,
variables: TemplateVarsType = None,
trace_result: bool = True,
) -> bool:
"""Test if template condition matches."""
try:
info = value_template.async_render_to_info(variables, parse_result=False)
value = info.resul... | [
"def",
"async_template",
"(",
"hass",
":",
"HomeAssistant",
",",
"value_template",
":",
"Template",
",",
"variables",
":",
"TemplateVarsType",
"=",
"None",
",",
"trace_result",
":",
"bool",
"=",
"True",
",",
")",
"->",
"bool",
":",
"try",
":",
"info",
"=",... | [
684,
0
] | [
700,
17
] | python | en | ['en', 'en', 'en'] | True |
async_template_from_config | (
config: ConfigType, config_validation: bool = True
) | Wrap action method with state based condition. | Wrap action method with state based condition. | def async_template_from_config(
config: ConfigType, config_validation: bool = True
) -> ConditionCheckerType:
"""Wrap action method with state based condition."""
if config_validation:
config = cv.TEMPLATE_CONDITION_SCHEMA(config)
value_template = cast(Template, config.get(CONF_VALUE_TEMPLATE))
... | [
"def",
"async_template_from_config",
"(",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
"=",
"True",
")",
"->",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"cv",
".",
"TEMPLATE_CONDITION_SCHEMA",
"(",
"config",
... | [
703,
0
] | [
718,
22
] | python | en | ['en', 'en', 'en'] | True |
time | (
hass: HomeAssistant,
before: dt_util.dt.time | str | None = None,
after: dt_util.dt.time | str | None = None,
weekday: None | str | Container[str] = None,
) | Test if local time condition matches.
Handle the fact that time is continuous and we may be testing for
a period that crosses midnight. In that case it is easier to test
for the opposite. "(23:59 <= now < 00:01)" would be the same as
"not (00:01 <= now < 23:59)".
| Test if local time condition matches. | def time(
hass: HomeAssistant,
before: dt_util.dt.time | str | None = None,
after: dt_util.dt.time | str | None = None,
weekday: None | str | Container[str] = None,
) -> bool:
"""Test if local time condition matches.
Handle the fact that time is continuous and we may be testing for
a period... | [
"def",
"time",
"(",
"hass",
":",
"HomeAssistant",
",",
"before",
":",
"dt_util",
".",
"dt",
".",
"time",
"|",
"str",
"|",
"None",
"=",
"None",
",",
"after",
":",
"dt_util",
".",
"dt",
".",
"time",
"|",
"str",
"|",
"None",
"=",
"None",
",",
"weekd... | [
721,
0
] | [
807,
15
] | python | en | ['en', 'en', 'en'] | True |
time_from_config | (
config: ConfigType, config_validation: bool = True
) | Wrap action method with time based condition. | Wrap action method with time based condition. | def time_from_config(
config: ConfigType, config_validation: bool = True
) -> ConditionCheckerType:
"""Wrap action method with time based condition."""
if config_validation:
config = cv.TIME_CONDITION_SCHEMA(config)
before = config.get(CONF_BEFORE)
after = config.get(CONF_AFTER)
weekday ... | [
"def",
"time_from_config",
"(",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
"=",
"True",
")",
"->",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"cv",
".",
"TIME_CONDITION_SCHEMA",
"(",
"config",
")",
"befor... | [
810,
0
] | [
825,
18
] | 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.