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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
TestFeedreaderComponent.test_feed_parsing_failed | (self, mock_parse) | Test feed where parsing fails. | Test feed where parsing fails. | def test_feed_parsing_failed(self, mock_parse):
"""Test feed where parsing fails."""
data_file = self.hass.config.path(f"{feedreader.DOMAIN}.pickle")
storage = StoredData(data_file)
manager = FeedManager(
"FEED DATA", DEFAULT_SCAN_INTERVAL, DEFAULT_MAX_ENTRIES, self.hass, sto... | [
"def",
"test_feed_parsing_failed",
"(",
"self",
",",
"mock_parse",
")",
":",
"data_file",
"=",
"self",
".",
"hass",
".",
"config",
".",
"path",
"(",
"f\"{feedreader.DOMAIN}.pickle\"",
")",
"storage",
"=",
"StoredData",
"(",
"data_file",
")",
"manager",
"=",
"F... | [
179,
4
] | [
190,
54
] | python | en | ['en', 'gd', 'en'] | True |
test_lovelace_from_storage | (hass, hass_ws_client, hass_storage) | Test we load lovelace config from storage. | Test we load lovelace config from storage. | async def test_lovelace_from_storage(hass, hass_ws_client, hass_storage):
"""Test we load lovelace config from storage."""
assert await async_setup_component(hass, "lovelace", {})
assert hass.data[frontend.DATA_PANELS]["lovelace"].config == {"mode": "storage"}
client = await hass_ws_client(hass)
#... | [
"async",
"def",
"test_lovelace_from_storage",
"(",
"hass",
",",
"hass_ws_client",
",",
"hass_storage",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"lovelace\"",
",",
"{",
"}",
")",
"assert",
"hass",
".",
"data",
"[",
"frontend",
"... | [
11,
0
] | [
59,
34
] | python | en | ['en', 'en', 'en'] | True |
test_lovelace_from_storage_save_before_load | (
hass, hass_ws_client, hass_storage
) | Test we can load lovelace config from storage. | Test we can load lovelace config from storage. | async def test_lovelace_from_storage_save_before_load(
hass, hass_ws_client, hass_storage
):
"""Test we can load lovelace config from storage."""
assert await async_setup_component(hass, "lovelace", {})
client = await hass_ws_client(hass)
# Store new config
await client.send_json(
{"id"... | [
"async",
"def",
"test_lovelace_from_storage_save_before_load",
"(",
"hass",
",",
"hass_ws_client",
",",
"hass_storage",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"lovelace\"",
",",
"{",
"}",
")",
"client",
"=",
"await",
"hass_ws_clien... | [
62,
0
] | [
77,
5
] | python | en | ['en', 'en', 'en'] | True |
test_lovelace_from_storage_delete | (hass, hass_ws_client, hass_storage) | Test we delete lovelace config from storage. | Test we delete lovelace config from storage. | async def test_lovelace_from_storage_delete(hass, hass_ws_client, hass_storage):
"""Test we delete lovelace config from storage."""
assert await async_setup_component(hass, "lovelace", {})
client = await hass_ws_client(hass)
# Store new config
await client.send_json(
{"id": 6, "type": "love... | [
"async",
"def",
"test_lovelace_from_storage_delete",
"(",
"hass",
",",
"hass_ws_client",
",",
"hass_storage",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"lovelace\"",
",",
"{",
"}",
")",
"client",
"=",
"await",
"hass_ws_client",
"(",... | [
80,
0
] | [
105,
58
] | python | en | ['en', 'en', 'en'] | True |
test_lovelace_from_yaml | (hass, hass_ws_client) | Test we load lovelace config from yaml. | Test we load lovelace config from yaml. | async def test_lovelace_from_yaml(hass, hass_ws_client):
"""Test we load lovelace config from yaml."""
assert await async_setup_component(hass, "lovelace", {"lovelace": {"mode": "YAML"}})
assert hass.data[frontend.DATA_PANELS]["lovelace"].config == {"mode": "yaml"}
client = await hass_ws_client(hass)
... | [
"async",
"def",
"test_lovelace_from_yaml",
"(",
"hass",
",",
"hass_ws_client",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"lovelace\"",
",",
"{",
"\"lovelace\"",
":",
"{",
"\"mode\"",
":",
"\"YAML\"",
"}",
"}",
")",
"assert",
"ha... | [
108,
0
] | [
155,
27
] | python | en | ['en', 'en', 'en'] | True |
test_dashboard_from_yaml | (hass, hass_ws_client, url_path) | Test we load lovelace dashboard config from yaml. | Test we load lovelace dashboard config from yaml. | async def test_dashboard_from_yaml(hass, hass_ws_client, url_path):
"""Test we load lovelace dashboard config from yaml."""
assert await async_setup_component(
hass,
"lovelace",
{
"lovelace": {
"dashboards": {
"test-panel": {
... | [
"async",
"def",
"test_dashboard_from_yaml",
"(",
"hass",
",",
"hass_ws_client",
",",
"url_path",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"lovelace\"",
",",
"{",
"\"lovelace\"",
":",
"{",
"\"dashboards\"",
":",
"{",
"\"test-panel\"... | [
159,
0
] | [
261,
27
] | python | en | ['en', 'en', 'en'] | True |
test_wrong_key_dashboard_from_yaml | (hass) | Test we don't load lovelace dashboard without hyphen config from yaml. | Test we don't load lovelace dashboard without hyphen config from yaml. | async def test_wrong_key_dashboard_from_yaml(hass):
"""Test we don't load lovelace dashboard without hyphen config from yaml."""
with assert_setup_component(0):
assert not await async_setup_component(
hass,
"lovelace",
{
"lovelace": {
... | [
"async",
"def",
"test_wrong_key_dashboard_from_yaml",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
")",
":",
"assert",
"not",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"lovelace\"",
",",
"{",
"\"lovelace\"",
":",
"{",
"\"dashboard... | [
264,
0
] | [
284,
9
] | python | en | ['en', 'en', 'en'] | True |
test_storage_dashboards | (hass, hass_ws_client, hass_storage) | Test we load lovelace config from storage. | Test we load lovelace config from storage. | async def test_storage_dashboards(hass, hass_ws_client, hass_storage):
"""Test we load lovelace config from storage."""
assert await async_setup_component(hass, "lovelace", {})
assert hass.data[frontend.DATA_PANELS]["lovelace"].config == {"mode": "storage"}
client = await hass_ws_client(hass)
# Fe... | [
"async",
"def",
"test_storage_dashboards",
"(",
"hass",
",",
"hass_ws_client",
",",
"hass_storage",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"lovelace\"",
",",
"{",
"}",
")",
"assert",
"hass",
".",
"data",
"[",
"frontend",
".",... | [
287,
0
] | [
425,
80
] | python | en | ['en', 'en', 'en'] | True |
test_storage_dashboard_migrate | (hass, hass_ws_client, hass_storage) | Test changing url path from storage config. | Test changing url path from storage config. | async def test_storage_dashboard_migrate(hass, hass_ws_client, hass_storage):
"""Test changing url path from storage config."""
hass_storage[dashboard.DASHBOARDS_STORAGE_KEY] = {
"key": "lovelace_dashboards",
"version": 1,
"data": {
"items": [
{
... | [
"async",
"def",
"test_storage_dashboard_migrate",
"(",
"hass",
",",
"hass_ws_client",
",",
"hass_storage",
")",
":",
"hass_storage",
"[",
"dashboard",
".",
"DASHBOARDS_STORAGE_KEY",
"]",
"=",
"{",
"\"key\"",
":",
"\"lovelace_dashboards\"",
",",
"\"version\"",
":",
"... | [
428,
0
] | [
478,
5
] | python | en | ['en', 'en', 'en'] | True |
test_websocket_list_dashboards | (hass, hass_ws_client) | Test listing dashboards both storage + YAML. | Test listing dashboards both storage + YAML. | async def test_websocket_list_dashboards(hass, hass_ws_client):
"""Test listing dashboards both storage + YAML."""
assert await async_setup_component(
hass,
"lovelace",
{
"lovelace": {
"dashboards": {
"test-panel-no-sidebar": {
... | [
"async",
"def",
"test_websocket_list_dashboards",
"(",
"hass",
",",
"hass_ws_client",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"lovelace\"",
",",
"{",
"\"lovelace\"",
":",
"{",
"\"dashboards\"",
":",
"{",
"\"test-panel-no-sidebar\"",
... | [
481,
0
] | [
527,
55
] | python | cy | ['de', 'cy', 'en'] | False |
normalize_package_name | (requirement: str) | Return a normalized package name from a requirement string. | Return a normalized package name from a requirement string. | def normalize_package_name(requirement: str) -> str:
"""Return a normalized package name from a requirement string."""
match = PACKAGE_REGEX.search(requirement)
if not match:
return ""
# pipdeptree needs lowercase and dash instead of underscore as separator
package = match.group(1).lower().... | [
"def",
"normalize_package_name",
"(",
"requirement",
":",
"str",
")",
"->",
"str",
":",
"match",
"=",
"PACKAGE_REGEX",
".",
"search",
"(",
"requirement",
")",
"if",
"not",
"match",
":",
"return",
"\"\"",
"# pipdeptree needs lowercase and dash instead of underscore as ... | [
48,
0
] | [
57,
18
] | python | en | ['en', 'en', 'en'] | True |
validate | (integrations: Dict[str, Integration], config: Config) | Handle requirements for integrations. | Handle requirements for integrations. | def validate(integrations: Dict[str, Integration], config: Config):
"""Handle requirements for integrations."""
ensure_cache()
# check for incompatible requirements
disable_tqdm = config.specific_integrations or os.environ.get("CI", False)
for integration in tqdm(integrations.values(), disable=di... | [
"def",
"validate",
"(",
"integrations",
":",
"Dict",
"[",
"str",
",",
"Integration",
"]",
",",
"config",
":",
"Config",
")",
":",
"ensure_cache",
"(",
")",
"# check for incompatible requirements",
"disable_tqdm",
"=",
"config",
".",
"specific_integrations",
"or",
... | [
60,
0
] | [
72,
42
] | python | en | ['en', 'en', 'en'] | True |
validate_requirements | (integration: Integration) | Validate requirements. | Validate requirements. | def validate_requirements(integration: Integration):
"""Validate requirements."""
# Some integrations have not been fixed yet so are allowed to have violations.
if integration.domain in IGNORE_VIOLATIONS:
return
integration_requirements = set()
integration_packages = set()
for req in in... | [
"def",
"validate_requirements",
"(",
"integration",
":",
"Integration",
")",
":",
"# Some integrations have not been fixed yet so are allowed to have violations.",
"if",
"integration",
".",
"domain",
"in",
"IGNORE_VIOLATIONS",
":",
"return",
"integration_requirements",
"=",
"se... | [
75,
0
] | [
117,
17
] | python | en | ['en', 'en', 'en'] | False |
ensure_cache | () | Ensure we have a cache of pipdeptree.
{
"flake8-docstring": {
"key": "flake8-docstrings",
"package_name": "flake8-docstrings",
"installed_version": "1.5.0"
"dependencies": {"flake8"}
}
}
| Ensure we have a cache of pipdeptree. | def ensure_cache():
"""Ensure we have a cache of pipdeptree.
{
"flake8-docstring": {
"key": "flake8-docstrings",
"package_name": "flake8-docstrings",
"installed_version": "1.5.0"
"dependencies": {"flake8"}
}
}
"""
global PIPDEPTREE_CAC... | [
"def",
"ensure_cache",
"(",
")",
":",
"global",
"PIPDEPTREE_CACHE",
"if",
"PIPDEPTREE_CACHE",
"is",
"not",
"None",
":",
"return",
"cache",
"=",
"{",
"}",
"for",
"item",
"in",
"json",
".",
"loads",
"(",
"subprocess",
".",
"run",
"(",
"[",
"\"pipdeptree\"",
... | [
120,
0
] | [
152,
28
] | python | en | ['en', 'en', 'en'] | True |
get_requirements | (integration: Integration, packages: Set[str]) | Return all (recursively) requirements for an integration. | Return all (recursively) requirements for an integration. | def get_requirements(integration: Integration, packages: Set[str]) -> Set[str]:
"""Return all (recursively) requirements for an integration."""
ensure_cache()
all_requirements = set()
to_check = deque(packages)
while to_check:
package = to_check.popleft()
if package in all_requir... | [
"def",
"get_requirements",
"(",
"integration",
":",
"Integration",
",",
"packages",
":",
"Set",
"[",
"str",
"]",
")",
"->",
"Set",
"[",
"str",
"]",
":",
"ensure_cache",
"(",
")",
"all_requirements",
"=",
"set",
"(",
")",
"to_check",
"=",
"deque",
"(",
... | [
155,
0
] | [
183,
27
] | python | en | ['en', 'en', 'en'] | True |
install_requirements | (integration: Integration, requirements: Set[str]) | Install integration requirements.
Return True if successful.
| Install integration requirements. | def install_requirements(integration: Integration, requirements: Set[str]) -> bool:
"""Install integration requirements.
Return True if successful.
"""
global PIPDEPTREE_CACHE
ensure_cache()
for req in requirements:
match = PIP_REGEX.search(req)
if not match:
inte... | [
"def",
"install_requirements",
"(",
"integration",
":",
"Integration",
",",
"requirements",
":",
"Set",
"[",
"str",
"]",
")",
"->",
"bool",
":",
"global",
"PIPDEPTREE_CACHE",
"ensure_cache",
"(",
")",
"for",
"req",
"in",
"requirements",
":",
"match",
"=",
"P... | [
186,
0
] | [
245,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Group Cover platform. | Set up the Group Cover platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Group Cover platform."""
async_add_entities([CoverGroup(config[CONF_NAME], config[CONF_ENTITIES])]) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"async_add_entities",
"(",
"[",
"CoverGroup",
"(",
"config",
"[",
"CONF_NAME",
"]",
",",
"config",
"[",
"CONF_ENTITIES",
... | [
64,
0
] | [
66,
78
] | python | en | ['en', 'da', 'en'] | True |
CoverGroup.__init__ | (self, name, entities) | Initialize a CoverGroup entity. | Initialize a CoverGroup entity. | def __init__(self, name, entities):
"""Initialize a CoverGroup entity."""
self._name = name
self._is_closed = False
self._is_closing = False
self._is_opening = False
self._cover_position: Optional[int] = 100
self._tilt_position = None
self._supported_featu... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"entities",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_is_closed",
"=",
"False",
"self",
".",
"_is_closing",
"=",
"False",
"self",
".",
"_is_opening",
"=",
"False",
"self",
".",
"_cover... | [
72,
4
] | [
93,
9
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.async_update_supported_features | (
self,
entity_id: str,
new_state: Optional[State],
update_state: bool = True,
) | Update dictionaries with supported features. | Update dictionaries with supported features. | async def async_update_supported_features(
self,
entity_id: str,
new_state: Optional[State],
update_state: bool = True,
) -> None:
"""Update dictionaries with supported features."""
if not new_state:
for values in self._covers.values():
val... | [
"async",
"def",
"async_update_supported_features",
"(",
"self",
",",
"entity_id",
":",
"str",
",",
"new_state",
":",
"Optional",
"[",
"State",
"]",
",",
"update_state",
":",
"bool",
"=",
"True",
",",
")",
"->",
"None",
":",
"if",
"not",
"new_state",
":",
... | [
101,
4
] | [
146,
55
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.async_added_to_hass | (self) | Register listeners. | Register listeners. | async def async_added_to_hass(self):
"""Register listeners."""
for entity_id in self._entities:
new_state = self.hass.states.get(entity_id)
if new_state is None:
continue
await self.async_update_supported_features(
entity_id, new_state,... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"for",
"entity_id",
"in",
"self",
".",
"_entities",
":",
"new_state",
"=",
"self",
".",
"hass",
".",
"states",
".",
"get",
"(",
"entity_id",
")",
"if",
"new_state",
"is",
"None",
":",
"continu... | [
148,
4
] | [
167,
43
] | python | en | ['fr', 'no', 'en'] | False |
CoverGroup.name | (self) | Return the name of the cover. | Return the name of the cover. | def name(self):
"""Return the name of the cover."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
170,
4
] | [
172,
25
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.assumed_state | (self) | Enable buttons even if at end position. | Enable buttons even if at end position. | def assumed_state(self):
"""Enable buttons even if at end position."""
return self._assumed_state | [
"def",
"assumed_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_assumed_state"
] | [
175,
4
] | [
177,
34
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.supported_features | (self) | Flag supported features for the cover. | Flag supported features for the cover. | def supported_features(self):
"""Flag supported features for the cover."""
return self._supported_features | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"self",
".",
"_supported_features"
] | [
180,
4
] | [
182,
39
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.is_closed | (self) | Return if all covers in group are closed. | Return if all covers in group are closed. | def is_closed(self):
"""Return if all covers in group are closed."""
return self._is_closed | [
"def",
"is_closed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_closed"
] | [
185,
4
] | [
187,
30
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.is_opening | (self) | Return if the cover is opening or not. | Return if the cover is opening or not. | def is_opening(self):
"""Return if the cover is opening or not."""
return self._is_opening | [
"def",
"is_opening",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_opening"
] | [
190,
4
] | [
192,
31
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.is_closing | (self) | Return if the cover is closing or not. | Return if the cover is closing or not. | def is_closing(self):
"""Return if the cover is closing or not."""
return self._is_closing | [
"def",
"is_closing",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_closing"
] | [
195,
4
] | [
197,
31
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.current_cover_position | (self) | Return current position for all covers. | Return current position for all covers. | def current_cover_position(self) -> Optional[int]:
"""Return current position for all covers."""
return self._cover_position | [
"def",
"current_cover_position",
"(",
"self",
")",
"->",
"Optional",
"[",
"int",
"]",
":",
"return",
"self",
".",
"_cover_position"
] | [
200,
4
] | [
202,
35
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.current_cover_tilt_position | (self) | Return current tilt position for all covers. | Return current tilt position for all covers. | def current_cover_tilt_position(self):
"""Return current tilt position for all covers."""
return self._tilt_position | [
"def",
"current_cover_tilt_position",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tilt_position"
] | [
205,
4
] | [
207,
34
] | python | da | ['nb', 'da', 'en'] | False |
CoverGroup.device_state_attributes | (self) | Return the state attributes for the cover group. | Return the state attributes for the cover group. | def device_state_attributes(self):
"""Return the state attributes for the cover group."""
return {ATTR_ENTITY_ID: self._entities} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_ENTITY_ID",
":",
"self",
".",
"_entities",
"}"
] | [
210,
4
] | [
212,
47
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.async_open_cover | (self, **kwargs) | Move the covers up. | Move the covers up. | async def async_open_cover(self, **kwargs):
"""Move the covers up."""
data = {ATTR_ENTITY_ID: self._covers[KEY_OPEN_CLOSE]}
await self.hass.services.async_call(
DOMAIN, SERVICE_OPEN_COVER, data, blocking=True, context=self._context
) | [
"async",
"def",
"async_open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"self",
".",
"_covers",
"[",
"KEY_OPEN_CLOSE",
"]",
"}",
"await",
"self",
".",
"hass",
".",
"services",
".",
"async_call",
"(",
... | [
214,
4
] | [
219,
9
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.async_close_cover | (self, **kwargs) | Move the covers down. | Move the covers down. | async def async_close_cover(self, **kwargs):
"""Move the covers down."""
data = {ATTR_ENTITY_ID: self._covers[KEY_OPEN_CLOSE]}
await self.hass.services.async_call(
DOMAIN, SERVICE_CLOSE_COVER, data, blocking=True, context=self._context
) | [
"async",
"def",
"async_close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"self",
".",
"_covers",
"[",
"KEY_OPEN_CLOSE",
"]",
"}",
"await",
"self",
".",
"hass",
".",
"services",
".",
"async_call",
"(",
... | [
221,
4
] | [
226,
9
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.async_stop_cover | (self, **kwargs) | Fire the stop action. | Fire the stop action. | async def async_stop_cover(self, **kwargs):
"""Fire the stop action."""
data = {ATTR_ENTITY_ID: self._covers[KEY_STOP]}
await self.hass.services.async_call(
DOMAIN, SERVICE_STOP_COVER, data, blocking=True, context=self._context
) | [
"async",
"def",
"async_stop_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"self",
".",
"_covers",
"[",
"KEY_STOP",
"]",
"}",
"await",
"self",
".",
"hass",
".",
"services",
".",
"async_call",
"(",
"DOMA... | [
228,
4
] | [
233,
9
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.async_set_cover_position | (self, **kwargs) | Set covers position. | Set covers position. | async def async_set_cover_position(self, **kwargs):
"""Set covers position."""
data = {
ATTR_ENTITY_ID: self._covers[KEY_POSITION],
ATTR_POSITION: kwargs[ATTR_POSITION],
}
await self.hass.services.async_call(
DOMAIN,
SERVICE_SET_COVER_POSIT... | [
"async",
"def",
"async_set_cover_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"self",
".",
"_covers",
"[",
"KEY_POSITION",
"]",
",",
"ATTR_POSITION",
":",
"kwargs",
"[",
"ATTR_POSITION",
"]",
",",
"}",... | [
235,
4
] | [
247,
9
] | python | en | ['fr', 'en', 'en'] | True |
CoverGroup.async_open_cover_tilt | (self, **kwargs) | Tilt covers open. | Tilt covers open. | async def async_open_cover_tilt(self, **kwargs):
"""Tilt covers open."""
data = {ATTR_ENTITY_ID: self._tilts[KEY_OPEN_CLOSE]}
await self.hass.services.async_call(
DOMAIN, SERVICE_OPEN_COVER_TILT, data, blocking=True, context=self._context
) | [
"async",
"def",
"async_open_cover_tilt",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"self",
".",
"_tilts",
"[",
"KEY_OPEN_CLOSE",
"]",
"}",
"await",
"self",
".",
"hass",
".",
"services",
".",
"async_call",
"(... | [
249,
4
] | [
254,
9
] | python | en | ['en', 'no', 'en'] | True |
CoverGroup.async_close_cover_tilt | (self, **kwargs) | Tilt covers closed. | Tilt covers closed. | async def async_close_cover_tilt(self, **kwargs):
"""Tilt covers closed."""
data = {ATTR_ENTITY_ID: self._tilts[KEY_OPEN_CLOSE]}
await self.hass.services.async_call(
DOMAIN, SERVICE_CLOSE_COVER_TILT, data, blocking=True, context=self._context
) | [
"async",
"def",
"async_close_cover_tilt",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"self",
".",
"_tilts",
"[",
"KEY_OPEN_CLOSE",
"]",
"}",
"await",
"self",
".",
"hass",
".",
"services",
".",
"async_call",
"... | [
256,
4
] | [
261,
9
] | python | en | ['en', 'en', 'en'] | True |
CoverGroup.async_stop_cover_tilt | (self, **kwargs) | Stop cover tilt. | Stop cover tilt. | async def async_stop_cover_tilt(self, **kwargs):
"""Stop cover tilt."""
data = {ATTR_ENTITY_ID: self._tilts[KEY_STOP]}
await self.hass.services.async_call(
DOMAIN, SERVICE_STOP_COVER_TILT, data, blocking=True, context=self._context
) | [
"async",
"def",
"async_stop_cover_tilt",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"self",
".",
"_tilts",
"[",
"KEY_STOP",
"]",
"}",
"await",
"self",
".",
"hass",
".",
"services",
".",
"async_call",
"(",
"... | [
263,
4
] | [
268,
9
] | python | da | ['da', 'no', 'en'] | False |
CoverGroup.async_set_cover_tilt_position | (self, **kwargs) | Set tilt position. | Set tilt position. | async def async_set_cover_tilt_position(self, **kwargs):
"""Set tilt position."""
data = {
ATTR_ENTITY_ID: self._tilts[KEY_POSITION],
ATTR_TILT_POSITION: kwargs[ATTR_TILT_POSITION],
}
await self.hass.services.async_call(
DOMAIN,
SERVICE_SET... | [
"async",
"def",
"async_set_cover_tilt_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"self",
".",
"_tilts",
"[",
"KEY_POSITION",
"]",
",",
"ATTR_TILT_POSITION",
":",
"kwargs",
"[",
"ATTR_TILT_POSITION",
"]",... | [
270,
4
] | [
282,
9
] | python | da | ['da', 'da', 'en'] | True |
CoverGroup.async_update | (self) | Update state and attributes. | Update state and attributes. | async def async_update(self):
"""Update state and attributes."""
self._assumed_state = False
self._is_closed = True
self._is_closing = False
self._is_opening = False
for entity_id in self._entities:
state = self.hass.states.get(entity_id)
if not s... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"self",
".",
"_assumed_state",
"=",
"False",
"self",
".",
"_is_closed",
"=",
"True",
"self",
".",
"_is_closing",
"=",
"False",
"self",
".",
"_is_opening",
"=",
"False",
"for",
"entity_id",
"in",
"self"... | [
284,
4
] | [
363,
25
] | python | en | ['en', 'en', 'en'] | True |
query_nb201_trial_stats | (arch, num_epochs, dataset, reduction=None, include_intermediates=False) |
Query trial stats of NAS-Bench-201 given conditions.
Parameters
----------
arch : dict or None
If a dict, it is in the format that is described in
:class:`nni.nas.benchmark.nasbench201.Nb201TrialConfig`. Only trial stats
matched will be returned. If none, all architectures in t... |
Query trial stats of NAS-Bench-201 given conditions. | def query_nb201_trial_stats(arch, num_epochs, dataset, reduction=None, include_intermediates=False):
"""
Query trial stats of NAS-Bench-201 given conditions.
Parameters
----------
arch : dict or None
If a dict, it is in the format that is described in
:class:`nni.nas.benchmark.nasbe... | [
"def",
"query_nb201_trial_stats",
"(",
"arch",
",",
"num_epochs",
",",
"dataset",
",",
"reduction",
"=",
"None",
",",
"include_intermediates",
"=",
"False",
")",
":",
"fields",
"=",
"[",
"]",
"if",
"reduction",
"==",
"'none'",
":",
"reduction",
"=",
"None",
... | [
7,
0
] | [
66,
38
] | python | en | ['en', 'error', 'th'] | False |
test_config_entry_not_ready | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test the DirecTV configuration entry not ready. | Test the DirecTV configuration entry not ready. | async def test_config_entry_not_ready(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the DirecTV configuration entry not ready."""
entry = await setup_integration(hass, aioclient_mock, setup_error=True)
assert entry.state == ENTRY_STATE_SETUP_RETRY | [
"async",
"def",
"test_config_entry_not_ready",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"entry",
"=",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
",",
"setup_error",
"=",
... | [
15,
0
] | [
21,
49
] | python | en | ['en', 'en', 'en'] | True |
test_unload_config_entry | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test the DirecTV configuration entry unloading. | Test the DirecTV configuration entry unloading. | async def test_unload_config_entry(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the DirecTV configuration entry unloading."""
entry = await setup_integration(hass, aioclient_mock)
assert entry.entry_id in hass.data[DOMAIN]
assert entry.state == ENTRY_STATE_LOADED... | [
"async",
"def",
"test_unload_config_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"entry",
"=",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
")",
"assert",
"entry",
".... | [
24,
0
] | [
37,
48
] | python | en | ['en', 'en', 'en'] | True |
msgformat | (logfunc) | The decorator used to construct the log msg. | The decorator used to construct the log msg. | def msgformat(logfunc):
"""The decorator used to construct the log msg."""
def _msgformatter(self, msg, *args):
if args:
logfunc(self, "%s %s", isinstance(msg, str) and msg or repr(msg), repr(args))
else:
logfunc(self, "%s", isinstance(msg, str) and msg or repr(msg))
... | [
"def",
"msgformat",
"(",
"logfunc",
")",
":",
"def",
"_msgformatter",
"(",
"self",
",",
"msg",
",",
"*",
"args",
")",
":",
"if",
"args",
":",
"logfunc",
"(",
"self",
",",
"\"%s %s\"",
",",
"isinstance",
"(",
"msg",
",",
"str",
")",
"and",
"msg",
"o... | [
73,
0
] | [
82,
24
] | python | en | ['en', 'en', 'en'] | True |
Logger.debug | (self, msg, *args) | Add a log with ``DEBUG`` level. | Add a log with ``DEBUG`` level. | def debug(self, msg, *args):
"""Add a log with ``DEBUG`` level."""
self._logger.debug(msg, *args, extra=self._extra) | [
"def",
"debug",
"(",
"self",
",",
"msg",
",",
"*",
"args",
")",
":",
"self",
".",
"_logger",
".",
"debug",
"(",
"msg",
",",
"*",
"args",
",",
"extra",
"=",
"self",
".",
"_extra",
")"
] | [
160,
4
] | [
162,
57
] | python | en | ['en', 'cy', 'en'] | True |
Logger.info | (self, msg, *args) | Add a log with ``INFO`` level. | Add a log with ``INFO`` level. | def info(self, msg, *args):
"""Add a log with ``INFO`` level."""
self._logger.info(msg, *args, extra=self._extra) | [
"def",
"info",
"(",
"self",
",",
"msg",
",",
"*",
"args",
")",
":",
"self",
".",
"_logger",
".",
"info",
"(",
"msg",
",",
"*",
"args",
",",
"extra",
"=",
"self",
".",
"_extra",
")"
] | [
165,
4
] | [
167,
56
] | python | en | ['en', 'en', 'en'] | True |
Logger.warn | (self, msg, *args) | Add a log with ``WARN`` level. | Add a log with ``WARN`` level. | def warn(self, msg, *args):
"""Add a log with ``WARN`` level."""
self._logger.warning(msg, *args, extra=self._extra) | [
"def",
"warn",
"(",
"self",
",",
"msg",
",",
"*",
"args",
")",
":",
"self",
".",
"_logger",
".",
"warning",
"(",
"msg",
",",
"*",
"args",
",",
"extra",
"=",
"self",
".",
"_extra",
")"
] | [
170,
4
] | [
172,
59
] | python | en | ['en', 'cy', 'en'] | True |
Logger.error | (self, msg, *args) | Add a log with ``ERROR`` level. | Add a log with ``ERROR`` level. | def error(self, msg, *args):
"""Add a log with ``ERROR`` level."""
self._logger.error(msg, *args, extra=self._extra) | [
"def",
"error",
"(",
"self",
",",
"msg",
",",
"*",
"args",
")",
":",
"self",
".",
"_logger",
".",
"error",
"(",
"msg",
",",
"*",
"args",
",",
"extra",
"=",
"self",
".",
"_extra",
")"
] | [
175,
4
] | [
177,
57
] | python | en | ['en', 'cy', 'en'] | True |
Logger.critical | (self, msg, *args) | Add a log with ``CRITICAL`` level. | Add a log with ``CRITICAL`` level. | def critical(self, msg, *args):
"""Add a log with ``CRITICAL`` level."""
self._logger.critical(msg, *args, extra=self._extra) | [
"def",
"critical",
"(",
"self",
",",
"msg",
",",
"*",
"args",
")",
":",
"self",
".",
"_logger",
".",
"critical",
"(",
"msg",
",",
"*",
"args",
",",
"extra",
"=",
"self",
".",
"_extra",
")"
] | [
180,
4
] | [
182,
60
] | python | en | ['en', 'en', 'en'] | True |
CliLogger.passive_init | (self) | Init a new ``CliLogger`` if current logger is not matched with the parameters. | Init a new ``CliLogger`` if current logger is not matched with the parameters. | def passive_init(self) -> None:
"""Init a new ``CliLogger`` if current logger is not matched with the parameters."""
if not CliLogger._logger or CliLogger._logger.log_level != CliGlobalParams.LOG_LEVEL:
CliLogger._logger = self._CliLogger() | [
"def",
"passive_init",
"(",
"self",
")",
"->",
"None",
":",
"if",
"not",
"CliLogger",
".",
"_logger",
"or",
"CliLogger",
".",
"_logger",
".",
"log_level",
"!=",
"CliGlobalParams",
".",
"LOG_LEVEL",
":",
"CliLogger",
".",
"_logger",
"=",
"self",
".",
"_CliL... | [
254,
4
] | [
257,
49
] | python | en | ['en', 'en', 'en'] | True |
CliLogger.debug | (self, message: str) | ``logger.debug()`` with passive init.
Args:
message (str): logged message.
| ``logger.debug()`` with passive init. | def debug(self, message: str) -> None:
"""``logger.debug()`` with passive init.
Args:
message (str): logged message.
"""
self.passive_init()
self._logger.debug(message) | [
"def",
"debug",
"(",
"self",
",",
"message",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"passive_init",
"(",
")",
"self",
".",
"_logger",
".",
"debug",
"(",
"message",
")"
] | [
259,
4
] | [
266,
35
] | python | en | ['en', 'en', 'en'] | True |
CliLogger.debug_yellow | (self, message: str) | ``logger.debug()`` with color yellow and passive init.
Args:
message (str): logged message.
| ``logger.debug()`` with color yellow and passive init. | def debug_yellow(self, message: str) -> None:
"""``logger.debug()`` with color yellow and passive init.
Args:
message (str): logged message.
"""
self.passive_init()
self._logger.debug('\033[33m' + message + '\033[0m') | [
"def",
"debug_yellow",
"(",
"self",
",",
"message",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"passive_init",
"(",
")",
"self",
".",
"_logger",
".",
"debug",
"(",
"'\\033[33m'",
"+",
"message",
"+",
"'\\033[0m'",
")"
] | [
268,
4
] | [
275,
60
] | python | en | ['en', 'en', 'en'] | True |
CliLogger.debug_green | (self, message: str) | ``logger.debug()`` with color green and passive init.
Args:
message (str): logged message.
| ``logger.debug()`` with color green and passive init. | def debug_green(self, message: str) -> None:
"""``logger.debug()`` with color green and passive init.
Args:
message (str): logged message.
"""
self.passive_init()
self._logger.debug('\033[32m' + message + '\033[0m') | [
"def",
"debug_green",
"(",
"self",
",",
"message",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"passive_init",
"(",
")",
"self",
".",
"_logger",
".",
"debug",
"(",
"'\\033[32m'",
"+",
"message",
"+",
"'\\033[0m'",
")"
] | [
277,
4
] | [
284,
60
] | python | en | ['en', 'en', 'en'] | True |
CliLogger.info | (self, message: str) | ``logger.info()`` with passive init.
Args:
message (str): logged message.
| ``logger.info()`` with passive init. | def info(self, message: str) -> None:
"""``logger.info()`` with passive init.
Args:
message (str): logged message.
"""
self.passive_init()
self._logger.info(message) | [
"def",
"info",
"(",
"self",
",",
"message",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"passive_init",
"(",
")",
"self",
".",
"_logger",
".",
"info",
"(",
"message",
")"
] | [
286,
4
] | [
293,
34
] | python | en | ['en', 'en', 'en'] | True |
CliLogger.warning | (self, message: str) | ``logger.warning()`` with passive init.
Args:
message (str): logged message.
| ``logger.warning()`` with passive init. | def warning(self, message: str) -> None:
"""``logger.warning()`` with passive init.
Args:
message (str): logged message.
"""
self.passive_init()
self._logger.warn(message) | [
"def",
"warning",
"(",
"self",
",",
"message",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"passive_init",
"(",
")",
"self",
".",
"_logger",
".",
"warn",
"(",
"message",
")"
] | [
295,
4
] | [
302,
34
] | python | en | ['en', 'en', 'en'] | True |
CliLogger.error | (self, message: str) | ``logger.error()`` with passive init.
Args:
message (str): logged message.
| ``logger.error()`` with passive init. | def error(self, message: str) -> None:
"""``logger.error()`` with passive init.
Args:
message (str): logged message.
"""
self.passive_init()
self._logger.error(message) | [
"def",
"error",
"(",
"self",
",",
"message",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"passive_init",
"(",
")",
"self",
".",
"_logger",
".",
"error",
"(",
"message",
")"
] | [
304,
4
] | [
311,
35
] | python | en | ['en', 'it', 'en'] | True |
CliLogger.info_green | (self, message: str) | ``logger.info()`` with color green and passive init.
Args:
message (str): logged message.
| ``logger.info()`` with color green and passive init. | def info_green(self, message: str) -> None:
"""``logger.info()`` with color green and passive init.
Args:
message (str): logged message.
"""
self.passive_init()
self._logger.info('\033[32m' + message + '\033[0m') | [
"def",
"info_green",
"(",
"self",
",",
"message",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"passive_init",
"(",
")",
"self",
".",
"_logger",
".",
"info",
"(",
"'\\033[32m'",
"+",
"message",
"+",
"'\\033[0m'",
")"
] | [
313,
4
] | [
320,
59
] | python | en | ['en', 'en', 'en'] | True |
CliLogger.warning_yellow | (self, message: str) | ``logger.warning()`` with color yellow and passive init.
Args:
message (str): logged message.
| ``logger.warning()`` with color yellow and passive init. | def warning_yellow(self, message: str) -> None:
"""``logger.warning()`` with color yellow and passive init.
Args:
message (str): logged message.
"""
self.passive_init()
self._logger.warn('\033[33m' + message + '\033[0m') | [
"def",
"warning_yellow",
"(",
"self",
",",
"message",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"passive_init",
"(",
")",
"self",
".",
"_logger",
".",
"warn",
"(",
"'\\033[33m'",
"+",
"message",
"+",
"'\\033[0m'",
")"
] | [
322,
4
] | [
329,
59
] | python | en | ['en', 'en', 'en'] | True |
CliLogger.error_red | (self, message: str) | ``logger.error()`` with color red and passive init.
Args:
message (str): logged message.
| ``logger.error()`` with color red and passive init. | def error_red(self, message: str) -> None:
"""``logger.error()`` with color red and passive init.
Args:
message (str): logged message.
"""
self.passive_init()
self._logger.error('\033[31m' + message + '\033[0m') | [
"def",
"error_red",
"(",
"self",
",",
"message",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"passive_init",
"(",
")",
"self",
".",
"_logger",
".",
"error",
"(",
"'\\033[31m'",
"+",
"message",
"+",
"'\\033[0m'",
")"
] | [
331,
4
] | [
338,
60
] | python | en | ['en', 'en', 'en'] | True |
encrypt_payload | (secret_key, payload) | Return a encrypted payload given a key and dictionary of data. | Return a encrypted payload given a key and dictionary of data. | def encrypt_payload(secret_key, payload):
"""Return a encrypted payload given a key and dictionary of data."""
try:
from nacl.encoding import Base64Encoder
from nacl.secret import SecretBox
except (ImportError, OSError):
pytest.skip("libnacl/libsodium is not installed")
retur... | [
"def",
"encrypt_payload",
"(",
"secret_key",
",",
"payload",
")",
":",
"try",
":",
"from",
"nacl",
".",
"encoding",
"import",
"Base64Encoder",
"from",
"nacl",
".",
"secret",
"import",
"SecretBox",
"except",
"(",
"ImportError",
",",
"OSError",
")",
":",
"pyte... | [
17,
0
] | [
37,
5
] | python | en | ['en', 'en', 'en'] | True |
decrypt_payload | (secret_key, encrypted_data) | Return a decrypted payload given a key and a string of encrypted data. | Return a decrypted payload given a key and a string of encrypted data. | def decrypt_payload(secret_key, encrypted_data):
"""Return a decrypted payload given a key and a string of encrypted data."""
try:
from nacl.encoding import Base64Encoder
from nacl.secret import SecretBox
except (ImportError, OSError):
pytest.skip("libnacl/libsodium is not installed"... | [
"def",
"decrypt_payload",
"(",
"secret_key",
",",
"encrypted_data",
")",
":",
"try",
":",
"from",
"nacl",
".",
"encoding",
"import",
"Base64Encoder",
"from",
"nacl",
".",
"secret",
"import",
"SecretBox",
"except",
"(",
"ImportError",
",",
"OSError",
")",
":",
... | [
40,
0
] | [
61,
37
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_render_template | (create_registrations, webhook_client) | Test that we render templates properly. | Test that we render templates properly. | async def test_webhook_handle_render_template(create_registrations, webhook_client):
"""Test that we render templates properly."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]),
json={
"type": "render_template",
"data": ... | [
"async",
"def",
"test_webhook_handle_render_template",
"(",
"create_registrations",
",",
"webhook_client",
")",
":",
"resp",
"=",
"await",
"webhook_client",
".",
"post",
"(",
"\"/api/webhook/{}\"",
".",
"format",
"(",
"create_registrations",
"[",
"1",
"]",
"[",
"\"w... | [
64,
0
] | [
87,
5
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_call_services | (hass, create_registrations, webhook_client) | Test that we call services properly. | Test that we call services properly. | async def test_webhook_handle_call_services(hass, create_registrations, webhook_client):
"""Test that we call services properly."""
calls = async_mock_service(hass, "test", "mobile_app")
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]),
json=... | [
"async",
"def",
"test_webhook_handle_call_services",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"calls",
"=",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"mobile_app\"",
")",
"resp",
"=",
"await",
"webhook_client",
".",... | [
90,
0
] | [
101,
26
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_fire_event | (hass, create_registrations, webhook_client) | Test that we can fire events. | Test that we can fire events. | async def test_webhook_handle_fire_event(hass, create_registrations, webhook_client):
"""Test that we can fire events."""
events = []
@callback
def store_event(event):
"""Helepr to store events."""
events.append(event)
hass.bus.async_listen("test_event", store_event)
resp = aw... | [
"async",
"def",
"test_webhook_handle_fire_event",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"events",
"=",
"[",
"]",
"@",
"callback",
"def",
"store_event",
"(",
"event",
")",
":",
"\"\"\"Helepr to store events.\"\"\"",
"events",
".",... | [
104,
0
] | [
124,
48
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_update_registration | (webhook_client, authed_api_client) | Test that a we can update an existing registration via webhook. | Test that a we can update an existing registration via webhook. | async def test_webhook_update_registration(webhook_client, authed_api_client):
"""Test that a we can update an existing registration via webhook."""
register_resp = await authed_api_client.post(
"/api/mobile_app/registrations", json=REGISTER_CLEARTEXT
)
assert register_resp.status == 201
re... | [
"async",
"def",
"test_webhook_update_registration",
"(",
"webhook_client",
",",
"authed_api_client",
")",
":",
"register_resp",
"=",
"await",
"authed_api_client",
".",
"post",
"(",
"\"/api/mobile_app/registrations\"",
",",
"json",
"=",
"REGISTER_CLEARTEXT",
")",
"assert",... | [
127,
0
] | [
148,
41
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_get_zones | (hass, create_registrations, webhook_client) | Test that we can get zones properly. | Test that we can get zones properly. | async def test_webhook_handle_get_zones(hass, create_registrations, webhook_client):
"""Test that we can get zones properly."""
await async_setup_component(
hass,
ZONE_DOMAIN,
{ZONE_DOMAIN: {}},
)
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registra... | [
"async",
"def",
"test_webhook_handle_get_zones",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"ZONE_DOMAIN",
",",
"{",
"ZONE_DOMAIN",
":",
"{",
"}",
"}",
",",
")",
"resp",
"=",
"... | [
151,
0
] | [
169,
47
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_get_config | (hass, create_registrations, webhook_client) | Test that we can get config properly. | Test that we can get config properly. | async def test_webhook_handle_get_config(hass, create_registrations, webhook_client):
"""Test that we can get config properly."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]),
json={"type": "get_config"},
)
assert resp.status == 200
... | [
"async",
"def",
"test_webhook_handle_get_config",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"resp",
"=",
"await",
"webhook_client",
".",
"post",
"(",
"\"/api/webhook/{}\"",
".",
"format",
"(",
"create_registrations",
"[",
"1",
"]",
... | [
172,
0
] | [
201,
32
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_returns_error_incorrect_json | (
webhook_client, create_registrations, caplog
) | Test that an error is returned when JSON is invalid. | Test that an error is returned when JSON is invalid. | async def test_webhook_returns_error_incorrect_json(
webhook_client, create_registrations, caplog
):
"""Test that an error is returned when JSON is invalid."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]), data="not json"
)
assert resp.st... | [
"async",
"def",
"test_webhook_returns_error_incorrect_json",
"(",
"webhook_client",
",",
"create_registrations",
",",
"caplog",
")",
":",
"resp",
"=",
"await",
"webhook_client",
".",
"post",
"(",
"\"/api/webhook/{}\"",
".",
"format",
"(",
"create_registrations",
"[",
... | [
204,
0
] | [
215,
40
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_decryption | (webhook_client, create_registrations) | Test that we can encrypt/decrypt properly. | Test that we can encrypt/decrypt properly. | async def test_webhook_handle_decryption(webhook_client, create_registrations):
"""Test that we can encrypt/decrypt properly."""
key = create_registrations[0]["secret"]
data = encrypt_payload(key, RENDER_TEMPLATE["data"])
container = {"type": "render_template", "encrypted": True, "encrypted_data": data... | [
"async",
"def",
"test_webhook_handle_decryption",
"(",
"webhook_client",
",",
"create_registrations",
")",
":",
"key",
"=",
"create_registrations",
"[",
"0",
"]",
"[",
"\"secret\"",
"]",
"data",
"=",
"encrypt_payload",
"(",
"key",
",",
"RENDER_TEMPLATE",
"[",
"\"d... | [
218,
0
] | [
236,
51
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_requires_encryption | (webhook_client, create_registrations) | Test that encrypted registrations only accept encrypted data. | Test that encrypted registrations only accept encrypted data. | async def test_webhook_requires_encryption(webhook_client, create_registrations):
"""Test that encrypted registrations only accept encrypted data."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[0]["webhook_id"]),
json=RENDER_TEMPLATE,
)
assert resp.st... | [
"async",
"def",
"test_webhook_requires_encryption",
"(",
"webhook_client",
",",
"create_registrations",
")",
":",
"resp",
"=",
"await",
"webhook_client",
".",
"post",
"(",
"\"/api/webhook/{}\"",
".",
"format",
"(",
"create_registrations",
"[",
"0",
"]",
"[",
"\"webh... | [
239,
0
] | [
251,
65
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_update_location | (hass, webhook_client, create_registrations) | Test that location can be updated. | Test that location can be updated. | async def test_webhook_update_location(hass, webhook_client, create_registrations):
"""Test that location can be updated."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]),
json={
"type": "update_location",
"data": {"gps"... | [
"async",
"def",
"test_webhook_update_location",
"(",
"hass",
",",
"webhook_client",
",",
"create_registrations",
")",
":",
"resp",
"=",
"await",
"webhook_client",
".",
"post",
"(",
"\"/api/webhook/{}\"",
".",
"format",
"(",
"create_registrations",
"[",
"1",
"]",
"... | [
254,
0
] | [
271,
46
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_enable_encryption | (hass, webhook_client, create_registrations) | Test that encryption can be added to a reg initially created without. | Test that encryption can be added to a reg initially created without. | async def test_webhook_enable_encryption(hass, webhook_client, create_registrations):
"""Test that encryption can be added to a reg initially created without."""
webhook_id = create_registrations[1]["webhook_id"]
enable_enc_resp = await webhook_client.post(
f"/api/webhook/{webhook_id}",
jso... | [
"async",
"def",
"test_webhook_enable_encryption",
"(",
"hass",
",",
"webhook_client",
",",
"create_registrations",
")",
":",
"webhook_id",
"=",
"create_registrations",
"[",
"1",
"]",
"[",
"\"webhook_id\"",
"]",
"enable_enc_resp",
"=",
"await",
"webhook_client",
".",
... | [
274,
0
] | [
320,
51
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_camera_stream_non_existent | (
hass, create_registrations, webhook_client
) | Test fetching camera stream URLs for a non-existent camera. | Test fetching camera stream URLs for a non-existent camera. | async def test_webhook_camera_stream_non_existent(
hass, create_registrations, webhook_client
):
"""Test fetching camera stream URLs for a non-existent camera."""
webhook_id = create_registrations[1]["webhook_id"]
resp = await webhook_client.post(
f"/api/webhook/{webhook_id}",
json={
... | [
"async",
"def",
"test_webhook_camera_stream_non_existent",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"webhook_id",
"=",
"create_registrations",
"[",
"1",
"]",
"[",
"\"webhook_id\"",
"]",
"resp",
"=",
"await",
"webhook_client",
".",
"... | [
323,
0
] | [
339,
43
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_camera_stream_non_hls | (
hass, create_registrations, webhook_client
) | Test fetching camera stream URLs for a non-HLS/stream-supporting camera. | Test fetching camera stream URLs for a non-HLS/stream-supporting camera. | async def test_webhook_camera_stream_non_hls(
hass, create_registrations, webhook_client
):
"""Test fetching camera stream URLs for a non-HLS/stream-supporting camera."""
hass.states.async_set("camera.non_stream_camera", "idle", {"supported_features": 0})
webhook_id = create_registrations[1]["webhook_i... | [
"async",
"def",
"test_webhook_camera_stream_non_hls",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"camera.non_stream_camera\"",
",",
"\"idle\"",
",",
"{",
"\"supported_features\"",
":",
"0"... | [
342,
0
] | [
364,
5
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_camera_stream_stream_available | (
hass, create_registrations, webhook_client
) | Test fetching camera stream URLs for an HLS/stream-supporting camera. | Test fetching camera stream URLs for an HLS/stream-supporting camera. | async def test_webhook_camera_stream_stream_available(
hass, create_registrations, webhook_client
):
"""Test fetching camera stream URLs for an HLS/stream-supporting camera."""
hass.states.async_set(
"camera.stream_camera", "idle", {"supported_features": CAMERA_SUPPORT_STREAM}
)
webhook_id ... | [
"async",
"def",
"test_webhook_camera_stream_stream_available",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"camera.stream_camera\"",
",",
"\"idle\"",
",",
"{",
"\"supported_features\"",
":",
... | [
367,
0
] | [
392,
88
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_camera_stream_stream_available_but_errors | (
hass, create_registrations, webhook_client
) | Test fetching camera stream URLs for an HLS/stream-supporting camera but that streaming errors. | Test fetching camera stream URLs for an HLS/stream-supporting camera but that streaming errors. | async def test_webhook_camera_stream_stream_available_but_errors(
hass, create_registrations, webhook_client
):
"""Test fetching camera stream URLs for an HLS/stream-supporting camera but that streaming errors."""
hass.states.async_set(
"camera.stream_camera", "idle", {"supported_features": CAMERA_S... | [
"async",
"def",
"test_webhook_camera_stream_stream_available_but_errors",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"camera.stream_camera\"",
",",
"\"idle\"",
",",
"{",
"\"supported_features\... | [
395,
0
] | [
420,
88
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_scan_tag | (hass, create_registrations, webhook_client) | Test that we can scan tags. | Test that we can scan tags. | async def test_webhook_handle_scan_tag(hass, create_registrations, webhook_client):
"""Test that we can scan tags."""
events = []
@callback
def store_event(event):
"""Helepr to store events."""
events.append(event)
hass.bus.async_listen("tag_scanned", store_event)
resp = await... | [
"async",
"def",
"test_webhook_handle_scan_tag",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"events",
"=",
"[",
"]",
"@",
"callback",
"def",
"store_event",
"(",
"event",
")",
":",
"\"\"\"Helepr to store events.\"\"\"",
"events",
".",
... | [
423,
0
] | [
445,
58
] | python | en | ['en', 'en', 'en'] | True |
color | (the_color, *args, reset=None) | Color helper. | Color helper. | def color(the_color, *args, reset=None):
"""Color helper."""
# pylint: disable=import-outside-toplevel
from colorlog.escape_codes import escape_codes, parse_colors
try:
if not args:
assert reset is None, "You cannot reset if nothing being printed"
return parse_colors(the... | [
"def",
"color",
"(",
"the_color",
",",
"*",
"args",
",",
"reset",
"=",
"None",
")",
":",
"# pylint: disable=import-outside-toplevel",
"from",
"colorlog",
".",
"escape_codes",
"import",
"escape_codes",
",",
"parse_colors",
"try",
":",
"if",
"not",
"args",
":",
... | [
36,
0
] | [
47,
70
] | python | en | ['en', 'nl', 'en'] | False |
run | (script_args: List) | Handle check config commandline script. | Handle check config commandline script. | def run(script_args: List) -> int:
"""Handle check config commandline script."""
parser = argparse.ArgumentParser(description="Check Home Assistant configuration.")
parser.add_argument("--script", choices=["check_config"])
parser.add_argument(
"-c",
"--config",
default=get_defaul... | [
"def",
"run",
"(",
"script_args",
":",
"List",
")",
"->",
"int",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Check Home Assistant configuration.\"",
")",
"parser",
".",
"add_argument",
"(",
"\"--script\"",
",",
"choices",
"... | [
50,
0
] | [
150,
29
] | python | en | ['en', 'es', 'en'] | True |
check | (config_dir, secrets=False) | Perform a check by mocking hass load functions. | Perform a check by mocking hass load functions. | def check(config_dir, secrets=False):
"""Perform a check by mocking hass load functions."""
logging.getLogger("homeassistant.loader").setLevel(logging.CRITICAL)
res: Dict[str, Any] = {
"yaml_files": OrderedDict(), # yaml_files loaded
"secrets": OrderedDict(), # secret cache and secrets loa... | [
"def",
"check",
"(",
"config_dir",
",",
"secrets",
"=",
"False",
")",
":",
"logging",
".",
"getLogger",
"(",
"\"homeassistant.loader\"",
")",
".",
"setLevel",
"(",
"logging",
".",
"CRITICAL",
")",
"res",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
"=",
"... | [
153,
0
] | [
224,
14
] | python | en | ['en', 'en', 'en'] | True |
async_check_config | (config_dir) | Check the HA config. | Check the HA config. | async def async_check_config(config_dir):
"""Check the HA config."""
hass = core.HomeAssistant()
hass.config.config_dir = config_dir
components = await async_check_ha_config_file(hass)
await hass.async_stop(force=True)
return components | [
"async",
"def",
"async_check_config",
"(",
"config_dir",
")",
":",
"hass",
"=",
"core",
".",
"HomeAssistant",
"(",
")",
"hass",
".",
"config",
".",
"config_dir",
"=",
"config_dir",
"components",
"=",
"await",
"async_check_ha_config_file",
"(",
"hass",
")",
"aw... | [
227,
0
] | [
233,
21
] | python | en | ['en', 'it', 'en'] | True |
line_info | (obj, **kwargs) | Display line config source. | Display line config source. | def line_info(obj, **kwargs):
"""Display line config source."""
if hasattr(obj, "__config_file__"):
return color(
"cyan", f"[source {obj.__config_file__}:{obj.__line__ or '?'}]", **kwargs
)
return "?" | [
"def",
"line_info",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"\"__config_file__\"",
")",
":",
"return",
"color",
"(",
"\"cyan\"",
",",
"f\"[source {obj.__config_file__}:{obj.__line__ or '?'}]\"",
",",
"*",
"*",
"kwargs",
... | [
236,
0
] | [
242,
14
] | python | en | ['en', 'nl', 'en'] | True |
dump_dict | (layer, indent_count=3, listi=False, **kwargs) | Display a dict.
A friendly version of print yaml_loader.yaml.dump(config).
| Display a dict. | def dump_dict(layer, indent_count=3, listi=False, **kwargs):
"""Display a dict.
A friendly version of print yaml_loader.yaml.dump(config).
"""
def sort_dict_key(val):
"""Return the dict key for sorting."""
key = str(val[0]).lower()
return "0" if key == "platform" else key
... | [
"def",
"dump_dict",
"(",
"layer",
",",
"indent_count",
"=",
"3",
",",
"listi",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"sort_dict_key",
"(",
"val",
")",
":",
"\"\"\"Return the dict key for sorting.\"\"\"",
"key",
"=",
"str",
"(",
"val",
"["... | [
245,
0
] | [
272,
41
] | python | en | ['es', 'en', 'en'] | True |
TestKiraSetup.setUp | (self) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setUp(self):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
_base_mock = MagicMock()
pykira = _base_mock.pykira
pykira.__file__ = "test"
self._module_patcher = patch.dict("sys.modules", {"pykira": pykira})
self._mod... | [
"def",
"setUp",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"_base_mock",
"=",
"MagicMock",
"(",
")",
"pykira",
"=",
"_base_mock",
".",
"pykira",
"pykira",
".",
"__file__",
"=",
"\"test\"",
"self",
".",
"_module_pa... | [
37,
4
] | [
47,
47
] | python | en | ['en', 'en', 'en'] | True |
TestKiraSetup.tear_down_cleanup | (self) | Stop everything that was started. | Stop everything that was started. | def tear_down_cleanup(self):
"""Stop everything that was started."""
self.hass.stop()
self._module_patcher.stop()
shutil.rmtree(self.work_dir, ignore_errors=True) | [
"def",
"tear_down_cleanup",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")",
"self",
".",
"_module_patcher",
".",
"stop",
"(",
")",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"work_dir",
",",
"ignore_errors",
"=",
"True",
")"
] | [
49,
4
] | [
53,
56
] | python | en | ['en', 'en', 'en'] | True |
TestKiraSetup.test_kira_empty_config | (self) | Kira component should load a default sensor. | Kira component should load a default sensor. | def test_kira_empty_config(self):
"""Kira component should load a default sensor."""
setup_component(self.hass, kira.DOMAIN, {})
assert len(self.hass.data[kira.DOMAIN]["sensor"]) == 1 | [
"def",
"test_kira_empty_config",
"(",
"self",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"kira",
".",
"DOMAIN",
",",
"{",
"}",
")",
"assert",
"len",
"(",
"self",
".",
"hass",
".",
"data",
"[",
"kira",
".",
"DOMAIN",
"]",
"[",
"\"sens... | [
55,
4
] | [
58,
62
] | python | en | ['en', 'ca', 'en'] | True |
TestKiraSetup.test_kira_setup | (self) | Ensure platforms are loaded correctly. | Ensure platforms are loaded correctly. | def test_kira_setup(self):
"""Ensure platforms are loaded correctly."""
setup_component(self.hass, kira.DOMAIN, TEST_CONFIG)
assert len(self.hass.data[kira.DOMAIN]["sensor"]) == 2
assert sorted(self.hass.data[kira.DOMAIN]["sensor"].keys()) == [
"kira",
"kira_1",
... | [
"def",
"test_kira_setup",
"(",
"self",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"kira",
".",
"DOMAIN",
",",
"TEST_CONFIG",
")",
"assert",
"len",
"(",
"self",
".",
"hass",
".",
"data",
"[",
"kira",
".",
"DOMAIN",
"]",
"[",
"\"sensor\"... | [
60,
4
] | [
72,
9
] | python | en | ['en', 'en', 'en'] | True |
TestKiraSetup.test_kira_creates_codes | (self) | Kira module should create codes file if missing. | Kira module should create codes file if missing. | def test_kira_creates_codes(self):
"""Kira module should create codes file if missing."""
code_path = os.path.join(self.work_dir, "codes.yaml")
kira.load_codes(code_path)
assert os.path.exists(code_path), "Kira component didn't create codes file" | [
"def",
"test_kira_creates_codes",
"(",
"self",
")",
":",
"code_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"work_dir",
",",
"\"codes.yaml\"",
")",
"kira",
".",
"load_codes",
"(",
"code_path",
")",
"assert",
"os",
".",
"path",
".",
"exis... | [
74,
4
] | [
78,
83
] | python | en | ['en', 'en', 'en'] | True |
TestKiraSetup.test_load_codes | (self) | Kira should ignore invalid codes. | Kira should ignore invalid codes. | def test_load_codes(self):
"""Kira should ignore invalid codes."""
code_path = os.path.join(self.work_dir, "codes.yaml")
with open(code_path, "w") as code_file:
code_file.write(KIRA_CODES)
res = kira.load_codes(code_path)
assert len(res) == 1, "Expected exactly 1 vali... | [
"def",
"test_load_codes",
"(",
"self",
")",
":",
"code_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"work_dir",
",",
"\"codes.yaml\"",
")",
"with",
"open",
"(",
"code_path",
",",
"\"w\"",
")",
"as",
"code_file",
":",
"code_file",
".",
... | [
80,
4
] | [
86,
66
] | python | en | ['en', 'en', 'en'] | True |
PolicyGradient.choose_action | (self, state: np.ndarray) | Use the actor (policy) model to generate stochastic actions.
Args:
state: Input to the actor model.
Returns:
Actions and corresponding log probabilities.
| Use the actor (policy) model to generate stochastic actions. | def choose_action(self, state: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
"""Use the actor (policy) model to generate stochastic actions.
Args:
state: Input to the actor model.
Returns:
Actions and corresponding log probabilities.
"""
state = torch.fr... | [
"def",
"choose_action",
"(",
"self",
",",
"state",
":",
"np",
".",
"ndarray",
")",
"->",
"Tuple",
"[",
"np",
".",
"ndarray",
",",
"np",
".",
"ndarray",
"]",
":",
"state",
"=",
"torch",
".",
"from_numpy",
"(",
"state",
")",
".",
"to",
"(",
"self",
... | [
27,
4
] | [
45,
70
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the DenonAVR receiver from a config entry. | Set up the DenonAVR receiver from a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the DenonAVR receiver from a config entry."""
entities = []
receiver = hass.data[DOMAIN][config_entry.entry_id][CONF_RECEIVER]
for receiver_zone in receiver.zones.values():
if config_entry.data[CONF_SERIAL_NUMBER] is ... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"entities",
"=",
"[",
"]",
"receiver",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"[",
"CONF_RECEIVER",
... | [
66,
0
] | [
79,
32
] | python | en | ['en', 'en', 'en'] | True |
DenonDevice.__init__ | (self, receiver, unique_id, config_entry) | Initialize the device. | Initialize the device. | def __init__(self, receiver, unique_id, config_entry):
"""Initialize the device."""
self._receiver = receiver
self._name = self._receiver.name
self._unique_id = unique_id
self._config_entry = config_entry
self._muted = self._receiver.muted
self._volume = self._rec... | [
"def",
"__init__",
"(",
"self",
",",
"receiver",
",",
"unique_id",
",",
"config_entry",
")",
":",
"self",
".",
"_receiver",
"=",
"receiver",
"self",
".",
"_name",
"=",
"self",
".",
"_receiver",
".",
"name",
"self",
".",
"_unique_id",
"=",
"unique_id",
"s... | [
85,
4
] | [
118,
9
] | python | en | ['en', 'en', 'en'] | True |
DenonDevice.async_added_to_hass | (self) | Register signal handler. | Register signal handler. | async def async_added_to_hass(self):
"""Register signal handler."""
self.async_on_remove(
async_dispatcher_connect(self.hass, DOMAIN, self.signal_handler)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"DOMAIN",
",",
"self",
".",
"signal_handler",
")",
")"
] | [
120,
4
] | [
124,
9
] | python | en | ['en', 'no', 'en'] | True |
DenonDevice.signal_handler | (self, data) | Handle domain-specific signal by calling appropriate method. | Handle domain-specific signal by calling appropriate method. | def signal_handler(self, data):
"""Handle domain-specific signal by calling appropriate method."""
entity_ids = data[ATTR_ENTITY_ID]
if entity_ids == ENTITY_MATCH_NONE:
return
if entity_ids == ENTITY_MATCH_ALL or self.entity_id in entity_ids:
params = {
... | [
"def",
"signal_handler",
"(",
"self",
",",
"data",
")",
":",
"entity_ids",
"=",
"data",
"[",
"ATTR_ENTITY_ID",
"]",
"if",
"entity_ids",
"==",
"ENTITY_MATCH_NONE",
":",
"return",
"if",
"entity_ids",
"==",
"ENTITY_MATCH_ALL",
"or",
"self",
".",
"entity_id",
"in"... | [
126,
4
] | [
139,
51
] | python | en | ['en', 'en', 'en'] | True |
DenonDevice.update | (self) | Get the latest status information from device. | Get the latest status information from device. | def update(self):
"""Get the latest status information from device."""
self._receiver.update()
self._name = self._receiver.name
self._muted = self._receiver.muted
self._volume = self._receiver.volume
self._current_source = self._receiver.input_func
self._source_li... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_receiver",
".",
"update",
"(",
")",
"self",
".",
"_name",
"=",
"self",
".",
"_receiver",
".",
"name",
"self",
".",
"_muted",
"=",
"self",
".",
"_receiver",
".",
"muted",
"self",
".",
"_volume",
... | [
141,
4
] | [
160,
64
] | python | en | ['en', 'en', 'en'] | True |
DenonDevice.unique_id | (self) | Return the unique id of the zone. | Return the unique id of the zone. | def unique_id(self):
"""Return the unique id of the zone."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
163,
4
] | [
165,
30
] | python | en | ['en', 'en', 'en'] | True |
DenonDevice.device_info | (self) | Return the device info of the receiver. | Return the device info of the receiver. | def device_info(self):
"""Return the device info of the receiver."""
if self._config_entry.data[CONF_SERIAL_NUMBER] is None:
return None
device_info = {
"identifiers": {(DOMAIN, self._config_entry.unique_id)},
"manufacturer": self._config_entry.data[CONF_MANU... | [
"def",
"device_info",
"(",
"self",
")",
":",
"if",
"self",
".",
"_config_entry",
".",
"data",
"[",
"CONF_SERIAL_NUMBER",
"]",
"is",
"None",
":",
"return",
"None",
"device_info",
"=",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_co... | [
168,
4
] | [
184,
26
] | python | en | ['en', 'en', 'en'] | True |
DenonDevice.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
187,
4
] | [
189,
25
] | python | en | ['en', 'en', 'en'] | True |
DenonDevice.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
192,
4
] | [
194,
26
] | python | en | ['en', 'en', 'en'] | True |
DenonDevice.is_volume_muted | (self) | Return boolean if volume is currently muted. | Return boolean if volume is currently muted. | def is_volume_muted(self):
"""Return boolean if volume is currently muted."""
return self._muted | [
"def",
"is_volume_muted",
"(",
"self",
")",
":",
"return",
"self",
".",
"_muted"
] | [
197,
4
] | [
199,
26
] | python | en | ['en', 'en', 'en'] | True |
DenonDevice.volume_level | (self) | Volume level of the media player (0..1). | Volume level of the media player (0..1). | def volume_level(self):
"""Volume level of the media player (0..1)."""
# Volume is sent in a format like -50.0. Minimum is -80.0,
# maximum is 18.0
return (float(self._volume) + 80) / 100 | [
"def",
"volume_level",
"(",
"self",
")",
":",
"# Volume is sent in a format like -50.0. Minimum is -80.0,",
"# maximum is 18.0",
"return",
"(",
"float",
"(",
"self",
".",
"_volume",
")",
"+",
"80",
")",
"/",
"100"
] | [
202,
4
] | [
206,
47
] | python | en | ['en', 'en', 'en'] | True |
DenonDevice.source | (self) | Return the current input source. | Return the current input source. | def source(self):
"""Return the current input source."""
return self._current_source | [
"def",
"source",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_source"
] | [
209,
4
] | [
211,
35
] | 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.