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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
EnvisalinkAlarm.async_alarm_disarm | (self, code=None) | Send disarm command. | Send disarm command. | async def async_alarm_disarm(self, code=None):
"""Send disarm command."""
if code:
self.hass.data[DATA_EVL].disarm_partition(str(code), self._partition_number)
else:
self.hass.data[DATA_EVL].disarm_partition(
str(self._code), self._partition_number
... | [
"async",
"def",
"async_alarm_disarm",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"if",
"code",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_EVL",
"]",
".",
"disarm_partition",
"(",
"str",
"(",
"code",
")",
",",
"self",
".",
"_partition_numbe... | [
169,
4
] | [
176,
13
] | python | en | ['en', 'pt', 'en'] | True |
EnvisalinkAlarm.async_alarm_arm_home | (self, code=None) | Send arm home command. | Send arm home command. | async def async_alarm_arm_home(self, code=None):
"""Send arm home command."""
if code:
self.hass.data[DATA_EVL].arm_stay_partition(
str(code), self._partition_number
)
else:
self.hass.data[DATA_EVL].arm_stay_partition(
str(self.... | [
"async",
"def",
"async_alarm_arm_home",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"if",
"code",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_EVL",
"]",
".",
"arm_stay_partition",
"(",
"str",
"(",
"code",
")",
",",
"self",
".",
"_partition_n... | [
178,
4
] | [
187,
13
] | python | en | ['en', 'pt', 'en'] | True |
EnvisalinkAlarm.async_alarm_arm_away | (self, code=None) | Send arm away command. | Send arm away command. | async def async_alarm_arm_away(self, code=None):
"""Send arm away command."""
if code:
self.hass.data[DATA_EVL].arm_away_partition(
str(code), self._partition_number
)
else:
self.hass.data[DATA_EVL].arm_away_partition(
str(self.... | [
"async",
"def",
"async_alarm_arm_away",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"if",
"code",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_EVL",
"]",
".",
"arm_away_partition",
"(",
"str",
"(",
"code",
")",
",",
"self",
".",
"_partition_n... | [
189,
4
] | [
198,
13
] | python | en | ['en', 'en', 'en'] | True |
EnvisalinkAlarm.async_alarm_trigger | (self, code=None) | Alarm trigger command. Will be used to trigger a panic alarm. | Alarm trigger command. Will be used to trigger a panic alarm. | async def async_alarm_trigger(self, code=None):
"""Alarm trigger command. Will be used to trigger a panic alarm."""
self.hass.data[DATA_EVL].panic_alarm(self._panic_type) | [
"async",
"def",
"async_alarm_trigger",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_EVL",
"]",
".",
"panic_alarm",
"(",
"self",
".",
"_panic_type",
")"
] | [
200,
4
] | [
202,
62
] | python | en | ['en', 'en', 'en'] | True |
EnvisalinkAlarm.async_alarm_arm_night | (self, code=None) | Send arm night command. | Send arm night command. | async def async_alarm_arm_night(self, code=None):
"""Send arm night command."""
self.hass.data[DATA_EVL].arm_night_partition(
str(code) if code else str(self._code), self._partition_number
) | [
"async",
"def",
"async_alarm_arm_night",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_EVL",
"]",
".",
"arm_night_partition",
"(",
"str",
"(",
"code",
")",
"if",
"code",
"else",
"str",
"(",
"self",
".",
... | [
204,
4
] | [
208,
9
] | python | en | ['en', 'zh', 'en'] | True |
EnvisalinkAlarm.async_alarm_keypress | (self, keypress=None) | Send custom keypress. | Send custom keypress. | def async_alarm_keypress(self, keypress=None):
"""Send custom keypress."""
if keypress:
self.hass.data[DATA_EVL].keypresses_to_partition(
self._partition_number, keypress
) | [
"def",
"async_alarm_keypress",
"(",
"self",
",",
"keypress",
"=",
"None",
")",
":",
"if",
"keypress",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_EVL",
"]",
".",
"keypresses_to_partition",
"(",
"self",
".",
"_partition_number",
",",
"keypress",
")"
] | [
211,
4
] | [
216,
13
] | python | en | ['en', 'cy', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up mFi sensors. | Set up mFi sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up mFi sensors."""
host = config.get(CONF_HOST)
username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD)
use_tls = config.get(CONF_SSL)
verify_tls = config.get(CONF_VERIFY_SSL)
default_port = 6443 if... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"host",
"=",
"config",
".",
"get",
"(",
"CONF_HOST",
")",
"username",
"=",
"config",
".",
"get",
"(",
"CONF_USERNAME",
")",
"password",
... | [
50,
0
] | [
73,
5
] | python | en | ['en', 'bg', 'en'] | True |
MfiSensor.__init__ | (self, port, hass) | Initialize the sensor. | Initialize the sensor. | def __init__(self, port, hass):
"""Initialize the sensor."""
self._port = port
self._hass = hass | [
"def",
"__init__",
"(",
"self",
",",
"port",
",",
"hass",
")",
":",
"self",
".",
"_port",
"=",
"port",
"self",
".",
"_hass",
"=",
"hass"
] | [
79,
4
] | [
82,
25
] | python | en | ['en', 'en', 'en'] | True |
MfiSensor.name | (self) | Return the name of th sensor. | Return the name of th sensor. | def name(self):
"""Return the name of th sensor."""
return self._port.label | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_port",
".",
"label"
] | [
85,
4
] | [
87,
31
] | python | en | ['en', 'mi', 'en'] | True |
MfiSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
try:
tag = self._port.tag
except ValueError:
tag = None
if tag is None:
return STATE_OFF
if self._port.model == "Input Digital":
return STATE_ON if self._port.value > 0 else STA... | [
"def",
"state",
"(",
"self",
")",
":",
"try",
":",
"tag",
"=",
"self",
".",
"_port",
".",
"tag",
"except",
"ValueError",
":",
"tag",
"=",
"None",
"if",
"tag",
"is",
"None",
":",
"return",
"STATE_OFF",
"if",
"self",
".",
"_port",
".",
"model",
"==",... | [
90,
4
] | [
101,
46
] | python | en | ['en', 'en', 'en'] | True |
MfiSensor.unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
try:
tag = self._port.tag
except ValueError:
return "State"
if tag == "temperature":
return TEMP_CELSIUS
if tag == "active_pwr":
return "Wa... | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"try",
":",
"tag",
"=",
"self",
".",
"_port",
".",
"tag",
"except",
"ValueError",
":",
"return",
"\"State\"",
"if",
"tag",
"==",
"\"temperature\"",
":",
"return",
"TEMP_CELSIUS",
"if",
"tag",
"==",
"\"ac... | [
104,
4
] | [
117,
18
] | python | en | ['en', 'en', 'en'] | True |
MfiSensor.update | (self) | Get the latest data. | Get the latest data. | def update(self):
"""Get the latest data."""
self._port.refresh() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_port",
".",
"refresh",
"(",
")"
] | [
119,
4
] | [
121,
28
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Remote Raspberry PI GPIO devices. | Set up the Remote Raspberry PI GPIO devices. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Remote Raspberry PI GPIO devices."""
address = config[CONF_HOST]
invert_logic = config[CONF_INVERT_LOGIC]
ports = config[CONF_PORTS]
devices = []
for port, name in ports.items():
try:
led = re... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"address",
"=",
"config",
"[",
"CONF_HOST",
"]",
"invert_logic",
"=",
"config",
"[",
"CONF_INVERT_LOGIC",
"]",
"ports",
"=",
"config",
"["... | [
23,
0
] | [
38,
25
] | python | en | ['en', 'en', 'en'] | True |
RemoteRPiGPIOSwitch.__init__ | (self, name, led) | Initialize the pin. | Initialize the pin. | def __init__(self, name, led):
"""Initialize the pin."""
self._name = name or DEVICE_DEFAULT_NAME
self._state = False
self._switch = led | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"led",
")",
":",
"self",
".",
"_name",
"=",
"name",
"or",
"DEVICE_DEFAULT_NAME",
"self",
".",
"_state",
"=",
"False",
"self",
".",
"_switch",
"=",
"led"
] | [
44,
4
] | [
48,
26
] | python | en | ['en', 'en', 'en'] | True |
RemoteRPiGPIOSwitch.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"
] | [
51,
4
] | [
53,
25
] | python | en | ['en', 'en', 'en'] | True |
RemoteRPiGPIOSwitch.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
56,
4
] | [
58,
20
] | python | en | ['en', 'en', 'en'] | True |
RemoteRPiGPIOSwitch.assumed_state | (self) | If unable to access real state of the entity. | If unable to access real state of the entity. | def assumed_state(self):
"""If unable to access real state of the entity."""
return True | [
"def",
"assumed_state",
"(",
"self",
")",
":",
"return",
"True"
] | [
61,
4
] | [
63,
19
] | python | en | ['en', 'en', 'en'] | True |
RemoteRPiGPIOSwitch.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"
] | [
66,
4
] | [
68,
26
] | python | en | ['en', 'fy', 'en'] | True |
RemoteRPiGPIOSwitch.turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | def turn_on(self, **kwargs):
"""Turn the device on."""
remote_rpi_gpio.write_output(self._switch, 1)
self._state = True
self.schedule_update_ha_state() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"remote_rpi_gpio",
".",
"write_output",
"(",
"self",
".",
"_switch",
",",
"1",
")",
"self",
".",
"_state",
"=",
"True",
"self",
".",
"schedule_update_ha_state",
"(",
")"
] | [
70,
4
] | [
74,
39
] | python | en | ['en', 'en', 'en'] | True |
RemoteRPiGPIOSwitch.turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | def turn_off(self, **kwargs):
"""Turn the device off."""
remote_rpi_gpio.write_output(self._switch, 0)
self._state = False
self.schedule_update_ha_state() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"remote_rpi_gpio",
".",
"write_output",
"(",
"self",
".",
"_switch",
",",
"0",
")",
"self",
".",
"_state",
"=",
"False",
"self",
".",
"schedule_update_ha_state",
"(",
")"
] | [
76,
4
] | [
80,
39
] | python | en | ['en', 'en', 'en'] | True |
attach_entity_component_collection | (
entity_component: EntityComponent,
collection: ObservableCollection,
create_entity: Callable[[dict], Entity],
) | Map a collection to an entity component. | Map a collection to an entity component. | def attach_entity_component_collection(
entity_component: EntityComponent,
collection: ObservableCollection,
create_entity: Callable[[dict], Entity],
) -> None:
"""Map a collection to an entity component."""
entities = {}
async def _collection_changed(change_type: str, item_id: str, config: dic... | [
"def",
"attach_entity_component_collection",
"(",
"entity_component",
":",
"EntityComponent",
",",
"collection",
":",
"ObservableCollection",
",",
"create_entity",
":",
"Callable",
"[",
"[",
"dict",
"]",
",",
"Entity",
"]",
",",
")",
"->",
"None",
":",
"entities",... | [
303,
0
] | [
327,
54
] | python | en | ['en', 'en', 'en'] | True |
attach_entity_registry_cleaner | (
hass: HomeAssistantType,
domain: str,
platform: str,
collection: ObservableCollection,
) | Attach a listener to clean up entity registry on collection changes. | Attach a listener to clean up entity registry on collection changes. | def attach_entity_registry_cleaner(
hass: HomeAssistantType,
domain: str,
platform: str,
collection: ObservableCollection,
) -> None:
"""Attach a listener to clean up entity registry on collection changes."""
async def _collection_changed(change_type: str, item_id: str, config: Dict) -> None:
... | [
"def",
"attach_entity_registry_cleaner",
"(",
"hass",
":",
"HomeAssistantType",
",",
"domain",
":",
"str",
",",
"platform",
":",
"str",
",",
"collection",
":",
"ObservableCollection",
",",
")",
"->",
"None",
":",
"async",
"def",
"_collection_changed",
"(",
"chan... | [
331,
0
] | [
349,
54
] | python | en | ['en', 'en', 'en'] | True |
ItemNotFound.__init__ | (self, item_id: str) | Initialize item not found error. | Initialize item not found error. | def __init__(self, item_id: str):
"""Initialize item not found error."""
super().__init__(f"Item {item_id} not found.")
self.item_id = item_id | [
"def",
"__init__",
"(",
"self",
",",
"item_id",
":",
"str",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"f\"Item {item_id} not found.\"",
")",
"self",
".",
"item_id",
"=",
"item_id"
] | [
63,
4
] | [
66,
30
] | python | en | ['en', 'la', 'en'] | True |
IDManager.__init__ | (self) | Initiate the ID manager. | Initiate the ID manager. | def __init__(self) -> None:
"""Initiate the ID manager."""
self.collections: List[Dict[str, Any]] = [] | [
"def",
"__init__",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"collections",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
"=",
"[",
"]"
] | [
72,
4
] | [
74,
51
] | python | en | ['en', 'en', 'en'] | True |
IDManager.add_collection | (self, collection: Dict[str, Any]) | Add a collection to check for ID usage. | Add a collection to check for ID usage. | def add_collection(self, collection: Dict[str, Any]) -> None:
"""Add a collection to check for ID usage."""
self.collections.append(collection) | [
"def",
"add_collection",
"(",
"self",
",",
"collection",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"self",
".",
"collections",
".",
"append",
"(",
"collection",
")"
] | [
76,
4
] | [
78,
43
] | python | en | ['en', 'en', 'en'] | True |
IDManager.has_id | (self, item_id: str) | Test if the ID exists. | Test if the ID exists. | def has_id(self, item_id: str) -> bool:
"""Test if the ID exists."""
return any(item_id in collection for collection in self.collections) | [
"def",
"has_id",
"(",
"self",
",",
"item_id",
":",
"str",
")",
"->",
"bool",
":",
"return",
"any",
"(",
"item_id",
"in",
"collection",
"for",
"collection",
"in",
"self",
".",
"collections",
")"
] | [
80,
4
] | [
82,
76
] | python | en | ['en', 'en', 'en'] | True |
IDManager.generate_id | (self, suggestion: str) | Generate an ID. | Generate an ID. | def generate_id(self, suggestion: str) -> str:
"""Generate an ID."""
base = slugify(suggestion)
proposal = base
attempt = 1
while self.has_id(proposal):
attempt += 1
proposal = f"{base}_{attempt}"
return proposal | [
"def",
"generate_id",
"(",
"self",
",",
"suggestion",
":",
"str",
")",
"->",
"str",
":",
"base",
"=",
"slugify",
"(",
"suggestion",
")",
"proposal",
"=",
"base",
"attempt",
"=",
"1",
"while",
"self",
".",
"has_id",
"(",
"proposal",
")",
":",
"attempt",... | [
84,
4
] | [
94,
23
] | python | en | ['en', 'yo', 'it'] | False |
ObservableCollection.__init__ | (self, logger: logging.Logger, id_manager: Optional[IDManager] = None) | Initialize the base collection. | Initialize the base collection. | def __init__(self, logger: logging.Logger, id_manager: Optional[IDManager] = None):
"""Initialize the base collection."""
self.logger = logger
self.id_manager = id_manager or IDManager()
self.data: Dict[str, dict] = {}
self.listeners: List[ChangeListener] = []
self.id_ma... | [
"def",
"__init__",
"(",
"self",
",",
"logger",
":",
"logging",
".",
"Logger",
",",
"id_manager",
":",
"Optional",
"[",
"IDManager",
"]",
"=",
"None",
")",
":",
"self",
".",
"logger",
"=",
"logger",
"self",
".",
"id_manager",
"=",
"id_manager",
"or",
"I... | [
100,
4
] | [
107,
49
] | python | en | ['en', 'en', 'en'] | True |
ObservableCollection.async_items | (self) | Return list of items in collection. | Return list of items in collection. | def async_items(self) -> List[dict]:
"""Return list of items in collection."""
return list(self.data.values()) | [
"def",
"async_items",
"(",
"self",
")",
"->",
"List",
"[",
"dict",
"]",
":",
"return",
"list",
"(",
"self",
".",
"data",
".",
"values",
"(",
")",
")"
] | [
110,
4
] | [
112,
39
] | python | en | ['en', 'en', 'en'] | True |
ObservableCollection.async_add_listener | (self, listener: ChangeListener) | Add a listener.
Will be called with (change_type, item_id, updated_config).
| Add a listener. | def async_add_listener(self, listener: ChangeListener) -> None:
"""Add a listener.
Will be called with (change_type, item_id, updated_config).
"""
self.listeners.append(listener) | [
"def",
"async_add_listener",
"(",
"self",
",",
"listener",
":",
"ChangeListener",
")",
"->",
"None",
":",
"self",
".",
"listeners",
".",
"append",
"(",
"listener",
")"
] | [
115,
4
] | [
120,
39
] | python | en | ['en', 'cy', 'en'] | True |
ObservableCollection.notify_changes | (self, change_sets: Iterable[CollectionChangeSet]) | Notify listeners of a change. | Notify listeners of a change. | async def notify_changes(self, change_sets: Iterable[CollectionChangeSet]) -> None:
"""Notify listeners of a change."""
await asyncio.gather(
*[
listener(change_set.change_type, change_set.item_id, change_set.item)
for listener in self.listeners
... | [
"async",
"def",
"notify_changes",
"(",
"self",
",",
"change_sets",
":",
"Iterable",
"[",
"CollectionChangeSet",
"]",
")",
"->",
"None",
":",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"listener",
"(",
"change_set",
".",
"change_type",
",",
"change_set... | [
122,
4
] | [
130,
9
] | python | en | ['en', 'en', 'en'] | True |
YamlCollection.async_load | (self, data: List[dict]) | Load the YAML collection. Overrides existing data. | Load the YAML collection. Overrides existing data. | async def async_load(self, data: List[dict]) -> None:
"""Load the YAML collection. Overrides existing data."""
old_ids = set(self.data)
change_sets = []
for item in data:
item_id = item[CONF_ID]
if item_id in old_ids:
old_ids.remove(item_id)
... | [
"async",
"def",
"async_load",
"(",
"self",
",",
"data",
":",
"List",
"[",
"dict",
"]",
")",
"->",
"None",
":",
"old_ids",
"=",
"set",
"(",
"self",
".",
"data",
")",
"change_sets",
"=",
"[",
"]",
"for",
"item",
"in",
"data",
":",
"item_id",
"=",
"... | [
136,
4
] | [
164,
50
] | python | en | ['en', 'en', 'en'] | True |
StorageCollection.__init__ | (
self,
store: Store,
logger: logging.Logger,
id_manager: Optional[IDManager] = None,
) | Initialize the storage collection. | Initialize the storage collection. | def __init__(
self,
store: Store,
logger: logging.Logger,
id_manager: Optional[IDManager] = None,
):
"""Initialize the storage collection."""
super().__init__(logger, id_manager)
self.store = store | [
"def",
"__init__",
"(",
"self",
",",
"store",
":",
"Store",
",",
"logger",
":",
"logging",
".",
"Logger",
",",
"id_manager",
":",
"Optional",
"[",
"IDManager",
"]",
"=",
"None",
",",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"logger",
",",
... | [
170,
4
] | [
178,
26
] | python | en | ['en', 'en', 'en'] | True |
StorageCollection.hass | (self) | Home Assistant object. | Home Assistant object. | def hass(self) -> HomeAssistant:
"""Home Assistant object."""
return self.store.hass | [
"def",
"hass",
"(",
"self",
")",
"->",
"HomeAssistant",
":",
"return",
"self",
".",
"store",
".",
"hass"
] | [
181,
4
] | [
183,
30
] | python | en | ['fr', 'en', 'en'] | True |
StorageCollection._async_load_data | (self) | Load the data. | Load the data. | async def _async_load_data(self) -> Optional[dict]:
"""Load the data."""
return cast(Optional[dict], await self.store.async_load()) | [
"async",
"def",
"_async_load_data",
"(",
"self",
")",
"->",
"Optional",
"[",
"dict",
"]",
":",
"return",
"cast",
"(",
"Optional",
"[",
"dict",
"]",
",",
"await",
"self",
".",
"store",
".",
"async_load",
"(",
")",
")"
] | [
185,
4
] | [
187,
66
] | python | en | ['en', 'en', 'en'] | True |
StorageCollection.async_load | (self) | Load the storage Manager. | Load the storage Manager. | async def async_load(self) -> None:
"""Load the storage Manager."""
raw_storage = await self._async_load_data()
if raw_storage is None:
raw_storage = {"items": []}
for item in raw_storage["items"]:
self.data[item[CONF_ID]] = item
await self.notify_chang... | [
"async",
"def",
"async_load",
"(",
"self",
")",
"->",
"None",
":",
"raw_storage",
"=",
"await",
"self",
".",
"_async_load_data",
"(",
")",
"if",
"raw_storage",
"is",
"None",
":",
"raw_storage",
"=",
"{",
"\"items\"",
":",
"[",
"]",
"}",
"for",
"item",
... | [
189,
4
] | [
204,
9
] | python | en | ['en', 'en', 'en'] | True |
StorageCollection._process_create_data | (self, data: dict) | Validate the config is valid. | Validate the config is valid. | async def _process_create_data(self, data: dict) -> dict:
"""Validate the config is valid.""" | [
"async",
"def",
"_process_create_data",
"(",
"self",
",",
"data",
":",
"dict",
")",
"->",
"dict",
":"
] | [
207,
4
] | [
208,
43
] | python | en | ['en', 'en', 'en'] | True |
StorageCollection._get_suggested_id | (self, info: dict) | Suggest an ID based on the config. | Suggest an ID based on the config. | def _get_suggested_id(self, info: dict) -> str:
"""Suggest an ID based on the config.""" | [
"def",
"_get_suggested_id",
"(",
"self",
",",
"info",
":",
"dict",
")",
"->",
"str",
":"
] | [
212,
4
] | [
213,
48
] | python | en | ['en', 'en', 'en'] | True |
StorageCollection._update_data | (self, data: dict, update_data: dict) | Return a new updated data object. | Return a new updated data object. | async def _update_data(self, data: dict, update_data: dict) -> dict:
"""Return a new updated data object.""" | [
"async",
"def",
"_update_data",
"(",
"self",
",",
"data",
":",
"dict",
",",
"update_data",
":",
"dict",
")",
"->",
"dict",
":"
] | [
216,
4
] | [
217,
47
] | python | en | ['en', 'en', 'en'] | True |
StorageCollection.async_create_item | (self, data: dict) | Create a new item. | Create a new item. | async def async_create_item(self, data: dict) -> dict:
"""Create a new item."""
item = await self._process_create_data(data)
item[CONF_ID] = self.id_manager.generate_id(self._get_suggested_id(item))
self.data[item[CONF_ID]] = item
self._async_schedule_save()
await self.no... | [
"async",
"def",
"async_create_item",
"(",
"self",
",",
"data",
":",
"dict",
")",
"->",
"dict",
":",
"item",
"=",
"await",
"self",
".",
"_process_create_data",
"(",
"data",
")",
"item",
"[",
"CONF_ID",
"]",
"=",
"self",
".",
"id_manager",
".",
"generate_i... | [
219,
4
] | [
228,
19
] | python | en | ['en', 'en', 'en'] | True |
StorageCollection.async_update_item | (self, item_id: str, updates: dict) | Update item. | Update item. | async def async_update_item(self, item_id: str, updates: dict) -> dict:
"""Update item."""
if item_id not in self.data:
raise ItemNotFound(item_id)
if CONF_ID in updates:
raise ValueError("Cannot update ID")
current = self.data[item_id]
updated = await ... | [
"async",
"def",
"async_update_item",
"(",
"self",
",",
"item_id",
":",
"str",
",",
"updates",
":",
"dict",
")",
"->",
"dict",
":",
"if",
"item_id",
"not",
"in",
"self",
".",
"data",
":",
"raise",
"ItemNotFound",
"(",
"item_id",
")",
"if",
"CONF_ID",
"i... | [
230,
4
] | [
249,
33
] | python | en | ['en', 'la', 'en'] | False |
StorageCollection.async_delete_item | (self, item_id: str) | Delete item. | Delete item. | async def async_delete_item(self, item_id: str) -> None:
"""Delete item."""
if item_id not in self.data:
raise ItemNotFound(item_id)
item = self.data.pop(item_id)
self._async_schedule_save()
await self.notify_changes([CollectionChangeSet(CHANGE_REMOVED, item_id, ite... | [
"async",
"def",
"async_delete_item",
"(",
"self",
",",
"item_id",
":",
"str",
")",
"->",
"None",
":",
"if",
"item_id",
"not",
"in",
"self",
".",
"data",
":",
"raise",
"ItemNotFound",
"(",
"item_id",
")",
"item",
"=",
"self",
".",
"data",
".",
"pop",
... | [
251,
4
] | [
259,
87
] | python | en | ['en', 'la', 'en'] | False |
StorageCollection._async_schedule_save | (self) | Schedule saving the area registry. | Schedule saving the area registry. | def _async_schedule_save(self) -> None:
"""Schedule saving the area registry."""
self.store.async_delay_save(self._data_to_save, SAVE_DELAY) | [
"def",
"_async_schedule_save",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"store",
".",
"async_delay_save",
"(",
"self",
".",
"_data_to_save",
",",
"SAVE_DELAY",
")"
] | [
262,
4
] | [
264,
67
] | python | en | ['en', 'nl', 'en'] | True |
StorageCollection._data_to_save | (self) | Return data of area registry to store in a file. | Return data of area registry to store in a file. | def _data_to_save(self) -> dict:
"""Return data of area registry to store in a file."""
return {"items": list(self.data.values())} | [
"def",
"_data_to_save",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"\"items\"",
":",
"list",
"(",
"self",
".",
"data",
".",
"values",
"(",
")",
")",
"}"
] | [
267,
4
] | [
269,
50
] | python | en | ['en', 'en', 'en'] | True |
IDLessCollection.async_load | (self, data: List[dict]) | Load the collection. Overrides existing data. | Load the collection. Overrides existing data. | async def async_load(self, data: List[dict]) -> None:
"""Load the collection. Overrides existing data."""
await self.notify_changes(
[
CollectionChangeSet(CHANGE_REMOVED, item_id, item)
for item_id, item in list(self.data.items())
]
)
... | [
"async",
"def",
"async_load",
"(",
"self",
",",
"data",
":",
"List",
"[",
"dict",
"]",
")",
"->",
"None",
":",
"await",
"self",
".",
"notify_changes",
"(",
"[",
"CollectionChangeSet",
"(",
"CHANGE_REMOVED",
",",
"item_id",
",",
"item",
")",
"for",
"item_... | [
277,
4
] | [
299,
9
] | python | en | ['en', 'en', 'en'] | True |
StorageCollectionWebsocket.__init__ | (
self,
storage_collection: StorageCollection,
api_prefix: str,
model_name: str,
create_schema: dict,
update_schema: dict,
) | Initialize a websocket CRUD. | Initialize a websocket CRUD. | def __init__(
self,
storage_collection: StorageCollection,
api_prefix: str,
model_name: str,
create_schema: dict,
update_schema: dict,
):
"""Initialize a websocket CRUD."""
self.storage_collection = storage_collection
self.api_prefix = api_pref... | [
"def",
"__init__",
"(",
"self",
",",
"storage_collection",
":",
"StorageCollection",
",",
"api_prefix",
":",
"str",
",",
"model_name",
":",
"str",
",",
"create_schema",
":",
"dict",
",",
"update_schema",
":",
"dict",
",",
")",
":",
"self",
".",
"storage_coll... | [
355,
4
] | [
370,
75
] | python | en | ['en', 'fy', 'it'] | False |
StorageCollectionWebsocket.item_id_key | (self) | Return item ID key. | Return item ID key. | def item_id_key(self) -> str:
"""Return item ID key."""
return f"{self.model_name}_id" | [
"def",
"item_id_key",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{self.model_name}_id\""
] | [
373,
4
] | [
375,
38
] | python | en | ['en', 'mt', 'en'] | True |
StorageCollectionWebsocket.async_setup | (
self,
hass: HomeAssistant,
*,
create_list: bool = True,
create_create: bool = True,
) | Set up the websocket commands. | Set up the websocket commands. | def async_setup(
self,
hass: HomeAssistant,
*,
create_list: bool = True,
create_create: bool = True,
) -> None:
"""Set up the websocket commands."""
if create_list:
websocket_api.async_register_command(
hass,
f"{self... | [
"def",
"async_setup",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"*",
",",
"create_list",
":",
"bool",
"=",
"True",
",",
"create_create",
":",
"bool",
"=",
"True",
",",
")",
"->",
"None",
":",
"if",
"create_list",
":",
"websocket_api",
".",
"... | [
378,
4
] | [
438,
9
] | python | en | ['en', 'da', 'en'] | True |
StorageCollectionWebsocket.ws_list_item | (
self, hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
) | List items. | List items. | def ws_list_item(
self, hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
) -> None:
"""List items."""
connection.send_result(msg["id"], self.storage_collection.async_items()) | [
"def",
"ws_list_item",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"websocket_api",
".",
"ActiveConnection",
",",
"msg",
":",
"dict",
")",
"->",
"None",
":",
"connection",
".",
"send_result",
"(",
"msg",
"[",
"\"id\"",
"]",
",",... | [
440,
4
] | [
444,
80
] | python | en | ['en', 'ga', 'en'] | False |
StorageCollectionWebsocket.ws_create_item | (
self, hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
) | Create a item. | Create a item. | async def ws_create_item(
self, hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
) -> None:
"""Create a item."""
try:
data = dict(msg)
data.pop("id")
data.pop("type")
item = await self.storage_collection.async_create_i... | [
"async",
"def",
"ws_create_item",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"websocket_api",
".",
"ActiveConnection",
",",
"msg",
":",
"dict",
")",
"->",
"None",
":",
"try",
":",
"data",
"=",
"dict",
"(",
"msg",
")",
"data",... | [
446,
4
] | [
465,
13
] | python | en | ['en', 'co', 'en'] | True |
StorageCollectionWebsocket.ws_update_item | (
self, hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
) | Update a item. | Update a item. | async def ws_update_item(
self, hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
) -> None:
"""Update a item."""
data = dict(msg)
msg_id = data.pop("id")
item_id = data.pop(self.item_id_key)
data.pop("type")
try:
item = a... | [
"async",
"def",
"ws_update_item",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"websocket_api",
".",
"ActiveConnection",
",",
"msg",
":",
"dict",
")",
"->",
"None",
":",
"data",
"=",
"dict",
"(",
"msg",
")",
"msg_id",
"=",
"dat... | [
467,
4
] | [
494,
13
] | python | en | ['en', 'co', 'en'] | True |
StorageCollectionWebsocket.ws_delete_item | (
self, hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
) | Delete a item. | Delete a item. | async def ws_delete_item(
self, hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict
) -> None:
"""Delete a item."""
try:
await self.storage_collection.async_delete_item(msg[self.item_id_key])
except ItemNotFound:
connection.send_error(
... | [
"async",
"def",
"ws_delete_item",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"websocket_api",
".",
"ActiveConnection",
",",
"msg",
":",
"dict",
")",
"->",
"None",
":",
"try",
":",
"await",
"self",
".",
"storage_collection",
".",
... | [
496,
4
] | [
509,
41
] | python | en | ['en', 'ca', 'en'] | True |
convert_parquet_to_iceberg | (parquet_file: ParquetFile) |
Given two Iceberg schema's returns a list of column_names for all id's in the
file schema that are projected in the expected schema
Parameters
----------
parquet_file : pyarrow.parquet.ParquetFile
The Parquet File to use to extract the iceberg schema
Returns
-------
iceberg.ap... |
Given two Iceberg schema's returns a list of column_names for all id's in the
file schema that are projected in the expected schema | def convert_parquet_to_iceberg(parquet_file: ParquetFile) -> Schema: # noqa: ignore=C901
"""
Given two Iceberg schema's returns a list of column_names for all id's in the
file schema that are projected in the expected schema
Parameters
----------
parquet_file : pyarrow.parquet.ParquetFile
... | [
"def",
"convert_parquet_to_iceberg",
"(",
"parquet_file",
":",
"ParquetFile",
")",
"->",
"Schema",
":",
"# noqa: ignore=C901",
"return",
"arrow_to_iceberg",
"(",
"parquet_file",
".",
"schema_arrow",
")"
] | [
119,
0
] | [
134,
54
] | python | en | ['en', 'error', 'th'] | False |
arrow_to_iceberg | (arrow_schema: pa.Schema) |
Use an arrow schema, which contains the field_id metadata, to create an equivalent iceberg Schema
Parameters
----------
arrow_schema : pyarrow.Schema
An Arrow schema with the parquet field_id metadata
Returns
-------
iceberg.api.Schema
returns an equivalent iceberg Schema ... |
Use an arrow schema, which contains the field_id metadata, to create an equivalent iceberg Schema | def arrow_to_iceberg(arrow_schema: pa.Schema) -> Schema:
"""
Use an arrow schema, which contains the field_id metadata, to create an equivalent iceberg Schema
Parameters
----------
arrow_schema : pyarrow.Schema
An Arrow schema with the parquet field_id metadata
Returns
-------
... | [
"def",
"arrow_to_iceberg",
"(",
"arrow_schema",
":",
"pa",
".",
"Schema",
")",
"->",
"Schema",
":",
"return",
"Schema",
"(",
"[",
"get_field",
"(",
"col",
")",
"for",
"col",
"in",
"arrow_schema",
"]",
")"
] | [
137,
0
] | [
151,
59
] | python | en | ['en', 'error', 'th'] | False |
validate_input | (hass: core.HomeAssistant, data) | Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
| Validate the user input allows us to connect. | async def validate_input(hass: core.HomeAssistant, data):
"""Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
"""
client_session = aiohttp_client.async_get_clientsession(hass)
try:
await AsyncGriddy(
client_sessi... | [
"async",
"def",
"validate_input",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"data",
")",
":",
"client_session",
"=",
"aiohttp_client",
".",
"async_get_clientsession",
"(",
"hass",
")",
"try",
":",
"await",
"AsyncGriddy",
"(",
"client_session",
",",
... | [
19,
0
] | [
34,
56
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_user | (self, user_input=None) | Handle the initial step. | Handle the initial step. | async def async_step_user(self, user_input=None):
"""Handle the initial step."""
errors = {}
info = None
if user_input is not None:
try:
info = await validate_input(self.hass, user_input)
except CannotConnect:
errors["base"] = "cann... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"info",
"=",
"None",
"if",
"user_input",
"is",
"not",
"None",
":",
"try",
":",
"info",
"=",
"await",
"validate_input",
"(",
"self",
".",
... | [
43,
4
] | [
63,
9
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_import | (self, user_input) | Handle import. | Handle import. | async def async_step_import(self, user_input):
"""Handle import."""
await self.async_set_unique_id(user_input[CONF_LOADZONE])
self._abort_if_unique_id_configured()
return await self.async_step_user(user_input) | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"user_input",
")",
":",
"await",
"self",
".",
"async_set_unique_id",
"(",
"user_input",
"[",
"CONF_LOADZONE",
"]",
")",
"self",
".",
"_abort_if_unique_id_configured",
"(",
")",
"return",
"await",
"self",
"."... | [
65,
4
] | [
70,
53
] | python | en | ['en', 'ja', 'en'] | False |
_update_device | (hass, config_entry, config) | Update device registry. | Update device registry. | async def _update_device(hass, config_entry, config):
"""Update device registry."""
device_registry = await hass.helpers.device_registry.async_get_registry()
config_entry_id = config_entry.entry_id
device_info = mqtt.device_info_from_config(config[CONF_DEVICE])
if config_entry_id is not None and de... | [
"async",
"def",
"_update_device",
"(",
"hass",
",",
"config_entry",
",",
"config",
")",
":",
"device_registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"device_registry",
".",
"async_get_registry",
"(",
")",
"config_entry_id",
"=",
"config_entry",
".",
"entry... | [
167,
0
] | [
175,
58
] | python | en | ['fr', 'fy', 'en'] | False |
async_setup_trigger | (hass, config, config_entry, discovery_data) | Set up the MQTT device trigger. | Set up the MQTT device trigger. | async def async_setup_trigger(hass, config, config_entry, discovery_data):
"""Set up the MQTT device trigger."""
config = TRIGGER_DISCOVERY_SCHEMA(config)
discovery_hash = discovery_data[ATTR_DISCOVERY_HASH]
discovery_id = discovery_hash[1]
remove_signal = None
async def discovery_update(payloa... | [
"async",
"def",
"async_setup_trigger",
"(",
"hass",
",",
"config",
",",
"config_entry",
",",
"discovery_data",
")",
":",
"config",
"=",
"TRIGGER_DISCOVERY_SCHEMA",
"(",
"config",
")",
"discovery_hash",
"=",
"discovery_data",
"[",
"ATTR_DISCOVERY_HASH",
"]",
"discove... | [
178,
0
] | [
244,
5
] | python | en | ['en', 'en', 'en'] | True |
async_device_removed | (hass: HomeAssistant, device_id: str) | Handle the removal of a device. | Handle the removal of a device. | async def async_device_removed(hass: HomeAssistant, device_id: str):
"""Handle the removal of a device."""
triggers = await async_get_triggers(hass, device_id)
for trig in triggers:
device_trigger = hass.data[DEVICE_TRIGGERS].pop(trig[CONF_DISCOVERY_ID])
if device_trigger:
discov... | [
"async",
"def",
"async_device_removed",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
":",
"triggers",
"=",
"await",
"async_get_triggers",
"(",
"hass",
",",
"device_id",
")",
"for",
"trig",
"in",
"triggers",
":",
"device_trigger",
"=",
... | [
247,
0
] | [
265,
13
] | python | en | ['en', 'en', 'en'] | True |
async_get_triggers | (hass: HomeAssistant, device_id: str) | List device triggers for MQTT devices. | List device triggers for MQTT devices. | async def async_get_triggers(hass: HomeAssistant, device_id: str) -> List[dict]:
"""List device triggers for MQTT devices."""
triggers = []
if DEVICE_TRIGGERS not in hass.data:
return triggers
for discovery_id, trig in hass.data[DEVICE_TRIGGERS].items():
if trig.device_id != device_id ... | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"List",
"[",
"dict",
"]",
":",
"triggers",
"=",
"[",
"]",
"if",
"DEVICE_TRIGGERS",
"not",
"in",
"hass",
".",
"data",
":",
"return",
"trigger... | [
268,
0
] | [
288,
19
] | python | en | ['da', 'en', 'en'] | True |
async_attach_trigger | (
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: dict,
) | Attach a trigger. | Attach a trigger. | async def async_attach_trigger(
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: dict,
) -> CALLBACK_TYPE:
"""Attach a trigger."""
if DEVICE_TRIGGERS not in hass.data:
hass.data[DEVICE_TRIGGERS] = {}
config = TRIGGER_SCHEMA(config)
device_id... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"action",
":",
"AutomationActionType",
",",
"automation_info",
":",
"dict",
",",
")",
"->",
"CALLBACK_TYPE",
":",
"if",
"DEVICE_TRIGGERS",
"not",
"i... | [
291,
0
] | [
318,
5
] | python | en | ['en', 'lb', 'en'] | True |
test_setup_fails | (hass, mqtt_mock) | Test that setup fails with missing required configuration items. | Test that setup fails with missing required configuration items. | async def test_setup_fails(hass, mqtt_mock):
"""Test that setup fails with missing required configuration items."""
with assert_setup_component(0, light.DOMAIN):
assert await async_setup_component(
hass,
light.DOMAIN,
{light.DOMAIN: {"platform": "mqtt", "schema": "tem... | [
"async",
"def",
"test_setup_fails",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"light",
".",
"DOMAIN",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"light",
".",
"DOMAIN",
",",
"{",
... | [
80,
0
] | [
139,
48
] | python | en | ['en', 'en', 'en'] | True |
test_state_change_via_topic | (hass, mqtt_mock) | Test state change via topic. | Test state change via topic. | async def test_state_change_via_topic(hass, mqtt_mock):
"""Test state change via topic."""
with assert_setup_component(1, light.DOMAIN):
assert await async_setup_component(
hass,
light.DOMAIN,
{
light.DOMAIN: {
"platform": "mqtt",
... | [
"async",
"def",
"test_state_change_via_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"light",
".",
"DOMAIN",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"light",
".",
"DOMAIN",
","... | [
142,
0
] | [
184,
54
] | python | en | ['en', 'en', 'en'] | True |
test_state_brightness_color_effect_temp_white_change_via_topic | (
hass, mqtt_mock
) | Test state, bri, color, effect, color temp, white val change. | Test state, bri, color, effect, color temp, white val change. | async def test_state_brightness_color_effect_temp_white_change_via_topic(
hass, mqtt_mock
):
"""Test state, bri, color, effect, color temp, white val change."""
with assert_setup_component(1, light.DOMAIN):
assert await async_setup_component(
hass,
light.DOMAIN,
{... | [
"async",
"def",
"test_state_brightness_color_effect_temp_white_change_via_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"light",
".",
"DOMAIN",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
... | [
187,
0
] | [
279,
60
] | python | en | ['en', 'en', 'en'] | True |
test_sending_mqtt_commands_and_optimistic | (hass, mqtt_mock) | Test the sending of command in optimistic mode. | Test the sending of command in optimistic mode. | async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
"""Test the sending of command in optimistic mode."""
fake_state = ha.State(
"light.test",
"on",
{
"brightness": 95,
"hs_color": [100, 100],
"effect": "random",
"color_te... | [
"async",
"def",
"test_sending_mqtt_commands_and_optimistic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"fake_state",
"=",
"ha",
".",
"State",
"(",
"\"light.test\"",
",",
"\"on\"",
",",
"{",
"\"brightness\"",
":",
"95",
",",
"\"hs_color\"",
":",
"[",
"100",
",",... | [
282,
0
] | [
432,
61
] | python | en | ['en', 'en', 'en'] | True |
test_sending_mqtt_commands_non_optimistic_brightness_template | (
hass, mqtt_mock
) | Test the sending of command in optimistic mode. | Test the sending of command in optimistic mode. | async def test_sending_mqtt_commands_non_optimistic_brightness_template(
hass, mqtt_mock
):
"""Test the sending of command in optimistic mode."""
with assert_setup_component(1, light.DOMAIN):
assert await async_setup_component(
hass,
light.DOMAIN,
{
... | [
"async",
"def",
"test_sending_mqtt_commands_non_optimistic_brightness_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"light",
".",
"DOMAIN",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
... | [
435,
0
] | [
562,
41
] | python | en | ['en', 'en', 'en'] | True |
test_effect | (hass, mqtt_mock) | Test effect sent over MQTT in optimistic mode. | Test effect sent over MQTT in optimistic mode. | async def test_effect(hass, mqtt_mock):
"""Test effect sent over MQTT in optimistic mode."""
with assert_setup_component(1, light.DOMAIN):
assert await async_setup_component(
hass,
light.DOMAIN,
{
light.DOMAIN: {
"platform": "mqtt",... | [
"async",
"def",
"test_effect",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"light",
".",
"DOMAIN",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"light",
".",
"DOMAIN",
",",
"{",
"ligh... | [
565,
0
] | [
614,
56
] | python | en | ['en', 'no', 'en'] | True |
test_flash | (hass, mqtt_mock) | Test flash sent over MQTT in optimistic mode. | Test flash sent over MQTT in optimistic mode. | async def test_flash(hass, mqtt_mock):
"""Test flash sent over MQTT in optimistic mode."""
with assert_setup_component(1, light.DOMAIN):
assert await async_setup_component(
hass,
light.DOMAIN,
{
light.DOMAIN: {
"platform": "mqtt",
... | [
"async",
"def",
"test_flash",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"light",
".",
"DOMAIN",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"light",
".",
"DOMAIN",
",",
"{",
"light... | [
617,
0
] | [
662,
34
] | python | en | ['en', 'la', 'nl'] | False |
test_transition | (hass, mqtt_mock) | Test for transition time being sent when included. | Test for transition time being sent when included. | async def test_transition(hass, mqtt_mock):
"""Test for transition time being sent when included."""
with assert_setup_component(1, light.DOMAIN):
assert await async_setup_component(
hass,
light.DOMAIN,
{
light.DOMAIN: {
"platform":... | [
"async",
"def",
"test_transition",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"light",
".",
"DOMAIN",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"light",
".",
"DOMAIN",
",",
"{",
"... | [
665,
0
] | [
703,
35
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_values | (hass, mqtt_mock) | Test that invalid values are ignored. | Test that invalid values are ignored. | async def test_invalid_values(hass, mqtt_mock):
"""Test that invalid values are ignored."""
with assert_setup_component(1, light.DOMAIN):
assert await async_setup_component(
hass,
light.DOMAIN,
{
light.DOMAIN: {
"platform": "mqtt",
... | [
"async",
"def",
"test_invalid_values",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"light",
".",
"DOMAIN",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"light",
".",
"DOMAIN",
",",
"{",... | [
706,
0
] | [
803,
54
] | python | en | ['en', 'en', 'en'] | True |
test_availability_when_connection_lost | (hass, mqtt_mock) | Test availability after MQTT disconnection. | Test availability after MQTT disconnection. | async def test_availability_when_connection_lost(hass, mqtt_mock):
"""Test availability after MQTT disconnection."""
await help_test_availability_when_connection_lost(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
806,
0
] | [
810,
5
] | python | en | ['en', 'en', 'en'] | True |
test_availability_without_topic | (hass, mqtt_mock) | Test availability without defined availability topic. | Test availability without defined availability topic. | async def test_availability_without_topic(hass, mqtt_mock):
"""Test availability without defined availability topic."""
await help_test_availability_without_topic(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
813,
0
] | [
817,
5
] | python | en | ['en', 'en', 'en'] | True |
test_default_availability_payload | (hass, mqtt_mock) | Test availability by default payload with defined topic. | Test availability by default payload with defined topic. | async def test_default_availability_payload(hass, mqtt_mock):
"""Test availability by default payload with defined topic."""
await help_test_default_availability_payload(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
820,
0
] | [
824,
5
] | python | en | ['en', 'en', 'en'] | True |
test_custom_availability_payload | (hass, mqtt_mock) | Test availability by custom payload with defined topic. | Test availability by custom payload with defined topic. | async def test_custom_availability_payload(hass, mqtt_mock):
"""Test availability by custom payload with defined topic."""
await help_test_custom_availability_payload(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
827,
0
] | [
831,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_via_mqtt_json_message | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_via_mqtt_json_message(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
834,
0
] | [
838,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_with_template | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_with_template(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_with_template(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
841,
0
] | [
845,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_not_dict | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_not_dict(
hass, mqtt_mock, caplog, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")... | [
848,
0
] | [
852,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_bad_JSON | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_bad_JSON(
hass, mqtt_mock, caplog, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")... | [
855,
0
] | [
859,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_attr | (hass, mqtt_mock, caplog) | Test update of discovered MQTTAttributes. | Test update of discovered MQTTAttributes. | async def test_discovery_update_attr(hass, mqtt_mock, caplog):
"""Test update of discovered MQTTAttributes."""
await help_test_discovery_update_attr(
hass, mqtt_mock, caplog, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
862,
0
] | [
866,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unique_id | (hass, mqtt_mock) | Test unique id option only creates one light per unique_id. | Test unique id option only creates one light per unique_id. | async def test_unique_id(hass, mqtt_mock):
"""Test unique id option only creates one light per unique_id."""
config = {
light.DOMAIN: [
{
"platform": "mqtt",
"name": "Test 1",
"schema": "template",
"state_topic": "test-topic",
... | [
"async",
"def",
"test_unique_id",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"Test 1\"",
",",
"\"schema\"",
":",
"\"template\"",
",",
"\"state... | [
869,
0
] | [
893,
68
] | python | en | ['en', 'fr', 'en'] | True |
test_discovery_removal | (hass, mqtt_mock, caplog) | Test removal of discovered mqtt_json lights. | Test removal of discovered mqtt_json lights. | async def test_discovery_removal(hass, mqtt_mock, caplog):
"""Test removal of discovered mqtt_json lights."""
data = (
'{ "name": "test",'
' "schema": "template",'
' "command_topic": "test_topic",'
' "command_on_template": "on",'
' "command_off_template": "off"}'
... | [
"async",
"def",
"test_discovery_removal",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data",
"=",
"(",
"'{ \"name\": \"test\",'",
"' \"schema\": \"template\",'",
"' \"command_topic\": \"test_topic\",'",
"' \"command_on_template\": \"on\",'",
"' \"command_off_temp... | [
896,
0
] | [
905,
82
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_light | (hass, mqtt_mock, caplog) | Test update of discovered light. | Test update of discovered light. | async def test_discovery_update_light(hass, mqtt_mock, caplog):
"""Test update of discovered light."""
data1 = (
'{ "name": "Beer",'
' "schema": "template",'
' "state_topic": "test_topic",'
' "command_topic": "test_topic",'
' "command_on_template": "on",'
' "... | [
"async",
"def",
"test_discovery_update_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"(",
"'{ \"name\": \"Beer\",'",
"' \"schema\": \"template\",'",
"' \"state_topic\": \"test_topic\",'",
"' \"command_topic\": \"test_topic\",'",
"' \"command_on... | [
908,
0
] | [
928,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_unchanged_light | (hass, mqtt_mock, caplog) | Test update of discovered light. | Test update of discovered light. | async def test_discovery_update_unchanged_light(hass, mqtt_mock, caplog):
"""Test update of discovered light."""
data1 = (
'{ "name": "Beer",'
' "schema": "template",'
' "state_topic": "test_topic",'
' "command_topic": "test_topic",'
' "command_on_template": "on",'
... | [
"async",
"def",
"test_discovery_update_unchanged_light",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"(",
"'{ \"name\": \"Beer\",'",
"' \"schema\": \"template\",'",
"' \"state_topic\": \"test_topic\",'",
"' \"command_topic\": \"test_topic\",'",
"' \"... | [
931,
0
] | [
946,
9
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_broken | (hass, mqtt_mock, caplog) | Test handling of bad discovery message. | Test handling of bad discovery message. | async def test_discovery_broken(hass, mqtt_mock, caplog):
"""Test handling of bad discovery message."""
data1 = '{ "name": "Beer" }'
data2 = (
'{ "name": "Milk",'
' "schema": "template",'
' "state_topic": "test_topic",'
' "command_topic": "test_topic",'
' "command... | [
"async",
"def",
"test_discovery_broken",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\" }'",
"data2",
"=",
"(",
"'{ \"name\": \"Milk\",'",
"' \"schema\": \"template\",'",
"' \"state_topic\": \"test_topic\",'",
"' \"command_topi... | [
950,
0
] | [
963,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_connection | (hass, mqtt_mock) | Test MQTT light device registry integration. | Test MQTT light device registry integration. | async def test_entity_device_info_with_connection(hass, mqtt_mock):
"""Test MQTT light device registry integration."""
await help_test_entity_device_info_with_connection(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
966,
0
] | [
970,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_with_identifier | (hass, mqtt_mock) | Test MQTT light device registry integration. | Test MQTT light device registry integration. | async def test_entity_device_info_with_identifier(hass, mqtt_mock):
"""Test MQTT light device registry integration."""
await help_test_entity_device_info_with_identifier(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
973,
0
] | [
977,
5
] | 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."""
await help_test_entity_device_info_update(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
980,
0
] | [
984,
5
] | python | en | ['fr', 'fy', 'en'] | False |
test_entity_device_info_remove | (hass, mqtt_mock) | Test device registry remove. | Test device registry remove. | async def test_entity_device_info_remove(hass, mqtt_mock):
"""Test device registry remove."""
await help_test_entity_device_info_remove(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
987,
0
] | [
991,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_entity_id_update_subscriptions | (hass, mqtt_mock) | Test MQTT subscriptions are managed when entity_id is updated. | Test MQTT subscriptions are managed when entity_id is updated. | async def test_entity_id_update_subscriptions(hass, mqtt_mock):
"""Test MQTT subscriptions are managed when entity_id is updated."""
await help_test_entity_id_update_subscriptions(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
994,
0
] | [
998,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_id_update_discovery_update | (hass, mqtt_mock) | Test MQTT discovery update when entity_id is updated. | Test MQTT discovery update when entity_id is updated. | async def test_entity_id_update_discovery_update(hass, mqtt_mock):
"""Test MQTT discovery update when entity_id is updated."""
await help_test_entity_id_update_discovery_update(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"light",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1001,
0
] | [
1005,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_debug_info_message | (hass, mqtt_mock) | Test MQTT debug info. | Test MQTT debug info. | async def test_entity_debug_info_message(hass, mqtt_mock):
"""Test MQTT debug info."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"schema": "template",
"name": "test",
"command_topic": "test-topic",
"command_on_template": "on,{{ transition ... | [
"async",
"def",
"test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"schema\"",
":",
"\"template\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"... | [
1008,
0
] | [
1021,
84
] | python | es | ['es', 'mt', 'it'] | False |
test_max_mireds | (hass, mqtt_mock) | Test setting min_mireds and max_mireds. | Test setting min_mireds and max_mireds. | async def test_max_mireds(hass, mqtt_mock):
"""Test setting min_mireds and max_mireds."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"schema": "template",
"name": "test",
"command_topic": "test_max_mireds/set",
"command_on_template": "on",
... | [
"async",
"def",
"test_max_mireds",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"light",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"schema\"",
":",
"\"template\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"command_topic... | [
1024,
0
] | [
1044,
52
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up Homekit sensors. | Set up Homekit sensors. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Homekit sensors."""
hkid = config_entry.data["AccessoryPairingID"]
conn = hass.data[KNOWN_DEVICES][hkid]
@callback
def async_add_service(service):
entity_class = ENTITY_TYPES.get(service.short_type)
if no... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"hkid",
"=",
"config_entry",
".",
"data",
"[",
"\"AccessoryPairingID\"",
"]",
"conn",
"=",
"hass",
".",
"data",
"[",
"KNOWN_DEVICES",
"]",
"[",
"hkid",
... | [
227,
0
] | [
241,
40
] | python | en | ['en', 'bg', 'en'] | True |
HomeKitHumiditySensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"RELATIVE_HUMIDITY_CURRENT",
"]"
] | [
27,
4
] | [
29,
63
] | python | en | ['en', 'en', 'en'] | True |
HomeKitHumiditySensor.device_class | (self) | Return the device class of the sensor. | Return the device class of the sensor. | def device_class(self) -> str:
"""Return the device class of the sensor."""
return DEVICE_CLASS_HUMIDITY | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_HUMIDITY"
] | [
32,
4
] | [
34,
36
] | python | en | ['en', 'en', 'en'] | True |
HomeKitHumiditySensor.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return f"{super().name} Humidity" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{super().name} Humidity\""
] | [
37,
4
] | [
39,
41
] | python | en | ['en', 'en', 'en'] | True |
HomeKitHumiditySensor.icon | (self) | Return the sensor icon. | Return the sensor icon. | def icon(self):
"""Return the sensor icon."""
return HUMIDITY_ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"HUMIDITY_ICON"
] | [
42,
4
] | [
44,
28
] | python | en | ['en', 'fa', 'en'] | True |
HomeKitHumiditySensor.unit_of_measurement | (self) | Return units for the sensor. | Return units for the sensor. | def unit_of_measurement(self):
"""Return units for the sensor."""
return PERCENTAGE | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"PERCENTAGE"
] | [
47,
4
] | [
49,
25
] | python | en | ['en', 'sq', 'en'] | True |
HomeKitHumiditySensor.state | (self) | Return the current humidity. | Return the current humidity. | def state(self):
"""Return the current humidity."""
return self.service.value(CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT) | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"RELATIVE_HUMIDITY_CURRENT",
")"
] | [
52,
4
] | [
54,
81
] | 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.