Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
test_extract_all_use_match_all | (hass, caplog) | Test extract all with None and *. | Test extract all with None and *. | async def test_extract_all_use_match_all(hass, caplog):
"""Test extract all with None and *."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
await component.async_add_entities(
[MockEntity(name="test_1"), MockEntity(name="test_2")]
)
call = ha.ServiceCall("test", "service", {"entity_i... | [
"async",
"def",
"test_extract_all_use_match_all",
"(",
"hass",
",",
"caplog",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"await",
"component",
".",
"async_add_entities",
"(",
"[",
"MockEntity",
"(",
"name",
... | [
424,
0
] | [
438,
24
] | python | en | ['en', 'en', 'en'] | True |
test_register_entity_service | (hass) | Test not expanding a group. | Test not expanding a group. | async def test_register_entity_service(hass):
"""Test not expanding a group."""
entity = MockEntity(entity_id=f"{DOMAIN}.entity")
calls = []
@ha.callback
def appender(**kwargs):
calls.append(kwargs)
entity.async_called_by_service = appender
component = EntityComponent(_LOGGER, DOM... | [
"async",
"def",
"test_register_entity_service",
"(",
"hass",
")",
":",
"entity",
"=",
"MockEntity",
"(",
"entity_id",
"=",
"f\"{DOMAIN}.entity\"",
")",
"calls",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"appender",
"(",
"*",
"*",
"kwargs",
")",
":"... | [
441,
0
] | [
488,
26
] | python | en | ['en', 'en', 'en'] | True |
test_valid_config | (hass) | Test configuration. | Test configuration. | async def test_valid_config(hass):
"""Test configuration."""
assert await async_setup_component(
hass,
"rfxtrx",
{
"rfxtrx": {
"device": "/dev/serial/by-id/usb"
+ "-RFXCOM_RFXtrx433_A1Y0NJGR-if00-port0",
}
},
) | [
"async",
"def",
"test_valid_config",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"rfxtrx\"",
",",
"{",
"\"rfxtrx\"",
":",
"{",
"\"device\"",
":",
"\"/dev/serial/by-id/usb\"",
"+",
"\"-RFXCOM_RFXtrx433_A1Y0NJGR-if00-port0\"",
... | [
12,
0
] | [
23,
5
] | python | en | ['en', 'fr', 'en'] | False |
test_valid_config2 | (hass) | Test configuration. | Test configuration. | async def test_valid_config2(hass):
"""Test configuration."""
assert await async_setup_component(
hass,
"rfxtrx",
{
"rfxtrx": {
"device": "/dev/serial/by-id/usb"
+ "-RFXCOM_RFXtrx433_A1Y0NJGR-if00-port0",
"debug": True,
... | [
"async",
"def",
"test_valid_config2",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"rfxtrx\"",
",",
"{",
"\"rfxtrx\"",
":",
"{",
"\"device\"",
":",
"\"/dev/serial/by-id/usb\"",
"+",
"\"-RFXCOM_RFXtrx433_A1Y0NJGR-if00-port0\"",
... | [
26,
0
] | [
38,
5
] | python | en | ['en', 'fr', 'en'] | False |
test_invalid_config | (hass) | Test configuration. | Test configuration. | async def test_invalid_config(hass):
"""Test configuration."""
assert not await async_setup_component(hass, "rfxtrx", {"rfxtrx": {}})
assert not await async_setup_component(
hass,
"rfxtrx",
{
"rfxtrx": {
"device": "/dev/serial/by-id/usb"
+... | [
"async",
"def",
"test_invalid_config",
"(",
"hass",
")",
":",
"assert",
"not",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"rfxtrx\"",
",",
"{",
"\"rfxtrx\"",
":",
"{",
"}",
"}",
")",
"assert",
"not",
"await",
"async_setup_component",
"(",
"hass",
... | [
41,
0
] | [
55,
5
] | python | en | ['en', 'fr', 'en'] | False |
test_fire_event | (hass, rfxtrx) | Test fire event. | Test fire event. | async def test_fire_event(hass, rfxtrx):
"""Test fire event."""
entry_data = create_rfx_test_cfg(
device="/dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1Y0NJGR-if00-port0",
automatic_add=True,
devices={
"0b1100cd0213c7f210010f51": {"fire_event": True},
"0716000100900970... | [
"async",
"def",
"test_fire_event",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"device",
"=",
"\"/dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1Y0NJGR-if00-port0\"",
",",
"automatic_add",
"=",
"True",
",",
"devices",
"=",
"{",
"\"0b1... | [
58,
0
] | [
106,
5
] | python | en | ['fr', 'lb', 'en'] | False |
test_send | (hass, rfxtrx) | Test configuration. | Test configuration. | async def test_send(hass, rfxtrx):
"""Test configuration."""
entry_data = create_rfx_test_cfg(device="/dev/null", devices={})
mock_entry = MockConfigEntry(domain="rfxtrx", unique_id=DOMAIN, data=entry_data)
mock_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_entry.entry_id)
... | [
"async",
"def",
"test_send",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"device",
"=",
"\"/dev/null\"",
",",
"devices",
"=",
"{",
"}",
")",
"mock_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"rfxtrx\"",
",",... | [
109,
0
] | [
125,
5
] | python | en | ['en', 'fr', 'en'] | False |
get_tracker | (hass, config) | Create a tracker. | Create a tracker. | async def get_tracker(hass, config):
"""Create a tracker."""
yaml_path = hass.config.path(YAML_DEVICES)
conf = config.get(DOMAIN, [])
conf = conf[0] if conf else {}
consider_home = conf.get(CONF_CONSIDER_HOME, DEFAULT_CONSIDER_HOME)
defaults = conf.get(CONF_NEW_DEVICE_DEFAULTS, {})
track_n... | [
"async",
"def",
"get_tracker",
"(",
"hass",
",",
"config",
")",
":",
"yaml_path",
"=",
"hass",
".",
"config",
".",
"path",
"(",
"YAML_DEVICES",
")",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
",",
"[",
"]",
")",
"conf",
"=",
"conf",
"[",
"0"... | [
53,
0
] | [
68,
18
] | python | en | ['en', 'gd', 'en'] | True |
async_load_config | (
path: str, hass: HomeAssistantType, consider_home: timedelta
) | Load devices from YAML configuration file.
This method is a coroutine.
| Load devices from YAML configuration file. | async def async_load_config(
path: str, hass: HomeAssistantType, consider_home: timedelta
):
"""Load devices from YAML configuration file.
This method is a coroutine.
"""
dev_schema = vol.Schema(
{
vol.Required(CONF_NAME): cv.string,
vol.Optional(CONF_ICON, default=N... | [
"async",
"def",
"async_load_config",
"(",
"path",
":",
"str",
",",
"hass",
":",
"HomeAssistantType",
",",
"consider_home",
":",
"timedelta",
")",
":",
"dev_schema",
"=",
"vol",
".",
"Schema",
"(",
"{",
"vol",
".",
"Required",
"(",
"CONF_NAME",
")",
":",
... | [
500,
0
] | [
542,
17
] | python | en | ['en', 'en', 'en'] | True |
update_config | (path: str, dev_id: str, device: Device) | Add device to YAML configuration file. | Add device to YAML configuration file. | def update_config(path: str, dev_id: str, device: Device):
"""Add device to YAML configuration file."""
with open(path, "a") as out:
device = {
device.dev_id: {
ATTR_NAME: device.name,
ATTR_MAC: device.mac,
ATTR_ICON: device.icon,
... | [
"def",
"update_config",
"(",
"path",
":",
"str",
",",
"dev_id",
":",
"str",
",",
"device",
":",
"Device",
")",
":",
"with",
"open",
"(",
"path",
",",
"\"a\"",
")",
"as",
"out",
":",
"device",
"=",
"{",
"device",
".",
"dev_id",
":",
"{",
"ATTR_NAME"... | [
545,
0
] | [
558,
31
] | python | en | ['en', 'en', 'en'] | True |
get_gravatar_for_email | (email: str) | Return an 80px Gravatar for the given email address.
Async friendly.
| Return an 80px Gravatar for the given email address. | def get_gravatar_for_email(email: str):
"""Return an 80px Gravatar for the given email address.
Async friendly.
"""
return (
f"https://www.gravatar.com/avatar/"
f"{hashlib.md5(email.encode('utf-8').lower()).hexdigest()}.jpg?s=80&d=wavatar"
) | [
"def",
"get_gravatar_for_email",
"(",
"email",
":",
"str",
")",
":",
"return",
"(",
"f\"https://www.gravatar.com/avatar/\"",
"f\"{hashlib.md5(email.encode('utf-8').lower()).hexdigest()}.jpg?s=80&d=wavatar\"",
")"
] | [
561,
0
] | [
570,
5
] | python | en | ['en', 'en', 'en'] | True |
DeviceTracker.__init__ | (
self,
hass: HomeAssistantType,
consider_home: timedelta,
track_new: bool,
defaults: dict,
devices: Sequence,
) | Initialize a device tracker. | Initialize a device tracker. | def __init__(
self,
hass: HomeAssistantType,
consider_home: timedelta,
track_new: bool,
defaults: dict,
devices: Sequence,
) -> None:
"""Initialize a device tracker."""
self.hass = hass
self.devices = {dev.dev_id: dev for dev in devices}
... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
",",
"consider_home",
":",
"timedelta",
",",
"track_new",
":",
"bool",
",",
"defaults",
":",
"dict",
",",
"devices",
":",
"Sequence",
",",
")",
"->",
"None",
":",
"self",
".",
"hass",... | [
74,
4
] | [
99,
85
] | python | en | ['es', 'en', 'en'] | True |
DeviceTracker.see | (
self,
mac: str = None,
dev_id: str = None,
host_name: str = None,
location_name: str = None,
gps: GPSType = None,
gps_accuracy: int = None,
battery: int = None,
attributes: dict = None,
source_type: str = SOURCE_TYPE_GPS,
picture:... | Notify the device tracker that you see a device. | Notify the device tracker that you see a device. | def see(
self,
mac: str = None,
dev_id: str = None,
host_name: str = None,
location_name: str = None,
gps: GPSType = None,
gps_accuracy: int = None,
battery: int = None,
attributes: dict = None,
source_type: str = SOURCE_TYPE_GPS,
p... | [
"def",
"see",
"(",
"self",
",",
"mac",
":",
"str",
"=",
"None",
",",
"dev_id",
":",
"str",
"=",
"None",
",",
"host_name",
":",
"str",
"=",
"None",
",",
"location_name",
":",
"str",
"=",
"None",
",",
"gps",
":",
"GPSType",
"=",
"None",
",",
"gps_a... | [
101,
4
] | [
132,
9
] | python | en | ['en', 'en', 'en'] | True |
DeviceTracker.async_see | (
self,
mac: str = None,
dev_id: str = None,
host_name: str = None,
location_name: str = None,
gps: GPSType = None,
gps_accuracy: int = None,
battery: int = None,
attributes: dict = None,
source_type: str = SOURCE_TYPE_GPS,
picture:... | Notify the device tracker that you see a device.
This method is a coroutine.
| Notify the device tracker that you see a device. | async def async_see(
self,
mac: str = None,
dev_id: str = None,
host_name: str = None,
location_name: str = None,
gps: GPSType = None,
gps_accuracy: int = None,
battery: int = None,
attributes: dict = None,
source_type: str = SOURCE_TYPE_GP... | [
"async",
"def",
"async_see",
"(",
"self",
",",
"mac",
":",
"str",
"=",
"None",
",",
"dev_id",
":",
"str",
"=",
"None",
",",
"host_name",
":",
"str",
"=",
"None",
",",
"location_name",
":",
"str",
"=",
"None",
",",
"gps",
":",
"GPSType",
"=",
"None"... | [
134,
4
] | [
230,
9
] | python | en | ['en', 'en', 'en'] | True |
DeviceTracker.async_update_config | (self, path, dev_id, device) | Add device to YAML configuration file.
This method is a coroutine.
| Add device to YAML configuration file. | async def async_update_config(self, path, dev_id, device):
"""Add device to YAML configuration file.
This method is a coroutine.
"""
async with self._is_updating:
await self.hass.async_add_executor_job(
update_config, self.hass.config.path(YAML_DEVICES), dev_... | [
"async",
"def",
"async_update_config",
"(",
"self",
",",
"path",
",",
"dev_id",
",",
"device",
")",
":",
"async",
"with",
"self",
".",
"_is_updating",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"update_config",
",",
"self",
".",
... | [
232,
4
] | [
240,
13
] | python | en | ['en', 'en', 'en'] | True |
DeviceTracker.async_update_stale | (self, now: dt_util.dt.datetime) | Update stale devices.
This method must be run in the event loop.
| Update stale devices. | def async_update_stale(self, now: dt_util.dt.datetime):
"""Update stale devices.
This method must be run in the event loop.
"""
for device in self.devices.values():
if (device.track and device.last_update_home) and device.stale(now):
self.hass.async_create_ta... | [
"def",
"async_update_stale",
"(",
"self",
",",
"now",
":",
"dt_util",
".",
"dt",
".",
"datetime",
")",
":",
"for",
"device",
"in",
"self",
".",
"devices",
".",
"values",
"(",
")",
":",
"if",
"(",
"device",
".",
"track",
"and",
"device",
".",
"last_up... | [
243,
4
] | [
250,
79
] | python | en | ['ro', 'en', 'en'] | True |
DeviceTracker.async_setup_tracked_device | (self) | Set up all not exists tracked devices.
This method is a coroutine.
| Set up all not exists tracked devices. | async def async_setup_tracked_device(self):
"""Set up all not exists tracked devices.
This method is a coroutine.
"""
async def async_init_single_device(dev):
"""Init a single device_tracker entity."""
await dev.async_added_to_hass()
dev.async_write_... | [
"async",
"def",
"async_setup_tracked_device",
"(",
"self",
")",
":",
"async",
"def",
"async_init_single_device",
"(",
"dev",
")",
":",
"\"\"\"Init a single device_tracker entity.\"\"\"",
"await",
"dev",
".",
"async_added_to_hass",
"(",
")",
"dev",
".",
"async_write_ha_s... | [
252,
4
] | [
271,
37
] | python | en | ['en', 'en', 'en'] | True |
Device.__init__ | (
self,
hass: HomeAssistantType,
consider_home: timedelta,
track: bool,
dev_id: str,
mac: str,
name: str = None,
picture: str = None,
gravatar: str = None,
icon: str = None,
) | Initialize a device. | Initialize a device. | def __init__(
self,
hass: HomeAssistantType,
consider_home: timedelta,
track: bool,
dev_id: str,
mac: str,
name: str = None,
picture: str = None,
gravatar: str = None,
icon: str = None,
) -> None:
"""Initialize a device."""
... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
",",
"consider_home",
":",
"timedelta",
",",
"track",
":",
"bool",
",",
"dev_id",
":",
"str",
",",
"mac",
":",
"str",
",",
"name",
":",
"str",
"=",
"None",
",",
"picture",
":",
"s... | [
291,
4
] | [
331,
29
] | python | en | ['es', 'en', 'en'] | True |
Device.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self):
"""Return the name of the entity."""
return self.config_name or self.host_name or self.dev_id or DEVICE_DEFAULT_NAME | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"config_name",
"or",
"self",
".",
"host_name",
"or",
"self",
".",
"dev_id",
"or",
"DEVICE_DEFAULT_NAME"
] | [
334,
4
] | [
336,
87
] | python | en | ['en', 'en', 'en'] | True |
Device.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
339,
4
] | [
341,
26
] | python | en | ['en', 'en', 'en'] | True |
Device.entity_picture | (self) | Return the picture of the device. | Return the picture of the device. | def entity_picture(self):
"""Return the picture of the device."""
return self.config_picture | [
"def",
"entity_picture",
"(",
"self",
")",
":",
"return",
"self",
".",
"config_picture"
] | [
344,
4
] | [
346,
34
] | python | en | ['en', 'en', 'en'] | True |
Device.state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def state_attributes(self):
"""Return the device state attributes."""
attr = {ATTR_SOURCE_TYPE: self.source_type}
if self.gps:
attr[ATTR_LATITUDE] = self.gps[0]
attr[ATTR_LONGITUDE] = self.gps[1]
attr[ATTR_GPS_ACCURACY] = self.gps_accuracy
if self.ba... | [
"def",
"state_attributes",
"(",
"self",
")",
":",
"attr",
"=",
"{",
"ATTR_SOURCE_TYPE",
":",
"self",
".",
"source_type",
"}",
"if",
"self",
".",
"gps",
":",
"attr",
"[",
"ATTR_LATITUDE",
"]",
"=",
"self",
".",
"gps",
"[",
"0",
"]",
"attr",
"[",
"ATTR... | [
349,
4
] | [
361,
19
] | python | en | ['en', 'en', 'en'] | True |
Device.device_state_attributes | (self) | Return device state attributes. | Return device state attributes. | def device_state_attributes(self):
"""Return device state attributes."""
return self._attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attributes"
] | [
364,
4
] | [
366,
31
] | python | en | ['es', 'en', 'en'] | True |
Device.async_seen | (
self,
host_name: str = None,
location_name: str = None,
gps: GPSType = None,
gps_accuracy=0,
battery: int = None,
attributes: dict = None,
source_type: str = SOURCE_TYPE_GPS,
consider_home: timedelta = None,
) | Mark the device as seen. | Mark the device as seen. | async def async_seen(
self,
host_name: str = None,
location_name: str = None,
gps: GPSType = None,
gps_accuracy=0,
battery: int = None,
attributes: dict = None,
source_type: str = SOURCE_TYPE_GPS,
consider_home: timedelta = None,
):
"""... | [
"async",
"def",
"async_seen",
"(",
"self",
",",
"host_name",
":",
"str",
"=",
"None",
",",
"location_name",
":",
"str",
"=",
"None",
",",
"gps",
":",
"GPSType",
"=",
"None",
",",
"gps_accuracy",
"=",
"0",
",",
"battery",
":",
"int",
"=",
"None",
",",... | [
368,
4
] | [
402,
33
] | python | en | ['en', 'en', 'en'] | True |
Device.stale | (self, now: dt_util.dt.datetime = None) | Return if device state is stale.
Async friendly.
| Return if device state is stale. | def stale(self, now: dt_util.dt.datetime = None):
"""Return if device state is stale.
Async friendly.
"""
return (
self.last_seen is None
or (now or dt_util.utcnow()) - self.last_seen > self.consider_home
) | [
"def",
"stale",
"(",
"self",
",",
"now",
":",
"dt_util",
".",
"dt",
".",
"datetime",
"=",
"None",
")",
":",
"return",
"(",
"self",
".",
"last_seen",
"is",
"None",
"or",
"(",
"now",
"or",
"dt_util",
".",
"utcnow",
"(",
")",
")",
"-",
"self",
".",
... | [
404,
4
] | [
412,
9
] | python | en | ['en', 'en', 'en'] | True |
Device.mark_stale | (self) | Mark the device state as stale. | Mark the device state as stale. | def mark_stale(self):
"""Mark the device state as stale."""
self._state = STATE_NOT_HOME
self.gps = None
self.last_update_home = False | [
"def",
"mark_stale",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"STATE_NOT_HOME",
"self",
".",
"gps",
"=",
"None",
"self",
".",
"last_update_home",
"=",
"False"
] | [
414,
4
] | [
418,
37
] | python | en | ['en', 'en', 'en'] | True |
Device.async_update | (self) | Update state of entity.
This method is a coroutine.
| Update state of entity. | async def async_update(self):
"""Update state of entity.
This method is a coroutine.
"""
if not self.last_seen:
return
if self.location_name:
self._state = self.location_name
elif self.gps is not None and self.source_type == SOURCE_TYPE_GPS:
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"last_seen",
":",
"return",
"if",
"self",
".",
"location_name",
":",
"self",
".",
"_state",
"=",
"self",
".",
"location_name",
"elif",
"self",
".",
"gps",
"is",
"not",
"No... | [
420,
4
] | [
443,
40
] | python | en | ['en', 'en', 'en'] | True |
Device.async_added_to_hass | (self) | Add an entity. | Add an entity. | async def async_added_to_hass(self):
"""Add an entity."""
await super().async_added_to_hass()
state = await self.async_get_last_state()
if not state:
return
self._state = state.state
self.last_update_home = state.state == STATE_HOME
self.last_seen = dt... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"state",
"=",
"await",
"self",
".",
"async_get_last_state",
"(",
")",
"if",
"not",
"state",
":",
"return",
"self",
".",
"_state"... | [
445,
4
] | [
467,
13
] | python | en | ['en', 'cy', 'en'] | True |
DeviceScanner.scan_devices | (self) | Scan for devices. | Scan for devices. | def scan_devices(self) -> List[str]:
"""Scan for devices."""
raise NotImplementedError() | [
"def",
"scan_devices",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
475,
4
] | [
477,
35
] | python | en | ['no', 'en', 'en'] | True |
DeviceScanner.async_scan_devices | (self) | Scan for devices. | Scan for devices. | async def async_scan_devices(self) -> Any:
"""Scan for devices."""
return await self.hass.async_add_executor_job(self.scan_devices) | [
"async",
"def",
"async_scan_devices",
"(",
"self",
")",
"->",
"Any",
":",
"return",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"scan_devices",
")"
] | [
479,
4
] | [
481,
72
] | python | en | ['no', 'en', 'en'] | True |
DeviceScanner.get_device_name | (self, device: str) | Get the name of a device. | Get the name of a device. | def get_device_name(self, device: str) -> str:
"""Get the name of a device."""
raise NotImplementedError() | [
"def",
"get_device_name",
"(",
"self",
",",
"device",
":",
"str",
")",
"->",
"str",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
483,
4
] | [
485,
35
] | python | en | ['en', 'en', 'en'] | True |
DeviceScanner.async_get_device_name | (self, device: str) | Get the name of a device. | Get the name of a device. | async def async_get_device_name(self, device: str) -> Any:
"""Get the name of a device."""
return await self.hass.async_add_executor_job(self.get_device_name, device) | [
"async",
"def",
"async_get_device_name",
"(",
"self",
",",
"device",
":",
"str",
")",
"->",
"Any",
":",
"return",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"get_device_name",
",",
"device",
")"
] | [
487,
4
] | [
489,
83
] | python | en | ['en', 'en', 'en'] | True |
DeviceScanner.get_extra_attributes | (self, device: str) | Get the extra attributes of a device. | Get the extra attributes of a device. | def get_extra_attributes(self, device: str) -> dict:
"""Get the extra attributes of a device."""
raise NotImplementedError() | [
"def",
"get_extra_attributes",
"(",
"self",
",",
"device",
":",
"str",
")",
"->",
"dict",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
491,
4
] | [
493,
35
] | python | en | ['en', 'en', 'en'] | True |
DeviceScanner.async_get_extra_attributes | (self, device: str) | Get the extra attributes of a device. | Get the extra attributes of a device. | async def async_get_extra_attributes(self, device: str) -> Any:
"""Get the extra attributes of a device."""
return await self.hass.async_add_executor_job(self.get_extra_attributes, device) | [
"async",
"def",
"async_get_extra_attributes",
"(",
"self",
",",
"device",
":",
"str",
")",
"->",
"Any",
":",
"return",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"get_extra_attributes",
",",
"device",
")"
] | [
495,
4
] | [
497,
88
] | python | en | ['en', 'en', 'en'] | True |
test_import_usb | (hass, dsmr_connection_send_validate_fixture) | Test we can import. | Test we can import. | async def test_import_usb(hass, dsmr_connection_send_validate_fixture):
"""Test we can import."""
await setup.async_setup_component(hass, "persistent_notification", {})
entry_data = {
"port": "/dev/ttyUSB0",
"dsmr_version": "2.2",
"precision": 4,
"reconnect_interval": 30,
... | [
"async",
"def",
"test_import_usb",
"(",
"hass",
",",
"dsmr_connection_send_validate_fixture",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry_data",
"=",
"{",
"\"port\"",
":",
"\... | [
15,
0
] | [
35,
58
] | python | en | ['en', 'en', 'en'] | True |
test_import_usb_failed_connection | (
hass, dsmr_connection_send_validate_fixture
) | Test we can import. | Test we can import. | async def test_import_usb_failed_connection(
hass, dsmr_connection_send_validate_fixture
):
"""Test we can import."""
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
await setup.async_setup_component(hass, "persistent_notification", {})
entry_data = {
"por... | [
"async",
"def",
"test_import_usb_failed_connection",
"(",
"hass",
",",
"dsmr_connection_send_validate_fixture",
")",
":",
"(",
"connection_factory",
",",
"transport",
",",
"protocol",
")",
"=",
"dsmr_connection_send_validate_fixture",
"await",
"setup",
".",
"async_setup_com... | [
38,
0
] | [
72,
47
] | python | en | ['en', 'en', 'en'] | True |
test_import_usb_no_data | (hass, dsmr_connection_send_validate_fixture) | Test we can import. | Test we can import. | async def test_import_usb_no_data(hass, dsmr_connection_send_validate_fixture):
"""Test we can import."""
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
await setup.async_setup_component(hass, "persistent_notification", {})
entry_data = {
"port": "/dev/ttyUSB... | [
"async",
"def",
"test_import_usb_no_data",
"(",
"hass",
",",
"dsmr_connection_send_validate_fixture",
")",
":",
"(",
"connection_factory",
",",
"transport",
",",
"protocol",
")",
"=",
"dsmr_connection_send_validate_fixture",
"await",
"setup",
".",
"async_setup_component",
... | [
75,
0
] | [
104,
51
] | python | en | ['en', 'en', 'en'] | True |
test_import_usb_wrong_telegram | (hass, dsmr_connection_send_validate_fixture) | Test we can import. | Test we can import. | async def test_import_usb_wrong_telegram(hass, dsmr_connection_send_validate_fixture):
"""Test we can import."""
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
await setup.async_setup_component(hass, "persistent_notification", {})
entry_data = {
"port": "/dev... | [
"async",
"def",
"test_import_usb_wrong_telegram",
"(",
"hass",
",",
"dsmr_connection_send_validate_fixture",
")",
":",
"(",
"connection_factory",
",",
"transport",
",",
"protocol",
")",
"=",
"dsmr_connection_send_validate_fixture",
"await",
"setup",
".",
"async_setup_compon... | [
107,
0
] | [
130,
51
] | python | en | ['en', 'en', 'en'] | True |
test_import_network | (hass, dsmr_connection_send_validate_fixture) | Test we can import from network. | Test we can import from network. | async def test_import_network(hass, dsmr_connection_send_validate_fixture):
"""Test we can import from network."""
await setup.async_setup_component(hass, "persistent_notification", {})
entry_data = {
"host": "localhost",
"port": "1234",
"dsmr_version": "2.2",
"precision": 4... | [
"async",
"def",
"test_import_network",
"(",
"hass",
",",
"dsmr_connection_send_validate_fixture",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry_data",
"=",
"{",
"\"host\"",
":",
... | [
133,
0
] | [
154,
58
] | python | en | ['en', 'en', 'en'] | True |
test_import_update | (hass, dsmr_connection_send_validate_fixture) | Test we can import. | Test we can import. | async def test_import_update(hass, dsmr_connection_send_validate_fixture):
"""Test we can import."""
await setup.async_setup_component(hass, "persistent_notification", {})
entry_data = {
"port": "/dev/ttyUSB0",
"dsmr_version": "2.2",
"precision": 4,
"reconnect_interval": 30,... | [
"async",
"def",
"test_import_update",
"(",
"hass",
",",
"dsmr_connection_send_validate_fixture",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry_data",
"=",
"{",
"\"port\"",
":",
... | [
157,
0
] | [
203,
39
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow | (hass) | Test options flow. | Test options flow. | async def test_options_flow(hass):
"""Test options flow."""
await setup.async_setup_component(hass, "persistent_notification", {})
entry_data = {
"port": "/dev/ttyUSB0",
"dsmr_version": "2.2",
"precision": 4,
"reconnect_interval": 30,
}
entry = MockConfigEntry(
... | [
"async",
"def",
"test_options_flow",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry_data",
"=",
"{",
"\"port\"",
":",
"\"/dev/ttyUSB0\"",
",",
"\"dsmr_version\"",
... | [
206,
0
] | [
243,
55
] | python | en | ['en', 'fr', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the BeagleBone Black GPIO devices. | Set up the BeagleBone Black GPIO devices. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the BeagleBone Black GPIO devices."""
pins = config[CONF_PINS]
switches = []
for pin, params in pins.items():
switches.append(BBBGPIOSwitch(pin, params))
add_entities(switches) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"pins",
"=",
"config",
"[",
"CONF_PINS",
"]",
"switches",
"=",
"[",
"]",
"for",
"pin",
",",
"params",
"in",
"pins",
".",
"items",
"(... | [
26,
0
] | [
33,
26
] | python | en | ['en', 'pt', 'en'] | True |
BBBGPIOSwitch.__init__ | (self, pin, params) | Initialize the pin. | Initialize the pin. | def __init__(self, pin, params):
"""Initialize the pin."""
self._pin = pin
self._name = params[CONF_NAME] or DEVICE_DEFAULT_NAME
self._state = params[CONF_INITIAL]
self._invert_logic = params[CONF_INVERT_LOGIC]
bbb_gpio.setup_output(self._pin)
if self._state is ... | [
"def",
"__init__",
"(",
"self",
",",
"pin",
",",
"params",
")",
":",
"self",
".",
"_pin",
"=",
"pin",
"self",
".",
"_name",
"=",
"params",
"[",
"CONF_NAME",
"]",
"or",
"DEVICE_DEFAULT_NAME",
"self",
".",
"_state",
"=",
"params",
"[",
"CONF_INITIAL",
"]... | [
39,
4
] | [
51,
76
] | python | en | ['en', 'en', 'en'] | True |
BBBGPIOSwitch.name | (self) | Return the name of the switch. | Return the name of the switch. | def name(self):
"""Return the name of the switch."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
54,
4
] | [
56,
25
] | python | en | ['en', 'en', 'en'] | True |
BBBGPIOSwitch.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
59,
4
] | [
61,
20
] | python | en | ['en', 'en', 'en'] | True |
BBBGPIOSwitch.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
64,
4
] | [
66,
26
] | python | en | ['en', 'fy', 'en'] | True |
BBBGPIOSwitch.turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | def turn_on(self, **kwargs):
"""Turn the device on."""
bbb_gpio.write_output(self._pin, 0 if self._invert_logic else 1)
self._state = True
self.schedule_update_ha_state() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"bbb_gpio",
".",
"write_output",
"(",
"self",
".",
"_pin",
",",
"0",
"if",
"self",
".",
"_invert_logic",
"else",
"1",
")",
"self",
".",
"_state",
"=",
"True",
"self",
".",
"schedule_up... | [
68,
4
] | [
72,
39
] | python | en | ['en', 'en', 'en'] | True |
BBBGPIOSwitch.turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | def turn_off(self, **kwargs):
"""Turn the device off."""
bbb_gpio.write_output(self._pin, 1 if self._invert_logic else 0)
self._state = False
self.schedule_update_ha_state() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"bbb_gpio",
".",
"write_output",
"(",
"self",
".",
"_pin",
",",
"1",
"if",
"self",
".",
"_invert_logic",
"else",
"0",
")",
"self",
".",
"_state",
"=",
"False",
"self",
".",
"schedule_... | [
74,
4
] | [
78,
39
] | python | en | ['en', 'en', 'en'] | True |
ngram_attention_bias | (sequence_length, ngram, device, dtype) |
This function computes the bias for the predict stream
|
This function computes the bias for the predict stream
| def ngram_attention_bias(sequence_length, ngram, device, dtype):
"""
This function computes the bias for the predict stream
"""
left_block = torch.ones((ngram, sequence_length, sequence_length), device=device, dtype=dtype) * float("-inf")
right_block = left_block.detach().clone()
# create bias
... | [
"def",
"ngram_attention_bias",
"(",
"sequence_length",
",",
"ngram",
",",
"device",
",",
"dtype",
")",
":",
"left_block",
"=",
"torch",
".",
"ones",
"(",
"(",
"ngram",
",",
"sequence_length",
",",
"sequence_length",
")",
",",
"device",
"=",
"device",
",",
... | [
169,
0
] | [
181,
54
] | python | en | ['en', 'error', 'th'] | False |
compute_relative_buckets | (num_buckets, max_distance, relative_positions, is_bidirectional=False) |
This function computes individual parts of the relative position buckets. For more detail, see paper.
|
This function computes individual parts of the relative position buckets. For more detail, see paper.
| def compute_relative_buckets(num_buckets, max_distance, relative_positions, is_bidirectional=False):
"""
This function computes individual parts of the relative position buckets. For more detail, see paper.
"""
inv_relative_positions = -relative_positions
rel_positions_bucket = 0
if is_bidirect... | [
"def",
"compute_relative_buckets",
"(",
"num_buckets",
",",
"max_distance",
",",
"relative_positions",
",",
"is_bidirectional",
"=",
"False",
")",
":",
"inv_relative_positions",
"=",
"-",
"relative_positions",
"rel_positions_bucket",
"=",
"0",
"if",
"is_bidirectional",
... | [
184,
0
] | [
208,
31
] | python | en | ['en', 'error', 'th'] | False |
compute_all_stream_relative_buckets | (num_buckets, max_distance, position_ids) |
This function computes both main and predict relative position buckets. For more detail, see paper.
|
This function computes both main and predict relative position buckets. For more detail, see paper.
| def compute_all_stream_relative_buckets(num_buckets, max_distance, position_ids):
"""
This function computes both main and predict relative position buckets. For more detail, see paper.
"""
# main stream
main_stream_relative_positions = position_ids.unsqueeze(1).repeat(1, position_ids.size(-1), 1)
... | [
"def",
"compute_all_stream_relative_buckets",
"(",
"num_buckets",
",",
"max_distance",
",",
"position_ids",
")",
":",
"# main stream",
"main_stream_relative_positions",
"=",
"position_ids",
".",
"unsqueeze",
"(",
"1",
")",
".",
"repeat",
"(",
"1",
",",
"position_ids",... | [
211,
0
] | [
231,
76
] | python | en | ['en', 'error', 'th'] | False |
AccuWeatherFlowHandler.async_step_user | (self, user_input=None) | Handle a flow initialized by the user. | Handle a flow initialized by the user. | async def async_step_user(self, user_input=None):
"""Handle a flow initialized by the user."""
# Under the terms of use of the API, one user can use one free API key. Due to
# the small number of requests allowed, we only allow one integration instance.
if self._async_current_entries():
... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"# Under the terms of use of the API, one user can use one free API key. Due to",
"# the small number of requests allowed, we only allow one integration instance.",
"if",
"self",
".",
"_async_cu... | [
24,
4
] | [
76,
9
] | python | en | ['en', 'en', 'en'] | True |
AccuWeatherFlowHandler.async_get_options_flow | (config_entry) | Options callback for AccuWeather. | Options callback for AccuWeather. | def async_get_options_flow(config_entry):
"""Options callback for AccuWeather."""
return AccuWeatherOptionsFlowHandler(config_entry) | [
"def",
"async_get_options_flow",
"(",
"config_entry",
")",
":",
"return",
"AccuWeatherOptionsFlowHandler",
"(",
"config_entry",
")"
] | [
80,
4
] | [
82,
58
] | python | en | ['en', 'en', 'en'] | True |
AccuWeatherOptionsFlowHandler.__init__ | (self, config_entry) | Initialize AccuWeather options flow. | Initialize AccuWeather options flow. | def __init__(self, config_entry):
"""Initialize AccuWeather options flow."""
self.config_entry = config_entry | [
"def",
"__init__",
"(",
"self",
",",
"config_entry",
")",
":",
"self",
".",
"config_entry",
"=",
"config_entry"
] | [
88,
4
] | [
90,
40
] | python | en | ['en', 'en', 'en'] | True |
AccuWeatherOptionsFlowHandler.async_step_init | (self, user_input=None) | Manage the options. | Manage the options. | async def async_step_init(self, user_input=None):
"""Manage the options."""
return await self.async_step_user() | [
"async",
"def",
"async_step_init",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"return",
"await",
"self",
".",
"async_step_user",
"(",
")"
] | [
92,
4
] | [
94,
43
] | python | en | ['en', 'en', 'en'] | True |
AccuWeatherOptionsFlowHandler.async_step_user | (self, user_input=None) | Handle a flow initialized by the user. | Handle a flow initialized by the user. | async def async_step_user(self, user_input=None):
"""Handle a flow initialized by the user."""
if user_input is not None:
return self.async_create_entry(title="", data=user_input)
return self.async_show_form(
step_id="user",
data_schema=vol.Schema(
... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"return",
"self",
".",
"async_create_entry",
"(",
"title",
"=",
"\"\"",
",",
"data",
"=",
"user_input",
")",
"return",
... | [
96,
4
] | [
111,
9
] | python | en | ['en', 'en', 'en'] | True |
test_water_heater_create_sensors | (hass) | Test creation of water heater. | Test creation of water heater. | async def test_water_heater_create_sensors(hass):
"""Test creation of water heater."""
await async_init_integration(hass)
state = hass.states.get("water_heater.water_heater")
assert state.state == "auto"
expected_attributes = {
"current_temperature": None,
"friendly_name": "Water ... | [
"async",
"def",
"test_water_heater_create_sensors",
"(",
"hass",
")",
":",
"await",
"async_init_integration",
"(",
"hass",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"water_heater.water_heater\"",
")",
"assert",
"state",
".",
"state",
"==",
"\"... | [
5,
0
] | [
46,
88
] | python | en | ['en', 'en', 'en'] | True |
async_set_txt | (hass, txt) | Set the txt record. Pass in None to remove it.
This is a legacy helper method. Do not use it for new tests.
| Set the txt record. Pass in None to remove it. | async def async_set_txt(hass, txt):
"""Set the txt record. Pass in None to remove it.
This is a legacy helper method. Do not use it for new tests.
"""
await hass.services.async_call(
duckdns.DOMAIN, duckdns.SERVICE_SET_TXT, {duckdns.ATTR_TXT: txt}, blocking=True
) | [
"async",
"def",
"async_set_txt",
"(",
"hass",
",",
"txt",
")",
":",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"duckdns",
".",
"DOMAIN",
",",
"duckdns",
".",
"SERVICE_SET_TXT",
",",
"{",
"duckdns",
".",
"ATTR_TXT",
":",
"txt",
"}",
",",
... | [
21,
0
] | [
28,
5
] | python | en | ['en', 'en', 'en'] | True |
setup_duckdns | (hass, aioclient_mock) | Fixture that sets up DuckDNS. | Fixture that sets up DuckDNS. | def setup_duckdns(hass, aioclient_mock):
"""Fixture that sets up DuckDNS."""
aioclient_mock.get(
duckdns.UPDATE_URL, params={"domains": DOMAIN, "token": TOKEN}, text="OK"
)
hass.loop.run_until_complete(
async_setup_component(
hass, duckdns.DOMAIN, {"duckdns": {"domain": DOMA... | [
"def",
"setup_duckdns",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"duckdns",
".",
"UPDATE_URL",
",",
"params",
"=",
"{",
"\"domains\"",
":",
"DOMAIN",
",",
"\"token\"",
":",
"TOKEN",
"}",
",",
"text",
"=",
"\"OK\"",
... | [
32,
0
] | [
42,
5
] | python | en | ['en', 'ca', 'en'] | True |
test_setup | (hass, aioclient_mock) | Test setup works if update passes. | Test setup works if update passes. | async def test_setup(hass, aioclient_mock):
"""Test setup works if update passes."""
aioclient_mock.get(
duckdns.UPDATE_URL, params={"domains": DOMAIN, "token": TOKEN}, text="OK"
)
result = await async_setup_component(
hass, duckdns.DOMAIN, {"duckdns": {"domain": DOMAIN, "access_token":... | [
"async",
"def",
"test_setup",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"duckdns",
".",
"UPDATE_URL",
",",
"params",
"=",
"{",
"\"domains\"",
":",
"DOMAIN",
",",
"\"token\"",
":",
"TOKEN",
"}",
",",
"text",
"=",
"\"... | [
45,
0
] | [
62,
41
] | python | en | ['en', 'en', 'en'] | True |
test_setup_backoff | (hass, aioclient_mock) | Test setup fails if first update fails. | Test setup fails if first update fails. | async def test_setup_backoff(hass, aioclient_mock):
"""Test setup fails if first update fails."""
aioclient_mock.get(
duckdns.UPDATE_URL, params={"domains": DOMAIN, "token": TOKEN}, text="KO"
)
result = await async_setup_component(
hass, duckdns.DOMAIN, {"duckdns": {"domain": DOMAIN, "a... | [
"async",
"def",
"test_setup_backoff",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"duckdns",
".",
"UPDATE_URL",
",",
"params",
"=",
"{",
"\"domains\"",
":",
"DOMAIN",
",",
"\"token\"",
":",
"TOKEN",
"}",
",",
"text",
"=... | [
65,
0
] | [
95,
51
] | python | en | ['ms', 'lb', 'en'] | False |
test_service_set_txt | (hass, aioclient_mock, setup_duckdns) | Test set txt service call. | Test set txt service call. | async def test_service_set_txt(hass, aioclient_mock, setup_duckdns):
"""Test set txt service call."""
# Empty the fixture mock requests
aioclient_mock.clear_requests()
aioclient_mock.get(
duckdns.UPDATE_URL,
params={"domains": DOMAIN, "token": TOKEN, "txt": "some-txt"},
text="OK... | [
"async",
"def",
"test_service_set_txt",
"(",
"hass",
",",
"aioclient_mock",
",",
"setup_duckdns",
")",
":",
"# Empty the fixture mock requests",
"aioclient_mock",
".",
"clear_requests",
"(",
")",
"aioclient_mock",
".",
"get",
"(",
"duckdns",
".",
"UPDATE_URL",
",",
... | [
98,
0
] | [
111,
41
] | python | en | ['en', 'lb', 'en'] | True |
test_service_clear_txt | (hass, aioclient_mock, setup_duckdns) | Test clear txt service call. | Test clear txt service call. | async def test_service_clear_txt(hass, aioclient_mock, setup_duckdns):
"""Test clear txt service call."""
# Empty the fixture mock requests
aioclient_mock.clear_requests()
aioclient_mock.get(
duckdns.UPDATE_URL,
params={"domains": DOMAIN, "token": TOKEN, "txt": "", "clear": "true"},
... | [
"async",
"def",
"test_service_clear_txt",
"(",
"hass",
",",
"aioclient_mock",
",",
"setup_duckdns",
")",
":",
"# Empty the fixture mock requests",
"aioclient_mock",
".",
"clear_requests",
"(",
")",
"aioclient_mock",
".",
"get",
"(",
"duckdns",
".",
"UPDATE_URL",
",",
... | [
114,
0
] | [
127,
41
] | python | en | ['en', 'en', 'en'] | True |
test_async_track_time_interval_backoff | (hass) | Test setup fails if first update fails. | Test setup fails if first update fails. | async def test_async_track_time_interval_backoff(hass):
"""Test setup fails if first update fails."""
ret_val = False
call_count = 0
tme = None
async def _return(now):
nonlocal call_count, ret_val, tme
if tme is None:
tme = now
call_count += 1
return ret_... | [
"async",
"def",
"test_async_track_time_interval_backoff",
"(",
"hass",
")",
":",
"ret_val",
"=",
"False",
"call_count",
"=",
"0",
"tme",
"=",
"None",
"async",
"def",
"_return",
"(",
"now",
")",
":",
"nonlocal",
"call_count",
",",
"ret_val",
",",
"tme",
"if",... | [
130,
0
] | [
188,
33
] | python | en | ['ms', 'lb', 'en'] | False |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the ZoneMinder switch platform. | Set up the ZoneMinder switch platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the ZoneMinder switch platform."""
on_state = MonitorState(config.get(CONF_COMMAND_ON))
off_state = MonitorState(config.get(CONF_COMMAND_OFF))
switches = []
for zm_client in hass.data[ZONEMINDER_DOMAIN].values():
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"on_state",
"=",
"MonitorState",
"(",
"config",
".",
"get",
"(",
"CONF_COMMAND_ON",
")",
")",
"off_state",
"=",
"MonitorState",
"(",
"conf... | [
22,
0
] | [
37,
26
] | python | en | ['en', 'de', 'en'] | True |
ZMSwitchMonitors.__init__ | (self, monitor, on_state, off_state) | Initialize the switch. | Initialize the switch. | def __init__(self, monitor, on_state, off_state):
"""Initialize the switch."""
self._monitor = monitor
self._on_state = on_state
self._off_state = off_state
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"monitor",
",",
"on_state",
",",
"off_state",
")",
":",
"self",
".",
"_monitor",
"=",
"monitor",
"self",
".",
"_on_state",
"=",
"on_state",
"self",
".",
"_off_state",
"=",
"off_state",
"self",
".",
"_state",
"=",
"Non... | [
45,
4
] | [
50,
26
] | python | en | ['en', 'en', 'en'] | True |
ZMSwitchMonitors.name | (self) | Return the name of the switch. | Return the name of the switch. | def name(self):
"""Return the name of the switch."""
return f"{self._monitor.name} State" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self._monitor.name} State\""
] | [
53,
4
] | [
55,
44
] | python | en | ['en', 'en', 'en'] | True |
ZMSwitchMonitors.update | (self) | Update the switch value. | Update the switch value. | def update(self):
"""Update the switch value."""
self._state = self._monitor.function == self._on_state | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"self",
".",
"_monitor",
".",
"function",
"==",
"self",
".",
"_on_state"
] | [
57,
4
] | [
59,
62
] | python | en | ['en', 'en', 'en'] | True |
ZMSwitchMonitors.is_on | (self) | Return True if entity is on. | Return True if entity is on. | def is_on(self):
"""Return True if entity is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
62,
4
] | [
64,
26
] | python | en | ['en', 'cy', 'en'] | True |
ZMSwitchMonitors.turn_on | (self, **kwargs) | Turn the entity on. | Turn the entity on. | def turn_on(self, **kwargs):
"""Turn the entity on."""
self._monitor.function = self._on_state | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_monitor",
".",
"function",
"=",
"self",
".",
"_on_state"
] | [
66,
4
] | [
68,
47
] | python | en | ['en', 'en', 'en'] | True |
ZMSwitchMonitors.turn_off | (self, **kwargs) | Turn the entity off. | Turn the entity off. | def turn_off(self, **kwargs):
"""Turn the entity off."""
self._monitor.function = self._off_state | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_monitor",
".",
"function",
"=",
"self",
".",
"_off_state"
] | [
70,
4
] | [
72,
48
] | python | en | ['en', 'en', 'en'] | True |
help_test_availability_when_connection_lost | (
hass,
mqtt_client_mock,
mqtt_mock,
domain,
config,
sensor_config=None,
entity_id="test",
) | Test availability after MQTT disconnection.
This is a test helper for the TasmotaAvailability mixin.
| Test availability after MQTT disconnection. | async def help_test_availability_when_connection_lost(
hass,
mqtt_client_mock,
mqtt_mock,
domain,
config,
sensor_config=None,
entity_id="test",
):
"""Test availability after MQTT disconnection.
This is a test helper for the TasmotaAvailability mixin.
"""
async_fire_mqtt_mess... | [
"async",
"def",
"help_test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_client_mock",
",",
"mqtt_mock",
",",
"domain",
",",
"config",
",",
"sensor_config",
"=",
"None",
",",
"entity_id",
"=",
"\"test\"",
",",
")",
":",
"async_fire_mqtt_message",
"(",
... | [
98,
0
] | [
160,
43
] | python | en | ['en', 'en', 'en'] | True |
help_test_availability | (
hass,
mqtt_mock,
domain,
config,
sensor_config=None,
entity_id="test",
) | Test availability.
This is a test helper for the TasmotaAvailability mixin.
| Test availability. | async def help_test_availability(
hass,
mqtt_mock,
domain,
config,
sensor_config=None,
entity_id="test",
):
"""Test availability.
This is a test helper for the TasmotaAvailability mixin.
"""
async_fire_mqtt_message(
hass,
f"{DEFAULT_PREFIX}/{config[CONF_MAC]}/con... | [
"async",
"def",
"help_test_availability",
"(",
"hass",
",",
"mqtt_mock",
",",
"domain",
",",
"config",
",",
"sensor_config",
"=",
"None",
",",
"entity_id",
"=",
"\"test\"",
",",
")",
":",
"async_fire_mqtt_message",
"(",
"hass",
",",
"f\"{DEFAULT_PREFIX}/{config[CO... | [
163,
0
] | [
208,
43
] | python | en | ['fr', 'ga', 'en'] | False |
help_test_availability_discovery_update | (
hass,
mqtt_mock,
domain,
config,
sensor_config=None,
entity_id="test",
) | Test update of discovered TasmotaAvailability.
This is a test helper for the TasmotaAvailability mixin.
| Test update of discovered TasmotaAvailability. | async def help_test_availability_discovery_update(
hass,
mqtt_mock,
domain,
config,
sensor_config=None,
entity_id="test",
):
"""Test update of discovered TasmotaAvailability.
This is a test helper for the TasmotaAvailability mixin.
"""
# customize availability topic
config1 ... | [
"async",
"def",
"help_test_availability_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"domain",
",",
"config",
",",
"sensor_config",
"=",
"None",
",",
"entity_id",
"=",
"\"test\"",
",",
")",
":",
"# customize availability topic",
"config1",
"=",
"copy",
"... | [
211,
0
] | [
280,
43
] | python | en | ['en', 'en', 'en'] | True |
help_test_availability_poll_state | (
hass,
mqtt_client_mock,
mqtt_mock,
domain,
config,
poll_topic,
poll_payload,
sensor_config=None,
) | Test polling of state when device is available.
This is a test helper for the TasmotaAvailability mixin.
| Test polling of state when device is available. | async def help_test_availability_poll_state(
hass,
mqtt_client_mock,
mqtt_mock,
domain,
config,
poll_topic,
poll_payload,
sensor_config=None,
):
"""Test polling of state when device is available.
This is a test helper for the TasmotaAvailability mixin.
"""
async_fire_mqt... | [
"async",
"def",
"help_test_availability_poll_state",
"(",
"hass",
",",
"mqtt_client_mock",
",",
"mqtt_mock",
",",
"domain",
",",
"config",
",",
"poll_topic",
",",
"poll_payload",
",",
"sensor_config",
"=",
"None",
",",
")",
":",
"async_fire_mqtt_message",
"(",
"ha... | [
283,
0
] | [
349,
87
] | python | en | ['en', 'en', 'en'] | True |
help_test_discovery_removal | (
hass,
mqtt_mock,
caplog,
domain,
config1,
config2,
sensor_config1=None,
sensor_config2=None,
entity_id="test",
name="Test",
) | Test removal of discovered entity. | Test removal of discovered entity. | async def help_test_discovery_removal(
hass,
mqtt_mock,
caplog,
domain,
config1,
config2,
sensor_config1=None,
sensor_config2=None,
entity_id="test",
name="Test",
):
"""Test removal of discovered entity."""
device_reg = await hass.helpers.device_registry.async_get_registr... | [
"async",
"def",
"help_test_discovery_removal",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"domain",
",",
"config1",
",",
"config2",
",",
"sensor_config1",
"=",
"None",
",",
"sensor_config2",
"=",
"None",
",",
"entity_id",
"=",
"\"test\"",
",",
"name",
... | [
352,
0
] | [
411,
24
] | python | en | ['en', 'en', 'en'] | True |
help_test_discovery_update_unchanged | (
hass,
mqtt_mock,
caplog,
domain,
config,
discovery_update,
sensor_config=None,
entity_id="test",
name="Test",
) | Test update of discovered component with and without changes.
This is a test helper for the MqttDiscoveryUpdate mixin.
| Test update of discovered component with and without changes. | async def help_test_discovery_update_unchanged(
hass,
mqtt_mock,
caplog,
domain,
config,
discovery_update,
sensor_config=None,
entity_id="test",
name="Test",
):
"""Test update of discovered component with and without changes.
This is a test helper for the MqttDiscoveryUpdate... | [
"async",
"def",
"help_test_discovery_update_unchanged",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"domain",
",",
"config",
",",
"discovery_update",
",",
"sensor_config",
"=",
"None",
",",
"entity_id",
"=",
"\"test\"",
",",
"name",
"=",
"\"Test\"",
",",
... | [
414,
0
] | [
465,
34
] | python | en | ['en', 'en', 'en'] | True |
help_test_discovery_device_remove | (
hass, mqtt_mock, domain, unique_id, config, sensor_config=None
) | Test domain entity is removed when device is removed. | Test domain entity is removed when device is removed. | async def help_test_discovery_device_remove(
hass, mqtt_mock, domain, unique_id, config, sensor_config=None
):
"""Test domain entity is removed when device is removed."""
device_reg = await hass.helpers.device_registry.async_get_registry()
entity_reg = await hass.helpers.entity_registry.async_get_regist... | [
"async",
"def",
"help_test_discovery_device_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"domain",
",",
"unique_id",
",",
"config",
",",
"sensor_config",
"=",
"None",
")",
":",
"device_reg",
"=",
"await",
"hass",
".",
"helpers",
".",
"device_registry",
".",
"a... | [
468,
0
] | [
497,
75
] | python | en | ['en', 'en', 'en'] | True |
help_test_entity_id_update_subscriptions | (
hass, mqtt_mock, domain, config, topics=None, sensor_config=None, entity_id="test"
) | Test MQTT subscriptions are managed when entity_id is updated. | Test MQTT subscriptions are managed when entity_id is updated. | async def help_test_entity_id_update_subscriptions(
hass, mqtt_mock, domain, config, topics=None, sensor_config=None, entity_id="test"
):
"""Test MQTT subscriptions are managed when entity_id is updated."""
entity_reg = await hass.helpers.entity_registry.async_get_registry()
config = copy.deepcopy(conf... | [
"async",
"def",
"help_test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
",",
"domain",
",",
"config",
",",
"topics",
"=",
"None",
",",
"sensor_config",
"=",
"None",
",",
"entity_id",
"=",
"\"test\"",
")",
":",
"entity_reg",
"=",
"await",
"ha... | [
500,
0
] | [
543,
71
] | python | en | ['en', 'en', 'en'] | True |
help_test_entity_id_update_discovery_update | (
hass, mqtt_mock, domain, config, sensor_config=None, entity_id="test"
) | Test MQTT discovery update after entity_id is updated. | Test MQTT discovery update after entity_id is updated. | async def help_test_entity_id_update_discovery_update(
hass, mqtt_mock, domain, config, sensor_config=None, entity_id="test"
):
"""Test MQTT discovery update after entity_id is updated."""
entity_reg = await hass.helpers.entity_registry.async_get_registry()
config = copy.deepcopy(config)
data = jso... | [
"async",
"def",
"help_test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"domain",
",",
"config",
",",
"sensor_config",
"=",
"None",
",",
"entity_id",
"=",
"\"test\"",
")",
":",
"entity_reg",
"=",
"await",
"hass",
".",
"helpers",
".",
... | [
546,
0
] | [
591,
43
] | python | en | ['en', 'en', 'en'] | True |
validate_schema | (schema) | Decorate a webhook function with a schema. | Decorate a webhook function with a schema. | def validate_schema(schema):
"""Decorate a webhook function with a schema."""
if isinstance(schema, dict):
schema = vol.Schema(schema)
def wrapper(func):
"""Wrap function so we validate schema."""
@wraps(func)
async def validate_and_run(hass, config_entry, data):
... | [
"def",
"validate_schema",
"(",
"schema",
")",
":",
"if",
"isinstance",
"(",
"schema",
",",
"dict",
")",
":",
"schema",
"=",
"vol",
".",
"Schema",
"(",
"schema",
")",
"def",
"wrapper",
"(",
"func",
")",
":",
"\"\"\"Wrap function so we validate schema.\"\"\"",
... | [
121,
0
] | [
143,
18
] | python | en | ['en', 'en', 'en'] | True |
handle_webhook | (
hass: HomeAssistantType, webhook_id: str, request: Request
) | Handle webhook callback. | Handle webhook callback. | async def handle_webhook(
hass: HomeAssistantType, webhook_id: str, request: Request
) -> Response:
"""Handle webhook callback."""
if webhook_id in hass.data[DOMAIN][DATA_DELETED_IDS]:
return Response(status=410)
config_entry = hass.data[DOMAIN][DATA_CONFIG_ENTRIES][webhook_id]
device_name... | [
"async",
"def",
"handle_webhook",
"(",
"hass",
":",
"HomeAssistantType",
",",
"webhook_id",
":",
"str",
",",
"request",
":",
"Request",
")",
"->",
"Response",
":",
"if",
"webhook_id",
"in",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_DELETED_IDS",
... | [
146,
0
] | [
206,
5
] | python | en | ['en', 'xh', 'en'] | True |
webhook_call_service | (hass, config_entry, data) | Handle a call service webhook. | Handle a call service webhook. | async def webhook_call_service(hass, config_entry, data):
"""Handle a call service webhook."""
try:
await hass.services.async_call(
data[ATTR_DOMAIN],
data[ATTR_SERVICE],
data[ATTR_SERVICE_DATA],
blocking=True,
context=registration_context(conf... | [
"async",
"def",
"webhook_call_service",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"try",
":",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"data",
"[",
"ATTR_DOMAIN",
"]",
",",
"data",
"[",
"ATTR_SERVICE",
"]",
",",
"data",
"[... | [
217,
0
] | [
236,
32
] | python | en | ['en', 'lb', 'en'] | True |
webhook_fire_event | (hass, config_entry, data) | Handle a fire event webhook. | Handle a fire event webhook. | async def webhook_fire_event(hass, config_entry, data):
"""Handle a fire event webhook."""
event_type = data[ATTR_EVENT_TYPE]
hass.bus.async_fire(
event_type,
data[ATTR_EVENT_DATA],
EventOrigin.remote,
context=registration_context(config_entry.data),
)
return empty_ok... | [
"async",
"def",
"webhook_fire_event",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"event_type",
"=",
"data",
"[",
"ATTR_EVENT_TYPE",
"]",
"hass",
".",
"bus",
".",
"async_fire",
"(",
"event_type",
",",
"data",
"[",
"ATTR_EVENT_DATA",
"]",
",",
... | [
246,
0
] | [
255,
32
] | python | en | ['en', 'lb', 'en'] | True |
webhook_stream_camera | (hass, config_entry, data) | Handle a request to HLS-stream a camera. | Handle a request to HLS-stream a camera. | async def webhook_stream_camera(hass, config_entry, data):
"""Handle a request to HLS-stream a camera."""
camera = hass.states.get(data[ATTR_CAMERA_ENTITY_ID])
if camera is None:
return webhook_response(
{"success": False},
registration=config_entry.data,
status=... | [
"async",
"def",
"webhook_stream_camera",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"camera",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"data",
"[",
"ATTR_CAMERA_ENTITY_ID",
"]",
")",
"if",
"camera",
"is",
"None",
":",
"return",
"webhook_r... | [
260,
0
] | [
283,
65
] | python | en | ['en', 'en', 'en'] | True |
webhook_render_template | (hass, config_entry, data) | Handle a render template webhook. | Handle a render template webhook. | async def webhook_render_template(hass, config_entry, data):
"""Handle a render template webhook."""
resp = {}
for key, item in data.items():
try:
tpl = template.Template(item[ATTR_TEMPLATE], hass)
resp[key] = tpl.async_render(item.get(ATTR_TEMPLATE_VARIABLES))
except... | [
"async",
"def",
"webhook_render_template",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"resp",
"=",
"{",
"}",
"for",
"key",
",",
"item",
"in",
"data",
".",
"items",
"(",
")",
":",
"try",
":",
"tpl",
"=",
"template",
".",
"Template",
"(",... | [
295,
0
] | [
305,
65
] | python | en | ['hu', 'lb', 'en'] | False |
webhook_update_location | (hass, config_entry, data) | Handle an update location webhook. | Handle an update location webhook. | async def webhook_update_location(hass, config_entry, data):
"""Handle an update location webhook."""
hass.helpers.dispatcher.async_dispatcher_send(
SIGNAL_LOCATION_UPDATE.format(config_entry.entry_id), data
)
return empty_okay_response() | [
"async",
"def",
"webhook_update_location",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"hass",
".",
"helpers",
".",
"dispatcher",
".",
"async_dispatcher_send",
"(",
"SIGNAL_LOCATION_UPDATE",
".",
"format",
"(",
"config_entry",
".",
"entry_id",
")",
... | [
321,
0
] | [
326,
32
] | python | en | ['en', 'lb', 'en'] | True |
webhook_update_registration | (hass, config_entry, data) | Handle an update registration webhook. | Handle an update registration webhook. | async def webhook_update_registration(hass, config_entry, data):
"""Handle an update registration webhook."""
new_registration = {**config_entry.data, **data}
device_registry = await dr.async_get_registry(hass)
device_registry.async_get_or_create(
config_entry_id=config_entry.entry_id,
... | [
"async",
"def",
"webhook_update_registration",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"new_registration",
"=",
"{",
"*",
"*",
"config_entry",
".",
"data",
",",
"*",
"*",
"data",
"}",
"device_registry",
"=",
"await",
"dr",
".",
"async_get_re... | [
340,
0
] | [
362,
5
] | python | en | ['en', 'lb', 'en'] | True |
webhook_enable_encryption | (hass, config_entry, data) | Handle a encryption enable webhook. | Handle a encryption enable webhook. | async def webhook_enable_encryption(hass, config_entry, data):
"""Handle a encryption enable webhook."""
if config_entry.data[ATTR_SUPPORTS_ENCRYPTION]:
_LOGGER.warning(
"Refusing to enable encryption for %s because it is already enabled!",
config_entry.data[ATTR_DEVICE_NAME],
... | [
"async",
"def",
"webhook_enable_encryption",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"if",
"config_entry",
".",
"data",
"[",
"ATTR_SUPPORTS_ENCRYPTION",
"]",
":",
"_LOGGER",
".",
"warning",
"(",
"\"Refusing to enable encryption for %s because it is alre... | [
366,
0
] | [
390,
44
] | python | en | ['es', 'en', 'en'] | True |
webhook_register_sensor | (hass, config_entry, data) | Handle a register sensor webhook. | Handle a register sensor webhook. | async def webhook_register_sensor(hass, config_entry, data):
"""Handle a register sensor webhook."""
entity_type = data[ATTR_SENSOR_TYPE]
unique_id = data[ATTR_SENSOR_UNIQUE_ID]
device_name = config_entry.data[ATTR_DEVICE_NAME]
unique_store_key = f"{config_entry.data[CONF_WEBHOOK_ID]}_{unique_id}"
... | [
"async",
"def",
"webhook_register_sensor",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"entity_type",
"=",
"data",
"[",
"ATTR_SENSOR_TYPE",
"]",
"unique_id",
"=",
"data",
"[",
"ATTR_SENSOR_UNIQUE_ID",
"]",
"device_name",
"=",
"config_entry",
".",
"d... | [
410,
0
] | [
445,
5
] | python | en | ['en', 'da', 'en'] | True |
webhook_update_sensor_states | (hass, config_entry, data) | Handle an update sensor states webhook. | Handle an update sensor states webhook. | async def webhook_update_sensor_states(hass, config_entry, data):
"""Handle an update sensor states webhook."""
sensor_schema_full = vol.Schema(
{
vol.Optional(ATTR_SENSOR_ATTRIBUTES, default={}): dict,
vol.Optional(ATTR_SENSOR_ICON, default="mdi:cellphone"): cv.icon,
... | [
"async",
"def",
"webhook_update_sensor_states",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"sensor_schema_full",
"=",
"vol",
".",
"Schema",
"(",
"{",
"vol",
".",
"Optional",
"(",
"ATTR_SENSOR_ATTRIBUTES",
",",
"default",
"=",
"{",
"}",
")",
":"... | [
466,
0
] | [
530,
65
] | python | en | ['en', 'lb', 'en'] | True |
webhook_get_zones | (hass, config_entry, data) | Handle a get zones webhook. | Handle a get zones webhook. | async def webhook_get_zones(hass, config_entry, data):
"""Handle a get zones webhook."""
zones = [
hass.states.get(entity_id)
for entity_id in sorted(hass.states.async_entity_ids(ZONE_DOMAIN))
]
return webhook_response(zones, registration=config_entry.data) | [
"async",
"def",
"webhook_get_zones",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"zones",
"=",
"[",
"hass",
".",
"states",
".",
"get",
"(",
"entity_id",
")",
"for",
"entity_id",
"in",
"sorted",
"(",
"hass",
".",
"states",
".",
"async_entity_... | [
534,
0
] | [
540,
66
] | python | nl | ['nl', 'nl', 'en'] | True |
webhook_get_config | (hass, config_entry, data) | Handle a get config webhook. | Handle a get config webhook. | async def webhook_get_config(hass, config_entry, data):
"""Handle a get config webhook."""
hass_config = hass.config.as_dict()
resp = {
"latitude": hass_config["latitude"],
"longitude": hass_config["longitude"],
"elevation": hass_config["elevation"],
"unit_system": hass_conf... | [
"async",
"def",
"webhook_get_config",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"hass_config",
"=",
"hass",
".",
"config",
".",
"as_dict",
"(",
")",
"resp",
"=",
"{",
"\"latitude\"",
":",
"hass_config",
"[",
"\"latitude\"",
"]",
",",
"\"long... | [
544,
0
] | [
568,
65
] | python | en | ['en', 'nl', 'en'] | True |
webhook_scan_tag | (hass, config_entry, data) | Handle a fire event webhook. | Handle a fire event webhook. | async def webhook_scan_tag(hass, config_entry, data):
"""Handle a fire event webhook."""
await tag.async_scan_tag(
hass,
data["tag_id"],
config_entry.data[ATTR_DEVICE_ID],
registration_context(config_entry.data),
)
return empty_okay_response() | [
"async",
"def",
"webhook_scan_tag",
"(",
"hass",
",",
"config_entry",
",",
"data",
")",
":",
"await",
"tag",
".",
"async_scan_tag",
"(",
"hass",
",",
"data",
"[",
"\"tag_id\"",
"]",
",",
"config_entry",
".",
"data",
"[",
"ATTR_DEVICE_ID",
"]",
",",
"regist... | [
573,
0
] | [
581,
32
] | python | en | ['en', 'lb', 'en'] | True |
test_empty_config | (hass) | Test a default config will be create for empty config. | Test a default config will be create for empty config. | async def test_empty_config(hass):
"""Test a default config will be create for empty config."""
with async_patch("aiobotocore.AioSession", new=MockAioSession):
await async_setup_component(hass, "aws", {"aws": {}})
await hass.async_block_till_done()
sessions = hass.data[aws.DATA_SESSIONS]
... | [
"async",
"def",
"test_empty_config",
"(",
"hass",
")",
":",
"with",
"async_patch",
"(",
"\"aiobotocore.AioSession\"",
",",
"new",
"=",
"MockAioSession",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"aws\"",
",",
"{",
"\"aws\"",
":",
"{",
"}"... | [
32,
0
] | [
44,
41
] | python | en | ['en', 'en', 'en'] | True |
test_empty_credential | (hass) | Test a default config will be create for empty credential section. | Test a default config will be create for empty credential section. | async def test_empty_credential(hass):
"""Test a default config will be create for empty credential section."""
with async_patch("aiobotocore.AioSession", new=MockAioSession):
await async_setup_component(
hass,
"aws",
{
"aws": {
"no... | [
"async",
"def",
"test_empty_credential",
"(",
"hass",
")",
":",
"with",
"async_patch",
"(",
"\"aiobotocore.AioSession\"",
",",
"new",
"=",
"MockAioSession",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"aws\"",
",",
"{",
"\"aws\"",
":",
"{",
... | [
47,
0
] | [
77,
40
] | python | en | ['en', 'en', 'en'] | True |
test_profile_credential | (hass) | Test credentials with profile name. | Test credentials with profile name. | async def test_profile_credential(hass):
"""Test credentials with profile name."""
with async_patch("aiobotocore.AioSession", new=MockAioSession):
await async_setup_component(
hass,
"aws",
{
"aws": {
"credentials": {"name": "test", ... | [
"async",
"def",
"test_profile_credential",
"(",
"hass",
")",
":",
"with",
"async_patch",
"(",
"\"aiobotocore.AioSession\"",
",",
"new",
"=",
"MockAioSession",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"aws\"",
",",
"{",
"\"aws\"",
":",
"{",... | [
80,
0
] | [
115,
41
] | python | en | ['en', 'en', 'en'] | True |
test_access_key_credential | (hass) | Test credentials with access key. | Test credentials with access key. | async def test_access_key_credential(hass):
"""Test credentials with access key."""
with async_patch("aiobotocore.AioSession", new=MockAioSession):
await async_setup_component(
hass,
"aws",
{
"aws": {
"credentials": [
... | [
"async",
"def",
"test_access_key_credential",
"(",
"hass",
")",
":",
"with",
"async_patch",
"(",
"\"aiobotocore.AioSession\"",
",",
"new",
"=",
"MockAioSession",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"aws\"",
",",
"{",
"\"aws\"",
":",
"... | [
118,
0
] | [
160,
41
] | python | en | ['en', 'en', 'en'] | True |
test_notify_credential | (hass) | Test notify service can use access key directly. | Test notify service can use access key directly. | async def test_notify_credential(hass):
"""Test notify service can use access key directly."""
with async_patch("aiobotocore.AioSession", new=MockAioSession):
await async_setup_component(
hass,
"aws",
{
"aws": {
"notify": [
... | [
"async",
"def",
"test_notify_credential",
"(",
"hass",
")",
":",
"with",
"async_patch",
"(",
"\"aiobotocore.AioSession\"",
",",
"new",
"=",
"MockAioSession",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"aws\"",
",",
"{",
"\"aws\"",
":",
"{",
... | [
163,
0
] | [
194,
5
] | python | en | ['en', 'en', 'en'] | True |
test_notify_credential_profile | (hass) | Test notify service can use profile directly. | Test notify service can use profile directly. | async def test_notify_credential_profile(hass):
"""Test notify service can use profile directly."""
with async_patch("aiobotocore.AioSession", new=MockAioSession):
await async_setup_component(
hass,
"aws",
{
"aws": {
"notify": [
... | [
"async",
"def",
"test_notify_credential_profile",
"(",
"hass",
")",
":",
"with",
"async_patch",
"(",
"\"aiobotocore.AioSession\"",
",",
"new",
"=",
"MockAioSession",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"aws\"",
",",
"{",
"\"aws\"",
":",... | [
197,
0
] | [
226,
5
] | 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.