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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
find_existing_host | (hass, serial) | Return a set of the configured hosts. | Return a set of the configured hosts. | def find_existing_host(hass, serial):
"""Return a set of the configured hosts."""
for entry in hass.config_entries.async_entries(DOMAIN):
if entry.data.get("AccessoryPairingID") == serial:
return entry | [
"def",
"find_existing_host",
"(",
"hass",
",",
"serial",
")",
":",
"for",
"entry",
"in",
"hass",
".",
"config_entries",
".",
"async_entries",
"(",
"DOMAIN",
")",
":",
"if",
"entry",
".",
"data",
".",
"get",
"(",
"\"AccessoryPairingID\"",
")",
"==",
"serial... | [
62,
0
] | [
66,
24
] | python | en | ['en', 'en', 'en'] | True |
ensure_pin_format | (pin, allow_insecure_setup_codes=None) |
Ensure a pin code is correctly formatted.
Ensures a pin code is in the format 111-11-111. Handles codes with and without dashes.
If incorrect code is entered, an exception is raised.
|
Ensure a pin code is correctly formatted. | def ensure_pin_format(pin, allow_insecure_setup_codes=None):
"""
Ensure a pin code is correctly formatted.
Ensures a pin code is in the format 111-11-111. Handles codes with and without dashes.
If incorrect code is entered, an exception is raised.
"""
match = PIN_FORMAT.search(pin.strip())
... | [
"def",
"ensure_pin_format",
"(",
"pin",
",",
"allow_insecure_setup_codes",
"=",
"None",
")",
":",
"match",
"=",
"PIN_FORMAT",
".",
"search",
"(",
"pin",
".",
"strip",
"(",
")",
")",
"if",
"not",
"match",
":",
"raise",
"aiohomekit",
".",
"exceptions",
".",
... | [
69,
0
] | [
83,
35
] | python | en | ['en', 'error', 'th'] | False |
HomekitControllerFlowHandler.__init__ | (self) | Initialize the homekit_controller flow. | Initialize the homekit_controller flow. | def __init__(self):
"""Initialize the homekit_controller flow."""
self.model = None
self.hkid = None
self.name = None
self.devices = {}
self.controller = None
self.finish_pairing = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"model",
"=",
"None",
"self",
".",
"hkid",
"=",
"None",
"self",
".",
"name",
"=",
"None",
"self",
".",
"devices",
"=",
"{",
"}",
"self",
".",
"controller",
"=",
"None",
"self",
".",
"finish_pai... | [
91,
4
] | [
98,
34
] | python | en | ['en', 'en', 'en'] | True |
HomekitControllerFlowHandler._async_setup_controller | (self) | Create the controller. | Create the controller. | async def _async_setup_controller(self):
"""Create the controller."""
async_zeroconf_instance = await zeroconf.async_get_async_instance(self.hass)
self.controller = aiohomekit.Controller(
async_zeroconf_instance=async_zeroconf_instance
) | [
"async",
"def",
"_async_setup_controller",
"(",
"self",
")",
":",
"async_zeroconf_instance",
"=",
"await",
"zeroconf",
".",
"async_get_async_instance",
"(",
"self",
".",
"hass",
")",
"self",
".",
"controller",
"=",
"aiohomekit",
".",
"Controller",
"(",
"async_zero... | [
100,
4
] | [
105,
9
] | python | en | ['en', 'en', 'en'] | True |
HomekitControllerFlowHandler.async_step_user | (self, user_input=None) | Handle a flow start. | Handle a flow start. | async def async_step_user(self, user_input=None):
"""Handle a flow start."""
errors = {}
if user_input is not None:
key = user_input["device"]
self.hkid = self.devices[key].device_id
self.model = self.devices[key].info["md"]
self.name = key[: -len... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"key",
"=",
"user_input",
"[",
"\"device\"",
"]",
"self",
".",
"hkid",
"=",
"self",
".",
... | [
107,
4
] | [
144,
9
] | python | en | ['en', 'lb', 'en'] | True |
HomekitControllerFlowHandler.async_step_unignore | (self, user_input) | Rediscover a previously ignored discover. | Rediscover a previously ignored discover. | async def async_step_unignore(self, user_input):
"""Rediscover a previously ignored discover."""
unique_id = user_input["unique_id"]
await self.async_set_unique_id(unique_id)
if self.controller is None:
await self._async_setup_controller()
devices = await self.contr... | [
"async",
"def",
"async_step_unignore",
"(",
"self",
",",
"user_input",
")",
":",
"unique_id",
"=",
"user_input",
"[",
"\"unique_id\"",
"]",
"await",
"self",
".",
"async_set_unique_id",
"(",
"unique_id",
")",
"if",
"self",
".",
"controller",
"is",
"None",
":",
... | [
146,
4
] | [
180,
52
] | python | en | ['en', 'en', 'en'] | True |
HomekitControllerFlowHandler._hkid_is_homekit | (self, hkid) | Determine if the device is a homekit bridge or accessory. | Determine if the device is a homekit bridge or accessory. | async def _hkid_is_homekit(self, hkid):
"""Determine if the device is a homekit bridge or accessory."""
dev_reg = await async_get_device_registry(self.hass)
device = dev_reg.async_get_device(
identifiers=set(), connections={(CONNECTION_NETWORK_MAC, hkid)}
)
if device... | [
"async",
"def",
"_hkid_is_homekit",
"(",
"self",
",",
"hkid",
")",
":",
"dev_reg",
"=",
"await",
"async_get_device_registry",
"(",
"self",
".",
"hass",
")",
"device",
"=",
"dev_reg",
".",
"async_get_device",
"(",
"identifiers",
"=",
"set",
"(",
")",
",",
"... | [
182,
4
] | [
197,
20
] | python | en | ['en', 'en', 'en'] | True |
HomekitControllerFlowHandler.async_step_zeroconf | (self, discovery_info) | Handle a discovered HomeKit accessory.
This flow is triggered by the discovery component.
| Handle a discovered HomeKit accessory. | async def async_step_zeroconf(self, discovery_info):
"""Handle a discovered HomeKit accessory.
This flow is triggered by the discovery component.
"""
# Normalize properties from discovery
# homekit_python has code to do this, but not in a form we can
# easily use, so do ... | [
"async",
"def",
"async_step_zeroconf",
"(",
"self",
",",
"discovery_info",
")",
":",
"# Normalize properties from discovery",
"# homekit_python has code to do this, but not in a form we can",
"# easily use, so do the bare minimum ourselves here instead.",
"properties",
"=",
"{",
"key",... | [
199,
4
] | [
327,
48
] | python | en | ['en', 'en', 'en'] | True |
HomekitControllerFlowHandler.async_step_pair | (self, pair_info=None) | Pair with a new HomeKit accessory. | Pair with a new HomeKit accessory. | async def async_step_pair(self, pair_info=None):
"""Pair with a new HomeKit accessory."""
# If async_step_pair is called with no pairing code then we do the M1
# phase of pairing. If this is successful the device enters pairing
# mode.
# If it doesn't have a screen then the pin ... | [
"async",
"def",
"async_step_pair",
"(",
"self",
",",
"pair_info",
"=",
"None",
")",
":",
"# If async_step_pair is called with no pairing code then we do the M1",
"# phase of pairing. If this is successful the device enters pairing",
"# mode.",
"# If it doesn't have a screen then the pin ... | [
329,
4
] | [
423,
54
] | python | en | ['en', 'en', 'en'] | True |
HomekitControllerFlowHandler.async_step_busy_error | (self, user_input=None) | Retry pairing after the accessory is busy. | Retry pairing after the accessory is busy. | async def async_step_busy_error(self, user_input=None):
"""Retry pairing after the accessory is busy."""
if user_input is not None:
return await self.async_step_pair()
return self.async_show_form(step_id="busy_error") | [
"async",
"def",
"async_step_busy_error",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"return",
"await",
"self",
".",
"async_step_pair",
"(",
")",
"return",
"self",
".",
"async_show_form",
"(",
"step_id... | [
425,
4
] | [
430,
57
] | python | en | ['en', 'en', 'en'] | True |
HomekitControllerFlowHandler.async_step_max_tries_error | (self, user_input=None) | Retry pairing after the accessory has reached max tries. | Retry pairing after the accessory has reached max tries. | async def async_step_max_tries_error(self, user_input=None):
"""Retry pairing after the accessory has reached max tries."""
if user_input is not None:
return await self.async_step_pair()
return self.async_show_form(step_id="max_tries_error") | [
"async",
"def",
"async_step_max_tries_error",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"return",
"await",
"self",
".",
"async_step_pair",
"(",
")",
"return",
"self",
".",
"async_show_form",
"(",
"st... | [
432,
4
] | [
437,
62
] | python | en | ['en', 'en', 'en'] | True |
HomekitControllerFlowHandler.async_step_protocol_error | (self, user_input=None) | Retry pairing after the accessory has a protocol error. | Retry pairing after the accessory has a protocol error. | async def async_step_protocol_error(self, user_input=None):
"""Retry pairing after the accessory has a protocol error."""
if user_input is not None:
return await self.async_step_pair()
return self.async_show_form(step_id="protocol_error") | [
"async",
"def",
"async_step_protocol_error",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"return",
"await",
"self",
".",
"async_step_pair",
"(",
")",
"return",
"self",
".",
"async_show_form",
"(",
"ste... | [
439,
4
] | [
444,
61
] | python | en | ['en', 'en', 'en'] | True |
HomekitControllerFlowHandler._entry_from_accessory | (self, pairing) | Return a config entry from an initialized bridge. | Return a config entry from an initialized bridge. | async def _entry_from_accessory(self, pairing):
"""Return a config entry from an initialized bridge."""
# The bulk of the pairing record is stored on the config entry.
# A specific exception is the 'accessories' key. This is more
# volatile. We do cache it, but not against the config ent... | [
"async",
"def",
"_entry_from_accessory",
"(",
"self",
",",
"pairing",
")",
":",
"# The bulk of the pairing record is stored on the config entry.",
"# A specific exception is the 'accessories' key. This is more",
"# volatile. We do cache it, but not against the config entry.",
"# So copy the ... | [
462,
4
] | [
481,
69
] | python | en | ['en', 'en', 'en'] | True |
get_async_client | (hass: HomeAssistant, verify_ssl: bool = True) | Return default httpx AsyncClient.
This method must be run in the event loop.
| Return default httpx AsyncClient. | def get_async_client(hass: HomeAssistant, verify_ssl: bool = True) -> httpx.AsyncClient:
"""Return default httpx AsyncClient.
This method must be run in the event loop.
"""
key = DATA_ASYNC_CLIENT if verify_ssl else DATA_ASYNC_CLIENT_NOVERIFY
client: httpx.AsyncClient | None = hass.data.get(key)
... | [
"def",
"get_async_client",
"(",
"hass",
":",
"HomeAssistant",
",",
"verify_ssl",
":",
"bool",
"=",
"True",
")",
"->",
"httpx",
".",
"AsyncClient",
":",
"key",
"=",
"DATA_ASYNC_CLIENT",
"if",
"verify_ssl",
"else",
"DATA_ASYNC_CLIENT_NOVERIFY",
"client",
":",
"htt... | [
23,
0
] | [
35,
17
] | python | en | ['es', 'fr', 'en'] | False |
create_async_httpx_client | (
hass: HomeAssistant,
verify_ssl: bool = True,
auto_cleanup: bool = True,
**kwargs: Any,
) | Create a new httpx.AsyncClient with kwargs, i.e. for cookies.
If auto_cleanup is False, the client will be
automatically closed on homeassistant_stop.
This method must be run in the event loop.
| Create a new httpx.AsyncClient with kwargs, i.e. for cookies. | def create_async_httpx_client(
hass: HomeAssistant,
verify_ssl: bool = True,
auto_cleanup: bool = True,
**kwargs: Any,
) -> httpx.AsyncClient:
"""Create a new httpx.AsyncClient with kwargs, i.e. for cookies.
If auto_cleanup is False, the client will be
automatically closed on homeassistant_... | [
"def",
"create_async_httpx_client",
"(",
"hass",
":",
"HomeAssistant",
",",
"verify_ssl",
":",
"bool",
"=",
"True",
",",
"auto_cleanup",
":",
"bool",
"=",
"True",
",",
"*",
"*",
"kwargs",
":",
"Any",
",",
")",
"->",
"httpx",
".",
"AsyncClient",
":",
"cli... | [
50,
0
] | [
78,
17
] | python | en | ['en', 'en', 'sw'] | True |
_async_register_async_client_shutdown | (
hass: HomeAssistant,
client: httpx.AsyncClient,
original_aclose: Callable[..., Any],
) | Register httpx AsyncClient aclose on Home Assistant shutdown.
This method must be run in the event loop.
| Register httpx AsyncClient aclose on Home Assistant shutdown. | def _async_register_async_client_shutdown(
hass: HomeAssistant,
client: httpx.AsyncClient,
original_aclose: Callable[..., Any],
) -> None:
"""Register httpx AsyncClient aclose on Home Assistant shutdown.
This method must be run in the event loop.
"""
async def _async_close_client(event: Ev... | [
"def",
"_async_register_async_client_shutdown",
"(",
"hass",
":",
"HomeAssistant",
",",
"client",
":",
"httpx",
".",
"AsyncClient",
",",
"original_aclose",
":",
"Callable",
"[",
"...",
",",
"Any",
"]",
",",
")",
"->",
"None",
":",
"async",
"def",
"_async_close... | [
82,
0
] | [
96,
78
] | python | en | ['en', 'en', 'en'] | True |
HassHttpXAsyncClient.__aenter__ | (self: HassHttpXAsyncClient) | Prevent an integration from reopen of the client via context manager. | Prevent an integration from reopen of the client via context manager. | async def __aenter__(self: HassHttpXAsyncClient) -> HassHttpXAsyncClient:
"""Prevent an integration from reopen of the client via context manager."""
return self | [
"async",
"def",
"__aenter__",
"(",
"self",
":",
"HassHttpXAsyncClient",
")",
"->",
"HassHttpXAsyncClient",
":",
"return",
"self"
] | [
41,
4
] | [
43,
19
] | python | en | ['en', 'en', 'en'] | True |
HassHttpXAsyncClient.__aexit__ | (self, *args: Any) | Prevent an integration from close of the client via context manager. | Prevent an integration from close of the client via context manager. | async def __aexit__(self, *args: Any) -> None:
"""Prevent an integration from close of the client via context manager.""" | [
"async",
"def",
"__aexit__",
"(",
"self",
",",
"*",
"args",
":",
"Any",
")",
"->",
"None",
":"
] | [
45,
4
] | [
46,
82
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Binary Sensor platform for EnOcean. | Set up the Binary Sensor platform for EnOcean. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Binary Sensor platform for EnOcean."""
dev_id = config.get(CONF_ID)
dev_name = config.get(CONF_NAME)
device_class = config.get(CONF_DEVICE_CLASS)
add_entities([EnOceanBinarySensor(dev_id, dev_name, device_class)]) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"dev_id",
"=",
"config",
".",
"get",
"(",
"CONF_ID",
")",
"dev_name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"device_class",
... | [
26,
0
] | [
32,
71
] | python | en | ['en', 'da', 'en'] | True |
EnOceanBinarySensor.__init__ | (self, dev_id, dev_name, device_class) | Initialize the EnOcean binary sensor. | Initialize the EnOcean binary sensor. | def __init__(self, dev_id, dev_name, device_class):
"""Initialize the EnOcean binary sensor."""
super().__init__(dev_id, dev_name)
self._device_class = device_class
self.which = -1
self.onoff = -1 | [
"def",
"__init__",
"(",
"self",
",",
"dev_id",
",",
"dev_name",
",",
"device_class",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"dev_id",
",",
"dev_name",
")",
"self",
".",
"_device_class",
"=",
"device_class",
"self",
".",
"which",
"=",
"-",
"... | [
43,
4
] | [
48,
23
] | python | en | ['en', 'zh-Latn', 'en'] | True |
EnOceanBinarySensor.name | (self) | Return the default name for the binary sensor. | Return the default name for the binary sensor. | def name(self):
"""Return the default name for the binary sensor."""
return self.dev_name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"dev_name"
] | [
51,
4
] | [
53,
28
] | python | en | ['en', 'no', 'en'] | True |
EnOceanBinarySensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self):
"""Return the class of this sensor."""
return self._device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_class"
] | [
56,
4
] | [
58,
33
] | python | en | ['en', 'en', 'en'] | True |
EnOceanBinarySensor.value_changed | (self, packet) | Fire an event with the data that have changed.
This method is called when there is an incoming packet associated
with this platform.
Example packet data:
- 2nd button pressed
['0xf6', '0x10', '0x00', '0x2d', '0xcf', '0x45', '0x30']
- button released
['0x... | Fire an event with the data that have changed. | def value_changed(self, packet):
"""Fire an event with the data that have changed.
This method is called when there is an incoming packet associated
with this platform.
Example packet data:
- 2nd button pressed
['0xf6', '0x10', '0x00', '0x2d', '0xcf', '0x45', '0x30'... | [
"def",
"value_changed",
"(",
"self",
",",
"packet",
")",
":",
"# Energy Bow",
"pushed",
"=",
"None",
"if",
"packet",
".",
"data",
"[",
"6",
"]",
"==",
"0x30",
":",
"pushed",
"=",
"1",
"elif",
"packet",
".",
"data",
"[",
"6",
"]",
"==",
"0x20",
":",... | [
60,
4
] | [
109,
9
] | python | en | ['en', 'en', 'en'] | True |
AbstractConfig.__init__ | (self, hass) | Initialize abstract config. | Initialize abstract config. | def __init__(self, hass):
"""Initialize abstract config."""
self.hass = hass | [
"def",
"__init__",
"(",
"self",
",",
"hass",
")",
":",
"self",
".",
"hass",
"=",
"hass"
] | [
13,
4
] | [
15,
24
] | python | en | ['en', 'en', 'en'] | True |
AbstractConfig.supports_auth | (self) | Return if config supports auth. | Return if config supports auth. | def supports_auth(self):
"""Return if config supports auth."""
return False | [
"def",
"supports_auth",
"(",
"self",
")",
":",
"return",
"False"
] | [
18,
4
] | [
20,
20
] | python | en | ['en', 'en', 'en'] | True |
AbstractConfig.should_report_state | (self) | Return if states should be proactively reported. | Return if states should be proactively reported. | def should_report_state(self):
"""Return if states should be proactively reported."""
return False | [
"def",
"should_report_state",
"(",
"self",
")",
":",
"return",
"False"
] | [
23,
4
] | [
25,
20
] | python | en | ['en', 'en', 'en'] | True |
AbstractConfig.endpoint | (self) | Endpoint for report state. | Endpoint for report state. | def endpoint(self):
"""Endpoint for report state."""
return None | [
"def",
"endpoint",
"(",
"self",
")",
":",
"return",
"None"
] | [
28,
4
] | [
30,
19
] | python | en | ['en', 'en', 'en'] | True |
AbstractConfig.locale | (self) | Return config locale. | Return config locale. | def locale(self):
"""Return config locale.""" | [
"def",
"locale",
"(",
"self",
")",
":"
] | [
34,
4
] | [
35,
35
] | python | de | ['de', 'la', 'en'] | False |
AbstractConfig.entity_config | (self) | Return entity config. | Return entity config. | def entity_config(self):
"""Return entity config."""
return {} | [
"def",
"entity_config",
"(",
"self",
")",
":",
"return",
"{",
"}"
] | [
38,
4
] | [
40,
17
] | python | en | ['en', 'cy', 'en'] | True |
AbstractConfig.is_reporting_states | (self) | Return if proactive mode is enabled. | Return if proactive mode is enabled. | def is_reporting_states(self):
"""Return if proactive mode is enabled."""
return self._unsub_proactive_report is not None | [
"def",
"is_reporting_states",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unsub_proactive_report",
"is",
"not",
"None"
] | [
43,
4
] | [
45,
55
] | python | en | ['en', 'en', 'en'] | True |
AbstractConfig.user_identifier | (self) | Return an identifier for the user that represents this config. | Return an identifier for the user that represents this config. | def user_identifier(self):
"""Return an identifier for the user that represents this config.""" | [
"def",
"user_identifier",
"(",
"self",
")",
":"
] | [
49,
4
] | [
50,
76
] | python | en | ['en', 'en', 'en'] | True |
AbstractConfig.async_enable_proactive_mode | (self) | Enable proactive mode. | Enable proactive mode. | async def async_enable_proactive_mode(self):
"""Enable proactive mode."""
if self._unsub_proactive_report is None:
self._unsub_proactive_report = self.hass.async_create_task(
async_enable_proactive_mode(self.hass, self)
)
try:
await self._unsub... | [
"async",
"def",
"async_enable_proactive_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"_unsub_proactive_report",
"is",
"None",
":",
"self",
".",
"_unsub_proactive_report",
"=",
"self",
".",
"hass",
".",
"async_create_task",
"(",
"async_enable_proactive_mode",
"("... | [
52,
4
] | [
62,
17
] | python | en | ['fr', 'xh', 'en'] | False |
AbstractConfig.async_disable_proactive_mode | (self) | Disable proactive mode. | Disable proactive mode. | async def async_disable_proactive_mode(self):
"""Disable proactive mode."""
unsub_func = await self._unsub_proactive_report
if unsub_func:
unsub_func()
self._unsub_proactive_report = None | [
"async",
"def",
"async_disable_proactive_mode",
"(",
"self",
")",
":",
"unsub_func",
"=",
"await",
"self",
".",
"_unsub_proactive_report",
"if",
"unsub_func",
":",
"unsub_func",
"(",
")",
"self",
".",
"_unsub_proactive_report",
"=",
"None"
] | [
64,
4
] | [
69,
43
] | python | en | ['fr', 'en', 'en'] | True |
AbstractConfig.should_expose | (self, entity_id) | If an entity should be exposed. | If an entity should be exposed. | def should_expose(self, entity_id):
"""If an entity should be exposed."""
# pylint: disable=no-self-use
return False | [
"def",
"should_expose",
"(",
"self",
",",
"entity_id",
")",
":",
"# pylint: disable=no-self-use",
"return",
"False"
] | [
72,
4
] | [
75,
20
] | python | en | ['en', 'en', 'en'] | True |
AbstractConfig.async_invalidate_access_token | (self) | Invalidate access token. | Invalidate access token. | def async_invalidate_access_token(self):
"""Invalidate access token."""
raise NotImplementedError | [
"def",
"async_invalidate_access_token",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | [
78,
4
] | [
80,
33
] | python | en | ['en', 'fi', 'en'] | True |
AbstractConfig.async_get_access_token | (self) | Get an access token. | Get an access token. | async def async_get_access_token(self):
"""Get an access token."""
raise NotImplementedError | [
"async",
"def",
"async_get_access_token",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | [
82,
4
] | [
84,
33
] | python | en | ['en', 'lb', 'en'] | True |
AbstractConfig.async_accept_grant | (self, code) | Accept a grant. | Accept a grant. | async def async_accept_grant(self, code):
"""Accept a grant."""
raise NotImplementedError | [
"async",
"def",
"async_accept_grant",
"(",
"self",
",",
"code",
")",
":",
"raise",
"NotImplementedError"
] | [
86,
4
] | [
88,
33
] | python | en | ['en', 'it', 'en'] | True |
fetch_mac_and_title | (hass: core.HomeAssistant, host) | Validate the user input allows us to connect. | Validate the user input allows us to connect. | async def fetch_mac_and_title(hass: core.HomeAssistant, host):
"""Validate the user input allows us to connect."""
session = aiohttp_client.async_get_clientsession(hass)
emonitor = Emonitor(host, session)
status = await emonitor.async_get_status()
mac_address = status.network.mac_address
return ... | [
"async",
"def",
"fetch_mac_and_title",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"host",
")",
":",
"session",
"=",
"aiohttp_client",
".",
"async_get_clientsession",
"(",
"hass",
")",
"emonitor",
"=",
"Emonitor",
"(",
"host",
",",
"session",
")",
"... | [
19,
0
] | [
25,
82
] | python | en | ['en', 'en', 'en'] | True |
short_mac | (mac) | Short version of the mac. | Short version of the mac. | def short_mac(mac):
"""Short version of the mac."""
return "".join(mac.split(":")[3:]).upper() | [
"def",
"short_mac",
"(",
"mac",
")",
":",
"return",
"\"\"",
".",
"join",
"(",
"mac",
".",
"split",
"(",
"\":\"",
")",
"[",
"3",
":",
"]",
")",
".",
"upper",
"(",
")"
] | [
101,
0
] | [
103,
46
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.__init__ | (self) | Initialize Emonitor ConfigFlow. | Initialize Emonitor ConfigFlow. | def __init__(self):
"""Initialize Emonitor ConfigFlow."""
self.discovered_ip = None
self.discovered_info = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"discovered_ip",
"=",
"None",
"self",
".",
"discovered_info",
"=",
"None"
] | [
33,
4
] | [
36,
35
] | python | en | ['en', 'en', 'it'] | 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 = {}
if user_input is not None:
try:
info = await fetch_mac_and_title(self.hass, user_input[CONF_HOST])
except aiohttp.ClientError:
errors[CONF_HOST] = ... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"try",
":",
"info",
"=",
"await",
"fetch_mac_and_title",
"(",
"self",
".",
"hass",
",",
"us... | [
38,
4
] | [
62,
9
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_dhcp | (self, discovery_info) | Handle dhcp discovery. | Handle dhcp discovery. | async def async_step_dhcp(self, discovery_info):
"""Handle dhcp discovery."""
self.discovered_ip = discovery_info[IP_ADDRESS]
await self.async_set_unique_id(format_mac(discovery_info[MAC_ADDRESS]))
self._abort_if_unique_id_configured(updates={CONF_HOST: self.discovered_ip})
name ... | [
"async",
"def",
"async_step_dhcp",
"(",
"self",
",",
"discovery_info",
")",
":",
"self",
".",
"discovered_ip",
"=",
"discovery_info",
"[",
"IP_ADDRESS",
"]",
"await",
"self",
".",
"async_set_unique_id",
"(",
"format_mac",
"(",
"discovery_info",
"[",
"MAC_ADDRESS",... | [
64,
4
] | [
80,
46
] | python | en | ['fr', 'en', 'en'] | True |
ConfigFlow.async_step_confirm | (self, user_input=None) | Attempt to confim. | Attempt to confim. | async def async_step_confirm(self, user_input=None):
"""Attempt to confim."""
if user_input is not None:
return self.async_create_entry(
title=self.discovered_info["title"],
data={CONF_HOST: self.discovered_ip},
)
self._set_confirm_only()
... | [
"async",
"def",
"async_step_confirm",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"return",
"self",
".",
"async_create_entry",
"(",
"title",
"=",
"self",
".",
"discovered_info",
"[",
"\"title\"",
"]",
... | [
82,
4
] | [
98,
9
] | python | en | ['en', 'it', 'en'] | True |
test_valve_switches | (hass, config_entry, aioclient_mock_fixture) | Test Flo by Moen valve switches. | Test Flo by Moen valve switches. | async def test_valve_switches(hass, config_entry, aioclient_mock_fixture):
"""Test Flo by Moen valve switches."""
config_entry.add_to_hass(hass)
assert await async_setup_component(
hass, FLO_DOMAIN, {CONF_USERNAME: TEST_USER_ID, CONF_PASSWORD: TEST_PASSWORD}
)
await hass.async_block_till_don... | [
"async",
"def",
"test_valve_switches",
"(",
"hass",
",",
"config_entry",
",",
"aioclient_mock_fixture",
")",
":",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"FLO_DOMAIN",
",",
"{",
"CONF_USER... | [
9,
0
] | [
30,
55
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the SyncThru component. | Set up the SyncThru component. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the SyncThru component."""
_LOGGER.warning(
"Loading syncthru via platform config is deprecated and no longer "
"necessary as of 0.113; Please remove it from your configuration YAML"
)
hass.a... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"_LOGGER",
".",
"warning",
"(",
"\"Loading syncthru via platform config is deprecated and no longer \"",
"\"necessary as of 0.113; Plea... | [
52,
0
] | [
68,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up from config entry. | Set up from config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up from config entry."""
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
printer: SyncThru = coordinator.data
supp_toner = printer.toner_status(filter_supported=True)
supp_drum = printer.drum_... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"coordinator",
":",
"DataUpdateCoordinator",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"printer",
":",
"S... | [
71,
0
] | [
94,
32
] | python | en | ['en', 'en', 'en'] | True |
SyncThruSensor.__init__ | (self, coordinator, name) | Initialize the sensor. | Initialize the sensor. | def __init__(self, coordinator, name):
"""Initialize the sensor."""
super().__init__(coordinator)
self.syncthru: SyncThru = coordinator.data
self._name = name
self._icon = "mdi:printer"
self._unit_of_measurement = None
self._id_suffix = "" | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"name",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"syncthru",
":",
"SyncThru",
"=",
"coordinator",
".",
"data",
"self",
".",
"_name",
"=",
"name",
"self"... | [
100,
4
] | [
107,
28
] | python | en | ['en', 'en', 'en'] | True |
SyncThruSensor.unique_id | (self) | Return unique ID for the sensor. | Return unique ID for the sensor. | def unique_id(self):
"""Return unique ID for the sensor."""
serial = self.syncthru.serial_number()
return f"{serial}{self._id_suffix}" if serial else None | [
"def",
"unique_id",
"(",
"self",
")",
":",
"serial",
"=",
"self",
".",
"syncthru",
".",
"serial_number",
"(",
")",
"return",
"f\"{serial}{self._id_suffix}\"",
"if",
"serial",
"else",
"None"
] | [
110,
4
] | [
113,
63
] | python | en | ['en', 'it', 'en'] | True |
SyncThruSensor.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"
] | [
116,
4
] | [
118,
25
] | python | en | ['en', 'mi', 'en'] | True |
SyncThruSensor.icon | (self) | Return the icon of the device. | Return the icon of the device. | def icon(self):
"""Return the icon of the device."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
121,
4
] | [
123,
25
] | python | en | ['en', 'en', 'en'] | True |
SyncThruSensor.native_unit_of_measurement | (self) | Return the unit of measuremnt. | Return the unit of measuremnt. | def native_unit_of_measurement(self):
"""Return the unit of measuremnt."""
return self._unit_of_measurement | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
126,
4
] | [
128,
40
] | python | en | ['en', 'da', 'en'] | True |
SyncThruSensor.device_info | (self) | Return device information. | Return device information. | def device_info(self):
"""Return device information."""
return {"identifiers": device_identifiers(self.syncthru)} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"device_identifiers",
"(",
"self",
".",
"syncthru",
")",
"}"
] | [
131,
4
] | [
133,
65
] | python | da | ['es', 'da', 'en'] | False |
SyncThruMainSensor.__init__ | (self, coordinator, name) | Initialize the sensor. | Initialize the sensor. | def __init__(self, coordinator, name):
"""Initialize the sensor."""
super().__init__(coordinator, name)
self._id_suffix = "_main" | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"name",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"name",
")",
"self",
".",
"_id_suffix",
"=",
"\"_main\""
] | [
144,
4
] | [
147,
33
] | python | en | ['en', 'en', 'en'] | True |
SyncThruMainSensor.native_value | (self) | Set state to human readable version of syncthru status. | Set state to human readable version of syncthru status. | def native_value(self):
"""Set state to human readable version of syncthru status."""
return SYNCTHRU_STATE_HUMAN[self.syncthru.device_status()] | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"SYNCTHRU_STATE_HUMAN",
"[",
"self",
".",
"syncthru",
".",
"device_status",
"(",
")",
"]"
] | [
150,
4
] | [
152,
66
] | python | en | ['en', 'en', 'en'] | True |
SyncThruMainSensor.extra_state_attributes | (self) | Show current printer display text. | Show current printer display text. | def extra_state_attributes(self):
"""Show current printer display text."""
return {
"display_text": self.syncthru.device_status_details(),
} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"\"display_text\"",
":",
"self",
".",
"syncthru",
".",
"device_status_details",
"(",
")",
",",
"}"
] | [
155,
4
] | [
159,
9
] | python | en | ['en', 'en', 'en'] | True |
SyncThruMainSensor.entity_registry_enabled_default | (self) | Disable entity by default. | Disable entity by default. | def entity_registry_enabled_default(self) -> bool:
"""Disable entity by default."""
return False | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
162,
4
] | [
164,
20
] | python | en | ['en', 'en', 'en'] | True |
SyncThruTonerSensor.__init__ | (self, coordinator, name, color) | Initialize the sensor. | Initialize the sensor. | def __init__(self, coordinator, name, color):
"""Initialize the sensor."""
super().__init__(coordinator, name)
self._name = f"{name} Toner {color}"
self._color = color
self._unit_of_measurement = PERCENTAGE
self._id_suffix = f"_toner_{color}" | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"name",
",",
"color",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"name",
")",
"self",
".",
"_name",
"=",
"f\"{name} Toner {color}\"",
"self",
".",
"_color",
"=",
"color"... | [
170,
4
] | [
176,
43
] | python | en | ['en', 'en', 'en'] | True |
SyncThruTonerSensor.extra_state_attributes | (self) | Show all data returned for this toner. | Show all data returned for this toner. | def extra_state_attributes(self):
"""Show all data returned for this toner."""
return self.syncthru.toner_status().get(self._color, {}) | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"syncthru",
".",
"toner_status",
"(",
")",
".",
"get",
"(",
"self",
".",
"_color",
",",
"{",
"}",
")"
] | [
179,
4
] | [
181,
64
] | python | en | ['en', 'en', 'en'] | True |
SyncThruTonerSensor.native_value | (self) | Show amount of remaining toner. | Show amount of remaining toner. | def native_value(self):
"""Show amount of remaining toner."""
return self.syncthru.toner_status().get(self._color, {}).get("remaining") | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"syncthru",
".",
"toner_status",
"(",
")",
".",
"get",
"(",
"self",
".",
"_color",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"remaining\"",
")"
] | [
184,
4
] | [
186,
81
] | python | en | ['en', 'zu', 'en'] | True |
SyncThruDrumSensor.__init__ | (self, syncthru, name, color) | Initialize the sensor. | Initialize the sensor. | def __init__(self, syncthru, name, color):
"""Initialize the sensor."""
super().__init__(syncthru, name)
self._name = f"{name} Drum {color}"
self._color = color
self._unit_of_measurement = PERCENTAGE
self._id_suffix = f"_drum_{color}" | [
"def",
"__init__",
"(",
"self",
",",
"syncthru",
",",
"name",
",",
"color",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"syncthru",
",",
"name",
")",
"self",
".",
"_name",
"=",
"f\"{name} Drum {color}\"",
"self",
".",
"_color",
"=",
"color",
"se... | [
192,
4
] | [
198,
42
] | python | en | ['en', 'en', 'en'] | True |
SyncThruDrumSensor.extra_state_attributes | (self) | Show all data returned for this drum. | Show all data returned for this drum. | def extra_state_attributes(self):
"""Show all data returned for this drum."""
return self.syncthru.drum_status().get(self._color, {}) | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"syncthru",
".",
"drum_status",
"(",
")",
".",
"get",
"(",
"self",
".",
"_color",
",",
"{",
"}",
")"
] | [
201,
4
] | [
203,
63
] | python | en | ['en', 'en', 'en'] | True |
SyncThruDrumSensor.native_value | (self) | Show amount of remaining drum. | Show amount of remaining drum. | def native_value(self):
"""Show amount of remaining drum."""
return self.syncthru.drum_status().get(self._color, {}).get("remaining") | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"syncthru",
".",
"drum_status",
"(",
")",
".",
"get",
"(",
"self",
".",
"_color",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"remaining\"",
")"
] | [
206,
4
] | [
208,
80
] | python | en | ['en', 'en', 'en'] | True |
SyncThruInputTraySensor.__init__ | (self, syncthru, name, number) | Initialize the sensor. | Initialize the sensor. | def __init__(self, syncthru, name, number):
"""Initialize the sensor."""
super().__init__(syncthru, name)
self._name = f"{name} Tray {number}"
self._number = number
self._id_suffix = f"_tray_{number}" | [
"def",
"__init__",
"(",
"self",
",",
"syncthru",
",",
"name",
",",
"number",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"syncthru",
",",
"name",
")",
"self",
".",
"_name",
"=",
"f\"{name} Tray {number}\"",
"self",
".",
"_number",
"=",
"number",
... | [
214,
4
] | [
219,
43
] | python | en | ['en', 'en', 'en'] | True |
SyncThruInputTraySensor.extra_state_attributes | (self) | Show all data returned for this input tray. | Show all data returned for this input tray. | def extra_state_attributes(self):
"""Show all data returned for this input tray."""
return self.syncthru.input_tray_status().get(self._number, {}) | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"syncthru",
".",
"input_tray_status",
"(",
")",
".",
"get",
"(",
"self",
".",
"_number",
",",
"{",
"}",
")"
] | [
222,
4
] | [
224,
70
] | python | en | ['en', 'en', 'en'] | True |
SyncThruInputTraySensor.native_value | (self) | Display ready unless there is some error, then display error. | Display ready unless there is some error, then display error. | def native_value(self):
"""Display ready unless there is some error, then display error."""
tray_state = (
self.syncthru.input_tray_status().get(self._number, {}).get("newError")
)
if tray_state == "":
tray_state = "Ready"
return tray_state | [
"def",
"native_value",
"(",
"self",
")",
":",
"tray_state",
"=",
"(",
"self",
".",
"syncthru",
".",
"input_tray_status",
"(",
")",
".",
"get",
"(",
"self",
".",
"_number",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"newError\"",
")",
")",
"if",
"tray_sta... | [
227,
4
] | [
234,
25
] | python | en | ['en', 'en', 'en'] | True |
SyncThruOutputTraySensor.__init__ | (self, syncthru, name, number) | Initialize the sensor. | Initialize the sensor. | def __init__(self, syncthru, name, number):
"""Initialize the sensor."""
super().__init__(syncthru, name)
self._name = f"{name} Output Tray {number}"
self._number = number
self._id_suffix = f"_output_tray_{number}" | [
"def",
"__init__",
"(",
"self",
",",
"syncthru",
",",
"name",
",",
"number",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"syncthru",
",",
"name",
")",
"self",
".",
"_name",
"=",
"f\"{name} Output Tray {number}\"",
"self",
".",
"_number",
"=",
"num... | [
240,
4
] | [
245,
50
] | python | en | ['en', 'en', 'en'] | True |
SyncThruOutputTraySensor.extra_state_attributes | (self) | Show all data returned for this output tray. | Show all data returned for this output tray. | def extra_state_attributes(self):
"""Show all data returned for this output tray."""
return self.syncthru.output_tray_status().get(self._number, {}) | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"syncthru",
".",
"output_tray_status",
"(",
")",
".",
"get",
"(",
"self",
".",
"_number",
",",
"{",
"}",
")"
] | [
248,
4
] | [
250,
71
] | python | en | ['en', 'en', 'en'] | True |
SyncThruOutputTraySensor.native_value | (self) | Display ready unless there is some error, then display error. | Display ready unless there is some error, then display error. | def native_value(self):
"""Display ready unless there is some error, then display error."""
tray_state = (
self.syncthru.output_tray_status().get(self._number, {}).get("status")
)
if tray_state == "":
tray_state = "Ready"
return tray_state | [
"def",
"native_value",
"(",
"self",
")",
":",
"tray_state",
"=",
"(",
"self",
".",
"syncthru",
".",
"output_tray_status",
"(",
")",
".",
"get",
"(",
"self",
".",
"_number",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"status\"",
")",
")",
"if",
"tray_stat... | [
253,
4
] | [
260,
25
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up an InComfort/InTouch binary_sensor device. | Set up an InComfort/InTouch binary_sensor device. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up an InComfort/InTouch binary_sensor device."""
if discovery_info is None:
return
client = hass.data[DOMAIN]["client"]
heaters = hass.data[DOMAIN]["heaters"]
async_add_entities([IncomfortFailed(c... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"client",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"... | [
13,
0
] | [
21,
69
] | python | en | ['en', 'en', 'en'] | True |
IncomfortFailed.__init__ | (self, client, heater) | Initialize the binary sensor. | Initialize the binary sensor. | def __init__(self, client, heater) -> None:
"""Initialize the binary sensor."""
super().__init__()
self._unique_id = f"{heater.serial_no}_failed"
self.entity_id = f"{BINARY_SENSOR_DOMAIN}.{DOMAIN}_failed"
self._name = "Boiler Fault"
self._client = client
self._h... | [
"def",
"__init__",
"(",
"self",
",",
"client",
",",
"heater",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_unique_id",
"=",
"f\"{heater.serial_no}_failed\"",
"self",
".",
"entity_id",
"=",
"f\"{BINARY_SENSOR_DOMAIN}.{DOM... | [
27,
4
] | [
36,
29
] | python | en | ['en', 'haw', 'en'] | True |
IncomfortFailed.is_on | (self) | Return the status of the sensor. | Return the status of the sensor. | def is_on(self) -> bool:
"""Return the status of the sensor."""
return self._heater.status["is_failed"] | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_heater",
".",
"status",
"[",
"\"is_failed\"",
"]"
] | [
39,
4
] | [
41,
47
] | python | en | ['en', 'id', 'en'] | True |
IncomfortFailed.extra_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def extra_state_attributes(self) -> dict[str, Any] | None:
"""Return the device state attributes."""
return {"fault_code": self._heater.status["fault_code"]} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
":",
"return",
"{",
"\"fault_code\"",
":",
"self",
".",
"_heater",
".",
"status",
"[",
"\"fault_code\"",
"]",
"}"
] | [
44,
4
] | [
46,
64
] | python | en | ['en', 'en', 'en'] | True |
_async_reproduce_state | (
hass: HomeAssistant,
state: State,
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) | Reproduce a single state. | Reproduce a single state. | async def _async_reproduce_state(
hass: HomeAssistant,
state: State,
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) -> None:
"""Reproduce a single state."""
cur_state = hass.states.get(state.entity_id)
if cur_state is None:
_LOGGER.warning(... | [
"async",
"def",
"_async_reproduce_state",
"(",
"hass",
":",
"HomeAssistant",
",",
"state",
":",
"State",
",",
"*",
",",
"context",
":",
"Context",
"|",
"None",
"=",
"None",
",",
"reproduce_options",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
... | [
24,
0
] | [
57,
5
] | python | en | ['en', 'en', 'en'] | True |
async_reproduce_states | (
hass: HomeAssistant,
states: Iterable[State],
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) | Reproduce Remote states. | Reproduce Remote states. | async def async_reproduce_states(
hass: HomeAssistant,
states: Iterable[State],
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) -> None:
"""Reproduce Remote states."""
await asyncio.gather(
*(
_async_reproduce_state(
h... | [
"async",
"def",
"async_reproduce_states",
"(",
"hass",
":",
"HomeAssistant",
",",
"states",
":",
"Iterable",
"[",
"State",
"]",
",",
"*",
",",
"context",
":",
"Context",
"|",
"None",
"=",
"None",
",",
"reproduce_options",
":",
"dict",
"[",
"str",
",",
"A... | [
60,
0
] | [
75,
5
] | python | en | ['en', 'en', 'en'] | True |
BuilderFromSource | (source, filename) | Utility method that returns an AstBuilder from source code.
Args:
source: 'C++ source code'
filename: 'file1'
Returns:
AstBuilder
| Utility method that returns an AstBuilder from source code. | def BuilderFromSource(source, filename):
"""Utility method that returns an AstBuilder from source code.
Args:
source: 'C++ source code'
filename: 'file1'
Returns:
AstBuilder
"""
return AstBuilder(tokenize.GetTokens(source), filename) | [
"def",
"BuilderFromSource",
"(",
"source",
",",
"filename",
")",
":",
"return",
"AstBuilder",
"(",
"tokenize",
".",
"GetTokens",
"(",
"source",
")",
",",
"filename",
")"
] | [
1701,
0
] | [
1711,
57
] | python | en | ['en', 'en', 'en'] | True |
PrintIndentifiers | (filename, should_print) | Prints all identifiers for a C++ source file.
Args:
filename: 'file1'
should_print: predicate with signature: bool Function(token)
| Prints all identifiers for a C++ source file. | def PrintIndentifiers(filename, should_print):
"""Prints all identifiers for a C++ source file.
Args:
filename: 'file1'
should_print: predicate with signature: bool Function(token)
"""
source = utils.ReadFile(filename, False)
if source is None:
sys.stderr.write('Unable to find: %s\n' % fi... | [
"def",
"PrintIndentifiers",
"(",
"filename",
",",
"should_print",
")",
":",
"source",
"=",
"utils",
".",
"ReadFile",
"(",
"filename",
",",
"False",
")",
"if",
"source",
"is",
"None",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'Unable to find: %s\\n'",
... | [
1714,
0
] | [
1735,
8
] | python | en | ['en', 'en', 'en'] | True |
PrintAllIndentifiers | (filenames, should_print) | Prints all identifiers for each C++ source file in filenames.
Args:
filenames: ['file1', 'file2', ...]
should_print: predicate with signature: bool Function(token)
| Prints all identifiers for each C++ source file in filenames. | def PrintAllIndentifiers(filenames, should_print):
"""Prints all identifiers for each C++ source file in filenames.
Args:
filenames: ['file1', 'file2', ...]
should_print: predicate with signature: bool Function(token)
"""
for path in filenames:
PrintIndentifiers(path, should_print) | [
"def",
"PrintAllIndentifiers",
"(",
"filenames",
",",
"should_print",
")",
":",
"for",
"path",
"in",
"filenames",
":",
"PrintIndentifiers",
"(",
"path",
",",
"should_print",
")"
] | [
1738,
0
] | [
1746,
41
] | python | en | ['en', 'en', 'en'] | True |
Node.IsDeclaration | (self) | Returns bool if this node is a declaration. | Returns bool if this node is a declaration. | def IsDeclaration(self):
"""Returns bool if this node is a declaration."""
return False | [
"def",
"IsDeclaration",
"(",
"self",
")",
":",
"return",
"False"
] | [
112,
2
] | [
114,
16
] | python | en | ['en', 'en', 'en'] | True |
Node.IsDefinition | (self) | Returns bool if this node is a definition. | Returns bool if this node is a definition. | def IsDefinition(self):
"""Returns bool if this node is a definition."""
return False | [
"def",
"IsDefinition",
"(",
"self",
")",
":",
"return",
"False"
] | [
116,
2
] | [
118,
16
] | python | en | ['en', 'en', 'en'] | True |
Node.IsExportable | (self) | Returns bool if this node exportable from a header file. | Returns bool if this node exportable from a header file. | def IsExportable(self):
"""Returns bool if this node exportable from a header file."""
return False | [
"def",
"IsExportable",
"(",
"self",
")",
":",
"return",
"False"
] | [
120,
2
] | [
122,
16
] | python | en | ['en', 'en', 'en'] | True |
Node.Requires | (self, node) | Does this AST node require the definition of the node passed in? | Does this AST node require the definition of the node passed in? | def Requires(self, node):
"""Does this AST node require the definition of the node passed in?"""
return False | [
"def",
"Requires",
"(",
"self",
",",
"node",
")",
":",
"return",
"False"
] | [
124,
2
] | [
126,
16
] | python | en | ['en', 'en', 'en'] | True |
VariableDeclaration.ToString | (self) | Return a string that tries to reconstitute the variable decl. | Return a string that tries to reconstitute the variable decl. | def ToString(self):
"""Return a string that tries to reconstitute the variable decl."""
suffix = '%s %s' % (self.type, self.name)
if self.initial_value:
suffix += ' = ' + self.initial_value
return suffix | [
"def",
"ToString",
"(",
"self",
")",
":",
"suffix",
"=",
"'%s %s'",
"%",
"(",
"self",
".",
"type",
",",
"self",
".",
"name",
")",
"if",
"self",
".",
"initial_value",
":",
"suffix",
"+=",
"' = '",
"+",
"self",
".",
"initial_value",
"return",
"suffix"
] | [
258,
2
] | [
263,
17
] | python | en | ['en', 'en', 'en'] | True |
Type.__init__ | (self, start, end, name, templated_types, modifiers,
reference, pointer, array) |
Args:
name: str name of main type
templated_types: [Class (Type?)] template type info between <>
modifiers: [str] type modifiers (keywords) eg, const, mutable, etc.
reference, pointer, array: bools
|
Args:
name: str name of main type
templated_types: [Class (Type?)] template type info between <>
modifiers: [str] type modifiers (keywords) eg, const, mutable, etc.
reference, pointer, array: bools
| def __init__(self, start, end, name, templated_types, modifiers,
reference, pointer, array):
"""
Args:
name: str name of main type
templated_types: [Class (Type?)] template type info between <>
modifiers: [str] type modifiers (keywords) eg, const, mutable, etc.
... | [
"def",
"__init__",
"(",
"self",
",",
"start",
",",
"end",
",",
"name",
",",
"templated_types",
",",
"modifiers",
",",
"reference",
",",
"pointer",
",",
"array",
")",
":",
"_GenericDeclaration",
".",
"__init__",
"(",
"self",
",",
"start",
",",
"end",
",",... | [
408,
2
] | [
424,
22
] | python | en | ['en', 'error', 'th'] | False |
TypeConverter.ToType | (self, tokens) | Convert [Token,...] to [Class(...), ] useful for base classes.
For example, code like class Foo : public Bar<x, y> { ... };
the "Bar<x, y>" portion gets converted to an AST.
Returns:
[Class(...), ...]
| Convert [Token,...] to [Class(...), ] useful for base classes.
For example, code like class Foo : public Bar<x, y> { ... };
the "Bar<x, y>" portion gets converted to an AST. | def ToType(self, tokens):
"""Convert [Token,...] to [Class(...), ] useful for base classes.
For example, code like class Foo : public Bar<x, y> { ... };
the "Bar<x, y>" portion gets converted to an AST.
Returns:
[Class(...), ...]
"""
result = []
name_tokens = []
... | [
"def",
"ToType",
"(",
"self",
",",
"tokens",
")",
":",
"result",
"=",
"[",
"]",
"name_tokens",
"=",
"[",
"]",
"reference",
"=",
"pointer",
"=",
"array",
"=",
"False",
"def",
"AddType",
"(",
"templated_types",
")",
":",
"# Partition tokens into name and modif... | [
473,
2
] | [
530,
17
] | python | en | ['en', 'en', 'en'] | True |
AstBuilder.GetName | (self, seq=None) | Returns ([tokens], next_token_info). | Returns ([tokens], next_token_info). | def GetName(self, seq=None):
"""Returns ([tokens], next_token_info)."""
GetNextToken = self._GetNextToken
if seq is not None:
it = iter(seq)
GetNextToken = lambda: next(it)
next_token = GetNextToken()
tokens = []
last_token_was_name = False
while (next_token.token_type == tokeniz... | [
"def",
"GetName",
"(",
"self",
",",
"seq",
"=",
"None",
")",
":",
"GetNextToken",
"=",
"self",
".",
"_GetNextToken",
"if",
"seq",
"is",
"not",
"None",
":",
"it",
"=",
"iter",
"(",
"seq",
")",
"GetNextToken",
"=",
"lambda",
":",
"next",
"(",
"it",
"... | [
966,
2
] | [
989,
29
] | python | nl | ['nl', 'nl', 'en'] | True |
validate_input | (hass: core.HomeAssistant, data) | Validate the user input allows us to connect. | Validate the user input allows us to connect. | async def validate_input(hass: core.HomeAssistant, data):
"""Validate the user input allows us to connect."""
auth = Auth(f"HomeAssistant/{const.__version__}")
try:
token = await hass.async_add_executor_job(
auth.fetch_token,
data["username"],
data["password"],
... | [
"async",
"def",
"validate_input",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"data",
")",
":",
"auth",
"=",
"Auth",
"(",
"f\"HomeAssistant/{const.__version__}\"",
")",
"try",
":",
"token",
"=",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"au... | [
14,
0
] | [
31,
16
] | python | en | ['en', 'en', 'en'] | True |
RingConfigFlow.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 = {}
if user_input is not None:
try:
token = await validate_input(self.hass, user_input)
await self.async_set_unique_id(user_input["username"])
ret... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"try",
":",
"token",
"=",
"await",
"validate_input",
"(",
"self",
".",
"hass",
",",
"user_i... | [
41,
4
] | [
70,
9
] | python | en | ['en', 'en', 'en'] | True |
RingConfigFlow.async_step_2fa | (self, user_input=None) | Handle 2fa step. | Handle 2fa step. | async def async_step_2fa(self, user_input=None):
"""Handle 2fa step."""
if user_input:
return await self.async_step_user({**self.user_pass, **user_input})
return self.async_show_form(
step_id="2fa",
data_schema=vol.Schema({vol.Required("2fa"): str}),
... | [
"async",
"def",
"async_step_2fa",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
":",
"return",
"await",
"self",
".",
"async_step_user",
"(",
"{",
"*",
"*",
"self",
".",
"user_pass",
",",
"*",
"*",
"user_input",
"}",
")",
"r... | [
72,
4
] | [
80,
9
] | python | en | ['it', 'sm', 'en'] | False |
async_setup_platform | (
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) | Set up switch(es) for KNX platform. | Set up switch(es) for KNX platform. | async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up switch(es) for KNX platform."""
if not discovery_info or not discovery_info["platform_config"]:
return
... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
"discovery_info",
":",
"DiscoveryInfoType",
"|",
"None",
"=",
"None",
",",
")",
"->",
"None",
... | [
20,
0
] | [
34,
5
] | python | en | ['en', 'da', 'en'] | True |
KNXSwitch.__init__ | (self, xknx: XKNX, config: ConfigType) | Initialize of KNX switch. | Initialize of KNX switch. | def __init__(self, xknx: XKNX, config: ConfigType) -> None:
"""Initialize of KNX switch."""
super().__init__(
device=XknxSwitch(
xknx,
name=config[CONF_NAME],
group_address=config[KNX_ADDRESS],
group_address_state=config.get(Swi... | [
"def",
"__init__",
"(",
"self",
",",
"xknx",
":",
"XKNX",
",",
"config",
":",
"ConfigType",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
"=",
"XknxSwitch",
"(",
"xknx",
",",
"name",
"=",
"config",
"[",
"CONF_NAME",
"]",
... | [
42,
4
] | [
54,
69
] | python | en | ['en', 'pl', 'en'] | True |
KNXSwitch.async_added_to_hass | (self) | Restore last state. | Restore last state. | async def async_added_to_hass(self) -> None:
"""Restore last state."""
await super().async_added_to_hass()
if not self._device.switch.readable and (
last_state := await self.async_get_last_state()
):
if last_state.state not in (STATE_UNKNOWN, STATE_UNAVAILABLE):
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"if",
"not",
"self",
".",
"_device",
".",
"switch",
".",
"readable",
"and",
"(",
"last_state",
":=",
"await",
"s... | [
56,
4
] | [
63,
72
] | python | it | ['it', 'it', 'en'] | True |
KNXSwitch.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self) -> bool:
"""Return true if device is on."""
return bool(self._device.state) | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"_device",
".",
"state",
")"
] | [
66,
4
] | [
68,
39
] | python | en | ['en', 'fy', 'en'] | True |
KNXSwitch.async_turn_on | (self, **kwargs: Any) | Turn the device on. | Turn the device on. | async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the device on."""
await self._device.set_on() | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"set_on",
"(",
")"
] | [
70,
4
] | [
72,
35
] | python | en | ['en', 'en', 'en'] | True |
KNXSwitch.async_turn_off | (self, **kwargs: Any) | Turn the device off. | Turn the device off. | async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the device off."""
await self._device.set_off() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"set_off",
"(",
")"
] | [
74,
4
] | [
76,
36
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (
hass: HomeAssistant, async_add_entities, config: ConfigType, discovery_info=None
) | Set up MQTT climate device through configuration.yaml. | Set up MQTT climate device through configuration.yaml. | async def async_setup_platform(
hass: HomeAssistant, async_add_entities, config: ConfigType, discovery_info=None
):
"""Set up MQTT climate device through configuration.yaml."""
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
await _async_setup_entity(hass, config, async_add_entities) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistant",
",",
"async_add_entities",
",",
"config",
":",
"ConfigType",
",",
"discovery_info",
"=",
"None",
")",
":",
"await",
"async_setup_reload_service",
"(",
"hass",
",",
"DOMAIN",
",",
"PLATFORMS... | [
277,
0
] | [
282,
63
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up MQTT climate device dynamically through MQTT discovery. | Set up MQTT climate device dynamically through MQTT discovery. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up MQTT climate device dynamically through MQTT discovery."""
setup = functools.partial(
_async_setup_entity, hass, async_add_entities, config_entry=config_entry
)
await async_setup_entry_helper(hass, climate.DOMAIN, set... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"setup",
"=",
"functools",
".",
"partial",
"(",
"_async_setup_entity",
",",
"hass",
",",
"async_add_entities",
",",
"config_entry",
"=",
"config_entry",
")"... | [
285,
0
] | [
290,
80
] | python | en | ['en', 'en', 'en'] | True |
_async_setup_entity | (
hass, async_add_entities, config, config_entry=None, discovery_data=None
) | Set up the MQTT climate devices. | Set up the MQTT climate devices. | async def _async_setup_entity(
hass, async_add_entities, config, config_entry=None, discovery_data=None
):
"""Set up the MQTT climate devices."""
async_add_entities([MqttClimate(hass, config, config_entry, discovery_data)]) | [
"async",
"def",
"_async_setup_entity",
"(",
"hass",
",",
"async_add_entities",
",",
"config",
",",
"config_entry",
"=",
"None",
",",
"discovery_data",
"=",
"None",
")",
":",
"async_add_entities",
"(",
"[",
"MqttClimate",
"(",
"hass",
",",
"config",
",",
"confi... | [
293,
0
] | [
297,
81
] | python | en | ['en', 'en', 'en'] | True |
MqttClimate.__init__ | (self, hass, config, config_entry, discovery_data) | Initialize the climate device. | Initialize the climate device. | def __init__(self, hass, config, config_entry, discovery_data):
"""Initialize the climate device."""
self._action = None
self._aux = False
self._away = False
self._current_fan_mode = None
self._current_operation = None
self._current_swing_mode = None
self.... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"config",
",",
"config_entry",
",",
"discovery_data",
")",
":",
"self",
".",
"_action",
"=",
"None",
"self",
".",
"_aux",
"=",
"False",
"self",
".",
"_away",
"=",
"False",
"self",
".",
"_current_fan_mode"... | [
305,
4
] | [
322,
77
] | python | en | ['en', 'en', 'en'] | True |
MqttClimate.config_schema | () | Return the config schema. | Return the config schema. | def config_schema():
"""Return the config schema."""
return PLATFORM_SCHEMA | [
"def",
"config_schema",
"(",
")",
":",
"return",
"PLATFORM_SCHEMA"
] | [
325,
4
] | [
327,
30
] | python | en | ['en', 'de', 'en'] | True |
MqttClimate.async_added_to_hass | (self) | Handle being added to Home Assistant. | Handle being added to Home Assistant. | async def async_added_to_hass(self):
"""Handle being added to Home Assistant."""
await super().async_added_to_hass()
await self._subscribe_topics() | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"await",
"self",
".",
"_subscribe_topics",
"(",
")"
] | [
329,
4
] | [
332,
38
] | 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.