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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
SoundTouchDevice._get_instance_by_id | (self, instance_id) | Search and return a SoundTouchDevice instance by it's ID (aka MAC address). | Search and return a SoundTouchDevice instance by it's ID (aka MAC address). | def _get_instance_by_id(self, instance_id):
"""Search and return a SoundTouchDevice instance by it's ID (aka MAC address)."""
for instance in self.hass.data[DATA_SOUNDTOUCH]:
if instance and instance.device.config.device_id == instance_id:
return instance
return None | [
"def",
"_get_instance_by_id",
"(",
"self",
",",
"instance_id",
")",
":",
"for",
"instance",
"in",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_SOUNDTOUCH",
"]",
":",
"if",
"instance",
"and",
"instance",
".",
"device",
".",
"config",
".",
"device_id",
"==",... | [
493,
4
] | [
498,
19
] | python | en | ['en', 'en', 'en'] | True |
SoundTouchDevice._build_zone_info | (self, master, zone_slaves) | Build the exposed zone attributes. | Build the exposed zone attributes. | def _build_zone_info(self, master, zone_slaves):
"""Build the exposed zone attributes."""
slaves = []
for slave in zone_slaves:
slave_instance = self._get_instance_by_ip(slave.device_ip)
if slave_instance:
slaves.append(slave_instance.entity_id)
... | [
"def",
"_build_zone_info",
"(",
"self",
",",
"master",
",",
"zone_slaves",
")",
":",
"slaves",
"=",
"[",
"]",
"for",
"slave",
"in",
"zone_slaves",
":",
"slave_instance",
"=",
"self",
".",
"_get_instance_by_ip",
"(",
"slave",
".",
"device_ip",
")",
"if",
"s... | [
500,
4
] | [
515,
25
] | python | en | ['en', 'en', 'en'] | True |
get_service | (hass, config, discovery_info=None) | Get the Twilio Call notification service. | Get the Twilio Call notification service. | def get_service(hass, config, discovery_info=None):
"""Get the Twilio Call notification service."""
return TwilioCallNotificationService(
hass.data[DATA_TWILIO], config[CONF_FROM_NUMBER]
) | [
"def",
"get_service",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"return",
"TwilioCallNotificationService",
"(",
"hass",
".",
"data",
"[",
"DATA_TWILIO",
"]",
",",
"config",
"[",
"CONF_FROM_NUMBER",
"]",
")"
] | [
28,
0
] | [
32,
5
] | python | en | ['en', 'en', 'en'] | True |
TwilioCallNotificationService.__init__ | (self, twilio_client, from_number) | Initialize the service. | Initialize the service. | def __init__(self, twilio_client, from_number):
"""Initialize the service."""
self.client = twilio_client
self.from_number = from_number | [
"def",
"__init__",
"(",
"self",
",",
"twilio_client",
",",
"from_number",
")",
":",
"self",
".",
"client",
"=",
"twilio_client",
"self",
".",
"from_number",
"=",
"from_number"
] | [
38,
4
] | [
41,
38
] | python | en | ['en', 'en', 'en'] | True |
TwilioCallNotificationService.send_message | (self, message="", **kwargs) | Call to specified target users. | Call to specified target users. | def send_message(self, message="", **kwargs):
"""Call to specified target users."""
targets = kwargs.get(ATTR_TARGET)
if not targets:
_LOGGER.info("At least 1 target is required")
return
if message.startswith(("http://", "https://")):
twimlet_url = ... | [
"def",
"send_message",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"targets",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TARGET",
")",
"if",
"not",
"targets",
":",
"_LOGGER",
".",
"info",
"(",
"\"At least 1 target is required\""... | [
43,
4
] | [
64,
34
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Set up config entry. | Set up config entry. | async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Set up config entry."""
session = aiohttp_client.async_get_clientsession(hass)
printer = hass.data[DOMAIN][entry.entry_id] = SyncThru(
entry.data[CONF_URL], session
)
try:
await printer.update()
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"session",
"=",
"aiohttp_client",
".",
"async_get_clientsession",
"(",
"hass",
")",
"printer",
"=",
"hass",
".",
"data",
"[",
... | [
25,
0
] | [
57,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Unload the config entry. | Unload the config entry. | async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Unload the config entry."""
await hass.config_entries.async_forward_entry_unload(entry, SENSOR_DOMAIN)
hass.data[DOMAIN].pop(entry.entry_id, None)
return True | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"entry",
",",
"SENSOR_DOMAIN",
")",
"hass",
"."... | [
60,
0
] | [
64,
15
] | python | en | ['en', 'en', 'en'] | True |
device_identifiers | (printer: SyncThru) | Get device identifiers for device registry. | Get device identifiers for device registry. | def device_identifiers(printer: SyncThru) -> Set[Tuple[str, str]]:
"""Get device identifiers for device registry."""
return {(DOMAIN, printer.serial_number())} | [
"def",
"device_identifiers",
"(",
"printer",
":",
"SyncThru",
")",
"->",
"Set",
"[",
"Tuple",
"[",
"str",
",",
"str",
"]",
"]",
":",
"return",
"{",
"(",
"DOMAIN",
",",
"printer",
".",
"serial_number",
"(",
")",
")",
"}"
] | [
67,
0
] | [
69,
46
] | python | en | ['nl', 'en', 'en'] | True |
device_connections | (printer: SyncThru) | Get device connections for device registry. | Get device connections for device registry. | def device_connections(printer: SyncThru) -> Set[Tuple[str, str]]:
"""Get device connections for device registry."""
connections = set()
try:
mac = printer.raw()["identity"]["mac_addr"]
if mac:
connections.add((dr.CONNECTION_NETWORK_MAC, mac))
except AttributeError:
p... | [
"def",
"device_connections",
"(",
"printer",
":",
"SyncThru",
")",
"->",
"Set",
"[",
"Tuple",
"[",
"str",
",",
"str",
"]",
"]",
":",
"connections",
"=",
"set",
"(",
")",
"try",
":",
"mac",
"=",
"printer",
".",
"raw",
"(",
")",
"[",
"\"identity\"",
... | [
72,
0
] | [
81,
22
] | python | en | ['da', 'en', 'en'] | True |
setup | (hass, config) | Set up the Wireless Sensor Tag component. | Set up the Wireless Sensor Tag component. | def setup(hass, config):
"""Set up the Wireless Sensor Tag component."""
conf = config[DOMAIN]
username = conf.get(CONF_USERNAME)
password = conf.get(CONF_PASSWORD)
try:
wirelesstags = WirelessTags(username=username, password=password)
platform = WirelessTagPlatform(hass, wirelesst... | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"username",
"=",
"conf",
".",
"get",
"(",
"CONF_USERNAME",
")",
"password",
"=",
"conf",
".",
"get",
"(",
"CONF_PASSWORD",
")",
"try",
":",
"wirelesstags",... | [
186,
0
] | [
213,
15
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagPlatform.__init__ | (self, hass, api) | Designated initializer for wirelesstags platform. | Designated initializer for wirelesstags platform. | def __init__(self, hass, api):
"""Designated initializer for wirelesstags platform."""
self.hass = hass
self.api = api
self.tags = {}
self._local_base_url = None | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"api",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"api",
"=",
"api",
"self",
".",
"tags",
"=",
"{",
"}",
"self",
".",
"_local_base_url",
"=",
"None"
] | [
62,
4
] | [
67,
35
] | python | en | ['en', 'de', 'en'] | True |
WirelessTagPlatform.tag_manager_macs | (self) | Return list of tag managers mac addresses in user account. | Return list of tag managers mac addresses in user account. | def tag_manager_macs(self):
"""Return list of tag managers mac addresses in user account."""
return self.api.mac_addresses | [
"def",
"tag_manager_macs",
"(",
"self",
")",
":",
"return",
"self",
".",
"api",
".",
"mac_addresses"
] | [
70,
4
] | [
72,
37
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagPlatform.load_tags | (self) | Load tags from remote server. | Load tags from remote server. | def load_tags(self):
"""Load tags from remote server."""
self.tags = self.api.load_tags()
return self.tags | [
"def",
"load_tags",
"(",
"self",
")",
":",
"self",
".",
"tags",
"=",
"self",
".",
"api",
".",
"load_tags",
"(",
")",
"return",
"self",
".",
"tags"
] | [
74,
4
] | [
77,
24
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagPlatform.arm | (self, switch) | Arm entity sensor monitoring. | Arm entity sensor monitoring. | def arm(self, switch):
"""Arm entity sensor monitoring."""
func_name = f"arm_{switch.sensor_type}"
arm_func = getattr(self.api, func_name)
if arm_func is not None:
arm_func(switch.tag_id, switch.tag_manager_mac) | [
"def",
"arm",
"(",
"self",
",",
"switch",
")",
":",
"func_name",
"=",
"f\"arm_{switch.sensor_type}\"",
"arm_func",
"=",
"getattr",
"(",
"self",
".",
"api",
",",
"func_name",
")",
"if",
"arm_func",
"is",
"not",
"None",
":",
"arm_func",
"(",
"switch",
".",
... | [
79,
4
] | [
84,
59
] | python | en | ['en', 'hmn', 'en'] | True |
WirelessTagPlatform.disarm | (self, switch) | Disarm entity sensor monitoring. | Disarm entity sensor monitoring. | def disarm(self, switch):
"""Disarm entity sensor monitoring."""
func_name = f"disarm_{switch.sensor_type}"
disarm_func = getattr(self.api, func_name)
if disarm_func is not None:
disarm_func(switch.tag_id, switch.tag_manager_mac) | [
"def",
"disarm",
"(",
"self",
",",
"switch",
")",
":",
"func_name",
"=",
"f\"disarm_{switch.sensor_type}\"",
"disarm_func",
"=",
"getattr",
"(",
"self",
".",
"api",
",",
"func_name",
")",
"if",
"disarm_func",
"is",
"not",
"None",
":",
"disarm_func",
"(",
"sw... | [
86,
4
] | [
91,
62
] | python | en | ['en', 'fil', 'en'] | True |
WirelessTagPlatform.make_notifications | (self, binary_sensors, mac) | Create configurations for push notifications. | Create configurations for push notifications. | def make_notifications(self, binary_sensors, mac):
"""Create configurations for push notifications."""
_LOGGER.info("Creating configurations for push notifications")
configs = []
bi_url = self.binary_event_callback_url
for bi_sensor in binary_sensors:
configs.extend(... | [
"def",
"make_notifications",
"(",
"self",
",",
"binary_sensors",
",",
"mac",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"Creating configurations for push notifications\"",
")",
"configs",
"=",
"[",
"]",
"bi_url",
"=",
"self",
".",
"binary_event_callback_url",
"for",
... | [
93,
4
] | [
107,
22
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagPlatform.install_push_notifications | (self, binary_sensors) | Register local push notification from tag manager. | Register local push notification from tag manager. | def install_push_notifications(self, binary_sensors):
"""Register local push notification from tag manager."""
_LOGGER.info("Registering local push notifications")
for mac in self.tag_manager_macs:
configs = self.make_notifications(binary_sensors, mac)
# install notificat... | [
"def",
"install_push_notifications",
"(",
"self",
",",
"binary_sensors",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"Registering local push notifications\"",
")",
"for",
"mac",
"in",
"self",
".",
"tag_manager_macs",
":",
"configs",
"=",
"self",
".",
"make_notification... | [
109,
4
] | [
127,
17
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagPlatform.local_base_url | (self) | Define base url of hass in local network. | Define base url of hass in local network. | def local_base_url(self):
"""Define base url of hass in local network."""
if self._local_base_url is None:
self._local_base_url = f"http://{util.get_local_ip()}"
port = self.hass.config.api.port
if port is not None:
self._local_base_url += f":{port}"
... | [
"def",
"local_base_url",
"(",
"self",
")",
":",
"if",
"self",
".",
"_local_base_url",
"is",
"None",
":",
"self",
".",
"_local_base_url",
"=",
"f\"http://{util.get_local_ip()}\"",
"port",
"=",
"self",
".",
"hass",
".",
"config",
".",
"api",
".",
"port",
"if",... | [
130,
4
] | [
138,
35
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagPlatform.update_callback_url | (self) | Return url for local push notifications(update event). | Return url for local push notifications(update event). | def update_callback_url(self):
"""Return url for local push notifications(update event)."""
return f"{self.local_base_url}/api/events/wirelesstag_update_tags" | [
"def",
"update_callback_url",
"(",
"self",
")",
":",
"return",
"f\"{self.local_base_url}/api/events/wirelesstag_update_tags\""
] | [
141,
4
] | [
143,
74
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagPlatform.binary_event_callback_url | (self) | Return url for local push notifications(binary event). | Return url for local push notifications(binary event). | def binary_event_callback_url(self):
"""Return url for local push notifications(binary event)."""
return f"{self.local_base_url}/api/events/wirelesstag_binary_event" | [
"def",
"binary_event_callback_url",
"(",
"self",
")",
":",
"return",
"f\"{self.local_base_url}/api/events/wirelesstag_binary_event\""
] | [
146,
4
] | [
148,
75
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagPlatform.handle_update_tags_event | (self, event) | Handle push event from wireless tag manager. | Handle push event from wireless tag manager. | def handle_update_tags_event(self, event):
"""Handle push event from wireless tag manager."""
_LOGGER.info("push notification for update arrived: %s", event)
try:
tag_id = event.data.get("id")
mac = event.data.get("mac")
dispatcher_send(self.hass, SIGNAL_TAG_U... | [
"def",
"handle_update_tags_event",
"(",
"self",
",",
"event",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"push notification for update arrived: %s\"",
",",
"event",
")",
"try",
":",
"tag_id",
"=",
"event",
".",
"data",
".",
"get",
"(",
"\"id\"",
")",
"mac",
"=... | [
150,
4
] | [
163,
13
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagPlatform.handle_binary_event | (self, event) | Handle push notifications for binary (on/off) events. | Handle push notifications for binary (on/off) events. | def handle_binary_event(self, event):
"""Handle push notifications for binary (on/off) events."""
_LOGGER.info("Push notification for binary event arrived: %s", event)
try:
tag_id = event.data.get("id")
event_type = event.data.get("type")
mac = event.data.get(... | [
"def",
"handle_binary_event",
"(",
"self",
",",
"event",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"Push notification for binary event arrived: %s\"",
",",
"event",
")",
"try",
":",
"tag_id",
"=",
"event",
".",
"data",
".",
"get",
"(",
"\"id\"",
")",
"event_typ... | [
165,
4
] | [
183,
13
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagBaseSensor.__init__ | (self, api, tag) | Initialize a base sensor for Wireless Sensor Tag platform. | Initialize a base sensor for Wireless Sensor Tag platform. | def __init__(self, api, tag):
"""Initialize a base sensor for Wireless Sensor Tag platform."""
self._api = api
self._tag = tag
self._uuid = self._tag.uuid
self.tag_id = self._tag.tag_id
self.tag_manager_mac = self._tag.tag_manager_mac
self._name = self._tag.name
... | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"tag",
")",
":",
"self",
".",
"_api",
"=",
"api",
"self",
".",
"_tag",
"=",
"tag",
"self",
".",
"_uuid",
"=",
"self",
".",
"_tag",
".",
"uuid",
"self",
".",
"tag_id",
"=",
"self",
".",
"_tag",
".... | [
219,
4
] | [
227,
26
] | python | en | ['en', 'pt', 'en'] | True |
WirelessTagBaseSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
230,
4
] | [
232,
25
] | python | en | ['en', 'mi', 'en'] | True |
WirelessTagBaseSensor.principal_value | (self) | Return base value.
Subclasses need override based on type of sensor.
| Return base value. | def principal_value(self):
"""Return base value.
Subclasses need override based on type of sensor.
"""
return 0 | [
"def",
"principal_value",
"(",
"self",
")",
":",
"return",
"0"
] | [
235,
4
] | [
240,
16
] | python | en | ['en', 'da', 'en'] | True |
WirelessTagBaseSensor.updated_state_value | (self) | Return formatted value.
The default implementation formats principal value.
| Return formatted value. | def updated_state_value(self):
"""Return formatted value.
The default implementation formats principal value.
"""
return self.decorate_value(self.principal_value) | [
"def",
"updated_state_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"decorate_value",
"(",
"self",
".",
"principal_value",
")"
] | [
242,
4
] | [
247,
56
] | python | en | ['en', 'da', 'en'] | True |
WirelessTagBaseSensor.decorate_value | (self, value) | Decorate input value to be well presented for end user. | Decorate input value to be well presented for end user. | def decorate_value(self, value):
"""Decorate input value to be well presented for end user."""
return f"{value:.1f}" | [
"def",
"decorate_value",
"(",
"self",
",",
"value",
")",
":",
"return",
"f\"{value:.1f}\""
] | [
250,
4
] | [
252,
29
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagBaseSensor.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self):
"""Return True if entity is available."""
return self._tag.is_alive | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tag",
".",
"is_alive"
] | [
255,
4
] | [
257,
33
] | python | en | ['en', 'en', 'en'] | True |
WirelessTagBaseSensor.update | (self) | Update state. | Update state. | def update(self):
"""Update state."""
if not self.should_poll:
return
updated_tags = self._api.load_tags()
updated_tag = updated_tags[self._uuid]
if updated_tag is None:
_LOGGER.error('Unable to update tag: "%s"', self.name)
return
se... | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"should_poll",
":",
"return",
"updated_tags",
"=",
"self",
".",
"_api",
".",
"load_tags",
"(",
")",
"updated_tag",
"=",
"updated_tags",
"[",
"self",
".",
"_uuid",
"]",
"if",
"updated_tag",... | [
259,
4
] | [
271,
48
] | python | en | ['en', 'co', 'en'] | False |
WirelessTagBaseSensor.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_BATTERY_LEVEL: int(self._tag.battery_remaining * 100),
ATTR_VOLTAGE: f"{self._tag.battery_volts:.2f}{VOLT}",
ATTR_TAG_SIGNAL_STRENGTH: f"{self._tag.signal_strength}{SIGNAL_STRENGTH_DEC... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_BATTERY_LEVEL",
":",
"int",
"(",
"self",
".",
"_tag",
".",
"battery_remaining",
"*",
"100",
")",
",",
"ATTR_VOLTAGE",
":",
"f\"{self._tag.battery_volts:.2f}{VOLT}\"",
",",
"ATTR_TAG_SIGNAL... | [
274,
4
] | [
282,
9
] | python | en | ['en', 'en', 'en'] | True |
validate_python | () | Validate that the right Python version is running. | Validate that the right Python version is running. | def validate_python() -> None:
"""Validate that the right Python version is running."""
if sys.version_info[:3] < REQUIRED_PYTHON_VER:
print(
"Home Assistant requires at least Python "
f"{REQUIRED_PYTHON_VER[0]}.{REQUIRED_PYTHON_VER[1]}.{REQUIRED_PYTHON_VER[2]}"
)
... | [
"def",
"validate_python",
"(",
")",
"->",
"None",
":",
"if",
"sys",
".",
"version_info",
"[",
":",
"3",
"]",
"<",
"REQUIRED_PYTHON_VER",
":",
"print",
"(",
"\"Home Assistant requires at least Python \"",
"f\"{REQUIRED_PYTHON_VER[0]}.{REQUIRED_PYTHON_VER[1]}.{REQUIRED_PYTHON... | [
12,
0
] | [
19,
19
] | python | en | ['en', 'en', 'en'] | True |
ensure_config_path | (config_dir: str) | Validate the configuration directory. | Validate the configuration directory. | def ensure_config_path(config_dir: str) -> None:
"""Validate the configuration directory."""
# pylint: disable=import-outside-toplevel
import homeassistant.config as config_util
lib_dir = os.path.join(config_dir, "deps")
# Test if configuration directory exists
if not os.path.isdir(config_dir)... | [
"def",
"ensure_config_path",
"(",
"config_dir",
":",
"str",
")",
"->",
"None",
":",
"# pylint: disable=import-outside-toplevel",
"import",
"homeassistant",
".",
"config",
"as",
"config_util",
"lib_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"config_dir",
",",
... | [
22,
0
] | [
53,
23
] | python | en | ['en', 'en', 'en'] | True |
get_arguments | () | Get parsed passed in arguments. | Get parsed passed in arguments. | def get_arguments() -> argparse.Namespace:
"""Get parsed passed in arguments."""
# pylint: disable=import-outside-toplevel
import homeassistant.config as config_util
parser = argparse.ArgumentParser(
description="Home Assistant: Observe, Control, Automate."
)
parser.add_argument("--vers... | [
"def",
"get_arguments",
"(",
")",
"->",
"argparse",
".",
"Namespace",
":",
"# pylint: disable=import-outside-toplevel",
"import",
"homeassistant",
".",
"config",
"as",
"config_util",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Home As... | [
56,
0
] | [
127,
20
] | python | en | ['en', 'la', 'en'] | True |
daemonize | () | Move current process to daemon process. | Move current process to daemon process. | def daemonize() -> None:
"""Move current process to daemon process."""
# Create first fork
pid = os.fork()
if pid > 0:
sys.exit(0)
# Decouple fork
os.setsid()
# Create second fork
pid = os.fork()
if pid > 0:
sys.exit(0)
# redirect standard file descriptors to d... | [
"def",
"daemonize",
"(",
")",
"->",
"None",
":",
"# Create first fork",
"pid",
"=",
"os",
".",
"fork",
"(",
")",
"if",
"pid",
">",
"0",
":",
"sys",
".",
"exit",
"(",
"0",
")",
"# Decouple fork",
"os",
".",
"setsid",
"(",
")",
"# Create second fork",
... | [
130,
0
] | [
152,
48
] | python | en | ['en', 'en', 'en'] | True |
check_pid | (pid_file: str) | Check that Home Assistant is not already running. | Check that Home Assistant is not already running. | def check_pid(pid_file: str) -> None:
"""Check that Home Assistant is not already running."""
# Check pid file
try:
with open(pid_file) as file:
pid = int(file.readline())
except OSError:
# PID File does not exist
return
# If we just restarted, we just found our ... | [
"def",
"check_pid",
"(",
"pid_file",
":",
"str",
")",
"->",
"None",
":",
"# Check pid file",
"try",
":",
"with",
"open",
"(",
"pid_file",
")",
"as",
"file",
":",
"pid",
"=",
"int",
"(",
"file",
".",
"readline",
"(",
")",
")",
"except",
"OSError",
":"... | [
155,
0
] | [
175,
15
] | python | en | ['en', 'en', 'en'] | True |
write_pid | (pid_file: str) | Create a PID File. | Create a PID File. | def write_pid(pid_file: str) -> None:
"""Create a PID File."""
pid = os.getpid()
try:
with open(pid_file, "w") as file:
file.write(str(pid))
except OSError:
print(f"Fatal Error: Unable to write pid file {pid_file}")
sys.exit(1) | [
"def",
"write_pid",
"(",
"pid_file",
":",
"str",
")",
"->",
"None",
":",
"pid",
"=",
"os",
".",
"getpid",
"(",
")",
"try",
":",
"with",
"open",
"(",
"pid_file",
",",
"\"w\"",
")",
"as",
"file",
":",
"file",
".",
"write",
"(",
"str",
"(",
"pid",
... | [
178,
0
] | [
186,
19
] | python | en | ['en', 'et', 'en'] | True |
closefds_osx | (min_fd: int, max_fd: int) | Make sure file descriptors get closed when we restart.
We cannot call close on guarded fds, and we cannot easily test which fds
are guarded. But we can set the close-on-exec flag on everything we want to
get rid of.
| Make sure file descriptors get closed when we restart. | def closefds_osx(min_fd: int, max_fd: int) -> None:
"""Make sure file descriptors get closed when we restart.
We cannot call close on guarded fds, and we cannot easily test which fds
are guarded. But we can set the close-on-exec flag on everything we want to
get rid of.
"""
# pylint: disable=im... | [
"def",
"closefds_osx",
"(",
"min_fd",
":",
"int",
",",
"max_fd",
":",
"int",
")",
"->",
"None",
":",
"# pylint: disable=import-outside-toplevel",
"from",
"fcntl",
"import",
"F_GETFD",
",",
"F_SETFD",
",",
"FD_CLOEXEC",
",",
"fcntl",
"for",
"_fd",
"in",
"range"... | [
189,
0
] | [
205,
16
] | python | en | ['en', 'da', 'en'] | True |
cmdline | () | Collect path and arguments to re-execute the current hass instance. | Collect path and arguments to re-execute the current hass instance. | def cmdline() -> List[str]:
"""Collect path and arguments to re-execute the current hass instance."""
if os.path.basename(sys.argv[0]) == "__main__.py":
modulepath = os.path.dirname(sys.argv[0])
os.environ["PYTHONPATH"] = os.path.dirname(modulepath)
return [sys.executable] + [arg for arg... | [
"def",
"cmdline",
"(",
")",
"->",
"List",
"[",
"str",
"]",
":",
"if",
"os",
".",
"path",
".",
"basename",
"(",
"sys",
".",
"argv",
"[",
"0",
"]",
")",
"==",
"\"__main__.py\"",
":",
"modulepath",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"sys",... | [
208,
0
] | [
215,
57
] | python | en | ['en', 'en', 'en'] | True |
try_to_restart | () | Attempt to clean up state and start a new Home Assistant instance. | Attempt to clean up state and start a new Home Assistant instance. | def try_to_restart() -> None:
"""Attempt to clean up state and start a new Home Assistant instance."""
# Things should be mostly shut down already at this point, now just try
# to clean up things that may have been left behind.
sys.stderr.write("Home Assistant attempting to restart.\n")
# Count rem... | [
"def",
"try_to_restart",
"(",
")",
"->",
"None",
":",
"# Things should be mostly shut down already at this point, now just try",
"# to clean up things that may have been left behind.",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"Home Assistant attempting to restart.\\n\"",
")",
"# ... | [
218,
0
] | [
257,
27
] | python | en | ['en', 'en', 'en'] | True |
main | () | Start Home Assistant. | Start Home Assistant. | def main() -> int:
"""Start Home Assistant."""
validate_python()
# Run a simple daemon runner process on Windows to handle restarts
if os.name == "nt" and "--runner" not in sys.argv:
nt_args = cmdline() + ["--runner"]
while True:
try:
subprocess.check_call(nt... | [
"def",
"main",
"(",
")",
"->",
"int",
":",
"validate_python",
"(",
")",
"# Run a simple daemon runner process on Windows to handle restarts",
"if",
"os",
".",
"name",
"==",
"\"nt\"",
"and",
"\"--runner\"",
"not",
"in",
"sys",
".",
"argv",
":",
"nt_args",
"=",
"c... | [
260,
0
] | [
315,
20
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: dict) | Set up the Intent component. | Set up the Intent component. | async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Intent component."""
hass.http.register_view(IntentHandleView())
await integration_platform.async_process_integration_platforms(
hass, DOMAIN, _async_process_intent
)
hass.helpers.intent.async_register(
intent.... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"hass",
".",
"http",
".",
"register_view",
"(",
"IntentHandleView",
"(",
")",
")",
"await",
"integration_platform",
".",
"async_process_integration_platforms",
... | [
14,
0
] | [
38,
15
] | python | en | ['en', 'en', 'en'] | True |
_async_process_intent | (hass: HomeAssistant, domain: str, platform) | Process the intents of an integration. | Process the intents of an integration. | async def _async_process_intent(hass: HomeAssistant, domain: str, platform):
"""Process the intents of an integration."""
await platform.async_setup_intents(hass) | [
"async",
"def",
"_async_process_intent",
"(",
"hass",
":",
"HomeAssistant",
",",
"domain",
":",
"str",
",",
"platform",
")",
":",
"await",
"platform",
".",
"async_setup_intents",
"(",
"hass",
")"
] | [
41,
0
] | [
43,
44
] | python | en | ['en', 'en', 'en'] | True |
IntentHandleView.post | (self, request, data) | Handle intent with name/data. | Handle intent with name/data. | async def post(self, request, data):
"""Handle intent with name/data."""
hass = request.app["hass"]
try:
intent_name = data["name"]
slots = {
key: {"value": value} for key, value in data.get("data", {}).items()
}
intent_result = aw... | [
"async",
"def",
"post",
"(",
"self",
",",
"request",
",",
"data",
")",
":",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"try",
":",
"intent_name",
"=",
"data",
"[",
"\"name\"",
"]",
"slots",
"=",
"{",
"key",
":",
"{",
"\"value\"",
":"... | [
60,
4
] | [
80,
39
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry, async_add_entities) | Set up Neato vacuum with config entry. | Set up Neato vacuum with config entry. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up Neato vacuum with config entry."""
dev = []
neato = hass.data.get(NEATO_LOGIN)
mapdata = hass.data.get(NEATO_MAP_DATA)
persistent_maps = hass.data.get(NEATO_PERSISTENT_MAPS)
for robot in hass.data[NEATO_ROBOTS]:
dev.... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"dev",
"=",
"[",
"]",
"neato",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"NEATO_LOGIN",
")",
"mapdata",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"... | [
86,
0
] | [
125,
5
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.__init__ | (self, neato, robot, mapdata, persistent_maps) | Initialize the Neato Connected Vacuum. | Initialize the Neato Connected Vacuum. | def __init__(self, neato, robot, mapdata, persistent_maps):
"""Initialize the Neato Connected Vacuum."""
self.robot = robot
self._available = neato.logged_in if neato is not None else False
self._mapdata = mapdata
self._name = f"{self.robot.name}"
self._robot_has_map = se... | [
"def",
"__init__",
"(",
"self",
",",
"neato",
",",
"robot",
",",
"mapdata",
",",
"persistent_maps",
")",
":",
"self",
".",
"robot",
"=",
"robot",
"self",
".",
"_available",
"=",
"neato",
".",
"logged_in",
"if",
"neato",
"is",
"not",
"None",
"else",
"Fa... | [
131,
4
] | [
155,
32
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.update | (self) | Update the states of Neato Vacuums. | Update the states of Neato Vacuums. | def update(self):
"""Update the states of Neato Vacuums."""
_LOGGER.debug("Running Neato Vacuums update for '%s'", self.entity_id)
try:
if self._robot_stats is None:
self._robot_stats = self.robot.get_general_info().json().get("data")
except NeatoRobotExceptio... | [
"def",
"update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Running Neato Vacuums update for '%s'\"",
",",
"self",
".",
"entity_id",
")",
"try",
":",
"if",
"self",
".",
"_robot_stats",
"is",
"None",
":",
"self",
".",
"_robot_stats",
"=",
"self",... | [
157,
4
] | [
272,
21
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
275,
4
] | [
277,
25
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.supported_features | (self) | Flag vacuum cleaner robot features that are supported. | Flag vacuum cleaner robot features that are supported. | def supported_features(self):
"""Flag vacuum cleaner robot features that are supported."""
return SUPPORT_NEATO | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_NEATO"
] | [
280,
4
] | [
282,
28
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.battery_level | (self) | Return the battery level of the vacuum cleaner. | Return the battery level of the vacuum cleaner. | def battery_level(self):
"""Return the battery level of the vacuum cleaner."""
return self._battery_level | [
"def",
"battery_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_battery_level"
] | [
285,
4
] | [
287,
34
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.available | (self) | Return if the robot is available. | Return if the robot is available. | def available(self):
"""Return if the robot is available."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
290,
4
] | [
292,
30
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.icon | (self) | Return neato specific icon. | Return neato specific icon. | def icon(self):
"""Return neato specific icon."""
return "mdi:robot-vacuum-variant" | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"\"mdi:robot-vacuum-variant\""
] | [
295,
4
] | [
297,
41
] | python | it | ['it', 'it', 'en'] | True |
NeatoConnectedVacuum.state | (self) | Return the status of the vacuum cleaner. | Return the status of the vacuum cleaner. | def state(self):
"""Return the status of the vacuum cleaner."""
return self._clean_state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_clean_state"
] | [
300,
4
] | [
302,
32
] | python | en | ['en', 'la', 'en'] | True |
NeatoConnectedVacuum.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return self._robot_serial | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_robot_serial"
] | [
305,
4
] | [
307,
33
] | python | ca | ['fr', 'ca', 'en'] | False |
NeatoConnectedVacuum.device_state_attributes | (self) | Return the state attributes of the vacuum cleaner. | Return the state attributes of the vacuum cleaner. | def device_state_attributes(self):
"""Return the state attributes of the vacuum cleaner."""
data = {}
if self._status_state is not None:
data[ATTR_STATUS] = self._status_state
if self._clean_time_start is not None:
data[ATTR_CLEAN_START] = self._clean_time_start
... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"data",
"=",
"{",
"}",
"if",
"self",
".",
"_status_state",
"is",
"not",
"None",
":",
"data",
"[",
"ATTR_STATUS",
"]",
"=",
"self",
".",
"_status_state",
"if",
"self",
".",
"_clean_time_start",
"is",
... | [
310,
4
] | [
337,
19
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.device_info | (self) | Device info for neato robot. | Device info for neato robot. | def device_info(self):
"""Device info for neato robot."""
info = {"identifiers": {(NEATO_DOMAIN, self._robot_serial)}, "name": self._name}
if self._robot_stats:
info["manufacturer"] = self._robot_stats["battery"]["vendor"]
info["model"] = self._robot_stats["model"]
... | [
"def",
"device_info",
"(",
"self",
")",
":",
"info",
"=",
"{",
"\"identifiers\"",
":",
"{",
"(",
"NEATO_DOMAIN",
",",
"self",
".",
"_robot_serial",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"_name",
"}",
"if",
"self",
".",
"_robot_stats",
":",
"info... | [
340,
4
] | [
347,
19
] | python | it | ['it', 'en', 'it'] | True |
NeatoConnectedVacuum.start | (self) | Start cleaning or resume cleaning. | Start cleaning or resume cleaning. | def start(self):
"""Start cleaning or resume cleaning."""
try:
if self._state["state"] == 1:
self.robot.start_cleaning()
elif self._state["state"] == 3:
self.robot.resume_cleaning()
except NeatoRobotException as ex:
_LOGGER.erro... | [
"def",
"start",
"(",
"self",
")",
":",
"try",
":",
"if",
"self",
".",
"_state",
"[",
"\"state\"",
"]",
"==",
"1",
":",
"self",
".",
"robot",
".",
"start_cleaning",
"(",
")",
"elif",
"self",
".",
"_state",
"[",
"\"state\"",
"]",
"==",
"3",
":",
"s... | [
349,
4
] | [
359,
13
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.pause | (self) | Pause the vacuum. | Pause the vacuum. | def pause(self):
"""Pause the vacuum."""
try:
self.robot.pause_cleaning()
except NeatoRobotException as ex:
_LOGGER.error(
"Neato vacuum connection error for '%s': %s", self.entity_id, ex
) | [
"def",
"pause",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"robot",
".",
"pause_cleaning",
"(",
")",
"except",
"NeatoRobotException",
"as",
"ex",
":",
"_LOGGER",
".",
"error",
"(",
"\"Neato vacuum connection error for '%s': %s\"",
",",
"self",
".",
"entit... | [
361,
4
] | [
368,
13
] | python | en | ['en', 'la', 'en'] | True |
NeatoConnectedVacuum.return_to_base | (self, **kwargs) | Set the vacuum cleaner to return to the dock. | Set the vacuum cleaner to return to the dock. | def return_to_base(self, **kwargs):
"""Set the vacuum cleaner to return to the dock."""
try:
if self._clean_state == STATE_CLEANING:
self.robot.pause_cleaning()
self._clean_state = STATE_RETURNING
self.robot.send_to_base()
except NeatoRobotExce... | [
"def",
"return_to_base",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"if",
"self",
".",
"_clean_state",
"==",
"STATE_CLEANING",
":",
"self",
".",
"robot",
".",
"pause_cleaning",
"(",
")",
"self",
".",
"_clean_state",
"=",
"STATE_RETURNING",... | [
370,
4
] | [
380,
13
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.stop | (self, **kwargs) | Stop the vacuum cleaner. | Stop the vacuum cleaner. | def stop(self, **kwargs):
"""Stop the vacuum cleaner."""
try:
self.robot.stop_cleaning()
except NeatoRobotException as ex:
_LOGGER.error(
"Neato vacuum connection error for '%s': %s", self.entity_id, ex
) | [
"def",
"stop",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"robot",
".",
"stop_cleaning",
"(",
")",
"except",
"NeatoRobotException",
"as",
"ex",
":",
"_LOGGER",
".",
"error",
"(",
"\"Neato vacuum connection error for '%s': %s\"",
... | [
382,
4
] | [
389,
13
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.locate | (self, **kwargs) | Locate the robot by making it emit a sound. | Locate the robot by making it emit a sound. | def locate(self, **kwargs):
"""Locate the robot by making it emit a sound."""
try:
self.robot.locate()
except NeatoRobotException as ex:
_LOGGER.error(
"Neato vacuum connection error for '%s': %s", self.entity_id, ex
) | [
"def",
"locate",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"robot",
".",
"locate",
"(",
")",
"except",
"NeatoRobotException",
"as",
"ex",
":",
"_LOGGER",
".",
"error",
"(",
"\"Neato vacuum connection error for '%s': %s\"",
",",... | [
391,
4
] | [
398,
13
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.clean_spot | (self, **kwargs) | Run a spot cleaning starting from the base. | Run a spot cleaning starting from the base. | def clean_spot(self, **kwargs):
"""Run a spot cleaning starting from the base."""
try:
self.robot.start_spot_cleaning()
except NeatoRobotException as ex:
_LOGGER.error(
"Neato vacuum connection error for '%s': %s", self.entity_id, ex
) | [
"def",
"clean_spot",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"robot",
".",
"start_spot_cleaning",
"(",
")",
"except",
"NeatoRobotException",
"as",
"ex",
":",
"_LOGGER",
".",
"error",
"(",
"\"Neato vacuum connection error for '%... | [
400,
4
] | [
407,
13
] | python | en | ['en', 'en', 'en'] | True |
NeatoConnectedVacuum.neato_custom_cleaning | (self, mode, navigation, category, zone=None, **kwargs) | Zone cleaning service call. | Zone cleaning service call. | def neato_custom_cleaning(self, mode, navigation, category, zone=None, **kwargs):
"""Zone cleaning service call."""
boundary_id = None
if zone is not None:
for boundary in self._robot_boundaries:
if zone in boundary["name"]:
boundary_id = boundary[... | [
"def",
"neato_custom_cleaning",
"(",
"self",
",",
"mode",
",",
"navigation",
",",
"category",
",",
"zone",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"boundary_id",
"=",
"None",
"if",
"zone",
"is",
"not",
"None",
":",
"for",
"boundary",
"in",
"sel... | [
409,
4
] | [
428,
13
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the sisyphus component. | Set up the sisyphus component. | async def async_setup(hass, config):
"""Set up the sisyphus component."""
class SocketIONoiseFilter(logging.Filter):
"""Filters out excessively verbose logs from SocketIO."""
def filter(self, record):
if "waiting for connection" in record.msg:
return False
... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"class",
"SocketIONoiseFilter",
"(",
"logging",
".",
"Filter",
")",
":",
"\"\"\"Filters out excessively verbose logs from SocketIO.\"\"\"",
"def",
"filter",
"(",
"self",
",",
"record",
")",
":",
... | [
30,
0
] | [
72,
15
] | python | en | ['en', 'en', 'en'] | True |
TableHolder.__init__ | (self, hass, session, host, name) | Initialize the table holder. | Initialize the table holder. | def __init__(self, hass, session, host, name):
"""Initialize the table holder."""
self._hass = hass
self._session = session
self._host = host
self._name = name
self._table = None
self._table_task = None | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"session",
",",
"host",
",",
"name",
")",
":",
"self",
".",
"_hass",
"=",
"hass",
"self",
".",
"_session",
"=",
"session",
"self",
".",
"_host",
"=",
"host",
"self",
".",
"_name",
"=",
"name",
"self... | [
78,
4
] | [
85,
31
] | python | en | ['en', 'en', 'en'] | True |
TableHolder.available | (self) | Return true if the table is responding to heartbeats. | Return true if the table is responding to heartbeats. | def available(self):
"""Return true if the table is responding to heartbeats."""
if self._table_task and self._table_task.done():
return self._table_task.result().is_connected
return False | [
"def",
"available",
"(",
"self",
")",
":",
"if",
"self",
".",
"_table_task",
"and",
"self",
".",
"_table_task",
".",
"done",
"(",
")",
":",
"return",
"self",
".",
"_table_task",
".",
"result",
"(",
")",
".",
"is_connected",
"return",
"False"
] | [
88,
4
] | [
92,
20
] | python | en | ['en', 'en', 'en'] | True |
TableHolder.name | (self) | Return the name of the table. | Return the name of the table. | def name(self):
"""Return the name of the table."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
95,
4
] | [
97,
25
] | python | en | ['en', 'en', 'en'] | True |
TableHolder.get_table | (self) | Return the Table held by this holder, connecting to it if needed. | Return the Table held by this holder, connecting to it if needed. | async def get_table(self):
"""Return the Table held by this holder, connecting to it if needed."""
if self._table:
return self._table
if not self._table_task:
self._table_task = self._hass.async_create_task(self._connect_table())
return await self._table_task | [
"async",
"def",
"get_table",
"(",
"self",
")",
":",
"if",
"self",
".",
"_table",
":",
"return",
"self",
".",
"_table",
"if",
"not",
"self",
".",
"_table_task",
":",
"self",
".",
"_table_task",
"=",
"self",
".",
"_hass",
".",
"async_create_task",
"(",
"... | [
99,
4
] | [
107,
37
] | python | en | ['en', 'en', 'en'] | True |
TableHolder.close | (self) | Close the table held by this holder, if any. | Close the table held by this holder, if any. | async def close(self):
"""Close the table held by this holder, if any."""
if self._table:
await self._table.close()
self._table = None
self._table_task = None | [
"async",
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"_table",
":",
"await",
"self",
".",
"_table",
".",
"close",
"(",
")",
"self",
".",
"_table",
"=",
"None",
"self",
".",
"_table_task",
"=",
"None"
] | [
119,
4
] | [
124,
35
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the FFmpeg noise binary sensor. | Set up the FFmpeg noise binary sensor. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the FFmpeg noise binary sensor."""
manager = hass.data[DATA_FFMPEG]
entity = FFmpegNoise(hass, manager, config)
async_add_entities([entity]) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"manager",
"=",
"hass",
".",
"data",
"[",
"DATA_FFMPEG",
"]",
"entity",
"=",
"FFmpegNoise",
"(",
"hass",
",",
"manage... | [
41,
0
] | [
45,
32
] | python | en | ['en', 'st', 'en'] | True |
FFmpegNoise.__init__ | (self, hass, manager, config) | Initialize FFmpeg noise binary sensor. | Initialize FFmpeg noise binary sensor. | def __init__(self, hass, manager, config):
"""Initialize FFmpeg noise binary sensor."""
super().__init__(config)
self.ffmpeg = ffmpeg_sensor.SensorNoise(
manager.binary, hass.loop, self._async_callback
) | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"manager",
",",
"config",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"config",
")",
"self",
".",
"ffmpeg",
"=",
"ffmpeg_sensor",
".",
"SensorNoise",
"(",
"manager",
".",
"binary",
",",
"hass",
... | [
51,
4
] | [
57,
9
] | python | en | ['en', 'fy', 'en'] | True |
FFmpegNoise._async_start_ffmpeg | (self, entity_ids) | Start a FFmpeg instance.
This method is a coroutine.
| Start a FFmpeg instance. | async def _async_start_ffmpeg(self, entity_ids):
"""Start a FFmpeg instance.
This method is a coroutine.
"""
if entity_ids is not None and self.entity_id not in entity_ids:
return
self.ffmpeg.set_options(
time_duration=self._config.get(CONF_DURATION),
... | [
"async",
"def",
"_async_start_ffmpeg",
"(",
"self",
",",
"entity_ids",
")",
":",
"if",
"entity_ids",
"is",
"not",
"None",
"and",
"self",
".",
"entity_id",
"not",
"in",
"entity_ids",
":",
"return",
"self",
".",
"ffmpeg",
".",
"set_options",
"(",
"time_duratio... | [
59,
4
] | [
77,
9
] | python | en | ['hu', 'lb', 'en'] | False |
FFmpegNoise.device_class | (self) | Return the class of this sensor, from DEVICE_CLASSES. | Return the class of this sensor, from DEVICE_CLASSES. | def device_class(self):
"""Return the class of this sensor, from DEVICE_CLASSES."""
return DEVICE_CLASS_SOUND | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_SOUND"
] | [
80,
4
] | [
82,
33
] | python | en | ['en', 'en', 'en'] | True |
test_user_form | (hass) | Test we get the user form. | Test we get the user form. | async def test_user_form(hass):
"""Test we get the user form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert resu... | [
"async",
"def",
"test_user_form",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",... | [
24,
0
] | [
68,
37
] | python | en | ['en', 'da', 'en'] | True |
test_form_import | (hass) | Test we get the form with import source. | Test we get the form with import source. | async def test_form_import(hass):
"""Test we get the form with import source."""
await setup.async_setup_component(hass, "persistent_notification", {})
mock_powerview_userdata = _get_mock_powerview_userdata()
with patch(
"homeassistant.components.hunterdouglas_powerview.UserData",
retur... | [
"async",
"def",
"test_form_import",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"mock_powerview_userdata",
"=",
"_get_mock_powerview_userdata",
"(",
")",
"with",
"patch",... | [
71,
0
] | [
99,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_homekit | (hass) | Test we get the form with homekit source. | Test we get the form with homekit source. | async def test_form_homekit(hass):
"""Test we get the form with homekit source."""
await setup.async_setup_component(hass, "persistent_notification", {})
ignored_config_entry = MockConfigEntry(domain=DOMAIN, data={}, source="ignore")
ignored_config_entry.add_to_hass(hass)
mock_powerview_userdata =... | [
"async",
"def",
"test_form_homekit",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"ignored_config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"d... | [
102,
0
] | [
162,
37
] | python | en | ['en', 'en', 'en'] | True |
test_form_cannot_connect | (hass) | Test we handle cannot connect error. | Test we handle cannot connect error. | async def test_form_cannot_connect(hass):
"""Test we handle cannot connect error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
mock_powerview_userdata = _get_mock_powerview_userdata(
get_resources=asyncio.TimeoutError
... | [
"async",
"def",
"test_form_cannot_connect",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
"... | [
165,
0
] | [
184,
58
] | python | en | ['en', 'en', 'en'] | True |
test_form_no_data | (hass) | Test we handle no data being returned from the hub. | Test we handle no data being returned from the hub. | async def test_form_no_data(hass):
"""Test we handle no data being returned from the hub."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
mock_powerview_userdata = _get_mock_powerview_userdata(userdata={"userData": {}})
with pa... | [
"async",
"def",
"test_form_no_data",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")",
"... | [
187,
0
] | [
204,
51
] | python | en | ['en', 'en', 'en'] | True |
test_form_unknown_exception | (hass) | Test we handle unknown exception. | Test we handle unknown exception. | async def test_form_unknown_exception(hass):
"""Test we handle unknown exception."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
mock_powerview_userdata = _get_mock_powerview_userdata(userdata={"userData": {}})
with patch(
... | [
"async",
"def",
"test_form_unknown_exception",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
... | [
207,
0
] | [
224,
51
] | python | en | ['en', 'en', 'en'] | True |
device_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def device_reg(hass):
"""Return an empty, loaded, registry."""
return mock_device_registry(hass) | [
"def",
"device_reg",
"(",
"hass",
")",
":",
"return",
"mock_device_registry",
"(",
"hass",
")"
] | [
21,
0
] | [
23,
37
] | python | en | ['en', 'fy', 'en'] | True |
entity_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def entity_reg(hass):
"""Return an empty, loaded, registry."""
return mock_registry(hass) | [
"def",
"entity_reg",
"(",
"hass",
")",
":",
"return",
"mock_registry",
"(",
"hass",
")"
] | [
27,
0
] | [
29,
30
] | python | en | ['en', 'fy', 'en'] | True |
calls | (hass) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
")",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
33,
0
] | [
35,
57
] | python | en | ['en', 'en', 'en'] | True |
test_get_triggers | (hass, device_reg, entity_reg, mqtt_mock) | Test we get the expected triggers from a discovered mqtt device. | Test we get the expected triggers from a discovered mqtt device. | async def test_get_triggers(hass, device_reg, entity_reg, mqtt_mock):
"""Test we get the expected triggers from a discovered mqtt device."""
data1 = (
'{ "automation_type":"trigger",'
' "device":{"identifiers":["0AFFD2"]},'
' "payload": "short_press",'
' "topic": "foobar/trigg... | [
"async",
"def",
"test_get_triggers",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
",",
"mqtt_mock",
")",
":",
"data1",
"=",
"(",
"'{ \"automation_type\":\"trigger\",'",
"' \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"payload\": \"short_press\",'",
"' \"topic\": \... | [
38,
0
] | [
63,
50
] | python | en | ['en', 'en', 'en'] | True |
test_get_unknown_triggers | (hass, device_reg, entity_reg, mqtt_mock) | Test we don't get unknown triggers. | Test we don't get unknown triggers. | async def test_get_unknown_triggers(hass, device_reg, entity_reg, mqtt_mock):
"""Test we don't get unknown triggers."""
# Discover a sensor (without device triggers)
data1 = (
'{ "device":{"identifiers":["0AFFD2"]},'
' "state_topic": "foobar/sensor",'
' "unique_id": "unique" }'
... | [
"async",
"def",
"test_get_unknown_triggers",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
",",
"mqtt_mock",
")",
":",
"# Discover a sensor (without device triggers)",
"data1",
"=",
"(",
"'{ \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"state_topic\": \"foobar/sensor\"... | [
66,
0
] | [
103,
35
] | python | en | ['en', 'en', 'en'] | True |
test_get_non_existing_triggers | (hass, device_reg, entity_reg, mqtt_mock) | Test getting non existing triggers. | Test getting non existing triggers. | async def test_get_non_existing_triggers(hass, device_reg, entity_reg, mqtt_mock):
"""Test getting non existing triggers."""
# Discover a sensor (without device triggers)
data1 = (
'{ "device":{"identifiers":["0AFFD2"]},'
' "state_topic": "foobar/sensor",'
' "unique_id": "unique" }... | [
"async",
"def",
"test_get_non_existing_triggers",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
",",
"mqtt_mock",
")",
":",
"# Discover a sensor (without device triggers)",
"data1",
"=",
"(",
"'{ \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"state_topic\": \"foobar/sen... | [
106,
0
] | [
119,
35
] | python | en | ['nl', 'en', 'en'] | True |
test_discover_bad_triggers | (hass, device_reg, entity_reg, mqtt_mock) | Test bad discovery message. | Test bad discovery message. | async def test_discover_bad_triggers(hass, device_reg, entity_reg, mqtt_mock):
"""Test bad discovery message."""
# Test sending bad data
data0 = (
'{ "automation_type":"trigger",'
' "device":{"identifiers":["0AFFD2"]},'
' "payloads": "short_press",'
' "topic": "foobar/trig... | [
"async",
"def",
"test_discover_bad_triggers",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
",",
"mqtt_mock",
")",
":",
"# Test sending bad data",
"data0",
"=",
"(",
"'{ \"automation_type\":\"trigger\",'",
"' \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"payloads\":... | [
123,
0
] | [
162,
50
] | python | en | ['en', 'en', 'en'] | True |
test_update_remove_triggers | (hass, device_reg, entity_reg, mqtt_mock) | Test triggers can be updated and removed. | Test triggers can be updated and removed. | async def test_update_remove_triggers(hass, device_reg, entity_reg, mqtt_mock):
"""Test triggers can be updated and removed."""
data1 = (
'{ "automation_type":"trigger",'
' "device":{"identifiers":["0AFFD2"]},'
' "payload": "short_press",'
' "topic": "foobar/triggers/button1",... | [
"async",
"def",
"test_update_remove_triggers",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
",",
"mqtt_mock",
")",
":",
"data1",
"=",
"(",
"'{ \"automation_type\":\"trigger\",'",
"' \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"payload\": \"short_press\",'",
"' \"... | [
165,
0
] | [
215,
31
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_mqtt_message | (hass, device_reg, calls, mqtt_mock) | Test triggers firing. | Test triggers firing. | async def test_if_fires_on_mqtt_message(hass, device_reg, calls, mqtt_mock):
"""Test triggers firing."""
data1 = (
'{ "automation_type":"trigger",'
' "device":{"identifiers":["0AFFD2"]},'
' "payload": "short_press",'
' "topic": "foobar/triggers/button1",'
' "type": "b... | [
"async",
"def",
"test_if_fires_on_mqtt_message",
"(",
"hass",
",",
"device_reg",
",",
"calls",
",",
"mqtt_mock",
")",
":",
"data1",
"=",
"(",
"'{ \"automation_type\":\"trigger\",'",
"' \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"payload\": \"short_press\",'",
"' \"top... | [
218,
0
] | [
288,
48
] | python | en | ['en', 'lb', 'en'] | True |
test_if_fires_on_mqtt_message_late_discover | (
hass, device_reg, calls, mqtt_mock
) | Test triggers firing of MQTT device triggers discovered after setup. | Test triggers firing of MQTT device triggers discovered after setup. | async def test_if_fires_on_mqtt_message_late_discover(
hass, device_reg, calls, mqtt_mock
):
"""Test triggers firing of MQTT device triggers discovered after setup."""
data0 = (
'{ "device":{"identifiers":["0AFFD2"]},'
' "state_topic": "foobar/sensor",'
' "unique_id": "unique" }'
... | [
"async",
"def",
"test_if_fires_on_mqtt_message_late_discover",
"(",
"hass",
",",
"device_reg",
",",
"calls",
",",
"mqtt_mock",
")",
":",
"data0",
"=",
"(",
"'{ \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"state_topic\": \"foobar/sensor\",'",
"' \"unique_id\": \"unique\" }... | [
291,
0
] | [
371,
48
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_mqtt_message_after_update | (
hass, device_reg, calls, mqtt_mock
) | Test triggers firing after update. | Test triggers firing after update. | async def test_if_fires_on_mqtt_message_after_update(
hass, device_reg, calls, mqtt_mock
):
"""Test triggers firing after update."""
data1 = (
'{ "automation_type":"trigger",'
' "device":{"identifiers":["0AFFD2"]},'
' "topic": "foobar/triggers/button1",'
' "type": "button_... | [
"async",
"def",
"test_if_fires_on_mqtt_message_after_update",
"(",
"hass",
",",
"device_reg",
",",
"calls",
",",
"mqtt_mock",
")",
":",
"data1",
"=",
"(",
"'{ \"automation_type\":\"trigger\",'",
"' \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"topic\": \"foobar/triggers/bu... | [
374,
0
] | [
446,
26
] | python | da | ['da', 'lb', 'en'] | False |
test_no_resubscribe_same_topic | (hass, device_reg, mqtt_mock) | Test subscription to topics without change. | Test subscription to topics without change. | async def test_no_resubscribe_same_topic(hass, device_reg, mqtt_mock):
"""Test subscription to topics without change."""
data1 = (
'{ "automation_type":"trigger",'
' "device":{"identifiers":["0AFFD2"]},'
' "topic": "foobar/triggers/button1",'
' "type": "button_short_press",'
... | [
"async",
"def",
"test_no_resubscribe_same_topic",
"(",
"hass",
",",
"device_reg",
",",
"mqtt_mock",
")",
":",
"data1",
"=",
"(",
"'{ \"automation_type\":\"trigger\",'",
"' \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"topic\": \"foobar/triggers/button1\",'",
"' \"type\": \"... | [
449,
0
] | [
488,
61
] | python | en | ['en', 'en', 'en'] | True |
test_not_fires_on_mqtt_message_after_remove_by_mqtt | (
hass, device_reg, calls, mqtt_mock
) | Test triggers not firing after removal. | Test triggers not firing after removal. | async def test_not_fires_on_mqtt_message_after_remove_by_mqtt(
hass, device_reg, calls, mqtt_mock
):
"""Test triggers not firing after removal."""
data1 = (
'{ "automation_type":"trigger",'
' "device":{"identifiers":["0AFFD2"]},'
' "topic": "foobar/triggers/button1",'
' "t... | [
"async",
"def",
"test_not_fires_on_mqtt_message_after_remove_by_mqtt",
"(",
"hass",
",",
"device_reg",
",",
"calls",
",",
"mqtt_mock",
")",
":",
"data1",
"=",
"(",
"'{ \"automation_type\":\"trigger\",'",
"' \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"topic\": \"foobar/tr... | [
491,
0
] | [
548,
26
] | python | en | ['en', 'en', 'en'] | True |
test_not_fires_on_mqtt_message_after_remove_from_registry | (
hass, device_reg, calls, mqtt_mock
) | Test triggers not firing after removal. | Test triggers not firing after removal. | async def test_not_fires_on_mqtt_message_after_remove_from_registry(
hass, device_reg, calls, mqtt_mock
):
"""Test triggers not firing after removal."""
data1 = (
'{ "automation_type":"trigger",'
' "device":{"identifiers":["0AFFD2"]},'
' "topic": "foobar/triggers/button1",'
... | [
"async",
"def",
"test_not_fires_on_mqtt_message_after_remove_from_registry",
"(",
"hass",
",",
"device_reg",
",",
"calls",
",",
"mqtt_mock",
")",
":",
"data1",
"=",
"(",
"'{ \"automation_type\":\"trigger\",'",
"' \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"topic\": \"foo... | [
551,
0
] | [
600,
26
] | python | en | ['en', 'en', 'en'] | True |
test_attach_remove | (hass, device_reg, mqtt_mock) | Test attach and removal of trigger. | Test attach and removal of trigger. | async def test_attach_remove(hass, device_reg, mqtt_mock):
"""Test attach and removal of trigger."""
data1 = (
'{ "automation_type":"trigger",'
' "device":{"identifiers":["0AFFD2"]},'
' "payload": "short_press",'
' "topic": "foobar/triggers/button1",'
' "type": "butto... | [
"async",
"def",
"test_attach_remove",
"(",
"hass",
",",
"device_reg",
",",
"mqtt_mock",
")",
":",
"data1",
"=",
"(",
"'{ \"automation_type\":\"trigger\",'",
"' \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"payload\": \"short_press\",'",
"' \"topic\": \"foobar/triggers/butto... | [
603,
0
] | [
649,
26
] | python | en | ['en', 'en', 'en'] | True |
test_attach_remove_late | (hass, device_reg, mqtt_mock) | Test attach and removal of trigger . | Test attach and removal of trigger . | async def test_attach_remove_late(hass, device_reg, mqtt_mock):
"""Test attach and removal of trigger ."""
data0 = (
'{ "device":{"identifiers":["0AFFD2"]},'
' "state_topic": "foobar/sensor",'
' "unique_id": "unique" }'
)
data1 = (
'{ "automation_type":"trigger",'
... | [
"async",
"def",
"test_attach_remove_late",
"(",
"hass",
",",
"device_reg",
",",
"mqtt_mock",
")",
":",
"data0",
"=",
"(",
"'{ \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"state_topic\": \"foobar/sensor\",'",
"' \"unique_id\": \"unique\" }'",
")",
"data1",
"=",
"(",
... | [
652,
0
] | [
706,
26
] | python | en | ['en', 'en', 'en'] | True |
test_attach_remove_late2 | (hass, device_reg, mqtt_mock) | Test attach and removal of trigger . | Test attach and removal of trigger . | async def test_attach_remove_late2(hass, device_reg, mqtt_mock):
"""Test attach and removal of trigger ."""
data0 = (
'{ "device":{"identifiers":["0AFFD2"]},'
' "state_topic": "foobar/sensor",'
' "unique_id": "unique" }'
)
data1 = (
'{ "automation_type":"trigger",'
... | [
"async",
"def",
"test_attach_remove_late2",
"(",
"hass",
",",
"device_reg",
",",
"mqtt_mock",
")",
":",
"data0",
"=",
"(",
"'{ \"device\":{\"identifiers\":[\"0AFFD2\"]},'",
"' \"state_topic\": \"foobar/sensor\",'",
"' \"unique_id\": \"unique\" }'",
")",
"data1",
"=",
"(",
... | [
709,
0
] | [
757,
26
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_connection | (hass, mqtt_mock) | Test MQTT device registry integration. | Test MQTT device registry integration. | async def test_entity_device_info_with_connection(hass, mqtt_mock):
"""Test MQTT device registry integration."""
registry = await hass.helpers.device_registry.async_get_registry()
data = json.dumps(
{
"automation_type": "trigger",
"topic": "test-topic",
"type": "... | [
"async",
"def",
"test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"device_registry",
".",
"async_get_registry",
"(",
")",
"data",
"=",
"json",
".",
"dumps",
"(",
"{",
"\"a... | [
760,
0
] | [
788,
42
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_with_identifier | (hass, mqtt_mock) | Test MQTT device registry integration. | Test MQTT device registry integration. | async def test_entity_device_info_with_identifier(hass, mqtt_mock):
"""Test MQTT device registry integration."""
registry = await hass.helpers.device_registry.async_get_registry()
data = json.dumps(
{
"automation_type": "trigger",
"topic": "test-topic",
"type": "... | [
"async",
"def",
"test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"device_registry",
".",
"async_get_registry",
"(",
")",
"data",
"=",
"json",
".",
"dumps",
"(",
"{",
"\"a... | [
791,
0
] | [
819,
42
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_update | (hass, mqtt_mock) | Test device registry update. | Test device registry update. | async def test_entity_device_info_update(hass, mqtt_mock):
"""Test device registry update."""
registry = await hass.helpers.device_registry.async_get_registry()
config = {
"automation_type": "trigger",
"topic": "test-topic",
"type": "foo",
"subtype": "bar",
"device":... | [
"async",
"def",
"test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"device_registry",
".",
"async_get_registry",
"(",
")",
"config",
"=",
"{",
"\"automation_type\"",
":",
"\"trigger\"",... | [
822,
0
] | [
856,
32
] | python | en | ['fr', 'fy', 'en'] | False |
test_cleanup_trigger | (hass, device_reg, entity_reg, mqtt_mock) | Test trigger discovery topic is cleaned when device is removed from registry. | Test trigger discovery topic is cleaned when device is removed from registry. | async def test_cleanup_trigger(hass, device_reg, entity_reg, mqtt_mock):
"""Test trigger discovery topic is cleaned when device is removed from registry."""
config = {
"automation_type": "trigger",
"topic": "test-topic",
"type": "foo",
"subtype": "bar",
"device": {"identi... | [
"async",
"def",
"test_cleanup_trigger",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"\"automation_type\"",
":",
"\"trigger\"",
",",
"\"topic\"",
":",
"\"test-topic\"",
",",
"\"type\"",
":",
"\"foo\"",
",",
... | [
859,
0
] | [
891,
5
] | python | en | ['en', 'en', 'en'] | True |
test_cleanup_device | (hass, device_reg, entity_reg, mqtt_mock) | Test removal from device registry when trigger is removed. | Test removal from device registry when trigger is removed. | async def test_cleanup_device(hass, device_reg, entity_reg, mqtt_mock):
"""Test removal from device registry when trigger is removed."""
config = {
"automation_type": "trigger",
"topic": "test-topic",
"type": "foo",
"subtype": "bar",
"device": {"identifiers": ["helloworld... | [
"async",
"def",
"test_cleanup_device",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"\"automation_type\"",
":",
"\"trigger\"",
",",
"\"topic\"",
":",
"\"test-topic\"",
",",
"\"type\"",
":",
"\"foo\"",
",",
... | [
894,
0
] | [
920,
31
] | 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.