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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
CloudGoogleConfig.should_report_state | (self) | Return if states should be proactively reported. | Return if states should be proactively reported. | def should_report_state(self):
"""Return if states should be proactively reported."""
return self._cloud.is_logged_in and self._prefs.google_report_state | [
"def",
"should_report_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cloud",
".",
"is_logged_in",
"and",
"self",
".",
"_prefs",
".",
"google_report_state"
] | [
58,
4
] | [
60,
75
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.local_sdk_webhook_id | (self) | Return the local SDK webhook.
Return None to disable the local SDK.
| Return the local SDK webhook. | def local_sdk_webhook_id(self):
"""Return the local SDK webhook.
Return None to disable the local SDK.
"""
return self._prefs.google_local_webhook_id | [
"def",
"local_sdk_webhook_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_prefs",
".",
"google_local_webhook_id"
] | [
63,
4
] | [
68,
50
] | python | en | ['en', 'zh', 'en'] | True |
CloudGoogleConfig.local_sdk_user_id | (self) | Return the user ID to be used for actions received via the local SDK. | Return the user ID to be used for actions received via the local SDK. | def local_sdk_user_id(self):
"""Return the user ID to be used for actions received via the local SDK."""
return self._user | [
"def",
"local_sdk_user_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_user"
] | [
71,
4
] | [
73,
25
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.cloud_user | (self) | Return Cloud User account. | Return Cloud User account. | def cloud_user(self):
"""Return Cloud User account."""
return self._user | [
"def",
"cloud_user",
"(",
"self",
")",
":",
"return",
"self",
".",
"_user"
] | [
76,
4
] | [
78,
25
] | python | en | ['en', 'id', 'en'] | True |
CloudGoogleConfig.async_initialize | (self) | Perform async initialization of config. | Perform async initialization of config. | async def async_initialize(self):
"""Perform async initialization of config."""
await super().async_initialize()
# Remove bad data that was there until 0.103.6 - Jan 6, 2020
self._store.pop_agent_user_id(self._user)
self._prefs.async_listen_updates(self._async_prefs_updated)
... | [
"async",
"def",
"async_initialize",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_initialize",
"(",
")",
"# Remove bad data that was there until 0.103.6 - Jan 6, 2020",
"self",
".",
"_store",
".",
"pop_agent_user_id",
"(",
"self",
".",
"_user",
")",... | [
80,
4
] | [
91,
9
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.should_expose | (self, state) | If a state object should be exposed. | If a state object should be exposed. | def should_expose(self, state):
"""If a state object should be exposed."""
return self._should_expose_entity_id(state.entity_id) | [
"def",
"should_expose",
"(",
"self",
",",
"state",
")",
":",
"return",
"self",
".",
"_should_expose_entity_id",
"(",
"state",
".",
"entity_id",
")"
] | [
93,
4
] | [
95,
61
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig._should_expose_entity_id | (self, entity_id) | If an entity ID should be exposed. | If an entity ID should be exposed. | def _should_expose_entity_id(self, entity_id):
"""If an entity ID should be exposed."""
if entity_id in CLOUD_NEVER_EXPOSED_ENTITIES:
return False
if not self._config["filter"].empty_filter:
return self._config["filter"](entity_id)
entity_configs = self._prefs.g... | [
"def",
"_should_expose_entity_id",
"(",
"self",
",",
"entity_id",
")",
":",
"if",
"entity_id",
"in",
"CLOUD_NEVER_EXPOSED_ENTITIES",
":",
"return",
"False",
"if",
"not",
"self",
".",
"_config",
"[",
"\"filter\"",
"]",
".",
"empty_filter",
":",
"return",
"self",
... | [
97,
4
] | [
117,
62
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.agent_user_id | (self) | Return Agent User Id to use for query responses. | Return Agent User Id to use for query responses. | def agent_user_id(self):
"""Return Agent User Id to use for query responses."""
return self._cloud.username | [
"def",
"agent_user_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cloud",
".",
"username"
] | [
120,
4
] | [
122,
35
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.get_agent_user_id | (self, context) | Get agent user ID making request. | Get agent user ID making request. | def get_agent_user_id(self, context):
"""Get agent user ID making request."""
return self.agent_user_id | [
"def",
"get_agent_user_id",
"(",
"self",
",",
"context",
")",
":",
"return",
"self",
".",
"agent_user_id"
] | [
124,
4
] | [
126,
33
] | python | en | ['fr', 'en', 'en'] | True |
CloudGoogleConfig.should_2fa | (self, state) | If an entity should be checked for 2FA. | If an entity should be checked for 2FA. | def should_2fa(self, state):
"""If an entity should be checked for 2FA."""
entity_configs = self._prefs.google_entity_configs
entity_config = entity_configs.get(state.entity_id, {})
return not entity_config.get(PREF_DISABLE_2FA, DEFAULT_DISABLE_2FA) | [
"def",
"should_2fa",
"(",
"self",
",",
"state",
")",
":",
"entity_configs",
"=",
"self",
".",
"_prefs",
".",
"google_entity_configs",
"entity_config",
"=",
"entity_configs",
".",
"get",
"(",
"state",
".",
"entity_id",
",",
"{",
"}",
")",
"return",
"not",
"... | [
128,
4
] | [
132,
75
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.async_report_state | (self, message, agent_user_id: str) | Send a state report to Google. | Send a state report to Google. | async def async_report_state(self, message, agent_user_id: str):
"""Send a state report to Google."""
try:
await self._cloud.google_report_state.async_send_message(message)
except ErrorResponse as err:
_LOGGER.warning("Error reporting state - %s: %s", err.code, err.messag... | [
"async",
"def",
"async_report_state",
"(",
"self",
",",
"message",
",",
"agent_user_id",
":",
"str",
")",
":",
"try",
":",
"await",
"self",
".",
"_cloud",
".",
"google_report_state",
".",
"async_send_message",
"(",
"message",
")",
"except",
"ErrorResponse",
"a... | [
134,
4
] | [
139,
84
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig._async_request_sync_devices | (self, agent_user_id: str) | Trigger a sync with Google. | Trigger a sync with Google. | async def _async_request_sync_devices(self, agent_user_id: str):
"""Trigger a sync with Google."""
if self._sync_entities_lock.locked():
return HTTP_OK
async with self._sync_entities_lock:
resp = await cloud_api.async_google_actions_request_sync(self._cloud)
... | [
"async",
"def",
"_async_request_sync_devices",
"(",
"self",
",",
"agent_user_id",
":",
"str",
")",
":",
"if",
"self",
".",
"_sync_entities_lock",
".",
"locked",
"(",
")",
":",
"return",
"HTTP_OK",
"async",
"with",
"self",
".",
"_sync_entities_lock",
":",
"resp... | [
141,
4
] | [
148,
30
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig._async_prefs_updated | (self, prefs) | Handle updated preferences. | Handle updated preferences. | async def _async_prefs_updated(self, prefs):
"""Handle updated preferences."""
if self.should_report_state != self.is_reporting_state:
if self.should_report_state:
self.async_enable_report_state()
else:
self.async_disable_report_state()
... | [
"async",
"def",
"_async_prefs_updated",
"(",
"self",
",",
"prefs",
")",
":",
"if",
"self",
".",
"should_report_state",
"!=",
"self",
".",
"is_reporting_state",
":",
"if",
"self",
".",
"should_report_state",
":",
"self",
".",
"async_enable_report_state",
"(",
")"... | [
150,
4
] | [
176,
62
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig._handle_entity_registry_updated | (self, event) | Handle when entity registry updated. | Handle when entity registry updated. | async def _handle_entity_registry_updated(self, event):
"""Handle when entity registry updated."""
if not self.enabled or not self._cloud.is_logged_in:
return
# Only consider entity registry updates if info relevant for Google has changed
if event.data["action"] == "update" ... | [
"async",
"def",
"_handle_entity_registry_updated",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"enabled",
"or",
"not",
"self",
".",
"_cloud",
".",
"is_logged_in",
":",
"return",
"# Only consider entity registry updates if info relevant for Google has ... | [
178,
4
] | [
207,
81
] | python | en | ['en', 'en', 'en'] | True |
MatrixAttributeAccessor.columns | (self) | int: Column number. | int: Column number. | def columns(self) -> int:
"""int: Column number."""
return self._col_num | [
"def",
"columns",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_col_num"
] | [
24,
4
] | [
26,
28
] | python | en | ['en', 'lb', 'en'] | True |
MatrixAttributeAccessor.rows | (self) | int: Row number. | int: Row number. | def rows(self) -> int:
"""int: Row number."""
return self._row_num | [
"def",
"rows",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_row_num"
] | [
29,
4
] | [
31,
28
] | python | en | ['en', 'en', 'en'] | True |
MatrixAttributeAccessor._ensure_attr | (self) | Ensure that the attribute instance correct | Ensure that the attribute instance correct | def _ensure_attr(self):
"""Ensure that the attribute instance correct"""
if self._attr is None:
self._attr = getattr(self._node, self._attr_name, None)
assert self._attr is not None | [
"def",
"_ensure_attr",
"(",
"self",
")",
":",
"if",
"self",
".",
"_attr",
"is",
"None",
":",
"self",
".",
"_attr",
"=",
"getattr",
"(",
"self",
".",
"_node",
",",
"self",
".",
"_attr_name",
",",
"None",
")",
"assert",
"self",
".",
"_attr",
"is",
"n... | [
33,
4
] | [
38,
37
] | python | en | ['en', 'en', 'en'] | True |
MatrixAttributeAccessor.get_row | (self, row_idx: int) | Get values of a row.
Args:
row_idx (int): Index of target row.
Returns:
list: List of value for that row.
| Get values of a row. | def get_row(self, row_idx: int) -> list:
"""Get values of a row.
Args:
row_idx (int): Index of target row.
Returns:
list: List of value for that row.
"""
self._ensure_attr()
start = self._col_num * row_idx
return self._attr[start: start ... | [
"def",
"get_row",
"(",
"self",
",",
"row_idx",
":",
"int",
")",
"->",
"list",
":",
"self",
".",
"_ensure_attr",
"(",
")",
"start",
"=",
"self",
".",
"_col_num",
"*",
"row_idx",
"return",
"self",
".",
"_attr",
"[",
"start",
":",
"start",
"+",
"self",
... | [
67,
4
] | [
79,
55
] | python | en | ['en', 'en', 'en'] | True |
MatrixAttributeAccessor.get_column | (self, column_idx: int) | Get values of a column.
Args:
column_idx (int): Index of target column.
Returns:
list: List of value for that column.
| Get values of a column. | def get_column(self, column_idx: int):
"""Get values of a column.
Args:
column_idx (int): Index of target column.
Returns:
list: List of value for that column.
"""
self._ensure_attr()
row_indices = [r * self._col_num + column_idx for r in range(... | [
"def",
"get_column",
"(",
"self",
",",
"column_idx",
":",
"int",
")",
":",
"self",
".",
"_ensure_attr",
"(",
")",
"row_indices",
"=",
"[",
"r",
"*",
"self",
".",
"_col_num",
"+",
"column_idx",
"for",
"r",
"in",
"range",
"(",
"self",
".",
"_row_num",
... | [
81,
4
] | [
94,
38
] | python | en | ['en', 'ca', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up LW-12 WiFi LED Controller platform. | Set up LW-12 WiFi LED Controller platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up LW-12 WiFi LED Controller platform."""
# Assign configuration variables.
name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
# Add devices
lw12_light = lw12.LW12Controller(host, ... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"# Assign configuration variables.",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"host",
"=",
"config",
".",
"get",
"(",
"CO... | [
38,
0
] | [
46,
46
] | python | en | ['en', 'da', 'en'] | True |
LW12WiFi.__init__ | (self, name, lw12_light) | Initialise LW-12 WiFi LED Controller.
:param name: Friendly name for this platform to use.
:param lw12_light: Instance of the LW12 controller.
| Initialise LW-12 WiFi LED Controller. | def __init__(self, name, lw12_light):
"""Initialise LW-12 WiFi LED Controller.
:param name: Friendly name for this platform to use.
:param lw12_light: Instance of the LW12 controller.
"""
self._light = lw12_light
self._name = name
self._state = None
self.... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"lw12_light",
")",
":",
"self",
".",
"_light",
"=",
"lw12_light",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_effect",
"=",
"None",
"self",
".",
"_rgb_color",
... | [
52,
4
] | [
67,
9
] | python | en | ['et', 'en', 'it'] | False |
LW12WiFi.name | (self) | Return the display name of the controlled light. | Return the display name of the controlled light. | def name(self):
"""Return the display name of the controlled light."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
70,
4
] | [
72,
25
] | python | en | ['en', 'en', 'en'] | True |
LW12WiFi.brightness | (self) | Return the brightness of the light. | Return the brightness of the light. | def brightness(self):
"""Return the brightness of the light."""
return self._brightness | [
"def",
"brightness",
"(",
"self",
")",
":",
"return",
"self",
".",
"_brightness"
] | [
75,
4
] | [
77,
31
] | python | en | ['en', 'no', 'en'] | True |
LW12WiFi.hs_color | (self) | Read back the hue-saturation of the light. | Read back the hue-saturation of the light. | def hs_color(self):
"""Read back the hue-saturation of the light."""
return color_util.color_RGB_to_hs(*self._rgb_color) | [
"def",
"hs_color",
"(",
"self",
")",
":",
"return",
"color_util",
".",
"color_RGB_to_hs",
"(",
"*",
"self",
".",
"_rgb_color",
")"
] | [
80,
4
] | [
82,
59
] | python | en | ['en', 'en', 'en'] | True |
LW12WiFi.effect | (self) | Return current light effect. | Return current light effect. | def effect(self):
"""Return current light effect."""
if self._effect is None:
return None
return self._effect.replace("_", " ").title() | [
"def",
"effect",
"(",
"self",
")",
":",
"if",
"self",
".",
"_effect",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_effect",
".",
"replace",
"(",
"\"_\"",
",",
"\" \"",
")",
".",
"title",
"(",
")"
] | [
85,
4
] | [
89,
53
] | python | da | ['fr', 'da', 'en'] | False |
LW12WiFi.is_on | (self) | Return true if light is on. | Return true if light is on. | def is_on(self):
"""Return true if light is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
92,
4
] | [
94,
26
] | python | en | ['en', 'et', 'en'] | True |
LW12WiFi.supported_features | (self) | Return a list of supported features. | Return a list of supported features. | def supported_features(self):
"""Return a list of supported features."""
return self._supported_features | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"self",
".",
"_supported_features"
] | [
97,
4
] | [
99,
39
] | python | en | ['en', 'en', 'en'] | True |
LW12WiFi.effect_list | (self) | Return a list of available effects.
Use the Enum element name for display.
| Return a list of available effects. | def effect_list(self):
"""Return a list of available effects.
Use the Enum element name for display.
"""
return [effect.name.replace("_", " ").title() for effect in lw12.LW12_EFFECT] | [
"def",
"effect_list",
"(",
"self",
")",
":",
"return",
"[",
"effect",
".",
"name",
".",
"replace",
"(",
"\"_\"",
",",
"\" \"",
")",
".",
"title",
"(",
")",
"for",
"effect",
"in",
"lw12",
".",
"LW12_EFFECT",
"]"
] | [
102,
4
] | [
107,
85
] | python | en | ['en', 'en', 'en'] | True |
LW12WiFi.assumed_state | (self) | Return True if unable to access real state of the entity. | Return True if unable to access real state of the entity. | def assumed_state(self) -> bool:
"""Return True if unable to access real state of the entity."""
return True | [
"def",
"assumed_state",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
110,
4
] | [
112,
19
] | python | en | ['en', 'en', 'en'] | True |
LW12WiFi.should_poll | (self) | Return False to not poll the state of this entity. | Return False to not poll the state of this entity. | def should_poll(self) -> bool:
"""Return False to not poll the state of this entity."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
115,
4
] | [
117,
20
] | python | en | ['en', 'en', 'en'] | True |
LW12WiFi.turn_on | (self, **kwargs) | Instruct the light to turn on. | Instruct the light to turn on. | def turn_on(self, **kwargs):
"""Instruct the light to turn on."""
self._light.light_on()
if ATTR_HS_COLOR in kwargs:
self._rgb_color = color_util.color_hs_to_RGB(*kwargs[ATTR_HS_COLOR])
self._light.set_color(*self._rgb_color)
self._effect = None
if ATT... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_light",
".",
"light_on",
"(",
")",
"if",
"ATTR_HS_COLOR",
"in",
"kwargs",
":",
"self",
".",
"_rgb_color",
"=",
"color_util",
".",
"color_hs_to_RGB",
"(",
"*",
"kwargs",
"[... | [
119,
4
] | [
144,
26
] | python | en | ['en', 'en', 'en'] | True |
LW12WiFi.turn_off | (self, **kwargs) | Instruct the light to turn off. | Instruct the light to turn off. | def turn_off(self, **kwargs):
"""Instruct the light to turn off."""
self._light.light_off()
self._state = False | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_light",
".",
"light_off",
"(",
")",
"self",
".",
"_state",
"=",
"False"
] | [
146,
4
] | [
149,
27
] | python | en | ['en', 'en', 'en'] | True |
test_get_jwt | (hass) | Test signing of key. | Test signing of key. | async def test_get_jwt(hass):
"""Test signing of key."""
jwt = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJkdW1teUBkdW1teS5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsInNjb3BlIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vYXV0aC9ob21lZ3JhcGgiLCJhdWQiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20vby9vYXV0aDIvdG9rZW4iLCJpYXQiOjE1Nz... | [
"async",
"def",
"test_get_jwt",
"(",
"hass",
")",
":",
"jwt",
"=",
"\"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJkdW1teUBkdW1teS5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsInNjb3BlIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vYXV0aC9ob21lZ3JhcGgiLCJhdWQiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20vby9vYXV0aDIvdG9... | [
34,
0
] | [
43,
21
] | python | en | ['en', 'zu', 'en'] | True |
test_get_access_token | (hass, aioclient_mock) | Test the function to get access token. | Test the function to get access token. | async def test_get_access_token(hass, aioclient_mock):
"""Test the function to get access token."""
jwt = "dummyjwt"
aioclient_mock.post(
HOMEGRAPH_TOKEN_URL,
status=200,
json={"access_token": "1234", "expires_in": 3600},
)
await _get_homegraph_token(hass, jwt)
assert a... | [
"async",
"def",
"test_get_access_token",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"jwt",
"=",
"\"dummyjwt\"",
"aioclient_mock",
".",
"post",
"(",
"HOMEGRAPH_TOKEN_URL",
",",
"status",
"=",
"200",
",",
"json",
"=",
"{",
"\"access_token\"",
":",
"\"1234\"",
... | [
46,
0
] | [
61,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_access_token | (hass) | Test the function to update access token when expired. | Test the function to update access token when expired. | async def test_update_access_token(hass):
"""Test the function to update access token when expired."""
jwt = "dummyjwt"
config = GoogleConfig(hass, DUMMY_CONFIG)
await config.async_initialize()
base_time = datetime(2019, 10, 14, tzinfo=timezone.utc)
with patch(
"homeassistant.component... | [
"async",
"def",
"test_update_access_token",
"(",
"hass",
")",
":",
"jwt",
"=",
"\"dummyjwt\"",
"config",
"=",
"GoogleConfig",
"(",
"hass",
",",
"DUMMY_CONFIG",
")",
"await",
"config",
".",
"async_initialize",
"(",
")",
"base_time",
"=",
"datetime",
"(",
"2019"... | [
64,
0
] | [
96,
43
] | python | en | ['en', 'en', 'en'] | True |
test_call_homegraph_api | (hass, aioclient_mock, hass_storage) | Test the function to call the homegraph api. | Test the function to call the homegraph api. | async def test_call_homegraph_api(hass, aioclient_mock, hass_storage):
"""Test the function to call the homegraph api."""
config = GoogleConfig(hass, DUMMY_CONFIG)
await config.async_initialize()
with patch(
"homeassistant.components.google_assistant.http._get_homegraph_token"
) as mock_get... | [
"async",
"def",
"test_call_homegraph_api",
"(",
"hass",
",",
"aioclient_mock",
",",
"hass_storage",
")",
":",
"config",
"=",
"GoogleConfig",
"(",
"hass",
",",
"DUMMY_CONFIG",
")",
"await",
"config",
".",
"async_initialize",
"(",
")",
"with",
"patch",
"(",
"\"h... | [
99,
0
] | [
119,
37
] | python | en | ['en', 'en', 'en'] | True |
test_call_homegraph_api_retry | (hass, aioclient_mock, hass_storage) | Test the that the calls get retried with new token on 401. | Test the that the calls get retried with new token on 401. | async def test_call_homegraph_api_retry(hass, aioclient_mock, hass_storage):
"""Test the that the calls get retried with new token on 401."""
config = GoogleConfig(hass, DUMMY_CONFIG)
await config.async_initialize()
with patch(
"homeassistant.components.google_assistant.http._get_homegraph_toke... | [
"async",
"def",
"test_call_homegraph_api_retry",
"(",
"hass",
",",
"aioclient_mock",
",",
"hass_storage",
")",
":",
"config",
"=",
"GoogleConfig",
"(",
"hass",
",",
"DUMMY_CONFIG",
")",
"await",
"config",
".",
"async_initialize",
"(",
")",
"with",
"patch",
"(",
... | [
122,
0
] | [
144,
37
] | python | en | ['en', 'en', 'en'] | True |
test_report_state | (hass, aioclient_mock, hass_storage) | Test the report state function. | Test the report state function. | async def test_report_state(hass, aioclient_mock, hass_storage):
"""Test the report state function."""
agent_user_id = "user"
config = GoogleConfig(hass, DUMMY_CONFIG)
await config.async_initialize()
await config.async_connect_agent_user(agent_user_id)
message = {"devices": {}}
with patch.... | [
"async",
"def",
"test_report_state",
"(",
"hass",
",",
"aioclient_mock",
",",
"hass_storage",
")",
":",
"agent_user_id",
"=",
"\"user\"",
"config",
"=",
"GoogleConfig",
"(",
"hass",
",",
"DUMMY_CONFIG",
")",
"await",
"config",
".",
"async_initialize",
"(",
")",
... | [
147,
0
] | [
161,
9
] | python | en | ['en', 'en', 'en'] | True |
is_command_yes | (cmd: str) | Check if user agree with current command.
Args:
cmd (str): Command input value.
Returns:
bool: True if command value is match "yes" or "y" (case insensitive.).
| Check if user agree with current command. | def is_command_yes(cmd: str):
"""Check if user agree with current command.
Args:
cmd (str): Command input value.
Returns:
bool: True if command value is match "yes" or "y" (case insensitive.).
"""
lower_cmd = cmd.lower()
return lower_cmd == "yes" or lower_cmd == "y" | [
"def",
"is_command_yes",
"(",
"cmd",
":",
"str",
")",
":",
"lower_cmd",
"=",
"cmd",
".",
"lower",
"(",
")",
"return",
"lower_cmd",
"==",
"\"yes\"",
"or",
"lower_cmd",
"==",
"\"y\""
] | [
44,
0
] | [
55,
49
] | python | en | ['en', 'en', 'en'] | True |
new_project | (**kwargs: dict) | Create a new project. | Create a new project. | def new_project(**kwargs: dict):
"""Create a new project."""
use_builtin_scenario = is_command_yes(prompt("Use built-in scenario?", default="yes"))
if use_builtin_scenario:
generate_function = new_project_with_builtin_scenario
# Build built-in scenario completer.
builtin_scenarios ... | [
"def",
"new_project",
"(",
"*",
"*",
"kwargs",
":",
"dict",
")",
":",
"use_builtin_scenario",
"=",
"is_command_yes",
"(",
"prompt",
"(",
"\"Use built-in scenario?\"",
",",
"default",
"=",
"\"yes\"",
")",
")",
"if",
"use_builtin_scenario",
":",
"generate_function",... | [
58,
0
] | [
165,
34
] | python | en | ['en', 'en', 'en'] | True |
new_project_with_builtin_scenario | (options: dict) | Create a runner.py to run with built-in scenario.
Args:
options (dict): Options to generate runner.py.
| Create a runner.py to run with built-in scenario. | def new_project_with_builtin_scenario(options: dict):
"""Create a runner.py to run with built-in scenario.
Args:
options (dict): Options to generate runner.py.
"""
if not options["use_builtin_topology"]:
# Create a folder to place new topology.
topology_root_path = os.path.join(... | [
"def",
"new_project_with_builtin_scenario",
"(",
"options",
":",
"dict",
")",
":",
"if",
"not",
"options",
"[",
"\"use_builtin_topology\"",
"]",
":",
"# Create a folder to place new topology.",
"topology_root_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".... | [
168,
0
] | [
221,
33
] | python | en | ['en', 'en', 'en'] | True |
new_project_from_scratch | (options: dict) | Create a project to customize scenario.
Args:
options (dict): Options for new project.
| Create a project to customize scenario. | def new_project_from_scratch(options: dict):
"""Create a project to customize scenario.
Args:
options (dict): Options for new project.
"""
# Scenario folder
scenario_folder = os.path.join(os.getcwd(), "scenario")
if not os.path.exists(scenario_folder):
os.mkdir(scenario_folder)... | [
"def",
"new_project_from_scratch",
"(",
"options",
":",
"dict",
")",
":",
"# Scenario folder",
"scenario_folder",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"getcwd",
"(",
")",
",",
"\"scenario\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"exi... | [
224,
0
] | [
271,
77
] | python | en | ['en', 'ro', 'en'] | True |
generate_environment | () | Generate a common template environment. | Generate a common template environment. | def generate_environment():
"""Generate a common template environment."""
env = Environment(
loader=PackageLoader("maro", "cli/project_generator/templates"),
trim_blocks=True
)
return env | [
"def",
"generate_environment",
"(",
")",
":",
"env",
"=",
"Environment",
"(",
"loader",
"=",
"PackageLoader",
"(",
"\"maro\"",
",",
"\"cli/project_generator/templates\"",
")",
",",
"trim_blocks",
"=",
"True",
")",
"return",
"env"
] | [
274,
0
] | [
281,
14
] | python | en | ['gl', 'en', 'en'] | True |
generate_runner | (env: Environment, options: dict) | Generate runner.py with options.
Args:
env (Environment): Template environment used to retrieve template.
options (dict): Options for runner.py.
| Generate runner.py with options. | def generate_runner(env: Environment, options: dict):
"""Generate runner.py with options.
Args:
env (Environment): Template environment used to retrieve template.
options (dict): Options for runner.py.
"""
use_builtin_scenario = options.get("use_builtin_scenario", False)
if use_bui... | [
"def",
"generate_runner",
"(",
"env",
":",
"Environment",
",",
"options",
":",
"dict",
")",
":",
"use_builtin_scenario",
"=",
"options",
".",
"get",
"(",
"\"use_builtin_scenario\"",
",",
"False",
")",
"if",
"use_builtin_scenario",
":",
"template_name",
"=",
"\"r... | [
284,
0
] | [
301,
50
] | python | en | ['en', 'en', 'en'] | True |
generate_business_engine | (env: Environment, folder: str, options: dict) | Generate business_engine.py with options.
Args:
env (Environment): Template environment used to retrieve template.
options (dict): Options for business_engine.py.
| Generate business_engine.py with options. | def generate_business_engine(env: Environment, folder: str, options: dict):
"""Generate business_engine.py with options.
Args:
env (Environment): Template environment used to retrieve template.
options (dict): Options for business_engine.py.
"""
template = env.get_template("business_eng... | [
"def",
"generate_business_engine",
"(",
"env",
":",
"Environment",
",",
"folder",
":",
"str",
",",
"options",
":",
"dict",
")",
":",
"template",
"=",
"env",
".",
"get_template",
"(",
"\"business_engine.py.jinja\"",
")",
"with",
"open",
"(",
"os",
".",
"path"... | [
304,
0
] | [
314,
50
] | python | en | ['en', 'en', 'en'] | True |
generate_frame_builder | (env: Environment, folder: str, options: dict) | Generate frame_builder.py with options.
Args:
env (Environment): Template environment used to retrieve template.
folder (str): Folder to place new file.
options (dict): Options for frame_builder.py.
| Generate frame_builder.py with options. | def generate_frame_builder(env: Environment, folder: str, options: dict):
"""Generate frame_builder.py with options.
Args:
env (Environment): Template environment used to retrieve template.
folder (str): Folder to place new file.
options (dict): Options for frame_builder.py.
"""
... | [
"def",
"generate_frame_builder",
"(",
"env",
":",
"Environment",
",",
"folder",
":",
"str",
",",
"options",
":",
"dict",
")",
":",
"template",
"=",
"env",
".",
"get_template",
"(",
"\"frame_builder.py.jinja\"",
")",
"with",
"open",
"(",
"os",
".",
"path",
... | [
317,
0
] | [
328,
50
] | python | en | ['en', 'en', 'en'] | True |
generate_commons | (env: Environment, folder: str, options: dict) | Generate common.py with options.
Args:
env (Environment): Template environment used to retrieve template.
folder (str): Folder to place new file.
options (dict): Options for common.py.
| Generate common.py with options. | def generate_commons(env: Environment, folder: str, options: dict):
"""Generate common.py with options.
Args:
env (Environment): Template environment used to retrieve template.
folder (str): Folder to place new file.
options (dict): Options for common.py.
"""
template = env.get_... | [
"def",
"generate_commons",
"(",
"env",
":",
"Environment",
",",
"folder",
":",
"str",
",",
"options",
":",
"dict",
")",
":",
"template",
"=",
"env",
".",
"get_template",
"(",
"\"common.py.jinja\"",
")",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join"... | [
331,
0
] | [
342,
50
] | python | en | ['en', 'en', 'en'] | True |
generate_events | (env: Environment, folder: str, options: dict) | Generate events.py with options.
Args:
env (Environment): Template environment used to retrieve template.
folder (str): Folder to place new file.
options (dict): Options for events.py.
| Generate events.py with options. | def generate_events(env: Environment, folder: str, options: dict):
"""Generate events.py with options.
Args:
env (Environment): Template environment used to retrieve template.
folder (str): Folder to place new file.
options (dict): Options for events.py.
"""
template = env.get_t... | [
"def",
"generate_events",
"(",
"env",
":",
"Environment",
",",
"folder",
":",
"str",
",",
"options",
":",
"dict",
")",
":",
"template",
"=",
"env",
".",
"get_template",
"(",
"\"events.py.jinja\"",
")",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",... | [
345,
0
] | [
356,
50
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Dyson Sensors. | Set up the Dyson Sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Dyson Sensors."""
if discovery_info is None:
return
hass.data.setdefault(DYSON_AIQ_DEVICES, [])
# Get Dyson Devices from parent component
device_ids = [device.unique_id for device in hass.data[DYSON_AIQ_DEV... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DYSON_AIQ_DEVICES",
",",
"[",
"]",
")... | [
19,
0
] | [
38,
46
] | python | en | ['en', 'sq', 'en'] | True |
DysonAirSensor.__init__ | (self, device) | Create a new generic air quality Dyson sensor. | Create a new generic air quality Dyson sensor. | def __init__(self, device):
"""Create a new generic air quality Dyson sensor."""
self._device = device
self._old_value = None
self._name = device.name | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"self",
".",
"_device",
"=",
"device",
"self",
".",
"_old_value",
"=",
"None",
"self",
".",
"_name",
"=",
"device",
".",
"name"
] | [
44,
4
] | [
48,
32
] | python | en | ['en', 'ga', 'en'] | True |
DysonAirSensor.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self._device.add_message_listener(self.on_message) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_device",
".",
"add_message_listener",
"(",
"self",
".",
"on_message",
")"
] | [
50,
4
] | [
52,
58
] | python | en | ['en', 'en', 'en'] | True |
DysonAirSensor.on_message | (self, message) | Handle new messages which are received from the fan. | Handle new messages which are received from the fan. | def on_message(self, message):
"""Handle new messages which are received from the fan."""
_LOGGER.debug(
"%s: Message received for %s device: %s", DOMAIN, self.name, message
)
if (
self._old_value is None
or self._old_value != self._device.environmenta... | [
"def",
"on_message",
"(",
"self",
",",
"message",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"%s: Message received for %s device: %s\"",
",",
"DOMAIN",
",",
"self",
".",
"name",
",",
"message",
")",
"if",
"(",
"self",
".",
"_old_value",
"is",
"None",
"or",
... | [
54,
4
] | [
64,
43
] | python | en | ['en', 'en', 'en'] | True |
DysonAirSensor.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
67,
4
] | [
69,
20
] | python | en | ['en', 'en', 'en'] | True |
DysonAirSensor.name | (self) | Return the name of the Dyson sensor. | Return the name of the Dyson sensor. | def name(self):
"""Return the name of the Dyson sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
72,
4
] | [
74,
25
] | python | en | ['en', 'sq', 'en'] | True |
DysonAirSensor.attribution | (self) | Return the attribution. | Return the attribution. | def attribution(self):
"""Return the attribution."""
return ATTRIBUTION | [
"def",
"attribution",
"(",
"self",
")",
":",
"return",
"ATTRIBUTION"
] | [
77,
4
] | [
79,
26
] | python | en | ['en', 'ja', 'en'] | True |
DysonAirSensor.air_quality_index | (self) | Return the Air Quality Index (AQI). | Return the Air Quality Index (AQI). | def air_quality_index(self):
"""Return the Air Quality Index (AQI)."""
return max(
self.particulate_matter_2_5,
self.particulate_matter_10,
self.nitrogen_dioxide,
self.volatile_organic_compounds,
) | [
"def",
"air_quality_index",
"(",
"self",
")",
":",
"return",
"max",
"(",
"self",
".",
"particulate_matter_2_5",
",",
"self",
".",
"particulate_matter_10",
",",
"self",
".",
"nitrogen_dioxide",
",",
"self",
".",
"volatile_organic_compounds",
",",
")"
] | [
82,
4
] | [
89,
9
] | python | en | ['en', 'cy', 'en'] | True |
DysonAirSensor.particulate_matter_2_5 | (self) | Return the particulate matter 2.5 level. | Return the particulate matter 2.5 level. | def particulate_matter_2_5(self):
"""Return the particulate matter 2.5 level."""
if self._device.environmental_state:
return int(self._device.environmental_state.particulate_matter_25)
return None | [
"def",
"particulate_matter_2_5",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
".",
"environmental_state",
":",
"return",
"int",
"(",
"self",
".",
"_device",
".",
"environmental_state",
".",
"particulate_matter_25",
")",
"return",
"None"
] | [
92,
4
] | [
96,
19
] | python | en | ['en', 'en', 'en'] | True |
DysonAirSensor.particulate_matter_10 | (self) | Return the particulate matter 10 level. | Return the particulate matter 10 level. | def particulate_matter_10(self):
"""Return the particulate matter 10 level."""
if self._device.environmental_state:
return int(self._device.environmental_state.particulate_matter_10)
return None | [
"def",
"particulate_matter_10",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
".",
"environmental_state",
":",
"return",
"int",
"(",
"self",
".",
"_device",
".",
"environmental_state",
".",
"particulate_matter_10",
")",
"return",
"None"
] | [
99,
4
] | [
103,
19
] | python | en | ['en', 'en', 'en'] | True |
DysonAirSensor.nitrogen_dioxide | (self) | Return the NO2 (nitrogen dioxide) level. | Return the NO2 (nitrogen dioxide) level. | def nitrogen_dioxide(self):
"""Return the NO2 (nitrogen dioxide) level."""
if self._device.environmental_state:
return int(self._device.environmental_state.nitrogen_dioxide)
return None | [
"def",
"nitrogen_dioxide",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
".",
"environmental_state",
":",
"return",
"int",
"(",
"self",
".",
"_device",
".",
"environmental_state",
".",
"nitrogen_dioxide",
")",
"return",
"None"
] | [
106,
4
] | [
110,
19
] | python | en | ['en', 'da', 'en'] | True |
DysonAirSensor.volatile_organic_compounds | (self) | Return the VOC (Volatile Organic Compounds) level. | Return the VOC (Volatile Organic Compounds) level. | def volatile_organic_compounds(self):
"""Return the VOC (Volatile Organic Compounds) level."""
if self._device.environmental_state:
return int(self._device.environmental_state.volatile_organic_compounds)
return None | [
"def",
"volatile_organic_compounds",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
".",
"environmental_state",
":",
"return",
"int",
"(",
"self",
".",
"_device",
".",
"environmental_state",
".",
"volatile_organic_compounds",
")",
"return",
"None"
] | [
113,
4
] | [
117,
19
] | python | en | ['en', 'fr', 'en'] | True |
DysonAirSensor.unique_id | (self) | Return the sensor's unique id. | Return the sensor's unique id. | def unique_id(self):
"""Return the sensor's unique id."""
return self._device.serial | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"serial"
] | [
120,
4
] | [
122,
34
] | python | en | ['en', 'ca', 'en'] | True |
DysonAirSensor.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
data = {}
voc = self.volatile_organic_compounds
if voc is not None:
data[ATTR_VOC] = voc
return data | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"data",
"=",
"{",
"}",
"voc",
"=",
"self",
".",
"volatile_organic_compounds",
"if",
"voc",
"is",
"not",
"None",
":",
"data",
"[",
"ATTR_VOC",
"]",
"=",
"voc",
"return",
"data"
] | [
125,
4
] | [
132,
19
] | python | en | ['en', 'en', 'en'] | True |
calls | (hass) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
")",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
22,
0
] | [
24,
57
] | python | en | ['en', 'en', 'en'] | True |
setup_comp | (hass) | Initialize components. | Initialize components. | def setup_comp(hass):
"""Initialize components."""
mock_component(hass, "group")
hass.states.async_set("test.entity", "hello") | [
"def",
"setup_comp",
"(",
"hass",
")",
":",
"mock_component",
"(",
"hass",
",",
"\"group\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"\"hello\"",
")"
] | [
28,
0
] | [
31,
49
] | python | en | ['de', 'en', 'en'] | False |
test_if_fires_on_change_bool | (hass, calls) | Test for firing on boolean change. | Test for firing on boolean change. | async def test_if_fires_on_change_bool(hass, calls):
"""Test for firing on boolean change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
"valu... | [
"async",
"def",
"test_if_fires_on_change_bool",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platfor... | [
34,
0
] | [
63,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_str | (hass, calls) | Test for firing on change. | Test for firing on change. | async def test_if_fires_on_change_str(hass, calls):
"""Test for firing on change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
"value_templat... | [
"async",
"def",
"test_if_fires_on_change_str",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform... | [
66,
0
] | [
84,
26
] | python | en | ['en', 'no', 'en'] | True |
test_if_fires_on_change_str_crazy | (hass, calls) | Test for firing on change. | Test for firing on change. | async def test_if_fires_on_change_str_crazy(hass, calls):
"""Test for firing on change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
"value_t... | [
"async",
"def",
"test_if_fires_on_change_str_crazy",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"pl... | [
87,
0
] | [
105,
26
] | python | en | ['en', 'no', 'en'] | True |
test_if_not_fires_on_change_bool | (hass, calls) | Test for not firing on boolean change. | Test for not firing on boolean change. | async def test_if_not_fires_on_change_bool(hass, calls):
"""Test for not firing on boolean change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_not_fires_on_change_bool",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"pla... | [
108,
0
] | [
126,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_not_fires_on_change_str | (hass, calls) | Test for not firing on string change. | Test for not firing on string change. | async def test_if_not_fires_on_change_str(hass, calls):
"""Test for not firing on string change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {"platform": "template", "value_template": "true"},
... | [
"async",
"def",
"test_if_not_fires_on_change_str",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"plat... | [
129,
0
] | [
144,
26
] | python | en | ['en', 'no', 'en'] | True |
test_if_not_fires_on_change_str_crazy | (hass, calls) | Test for not firing on string change. | Test for not firing on string change. | async def test_if_not_fires_on_change_str_crazy(hass, calls):
"""Test for not firing on string change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_not_fires_on_change_str_crazy",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"... | [
147,
0
] | [
165,
26
] | python | en | ['en', 'no', 'en'] | True |
test_if_fires_on_no_change | (hass, calls) | Test for firing on no change. | Test for firing on no change. | async def test_if_fires_on_no_change(hass, calls):
"""Test for firing on no change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {"platform": "template", "value_template": "{{ true }}"},
"act... | [
"async",
"def",
"test_if_fires_on_no_change",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform\... | [
168,
0
] | [
186,
32
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_two_change | (hass, calls) | Test for firing on two changes. | Test for firing on two changes. | async def test_if_fires_on_two_change(hass, calls):
"""Test for firing on two changes."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
"value_te... | [
"async",
"def",
"test_if_fires_on_two_change",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform... | [
189,
0
] | [
213,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_template | (hass, calls) | Test for firing on change with template. | Test for firing on change with template. | async def test_if_fires_on_change_with_template(hass, calls):
"""Test for firing on change with template."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_fires_on_change_with_template",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"... | [
216,
0
] | [
234,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_not_fires_on_change_with_template | (hass, calls) | Test for not firing on change with template. | Test for not firing on change with template. | async def test_if_not_fires_on_change_with_template(hass, calls):
"""Test for not firing on change with template."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_not_fires_on_change_with_template",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",... | [
237,
0
] | [
257,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_template_advanced | (hass, calls) | Test for firing on change with template advanced. | Test for firing on change with template advanced. | async def test_if_fires_on_change_with_template_advanced(hass, calls):
"""Test for firing on change with template advanced."""
context = Context()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
... | [
"async",
"def",
"test_if_fires_on_change_with_template_advanced",
"(",
"hass",
",",
"calls",
")",
":",
"context",
"=",
"Context",
"(",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"D... | [
260,
0
] | [
297,
83
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_no_change_with_template_advanced | (hass, calls) | Test for firing on no change with template advanced. | Test for firing on no change with template advanced. | async def test_if_fires_on_no_change_with_template_advanced(hass, calls):
"""Test for firing on no change with template advanced."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform"... | [
"async",
"def",
"test_if_fires_on_no_change_with_template_advanced",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":"... | [
300,
0
] | [
328,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_template_2 | (hass, calls) | Test for firing on change with template. | Test for firing on change with template. | async def test_if_fires_on_change_with_template_2(hass, calls):
"""Test for firing on change with template."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_fires_on_change_with_template_2",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
... | [
331,
0
] | [
371,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_action | (hass, calls) | Test for firing if action. | Test for firing if action. | async def test_if_action(hass, calls):
"""Test for firing if action."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {"platform": "event", "event_type": "test_event"},
"condition": [
... | [
"async",
"def",
"test_if_action",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform\"",
":",
... | [
374,
0
] | [
406,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_bad_template | (hass, calls) | Test for firing on change with bad template. | Test for firing on change with bad template. | async def test_if_fires_on_change_with_bad_template(hass, calls):
"""Test for firing on change with bad template."""
with assert_setup_component(0, automation.DOMAIN):
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
... | [
"async",
"def",
"test_if_fires_on_change_with_bad_template",
"(",
"hass",
",",
"calls",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"automation",
".",
"DOMAIN",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".... | [
409,
0
] | [
421,
9
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_bad_template_2 | (hass, calls) | Test for firing on change with bad template. | Test for firing on change with bad template. | async def test_if_fires_on_change_with_bad_template_2(hass, calls):
"""Test for firing on change with bad template."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_fires_on_change_with_bad_template_2",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{... | [
424,
0
] | [
442,
26
] | python | en | ['en', 'en', 'en'] | True |
test_wait_template_with_trigger | (hass, calls) | Test using wait template with 'trigger.entity_id'. | Test using wait template with 'trigger.entity_id'. | async def test_wait_template_with_trigger(hass, calls):
"""Test using wait template with 'trigger.entity_id'."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_wait_template_with_trigger",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"plat... | [
445,
0
] | [
490,
83
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_for | (hass, calls) | Test for firing on change with for. | Test for firing on change with for. | async def test_if_fires_on_change_with_for(hass, calls):
"""Test for firing on change with for."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_fires_on_change_with_for",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"pla... | [
493,
0
] | [
515,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_for_advanced | (hass, calls) | Test for firing on change with for advanced. | Test for firing on change with for advanced. | async def test_if_fires_on_change_with_for_advanced(hass, calls):
"""Test for firing on change with for advanced."""
context = Context()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"p... | [
"async",
"def",
"test_if_fires_on_change_with_for_advanced",
"(",
"hass",
",",
"calls",
")",
":",
"context",
"=",
"Context",
"(",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN... | [
518,
0
] | [
559,
86
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_for_0 | (hass, calls) | Test for firing on change with for: 0. | Test for firing on change with for: 0. | async def test_if_fires_on_change_with_for_0(hass, calls):
"""Test for firing on change with for: 0."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_fires_on_change_with_for_0",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"p... | [
562,
0
] | [
581,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_for_0_advanced | (hass, calls) | Test for firing on change with for: 0 advanced. | Test for firing on change with for: 0 advanced. | async def test_if_fires_on_change_with_for_0_advanced(hass, calls):
"""Test for firing on change with for: 0 advanced."""
context = Context()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
... | [
"async",
"def",
"test_if_fires_on_change_with_for_0_advanced",
"(",
"hass",
",",
"calls",
")",
":",
"context",
"=",
"Context",
"(",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMA... | [
584,
0
] | [
622,
86
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_for_2 | (hass, calls) | Test for firing on change with for. | Test for firing on change with for. | async def test_if_fires_on_change_with_for_2(hass, calls):
"""Test for firing on change with for."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_fires_on_change_with_for_2",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"p... | [
625,
0
] | [
647,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_not_fires_on_change_with_for | (hass, calls) | Test for firing on change with for. | Test for firing on change with for. | async def test_if_not_fires_on_change_with_for(hass, calls):
"""Test for firing on change with for."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_not_fires_on_change_with_for",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\... | [
650,
0
] | [
678,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_not_fires_when_turned_off_with_for | (hass, calls) | Test for firing on change with for. | Test for firing on change with for. | async def test_if_not_fires_when_turned_off_with_for(hass, calls):
"""Test for firing on change with for."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_not_fires_when_turned_off_with_for",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{"... | [
681,
0
] | [
713,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_for_template_1 | (hass, calls) | Test for firing on change with for template. | Test for firing on change with for template. | async def test_if_fires_on_change_with_for_template_1(hass, calls):
"""Test for firing on change with for template."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_fires_on_change_with_for_template_1",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{... | [
716,
0
] | [
738,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_for_template_2 | (hass, calls) | Test for firing on change with for template. | Test for firing on change with for template. | async def test_if_fires_on_change_with_for_template_2(hass, calls):
"""Test for firing on change with for template."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_fires_on_change_with_for_template_2",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{... | [
741,
0
] | [
763,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_change_with_for_template_3 | (hass, calls) | Test for firing on change with for template. | Test for firing on change with for template. | async def test_if_fires_on_change_with_for_template_3(hass, calls):
"""Test for firing on change with for template."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
... | [
"async",
"def",
"test_if_fires_on_change_with_for_template_3",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{... | [
766,
0
] | [
788,
26
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_for_template_1 | (hass, calls) | Test for invalid for template. | Test for invalid for template. | async def test_invalid_for_template_1(hass, calls):
"""Test for invalid for template."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "template",
"value_tem... | [
"async",
"def",
"test_invalid_for_template_1",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform... | [
791,
0
] | [
811,
39
] | python | en | ['en', 'en', 'en'] | True |
GoogleConfig.__init__ | (self, hass, config) | Initialize the config. | Initialize the config. | def __init__(self, hass, config):
"""Initialize the config."""
super().__init__(hass)
self._config = config
self._access_token = None
self._access_token_renew = None | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"config",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hass",
")",
"self",
".",
"_config",
"=",
"config",
"self",
".",
"_access_token",
"=",
"None",
"self",
".",
"_access_token_renew",
"=",
"None... | [
76,
4
] | [
81,
39
] | python | en | ['en', 'en', 'en'] | True |
GoogleConfig.enabled | (self) | Return if Google is enabled. | Return if Google is enabled. | def enabled(self):
"""Return if Google is enabled."""
return True | [
"def",
"enabled",
"(",
"self",
")",
":",
"return",
"True"
] | [
84,
4
] | [
86,
19
] | python | en | ['en', 'en', 'en'] | True |
GoogleConfig.entity_config | (self) | Return entity config. | Return entity config. | def entity_config(self):
"""Return entity config."""
return self._config.get(CONF_ENTITY_CONFIG) or {} | [
"def",
"entity_config",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_ENTITY_CONFIG",
")",
"or",
"{",
"}"
] | [
89,
4
] | [
91,
57
] | python | en | ['en', 'cy', 'en'] | True |
GoogleConfig.secure_devices_pin | (self) | Return entity config. | Return entity config. | def secure_devices_pin(self):
"""Return entity config."""
return self._config.get(CONF_SECURE_DEVICES_PIN) | [
"def",
"secure_devices_pin",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_SECURE_DEVICES_PIN",
")"
] | [
94,
4
] | [
96,
56
] | python | en | ['en', 'cy', 'en'] | True |
GoogleConfig.should_report_state | (self) | Return if states should be proactively reported. | Return if states should be proactively reported. | def should_report_state(self):
"""Return if states should be proactively reported."""
return self._config.get(CONF_REPORT_STATE) | [
"def",
"should_report_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_REPORT_STATE",
")"
] | [
99,
4
] | [
101,
50
] | python | en | ['en', 'en', 'en'] | True |
GoogleConfig.should_expose | (self, state) | Return if entity should be exposed. | Return if entity should be exposed. | def should_expose(self, state) -> bool:
"""Return if entity should be exposed."""
expose_by_default = self._config.get(CONF_EXPOSE_BY_DEFAULT)
exposed_domains = self._config.get(CONF_EXPOSED_DOMAINS)
if state.attributes.get("view") is not None:
# Ignore entities that are vie... | [
"def",
"should_expose",
"(",
"self",
",",
"state",
")",
"->",
"bool",
":",
"expose_by_default",
"=",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_EXPOSE_BY_DEFAULT",
")",
"exposed_domains",
"=",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_EXPOSED_DOMAINS"... | [
103,
4
] | [
126,
52
] | python | en | ['en', 'en', 'en'] | True |
GoogleConfig.get_agent_user_id | (self, context) | Get agent user ID making request. | Get agent user ID making request. | def get_agent_user_id(self, context):
"""Get agent user ID making request."""
return context.user_id | [
"def",
"get_agent_user_id",
"(",
"self",
",",
"context",
")",
":",
"return",
"context",
".",
"user_id"
] | [
128,
4
] | [
130,
30
] | python | en | ['fr', 'en', 'en'] | True |
GoogleConfig.should_2fa | (self, state) | If an entity should have 2FA checked. | If an entity should have 2FA checked. | def should_2fa(self, state):
"""If an entity should have 2FA checked."""
return True | [
"def",
"should_2fa",
"(",
"self",
",",
"state",
")",
":",
"return",
"True"
] | [
132,
4
] | [
134,
19
] | 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.