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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
GdacsFeedEntityManager.async_stop | (self) | Stop this feed entity manager from refreshing. | Stop this feed entity manager from refreshing. | async def async_stop(self):
"""Stop this feed entity manager from refreshing."""
for unsub_dispatcher in self.listeners:
unsub_dispatcher()
self.listeners = []
if self._track_time_remove_callback:
self._track_time_remove_callback()
_LOGGER.debug("Feed enti... | [
"async",
"def",
"async_stop",
"(",
"self",
")",
":",
"for",
"unsub_dispatcher",
"in",
"self",
".",
"listeners",
":",
"unsub_dispatcher",
"(",
")",
"self",
".",
"listeners",
"=",
"[",
"]",
"if",
"self",
".",
"_track_time_remove_callback",
":",
"self",
".",
... | [
167,
4
] | [
174,
52
] | python | en | ['en', 'en', 'en'] | True |
GdacsFeedEntityManager.async_event_new_entity | (self) | Return manager specific event to signal new entity. | Return manager specific event to signal new entity. | def async_event_new_entity(self):
"""Return manager specific event to signal new entity."""
return f"gdacs_new_geolocation_{self._config_entry_id}" | [
"def",
"async_event_new_entity",
"(",
"self",
")",
":",
"return",
"f\"gdacs_new_geolocation_{self._config_entry_id}\""
] | [
177,
4
] | [
179,
63
] | python | en | ['en', 'en', 'en'] | True |
GdacsFeedEntityManager.get_entry | (self, external_id) | Get feed entry by external id. | Get feed entry by external id. | def get_entry(self, external_id):
"""Get feed entry by external id."""
return self._feed_manager.feed_entries.get(external_id) | [
"def",
"get_entry",
"(",
"self",
",",
"external_id",
")",
":",
"return",
"self",
".",
"_feed_manager",
".",
"feed_entries",
".",
"get",
"(",
"external_id",
")"
] | [
181,
4
] | [
183,
63
] | python | en | ['en', 'en', 'en'] | True |
GdacsFeedEntityManager.status_info | (self) | Return latest status update info received. | Return latest status update info received. | def status_info(self):
"""Return latest status update info received."""
return self._status_info | [
"def",
"status_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_status_info"
] | [
185,
4
] | [
187,
32
] | python | co | ['es', 'co', 'en'] | False |
GdacsFeedEntityManager._generate_entity | (self, external_id) | Generate new entity. | Generate new entity. | async def _generate_entity(self, external_id):
"""Generate new entity."""
async_dispatcher_send(
self._hass,
self.async_event_new_entity(),
self,
self._config_entry.unique_id,
external_id,
) | [
"async",
"def",
"_generate_entity",
"(",
"self",
",",
"external_id",
")",
":",
"async_dispatcher_send",
"(",
"self",
".",
"_hass",
",",
"self",
".",
"async_event_new_entity",
"(",
")",
",",
"self",
",",
"self",
".",
"_config_entry",
".",
"unique_id",
",",
"e... | [
189,
4
] | [
197,
9
] | python | en | ['en', 'en', 'en'] | True |
GdacsFeedEntityManager._update_entity | (self, external_id) | Update entity. | Update entity. | async def _update_entity(self, external_id):
"""Update entity."""
async_dispatcher_send(self._hass, f"gdacs_update_{external_id}") | [
"async",
"def",
"_update_entity",
"(",
"self",
",",
"external_id",
")",
":",
"async_dispatcher_send",
"(",
"self",
".",
"_hass",
",",
"f\"gdacs_update_{external_id}\"",
")"
] | [
199,
4
] | [
201,
72
] | python | en | ['es', 'en', 'en'] | False |
GdacsFeedEntityManager._remove_entity | (self, external_id) | Remove entity. | Remove entity. | async def _remove_entity(self, external_id):
"""Remove entity."""
async_dispatcher_send(self._hass, f"gdacs_delete_{external_id}") | [
"async",
"def",
"_remove_entity",
"(",
"self",
",",
"external_id",
")",
":",
"async_dispatcher_send",
"(",
"self",
".",
"_hass",
",",
"f\"gdacs_delete_{external_id}\"",
")"
] | [
203,
4
] | [
205,
72
] | python | en | ['es', 'it', 'en'] | False |
GdacsFeedEntityManager._status_update | (self, status_info) | Propagate status update. | Propagate status update. | async def _status_update(self, status_info):
"""Propagate status update."""
_LOGGER.debug("Status update received: %s", status_info)
self._status_info = status_info
async_dispatcher_send(self._hass, f"gdacs_status_{self._config_entry_id}") | [
"async",
"def",
"_status_update",
"(",
"self",
",",
"status_info",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Status update received: %s\"",
",",
"status_info",
")",
"self",
".",
"_status_info",
"=",
"status_info",
"async_dispatcher_send",
"(",
"self",
".",
"_hass... | [
207,
4
] | [
211,
82
] | python | co | ['en', 'co', 'sw'] | False |
set_or_callable | (value) | Convert single str or None to a set. Pass through callables and sets. | Convert single str or None to a set. Pass through callables and sets. | def set_or_callable(value):
"""Convert single str or None to a set. Pass through callables and sets."""
if value is None:
return frozenset()
if callable(value):
return value
if isinstance(value, (frozenset, set, list)):
return frozenset(value)
return frozenset([str(value)]) | [
"def",
"set_or_callable",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"frozenset",
"(",
")",
"if",
"callable",
"(",
"value",
")",
":",
"return",
"value",
"if",
"isinstance",
"(",
"value",
",",
"(",
"frozenset",
",",
"set",
",",
... | [
137,
0
] | [
145,
34
] | python | en | ['en', 'en', 'en'] | True |
ZHAEntityRegistry.__init__ | (self) | Initialize Registry instance. | Initialize Registry instance. | def __init__(self):
"""Initialize Registry instance."""
self._strict_registry: RegistryDictType = collections.defaultdict(dict)
self._loose_registry: RegistryDictType = collections.defaultdict(dict)
self._group_registry: GroupRegistryDictType = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_strict_registry",
":",
"RegistryDictType",
"=",
"collections",
".",
"defaultdict",
"(",
"dict",
")",
"self",
".",
"_loose_registry",
":",
"RegistryDictType",
"=",
"collections",
".",
"defaultdict",
"(",
... | [
252,
4
] | [
256,
56
] | python | en | ['en', 'en', 'en'] | True |
ZHAEntityRegistry.get_entity | (
self,
component: str,
manufacturer: str,
model: str,
channels: List[ChannelType],
default: CALLABLE_T = None,
) | Match a ZHA Channels to a ZHA Entity class. | Match a ZHA Channels to a ZHA Entity class. | def get_entity(
self,
component: str,
manufacturer: str,
model: str,
channels: List[ChannelType],
default: CALLABLE_T = None,
) -> Tuple[CALLABLE_T, List[ChannelType]]:
"""Match a ZHA Channels to a ZHA Entity class."""
matches = self._strict_registry[c... | [
"def",
"get_entity",
"(",
"self",
",",
"component",
":",
"str",
",",
"manufacturer",
":",
"str",
",",
"model",
":",
"str",
",",
"channels",
":",
"List",
"[",
"ChannelType",
"]",
",",
"default",
":",
"CALLABLE_T",
"=",
"None",
",",
")",
"->",
"Tuple",
... | [
258,
4
] | [
273,
26
] | python | en | ['en', 'ht', 'en'] | True |
ZHAEntityRegistry.get_group_entity | (self, component: str) | Match a ZHA group to a ZHA Entity class. | Match a ZHA group to a ZHA Entity class. | def get_group_entity(self, component: str) -> CALLABLE_T:
"""Match a ZHA group to a ZHA Entity class."""
return self._group_registry.get(component) | [
"def",
"get_group_entity",
"(",
"self",
",",
"component",
":",
"str",
")",
"->",
"CALLABLE_T",
":",
"return",
"self",
".",
"_group_registry",
".",
"get",
"(",
"component",
")"
] | [
275,
4
] | [
277,
50
] | python | en | ['en', 'ht', 'en'] | True |
ZHAEntityRegistry.strict_match | (
self,
component: str,
channel_names: Union[Callable, Set[str], str] = None,
generic_ids: Union[Callable, Set[str], str] = None,
manufacturers: Union[Callable, Set[str], str] = None,
models: Union[Callable, Set[str], str] = None,
aux_channels: Union[Callable, Set... | Decorate a strict match rule. | Decorate a strict match rule. | def strict_match(
self,
component: str,
channel_names: Union[Callable, Set[str], str] = None,
generic_ids: Union[Callable, Set[str], str] = None,
manufacturers: Union[Callable, Set[str], str] = None,
models: Union[Callable, Set[str], str] = None,
aux_channels: Uni... | [
"def",
"strict_match",
"(",
"self",
",",
"component",
":",
"str",
",",
"channel_names",
":",
"Union",
"[",
"Callable",
",",
"Set",
"[",
"str",
"]",
",",
"str",
"]",
"=",
"None",
",",
"generic_ids",
":",
"Union",
"[",
"Callable",
",",
"Set",
"[",
"str... | [
279,
4
] | [
302,
24
] | python | en | ['en', 'co', 'en'] | True |
ZHAEntityRegistry.loose_match | (
self,
component: str,
channel_names: Union[Callable, Set[str], str] = None,
generic_ids: Union[Callable, Set[str], str] = None,
manufacturers: Union[Callable, Set[str], str] = None,
models: Union[Callable, Set[str], str] = None,
aux_channels: Union[Callable, Set... | Decorate a loose match rule. | Decorate a loose match rule. | def loose_match(
self,
component: str,
channel_names: Union[Callable, Set[str], str] = None,
generic_ids: Union[Callable, Set[str], str] = None,
manufacturers: Union[Callable, Set[str], str] = None,
models: Union[Callable, Set[str], str] = None,
aux_channels: Unio... | [
"def",
"loose_match",
"(",
"self",
",",
"component",
":",
"str",
",",
"channel_names",
":",
"Union",
"[",
"Callable",
",",
"Set",
"[",
"str",
"]",
",",
"str",
"]",
"=",
"None",
",",
"generic_ids",
":",
"Union",
"[",
"Callable",
",",
"Set",
"[",
"str"... | [
304,
4
] | [
327,
24
] | python | en | ['en', 'ro', 'en'] | True |
ZHAEntityRegistry.group_match | (self, component: str) | Decorate a group match rule. | Decorate a group match rule. | def group_match(self, component: str) -> Callable[[CALLABLE_T], CALLABLE_T]:
"""Decorate a group match rule."""
def decorator(zha_ent: CALLABLE_T) -> CALLABLE_T:
"""Register a group match rule."""
self._group_registry[component] = zha_ent
return zha_ent
retu... | [
"def",
"group_match",
"(",
"self",
",",
"component",
":",
"str",
")",
"->",
"Callable",
"[",
"[",
"CALLABLE_T",
"]",
",",
"CALLABLE_T",
"]",
":",
"def",
"decorator",
"(",
"zha_ent",
":",
"CALLABLE_T",
")",
"->",
"CALLABLE_T",
":",
"\"\"\"Register a group mat... | [
329,
4
] | [
337,
24
] | python | en | ['en', 'en', 'en'] | True |
test_form | (hass) | Test we get the form. | Test we get the form. | async def test_form(hass):
"""Test we get the form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["errors... | [
"async",
"def",
"test_form",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(... | [
10,
0
] | [
44,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_invalid_auth | (hass) | Test we handle invalid auth. | Test we handle invalid auth. | async def test_form_invalid_auth(hass):
"""Test we handle invalid auth."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch("homeassistant.components.nexia.config_flow.NexiaHome.login"):
result2 = await hass.config_e... | [
"async",
"def",
"test_form_invalid_auth",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")"... | [
47,
0
] | [
60,
56
] | python | en | ['en', 'en', 'en'] | True |
test_form_cannot_connect | (hass) | Test we handle cannot connect error. | Test we handle cannot connect error. | async def test_form_cannot_connect(hass):
"""Test we handle cannot connect error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.nexia.config_flow.NexiaHome.login",
side_effect... | [
"async",
"def",
"test_form_cannot_connect",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
"... | [
63,
0
] | [
79,
58
] | python | en | ['en', 'en', 'en'] | True |
test_form_invalid_auth_http_401 | (hass) | Test we handle invalid auth error from http 401. | Test we handle invalid auth error from http 401. | async def test_form_invalid_auth_http_401(hass):
"""Test we handle invalid auth error from http 401."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
response_mock = MagicMock()
type(response_mock).status_code = 401
with pat... | [
"async",
"def",
"test_form_invalid_auth_http_401",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"... | [
82,
0
] | [
100,
56
] | python | en | ['en', 'en', 'en'] | True |
test_form_cannot_connect_not_found | (hass) | Test we handle cannot connect from an http not found error. | Test we handle cannot connect from an http not found error. | async def test_form_cannot_connect_not_found(hass):
"""Test we handle cannot connect from an http not found error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
response_mock = MagicMock()
type(response_mock).status_code = 40... | [
"async",
"def",
"test_form_cannot_connect_not_found",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
... | [
103,
0
] | [
121,
58
] | python | en | ['en', 'en', 'en'] | True |
test_form_broad_exception | (hass) | Test we handle invalid auth error. | Test we handle invalid auth error. | async def test_form_broad_exception(hass):
"""Test we handle invalid auth error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.nexia.config_flow.NexiaHome.login",
side_effect=... | [
"async",
"def",
"test_form_broad_exception",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
... | [
124,
0
] | [
140,
51
] | python | de | ['de', 'et', 'en'] | False |
test_form_import | (hass) | Test we get the form with import source. | Test we get the form with import source. | async def test_form_import(hass):
"""Test we get the form with import source."""
await setup.async_setup_component(hass, "persistent_notification", {})
with patch(
"homeassistant.components.nexia.config_flow.NexiaHome.get_name",
return_value="myhouse",
), patch(
"homeassistant.c... | [
"async",
"def",
"test_form_import",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"with",
"patch",
"(",
"\"homeassistant.components.nexia.config_flow.NexiaHome.get_name\"",
","... | [
143,
0
] | [
182,
52
] | python | en | ['en', 'en', 'en'] | True |
test_get_device_detects_none | (mock_openzwave) | Test device is not returned. | Test device is not returned. | def test_get_device_detects_none(mock_openzwave):
"""Test device is not returned."""
node = MockNode()
value = MockValue(data=False, node=node)
values = MockEntityValues(primary=value)
device = binary_sensor.get_device(node=node, values=values, node_config={})
assert device is None | [
"def",
"test_get_device_detects_none",
"(",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
"False",
",",
"node",
"=",
"node",
")",
"values",
"=",
"MockEntityValues",
"(",
"primary",
"=",
"value",
... | [
9,
0
] | [
16,
25
] | python | en | ['en', 'en', 'en'] | True |
test_get_device_detects_trigger_sensor | (mock_openzwave) | Test device is a trigger sensor. | Test device is a trigger sensor. | def test_get_device_detects_trigger_sensor(mock_openzwave):
"""Test device is a trigger sensor."""
node = MockNode(manufacturer_id="013c", product_type="0002", product_id="0002")
value = MockValue(data=False, node=node)
values = MockEntityValues(primary=value)
device = binary_sensor.get_device(node... | [
"def",
"test_get_device_detects_trigger_sensor",
"(",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
"manufacturer_id",
"=",
"\"013c\"",
",",
"product_type",
"=",
"\"0002\"",
",",
"product_id",
"=",
"\"0002\"",
")",
"value",
"=",
"MockValue",
"(",
"data... | [
19,
0
] | [
27,
42
] | python | en | ['en', 'en', 'en'] | True |
test_get_device_detects_workaround_sensor | (mock_openzwave) | Test that workaround returns a binary sensor. | Test that workaround returns a binary sensor. | def test_get_device_detects_workaround_sensor(mock_openzwave):
"""Test that workaround returns a binary sensor."""
node = MockNode(manufacturer_id="010f", product_type="0b00")
value = MockValue(
data=False, node=node, command_class=const.COMMAND_CLASS_SENSOR_ALARM
)
values = MockEntityValues... | [
"def",
"test_get_device_detects_workaround_sensor",
"(",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
"manufacturer_id",
"=",
"\"010f\"",
",",
"product_type",
"=",
"\"0b00\"",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
"False",
",",
"node",
"... | [
30,
0
] | [
39,
62
] | python | en | ['en', 'de', 'en'] | True |
test_get_device_detects_sensor | (mock_openzwave) | Test that device returns a binary sensor. | Test that device returns a binary sensor. | def test_get_device_detects_sensor(mock_openzwave):
"""Test that device returns a binary sensor."""
node = MockNode()
value = MockValue(
data=False, node=node, command_class=const.COMMAND_CLASS_SENSOR_BINARY
)
values = MockEntityValues(primary=value)
device = binary_sensor.get_device(no... | [
"def",
"test_get_device_detects_sensor",
"(",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
"False",
",",
"node",
"=",
"node",
",",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_SENSOR_BINARY",
... | [
42,
0
] | [
51,
62
] | python | en | ['en', 'bg', 'en'] | True |
test_binary_sensor_value_changed | (mock_openzwave) | Test value changed for binary sensor. | Test value changed for binary sensor. | def test_binary_sensor_value_changed(mock_openzwave):
"""Test value changed for binary sensor."""
node = MockNode()
value = MockValue(
data=False, node=node, command_class=const.COMMAND_CLASS_SENSOR_BINARY
)
values = MockEntityValues(primary=value)
device = binary_sensor.get_device(node=... | [
"def",
"test_binary_sensor_value_changed",
"(",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
"False",
",",
"node",
"=",
"node",
",",
"command_class",
"=",
"const",
".",
"COMMAND_CLASS_SENSOR_BINARY",... | [
54,
0
] | [
68,
23
] | python | en | ['en', 'en', 'en'] | True |
test_trigger_sensor_value_changed | (hass, mock_openzwave) | Test value changed for trigger sensor. | Test value changed for trigger sensor. | async def test_trigger_sensor_value_changed(hass, mock_openzwave):
"""Test value changed for trigger sensor."""
node = MockNode(manufacturer_id="013c", product_type="0002", product_id="0002")
value = MockValue(data=False, node=node)
value_off_delay = MockValue(data=15, node=node)
values = MockEntity... | [
"async",
"def",
"test_trigger_sensor_value_changed",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
"manufacturer_id",
"=",
"\"013c\"",
",",
"product_type",
"=",
"\"0002\"",
",",
"product_id",
"=",
"\"0002\"",
")",
"value",
"=",
"Moc... | [
71,
0
] | [
97,
31
] | python | en | ['en', 'da', 'en'] | True |
register_flow_implementation | (hass, domain, client_id, client_secret) | Register a flow implementation.
domain: Domain of the component responsible for the implementation.
name: Name of the component.
client_id: Client id.
client_secret: Client secret.
| Register a flow implementation. | def register_flow_implementation(hass, domain, client_id, client_secret):
"""Register a flow implementation.
domain: Domain of the component responsible for the implementation.
name: Name of the component.
client_id: Client id.
client_secret: Client secret.
"""
if DATA_FLOW_IMPL not in hass... | [
"def",
"register_flow_implementation",
"(",
"hass",
",",
"domain",
",",
"client_id",
",",
"client_secret",
")",
":",
"if",
"DATA_FLOW_IMPL",
"not",
"in",
"hass",
".",
"data",
":",
"hass",
".",
"data",
"[",
"DATA_FLOW_IMPL",
"]",
"=",
"OrderedDict",
"(",
")",... | [
25,
0
] | [
39,
5
] | python | en | ['en', 'da', 'en'] | True |
MinutAuthCallbackView.get | (request) | Receive authorization code. | Receive authorization code. | async def get(request):
"""Receive authorization code."""
hass = request.app["hass"]
if "code" in request.query:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": "code"}, data=request.query["code"]
... | [
"async",
"def",
"get",
"(",
"request",
")",
":",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"if",
"\"code\"",
"in",
"request",
".",
"query",
":",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"flow",
".",
"as... | [
181,
4
] | [
190,
20
] | python | de | ['de', 'sr', 'en'] | False |
giveback_priors | (kind, bounds, pams, val) | The code is supposed to give -np.inf log-likelihood when the
parameters are outside the boundaries,
so this case is not encompassed in the definition of the priors | The code is supposed to give -np.inf log-likelihood when the
parameters are outside the boundaries,
so this case is not encompassed in the definition of the priors | def giveback_priors(kind, bounds, pams, val):
""" The code is supposed to give -np.inf log-likelihood when the
parameters are outside the boundaries,
so this case is not encompassed in the definition of the priors """
if kind == 'File':
""" Special case where 'pams' is actually a KDE """
... | [
"def",
"giveback_priors",
"(",
"kind",
",",
"bounds",
",",
"pams",
",",
"val",
")",
":",
"if",
"kind",
"==",
"'File'",
":",
"\"\"\" Special case where 'pams' is actually a KDE \"\"\"",
"return",
"np",
".",
"log",
"(",
"pams",
".",
"pdf",
"(",
"val",
")",
"["... | [
156,
0
] | [
213,
94
] | python | en | ['en', 'en', 'en'] | True |
nested_sampling_prior_prepare | (kind, bounds, pams, space) |
This subroutine computes the coefficient of the spline interpolation of
the inverse cumulative function
In some special cases, it returns the parameters required by the intrinsic
function, e.g. scipi.stats.norm.icf according to their implementation in
nested_sampling_prior_compute()
:param kin... |
This subroutine computes the coefficient of the spline interpolation of
the inverse cumulative function
In some special cases, it returns the parameters required by the intrinsic
function, e.g. scipi.stats.norm.icf according to their implementation in
nested_sampling_prior_compute() | def nested_sampling_prior_prepare(kind, bounds, pams, space):
"""
This subroutine computes the coefficient of the spline interpolation of
the inverse cumulative function
In some special cases, it returns the parameters required by the intrinsic
function, e.g. scipi.stats.norm.icf according to their ... | [
"def",
"nested_sampling_prior_prepare",
"(",
"kind",
",",
"bounds",
",",
"pams",
",",
"space",
")",
":",
"if",
"kind",
"in",
"[",
"'Uniform'",
"]",
":",
"return",
"bounds",
"if",
"kind",
"in",
"[",
"'Uniform'",
",",
"'Gaussian'",
",",
"'BetaDistribution'",
... | [
236,
0
] | [
276,
30
] | python | en | ['en', 'error', 'th'] | False |
nested_sampling_prior_compute | (val, kind, coeff, space) |
In same cases ()
:param val:
:param kind:
:param coeff:
:param space:
:return:
|
In same cases () | def nested_sampling_prior_compute(val, kind, coeff, space):
"""
In same cases ()
:param val:
:param kind:
:param coeff:
:param space:
:return:
"""
if kind == 'Uniform':
return val * (coeff[1] - coeff[0]) + coeff[0]
if kind == 'Gaussian':
if space == 'Logarithmi... | [
"def",
"nested_sampling_prior_compute",
"(",
"val",
",",
"kind",
",",
"coeff",
",",
"space",
")",
":",
"if",
"kind",
"==",
"'Uniform'",
":",
"return",
"val",
"*",
"(",
"coeff",
"[",
"1",
"]",
"-",
"coeff",
"[",
"0",
"]",
")",
"+",
"coeff",
"[",
"0"... | [
279,
0
] | [
317,
28
] | python | en | ['en', 'error', 'th'] | False |
get_astral_location | (hass: HomeAssistantType) | Get an astral location for the current Home Assistant configuration. | Get an astral location for the current Home Assistant configuration. | def get_astral_location(hass: HomeAssistantType) -> "astral.Location":
"""Get an astral location for the current Home Assistant configuration."""
from astral import Location # pylint: disable=import-outside-toplevel
latitude = hass.config.latitude
longitude = hass.config.longitude
timezone = str(... | [
"def",
"get_astral_location",
"(",
"hass",
":",
"HomeAssistantType",
")",
"->",
"\"astral.Location\"",
":",
"from",
"astral",
"import",
"Location",
"# pylint: disable=import-outside-toplevel",
"latitude",
"=",
"hass",
".",
"config",
".",
"latitude",
"longitude",
"=",
... | [
19,
0
] | [
37,
47
] | python | en | ['en', 'en', 'en'] | True |
get_astral_event_next | (
hass: HomeAssistantType,
event: str,
utc_point_in_time: Optional[datetime.datetime] = None,
offset: Optional[datetime.timedelta] = None,
) | Calculate the next specified solar event. | Calculate the next specified solar event. | def get_astral_event_next(
hass: HomeAssistantType,
event: str,
utc_point_in_time: Optional[datetime.datetime] = None,
offset: Optional[datetime.timedelta] = None,
) -> datetime.datetime:
"""Calculate the next specified solar event."""
location = get_astral_location(hass)
return get_location... | [
"def",
"get_astral_event_next",
"(",
"hass",
":",
"HomeAssistantType",
",",
"event",
":",
"str",
",",
"utc_point_in_time",
":",
"Optional",
"[",
"datetime",
".",
"datetime",
"]",
"=",
"None",
",",
"offset",
":",
"Optional",
"[",
"datetime",
".",
"timedelta",
... | [
42,
0
] | [
50,
85
] | python | en | ['en', 'en', 'en'] | True |
get_location_astral_event_next | (
location: "astral.Location",
event: str,
utc_point_in_time: Optional[datetime.datetime] = None,
offset: Optional[datetime.timedelta] = None,
) | Calculate the next specified solar event. | Calculate the next specified solar event. | def get_location_astral_event_next(
location: "astral.Location",
event: str,
utc_point_in_time: Optional[datetime.datetime] = None,
offset: Optional[datetime.timedelta] = None,
) -> datetime.datetime:
"""Calculate the next specified solar event."""
from astral import AstralError # pylint: disab... | [
"def",
"get_location_astral_event_next",
"(",
"location",
":",
"\"astral.Location\"",
",",
"event",
":",
"str",
",",
"utc_point_in_time",
":",
"Optional",
"[",
"datetime",
".",
"datetime",
"]",
"=",
"None",
",",
"offset",
":",
"Optional",
"[",
"datetime",
".",
... | [
54,
0
] | [
84,
16
] | python | en | ['en', 'en', 'en'] | True |
get_astral_event_date | (
hass: HomeAssistantType,
event: str,
date: Union[datetime.date, datetime.datetime, None] = None,
) | Calculate the astral event time for the specified date. | Calculate the astral event time for the specified date. | def get_astral_event_date(
hass: HomeAssistantType,
event: str,
date: Union[datetime.date, datetime.datetime, None] = None,
) -> Optional[datetime.datetime]:
"""Calculate the astral event time for the specified date."""
from astral import AstralError # pylint: disable=import-outside-toplevel
l... | [
"def",
"get_astral_event_date",
"(",
"hass",
":",
"HomeAssistantType",
",",
"event",
":",
"str",
",",
"date",
":",
"Union",
"[",
"datetime",
".",
"date",
",",
"datetime",
".",
"datetime",
",",
"None",
"]",
"=",
"None",
",",
")",
"->",
"Optional",
"[",
... | [
89,
0
] | [
109,
19
] | python | en | ['en', 'en', 'en'] | True |
is_up | (
hass: HomeAssistantType, utc_point_in_time: Optional[datetime.datetime] = None
) | Calculate if the sun is currently up. | Calculate if the sun is currently up. | def is_up(
hass: HomeAssistantType, utc_point_in_time: Optional[datetime.datetime] = None
) -> bool:
"""Calculate if the sun is currently up."""
if utc_point_in_time is None:
utc_point_in_time = dt_util.utcnow()
next_sunrise = get_astral_event_next(hass, SUN_EVENT_SUNRISE, utc_point_in_time)
... | [
"def",
"is_up",
"(",
"hass",
":",
"HomeAssistantType",
",",
"utc_point_in_time",
":",
"Optional",
"[",
"datetime",
".",
"datetime",
"]",
"=",
"None",
")",
"->",
"bool",
":",
"if",
"utc_point_in_time",
"is",
"None",
":",
"utc_point_in_time",
"=",
"dt_util",
"... | [
114,
0
] | [
124,
37
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up Z-Wave Fan from Config Entry. | Set up Z-Wave Fan from Config Entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Z-Wave Fan from Config Entry."""
@callback
def async_add_fan(values):
"""Add Z-Wave Fan."""
fan = ZwaveFan(values)
async_add_entities([fan])
hass.data[DOMAIN][config_entry.entry_id][DATA_UNSUBSCRIBE]... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"@",
"callback",
"def",
"async_add_fan",
"(",
"values",
")",
":",
"\"\"\"Add Z-Wave Fan.\"\"\"",
"fan",
"=",
"ZwaveFan",
"(",
"values",
")",
"async_add_enti... | [
29,
0
] | [
40,
5
] | python | en | ['en', 'en', 'en'] | True |
ZwaveFan.__init__ | (self, values) | Initialize the fan. | Initialize the fan. | def __init__(self, values):
"""Initialize the fan."""
super().__init__(values)
self._previous_speed = None | [
"def",
"__init__",
"(",
"self",
",",
"values",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"values",
")",
"self",
".",
"_previous_speed",
"=",
"None"
] | [
46,
4
] | [
49,
35
] | python | en | ['en', 'fy', 'en'] | True |
ZwaveFan.async_set_speed | (self, speed) | Set the speed of the fan. | Set the speed of the fan. | async def async_set_speed(self, speed):
"""Set the speed of the fan."""
if speed not in SPEED_TO_VALUE:
_LOGGER.warning("Invalid speed received: %s", speed)
return
self._previous_speed = speed
self.values.primary.send_value(SPEED_TO_VALUE[speed]) | [
"async",
"def",
"async_set_speed",
"(",
"self",
",",
"speed",
")",
":",
"if",
"speed",
"not",
"in",
"SPEED_TO_VALUE",
":",
"_LOGGER",
".",
"warning",
"(",
"\"Invalid speed received: %s\"",
",",
"speed",
")",
"return",
"self",
".",
"_previous_speed",
"=",
"spee... | [
51,
4
] | [
57,
61
] | python | en | ['en', 'en', 'en'] | True |
ZwaveFan.async_turn_on | (self, speed=None, **kwargs) | Turn the device on. | Turn the device on. | async def async_turn_on(self, speed=None, **kwargs):
"""Turn the device on."""
if speed is None:
# Value 255 tells device to return to previous value
self.values.primary.send_value(255)
else:
await self.async_set_speed(speed) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"speed",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"speed",
"is",
"None",
":",
"# Value 255 tells device to return to previous value",
"self",
".",
"values",
".",
"primary",
".",
"send_value",
"(",... | [
59,
4
] | [
65,
45
] | python | en | ['en', 'en', 'en'] | True |
ZwaveFan.async_turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | async def async_turn_off(self, **kwargs):
"""Turn the device off."""
self.values.primary.send_value(0) | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"values",
".",
"primary",
".",
"send_value",
"(",
"0",
")"
] | [
67,
4
] | [
69,
41
] | python | en | ['en', 'en', 'en'] | True |
ZwaveFan.is_on | (self) | Return true if device is on (speed above 0). | Return true if device is on (speed above 0). | def is_on(self):
"""Return true if device is on (speed above 0)."""
return self.values.primary.value > 0 | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"values",
".",
"primary",
".",
"value",
">",
"0"
] | [
72,
4
] | [
74,
44
] | python | en | ['en', 'en', 'en'] | True |
ZwaveFan.speed | (self) | Return the current speed.
The Z-Wave speed value is a byte 0-255. 255 means previous value.
The normal range of the speed is 0-99. 0 means off.
| Return the current speed. | def speed(self):
"""Return the current speed.
The Z-Wave speed value is a byte 0-255. 255 means previous value.
The normal range of the speed is 0-99. 0 means off.
"""
value = math.ceil(self.values.primary.value * 3 / 100)
return VALUE_TO_SPEED.get(value, self._previous_... | [
"def",
"speed",
"(",
"self",
")",
":",
"value",
"=",
"math",
".",
"ceil",
"(",
"self",
".",
"values",
".",
"primary",
".",
"value",
"*",
"3",
"/",
"100",
")",
"return",
"VALUE_TO_SPEED",
".",
"get",
"(",
"value",
",",
"self",
".",
"_previous_speed",
... | [
77,
4
] | [
84,
62
] | python | en | ['en', 'en', 'en'] | True |
ZwaveFan.speed_list | (self) | Get the list of available speeds. | Get the list of available speeds. | def speed_list(self):
"""Get the list of available speeds."""
return SPEED_LIST | [
"def",
"speed_list",
"(",
"self",
")",
":",
"return",
"SPEED_LIST"
] | [
87,
4
] | [
89,
25
] | python | en | ['en', 'en', 'en'] | True |
ZwaveFan.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORTED_FEATURES | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORTED_FEATURES"
] | [
92,
4
] | [
94,
33
] | python | en | ['da', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the UPB link based on a config entry. | Set up the UPB link based on a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the UPB link based on a config entry."""
upb = hass.data[DOMAIN][config_entry.entry_id]["upb"]
unique_id = config_entry.entry_id
async_add_entities(UpbLink(upb.links[link], unique_id, upb) for link in upb.links)
platform... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"upb",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"[",
"\"upb\"",
"]",
"unique_id",
"=",
"config_entry",... | [
16,
0
] | [
38,
5
] | python | en | ['en', 'en', 'en'] | True |
UpbLink.async_activate | (self, **kwargs: Any) | Activate the task. | Activate the task. | async def async_activate(self, **kwargs: Any) -> None:
"""Activate the task."""
self._element.activate() | [
"async",
"def",
"async_activate",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"self",
".",
"_element",
".",
"activate",
"(",
")"
] | [
44,
4
] | [
46,
32
] | python | en | ['en', 'en', 'en'] | True |
UpbLink.async_link_deactivate | (self) | Activate the task. | Activate the task. | async def async_link_deactivate(self):
"""Activate the task."""
self._element.deactivate() | [
"async",
"def",
"async_link_deactivate",
"(",
"self",
")",
":",
"self",
".",
"_element",
".",
"deactivate",
"(",
")"
] | [
48,
4
] | [
50,
34
] | python | en | ['en', 'en', 'en'] | True |
UpbLink.async_link_goto | (self, rate, brightness=None, brightness_pct=None) | Activate the task. | Activate the task. | async def async_link_goto(self, rate, brightness=None, brightness_pct=None):
"""Activate the task."""
if brightness is not None:
brightness_pct = round(brightness / 2.55)
self._element.goto(brightness_pct, rate) | [
"async",
"def",
"async_link_goto",
"(",
"self",
",",
"rate",
",",
"brightness",
"=",
"None",
",",
"brightness_pct",
"=",
"None",
")",
":",
"if",
"brightness",
"is",
"not",
"None",
":",
"brightness_pct",
"=",
"round",
"(",
"brightness",
"/",
"2.55",
")",
... | [
52,
4
] | [
56,
48
] | python | en | ['en', 'en', 'en'] | True |
UpbLink.async_link_fade_start | (self, rate, brightness=None, brightness_pct=None) | Start dimming a link. | Start dimming a link. | async def async_link_fade_start(self, rate, brightness=None, brightness_pct=None):
"""Start dimming a link."""
if brightness is not None:
brightness_pct = round(brightness / 2.55)
self._element.fade_start(brightness_pct, rate) | [
"async",
"def",
"async_link_fade_start",
"(",
"self",
",",
"rate",
",",
"brightness",
"=",
"None",
",",
"brightness_pct",
"=",
"None",
")",
":",
"if",
"brightness",
"is",
"not",
"None",
":",
"brightness_pct",
"=",
"round",
"(",
"brightness",
"/",
"2.55",
"... | [
58,
4
] | [
62,
54
] | python | en | ['en', 'en', 'it'] | True |
UpbLink.async_link_fade_stop | (self) | Stop dimming a link. | Stop dimming a link. | async def async_link_fade_stop(self):
"""Stop dimming a link."""
self._element.fade_stop() | [
"async",
"def",
"async_link_fade_stop",
"(",
"self",
")",
":",
"self",
".",
"_element",
".",
"fade_stop",
"(",
")"
] | [
64,
4
] | [
66,
33
] | python | en | ['en', 'en', 'it'] | True |
UpbLink.async_link_blink | (self, blink_rate) | Blink a link. | Blink a link. | async def async_link_blink(self, blink_rate):
"""Blink a link."""
blink_rate = int(blink_rate * 60)
self._element.blink(blink_rate) | [
"async",
"def",
"async_link_blink",
"(",
"self",
",",
"blink_rate",
")",
":",
"blink_rate",
"=",
"int",
"(",
"blink_rate",
"*",
"60",
")",
"self",
".",
"_element",
".",
"blink",
"(",
"blink_rate",
")"
] | [
68,
4
] | [
71,
39
] | python | da | ['es', 'da', 'en'] | False |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up MoldIndicator sensor. | Set up MoldIndicator sensor. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up MoldIndicator sensor."""
name = config.get(CONF_NAME, DEFAULT_NAME)
indoor_temp_sensor = config.get(CONF_INDOOR_TEMP)
outdoor_temp_sensor = config.get(CONF_OUTDOOR_TEMP)
indoor_humidity_sensor = config.g... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
",",
"DEFAULT_NAME",
")",
"indoor_temp_sensor",
"=",
"config",
"."... | [
48,
0
] | [
68,
5
] | python | en | ['en', 'su', 'en'] | True |
MoldIndicator.__init__ | (
self,
name,
is_metric,
indoor_temp_sensor,
outdoor_temp_sensor,
indoor_humidity_sensor,
calib_factor,
) | Initialize the sensor. | Initialize the sensor. | def __init__(
self,
name,
is_metric,
indoor_temp_sensor,
outdoor_temp_sensor,
indoor_humidity_sensor,
calib_factor,
):
"""Initialize the sensor."""
self._state = None
self._name = name
self._indoor_temp_sensor = indoor_temp_sens... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"is_metric",
",",
"indoor_temp_sensor",
",",
"outdoor_temp_sensor",
",",
"indoor_humidity_sensor",
",",
"calib_factor",
",",
")",
":",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_name",
"=",
"name",
"s... | [
74,
4
] | [
102,
30
] | python | en | ['en', 'en', 'en'] | True |
MoldIndicator.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
@callback
def mold_indicator_sensors_state_listener(event):
"""Handle for state changes for dependent sensors."""
new_state = event.data.get("new_state")
old_state = event.data.get("old_state")
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"@",
"callback",
"def",
"mold_indicator_sensors_state_listener",
"(",
"event",
")",
":",
"\"\"\"Handle for state changes for dependent sensors.\"\"\"",
"new_state",
"=",
"event",
".",
"data",
".",
"get",
"(",... | [
104,
4
] | [
162,
9
] | python | en | ['en', 'no', 'en'] | False |
MoldIndicator._update_sensor | (self, entity, old_state, new_state) | Update information based on new sensor states. | Update information based on new sensor states. | def _update_sensor(self, entity, old_state, new_state):
"""Update information based on new sensor states."""
_LOGGER.debug("Sensor update for %s", entity)
if new_state is None:
return False
# If old_state is not set and new state is unknown then it means
# that the s... | [
"def",
"_update_sensor",
"(",
"self",
",",
"entity",
",",
"old_state",
",",
"new_state",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Sensor update for %s\"",
",",
"entity",
")",
"if",
"new_state",
"is",
"None",
":",
"return",
"False",
"# If old_state is not set a... | [
164,
4
] | [
182,
19
] | python | en | ['en', 'da', 'en'] | True |
MoldIndicator._update_temp_sensor | (state) | Parse temperature sensor value. | Parse temperature sensor value. | def _update_temp_sensor(state):
"""Parse temperature sensor value."""
_LOGGER.debug("Updating temp sensor with value %s", state.state)
# Return an error if the sensor change its state to Unknown.
if state.state == STATE_UNKNOWN:
_LOGGER.error(
"Unable to pars... | [
"def",
"_update_temp_sensor",
"(",
"state",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating temp sensor with value %s\"",
",",
"state",
".",
"state",
")",
"# Return an error if the sensor change its state to Unknown.",
"if",
"state",
".",
"state",
"==",
"STATE_UNKNOWN... | [
185,
4
] | [
222,
19
] | python | en | ['en', 'la', 'en'] | True |
MoldIndicator._update_hum_sensor | (state) | Parse humidity sensor value. | Parse humidity sensor value. | def _update_hum_sensor(state):
"""Parse humidity sensor value."""
_LOGGER.debug("Updating humidity sensor with value %s", state.state)
# Return an error if the sensor change its state to Unknown.
if state.state == STATE_UNKNOWN:
_LOGGER.error(
"Unable to pars... | [
"def",
"_update_hum_sensor",
"(",
"state",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating humidity sensor with value %s\"",
",",
"state",
".",
"state",
")",
"# Return an error if the sensor change its state to Unknown.",
"if",
"state",
".",
"state",
"==",
"STATE_UNKN... | [
225,
4
] | [
267,
18
] | python | en | ['en', 'mg', 'en'] | True |
MoldIndicator.async_update | (self) | Calculate latest state. | Calculate latest state. | async def async_update(self):
"""Calculate latest state."""
_LOGGER.debug("Update state for %s", self.entity_id)
# check all sensors
if None in (self._indoor_temp, self._indoor_hum, self._outdoor_temp):
self._available = False
self._dewpoint = None
sel... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Update state for %s\"",
",",
"self",
".",
"entity_id",
")",
"# check all sensors",
"if",
"None",
"in",
"(",
"self",
".",
"_indoor_temp",
",",
"self",
".",
"_indoor_hum",
... | [
269,
4
] | [
287,
34
] | python | en | ['es', 'en', 'en'] | True |
MoldIndicator._calc_dewpoint | (self) | Calculate the dewpoint for the indoor air. | Calculate the dewpoint for the indoor air. | def _calc_dewpoint(self):
"""Calculate the dewpoint for the indoor air."""
# Use magnus approximation to calculate the dew point
alpha = MAGNUS_K2 * self._indoor_temp / (MAGNUS_K3 + self._indoor_temp)
beta = MAGNUS_K2 * MAGNUS_K3 / (MAGNUS_K3 + self._indoor_temp)
if self._indoor... | [
"def",
"_calc_dewpoint",
"(",
"self",
")",
":",
"# Use magnus approximation to calculate the dew point",
"alpha",
"=",
"MAGNUS_K2",
"*",
"self",
".",
"_indoor_temp",
"/",
"(",
"MAGNUS_K3",
"+",
"self",
".",
"_indoor_temp",
")",
"beta",
"=",
"MAGNUS_K2",
"*",
"MAGN... | [
289,
4
] | [
303,
70
] | python | en | ['en', 'en', 'en'] | True |
MoldIndicator._calc_moldindicator | (self) | Calculate the humidity at the (cold) calibration point. | Calculate the humidity at the (cold) calibration point. | def _calc_moldindicator(self):
"""Calculate the humidity at the (cold) calibration point."""
if None in (self._dewpoint, self._calib_factor) or self._calib_factor == 0:
_LOGGER.debug(
"Invalid inputs - dewpoint: %s, calibration-factor: %s",
self._dewpoint,
... | [
"def",
"_calc_moldindicator",
"(",
"self",
")",
":",
"if",
"None",
"in",
"(",
"self",
".",
"_dewpoint",
",",
"self",
".",
"_calib_factor",
")",
"or",
"self",
".",
"_calib_factor",
"==",
"0",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Invalid inputs - dewpoint: %s... | [
305,
4
] | [
349,
65
] | python | en | ['en', 'en', 'en'] | True |
MoldIndicator.should_poll | (self) | Return the polling state. | Return the polling state. | def should_poll(self):
"""Return the polling state."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
352,
4
] | [
354,
20
] | python | en | ['en', 'en', 'en'] | True |
MoldIndicator.name | (self) | Return the name. | Return the name. | def name(self):
"""Return the name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
357,
4
] | [
359,
25
] | python | en | ['en', 'ig', 'en'] | True |
MoldIndicator.unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def unit_of_measurement(self):
"""Return the unit of measurement."""
return PERCENTAGE | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"PERCENTAGE"
] | [
362,
4
] | [
364,
25
] | python | en | ['en', 'la', 'en'] | True |
MoldIndicator.state | (self) | Return the state of the entity. | Return the state of the entity. | def state(self):
"""Return the state of the entity."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
367,
4
] | [
369,
26
] | python | en | ['en', 'en', 'en'] | True |
MoldIndicator.available | (self) | Return the availability of this sensor. | Return the availability of this sensor. | def available(self):
"""Return the availability of this sensor."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
372,
4
] | [
374,
30
] | python | en | ['en', 'en', 'en'] | True |
MoldIndicator.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
if self._is_metric:
return {ATTR_DEWPOINT: self._dewpoint, ATTR_CRITICAL_TEMP: self._crit_temp}
dewpoint = (
util.temperature.celsius_to_fahrenheit(self._dewpoint)
if self._dewpoint is not ... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_metric",
":",
"return",
"{",
"ATTR_DEWPOINT",
":",
"self",
".",
"_dewpoint",
",",
"ATTR_CRITICAL_TEMP",
":",
"self",
".",
"_crit_temp",
"}",
"dewpoint",
"=",
"(",
"util",
".",
... | [
377,
4
] | [
394,
71
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.__init__ | (
self,
hass: HomeAssistantType,
zigpy_device: zha_typing.ZigpyDeviceType,
zha_gateway: zha_typing.ZhaGatewayType,
) | Initialize the gateway. | Initialize the gateway. | def __init__(
self,
hass: HomeAssistantType,
zigpy_device: zha_typing.ZigpyDeviceType,
zha_gateway: zha_typing.ZhaGatewayType,
):
"""Initialize the gateway."""
self.hass = hass
self._zigpy_device = zigpy_device
self._zha_gateway = zha_gateway
s... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
",",
"zigpy_device",
":",
"zha_typing",
".",
"ZigpyDeviceType",
",",
"zha_gateway",
":",
"zha_typing",
".",
"ZhaGatewayType",
",",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",... | [
86,
4
] | [
118,
48
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.device_id | (self) | Return the HA device registry device id. | Return the HA device registry device id. | def device_id(self):
"""Return the HA device registry device id."""
return self._ha_device_id | [
"def",
"device_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ha_device_id"
] | [
121,
4
] | [
123,
33
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.set_device_id | (self, device_id) | Set the HA device registry device id. | Set the HA device registry device id. | def set_device_id(self, device_id):
"""Set the HA device registry device id."""
self._ha_device_id = device_id | [
"def",
"set_device_id",
"(",
"self",
",",
"device_id",
")",
":",
"self",
".",
"_ha_device_id",
"=",
"device_id"
] | [
125,
4
] | [
127,
38
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.device | (self) | Return underlying Zigpy device. | Return underlying Zigpy device. | def device(self) -> zha_typing.ZigpyDeviceType:
"""Return underlying Zigpy device."""
return self._zigpy_device | [
"def",
"device",
"(",
"self",
")",
"->",
"zha_typing",
".",
"ZigpyDeviceType",
":",
"return",
"self",
".",
"_zigpy_device"
] | [
130,
4
] | [
132,
33
] | python | de | ['de', 'zh', 'en'] | False |
ZHADevice.channels | (self) | Return ZHA channels. | Return ZHA channels. | def channels(self) -> zha_typing.ChannelsType:
"""Return ZHA channels."""
return self._channels | [
"def",
"channels",
"(",
"self",
")",
"->",
"zha_typing",
".",
"ChannelsType",
":",
"return",
"self",
".",
"_channels"
] | [
135,
4
] | [
137,
29
] | python | en | ['en', 'fy', 'en'] | True |
ZHADevice.channels | (self, value: zha_typing.ChannelsType) | Channels setter. | Channels setter. | def channels(self, value: zha_typing.ChannelsType) -> None:
"""Channels setter."""
assert isinstance(value, channels.Channels)
self._channels = value | [
"def",
"channels",
"(",
"self",
",",
"value",
":",
"zha_typing",
".",
"ChannelsType",
")",
"->",
"None",
":",
"assert",
"isinstance",
"(",
"value",
",",
"channels",
".",
"Channels",
")",
"self",
".",
"_channels",
"=",
"value"
] | [
140,
4
] | [
143,
30
] | python | ca | ['ca', 'fy', 'en'] | False |
ZHADevice.name | (self) | Return device name. | Return device name. | def name(self):
"""Return device name."""
return f"{self.manufacturer} {self.model}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self.manufacturer} {self.model}\""
] | [
146,
4
] | [
148,
50
] | python | en | ['es', 'sl', 'en'] | False |
ZHADevice.ieee | (self) | Return ieee address for device. | Return ieee address for device. | def ieee(self):
"""Return ieee address for device."""
return self._zigpy_device.ieee | [
"def",
"ieee",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"ieee"
] | [
151,
4
] | [
153,
38
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.manufacturer | (self) | Return manufacturer for device. | Return manufacturer for device. | def manufacturer(self):
"""Return manufacturer for device."""
if self._zigpy_device.manufacturer is None:
return UNKNOWN_MANUFACTURER
return self._zigpy_device.manufacturer | [
"def",
"manufacturer",
"(",
"self",
")",
":",
"if",
"self",
".",
"_zigpy_device",
".",
"manufacturer",
"is",
"None",
":",
"return",
"UNKNOWN_MANUFACTURER",
"return",
"self",
".",
"_zigpy_device",
".",
"manufacturer"
] | [
156,
4
] | [
160,
46
] | python | da | ['da', 'da', 'en'] | True |
ZHADevice.model | (self) | Return model for device. | Return model for device. | def model(self):
"""Return model for device."""
if self._zigpy_device.model is None:
return UNKNOWN_MODEL
return self._zigpy_device.model | [
"def",
"model",
"(",
"self",
")",
":",
"if",
"self",
".",
"_zigpy_device",
".",
"model",
"is",
"None",
":",
"return",
"UNKNOWN_MODEL",
"return",
"self",
".",
"_zigpy_device",
".",
"model"
] | [
163,
4
] | [
167,
39
] | python | da | ['da', 'no', 'en'] | False |
ZHADevice.manufacturer_code | (self) | Return the manufacturer code for the device. | Return the manufacturer code for the device. | def manufacturer_code(self):
"""Return the manufacturer code for the device."""
if self._zigpy_device.node_desc.is_valid:
return self._zigpy_device.node_desc.manufacturer_code
return None | [
"def",
"manufacturer_code",
"(",
"self",
")",
":",
"if",
"self",
".",
"_zigpy_device",
".",
"node_desc",
".",
"is_valid",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"node_desc",
".",
"manufacturer_code",
"return",
"None"
] | [
170,
4
] | [
174,
19
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.nwk | (self) | Return nwk for device. | Return nwk for device. | def nwk(self):
"""Return nwk for device."""
return self._zigpy_device.nwk | [
"def",
"nwk",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"nwk"
] | [
177,
4
] | [
179,
37
] | python | en | ['da', 'en', 'en'] | True |
ZHADevice.lqi | (self) | Return lqi for device. | Return lqi for device. | def lqi(self):
"""Return lqi for device."""
return self._zigpy_device.lqi | [
"def",
"lqi",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"lqi"
] | [
182,
4
] | [
184,
37
] | python | en | ['da', 'en', 'en'] | True |
ZHADevice.rssi | (self) | Return rssi for device. | Return rssi for device. | def rssi(self):
"""Return rssi for device."""
return self._zigpy_device.rssi | [
"def",
"rssi",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"rssi"
] | [
187,
4
] | [
189,
38
] | python | en | ['da', 'en', 'en'] | True |
ZHADevice.last_seen | (self) | Return last_seen for device. | Return last_seen for device. | def last_seen(self):
"""Return last_seen for device."""
return self._zigpy_device.last_seen | [
"def",
"last_seen",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"last_seen"
] | [
192,
4
] | [
194,
43
] | python | en | ['es', 'en', 'en'] | True |
ZHADevice.is_mains_powered | (self) | Return true if device is mains powered. | Return true if device is mains powered. | def is_mains_powered(self):
"""Return true if device is mains powered."""
return self._zigpy_device.node_desc.is_mains_powered | [
"def",
"is_mains_powered",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"node_desc",
".",
"is_mains_powered"
] | [
197,
4
] | [
199,
60
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.device_type | (self) | Return the logical device type for the device. | Return the logical device type for the device. | def device_type(self):
"""Return the logical device type for the device."""
node_descriptor = self._zigpy_device.node_desc
return (
node_descriptor.logical_type.name if node_descriptor.is_valid else UNKNOWN
) | [
"def",
"device_type",
"(",
"self",
")",
":",
"node_descriptor",
"=",
"self",
".",
"_zigpy_device",
".",
"node_desc",
"return",
"(",
"node_descriptor",
".",
"logical_type",
".",
"name",
"if",
"node_descriptor",
".",
"is_valid",
"else",
"UNKNOWN",
")"
] | [
202,
4
] | [
207,
9
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.power_source | (self) | Return the power source for the device. | Return the power source for the device. | def power_source(self):
"""Return the power source for the device."""
return (
POWER_MAINS_POWERED if self.is_mains_powered else POWER_BATTERY_OR_UNKNOWN
) | [
"def",
"power_source",
"(",
"self",
")",
":",
"return",
"(",
"POWER_MAINS_POWERED",
"if",
"self",
".",
"is_mains_powered",
"else",
"POWER_BATTERY_OR_UNKNOWN",
")"
] | [
210,
4
] | [
214,
9
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.is_router | (self) | Return true if this is a routing capable device. | Return true if this is a routing capable device. | def is_router(self):
"""Return true if this is a routing capable device."""
return self._zigpy_device.node_desc.is_router | [
"def",
"is_router",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"node_desc",
".",
"is_router"
] | [
217,
4
] | [
219,
53
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.is_coordinator | (self) | Return true if this device represents the coordinator. | Return true if this device represents the coordinator. | def is_coordinator(self):
"""Return true if this device represents the coordinator."""
return self._zigpy_device.node_desc.is_coordinator | [
"def",
"is_coordinator",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"node_desc",
".",
"is_coordinator"
] | [
222,
4
] | [
224,
58
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.is_end_device | (self) | Return true if this device is an end device. | Return true if this device is an end device. | def is_end_device(self):
"""Return true if this device is an end device."""
return self._zigpy_device.node_desc.is_end_device | [
"def",
"is_end_device",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"node_desc",
".",
"is_end_device"
] | [
227,
4
] | [
229,
57
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.is_groupable | (self) | Return true if this device has a group cluster. | Return true if this device has a group cluster. | def is_groupable(self):
"""Return true if this device has a group cluster."""
return self.is_coordinator or (
self.available and self.async_get_groupable_endpoints()
) | [
"def",
"is_groupable",
"(",
"self",
")",
":",
"return",
"self",
".",
"is_coordinator",
"or",
"(",
"self",
".",
"available",
"and",
"self",
".",
"async_get_groupable_endpoints",
"(",
")",
")"
] | [
232,
4
] | [
236,
9
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.skip_configuration | (self) | Return true if the device should not issue configuration related commands. | Return true if the device should not issue configuration related commands. | def skip_configuration(self):
"""Return true if the device should not issue configuration related commands."""
return self._zigpy_device.skip_configuration | [
"def",
"skip_configuration",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zigpy_device",
".",
"skip_configuration"
] | [
239,
4
] | [
241,
52
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.gateway | (self) | Return the gateway for this device. | Return the gateway for this device. | def gateway(self):
"""Return the gateway for this device."""
return self._zha_gateway | [
"def",
"gateway",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zha_gateway"
] | [
244,
4
] | [
246,
32
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.device_automation_triggers | (self) | Return the device automation triggers for this device. | Return the device automation triggers for this device. | def device_automation_triggers(self):
"""Return the device automation triggers for this device."""
triggers = {
("device_offline", "device_offline"): {
"device_event_type": "device_offline"
}
}
if hasattr(self._zigpy_device, "device_automation_trig... | [
"def",
"device_automation_triggers",
"(",
"self",
")",
":",
"triggers",
"=",
"{",
"(",
"\"device_offline\"",
",",
"\"device_offline\"",
")",
":",
"{",
"\"device_event_type\"",
":",
"\"device_offline\"",
"}",
"}",
"if",
"hasattr",
"(",
"self",
".",
"_zigpy_device",... | [
249,
4
] | [
258,
23
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.available_signal | (self) | Signal to use to subscribe to device availability changes. | Signal to use to subscribe to device availability changes. | def available_signal(self):
"""Signal to use to subscribe to device availability changes."""
return self._available_signal | [
"def",
"available_signal",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available_signal"
] | [
261,
4
] | [
263,
37
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.available | (self) | Return True if device is available. | Return True if device is available. | def available(self):
"""Return True if device is available."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
266,
4
] | [
268,
30
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.available | (self, new_availability: bool) | Set device availability. | Set device availability. | def available(self, new_availability: bool) -> None:
"""Set device availability."""
self._available = new_availability | [
"def",
"available",
"(",
"self",
",",
"new_availability",
":",
"bool",
")",
"->",
"None",
":",
"self",
".",
"_available",
"=",
"new_availability"
] | [
271,
4
] | [
273,
42
] | python | cs | ['fr', 'cs', 'en'] | False |
ZHADevice.zigbee_signature | (self) | Get zigbee signature for this device. | Get zigbee signature for this device. | def zigbee_signature(self) -> Dict[str, Any]:
"""Get zigbee signature for this device."""
return {
ATTR_NODE_DESCRIPTOR: str(self._zigpy_device.node_desc),
ATTR_ENDPOINTS: self._channels.zigbee_signature,
} | [
"def",
"zigbee_signature",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"{",
"ATTR_NODE_DESCRIPTOR",
":",
"str",
"(",
"self",
".",
"_zigpy_device",
".",
"node_desc",
")",
",",
"ATTR_ENDPOINTS",
":",
"self",
".",
"_channels",
... | [
276,
4
] | [
281,
9
] | python | en | ['en', 'en', 'en'] | True |
ZHADevice.new | (
cls,
hass: HomeAssistantType,
zigpy_dev: zha_typing.ZigpyDeviceType,
gateway: zha_typing.ZhaGatewayType,
restored: bool = False,
) | Create new device. | Create new device. | def new(
cls,
hass: HomeAssistantType,
zigpy_dev: zha_typing.ZigpyDeviceType,
gateway: zha_typing.ZhaGatewayType,
restored: bool = False,
):
"""Create new device."""
zha_dev = cls(hass, zigpy_dev, gateway)
zha_dev.channels = channels.Channels.new(zha_d... | [
"def",
"new",
"(",
"cls",
",",
"hass",
":",
"HomeAssistantType",
",",
"zigpy_dev",
":",
"zha_typing",
".",
"ZigpyDeviceType",
",",
"gateway",
":",
"zha_typing",
".",
"ZhaGatewayType",
",",
"restored",
":",
"bool",
"=",
"False",
",",
")",
":",
"zha_dev",
"=... | [
284,
4
] | [
301,
22
] | python | en | ['en', 'sr', 'en'] | True |
ZHADevice.async_update_sw_build_id | (self, sw_version: int) | Update device sw version. | Update device sw version. | def async_update_sw_build_id(self, sw_version: int):
"""Update device sw version."""
if self.device_id is None:
return
self._zha_gateway.ha_device_registry.async_update_device(
self.device_id, sw_version=f"0x{sw_version:08x}"
) | [
"def",
"async_update_sw_build_id",
"(",
"self",
",",
"sw_version",
":",
"int",
")",
":",
"if",
"self",
".",
"device_id",
"is",
"None",
":",
"return",
"self",
".",
"_zha_gateway",
".",
"ha_device_registry",
".",
"async_update_device",
"(",
"self",
".",
"device_... | [
304,
4
] | [
310,
9
] | python | de | ['fr', 'de', 'en'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.