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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
async_get_triggers | (hass: HomeAssistant, device_id: str) | List device triggers for Fan devices. | List device triggers for Fan devices. | async def async_get_triggers(hass: HomeAssistant, device_id: str) -> List[dict]:
"""List device triggers for Fan devices."""
registry = await entity_registry.async_get_registry(hass)
triggers = []
# Get all the integrations entities for this device
for entry in entity_registry.async_entries_for_dev... | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"List",
"[",
"dict",
"]",
":",
"registry",
"=",
"await",
"entity_registry",
".",
"async_get_registry",
"(",
"hass",
")",
"triggers",
"=",
"[",
... | [
33,
0
] | [
63,
19
] | python | en | ['nl', 'en', 'en'] | True |
async_attach_trigger | (
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: dict,
) | Attach a trigger. | Attach a trigger. | async def async_attach_trigger(
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: dict,
) -> CALLBACK_TYPE:
"""Attach a trigger."""
config = TRIGGER_SCHEMA(config)
if config[CONF_TYPE] == "turned_on":
from_state = STATE_OFF
to_state = ST... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"action",
":",
"AutomationActionType",
",",
"automation_info",
":",
"dict",
",",
")",
"->",
"CALLBACK_TYPE",
":",
"config",
"=",
"TRIGGER_SCHEMA",
"... | [
66,
0
] | [
91,
5
] | python | en | ['en', 'lb', 'en'] | True |
test_form | (hass) | Test we get the form. | Test we get the form. | async def test_form(hass):
"""Test we get the form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM... | [
"async",
"def",
"test_form",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(... | [
12,
0
] | [
40,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_account_error | (hass) | Test we handle account error. | Test we handle account error. | async def test_form_account_error(hass):
"""Test we handle account error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.dexcom.config_flow.Dexcom",
side_effect=AccountError,
... | [
"async",
"def",
"test_form_account_error",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")... | [
43,
0
] | [
59,
56
] | python | nl | ['nl', 'nl', 'en'] | True |
test_form_session_error | (hass) | Test we handle session error. | Test we handle session error. | async def test_form_session_error(hass):
"""Test we handle session error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.dexcom.config_flow.Dexcom",
side_effect=SessionError,
... | [
"async",
"def",
"test_form_session_error",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")... | [
62,
0
] | [
78,
58
] | python | en | ['en', 'da', 'en'] | True |
test_form_unknown_error | (hass) | Test we handle unknown error. | Test we handle unknown error. | async def test_form_unknown_error(hass):
"""Test we handle unknown error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.dexcom.config_flow.Dexcom",
side_effect=Exception,
... | [
"async",
"def",
"test_form_unknown_error",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")... | [
81,
0
] | [
97,
51
] | python | en | ['en', 'de', 'en'] | True |
test_option_flow_default | (hass) | Test config flow options. | Test config flow options. | async def test_option_flow_default(hass):
"""Test config flow options."""
entry = MockConfigEntry(
domain=DOMAIN,
data=CONFIG,
options=None,
)
entry.add_to_hass(hass)
result = await hass.config_entries.options.async_init(entry.entry_id)
assert result["type"] == data_ent... | [
"async",
"def",
"test_option_flow_default",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"CONFIG",
",",
"options",
"=",
"None",
",",
")",
"entry",
".",
"add_to_hass",
"(",
"hass",
")",
"result",
... | [
100,
0
] | [
121,
5
] | python | en | ['en', 'fr', 'en'] | True |
test_option_flow | (hass) | Test config flow options. | Test config flow options. | async def test_option_flow(hass):
"""Test config flow options."""
entry = MockConfigEntry(
domain=DOMAIN,
data=CONFIG,
options={CONF_UNIT_OF_MEASUREMENT: MG_DL},
)
entry.add_to_hass(hass)
result = await hass.config_entries.options.async_init(entry.entry_id)
assert resul... | [
"async",
"def",
"test_option_flow",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"CONFIG",
",",
"options",
"=",
"{",
"CONF_UNIT_OF_MEASUREMENT",
":",
"MG_DL",
"}",
",",
")",
"entry",
".",
"add_to_h... | [
124,
0
] | [
145,
5
] | python | en | ['en', 'fr', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the fan device. | Set up the fan device. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the fan device."""
if discovery_info is None:
return
client = hass.data[DOMAIN]["client"]
client.set_settable_address(METRIC_KEY_MODE, int)
device = ValloxFan(
hass.data[DOMAIN]["name"... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"client",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"... | [
34,
0
] | [
47,
57
] | python | en | ['en', 'fy', 'en'] | True |
ValloxFan.__init__ | (self, name, client, state_proxy) | Initialize the fan. | Initialize the fan. | def __init__(self, name, client, state_proxy):
"""Initialize the fan."""
self._name = name
self._client = client
self._state_proxy = state_proxy
self._available = False
self._state = None
self._fan_speed_home = None
self._fan_speed_away = None
self... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"client",
",",
"state_proxy",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_client",
"=",
"client",
"self",
".",
"_state_proxy",
"=",
"state_proxy",
"self",
".",
"_available",
"=",
"False",
... | [
53,
4
] | [
62,
36
] | python | en | ['en', 'fy', 'en'] | True |
ValloxFan.should_poll | (self) | Do not poll the device. | Do not poll the device. | def should_poll(self):
"""Do not poll the device."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
65,
4
] | [
67,
20
] | python | en | ['en', 'en', 'en'] | True |
ValloxFan.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"
] | [
70,
4
] | [
72,
25
] | python | en | ['en', 'en', 'en'] | True |
ValloxFan.available | (self) | Return if state is known. | Return if state is known. | def available(self):
"""Return if state is known."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
75,
4
] | [
77,
30
] | python | en | ['en', 'en', 'en'] | True |
ValloxFan.is_on | (self) | Return if device is on. | Return if device is on. | def is_on(self):
"""Return if device is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
80,
4
] | [
82,
26
] | python | en | ['en', 'en', 'en'] | True |
ValloxFan.device_state_attributes | (self) | Return device specific state attributes. | Return device specific state attributes. | def device_state_attributes(self):
"""Return device specific state attributes."""
return {
ATTR_PROFILE_FAN_SPEED_HOME["description"]: self._fan_speed_home,
ATTR_PROFILE_FAN_SPEED_AWAY["description"]: self._fan_speed_away,
ATTR_PROFILE_FAN_SPEED_BOOST["description"]: ... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_PROFILE_FAN_SPEED_HOME",
"[",
"\"description\"",
"]",
":",
"self",
".",
"_fan_speed_home",
",",
"ATTR_PROFILE_FAN_SPEED_AWAY",
"[",
"\"description\"",
"]",
":",
"self",
".",
"_fan_speed_away... | [
85,
4
] | [
91,
9
] | python | en | ['fr', 'en', 'en'] | True |
ValloxFan.async_added_to_hass | (self) | Call to update. | Call to update. | async def async_added_to_hass(self):
"""Call to update."""
self.async_on_remove(
async_dispatcher_connect(
self.hass, SIGNAL_VALLOX_STATE_UPDATE, self._update_callback
)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"SIGNAL_VALLOX_STATE_UPDATE",
",",
"self",
".",
"_update_callback",
")",
")"
] | [
93,
4
] | [
99,
9
] | python | en | ['en', 'en', 'en'] | True |
ValloxFan._update_callback | (self) | Call update method. | Call update method. | def _update_callback(self):
"""Call update method."""
self.async_schedule_update_ha_state(True) | [
"def",
"_update_callback",
"(",
"self",
")",
":",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")"
] | [
102,
4
] | [
104,
49
] | python | en | ['en', 'sn', 'en'] | True |
ValloxFan.async_update | (self) | Fetch state from the device. | Fetch state from the device. | async def async_update(self):
"""Fetch state from the device."""
try:
# Fetch if the whole device is in regular operation state.
mode = self._state_proxy.fetch_metric(METRIC_KEY_MODE)
if mode == 0:
self._state = True
else:
s... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"# Fetch if the whole device is in regular operation state.",
"mode",
"=",
"self",
".",
"_state_proxy",
".",
"fetch_metric",
"(",
"METRIC_KEY_MODE",
")",
"if",
"mode",
"==",
"0",
":",
"self",
".",
... | [
106,
4
] | [
137,
56
] | python | en | ['en', 'en', 'en'] | True |
ValloxFan.async_turn_on | (self, speed: str = None, **kwargs) | Turn the device on. | Turn the device on. | async def async_turn_on(self, speed: str = None, **kwargs) -> None:
"""Turn the device on."""
_LOGGER.debug("Turn on: %s", speed)
# Only the case speed == None equals the GUI toggle switch being
# activated.
if speed is not None:
return
if self._state is Fal... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"speed",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn on: %s\"",
",",
"speed",
")",
"# Only the case speed == None equals the GUI toggle switch ... | [
139,
4
] | [
161,
39
] | python | en | ['en', 'en', 'en'] | True |
ValloxFan.async_turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | async def async_turn_off(self, **kwargs) -> None:
"""Turn the device off."""
if self._state is True:
try:
await self._client.set_values({METRIC_KEY_MODE: 5})
# Same as for turn_on method.
await self._state_proxy.async_update(None)
... | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"if",
"self",
".",
"_state",
"is",
"True",
":",
"try",
":",
"await",
"self",
".",
"_client",
".",
"set_values",
"(",
"{",
"METRIC_KEY_MODE",
":",
"5",
"}"... | [
163,
4
] | [
176,
40
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream.__init__ | (self, hass, api, august_gateway, house_ids) | Init August activity stream object. | Init August activity stream object. | def __init__(self, hass, api, august_gateway, house_ids):
"""Init August activity stream object."""
super().__init__(hass, ACTIVITY_UPDATE_INTERVAL)
self._hass = hass
self._august_gateway = august_gateway
self._api = api
self._house_ids = house_ids
self._latest_ac... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"api",
",",
"august_gateway",
",",
"house_ids",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hass",
",",
"ACTIVITY_UPDATE_INTERVAL",
")",
"self",
".",
"_hass",
"=",
"hass",
"self",
".",
"_august_ga... | [
19,
4
] | [
28,
52
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream.async_setup | (self) | Token refresh check and catch up the activity stream. | Token refresh check and catch up the activity stream. | async def async_setup(self):
"""Token refresh check and catch up the activity stream."""
await self._async_refresh(utcnow) | [
"async",
"def",
"async_setup",
"(",
"self",
")",
":",
"await",
"self",
".",
"_async_refresh",
"(",
"utcnow",
")"
] | [
30,
4
] | [
32,
41
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream.get_latest_device_activity | (self, device_id, activity_types) | Return latest activity that is one of the acitivty_types. | Return latest activity that is one of the acitivty_types. | def get_latest_device_activity(self, device_id, activity_types):
"""Return latest activity that is one of the acitivty_types."""
if device_id not in self._latest_activities_by_id_type:
return None
latest_device_activities = self._latest_activities_by_id_type[device_id]
lates... | [
"def",
"get_latest_device_activity",
"(",
"self",
",",
"device_id",
",",
"activity_types",
")",
":",
"if",
"device_id",
"not",
"in",
"self",
".",
"_latest_activities_by_id_type",
":",
"return",
"None",
"latest_device_activities",
"=",
"self",
".",
"_latest_activities_... | [
34,
4
] | [
52,
30
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream._async_refresh | (self, time) | Update the activity stream from August. | Update the activity stream from August. | async def _async_refresh(self, time):
"""Update the activity stream from August."""
# This is the only place we refresh the api token
await self._august_gateway.async_refresh_access_token_if_needed()
await self._async_update_device_activities(time) | [
"async",
"def",
"_async_refresh",
"(",
"self",
",",
"time",
")",
":",
"# This is the only place we refresh the api token",
"await",
"self",
".",
"_august_gateway",
".",
"async_refresh_access_token_if_needed",
"(",
")",
"await",
"self",
".",
"_async_update_device_activities"... | [
54,
4
] | [
59,
56
] | python | en | ['en', 'en', 'en'] | True |
test_setup | (hass, requests_mock) | Test the setup. | Test the setup. | async def test_setup(hass, requests_mock):
"""Test the setup."""
await async_setup_component(hass, ring.DOMAIN, {})
requests_mock.post(
"https://oauth.ring.com/oauth/token", text=load_fixture("ring_oauth.json")
)
requests_mock.post(
"https://api.ring.com/clients_api/session",
... | [
"async",
"def",
"test_setup",
"(",
"hass",
",",
"requests_mock",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"ring",
".",
"DOMAIN",
",",
"{",
"}",
")",
"requests_mock",
".",
"post",
"(",
"\"https://oauth.ring.com/oauth/token\"",
",",
"text",
... | [
15,
0
] | [
39,
53
] | python | en | ['en', 'haw', 'en'] | True |
get_client | (aiohttp_client, validator) | Generate a client that hits a view decorated with validator. | Generate a client that hits a view decorated with validator. | async def get_client(aiohttp_client, validator):
"""Generate a client that hits a view decorated with validator."""
app = web.Application()
app["hass"] = Mock(is_stopping=False)
class TestView(HomeAssistantView):
url = "/"
name = "test"
requires_auth = False
@validator
... | [
"async",
"def",
"get_client",
"(",
"aiohttp_client",
",",
"validator",
")",
":",
"app",
"=",
"web",
".",
"Application",
"(",
")",
"app",
"[",
"\"hass\"",
"]",
"=",
"Mock",
"(",
"is_stopping",
"=",
"False",
")",
"class",
"TestView",
"(",
"HomeAssistantView"... | [
10,
0
] | [
27,
17
] | python | en | ['en', 'en', 'en'] | True |
test_validator | (aiohttp_client) | Test the validator. | Test the validator. | async def test_validator(aiohttp_client):
"""Test the validator."""
client = await get_client(
aiohttp_client, RequestDataValidator(vol.Schema({vol.Required("test"): str}))
)
resp = await client.post("/", json={"test": "bla"})
assert resp.status == 200
resp = await client.post("/", jso... | [
"async",
"def",
"test_validator",
"(",
"aiohttp_client",
")",
":",
"client",
"=",
"await",
"get_client",
"(",
"aiohttp_client",
",",
"RequestDataValidator",
"(",
"vol",
".",
"Schema",
"(",
"{",
"vol",
".",
"Required",
"(",
"\"test\"",
")",
":",
"str",
"}",
... | [
30,
0
] | [
43,
29
] | python | en | ['en', 'et', 'en'] | True |
test_validator_allow_empty | (aiohttp_client) | Test the validator with empty data. | Test the validator with empty data. | async def test_validator_allow_empty(aiohttp_client):
"""Test the validator with empty data."""
client = await get_client(
aiohttp_client,
RequestDataValidator(
vol.Schema(
{
# Although we allow empty, our schema should still be able
... | [
"async",
"def",
"test_validator_allow_empty",
"(",
"aiohttp_client",
")",
":",
"client",
"=",
"await",
"get_client",
"(",
"aiohttp_client",
",",
"RequestDataValidator",
"(",
"vol",
".",
"Schema",
"(",
"{",
"# Although we allow empty, our schema should still be able",
"# t... | [
46,
0
] | [
69,
29
] | python | en | ['en', 'en', 'en'] | True |
vap | (x, a, b, c) | Vapor pressure model
Parameters
----------
x : int
a : float
b : float
c : float
Returns
-------
float
np.exp(a+b/x+c*np.log(x))
| Vapor pressure model | def vap(x, a, b, c):
"""Vapor pressure model
Parameters
----------
x : int
a : float
b : float
c : float
Returns
-------
float
np.exp(a+b/x+c*np.log(x))
"""
return np.exp(a+b/x+c*np.log(x)) | [
"def",
"vap",
"(",
"x",
",",
"a",
",",
"b",
",",
"c",
")",
":",
"return",
"np",
".",
"exp",
"(",
"a",
"+",
"b",
"/",
"x",
"+",
"c",
"*",
"np",
".",
"log",
"(",
"x",
")",
")"
] | [
17,
0
] | [
32,
36
] | python | en | ['es', 'no', 'en'] | False |
pow3 | (x, c, a, alpha) | pow3
Parameters
----------
x : int
c : float
a : float
alpha : float
Returns
-------
float
c - a * x**(-alpha)
| pow3 | def pow3(x, c, a, alpha):
"""pow3
Parameters
----------
x : int
c : float
a : float
alpha : float
Returns
-------
float
c - a * x**(-alpha)
"""
return c - a * x**(-alpha) | [
"def",
"pow3",
"(",
"x",
",",
"c",
",",
"a",
",",
"alpha",
")",
":",
"return",
"c",
"-",
"a",
"*",
"x",
"**",
"(",
"-",
"alpha",
")"
] | [
40,
0
] | [
55,
30
] | python | pl | ['en', 'pl', 'pl'] | False |
linear | (x, a, b) | linear
Parameters
----------
x : int
a : float
b : float
Returns
-------
float
a*x + b
| linear | def linear(x, a, b):
"""linear
Parameters
----------
x : int
a : float
b : float
Returns
-------
float
a*x + b
"""
return a*x + b | [
"def",
"linear",
"(",
"x",
",",
"a",
",",
"b",
")",
":",
"return",
"a",
"*",
"x",
"+",
"b"
] | [
63,
0
] | [
77,
18
] | python | fy | ['ro', 'fy', 'pt'] | False |
logx_linear | (x, a, b) | logx linear
Parameters
----------
x : int
a : float
b : float
Returns
-------
float
a * np.log(x) + b
| logx linear | def logx_linear(x, a, b):
"""logx linear
Parameters
----------
x : int
a : float
b : float
Returns
-------
float
a * np.log(x) + b
"""
x = np.log(x)
return a*x + b | [
"def",
"logx_linear",
"(",
"x",
",",
"a",
",",
"b",
")",
":",
"x",
"=",
"np",
".",
"log",
"(",
"x",
")",
"return",
"a",
"*",
"x",
"+",
"b"
] | [
85,
0
] | [
100,
18
] | python | ro | ['ro', 'uk', 'ur'] | False |
dr_hill_zero_background | (x, theta, eta, kappa) | dr hill zero background
Parameters
----------
x : int
theta : float
eta : float
kappa : float
Returns
-------
float
(theta* x**eta) / (kappa**eta + x**eta)
| dr hill zero background | def dr_hill_zero_background(x, theta, eta, kappa):
"""dr hill zero background
Parameters
----------
x : int
theta : float
eta : float
kappa : float
Returns
-------
float
(theta* x**eta) / (kappa**eta + x**eta)
"""
return (theta * x**eta) / (kappa**eta + x**eta) | [
"def",
"dr_hill_zero_background",
"(",
"x",
",",
"theta",
",",
"eta",
",",
"kappa",
")",
":",
"return",
"(",
"theta",
"*",
"x",
"**",
"eta",
")",
"/",
"(",
"kappa",
"**",
"eta",
"+",
"x",
"**",
"eta",
")"
] | [
108,
0
] | [
123,
51
] | python | de | ['eu', 'de', 'en'] | False |
log_power | (x, a, b, c) | logistic power
Parameters
----------
x : int
a : float
b : float
c : float
Returns
-------
float
a/(1.+(x/np.exp(b))**c)
| logistic power | def log_power(x, a, b, c):
""""logistic power
Parameters
----------
x : int
a : float
b : float
c : float
Returns
-------
float
a/(1.+(x/np.exp(b))**c)
"""
return a/(1.+(x/np.exp(b))**c) | [
"def",
"log_power",
"(",
"x",
",",
"a",
",",
"b",
",",
"c",
")",
":",
"return",
"a",
"/",
"(",
"1.",
"+",
"(",
"x",
"/",
"np",
".",
"exp",
"(",
"b",
")",
")",
"**",
"c",
")"
] | [
131,
0
] | [
146,
34
] | python | en | ['en', 'en', 'en'] | False |
pow4 | (x, alpha, a, b, c) | pow4
Parameters
----------
x : int
alpha : float
a : float
b : float
c : float
Returns
-------
float
c - (a*x+b)**-alpha
| pow4 | def pow4(x, alpha, a, b, c):
"""pow4
Parameters
----------
x : int
alpha : float
a : float
b : float
c : float
Returns
-------
float
c - (a*x+b)**-alpha
"""
return c - (a*x+b)**-alpha | [
"def",
"pow4",
"(",
"x",
",",
"alpha",
",",
"a",
",",
"b",
",",
"c",
")",
":",
"return",
"c",
"-",
"(",
"a",
"*",
"x",
"+",
"b",
")",
"**",
"-",
"alpha"
] | [
154,
0
] | [
170,
30
] | python | pl | ['en', 'pl', 'pl'] | False |
mmf | (x, alpha, beta, kappa, delta) | Morgan-Mercer-Flodin
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm
Parameters
----------
x : int
alpha : float
beta : float
kappa : float
delta : float
Returns
-------
float
alpha - (alpha - beta) / (1. + (kappa * x)**delta)
| Morgan-Mercer-Flodin
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm | def mmf(x, alpha, beta, kappa, delta):
"""Morgan-Mercer-Flodin
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm
Parameters
----------
x : int
alpha : float
beta : float
kappa : float
delta : float
Returns
-------
float
alpha - (a... | [
"def",
"mmf",
"(",
"x",
",",
"alpha",
",",
"beta",
",",
"kappa",
",",
"delta",
")",
":",
"return",
"alpha",
"-",
"(",
"alpha",
"-",
"beta",
")",
"/",
"(",
"1.",
"+",
"(",
"kappa",
"*",
"x",
")",
"**",
"delta",
")"
] | [
178,
0
] | [
195,
61
] | python | en | ['en', 'no', 'tr'] | False |
exp4 | (x, c, a, b, alpha) | exp4
Parameters
----------
x : int
c : float
a : float
b : float
alpha : float
Returns
-------
float
c - np.exp(-a*(x**alpha)+b)
| exp4 | def exp4(x, c, a, b, alpha):
"""exp4
Parameters
----------
x : int
c : float
a : float
b : float
alpha : float
Returns
-------
float
c - np.exp(-a*(x**alpha)+b)
"""
return c - np.exp(-a*(x**alpha)+b) | [
"def",
"exp4",
"(",
"x",
",",
"c",
",",
"a",
",",
"b",
",",
"alpha",
")",
":",
"return",
"c",
"-",
"np",
".",
"exp",
"(",
"-",
"a",
"*",
"(",
"x",
"**",
"alpha",
")",
"+",
"b",
")"
] | [
203,
0
] | [
219,
38
] | python | en | ['en', 'en', 'en'] | False |
ilog2 | (x, c, a) | ilog2
Parameters
----------
x : int
c : float
a : float
Returns
-------
float
c - a / np.log(x)
| ilog2 | def ilog2(x, c, a):
"""ilog2
Parameters
----------
x : int
c : float
a : float
Returns
-------
float
c - a / np.log(x)
"""
return c - a / np.log(x) | [
"def",
"ilog2",
"(",
"x",
",",
"c",
",",
"a",
")",
":",
"return",
"c",
"-",
"a",
"/",
"np",
".",
"log",
"(",
"x",
")"
] | [
227,
0
] | [
241,
28
] | python | la | ['ro', 'la', 'ur'] | False |
weibull | (x, alpha, beta, kappa, delta) | Weibull model
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm
Parameters
----------
x : int
alpha : float
beta : float
kappa : float
delta : float
Returns
-------
float
alpha - (alpha - beta) * np.exp(-(kappa * x)**delta)
| Weibull model
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm | def weibull(x, alpha, beta, kappa, delta):
"""Weibull model
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm
Parameters
----------
x : int
alpha : float
beta : float
kappa : float
delta : float
Returns
-------
float
alpha - (alph... | [
"def",
"weibull",
"(",
"x",
",",
"alpha",
",",
"beta",
",",
"kappa",
",",
"delta",
")",
":",
"return",
"alpha",
"-",
"(",
"alpha",
"-",
"beta",
")",
"*",
"np",
".",
"exp",
"(",
"-",
"(",
"kappa",
"*",
"x",
")",
"**",
"delta",
")"
] | [
249,
0
] | [
266,
63
] | python | en | ['en', 'no', 'ur'] | False |
janoschek | (x, a, beta, k, delta) | http://www.pisces-conservation.com/growthhelp/janoschek.htm
Parameters
----------
x : int
a : float
beta : float
k : float
delta : float
Returns
-------
float
a - (a - beta) * np.exp(-k*x**delta)
| http://www.pisces-conservation.com/growthhelp/janoschek.htm | def janoschek(x, a, beta, k, delta):
"""http://www.pisces-conservation.com/growthhelp/janoschek.htm
Parameters
----------
x : int
a : float
beta : float
k : float
delta : float
Returns
-------
float
a - (a - beta) * np.exp(-k*x**delta)
"""
return a - (a - be... | [
"def",
"janoschek",
"(",
"x",
",",
"a",
",",
"beta",
",",
"k",
",",
"delta",
")",
":",
"return",
"a",
"-",
"(",
"a",
"-",
"beta",
")",
"*",
"np",
".",
"exp",
"(",
"-",
"k",
"*",
"x",
"**",
"delta",
")"
] | [
274,
0
] | [
290,
47
] | python | de | ['de', 'lb', 'en'] | False |
test_deprecated_substitute_old_class | (mock_get_logger) | Test deprecated class object. | Test deprecated class object. | def test_deprecated_substitute_old_class(mock_get_logger):
"""Test deprecated class object."""
mock_logger = MagicMock()
mock_get_logger.return_value = mock_logger
mock_object = MockDeprecatedClass()
assert mock_object.new_property is True
assert mock_object.new_property is True
assert mock... | [
"def",
"test_deprecated_substitute_old_class",
"(",
"mock_get_logger",
")",
":",
"mock_logger",
"=",
"MagicMock",
"(",
")",
"mock_get_logger",
".",
"return_value",
"=",
"mock_logger",
"mock_object",
"=",
"MockDeprecatedClass",
"(",
")",
"assert",
"mock_object",
".",
"... | [
35,
0
] | [
44,
51
] | python | en | ['en', 'en', 'en'] | True |
test_deprecated_substitute_new_class | (mock_get_logger) | Test deprecated class object. | Test deprecated class object. | def test_deprecated_substitute_new_class(mock_get_logger):
"""Test deprecated class object."""
mock_logger = MagicMock()
mock_get_logger.return_value = mock_logger
mock_object = MockUpdatedClass()
assert mock_object.new_property is True
assert mock_object.new_property is True
assert not moc... | [
"def",
"test_deprecated_substitute_new_class",
"(",
"mock_get_logger",
")",
":",
"mock_logger",
"=",
"MagicMock",
"(",
")",
"mock_get_logger",
".",
"return_value",
"=",
"mock_logger",
"mock_object",
"=",
"MockUpdatedClass",
"(",
")",
"assert",
"mock_object",
".",
"new... | [
48,
0
] | [
56,
41
] | python | en | ['en', 'en', 'en'] | True |
test_config_get_deprecated_old | (mock_get_logger) | Test deprecated class object. | Test deprecated class object. | def test_config_get_deprecated_old(mock_get_logger):
"""Test deprecated class object."""
mock_logger = MagicMock()
mock_get_logger.return_value = mock_logger
config = {"old_name": True}
assert get_deprecated(config, "new_name", "old_name") is True
assert mock_logger.warning.called
assert le... | [
"def",
"test_config_get_deprecated_old",
"(",
"mock_get_logger",
")",
":",
"mock_logger",
"=",
"MagicMock",
"(",
")",
"mock_get_logger",
".",
"return_value",
"=",
"mock_logger",
"config",
"=",
"{",
"\"old_name\"",
":",
"True",
"}",
"assert",
"get_deprecated",
"(",
... | [
60,
0
] | [
68,
51
] | python | en | ['en', 'en', 'en'] | True |
test_config_get_deprecated_new | (mock_get_logger) | Test deprecated class object. | Test deprecated class object. | def test_config_get_deprecated_new(mock_get_logger):
"""Test deprecated class object."""
mock_logger = MagicMock()
mock_get_logger.return_value = mock_logger
config = {"new_name": True}
assert get_deprecated(config, "new_name", "old_name") is True
assert not mock_logger.warning.called | [
"def",
"test_config_get_deprecated_new",
"(",
"mock_get_logger",
")",
":",
"mock_logger",
"=",
"MagicMock",
"(",
")",
"mock_get_logger",
".",
"return_value",
"=",
"mock_logger",
"config",
"=",
"{",
"\"new_name\"",
":",
"True",
"}",
"assert",
"get_deprecated",
"(",
... | [
72,
0
] | [
79,
41
] | python | en | ['en', 'en', 'en'] | True |
MockBaseClass.new_property | (self) | Test property to fetch. | Test property to fetch. | def new_property(self):
"""Test property to fetch."""
raise NotImplementedError() | [
"def",
"new_property",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
11,
4
] | [
13,
35
] | python | en | ['en', 'en', 'en'] | True |
MockDeprecatedClass.old_property | (self) | Test property to fetch. | Test property to fetch. | def old_property(self):
"""Test property to fetch."""
return True | [
"def",
"old_property",
"(",
"self",
")",
":",
"return",
"True"
] | [
20,
4
] | [
22,
19
] | python | en | ['en', 'en', 'en'] | True |
MockUpdatedClass.new_property | (self) | Test property to fetch. | Test property to fetch. | def new_property(self):
"""Test property to fetch."""
return True | [
"def",
"new_property",
"(",
"self",
")",
":",
"return",
"True"
] | [
29,
4
] | [
31,
19
] | python | en | ['en', 'en', 'en'] | True |
async_describe_events | (hass, async_describe_event) | Describe logbook events. | Describe logbook events. | def async_describe_events(hass, async_describe_event):
"""Describe logbook events."""
@callback
def async_describe_logbook_event(event):
"""Describe a logbook event."""
_, doorbird_event = event.event_type.split("_", 1)
return {
"name": "Doorbird",
"message"... | [
"def",
"async_describe_events",
"(",
"hass",
",",
"async_describe_event",
")",
":",
"@",
"callback",
"def",
"async_describe_logbook_event",
"(",
"event",
")",
":",
"\"\"\"Describe a logbook event.\"\"\"",
"_",
",",
"doorbird_event",
"=",
"event",
".",
"event_type",
".... | [
9,
0
] | [
33,
13
] | python | en | ['en', 'es', 'en'] | True |
_is_whitespace | (char) | Checks whether `chars` is a whitespace character. | Checks whether `chars` is a whitespace character. | def _is_whitespace(char):
"""Checks whether `chars` is a whitespace character."""
# \t, \n, and \r are technically contorl characters but we treat them
# as whitespace since they are generally considered as such.
if char == " " or char == "\t" or char == "\n" or char == "\r":
return True
cat... | [
"def",
"_is_whitespace",
"(",
"char",
")",
":",
"# \\t, \\n, and \\r are technically contorl characters but we treat them",
"# as whitespace since they are generally considered as such.",
"if",
"char",
"==",
"\" \"",
"or",
"char",
"==",
"\"\\t\"",
"or",
"char",
"==",
"\"\\n\"",... | [
436,
0
] | [
445,
16
] | python | en | ['en', 'en', 'en'] | True |
_is_control | (char) | Checks whether `chars` is a control character. | Checks whether `chars` is a control character. | def _is_control(char):
"""Checks whether `chars` is a control character."""
# These are technically control characters but we count them as whitespace
# characters.
if char == "\t" or char == "\n" or char == "\r":
return False
cat = unicodedata.category(char)
if cat.startswith("C"):
... | [
"def",
"_is_control",
"(",
"char",
")",
":",
"# These are technically control characters but we count them as whitespace",
"# characters.",
"if",
"char",
"==",
"\"\\t\"",
"or",
"char",
"==",
"\"\\n\"",
"or",
"char",
"==",
"\"\\r\"",
":",
"return",
"False",
"cat",
"=",... | [
448,
0
] | [
457,
16
] | python | en | ['en', 'en', 'en'] | True |
_is_punctuation | (char) | Checks whether `chars` is a punctuation character. | Checks whether `chars` is a punctuation character. | def _is_punctuation(char):
"""Checks whether `chars` is a punctuation character."""
cp = ord(char)
# We treat all non-letter/number ASCII as punctuation.
# Characters such as "^", "$", and "`" are not in the Unicode
# Punctuation class but we treat them as punctuation anyways, for
# consistency.... | [
"def",
"_is_punctuation",
"(",
"char",
")",
":",
"cp",
"=",
"ord",
"(",
"char",
")",
"# We treat all non-letter/number ASCII as punctuation.",
"# Characters such as \"^\", \"$\", and \"`\" are not in the Unicode",
"# Punctuation class but we treat them as punctuation anyways, for",
"# ... | [
460,
0
] | [
472,
16
] | python | en | ['en', 'en', 'en'] | True |
convert_to_unicode | (text) | Converts `text` to Unicode (if it's not already), assuming utf-8 input. | Converts `text` to Unicode (if it's not already), assuming utf-8 input. | def convert_to_unicode(text):
"""Converts `text` to Unicode (if it's not already), assuming utf-8 input."""
if six.PY3:
if isinstance(text, str):
return text
elif isinstance(text, bytes):
return text.decode("utf-8", "ignore")
else:
raise ValueError("Un... | [
"def",
"convert_to_unicode",
"(",
"text",
")",
":",
"if",
"six",
".",
"PY3",
":",
"if",
"isinstance",
"(",
"text",
",",
"str",
")",
":",
"return",
"text",
"elif",
"isinstance",
"(",
"text",
",",
"bytes",
")",
":",
"return",
"text",
".",
"decode",
"("... | [
475,
0
] | [
490,
63
] | python | en | ['en', 'en', 'en'] | True |
DebertaV2Tokenizer._tokenize | (self, text) | Take as input a string and return a list of strings (tokens) for words/sub-words | Take as input a string and return a list of strings (tokens) for words/sub-words | def _tokenize(self, text):
"""Take as input a string and return a list of strings (tokens) for words/sub-words"""
if self.do_lower_case:
text = text.lower()
return self._tokenizer.tokenize(text) | [
"def",
"_tokenize",
"(",
"self",
",",
"text",
")",
":",
"if",
"self",
".",
"do_lower_case",
":",
"text",
"=",
"text",
".",
"lower",
"(",
")",
"return",
"self",
".",
"_tokenizer",
".",
"tokenize",
"(",
"text",
")"
] | [
129,
4
] | [
133,
45
] | python | en | ['en', 'en', 'en'] | True |
DebertaV2Tokenizer._convert_token_to_id | (self, token) | Converts a token (str) in an id using the vocab. | Converts a token (str) in an id using the vocab. | def _convert_token_to_id(self, token):
""" Converts a token (str) in an id using the vocab. """
return self._tokenizer.spm.PieceToId(token) | [
"def",
"_convert_token_to_id",
"(",
"self",
",",
"token",
")",
":",
"return",
"self",
".",
"_tokenizer",
".",
"spm",
".",
"PieceToId",
"(",
"token",
")"
] | [
135,
4
] | [
137,
51
] | python | en | ['en', 'en', 'en'] | True |
DebertaV2Tokenizer._convert_id_to_token | (self, index) | Converts an index (integer) in a token (str) using the vocab. | Converts an index (integer) in a token (str) using the vocab. | def _convert_id_to_token(self, index):
"""Converts an index (integer) in a token (str) using the vocab."""
return self._tokenizer.spm.IdToPiece(index) if index < self.vocab_size else self.unk_token | [
"def",
"_convert_id_to_token",
"(",
"self",
",",
"index",
")",
":",
"return",
"self",
".",
"_tokenizer",
".",
"spm",
".",
"IdToPiece",
"(",
"index",
")",
"if",
"index",
"<",
"self",
".",
"vocab_size",
"else",
"self",
".",
"unk_token"
] | [
139,
4
] | [
141,
98
] | python | en | ['en', 'en', 'en'] | True |
DebertaV2Tokenizer.convert_tokens_to_string | (self, tokens) | Converts a sequence of tokens (string) in a single string. | Converts a sequence of tokens (string) in a single string. | def convert_tokens_to_string(self, tokens):
""" Converts a sequence of tokens (string) in a single string. """
return self._tokenizer.decode(tokens) | [
"def",
"convert_tokens_to_string",
"(",
"self",
",",
"tokens",
")",
":",
"return",
"self",
".",
"_tokenizer",
".",
"decode",
"(",
"tokens",
")"
] | [
143,
4
] | [
145,
45
] | python | en | ['en', 'en', 'en'] | True |
DebertaV2Tokenizer.build_inputs_with_special_tokens | (self, token_ids_0, token_ids_1=None) |
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A DeBERTa sequence has the following format:
- single sequence: [CLS] X [SEP]
- pair of sequences: [CLS] A [SEP] B [SEP]
Args:
tok... |
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A DeBERTa sequence has the following format: | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
"""
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A DeBERTa sequence has the following format:
- single sequence: [CLS] X [... | [
"def",
"build_inputs_with_special_tokens",
"(",
"self",
",",
"token_ids_0",
",",
"token_ids_1",
"=",
"None",
")",
":",
"if",
"token_ids_1",
"is",
"None",
":",
"return",
"[",
"self",
".",
"cls_token_id",
"]",
"+",
"token_ids_0",
"+",
"[",
"self",
".",
"sep_to... | [
147,
4
] | [
169,
58
] | python | en | ['en', 'error', 'th'] | False |
DebertaV2Tokenizer.get_special_tokens_mask | (self, token_ids_0, token_ids_1=None, already_has_special_tokens=False) |
Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer ``prepare_for_model`` or ``encode_plus`` methods.
Args:
token_ids_0 (:obj:`List[int]`):
List of IDs.
token_ids... |
Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer ``prepare_for_model`` or ``encode_plus`` methods. | def get_special_tokens_mask(self, token_ids_0, token_ids_1=None, already_has_special_tokens=False):
"""
Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer ``prepare_for_model`` or ``encode_plus`` methods... | [
"def",
"get_special_tokens_mask",
"(",
"self",
",",
"token_ids_0",
",",
"token_ids_1",
"=",
"None",
",",
"already_has_special_tokens",
"=",
"False",
")",
":",
"if",
"already_has_special_tokens",
":",
"if",
"token_ids_1",
"is",
"not",
"None",
":",
"raise",
"ValueEr... | [
171,
4
] | [
203,
51
] | python | en | ['en', 'error', 'th'] | False |
DebertaV2Tokenizer.create_token_type_ids_from_sequences | (self, token_ids_0, token_ids_1=None) |
Create a mask from the two sequences passed to be used in a sequence-pair classification task. A DeBERTa
sequence pair mask has the following format:
::
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
| first sequence | second sequence |
If :obj:`token_ids_1` is :o... |
Create a mask from the two sequences passed to be used in a sequence-pair classification task. A DeBERTa
sequence pair mask has the following format: | def create_token_type_ids_from_sequences(self, token_ids_0, token_ids_1=None):
"""
Create a mask from the two sequences passed to be used in a sequence-pair classification task. A DeBERTa
sequence pair mask has the following format:
::
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ... | [
"def",
"create_token_type_ids_from_sequences",
"(",
"self",
",",
"token_ids_0",
",",
"token_ids_1",
"=",
"None",
")",
":",
"sep",
"=",
"[",
"self",
".",
"sep_token_id",
"]",
"cls",
"=",
"[",
"self",
".",
"cls_token_id",
"]",
"if",
"token_ids_1",
"is",
"None"... | [
205,
4
] | [
231,
80
] | python | en | ['en', 'error', 'th'] | False |
SPMTokenizer._run_strip_accents | (self, text) | Strips accents from a piece of text. | Strips accents from a piece of text. | def _run_strip_accents(self, text):
"""Strips accents from a piece of text."""
text = unicodedata.normalize("NFD", text)
output = []
for char in text:
cat = unicodedata.category(char)
if cat == "Mn":
continue
output.append(char)
... | [
"def",
"_run_strip_accents",
"(",
"self",
",",
"text",
")",
":",
"text",
"=",
"unicodedata",
".",
"normalize",
"(",
"\"NFD\"",
",",
"text",
")",
"output",
"=",
"[",
"]",
"for",
"char",
"in",
"text",
":",
"cat",
"=",
"unicodedata",
".",
"category",
"(",... | [
395,
4
] | [
404,
30
] | python | en | ['en', 'en', 'en'] | True |
SPMTokenizer._run_split_on_punc | (self, text) | Splits punctuation on a piece of text. | Splits punctuation on a piece of text. | def _run_split_on_punc(self, text):
"""Splits punctuation on a piece of text."""
chars = list(text)
i = 0
start_new_word = True
output = []
while i < len(chars):
char = chars[i]
if _is_punctuation(char):
output.append([char])
... | [
"def",
"_run_split_on_punc",
"(",
"self",
",",
"text",
")",
":",
"chars",
"=",
"list",
"(",
"text",
")",
"i",
"=",
"0",
"start_new_word",
"=",
"True",
"output",
"=",
"[",
"]",
"while",
"i",
"<",
"len",
"(",
"chars",
")",
":",
"char",
"=",
"chars",
... | [
406,
4
] | [
424,
43
] | python | en | ['en', 'en', 'en'] | True |
init_integration | (hass) | Set up the Nightscout integration in Home Assistant. | Set up the Nightscout integration in Home Assistant. | async def init_integration(hass) -> MockConfigEntry:
"""Set up the Nightscout integration in Home Assistant."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_URL: "https://some.url:1234"},
)
with patch(
"homeassistant.components.nightscout.NightscoutAPI.get_sgvs",
re... | [
"async",
"def",
"init_integration",
"(",
"hass",
")",
"->",
"MockConfigEntry",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_URL",
":",
"\"https://some.url:1234\"",
"}",
",",
")",
"with",
"patch",
"(",
"\"ho... | [
31,
0
] | [
48,
16
] | python | en | ['en', 'en', 'en'] | True |
init_integration_unavailable | (hass) | Set up the Nightscout integration in Home Assistant. | Set up the Nightscout integration in Home Assistant. | async def init_integration_unavailable(hass) -> MockConfigEntry:
"""Set up the Nightscout integration in Home Assistant."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_URL: "https://some.url:1234"},
)
with patch(
"homeassistant.components.nightscout.NightscoutAPI.get_sgvs"... | [
"async",
"def",
"init_integration_unavailable",
"(",
"hass",
")",
"->",
"MockConfigEntry",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_URL",
":",
"\"https://some.url:1234\"",
"}",
",",
")",
"with",
"patch",
... | [
51,
0
] | [
68,
16
] | python | en | ['en', 'en', 'en'] | True |
init_integration_empty_response | (hass) | Set up the Nightscout integration in Home Assistant. | Set up the Nightscout integration in Home Assistant. | async def init_integration_empty_response(hass) -> MockConfigEntry:
"""Set up the Nightscout integration in Home Assistant."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_URL: "https://some.url:1234"},
)
with patch(
"homeassistant.components.nightscout.NightscoutAPI.get_sg... | [
"async",
"def",
"init_integration_empty_response",
"(",
"hass",
")",
"->",
"MockConfigEntry",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_URL",
":",
"\"https://some.url:1234\"",
"}",
",",
")",
"with",
"patch",... | [
71,
0
] | [
87,
16
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Schluter thermostats. | Set up the Schluter thermostats. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Schluter thermostats."""
if discovery_info is None:
return
session_id = hass.data[DOMAIN][DATA_SCHLUTER_SESSION]
api = hass.data[DOMAIN][DATA_SCHLUTER_API]
async def async_update_data():
... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"session_id",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",... | [
33,
0
] | [
66,
5
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.__init__ | (self, coordinator, serial_number, api, session_id) | Initialize the thermostat. | Initialize the thermostat. | def __init__(self, coordinator, serial_number, api, session_id):
"""Initialize the thermostat."""
super().__init__(coordinator)
self._serial_number = serial_number
self._api = api
self._session_id = session_id
self._support_flags = SUPPORT_TARGET_TEMPERATURE | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"serial_number",
",",
"api",
",",
"session_id",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_serial_number",
"=",
"serial_number",
"self",
".",
"_api",
"=",
... | [
72,
4
] | [
78,
56
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
return self._support_flags | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"self",
".",
"_support_flags"
] | [
81,
4
] | [
83,
34
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.unique_id | (self) | Return unique ID for this device. | Return unique ID for this device. | def unique_id(self):
"""Return unique ID for this device."""
return self._serial_number | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_serial_number"
] | [
86,
4
] | [
88,
34
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.name | (self) | Return the name of the thermostat. | Return the name of the thermostat. | def name(self):
"""Return the name of the thermostat."""
return self.coordinator.data[self._serial_number].name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
"[",
"self",
".",
"_serial_number",
"]",
".",
"name"
] | [
91,
4
] | [
93,
62
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.temperature_unit | (self) | Schluter API always uses celsius. | Schluter API always uses celsius. | def temperature_unit(self):
"""Schluter API always uses celsius."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
96,
4
] | [
98,
27
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self.coordinator.data[self._serial_number].temperature | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
"[",
"self",
".",
"_serial_number",
"]",
".",
"temperature"
] | [
101,
4
] | [
103,
69
] | python | en | ['en', 'la', 'en'] | True |
SchluterThermostat.hvac_mode | (self) | Return current mode. Only heat available for floor thermostat. | Return current mode. Only heat available for floor thermostat. | def hvac_mode(self):
"""Return current mode. Only heat available for floor thermostat."""
return HVAC_MODE_HEAT | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"return",
"HVAC_MODE_HEAT"
] | [
106,
4
] | [
108,
29
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.hvac_action | (self) | Return current operation. Can only be heating or idle. | Return current operation. Can only be heating or idle. | def hvac_action(self):
"""Return current operation. Can only be heating or idle."""
return (
CURRENT_HVAC_HEAT
if self.coordinator.data[self._serial_number].is_heating
else CURRENT_HVAC_IDLE
) | [
"def",
"hvac_action",
"(",
"self",
")",
":",
"return",
"(",
"CURRENT_HVAC_HEAT",
"if",
"self",
".",
"coordinator",
".",
"data",
"[",
"self",
".",
"_serial_number",
"]",
".",
"is_heating",
"else",
"CURRENT_HVAC_IDLE",
")"
] | [
111,
4
] | [
117,
9
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
return self.coordinator.data[self._serial_number].set_point_temp | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
"[",
"self",
".",
"_serial_number",
"]",
".",
"set_point_temp"
] | [
120,
4
] | [
122,
72
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.hvac_modes | (self) | List of available operation modes. | List of available operation modes. | def hvac_modes(self):
"""List of available operation modes."""
return [HVAC_MODE_HEAT] | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"[",
"HVAC_MODE_HEAT",
"]"
] | [
125,
4
] | [
127,
31
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.min_temp | (self) | Identify min_temp in Schluter API. | Identify min_temp in Schluter API. | def min_temp(self):
"""Identify min_temp in Schluter API."""
return self.coordinator.data[self._serial_number].min_temp | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
"[",
"self",
".",
"_serial_number",
"]",
".",
"min_temp"
] | [
130,
4
] | [
132,
66
] | python | co | ['de', 'co', 'nl'] | False |
SchluterThermostat.max_temp | (self) | Identify max_temp in Schluter API. | Identify max_temp in Schluter API. | def max_temp(self):
"""Identify max_temp in Schluter API."""
return self.coordinator.data[self._serial_number].max_temp | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
"[",
"self",
".",
"_serial_number",
"]",
".",
"max_temp"
] | [
135,
4
] | [
137,
66
] | python | it | ['de', 'it', 'it'] | True |
SchluterThermostat.async_set_hvac_mode | (self, hvac_mode) | Mode is always heating, so do nothing. | Mode is always heating, so do nothing. | async def async_set_hvac_mode(self, hvac_mode):
"""Mode is always heating, so do nothing.""" | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":"
] | [
139,
4
] | [
140,
52
] | python | en | ['en', 'en', 'en'] | True |
SchluterThermostat.set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | def set_temperature(self, **kwargs):
"""Set new target temperature."""
target_temp = None
target_temp = kwargs.get(ATTR_TEMPERATURE)
serial_number = self.coordinator.data[self._serial_number].serial_number
_LOGGER.debug("Setting thermostat temperature: %s", target_temp)
... | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"target_temp",
"=",
"None",
"target_temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"serial_number",
"=",
"self",
".",
"coordinator",
".",
"data",
"[",
"self",
".",
... | [
142,
4
] | [
153,
80
] | python | en | ['en', 'ca', 'en'] | True |
async_setup | (hass, config) | Component setup, do nothing. | Component setup, do nothing. | async def async_setup(hass, config):
"""Component setup, do nothing."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"return",
"True"
] | [
5,
0
] | [
7,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Set up a config entry for solarlog. | Set up a config entry for solarlog. | async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Set up a config entry for solarlog."""
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, "sensor")
)
return True | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"async_forward_entry_setup",
"(",
"entry",
",",
"\"sensor\"",
")",
... | [
10,
0
] | [
15,
15
] | python | en | ['en', 'pt', 'en'] | True |
async_unload_entry | (hass, entry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, entry):
"""Unload a config entry."""
return await hass.config_entries.async_forward_entry_unload(entry, "sensor") | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"return",
"await",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"entry",
",",
"\"sensor\"",
")"
] | [
18,
0
] | [
20,
80
] | python | en | ['en', 'es', 'en'] | True |
data | (hass) | Create a loaded data class. | Create a loaded data class. | def data(hass):
"""Create a loaded data class."""
data = hass_auth.Data(hass)
hass.loop.run_until_complete(data.async_load())
return data | [
"def",
"data",
"(",
"hass",
")",
":",
"data",
"=",
"hass_auth",
".",
"Data",
"(",
"hass",
")",
"hass",
".",
"loop",
".",
"run_until_complete",
"(",
"data",
".",
"async_load",
"(",
")",
")",
"return",
"data"
] | [
17,
0
] | [
21,
15
] | python | en | ['en', 'sm', 'en'] | True |
legacy_data | (hass) | Create a loaded legacy data class. | Create a loaded legacy data class. | def legacy_data(hass):
"""Create a loaded legacy data class."""
data = hass_auth.Data(hass)
hass.loop.run_until_complete(data.async_load())
data.is_legacy = True
return data | [
"def",
"legacy_data",
"(",
"hass",
")",
":",
"data",
"=",
"hass_auth",
".",
"Data",
"(",
"hass",
")",
"hass",
".",
"loop",
".",
"run_until_complete",
"(",
"data",
".",
"async_load",
"(",
")",
")",
"data",
".",
"is_legacy",
"=",
"True",
"return",
"data"... | [
25,
0
] | [
30,
15
] | python | en | ['en', 'sm', 'en'] | True |
test_validating_password_invalid_user | (data, hass) | Test validating an invalid user. | Test validating an invalid user. | async def test_validating_password_invalid_user(data, hass):
"""Test validating an invalid user."""
with pytest.raises(hass_auth.InvalidAuth):
data.validate_login("non-existing", "pw") | [
"async",
"def",
"test_validating_password_invalid_user",
"(",
"data",
",",
"hass",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"hass_auth",
".",
"InvalidAuth",
")",
":",
"data",
".",
"validate_login",
"(",
"\"non-existing\"",
",",
"\"pw\"",
")"
] | [
33,
0
] | [
36,
49
] | python | en | ['en', 'en', 'en'] | True |
test_not_allow_set_id | () | Test we are not allowed to set an ID in config. | Test we are not allowed to set an ID in config. | async def test_not_allow_set_id():
"""Test we are not allowed to set an ID in config."""
hass = Mock()
with pytest.raises(vol.Invalid):
await auth_provider_from_config(
hass, None, {"type": "homeassistant", "id": "invalid"}
) | [
"async",
"def",
"test_not_allow_set_id",
"(",
")",
":",
"hass",
"=",
"Mock",
"(",
")",
"with",
"pytest",
".",
"raises",
"(",
"vol",
".",
"Invalid",
")",
":",
"await",
"auth_provider_from_config",
"(",
"hass",
",",
"None",
",",
"{",
"\"type\"",
":",
"\"ho... | [
39,
0
] | [
45,
9
] | python | en | ['en', 'en', 'en'] | True |
test_new_users_populate_values | (hass, data) | Test that we populate data for new users. | Test that we populate data for new users. | async def test_new_users_populate_values(hass, data):
"""Test that we populate data for new users."""
data.add_auth("hello", "test-pass")
await data.async_save()
manager = await auth_manager_from_config(hass, [{"type": "homeassistant"}], [])
provider = manager.auth_providers[0]
credentials = aw... | [
"async",
"def",
"test_new_users_populate_values",
"(",
"hass",
",",
"data",
")",
":",
"data",
".",
"add_auth",
"(",
"\"hello\"",
",",
"\"test-pass\"",
")",
"await",
"data",
".",
"async_save",
"(",
")",
"manager",
"=",
"await",
"auth_manager_from_config",
"(",
... | [
48,
0
] | [
58,
25
] | python | en | ['en', 'en', 'en'] | True |
test_changing_password_raises_invalid_user | (data, hass) | Test that changing password raises invalid user. | Test that changing password raises invalid user. | async def test_changing_password_raises_invalid_user(data, hass):
"""Test that changing password raises invalid user."""
with pytest.raises(hass_auth.InvalidUser):
data.change_password("non-existing", "pw") | [
"async",
"def",
"test_changing_password_raises_invalid_user",
"(",
"data",
",",
"hass",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"hass_auth",
".",
"InvalidUser",
")",
":",
"data",
".",
"change_password",
"(",
"\"non-existing\"",
",",
"\"pw\"",
")"
] | [
61,
0
] | [
64,
50
] | python | en | ['en', 'en', 'en'] | True |
test_adding_user | (data, hass) | Test adding a user. | Test adding a user. | async def test_adding_user(data, hass):
"""Test adding a user."""
data.add_auth("test-user", "test-pass")
data.validate_login(" test-user ", "test-pass") | [
"async",
"def",
"test_adding_user",
"(",
"data",
",",
"hass",
")",
":",
"data",
".",
"add_auth",
"(",
"\"test-user\"",
",",
"\"test-pass\"",
")",
"data",
".",
"validate_login",
"(",
"\" test-user \"",
",",
"\"test-pass\"",
")"
] | [
70,
0
] | [
73,
51
] | python | en | ['en', 'lb', 'en'] | True |
test_adding_user_duplicate_username | (data, hass) | Test adding a user with duplicate username. | Test adding a user with duplicate username. | async def test_adding_user_duplicate_username(data, hass):
"""Test adding a user with duplicate username."""
data.add_auth("test-user", "test-pass")
with pytest.raises(hass_auth.InvalidUser):
data.add_auth("TEST-user ", "other-pass") | [
"async",
"def",
"test_adding_user_duplicate_username",
"(",
"data",
",",
"hass",
")",
":",
"data",
".",
"add_auth",
"(",
"\"test-user\"",
",",
"\"test-pass\"",
")",
"with",
"pytest",
".",
"raises",
"(",
"hass_auth",
".",
"InvalidUser",
")",
":",
"data",
".",
... | [
76,
0
] | [
80,
49
] | python | en | ['en', 'en', 'en'] | True |
test_validating_password_invalid_password | (data, hass) | Test validating an invalid password. | Test validating an invalid password. | async def test_validating_password_invalid_password(data, hass):
"""Test validating an invalid password."""
data.add_auth("test-user", "test-pass")
with pytest.raises(hass_auth.InvalidAuth):
data.validate_login(" test-user ", "invalid-pass")
with pytest.raises(hass_auth.InvalidAuth):
d... | [
"async",
"def",
"test_validating_password_invalid_password",
"(",
"data",
",",
"hass",
")",
":",
"data",
".",
"add_auth",
"(",
"\"test-user\"",
",",
"\"test-pass\"",
")",
"with",
"pytest",
".",
"raises",
"(",
"hass_auth",
".",
"InvalidAuth",
")",
":",
"data",
... | [
83,
0
] | [
94,
53
] | python | en | ['en', 'en', 'en'] | True |
test_changing_password | (data, hass) | Test adding a user. | Test adding a user. | async def test_changing_password(data, hass):
"""Test adding a user."""
data.add_auth("test-user", "test-pass")
data.change_password("TEST-USER ", "new-pass")
with pytest.raises(hass_auth.InvalidAuth):
data.validate_login("test-user", "test-pass")
data.validate_login("test-UsEr", "new-pass... | [
"async",
"def",
"test_changing_password",
"(",
"data",
",",
"hass",
")",
":",
"data",
".",
"add_auth",
"(",
"\"test-user\"",
",",
"\"test-pass\"",
")",
"data",
".",
"change_password",
"(",
"\"TEST-USER \"",
",",
"\"new-pass\"",
")",
"with",
"pytest",
".",
"rai... | [
97,
0
] | [
105,
48
] | python | en | ['en', 'lb', 'en'] | True |
test_login_flow_validates | (data, hass) | Test login flow. | Test login flow. | async def test_login_flow_validates(data, hass):
"""Test login flow."""
data.add_auth("test-user", "test-pass")
await data.async_save()
provider = hass_auth.HassAuthProvider(
hass, auth_store.AuthStore(hass), {"type": "homeassistant"}
)
flow = await provider.async_login_flow({})
res... | [
"async",
"def",
"test_login_flow_validates",
"(",
"data",
",",
"hass",
")",
":",
"data",
".",
"add_auth",
"(",
"\"test-user\"",
",",
"\"test-pass\"",
")",
"await",
"data",
".",
"async_save",
"(",
")",
"provider",
"=",
"hass_auth",
".",
"HassAuthProvider",
"(",... | [
108,
0
] | [
136,
52
] | python | en | ['en', 'fy', 'en'] | True |
test_saving_loading | (data, hass) | Test saving and loading JSON. | Test saving and loading JSON. | async def test_saving_loading(data, hass):
"""Test saving and loading JSON."""
data.add_auth("test-user", "test-pass")
data.add_auth("second-user", "second-pass")
await data.async_save()
data = hass_auth.Data(hass)
await data.async_load()
data.validate_login("test-user ", "test-pass")
d... | [
"async",
"def",
"test_saving_loading",
"(",
"data",
",",
"hass",
")",
":",
"data",
".",
"add_auth",
"(",
"\"test-user\"",
",",
"\"test-pass\"",
")",
"data",
".",
"add_auth",
"(",
"\"second-user\"",
",",
"\"second-pass\"",
")",
"await",
"data",
".",
"async_save... | [
139,
0
] | [
148,
54
] | python | en | ['en', 'en', 'en'] | True |
test_get_or_create_credentials | (hass, data) | Test that we can get or create credentials. | Test that we can get or create credentials. | async def test_get_or_create_credentials(hass, data):
"""Test that we can get or create credentials."""
manager = await auth_manager_from_config(hass, [{"type": "homeassistant"}], [])
provider = manager.auth_providers[0]
provider.data = data
credentials1 = await provider.async_get_or_create_credenti... | [
"async",
"def",
"test_get_or_create_credentials",
"(",
"hass",
",",
"data",
")",
":",
"manager",
"=",
"await",
"auth_manager_from_config",
"(",
"hass",
",",
"[",
"{",
"\"type\"",
":",
"\"homeassistant\"",
"}",
"]",
",",
"[",
"]",
")",
"provider",
"=",
"manag... | [
151,
0
] | [
161,
39
] | python | en | ['en', 'en', 'en'] | True |
test_legacy_adding_user | (legacy_data, hass) | Test in legacy mode adding a user. | Test in legacy mode adding a user. | async def test_legacy_adding_user(legacy_data, hass):
"""Test in legacy mode adding a user."""
legacy_data.add_auth("test-user", "test-pass")
legacy_data.validate_login("test-user", "test-pass") | [
"async",
"def",
"test_legacy_adding_user",
"(",
"legacy_data",
",",
"hass",
")",
":",
"legacy_data",
".",
"add_auth",
"(",
"\"test-user\"",
",",
"\"test-pass\"",
")",
"legacy_data",
".",
"validate_login",
"(",
"\"test-user\"",
",",
"\"test-pass\"",
")"
] | [
167,
0
] | [
170,
56
] | python | en | ['en', 'en', 'en'] | True |
test_legacy_adding_user_duplicate_username | (legacy_data, hass) | Test in legacy mode adding a user with duplicate username. | Test in legacy mode adding a user with duplicate username. | async def test_legacy_adding_user_duplicate_username(legacy_data, hass):
"""Test in legacy mode adding a user with duplicate username."""
legacy_data.add_auth("test-user", "test-pass")
with pytest.raises(hass_auth.InvalidUser):
legacy_data.add_auth("test-user", "other-pass")
# Not considered dup... | [
"async",
"def",
"test_legacy_adding_user_duplicate_username",
"(",
"legacy_data",
",",
"hass",
")",
":",
"legacy_data",
".",
"add_auth",
"(",
"\"test-user\"",
",",
"\"test-pass\"",
")",
"with",
"pytest",
".",
"raises",
"(",
"hass_auth",
".",
"InvalidUser",
")",
":... | [
173,
0
] | [
180,
50
] | python | en | ['en', 'en', 'en'] | True |
test_legacy_validating_password_invalid_password | (legacy_data, hass) | Test in legacy mode validating an invalid password. | Test in legacy mode validating an invalid password. | async def test_legacy_validating_password_invalid_password(legacy_data, hass):
"""Test in legacy mode validating an invalid password."""
legacy_data.add_auth("test-user", "test-pass")
with pytest.raises(hass_auth.InvalidAuth):
legacy_data.validate_login("test-user", "invalid-pass") | [
"async",
"def",
"test_legacy_validating_password_invalid_password",
"(",
"legacy_data",
",",
"hass",
")",
":",
"legacy_data",
".",
"add_auth",
"(",
"\"test-user\"",
",",
"\"test-pass\"",
")",
"with",
"pytest",
".",
"raises",
"(",
"hass_auth",
".",
"InvalidAuth",
")"... | [
183,
0
] | [
188,
63
] | python | en | ['en', 'en', 'it'] | True |
test_legacy_changing_password | (legacy_data, hass) | Test in legacy mode adding a user. | Test in legacy mode adding a user. | async def test_legacy_changing_password(legacy_data, hass):
"""Test in legacy mode adding a user."""
user = "test-user"
legacy_data.add_auth(user, "test-pass")
legacy_data.change_password(user, "new-pass")
with pytest.raises(hass_auth.InvalidAuth):
legacy_data.validate_login(user, "test-pas... | [
"async",
"def",
"test_legacy_changing_password",
"(",
"legacy_data",
",",
"hass",
")",
":",
"user",
"=",
"\"test-user\"",
"legacy_data",
".",
"add_auth",
"(",
"user",
",",
"\"test-pass\"",
")",
"legacy_data",
".",
"change_password",
"(",
"user",
",",
"\"new-pass\"... | [
191,
0
] | [
200,
48
] | python | en | ['en', 'en', 'en'] | True |
test_legacy_changing_password_raises_invalid_user | (legacy_data, hass) | Test in legacy mode that we initialize an empty config. | Test in legacy mode that we initialize an empty config. | async def test_legacy_changing_password_raises_invalid_user(legacy_data, hass):
"""Test in legacy mode that we initialize an empty config."""
with pytest.raises(hass_auth.InvalidUser):
legacy_data.change_password("non-existing", "pw") | [
"async",
"def",
"test_legacy_changing_password_raises_invalid_user",
"(",
"legacy_data",
",",
"hass",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"hass_auth",
".",
"InvalidUser",
")",
":",
"legacy_data",
".",
"change_password",
"(",
"\"non-existing\"",
",",
"\"p... | [
203,
0
] | [
206,
57
] | 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.