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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
handle_integration_setup_info | (
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) | Handle integrations command. | Handle integrations command. | async def handle_integration_setup_info(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle integrations command."""
connection.send_result(
msg["id"],
[
{"domain": integration, "seconds": timedelta.total_seconds()}
for integra... | [
"async",
"def",
"handle_integration_setup_info",
"(",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"ActiveConnection",
",",
"msg",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"connection",
".",
"send_result",
"(",
"msg",
"[",
... | [
294,
0
] | [
304,
5
] | python | ca | ['fr', 'ca', 'en'] | False |
handle_ping | (
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) | Handle ping command. | Handle ping command. | def handle_ping(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle ping command."""
connection.send_message(pong_message(msg["id"])) | [
"def",
"handle_ping",
"(",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"ActiveConnection",
",",
"msg",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"connection",
".",
"send_message",
"(",
"pong_message",
"(",
"msg",
"[",
"\... | [
309,
0
] | [
313,
52
] | python | en | ['fr', 'en', 'en'] | True |
handle_render_template | (
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) | Handle render_template command. | Handle render_template command. | async def handle_render_template(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle render_template command."""
template_str = msg["template"]
template_obj = template.Template(template_str, hass) # type: ignore[no-untyped-call]
variables = msg.get("variable... | [
"async",
"def",
"handle_render_template",
"(",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"ActiveConnection",
",",
"msg",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"template_str",
"=",
"msg",
"[",
"\"template\"",
"]",
"te... | [
327,
0
] | [
385,
54
] | python | en | ['en', 'en', 'en'] | True |
handle_entity_source | (
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) | Handle entity source command. | Handle entity source command. | def handle_entity_source(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle entity source command."""
raw_sources = entity.entity_sources(hass)
entity_perm = connection.user.permissions.check_entity
if "entity_id" not in msg:
if connection.user.perm... | [
"def",
"handle_entity_source",
"(",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"ActiveConnection",
",",
"msg",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"raw_sources",
"=",
"entity",
".",
"entity_sources",
"(",
"hass",
")... | [
392,
0
] | [
430,
46
] | python | en | ['en', 'en', 'en'] | True |
handle_subscribe_trigger | (
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) | Handle subscribe trigger command. | Handle subscribe trigger command. | async def handle_subscribe_trigger(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle subscribe trigger command."""
# Circular dep
# pylint: disable=import-outside-toplevel
from homeassistant.helpers import trigger
trigger_config = await trigger.async_v... | [
"async",
"def",
"handle_subscribe_trigger",
"(",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"ActiveConnection",
",",
"msg",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"# Circular dep",
"# pylint: disable=import-outside-toplevel",
... | [
442,
0
] | [
479,
37
] | python | en | ['en', 'en', 'en'] | True |
handle_test_condition | (
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) | Handle test condition command. | Handle test condition command. | async def handle_test_condition(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle test condition command."""
# Circular dep
# pylint: disable=import-outside-toplevel
from homeassistant.helpers import condition
check_condition = await condition.async_fr... | [
"async",
"def",
"handle_test_condition",
"(",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"ActiveConnection",
",",
"msg",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"# Circular dep",
"# pylint: disable=import-outside-toplevel",
"fr... | [
491,
0
] | [
502,
5
] | python | en | ['en', 'en', 'en'] | True |
handle_execute_script | (
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) | Handle execute script command. | Handle execute script command. | async def handle_execute_script(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle execute script command."""
# Circular dep
# pylint: disable=import-outside-toplevel
from homeassistant.helpers.script import Script
context = connection.context(msg)
... | [
"async",
"def",
"handle_execute_script",
"(",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"ActiveConnection",
",",
"msg",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"# Circular dep",
"# pylint: disable=import-outside-toplevel",
"fr... | [
514,
0
] | [
525,
85
] | python | ca | ['ro', 'ca', 'en'] | False |
intranges_from_list | (list_) | Represent a list of integers as a sequence of ranges:
((start_0, end_0), (start_1, end_1), ...), such that the original
integers are exactly those x such that start_i <= x < end_i for some i.
Ranges are encoded as single integers (start << 32 | end), not as tuples.
| Represent a list of integers as a sequence of ranges:
((start_0, end_0), (start_1, end_1), ...), such that the original
integers are exactly those x such that start_i <= x < end_i for some i. | def intranges_from_list(list_):
"""Represent a list of integers as a sequence of ranges:
((start_0, end_0), (start_1, end_1), ...), such that the original
integers are exactly those x such that start_i <= x < end_i for some i.
Ranges are encoded as single integers (start << 32 | end), not as tuples.
... | [
"def",
"intranges_from_list",
"(",
"list_",
")",
":",
"sorted_list",
"=",
"sorted",
"(",
"list_",
")",
"ranges",
"=",
"[",
"]",
"last_write",
"=",
"-",
"1",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"sorted_list",
")",
")",
":",
"if",
"i",
"+",
"... | [
9,
0
] | [
28,
24
] | python | en | ['en', 'en', 'en'] | True |
intranges_contain | (int_, ranges) | Determine if `int_` falls into one of the ranges in `ranges`. | Determine if `int_` falls into one of the ranges in `ranges`. | def intranges_contain(int_, ranges):
"""Determine if `int_` falls into one of the ranges in `ranges`."""
tuple_ = _encode_range(int_, 0)
pos = bisect.bisect_left(ranges, tuple_)
# we could be immediately ahead of a tuple (start, end)
# with start < int_ <= end
if pos > 0:
left, right = _... | [
"def",
"intranges_contain",
"(",
"int_",
",",
"ranges",
")",
":",
"tuple_",
"=",
"_encode_range",
"(",
"int_",
",",
"0",
")",
"pos",
"=",
"bisect",
".",
"bisect_left",
"(",
"ranges",
",",
"tuple_",
")",
"# we could be immediately ahead of a tuple (start, end)",
... | [
37,
0
] | [
52,
16
] | python | en | ['en', 'en', 'en'] | True |
setup | (hass, config) | Set up the BloomSky integration. | Set up the BloomSky integration. | def setup(hass, config):
"""Set up the BloomSky integration."""
api_key = config[DOMAIN][CONF_API_KEY]
try:
bloomsky = BloomSky(api_key, hass.config.units.is_metric)
except RuntimeError:
return False
hass.data[DOMAIN] = bloomsky
for platform in PLATFORMS:
discovery.loa... | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"api_key",
"=",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_API_KEY",
"]",
"try",
":",
"bloomsky",
"=",
"BloomSky",
"(",
"api_key",
",",
"hass",
".",
"config",
".",
"units",
".",
"is_metric",
")",
"e... | [
33,
0
] | [
47,
15
] | python | en | ['en', 'da', 'en'] | True |
BloomSky.__init__ | (self, api_key, is_metric) | Initialize the BookSky. | Initialize the BookSky. | def __init__(self, api_key, is_metric):
"""Initialize the BookSky."""
self._api_key = api_key
self._endpoint_argument = "unit=intl" if is_metric else ""
self.devices = {}
self.is_metric = is_metric
_LOGGER.debug("Initial BloomSky device load")
self.refresh_devices... | [
"def",
"__init__",
"(",
"self",
",",
"api_key",
",",
"is_metric",
")",
":",
"self",
".",
"_api_key",
"=",
"api_key",
"self",
".",
"_endpoint_argument",
"=",
"\"unit=intl\"",
"if",
"is_metric",
"else",
"\"\"",
"self",
".",
"devices",
"=",
"{",
"}",
"self",
... | [
56,
4
] | [
63,
30
] | python | en | ['en', 'en', 'en'] | True |
BloomSky.refresh_devices | (self) | Use the API to retrieve a list of devices. | Use the API to retrieve a list of devices. | def refresh_devices(self):
"""Use the API to retrieve a list of devices."""
_LOGGER.debug("Fetching BloomSky update")
response = requests.get(
f"{self.API_URL}?{self._endpoint_argument}",
headers={AUTHORIZATION: self._api_key},
timeout=10,
)
if... | [
"def",
"refresh_devices",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Fetching BloomSky update\"",
")",
"response",
"=",
"requests",
".",
"get",
"(",
"f\"{self.API_URL}?{self._endpoint_argument}\"",
",",
"headers",
"=",
"{",
"AUTHORIZATION",
":",
"self",... | [
66,
4
] | [
83,
87
] | python | en | ['en', 'haw', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Homematic lock platform. | Set up the Homematic lock platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Homematic lock platform."""
if discovery_info is None:
return
devices = []
for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
devices.append(HMLock(conf))
add_entities(devices, True) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"devices",
"=",
"[",
"]",
"for",
"conf",
"in",
"discovery_info",
"[",
"ATTR_DISCOVER_... | [
7,
0
] | [
16,
31
] | python | en | ['en', 'da', 'en'] | True |
HMLock.is_locked | (self) | Return true if the lock is locked. | Return true if the lock is locked. | def is_locked(self):
"""Return true if the lock is locked."""
return not bool(self._hm_get_state()) | [
"def",
"is_locked",
"(",
"self",
")",
":",
"return",
"not",
"bool",
"(",
"self",
".",
"_hm_get_state",
"(",
")",
")"
] | [
23,
4
] | [
25,
45
] | python | en | ['en', 'mt', 'en'] | True |
HMLock.lock | (self, **kwargs) | Lock the lock. | Lock the lock. | def lock(self, **kwargs):
"""Lock the lock."""
self._hmdevice.lock() | [
"def",
"lock",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_hmdevice",
".",
"lock",
"(",
")"
] | [
27,
4
] | [
29,
29
] | python | en | ['en', 'la', 'en'] | True |
HMLock.unlock | (self, **kwargs) | Unlock the lock. | Unlock the lock. | def unlock(self, **kwargs):
"""Unlock the lock."""
self._hmdevice.unlock() | [
"def",
"unlock",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_hmdevice",
".",
"unlock",
"(",
")"
] | [
31,
4
] | [
33,
31
] | python | en | ['en', 'ms', 'en'] | True |
HMLock.open | (self, **kwargs) | Open the door latch. | Open the door latch. | def open(self, **kwargs):
"""Open the door latch."""
self._hmdevice.open() | [
"def",
"open",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_hmdevice",
".",
"open",
"(",
")"
] | [
35,
4
] | [
37,
29
] | python | en | ['en', 'nl', 'en'] | True |
HMLock._init_data_struct | (self) | Generate the data dictionary (self._data) from metadata. | Generate the data dictionary (self._data) from metadata. | def _init_data_struct(self):
"""Generate the data dictionary (self._data) from metadata."""
self._state = "STATE"
self._data.update({self._state: None}) | [
"def",
"_init_data_struct",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"\"STATE\"",
"self",
".",
"_data",
".",
"update",
"(",
"{",
"self",
".",
"_state",
":",
"None",
"}",
")"
] | [
39,
4
] | [
42,
46
] | python | en | ['en', 'en', 'en'] | True |
HMLock.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_OPEN | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_OPEN"
] | [
45,
4
] | [
47,
27
] | python | en | ['da', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up the Renault entities from config entry. | Set up the Renault entities from config entry. | async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the Renault entities from config entry."""
proxy: RenaultHub = hass.data[DOMAIN][config_entry.entry_id]
entities: list[RenaultSelectEntity] = [
Renau... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"proxy",
":",
"RenaultHub",
"=",
"hass",
".",
"data",
"[",
"DOM... | [
35,
0
] | [
48,
32
] | python | en | ['en', 'en', 'en'] | True |
_get_charge_mode_icon | (entity: RenaultSelectEntity) | Return the icon of this entity. | Return the icon of this entity. | def _get_charge_mode_icon(entity: RenaultSelectEntity) -> str:
"""Return the icon of this entity."""
if entity.data == "schedule_mode":
return "mdi:calendar-clock"
return "mdi:calendar-remove" | [
"def",
"_get_charge_mode_icon",
"(",
"entity",
":",
"RenaultSelectEntity",
")",
"->",
"str",
":",
"if",
"entity",
".",
"data",
"==",
"\"schedule_mode\"",
":",
"return",
"\"mdi:calendar-clock\"",
"return",
"\"mdi:calendar-remove\""
] | [
83,
0
] | [
87,
32
] | python | en | ['en', 'en', 'en'] | True |
RenaultSelectEntity.current_option | (self) | Return the selected entity option to represent the entity state. | Return the selected entity option to represent the entity state. | def current_option(self) -> str | None:
"""Return the selected entity option to represent the entity state."""
return cast(str, self.data) | [
"def",
"current_option",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"cast",
"(",
"str",
",",
"self",
".",
"data",
")"
] | [
59,
4
] | [
61,
35
] | python | en | ['en', 'en', 'en'] | True |
RenaultSelectEntity.data | (self) | Return the state of this entity. | Return the state of this entity. | def data(self) -> StateType:
"""Return the state of this entity."""
return self._get_data_attr(self.entity_description.data_key) | [
"def",
"data",
"(",
"self",
")",
"->",
"StateType",
":",
"return",
"self",
".",
"_get_data_attr",
"(",
"self",
".",
"entity_description",
".",
"data_key",
")"
] | [
64,
4
] | [
66,
68
] | python | en | ['en', 'en', 'en'] | True |
RenaultSelectEntity.icon | (self) | Icon handling. | Icon handling. | def icon(self) -> str | None:
"""Icon handling."""
return self.entity_description.icon_lambda(self) | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"self",
".",
"entity_description",
".",
"icon_lambda",
"(",
"self",
")"
] | [
69,
4
] | [
71,
56
] | python | en | ['en', 'ja', 'en'] | False |
RenaultSelectEntity.options | (self) | Return a set of selectable options. | Return a set of selectable options. | def options(self) -> list[str]:
"""Return a set of selectable options."""
return self.entity_description.options | [
"def",
"options",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
":",
"return",
"self",
".",
"entity_description",
".",
"options"
] | [
74,
4
] | [
76,
46
] | python | en | ['en', 'en', 'en'] | True |
RenaultSelectEntity.async_select_option | (self, option: str) | Change the selected option. | Change the selected option. | async def async_select_option(self, option: str) -> None:
"""Change the selected option."""
await self.vehicle.vehicle.set_charge_mode(option) | [
"async",
"def",
"async_select_option",
"(",
"self",
",",
"option",
":",
"str",
")",
"->",
"None",
":",
"await",
"self",
".",
"vehicle",
".",
"vehicle",
".",
"set_charge_mode",
"(",
"option",
")"
] | [
78,
4
] | [
80,
58
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_minimum_fields | (hass: HomeAssistant) | Test user config flow with minimum fields. | Test user config flow with minimum fields. | async def test_user_flow_minimum_fields(hass: HomeAssistant) -> None:
"""Test user config flow with minimum fields."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_i... | [
"async",
"def",
"test_user_flow_minimum_fields",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SO... | [
39,
0
] | [
58,
66
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_v3 | (hass: HomeAssistant) | Test user config flow with v3 API. | Test user config flow with v3 API. | async def test_user_flow_v3(hass: HomeAssistant) -> None:
"""Test user config flow with v3 API."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user"
d... | [
"async",
"def",
"test_user_flow_v3",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_USER",
... | [
61,
0
] | [
83,
66
] | python | en | ['en', 'pt', 'en'] | True |
test_user_flow_same_unique_ids | (hass: HomeAssistant) | Test user config flow with the same unique ID as an existing entry. | Test user config flow with the same unique ID as an existing entry. | async def test_user_flow_same_unique_ids(hass: HomeAssistant) -> None:
"""Test user config flow with the same unique ID as an existing entry."""
user_input = _get_config_schema(hass, MIN_CONFIG)(MIN_CONFIG)
MockConfigEntry(
domain=DOMAIN,
data=user_input,
source=SOURCE_USER,
... | [
"async",
"def",
"test_user_flow_same_unique_ids",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"user_input",
"=",
"_get_config_schema",
"(",
"hass",
",",
"MIN_CONFIG",
")",
"(",
"MIN_CONFIG",
")",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",... | [
86,
0
] | [
104,
51
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_cannot_connect | (hass: HomeAssistant) | Test user config flow when ClimaCell can't connect. | Test user config flow when ClimaCell can't connect. | async def test_user_flow_cannot_connect(hass: HomeAssistant) -> None:
"""Test user config flow when ClimaCell can't connect."""
with patch(
"homeassistant.components.climacell.config_flow.ClimaCellV4.realtime",
side_effect=CantConnectException,
):
result = await hass.config_entries.f... | [
"async",
"def",
"test_user_flow_cannot_connect",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"with",
"patch",
"(",
"\"homeassistant.components.climacell.config_flow.ClimaCellV4.realtime\"",
",",
"side_effect",
"=",
"CantConnectException",
",",
")",
":",
"re... | [
107,
0
] | [
120,
61
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_invalid_api | (hass: HomeAssistant) | Test user config flow when API key is invalid. | Test user config flow when API key is invalid. | async def test_user_flow_invalid_api(hass: HomeAssistant) -> None:
"""Test user config flow when API key is invalid."""
with patch(
"homeassistant.components.climacell.config_flow.ClimaCellV4.realtime",
side_effect=InvalidAPIKeyException,
):
result = await hass.config_entries.flow.as... | [
"async",
"def",
"test_user_flow_invalid_api",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"with",
"patch",
"(",
"\"homeassistant.components.climacell.config_flow.ClimaCellV4.realtime\"",
",",
"side_effect",
"=",
"InvalidAPIKeyException",
",",
")",
":",
"res... | [
123,
0
] | [
136,
68
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_rate_limited | (hass: HomeAssistant) | Test user config flow when API key is rate limited. | Test user config flow when API key is rate limited. | async def test_user_flow_rate_limited(hass: HomeAssistant) -> None:
"""Test user config flow when API key is rate limited."""
with patch(
"homeassistant.components.climacell.config_flow.ClimaCellV4.realtime",
side_effect=RateLimitedException,
):
result = await hass.config_entries.flo... | [
"async",
"def",
"test_user_flow_rate_limited",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"with",
"patch",
"(",
"\"homeassistant.components.climacell.config_flow.ClimaCellV4.realtime\"",
",",
"side_effect",
"=",
"RateLimitedException",
",",
")",
":",
"resu... | [
139,
0
] | [
152,
65
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_unknown_exception | (hass: HomeAssistant) | Test user config flow when unknown error occurs. | Test user config flow when unknown error occurs. | async def test_user_flow_unknown_exception(hass: HomeAssistant) -> None:
"""Test user config flow when unknown error occurs."""
with patch(
"homeassistant.components.climacell.config_flow.ClimaCellV4.realtime",
side_effect=UnknownException,
):
result = await hass.config_entries.flow.... | [
"async",
"def",
"test_user_flow_unknown_exception",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"with",
"patch",
"(",
"\"homeassistant.components.climacell.config_flow.ClimaCellV4.realtime\"",
",",
"side_effect",
"=",
"UnknownException",
",",
")",
":",
"res... | [
155,
0
] | [
168,
54
] | python | en | ['en', 'de', 'en'] | True |
test_options_flow | (hass: HomeAssistant) | Test options config flow for climacell. | Test options config flow for climacell. | async def test_options_flow(hass: HomeAssistant) -> None:
"""Test options config flow for climacell."""
user_config = _get_config_schema(hass)(MIN_CONFIG)
entry = MockConfigEntry(
domain=DOMAIN,
data=user_config,
source=SOURCE_USER,
unique_id=_get_unique_id(hass, user_config)... | [
"async",
"def",
"test_options_flow",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"user_config",
"=",
"_get_config_schema",
"(",
"hass",
")",
"(",
"MIN_CONFIG",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=... | [
171,
0
] | [
200,
44
] | python | en | ['en', 'en', 'en'] | True |
async_get_service | (
hass: HomeAssistant,
config: dict[str, Any],
discovery_info: dict[str, Any] | None = None,
) | Get the notification service. | Get the notification service. | async def async_get_service(
hass: HomeAssistant,
config: dict[str, Any],
discovery_info: dict[str, Any] | None = None,
) -> HuaweiLteSmsNotificationService | None:
"""Get the notification service."""
if discovery_info is None:
return None
router = hass.data[DOMAIN].routers[discovery_in... | [
"async",
"def",
"async_get_service",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
",",
"discovery_info",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
",",
")",
"->",
"HuaweiLteSmsNot... | [
20,
0
] | [
32,
67
] | python | en | ['en', 'en', 'en'] | True |
TestModel200Response.testModel200Response | (self) | Test Model200Response | Test Model200Response | def testModel200Response(self):
"""Test Model200Response"""
# FIXME: construct object with mandatory attributes with example values
# model = petstore_api.models.model200_response.Model200Response() # noqa: E501
pass | [
"def",
"testModel200Response",
"(",
"self",
")",
":",
"# FIXME: construct object with mandatory attributes with example values",
"# model = petstore_api.models.model200_response.Model200Response() # noqa: E501",
"pass"
] | [
30,
4
] | [
34,
12
] | python | en | ['en', 'no', 'en'] | False |
getctype | (var) |
Determines C type
|
Determines C type
| def getctype(var):
"""
Determines C type
"""
ctype = 'void'
if isfunction(var):
if 'result' in var:
a = var['result']
else:
a = var['name']
if a in var['vars']:
return getctype(var['vars'][a])
else:
errmess('getctype: fu... | [
"def",
"getctype",
"(",
"var",
")",
":",
"ctype",
"=",
"'void'",
"if",
"isfunction",
"(",
"var",
")",
":",
"if",
"'result'",
"in",
"var",
":",
"a",
"=",
"var",
"[",
"'result'",
"]",
"else",
":",
"a",
"=",
"var",
"[",
"'name'",
"]",
"if",
"a",
"... | [
242,
0
] | [
288,
16
] | python | en | ['en', 'error', 'th'] | False |
sign2map | (a, var) |
varname,ctype,atype
init,init.r,init.i,pytype
vardebuginfo,vardebugshowvalue,varshowvalue
varrfromat
intent
|
varname,ctype,atype
init,init.r,init.i,pytype
vardebuginfo,vardebugshowvalue,varshowvalue
varrfromat
intent
| def sign2map(a, var):
"""
varname,ctype,atype
init,init.r,init.i,pytype
vardebuginfo,vardebugshowvalue,varshowvalue
varrfromat
intent
"""
out_a = a
if isintent_out(var):
for k in var['intent']:
if k[:4] == 'out=':
out_a = k[4:]
brea... | [
"def",
"sign2map",
"(",
"a",
",",
"var",
")",
":",
"out_a",
"=",
"a",
"if",
"isintent_out",
"(",
"var",
")",
":",
"for",
"k",
"in",
"var",
"[",
"'intent'",
"]",
":",
"if",
"k",
"[",
":",
"4",
"]",
"==",
"'out='",
":",
"out_a",
"=",
"k",
"[",
... | [
507,
0
] | [
608,
14
] | python | en | ['en', 'error', 'th'] | False |
routsign2map | (rout) |
name,NAME,begintitle,endtitle
rname,ctype,rformat
routdebugshowvalue
|
name,NAME,begintitle,endtitle
rname,ctype,rformat
routdebugshowvalue
| def routsign2map(rout):
"""
name,NAME,begintitle,endtitle
rname,ctype,rformat
routdebugshowvalue
"""
global lcb_map
name = rout['name']
fname = getfortranname(rout)
ret = {'name': name,
'texname': name.replace('_', '\\_'),
'name_lower': name.lower(),
... | [
"def",
"routsign2map",
"(",
"rout",
")",
":",
"global",
"lcb_map",
"name",
"=",
"rout",
"[",
"'name'",
"]",
"fname",
"=",
"getfortranname",
"(",
"rout",
")",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'texname'",
":",
"name",
".",
"replace",
"(",
... | [
611,
0
] | [
689,
14
] | python | en | ['en', 'error', 'th'] | False |
modsign2map | (m) |
modulename
|
modulename
| def modsign2map(m):
"""
modulename
"""
if ismodule(m):
ret = {'f90modulename': m['name'],
'F90MODULENAME': m['name'].upper(),
'texf90modulename': m['name'].replace('_', '\\_')}
else:
ret = {'modulename': m['name'],
'MODULENAME': m['name'].... | [
"def",
"modsign2map",
"(",
"m",
")",
":",
"if",
"ismodule",
"(",
"m",
")",
":",
"ret",
"=",
"{",
"'f90modulename'",
":",
"m",
"[",
"'name'",
"]",
",",
"'F90MODULENAME'",
":",
"m",
"[",
"'name'",
"]",
".",
"upper",
"(",
")",
",",
"'texf90modulename'",... | [
692,
0
] | [
718,
14
] | python | en | ['en', 'error', 'th'] | False |
cb_routsign2map | (rout, um) |
name,begintitle,endtitle,argname
ctype,rctype,maxnofargs,nofoptargs,returncptr
|
name,begintitle,endtitle,argname
ctype,rctype,maxnofargs,nofoptargs,returncptr
| def cb_routsign2map(rout, um):
"""
name,begintitle,endtitle,argname
ctype,rctype,maxnofargs,nofoptargs,returncptr
"""
ret = {'name': 'cb_%s_in_%s' % (rout['name'], um),
'returncptr': ''}
if isintent_callback(rout):
if '_' in rout['name']:
F_FUNC = 'F_FUNC_US'
... | [
"def",
"cb_routsign2map",
"(",
"rout",
",",
"um",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"'cb_%s_in_%s'",
"%",
"(",
"rout",
"[",
"'name'",
"]",
",",
"um",
")",
",",
"'returncptr'",
":",
"''",
"}",
"if",
"isintent_callback",
"(",
"rout",
")",
":",
... | [
738,
0
] | [
817,
14
] | python | en | ['en', 'error', 'th'] | False |
load_json | (filename: str, default: list | dict | None = None) | Load JSON data from a file and return as dict or list.
Defaults to returning empty dict if file is not found.
| Load JSON data from a file and return as dict or list. | def load_json(filename: str, default: list | dict | None = None) -> list | dict:
"""Load JSON data from a file and return as dict or list.
Defaults to returning empty dict if file is not found.
"""
try:
with open(filename, encoding="utf-8") as fdesc:
return json.loads(fdesc.read()) ... | [
"def",
"load_json",
"(",
"filename",
":",
"str",
",",
"default",
":",
"list",
"|",
"dict",
"|",
"None",
"=",
"None",
")",
"->",
"list",
"|",
"dict",
":",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"fd... | [
24,
0
] | [
41,
45
] | python | en | ['en', 'en', 'en'] | True |
save_json | (
filename: str,
data: list | dict,
private: bool = False,
*,
encoder: type[json.JSONEncoder] | None = None,
) | Save JSON data to a file.
Returns True on success.
| Save JSON data to a file. | def save_json(
filename: str,
data: list | dict,
private: bool = False,
*,
encoder: type[json.JSONEncoder] | None = None,
) -> None:
"""Save JSON data to a file.
Returns True on success.
"""
try:
json_data = json.dumps(data, indent=4, cls=encoder)
except TypeError as err... | [
"def",
"save_json",
"(",
"filename",
":",
"str",
",",
"data",
":",
"list",
"|",
"dict",
",",
"private",
":",
"bool",
"=",
"False",
",",
"*",
",",
"encoder",
":",
"type",
"[",
"json",
".",
"JSONEncoder",
"]",
"|",
"None",
"=",
"None",
",",
")",
"-... | [
44,
0
] | [
84,
73
] | python | en | ['en', 'en', 'en'] | True |
format_unserializable_data | (data: dict[str, Any]) | Format output of find_paths in a friendly way.
Format is comma separated: <path>=<value>(<type>)
| Format output of find_paths in a friendly way. | def format_unserializable_data(data: dict[str, Any]) -> str:
"""Format output of find_paths in a friendly way.
Format is comma separated: <path>=<value>(<type>)
"""
return ", ".join(f"{path}={value}({type(value)}" for path, value in data.items()) | [
"def",
"format_unserializable_data",
"(",
"data",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"str",
":",
"return",
"\", \"",
".",
"join",
"(",
"f\"{path}={value}({type(value)}\"",
"for",
"path",
",",
"value",
"in",
"data",
".",
"items",
"(",
")",... | [
87,
0
] | [
92,
85
] | python | en | ['en', 'en', 'en'] | True |
find_paths_unserializable_data | (
bad_data: Any, *, dump: Callable[[Any], str] = json.dumps
) | Find the paths to unserializable data.
This method is slow! Only use for error handling.
| Find the paths to unserializable data. | def find_paths_unserializable_data(
bad_data: Any, *, dump: Callable[[Any], str] = json.dumps
) -> dict[str, Any]:
"""Find the paths to unserializable data.
This method is slow! Only use for error handling.
"""
to_process = deque([(bad_data, "$")])
invalid = {}
while to_process:
ob... | [
"def",
"find_paths_unserializable_data",
"(",
"bad_data",
":",
"Any",
",",
"*",
",",
"dump",
":",
"Callable",
"[",
"[",
"Any",
"]",
",",
"str",
"]",
"=",
"json",
".",
"dumps",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
":",
"to_process",
"=",
... | [
95,
0
] | [
141,
18
] | python | en | ['en', 'en', 'en'] | True |
async_update_programs_and_zones | (
hass: HomeAssistant, entry: ConfigEntry
) | Update program and zone DataUpdateCoordinators.
Program and zone updates always go together because of how linked they are:
programs affect zones and certain combinations of zones affect programs.
| Update program and zone DataUpdateCoordinators. | async def async_update_programs_and_zones(
hass: HomeAssistant, entry: ConfigEntry
) -> None:
"""Update program and zone DataUpdateCoordinators.
Program and zone updates always go together because of how linked they are:
programs affect zones and certain combinations of zones affect programs.
"""
... | [
"async",
"def",
"async_update_programs_and_zones",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"None",
":",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_COORDINATOR"... | [
56,
0
] | [
73,
5
] | python | en | ['en', 'sn', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up RainMachine as config entry. | Set up RainMachine as config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up RainMachine as config entry."""
hass.data.setdefault(DOMAIN, {DATA_CONTROLLER: {}, DATA_COORDINATOR: {}})
hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id] = {}
websession = aiohttp_client.async_get_clientsession(h... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"DATA_CONTROLLER",
":",
"{",
"}",
",",
"DATA_COORDINATOR",
":... | [
76,
0
] | [
160,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload an RainMachine config entry. | Unload an RainMachine config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload an RainMachine config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data[DOMAIN][DATA_COORDINATOR].pop(entry.entry_id)
return unload_ok | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"unload_ok",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLATFORMS",
")",
"if... | [
163,
0
] | [
168,
20
] | python | en | ['en', 'en', 'en'] | True |
async_reload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Handle an options update. | Handle an options update. | async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Handle an options update."""
await hass.config_entries.async_reload(entry.entry_id) | [
"async",
"def",
"async_reload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"None",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_reload",
"(",
"entry",
".",
"entry_id",
")"
] | [
171,
0
] | [
173,
58
] | python | en | ['en', 'en', 'en'] | True |
RainMachineEntity.__init__ | (
self,
coordinator: DataUpdateCoordinator,
controller: Controller,
description: EntityDescription,
) | Initialize. | Initialize. | def __init__(
self,
coordinator: DataUpdateCoordinator,
controller: Controller,
description: EntityDescription,
) -> None:
"""Initialize."""
super().__init__(coordinator)
self._attr_device_info = {
"identifiers": {(DOMAIN, controller.mac)},
... | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"DataUpdateCoordinator",
",",
"controller",
":",
"Controller",
",",
"description",
":",
"EntityDescription",
",",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"s... | [
179,
4
] | [
205,
45
] | python | en | ['en', 'en', 'it'] | False |
RainMachineEntity._handle_coordinator_update | (self) | Respond to a DataUpdateCoordinator update. | Respond to a DataUpdateCoordinator update. | def _handle_coordinator_update(self) -> None:
"""Respond to a DataUpdateCoordinator update."""
self.update_from_latest_data()
self.async_write_ha_state() | [
"def",
"_handle_coordinator_update",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"update_from_latest_data",
"(",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
208,
4
] | [
211,
35
] | python | en | ['en', 'de', 'en'] | True |
RainMachineEntity.async_added_to_hass | (self) | Handle entity which will be added. | Handle entity which will be added. | async def async_added_to_hass(self) -> None:
"""Handle entity which will be added."""
await super().async_added_to_hass()
self.update_from_latest_data() | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"self",
".",
"update_from_latest_data",
"(",
")"
] | [
213,
4
] | [
216,
38
] | python | en | ['en', 'en', 'en'] | True |
RainMachineEntity.update_from_latest_data | (self) | Update the state. | Update the state. | def update_from_latest_data(self) -> None:
"""Update the state."""
raise NotImplementedError | [
"def",
"update_from_latest_data",
"(",
"self",
")",
"->",
"None",
":",
"raise",
"NotImplementedError"
] | [
219,
4
] | [
221,
33
] | python | en | ['en', 'en', 'en'] | True |
BaseQemuXML.parse_dom | (self) | Parse xml information in :attr:`data` and return.
Returns:
dict: Parsed xml data. An empty dictionary when content is blank.
| Parse xml information in :attr:`data` and return. | def parse_dom(self):
"""Parse xml information in :attr:`data` and return.
Returns:
dict: Parsed xml data. An empty dictionary when content is blank.
"""
if self.dom is None:
return {}
domain = {}
for child in self.dom:
if len(child) =... | [
"def",
"parse_dom",
"(",
"self",
")",
":",
"if",
"self",
".",
"dom",
"is",
"None",
":",
"return",
"{",
"}",
"domain",
"=",
"{",
"}",
"for",
"child",
"in",
"self",
".",
"dom",
":",
"if",
"len",
"(",
"child",
")",
"==",
"0",
":",
"domain",
"[",
... | [
37,
4
] | [
52,
21
] | python | en | ['en', 'de', 'en'] | True |
_mock_config_entry_with_options_populated | () | Create a mock config entry with options populated. | Create a mock config entry with options populated. | def _mock_config_entry_with_options_populated():
"""Create a mock config entry with options populated."""
return MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: "mock_name", CONF_PORT: 12345},
options={
"filter": {
"include_domains": [
"fa... | [
"def",
"_mock_config_entry_with_options_populated",
"(",
")",
":",
"return",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_NAME",
":",
"\"mock_name\"",
",",
"CONF_PORT",
":",
"12345",
"}",
",",
"options",
"=",
"{",
"\"filter\"",
... | [
14,
0
] | [
32,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setup_in_bridge_mode | (hass, mock_get_source_ip) | Test we can setup a new instance in bridge mode. | Test we can setup a new instance in bridge mode. | async def test_setup_in_bridge_mode(hass, mock_get_source_ip):
"""Test we can setup a new instance in bridge mode."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
... | [
"async",
"def",
"test_setup_in_bridge_mode",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries... | [
35,
0
] | [
82,
48
] | python | en | ['en', 'en', 'en'] | True |
test_setup_in_bridge_mode_name_taken | (hass, mock_get_source_ip) | Test we can setup a new instance in bridge mode when the name is taken. | Test we can setup a new instance in bridge mode when the name is taken. | async def test_setup_in_bridge_mode_name_taken(hass, mock_get_source_ip):
"""Test we can setup a new instance in bridge mode when the name is taken."""
await setup.async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: SHORT_BRIDG... | [
"async",
"def",
"test_setup_in_bridge_mode_name_taken",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"doma... | [
85,
0
] | [
140,
48
] | python | en | ['en', 'en', 'en'] | True |
test_setup_creates_entries_for_accessory_mode_devices | (
hass, mock_get_source_ip
) | Test we can setup a new instance and we create entries for accessory mode devices. | Test we can setup a new instance and we create entries for accessory mode devices. | async def test_setup_creates_entries_for_accessory_mode_devices(
hass, mock_get_source_ip
):
"""Test we can setup a new instance and we create entries for accessory mode devices."""
hass.states.async_set("camera.one", "on")
hass.states.async_set("camera.existing", "on")
hass.states.async_set("lock.n... | [
"async",
"def",
"test_setup_creates_entries_for_accessory_mode_devices",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"camera.one\"",
",",
"\"on\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"camera.exi... | [
143,
0
] | [
232,
48
] | python | en | ['en', 'en', 'en'] | True |
test_import | (hass, mock_get_source_ip) | Test we can import instance. | Test we can import instance. | async def test_import(hass, mock_get_source_ip):
"""Test we can import instance."""
await setup.async_setup_component(hass, "persistent_notification", {})
ignored_entry = MockConfigEntry(domain=DOMAIN, data={}, source=SOURCE_IGNORE)
ignored_entry.add_to_hass(hass)
entry = MockConfigEntry(
d... | [
"async",
"def",
"test_import",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"ignored_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DO... | [
235,
0
] | [
275,
48
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow_exclude_mode_advanced | (auto_start, hass, mock_get_source_ip) | Test config flow options in exclude mode with advanced options. | Test config flow options in exclude mode with advanced options. | async def test_options_flow_exclude_mode_advanced(auto_start, hass, mock_get_source_ip):
"""Test config flow options in exclude mode with advanced options."""
config_entry = _mock_config_entry_with_options_populated()
config_entry.add_to_hass(hass)
hass.states.async_set("climate.old", "off")
await... | [
"async",
"def",
"test_options_flow_exclude_mode_advanced",
"(",
"auto_start",
",",
"hass",
",",
"mock_get_source_ip",
")",
":",
"config_entry",
"=",
"_mock_config_entry_with_options_populated",
"(",
")",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"hass",
".",... | [
279,
0
] | [
327,
5
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow_exclude_mode_basic | (hass, mock_get_source_ip) | Test config flow options in exclude mode. | Test config flow options in exclude mode. | async def test_options_flow_exclude_mode_basic(hass, mock_get_source_ip):
"""Test config flow options in exclude mode."""
config_entry = _mock_config_entry_with_options_populated()
config_entry.add_to_hass(hass)
hass.states.async_set("climate.old", "off")
await hass.async_block_till_done()
re... | [
"async",
"def",
"test_options_flow_exclude_mode_basic",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"config_entry",
"=",
"_mock_config_entry_with_options_populated",
"(",
")",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"hass",
".",
"states",
".",
"asy... | [
330,
0
] | [
368,
5
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow_devices | (
mock_hap, hass, demo_cleanup, device_reg, entity_reg, mock_get_source_ip
) | Test devices can be bridged. | Test devices can be bridged. | async def test_options_flow_devices(
mock_hap, hass, demo_cleanup, device_reg, entity_reg, mock_get_source_ip
):
"""Test devices can be bridged."""
config_entry = _mock_config_entry_with_options_populated()
config_entry.add_to_hass(hass)
demo_config_entry = MockConfigEntry(domain="domain")
demo... | [
"async",
"def",
"test_options_flow_devices",
"(",
"mock_hap",
",",
"hass",
",",
"demo_cleanup",
",",
"device_reg",
",",
"entity_reg",
",",
"mock_get_source_ip",
")",
":",
"config_entry",
"=",
"_mock_config_entry_with_options_populated",
"(",
")",
"config_entry",
".",
... | [
371,
0
] | [
432,
5
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow_devices_preserved_when_advanced_off | (
mock_hap, hass, mock_get_source_ip
) | Test devices are preserved if they were added in advanced mode but it was turned off. | Test devices are preserved if they were added in advanced mode but it was turned off. | async def test_options_flow_devices_preserved_when_advanced_off(
mock_hap, hass, mock_get_source_ip
):
"""Test devices are preserved if they were added in advanced mode but it was turned off."""
config_entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: "mock_name", CONF_PORT: 12345},
... | [
"async",
"def",
"test_options_flow_devices_preserved_when_advanced_off",
"(",
"mock_hap",
",",
"hass",
",",
"mock_get_source_ip",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_NAME",
":",
"\"mock_name\"",
... | [
435,
0
] | [
502,
5
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow_include_mode_basic | (hass, mock_get_source_ip) | Test config flow options in include mode. | Test config flow options in include mode. | async def test_options_flow_include_mode_basic(hass, mock_get_source_ip):
"""Test config flow options in include mode."""
config_entry = _mock_config_entry_with_options_populated()
config_entry.add_to_hass(hass)
hass.states.async_set("climate.old", "off")
hass.states.async_set("climate.new", "off"... | [
"async",
"def",
"test_options_flow_include_mode_basic",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"config_entry",
"=",
"_mock_config_entry_with_options_populated",
"(",
")",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"hass",
".",
"states",
".",
"asy... | [
505,
0
] | [
545,
5
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow_exclude_mode_with_cameras | (hass, mock_get_source_ip) | Test config flow options in exclude mode with cameras. | Test config flow options in exclude mode with cameras. | async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
"""Test config flow options in exclude mode with cameras."""
config_entry = _mock_config_entry_with_options_populated()
config_entry.add_to_hass(hass)
hass.states.async_set("climate.old", "off")
hass.states.async_set(... | [
"async",
"def",
"test_options_flow_exclude_mode_with_cameras",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"config_entry",
"=",
"_mock_config_entry_with_options_populated",
"(",
")",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"hass",
".",
"states",
".",... | [
548,
0
] | [
648,
5
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow_include_mode_with_cameras | (hass, mock_get_source_ip) | Test config flow options in include mode with cameras. | Test config flow options in include mode with cameras. | async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
"""Test config flow options in include mode with cameras."""
config_entry = _mock_config_entry_with_options_populated()
config_entry.add_to_hass(hass)
hass.states.async_set("climate.old", "off")
hass.states.async_set(... | [
"async",
"def",
"test_options_flow_include_mode_with_cameras",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"config_entry",
"=",
"_mock_config_entry_with_options_populated",
"(",
")",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"hass",
".",
"states",
".",... | [
651,
0
] | [
775,
5
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow_blocked_when_from_yaml | (hass, mock_get_source_ip) | Test config flow options. | Test config flow options. | async def test_options_flow_blocked_when_from_yaml(hass, mock_get_source_ip):
"""Test config flow options."""
config_entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: "mock_name", CONF_PORT: 12345},
options={
"auto_start": True,
"devices": [],
... | [
"async",
"def",
"test_options_flow_blocked_when_from_yaml",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_NAME",
":",
"\"mock_name\"",
",",
"CONF_PORT",
":",
"12... | [
778,
0
] | [
815,
74
] | python | en | ['en', 'fr', 'en'] | True |
test_options_flow_include_mode_basic_accessory | (hass, mock_get_source_ip) | Test config flow options in include mode with a single accessory. | Test config flow options in include mode with a single accessory. | async def test_options_flow_include_mode_basic_accessory(hass, mock_get_source_ip):
"""Test config flow options in include mode with a single accessory."""
config_entry = _mock_config_entry_with_options_populated()
config_entry.add_to_hass(hass)
hass.states.async_set("media_player.tv", "off")
hass... | [
"async",
"def",
"test_options_flow_include_mode_basic_accessory",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"config_entry",
"=",
"_mock_config_entry_with_options_populated",
"(",
")",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"hass",
".",
"states",
"... | [
818,
0
] | [
870,
5
] | python | en | ['en', 'en', 'en'] | True |
test_converting_bridge_to_accessory_mode | (hass, hk_driver, mock_get_source_ip) | Test we can convert a bridge to accessory mode. | Test we can convert a bridge to accessory mode. | async def test_converting_bridge_to_accessory_mode(hass, hk_driver, mock_get_source_ip):
"""Test we can convert a bridge to accessory mode."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_... | [
"async",
"def",
"test_converting_bridge_to_accessory_mode",
"(",
"hass",
",",
"hk_driver",
",",
"mock_get_source_ip",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await... | [
873,
0
] | [
975,
48
] | python | en | ['en', 'en', 'en'] | True |
_get_schema_default | (schema, key_name) | Iterate schema to find a key. | Iterate schema to find a key. | def _get_schema_default(schema, key_name):
"""Iterate schema to find a key."""
for schema_key in schema:
if schema_key == key_name:
return schema_key.default()
raise KeyError(f"{key_name} not found in schema") | [
"def",
"_get_schema_default",
"(",
"schema",
",",
"key_name",
")",
":",
"for",
"schema_key",
"in",
"schema",
":",
"if",
"schema_key",
"==",
"key_name",
":",
"return",
"schema_key",
".",
"default",
"(",
")",
"raise",
"KeyError",
"(",
"f\"{key_name} not found in s... | [
978,
0
] | [
983,
53
] | python | en | ['en', 'co', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up Z-Wave Select entity from Config Entry. | Set up Z-Wave Select entity from Config Entry. | async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up Z-Wave Select entity from Config Entry."""
client: ZwaveClient = hass.data[DOMAIN][config_entry.entry_id][DATA_CLIENT]
@callback
def async_add_select(in... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"client",
":",
"ZwaveClient",
"=",
"hass",
".",
"data",
"[",
"D... | [
18,
0
] | [
42,
5
] | python | en | ['en', 'en', 'en'] | True |
ZwaveSelectEntity.__init__ | (
self, config_entry: ConfigEntry, client: ZwaveClient, info: ZwaveDiscoveryInfo
) | Initialize a ZwaveSelectEntity entity. | Initialize a ZwaveSelectEntity entity. | def __init__(
self, config_entry: ConfigEntry, client: ZwaveClient, info: ZwaveDiscoveryInfo
) -> None:
"""Initialize a ZwaveSelectEntity entity."""
super().__init__(config_entry, client, info)
# Entity class attributes
self._attr_name = self.generate_name(include_value_name... | [
"def",
"__init__",
"(",
"self",
",",
"config_entry",
":",
"ConfigEntry",
",",
"client",
":",
"ZwaveClient",
",",
"info",
":",
"ZwaveDiscoveryInfo",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"config_entry",
",",
"client",
",",
"info",... | [
48,
4
] | [
56,
83
] | python | cs | ['en', 'cs', 'it'] | False |
ZwaveSelectEntity.current_option | (self) | Return the selected entity option to represent the entity state. | Return the selected entity option to represent the entity state. | def current_option(self) -> str | None:
"""Return the selected entity option to represent the entity state."""
if self.info.primary_value.value is None:
return None
return str(
self.info.primary_value.metadata.states.get(
str(self.info.primary_value.value)... | [
"def",
"current_option",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"if",
"self",
".",
"info",
".",
"primary_value",
".",
"value",
"is",
"None",
":",
"return",
"None",
"return",
"str",
"(",
"self",
".",
"info",
".",
"primary_value",
".",
"metadat... | [
59,
4
] | [
67,
9
] | python | en | ['en', 'en', 'en'] | True |
ZwaveSelectEntity.async_select_option | (self, option: str | int) | Change the selected option. | Change the selected option. | async def async_select_option(self, option: str | int) -> None:
"""Change the selected option."""
key = next(
key
for key, val in self.info.primary_value.metadata.states.items()
if val == option
)
await self.info.node.async_set_value(self.info.primary_... | [
"async",
"def",
"async_select_option",
"(",
"self",
",",
"option",
":",
"str",
"|",
"int",
")",
"->",
"None",
":",
"key",
"=",
"next",
"(",
"key",
"for",
"key",
",",
"val",
"in",
"self",
".",
"info",
".",
"primary_value",
".",
"metadata",
".",
"state... | [
69,
4
] | [
76,
79
] | python | en | ['en', 'en', 'en'] | True |
ZwaveDefaultToneSelectEntity.__init__ | (
self, config_entry: ConfigEntry, client: ZwaveClient, info: ZwaveDiscoveryInfo
) | Initialize a ZwaveDefaultToneSelectEntity entity. | Initialize a ZwaveDefaultToneSelectEntity entity. | def __init__(
self, config_entry: ConfigEntry, client: ZwaveClient, info: ZwaveDiscoveryInfo
) -> None:
"""Initialize a ZwaveDefaultToneSelectEntity entity."""
super().__init__(config_entry, client, info)
self._tones_value = self.get_zwave_value(
"toneId", command_class=C... | [
"def",
"__init__",
"(",
"self",
",",
"config_entry",
":",
"ConfigEntry",
",",
"client",
":",
"ZwaveClient",
",",
"info",
":",
"ZwaveDiscoveryInfo",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"config_entry",
",",
"client",
",",
"info",... | [
82,
4
] | [
94,
9
] | python | en | ['en', 'fr', 'en'] | True |
ZwaveDefaultToneSelectEntity.options | (self) | Return a set of selectable options. | Return a set of selectable options. | def options(self) -> list[str]:
"""Return a set of selectable options."""
# We know we can assert because this value is part of the discovery schema
assert self._tones_value
return [
val
for key, val in self._tones_value.metadata.states.items()
if int(... | [
"def",
"options",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
":",
"# We know we can assert because this value is part of the discovery schema",
"assert",
"self",
".",
"_tones_value",
"return",
"[",
"val",
"for",
"key",
",",
"val",
"in",
"self",
".",
"_tones_... | [
97,
4
] | [
105,
9
] | python | en | ['en', 'en', 'en'] | True |
ZwaveDefaultToneSelectEntity.current_option | (self) | Return the selected entity option to represent the entity state. | Return the selected entity option to represent the entity state. | def current_option(self) -> str | None:
"""Return the selected entity option to represent the entity state."""
# We know we can assert because this value is part of the discovery schema
assert self._tones_value
return str(
self._tones_value.metadata.states.get(
... | [
"def",
"current_option",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"# We know we can assert because this value is part of the discovery schema",
"assert",
"self",
".",
"_tones_value",
"return",
"str",
"(",
"self",
".",
"_tones_value",
".",
"metadata",
".",
"sta... | [
108,
4
] | [
116,
9
] | python | en | ['en', 'en', 'en'] | True |
ZwaveDefaultToneSelectEntity.async_select_option | (self, option: str | int) | Change the selected option. | Change the selected option. | async def async_select_option(self, option: str | int) -> None:
"""Change the selected option."""
# We know we can assert because this value is part of the discovery schema
assert self._tones_value
key = next(
key
for key, val in self._tones_value.metadata.states.... | [
"async",
"def",
"async_select_option",
"(",
"self",
",",
"option",
":",
"str",
"|",
"int",
")",
"->",
"None",
":",
"# We know we can assert because this value is part of the discovery schema",
"assert",
"self",
".",
"_tones_value",
"key",
"=",
"next",
"(",
"key",
"f... | [
118,
4
] | [
127,
79
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up device tracker for UniFi component. | Set up device tracker for UniFi component. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up device tracker for UniFi component."""
controller = hass.data[UNIFI_DOMAIN][config_entry.entry_id]
controller.entities[DOMAIN] = {CLIENT_TRACKER: set(), DEVICE_TRACKER: set()}
@callback
def items_added(
clients: ... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"controller",
"=",
"hass",
".",
"data",
"[",
"UNIFI_DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"controller",
".",
"entities",
"[",
"DOMAIN... | [
70,
0
] | [
91,
17
] | python | en | ['en', 'en', 'en'] | True |
add_client_entities | (controller, async_add_entities, clients) | Add new client tracker entities from the controller. | Add new client tracker entities from the controller. | def add_client_entities(controller, async_add_entities, clients):
"""Add new client tracker entities from the controller."""
trackers = []
for mac in clients:
if mac in controller.entities[DOMAIN][UniFiClientTracker.TYPE]:
continue
client = controller.api.clients[mac]
... | [
"def",
"add_client_entities",
"(",
"controller",
",",
"async_add_entities",
",",
"clients",
")",
":",
"trackers",
"=",
"[",
"]",
"for",
"mac",
"in",
"clients",
":",
"if",
"mac",
"in",
"controller",
".",
"entities",
"[",
"DOMAIN",
"]",
"[",
"UniFiClientTracke... | [
95,
0
] | [
118,
36
] | python | en | ['en', 'en', 'en'] | True |
add_device_entities | (controller, async_add_entities, devices) | Add new device tracker entities from the controller. | Add new device tracker entities from the controller. | def add_device_entities(controller, async_add_entities, devices):
"""Add new device tracker entities from the controller."""
trackers = []
for mac in devices:
if mac in controller.entities[DOMAIN][UniFiDeviceTracker.TYPE]:
continue
device = controller.api.devices[mac]
t... | [
"def",
"add_device_entities",
"(",
"controller",
",",
"async_add_entities",
",",
"devices",
")",
":",
"trackers",
"=",
"[",
"]",
"for",
"mac",
"in",
"devices",
":",
"if",
"mac",
"in",
"controller",
".",
"entities",
"[",
"DOMAIN",
"]",
"[",
"UniFiDeviceTracke... | [
122,
0
] | [
134,
36
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker.__init__ | (self, client, controller) | Set up tracked client. | Set up tracked client. | def __init__(self, client, controller):
"""Set up tracked client."""
super().__init__(client, controller)
self.heartbeat_check = False
self._is_connected = False
self._controller_connection_state_changed = False
if client.last_seen:
self._is_connected = (
... | [
"def",
"__init__",
"(",
"self",
",",
"client",
",",
"controller",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"client",
",",
"controller",
")",
"self",
".",
"heartbeat_check",
"=",
"False",
"self",
".",
"_is_connected",
"=",
"False",
"self",
".",
... | [
143,
4
] | [
159,
49
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker.async_added_to_hass | (self) | Watch object when added. | Watch object when added. | async def async_added_to_hass(self) -> None:
"""Watch object when added."""
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self.controller.signal_heartbeat_missed}_{self.unique_id}",
self._make_disconnected,
)
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"{self.controller.signal_heartbeat_missed}_{self.unique_id}\"",
",",
"self",
".",
"_make_discon... | [
161,
4
] | [
170,
43
] | python | en | ['en', 'fy', 'en'] | True |
UniFiClientTracker.async_will_remove_from_hass | (self) | Disconnect object when removed. | Disconnect object when removed. | async def async_will_remove_from_hass(self) -> None:
"""Disconnect object when removed."""
self.controller.async_heartbeat(self.unique_id)
await super().async_will_remove_from_hass() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"controller",
".",
"async_heartbeat",
"(",
"self",
".",
"unique_id",
")",
"await",
"super",
"(",
")",
".",
"async_will_remove_from_hass",
"(",
")"
] | [
172,
4
] | [
175,
51
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker.async_signal_reachable_callback | (self) | Call when controller connection state change. | Call when controller connection state change. | def async_signal_reachable_callback(self) -> None:
"""Call when controller connection state change."""
self._controller_connection_state_changed = True
super().async_signal_reachable_callback() | [
"def",
"async_signal_reachable_callback",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_controller_connection_state_changed",
"=",
"True",
"super",
"(",
")",
".",
"async_signal_reachable_callback",
"(",
")"
] | [
178,
4
] | [
181,
49
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker.async_update_callback | (self) | Update the clients state. | Update the clients state. | def async_update_callback(self) -> None:
"""Update the clients state."""
if self._controller_connection_state_changed:
self._controller_connection_state_changed = False
if self.controller.available:
self.schedule_update = True
else:
... | [
"def",
"async_update_callback",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_controller_connection_state_changed",
":",
"self",
".",
"_controller_connection_state_changed",
"=",
"False",
"if",
"self",
".",
"controller",
".",
"available",
":",
"self",
... | [
184,
4
] | [
224,
39
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker._make_disconnected | (self, *_) | No heart beat by device. | No heart beat by device. | def _make_disconnected(self, *_):
"""No heart beat by device."""
self._is_connected = False
self.async_write_ha_state() | [
"def",
"_make_disconnected",
"(",
"self",
",",
"*",
"_",
")",
":",
"self",
".",
"_is_connected",
"=",
"False",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
227,
4
] | [
230,
35
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker.is_connected | (self) | Return true if the client is connected to the network. | Return true if the client is connected to the network. | def is_connected(self):
"""Return true if the client is connected to the network."""
if (
not self.is_wired
and self.client.essid
and self.controller.option_ssid_filter
and self.client.essid not in self.controller.option_ssid_filter
):
... | [
"def",
"is_connected",
"(",
"self",
")",
":",
"if",
"(",
"not",
"self",
".",
"is_wired",
"and",
"self",
".",
"client",
".",
"essid",
"and",
"self",
".",
"controller",
".",
"option_ssid_filter",
"and",
"self",
".",
"client",
".",
"essid",
"not",
"in",
"... | [
233,
4
] | [
243,
33
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker.source_type | (self) | Return the source type of the client. | Return the source type of the client. | def source_type(self):
"""Return the source type of the client."""
return SOURCE_TYPE_ROUTER | [
"def",
"source_type",
"(",
"self",
")",
":",
"return",
"SOURCE_TYPE_ROUTER"
] | [
246,
4
] | [
248,
33
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker.unique_id | (self) | Return a unique identifier for this client. | Return a unique identifier for this client. | def unique_id(self) -> str:
"""Return a unique identifier for this client."""
return f"{self.client.mac}-{self.controller.site}" | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{self.client.mac}-{self.controller.site}\""
] | [
251,
4
] | [
253,
58
] | python | en | ['en', 'fr', 'en'] | True |
UniFiClientTracker.extra_state_attributes | (self) | Return the client state attributes. | Return the client state attributes. | def extra_state_attributes(self):
"""Return the client state attributes."""
raw = self.client.raw
attributes_to_check = CLIENT_STATIC_ATTRIBUTES
if self.is_connected:
attributes_to_check = CLIENT_CONNECTED_ALL_ATTRIBUTES
attributes = {k: raw[k] for k in attributes_t... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"raw",
"=",
"self",
".",
"client",
".",
"raw",
"attributes_to_check",
"=",
"CLIENT_STATIC_ATTRIBUTES",
"if",
"self",
".",
"is_connected",
":",
"attributes_to_check",
"=",
"CLIENT_CONNECTED_ALL_ATTRIBUTES",
"attri... | [
256,
4
] | [
267,
25
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker.ip_address | (self) | Return the primary ip address of the device. | Return the primary ip address of the device. | def ip_address(self) -> str:
"""Return the primary ip address of the device."""
return self.client.raw.get("ip") | [
"def",
"ip_address",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"client",
".",
"raw",
".",
"get",
"(",
"\"ip\"",
")"
] | [
270,
4
] | [
272,
40
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker.mac_address | (self) | Return the mac address of the device. | Return the mac address of the device. | def mac_address(self) -> str:
"""Return the mac address of the device."""
return self.client.raw.get("mac") | [
"def",
"mac_address",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"client",
".",
"raw",
".",
"get",
"(",
"\"mac\"",
")"
] | [
275,
4
] | [
277,
41
] | python | en | ['en', 'en', 'en'] | True |
UniFiClientTracker.hostname | (self) | Return hostname of the device. | Return hostname of the device. | def hostname(self) -> str:
"""Return hostname of the device."""
return self.client.raw.get("hostname") | [
"def",
"hostname",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"client",
".",
"raw",
".",
"get",
"(",
"\"hostname\"",
")"
] | [
280,
4
] | [
282,
46
] | python | en | ['en', 'sl', 'en'] | True |
UniFiClientTracker.options_updated | (self) | Config entry options are updated, remove entity if option is disabled. | Config entry options are updated, remove entity if option is disabled. | async def options_updated(self) -> None:
"""Config entry options are updated, remove entity if option is disabled."""
if not self.controller.option_track_clients:
await self.remove_item({self.client.mac})
elif self.is_wired:
if not self.controller.option_track_wired_clie... | [
"async",
"def",
"options_updated",
"(",
"self",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"controller",
".",
"option_track_clients",
":",
"await",
"self",
".",
"remove_item",
"(",
"{",
"self",
".",
"client",
".",
"mac",
"}",
")",
"elif",
"self",
... | [
284,
4
] | [
297,
53
] | python | en | ['en', 'en', 'en'] | True |
UniFiDeviceTracker.__init__ | (self, device, controller) | Set up tracked device. | Set up tracked device. | def __init__(self, device, controller):
"""Set up tracked device."""
super().__init__(device, controller)
self.device = self._item
self._is_connected = device.state == 1
self._controller_connection_state_changed = False
self.schedule_update = False | [
"def",
"__init__",
"(",
"self",
",",
"device",
",",
"controller",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
",",
"controller",
")",
"self",
".",
"device",
"=",
"self",
".",
"_item",
"self",
".",
"_is_connected",
"=",
"device",
".",
... | [
306,
4
] | [
313,
36
] | python | en | ['en', 'en', 'en'] | True |
UniFiDeviceTracker.async_added_to_hass | (self) | Watch object when added. | Watch object when added. | async def async_added_to_hass(self) -> None:
"""Watch object when added."""
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self.controller.signal_heartbeat_missed}_{self.unique_id}",
self._make_disconnected,
)
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"{self.controller.signal_heartbeat_missed}_{self.unique_id}\"",
",",
"self",
".",
"_make_discon... | [
315,
4
] | [
324,
43
] | python | en | ['en', 'fy', 'en'] | True |
UniFiDeviceTracker.async_will_remove_from_hass | (self) | Disconnect object when removed. | Disconnect object when removed. | async def async_will_remove_from_hass(self) -> None:
"""Disconnect object when removed."""
self.controller.async_heartbeat(self.unique_id)
await super().async_will_remove_from_hass() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"controller",
".",
"async_heartbeat",
"(",
"self",
".",
"unique_id",
")",
"await",
"super",
"(",
")",
".",
"async_will_remove_from_hass",
"(",
")"
] | [
326,
4
] | [
329,
51
] | python | en | ['en', 'en', 'en'] | True |
UniFiDeviceTracker.async_signal_reachable_callback | (self) | Call when controller connection state change. | Call when controller connection state change. | def async_signal_reachable_callback(self) -> None:
"""Call when controller connection state change."""
self._controller_connection_state_changed = True
super().async_signal_reachable_callback() | [
"def",
"async_signal_reachable_callback",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_controller_connection_state_changed",
"=",
"True",
"super",
"(",
")",
".",
"async_signal_reachable_callback",
"(",
")"
] | [
332,
4
] | [
335,
49
] | python | en | ['en', 'en', 'en'] | True |
UniFiDeviceTracker.async_update_callback | (self) | Update the devices' state. | Update the devices' state. | def async_update_callback(self) -> None:
"""Update the devices' state."""
if self._controller_connection_state_changed:
self._controller_connection_state_changed = False
if self.controller.available:
if self._is_connected:
self.schedule_updat... | [
"def",
"async_update_callback",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_controller_connection_state_changed",
":",
"self",
".",
"_controller_connection_state_changed",
"=",
"False",
"if",
"self",
".",
"controller",
".",
"available",
":",
"if",
"s... | [
338,
4
] | [
369,
39
] | 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.