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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
DecoraWifiLight.name | (self) | Return the display name of this switch. | Return the display name of this switch. | def name(self):
"""Return the display name of this switch."""
return self._switch.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_switch",
".",
"name"
] | [
97,
4
] | [
99,
32
] | python | en | ['en', 'en', 'en'] | True |
DecoraWifiLight.brightness | (self) | Return the brightness of the dimmer switch. | Return the brightness of the dimmer switch. | def brightness(self):
"""Return the brightness of the dimmer switch."""
return int(self._switch.brightness * 255 / 100) | [
"def",
"brightness",
"(",
"self",
")",
":",
"return",
"int",
"(",
"self",
".",
"_switch",
".",
"brightness",
"*",
"255",
"/",
"100",
")"
] | [
102,
4
] | [
104,
55
] | python | en | ['en', 'en', 'en'] | True |
DecoraWifiLight.is_on | (self) | Return true if switch is on. | Return true if switch is on. | def is_on(self):
"""Return true if switch is on."""
return self._switch.power == "ON" | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_switch",
".",
"power",
"==",
"\"ON\""
] | [
107,
4
] | [
109,
41
] | python | en | ['en', 'fy', 'en'] | True |
DecoraWifiLight.turn_on | (self, **kwargs) | Instruct the switch to turn on & adjust brightness. | Instruct the switch to turn on & adjust brightness. | def turn_on(self, **kwargs):
"""Instruct the switch to turn on & adjust brightness."""
attribs = {"power": "ON"}
if ATTR_BRIGHTNESS in kwargs:
min_level = self._switch.data.get("minLevel", 0)
max_level = self._switch.data.get("maxLevel", 100)
brightness = int... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"attribs",
"=",
"{",
"\"power\"",
":",
"\"ON\"",
"}",
"if",
"ATTR_BRIGHTNESS",
"in",
"kwargs",
":",
"min_level",
"=",
"self",
".",
"_switch",
".",
"data",
".",
"get",
"(",
"\"minLevel\""... | [
111,
4
] | [
129,
63
] | python | en | ['en', 'en', 'en'] | True |
DecoraWifiLight.turn_off | (self, **kwargs) | Instruct the switch to turn off. | Instruct the switch to turn off. | def turn_off(self, **kwargs):
"""Instruct the switch to turn off."""
attribs = {"power": "OFF"}
try:
self._switch.update_attributes(attribs)
except ValueError:
_LOGGER.error("Failed to turn off myLeviton switch") | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"attribs",
"=",
"{",
"\"power\"",
":",
"\"OFF\"",
"}",
"try",
":",
"self",
".",
"_switch",
".",
"update_attributes",
"(",
"attribs",
")",
"except",
"ValueError",
":",
"_LOGGER",
".",
"e... | [
131,
4
] | [
137,
64
] | python | en | ['en', 'en', 'en'] | True |
DecoraWifiLight.update | (self) | Fetch new state data for this switch. | Fetch new state data for this switch. | def update(self):
"""Fetch new state data for this switch."""
try:
self._switch.refresh()
except ValueError:
_LOGGER.error("Failed to update myLeviton switch data") | [
"def",
"update",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_switch",
".",
"refresh",
"(",
")",
"except",
"ValueError",
":",
"_LOGGER",
".",
"error",
"(",
"\"Failed to update myLeviton switch data\"",
")"
] | [
139,
4
] | [
144,
67
] | python | en | ['en', 'en', 'en'] | True |
_read_json | (environment, call) | Undecode the json data. | Undecode the json data. | def _read_json(environment, call):
"""Undecode the json data."""
fixture = load_fixture(f"plugwise/{environment}/{call}.json")
return jsonpickle.decode(fixture) | [
"def",
"_read_json",
"(",
"environment",
",",
"call",
")",
":",
"fixture",
"=",
"load_fixture",
"(",
"f\"plugwise/{environment}/{call}.json\"",
")",
"return",
"jsonpickle",
".",
"decode",
"(",
"fixture",
")"
] | [
14,
0
] | [
17,
37
] | python | en | ['en', 'en', 'en'] | True |
mock_smile | () | Create a Mock Smile for testing exceptions. | Create a Mock Smile for testing exceptions. | def mock_smile():
"""Create a Mock Smile for testing exceptions."""
with patch(
"homeassistant.components.plugwise.config_flow.Smile",
) as smile_mock:
smile_mock.InvalidAuthentication = Smile.InvalidAuthentication
smile_mock.ConnectionFailedError = Smile.ConnectionFailedError
... | [
"def",
"mock_smile",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.plugwise.config_flow.Smile\"",
",",
")",
"as",
"smile_mock",
":",
"smile_mock",
".",
"InvalidAuthentication",
"=",
"Smile",
".",
"InvalidAuthentication",
"smile_mock",
".",
"Connection... | [
21,
0
] | [
29,
37
] | python | en | ['en', 'en', 'en'] | True |
mock_smile_unauth | (aioclient_mock: AiohttpClientMocker) | Mock the Plugwise Smile unauthorized for Home Assistant. | Mock the Plugwise Smile unauthorized for Home Assistant. | def mock_smile_unauth(aioclient_mock: AiohttpClientMocker) -> None:
"""Mock the Plugwise Smile unauthorized for Home Assistant."""
aioclient_mock.get(re.compile(".*"), status=401)
aioclient_mock.put(re.compile(".*"), status=401) | [
"def",
"mock_smile_unauth",
"(",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"aioclient_mock",
".",
"get",
"(",
"re",
".",
"compile",
"(",
"\".*\"",
")",
",",
"status",
"=",
"401",
")",
"aioclient_mock",
".",
"put",
"(",
"re",
"."... | [
33,
0
] | [
36,
52
] | python | en | ['en', 'en', 'en'] | True |
mock_smile_error | (aioclient_mock: AiohttpClientMocker) | Mock the Plugwise Smile server failure for Home Assistant. | Mock the Plugwise Smile server failure for Home Assistant. | def mock_smile_error(aioclient_mock: AiohttpClientMocker) -> None:
"""Mock the Plugwise Smile server failure for Home Assistant."""
aioclient_mock.get(re.compile(".*"), status=500)
aioclient_mock.put(re.compile(".*"), status=500) | [
"def",
"mock_smile_error",
"(",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"aioclient_mock",
".",
"get",
"(",
"re",
".",
"compile",
"(",
"\".*\"",
")",
",",
"status",
"=",
"500",
")",
"aioclient_mock",
".",
"put",
"(",
"re",
".",... | [
40,
0
] | [
43,
52
] | python | en | ['en', 'en', 'en'] | True |
mock_smile_notconnect | () | Mock the Plugwise Smile general connection failure for Home Assistant. | Mock the Plugwise Smile general connection failure for Home Assistant. | def mock_smile_notconnect():
"""Mock the Plugwise Smile general connection failure for Home Assistant."""
with patch("homeassistant.components.plugwise.gateway.Smile") as smile_mock:
smile_mock.InvalidAuthentication = Smile.InvalidAuthentication
smile_mock.ConnectionFailedError = Smile.Connectio... | [
"def",
"mock_smile_notconnect",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.plugwise.gateway.Smile\"",
")",
"as",
"smile_mock",
":",
"smile_mock",
".",
"InvalidAuthentication",
"=",
"Smile",
".",
"InvalidAuthentication",
"smile_mock",
".",
"Connection... | [
47,
0
] | [
54,
37
] | python | en | ['en', 'en', 'en'] | True |
_get_device_data | (chosen_env, device_id) | Mock return data for specific devices. | Mock return data for specific devices. | def _get_device_data(chosen_env, device_id):
"""Mock return data for specific devices."""
return _read_json(chosen_env, "get_device_data/" + device_id) | [
"def",
"_get_device_data",
"(",
"chosen_env",
",",
"device_id",
")",
":",
"return",
"_read_json",
"(",
"chosen_env",
",",
"\"get_device_data/\"",
"+",
"device_id",
")"
] | [
57,
0
] | [
59,
65
] | python | en | ['en', 'en', 'en'] | True |
mock_smile_adam | () | Create a Mock Adam environment for testing exceptions. | Create a Mock Adam environment for testing exceptions. | def mock_smile_adam():
"""Create a Mock Adam environment for testing exceptions."""
chosen_env = "adam_multiple_devices_per_zone"
with patch("homeassistant.components.plugwise.gateway.Smile") as smile_mock:
smile_mock.InvalidAuthentication = Smile.InvalidAuthentication
smile_mock.ConnectionF... | [
"def",
"mock_smile_adam",
"(",
")",
":",
"chosen_env",
"=",
"\"adam_multiple_devices_per_zone\"",
"with",
"patch",
"(",
"\"homeassistant.components.plugwise.gateway.Smile\"",
")",
"as",
"smile_mock",
":",
"smile_mock",
".",
"InvalidAuthentication",
"=",
"Smile",
".",
"Inv... | [
63,
0
] | [
104,
37
] | python | en | ['en', 'en', 'en'] | True |
mock_smile_anna | () | Create a Mock Anna environment for testing exceptions. | Create a Mock Anna environment for testing exceptions. | def mock_smile_anna():
"""Create a Mock Anna environment for testing exceptions."""
chosen_env = "anna_heatpump"
with patch("homeassistant.components.plugwise.gateway.Smile") as smile_mock:
smile_mock.InvalidAuthentication = Smile.InvalidAuthentication
smile_mock.ConnectionFailedError = Smil... | [
"def",
"mock_smile_anna",
"(",
")",
":",
"chosen_env",
"=",
"\"anna_heatpump\"",
"with",
"patch",
"(",
"\"homeassistant.components.plugwise.gateway.Smile\"",
")",
"as",
"smile_mock",
":",
"smile_mock",
".",
"InvalidAuthentication",
"=",
"Smile",
".",
"InvalidAuthenticatio... | [
108,
0
] | [
149,
37
] | python | en | ['en', 'en', 'en'] | True |
mock_smile_p1 | () | Create a Mock P1 DSMR environment for testing exceptions. | Create a Mock P1 DSMR environment for testing exceptions. | def mock_smile_p1():
"""Create a Mock P1 DSMR environment for testing exceptions."""
chosen_env = "p1v3_full_option"
with patch("homeassistant.components.plugwise.gateway.Smile") as smile_mock:
smile_mock.InvalidAuthentication = Smile.InvalidAuthentication
smile_mock.ConnectionFailedError = ... | [
"def",
"mock_smile_p1",
"(",
")",
":",
"chosen_env",
"=",
"\"p1v3_full_option\"",
"with",
"patch",
"(",
"\"homeassistant.components.plugwise.gateway.Smile\"",
")",
"as",
"smile_mock",
":",
"smile_mock",
".",
"InvalidAuthentication",
"=",
"Smile",
".",
"InvalidAuthenticati... | [
153,
0
] | [
185,
37
] | python | en | ['en', 'en', 'en'] | True |
mock_stretch | () | Create a Mock Stretch environment for testing exceptions. | Create a Mock Stretch environment for testing exceptions. | def mock_stretch():
"""Create a Mock Stretch environment for testing exceptions."""
chosen_env = "stretch_v31"
with patch("homeassistant.components.plugwise.gateway.Smile") as smile_mock:
smile_mock.InvalidAuthentication = Smile.InvalidAuthentication
smile_mock.ConnectionFailedError = Smile.... | [
"def",
"mock_stretch",
"(",
")",
":",
"chosen_env",
"=",
"\"stretch_v31\"",
"with",
"patch",
"(",
"\"homeassistant.components.plugwise.gateway.Smile\"",
")",
"as",
"smile_mock",
":",
"smile_mock",
".",
"InvalidAuthentication",
"=",
"Smile",
".",
"InvalidAuthentication",
... | [
189,
0
] | [
218,
37
] | python | en | ['en', 'en', 'en'] | True |
ModelContainerEmcee.__init__ | (self) | pyde/emcee variabless | pyde/emcee variabless | def __init__(self):
super(self.__class__, self).__init__()
""" pyde/emcee variabless """
self.pyde_dir_output = None
self.emcee_dir_output = None
self.emcee_parameters = {'nsave': 0,
'npop_mult': 4,
'thin': 1,
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"self",
".",
"__class__",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"pyde_dir_output",
"=",
"None",
"self",
".",
"emcee_dir_output",
"=",
"None",
"self",
".",
"emcee_parameters",
"="... | [
5,
4
] | [
26,
33
] | python | en | ['en', 'en', 'en'] | False |
device_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def device_reg(hass):
"""Return an empty, loaded, registry."""
return mock_device_registry(hass) | [
"def",
"device_reg",
"(",
"hass",
")",
":",
"return",
"mock_device_registry",
"(",
"hass",
")"
] | [
20,
0
] | [
22,
37
] | python | en | ['en', 'fy', 'en'] | True |
entity_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def entity_reg(hass):
"""Return an empty, loaded, registry."""
return mock_registry(hass) | [
"def",
"entity_reg",
"(",
"hass",
")",
":",
"return",
"mock_registry",
"(",
"hass",
")"
] | [
26,
0
] | [
28,
30
] | python | en | ['en', 'fy', '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\"",
")"
] | [
32,
0
] | [
34,
57
] | python | en | ['en', 'en', 'en'] | True |
test_get_conditions | (hass, device_reg, entity_reg) | Test we get the expected conditions from a fan. | Test we get the expected conditions from a fan. | async def test_get_conditions(hass, device_reg, entity_reg):
"""Test we get the expected conditions from a fan."""
config_entry = MockConfigEntry(domain="test", data={})
config_entry.add_to_hass(hass)
device_entry = device_reg.async_get_or_create(
config_entry_id=config_entry.entry_id,
c... | [
"async",
"def",
"test_get_conditions",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"test\"",
",",
"data",
"=",
"{",
"}",
")",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",... | [
37,
0
] | [
63,
54
] | python | en | ['en', 'en', 'en'] | True |
test_if_state | (hass, calls) | Test for turn_on and turn_off conditions. | Test for turn_on and turn_off conditions. | async def test_if_state(hass, calls):
"""Test for turn_on and turn_off conditions."""
hass.states.async_set("fan.entity", STATE_ON)
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: [
{
"trigger": {"plat... | [
"async",
"def",
"test_if_state",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"fan.entity\"",
",",
"STATE_ON",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
... | [
66,
0
] | [
125,
66
] | python | en | ['en', 'en', 'en'] | True |
mock_garmin | () | Mock Garmin. | Mock Garmin. | def mock_garmin():
"""Mock Garmin."""
with patch(
"homeassistant.components.garmin_connect.config_flow.Garmin",
) as garmin:
garmin.return_value.get_full_name.return_value = MOCK_CONF[CONF_ID]
yield garmin.return_value | [
"def",
"mock_garmin",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.garmin_connect.config_flow.Garmin\"",
",",
")",
"as",
"garmin",
":",
"garmin",
".",
"return_value",
".",
"get_full_name",
".",
"return_value",
"=",
"MOCK_CONF",
"[",
"CONF_ID",
"]... | [
23,
0
] | [
29,
33
] | python | en | ['en', 'tr', 'en'] | False |
test_show_form | (hass) | Test that the form is served with no input. | Test that the form is served with no input. | async def test_show_form(hass):
"""Test that the form is served with no input."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user" | [
"async",
"def",
"test_show_form",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\"",
"}",
")",
"assert",
"result",
"[",
"\"... | [
32,
0
] | [
38,
38
] | python | en | ['en', 'en', 'en'] | True |
test_step_user | (hass, mock_garmin_connect) | Test registering an integration and finishing flow works. | Test registering an integration and finishing flow works. | async def test_step_user(hass, mock_garmin_connect):
"""Test registering an integration and finishing flow works."""
with patch(
"homeassistant.components.garmin_connect.async_setup_entry", return_value=True
), patch("homeassistant.components.garmin_connect.async_setup", return_value=True):
... | [
"async",
"def",
"test_step_user",
"(",
"hass",
",",
"mock_garmin_connect",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.garmin_connect.async_setup_entry\"",
",",
"return_value",
"=",
"True",
")",
",",
"patch",
"(",
"\"homeassistant.components.garmin_connect.a... | [
41,
0
] | [
51,
38
] | python | en | ['en', 'en', 'en'] | True |
test_connection_error | (hass, mock_garmin_connect) | Test for connection error. | Test for connection error. | async def test_connection_error(hass, mock_garmin_connect):
"""Test for connection error."""
mock_garmin_connect.login.side_effect = GarminConnectConnectionError("errormsg")
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}, data=MOCK_CONF
)
assert result... | [
"async",
"def",
"test_connection_error",
"(",
"hass",
",",
"mock_garmin_connect",
")",
":",
"mock_garmin_connect",
".",
"login",
".",
"side_effect",
"=",
"GarminConnectConnectionError",
"(",
"\"errormsg\"",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
... | [
54,
0
] | [
61,
57
] | python | en | ['da', 'en', 'en'] | True |
test_authentication_error | (hass, mock_garmin_connect) | Test for authentication error. | Test for authentication error. | async def test_authentication_error(hass, mock_garmin_connect):
"""Test for authentication error."""
mock_garmin_connect.login.side_effect = GarminConnectAuthenticationError("errormsg")
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}, data=MOCK_CONF
)
a... | [
"async",
"def",
"test_authentication_error",
"(",
"hass",
",",
"mock_garmin_connect",
")",
":",
"mock_garmin_connect",
".",
"login",
".",
"side_effect",
"=",
"GarminConnectAuthenticationError",
"(",
"\"errormsg\"",
")",
"result",
"=",
"await",
"hass",
".",
"config_ent... | [
64,
0
] | [
71,
55
] | python | en | ['da', 'en', 'en'] | True |
test_toomanyrequest_error | (hass, mock_garmin_connect) | Test for toomanyrequests error. | Test for toomanyrequests error. | async def test_toomanyrequest_error(hass, mock_garmin_connect):
"""Test for toomanyrequests error."""
mock_garmin_connect.login.side_effect = GarminConnectTooManyRequestsError(
"errormsg"
)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}, data=MOCK_... | [
"async",
"def",
"test_toomanyrequest_error",
"(",
"hass",
",",
"mock_garmin_connect",
")",
":",
"mock_garmin_connect",
".",
"login",
".",
"side_effect",
"=",
"GarminConnectTooManyRequestsError",
"(",
"\"errormsg\"",
")",
"result",
"=",
"await",
"hass",
".",
"config_en... | [
74,
0
] | [
83,
60
] | python | en | ['en', 'en', 'en'] | True |
test_unknown_error | (hass, mock_garmin_connect) | Test for unknown error. | Test for unknown error. | async def test_unknown_error(hass, mock_garmin_connect):
"""Test for unknown error."""
mock_garmin_connect.login.side_effect = Exception
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}, data=MOCK_CONF
)
assert result["type"] == data_entry_flow.RESULT_TY... | [
"async",
"def",
"test_unknown_error",
"(",
"hass",
",",
"mock_garmin_connect",
")",
":",
"mock_garmin_connect",
".",
"login",
".",
"side_effect",
"=",
"Exception",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAI... | [
86,
0
] | [
93,
50
] | python | en | ['en', 'de', 'en'] | True |
test_abort_if_already_setup | (hass, mock_garmin_connect) | Test abort if already setup. | Test abort if already setup. | async def test_abort_if_already_setup(hass, mock_garmin_connect):
"""Test abort if already setup."""
entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONF, unique_id=MOCK_CONF[CONF_ID])
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}... | [
"async",
"def",
"test_abort_if_already_setup",
"(",
"hass",
",",
"mock_garmin_connect",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"MOCK_CONF",
",",
"unique_id",
"=",
"MOCK_CONF",
"[",
"CONF_ID",
"]",
")",
"entry... | [
96,
0
] | [
104,
51
] | python | en | ['en', 'zu', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Ambicliamte device. | Set up the Ambicliamte device. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Ambicliamte device.""" | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":"
] | [
48,
0
] | [
49,
40
] | python | en | ['en', 'ny', 'en'] | True |
async_setup_entry | (hass, entry, async_add_entities) | Set up the Ambicliamte device from config entry. | Set up the Ambicliamte device from config entry. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the Ambicliamte device from config entry."""
config = entry.data
websession = async_get_clientsession(hass)
store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
token_info = await store.async_load()
oauth = ambi... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"config",
"=",
"entry",
".",
"data",
"websession",
"=",
"async_get_clientsession",
"(",
"hass",
")",
"store",
"=",
"hass",
".",
"helpers",
".",
"storage",
".... | [
52,
0
] | [
133,
5
] | python | en | ['en', 'en', 'en'] | True |
AmbiclimateEntity.__init__ | (self, heater, store) | Initialize the thermostat. | Initialize the thermostat. | def __init__(self, heater, store):
"""Initialize the thermostat."""
self._heater = heater
self._store = store
self._data = {} | [
"def",
"__init__",
"(",
"self",
",",
"heater",
",",
"store",
")",
":",
"self",
".",
"_heater",
"=",
"heater",
"self",
".",
"_store",
"=",
"store",
"self",
".",
"_data",
"=",
"{",
"}"
] | [
139,
4
] | [
143,
23
] | python | en | ['en', 'en', 'en'] | True |
AmbiclimateEntity.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return self._heater.device_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_heater",
".",
"device_id"
] | [
146,
4
] | [
148,
37
] | python | ca | ['fr', 'ca', 'en'] | False |
AmbiclimateEntity.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self):
"""Return the name of the entity."""
return self._heater.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_heater",
".",
"name"
] | [
151,
4
] | [
153,
32
] | python | en | ['en', 'en', 'en'] | True |
AmbiclimateEntity.device_info | (self) | Return the device info. | Return the device info. | def device_info(self):
"""Return the device info."""
return {
"identifiers": {(DOMAIN, self.unique_id)},
"name": self.name,
"manufacturer": "Ambiclimate",
} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"unique_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"manufacturer\"",
":",
"\"Ambiclimate\"",
",",
"}"
] | [
156,
4
] | [
162,
9
] | python | en | ['en', 'en', 'en'] | True |
AmbiclimateEntity.temperature_unit | (self) | Return the unit of measurement which this thermostat uses. | Return the unit of measurement which this thermostat uses. | def temperature_unit(self):
"""Return the unit of measurement which this thermostat uses."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
165,
4
] | [
167,
27
] | python | en | ['en', 'en', 'en'] | True |
AmbiclimateEntity.target_temperature | (self) | Return the target temperature. | Return the target temperature. | def target_temperature(self):
"""Return the target temperature."""
return self._data.get("target_temperature") | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_data",
".",
"get",
"(",
"\"target_temperature\"",
")"
] | [
170,
4
] | [
172,
51
] | python | en | ['en', 'la', 'en'] | True |
AmbiclimateEntity.target_temperature_step | (self) | Return the supported step of target temperature. | Return the supported step of target temperature. | def target_temperature_step(self):
"""Return the supported step of target temperature."""
return 1 | [
"def",
"target_temperature_step",
"(",
"self",
")",
":",
"return",
"1"
] | [
175,
4
] | [
177,
16
] | python | en | ['en', 'en', 'en'] | True |
AmbiclimateEntity.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._data.get("temperature") | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_data",
".",
"get",
"(",
"\"temperature\"",
")"
] | [
180,
4
] | [
182,
44
] | python | en | ['en', 'la', 'en'] | True |
AmbiclimateEntity.current_humidity | (self) | Return the current humidity. | Return the current humidity. | def current_humidity(self):
"""Return the current humidity."""
return self._data.get("humidity") | [
"def",
"current_humidity",
"(",
"self",
")",
":",
"return",
"self",
".",
"_data",
".",
"get",
"(",
"\"humidity\"",
")"
] | [
185,
4
] | [
187,
41
] | python | en | ['en', 'en', 'en'] | True |
AmbiclimateEntity.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
return self._heater.get_min_temp() | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_heater",
".",
"get_min_temp",
"(",
")"
] | [
190,
4
] | [
192,
42
] | python | en | ['en', 'la', 'en'] | True |
AmbiclimateEntity.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
return self._heater.get_max_temp() | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_heater",
".",
"get_max_temp",
"(",
")"
] | [
195,
4
] | [
197,
42
] | python | en | ['en', 'la', 'en'] | True |
AmbiclimateEntity.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 SUPPORT_FLAGS | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_FLAGS"
] | [
200,
4
] | [
202,
28
] | python | en | ['en', 'en', 'en'] | True |
AmbiclimateEntity.hvac_modes | (self) | Return the list of available hvac operation modes. | Return the list of available hvac operation modes. | def hvac_modes(self):
"""Return the list of available hvac operation modes."""
return [HVAC_MODE_HEAT, HVAC_MODE_OFF] | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"[",
"HVAC_MODE_HEAT",
",",
"HVAC_MODE_OFF",
"]"
] | [
205,
4
] | [
207,
46
] | python | en | ['en', 'en', 'en'] | True |
AmbiclimateEntity.hvac_mode | (self) | Return current operation. | Return current operation. | def hvac_mode(self):
"""Return current operation."""
if self._data.get("power", "").lower() == "on":
return HVAC_MODE_HEAT
return HVAC_MODE_OFF | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"_data",
".",
"get",
"(",
"\"power\"",
",",
"\"\"",
")",
".",
"lower",
"(",
")",
"==",
"\"on\"",
":",
"return",
"HVAC_MODE_HEAT",
"return",
"HVAC_MODE_OFF"
] | [
210,
4
] | [
215,
28
] | python | bg | ['nl', 'bg', 'en'] | False |
AmbiclimateEntity.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
temperature = kwargs.get(ATTR_TEMPERATURE)
if temperature is None:
return
await self._heater.set_target_temperature(temperature) | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"temperature",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"if",
"temperature",
"is",
"None",
":",
"return",
"await",
"self",
".",
"_heater",
".",
"set_ta... | [
217,
4
] | [
222,
62
] | python | en | ['en', 'ca', 'en'] | True |
AmbiclimateEntity.async_set_hvac_mode | (self, hvac_mode) | Set new target hvac mode. | Set new target hvac mode. | async def async_set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
if hvac_mode == HVAC_MODE_HEAT:
await self._heater.turn_on()
return
if hvac_mode == HVAC_MODE_OFF:
await self._heater.turn_off() | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"if",
"hvac_mode",
"==",
"HVAC_MODE_HEAT",
":",
"await",
"self",
".",
"_heater",
".",
"turn_on",
"(",
")",
"return",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"await",
"self... | [
224,
4
] | [
230,
41
] | python | da | ['da', 'su', 'en'] | False |
AmbiclimateEntity.async_update | (self) | Retrieve latest state. | Retrieve latest state. | async def async_update(self):
"""Retrieve latest state."""
try:
token_info = await self._heater.control.refresh_access_token()
except ambiclimate.AmbiclimateOauthError:
_LOGGER.error("Failed to refresh access token")
return
if token_info:
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"token_info",
"=",
"await",
"self",
".",
"_heater",
".",
"control",
".",
"refresh_access_token",
"(",
")",
"except",
"ambiclimate",
".",
"AmbiclimateOauthError",
":",
"_LOGGER",
".",
"error",
... | [
232,
4
] | [
243,
55
] | python | en | ['es', 'sk', 'en'] | False |
_mock_get_config | () | Return a default august config. | Return a default august config. | def _mock_get_config():
"""Return a default august config."""
return {
DOMAIN: {
CONF_LOGIN_METHOD: "email",
CONF_USERNAME: "mocked_username",
CONF_PASSWORD: "mocked_password",
}
} | [
"def",
"_mock_get_config",
"(",
")",
":",
"return",
"{",
"DOMAIN",
":",
"{",
"CONF_LOGIN_METHOD",
":",
"\"email\"",
",",
"CONF_USERNAME",
":",
"\"mocked_username\"",
",",
"CONF_PASSWORD",
":",
"\"mocked_password\"",
",",
"}",
"}"
] | [
34,
0
] | [
42,
5
] | python | en | ['en', 'fr', 'en'] | True |
_mock_authenticator | (auth_state) | Mock an august authenticator. | Mock an august authenticator. | def _mock_authenticator(auth_state):
"""Mock an august authenticator."""
authenticator = MagicMock()
type(authenticator).state = PropertyMock(return_value=auth_state)
return authenticator | [
"def",
"_mock_authenticator",
"(",
"auth_state",
")",
":",
"authenticator",
"=",
"MagicMock",
"(",
")",
"type",
"(",
"authenticator",
")",
".",
"state",
"=",
"PropertyMock",
"(",
"return_value",
"=",
"auth_state",
")",
"return",
"authenticator"
] | [
45,
0
] | [
49,
24
] | python | en | ['de', 'en', 'en'] | True |
_mock_setup_august | (hass, api_instance, authenticate_mock, api_mock) | Set up august integration. | Set up august integration. | async def _mock_setup_august(hass, api_instance, authenticate_mock, api_mock):
"""Set up august integration."""
authenticate_mock.side_effect = MagicMock(
return_value=_mock_august_authentication(
"original_token", 1234, AuthenticationState.AUTHENTICATED
)
)
api_mock.return_v... | [
"async",
"def",
"_mock_setup_august",
"(",
"hass",
",",
"api_instance",
",",
"authenticate_mock",
",",
"api_mock",
")",
":",
"authenticate_mock",
".",
"side_effect",
"=",
"MagicMock",
"(",
"return_value",
"=",
"_mock_august_authentication",
"(",
"\"original_token\"",
... | [
54,
0
] | [
64,
15
] | python | en | ['en', 'da', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Tahoma lock. | Set up the Tahoma lock. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Tahoma lock."""
if discovery_info is None:
return
controller = hass.data[TAHOMA_DOMAIN]["controller"]
devices = []
for device in hass.data[TAHOMA_DOMAIN]["devices"]["lock"]:
devices.append(TahomaLock(d... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"controller",
"=",
"hass",
".",
"data",
"[",
"TAHOMA_DOMAIN",
"]",
"[",
"\"controller... | [
15,
0
] | [
23,
31
] | python | en | ['en', 'mg', 'en'] | True |
TahomaLock.__init__ | (self, tahoma_device, controller) | Initialize the device. | Initialize the device. | def __init__(self, tahoma_device, controller):
"""Initialize the device."""
super().__init__(tahoma_device, controller)
self._lock_status = None
self._available = False
self._battery_level = None
self._name = None | [
"def",
"__init__",
"(",
"self",
",",
"tahoma_device",
",",
"controller",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"tahoma_device",
",",
"controller",
")",
"self",
".",
"_lock_status",
"=",
"None",
"self",
".",
"_available",
"=",
"False",
"self",
... | [
29,
4
] | [
35,
25
] | python | en | ['en', 'en', 'en'] | True |
TahomaLock.update | (self) | Update method. | Update method. | def update(self):
"""Update method."""
self.controller.get_states([self.tahoma_device])
self._battery_level = self.tahoma_device.active_states["core:BatteryState"]
self._name = self.tahoma_device.active_states["core:NameState"]
if (
self.tahoma_device.active_states.ge... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"controller",
".",
"get_states",
"(",
"[",
"self",
".",
"tahoma_device",
"]",
")",
"self",
".",
"_battery_level",
"=",
"self",
".",
"tahoma_device",
".",
"active_states",
"[",
"\"core:BatteryState\"",
"]",... | [
37,
4
] | [
52,
9
] | python | en | ['en', 'nl', 'en'] | False |
TahomaLock.unlock | (self, **kwargs) | Unlock method. | Unlock method. | def unlock(self, **kwargs):
"""Unlock method."""
_LOGGER.debug("Unlocking %s", self._name)
self.apply_action("unlock") | [
"def",
"unlock",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Unlocking %s\"",
",",
"self",
".",
"_name",
")",
"self",
".",
"apply_action",
"(",
"\"unlock\"",
")"
] | [
54,
4
] | [
57,
35
] | python | en | ['id', 'et', 'en'] | False |
TahomaLock.lock | (self, **kwargs) | Lock method. | Lock method. | def lock(self, **kwargs):
"""Lock method."""
_LOGGER.debug("Locking %s", self._name)
self.apply_action("lock") | [
"def",
"lock",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Locking %s\"",
",",
"self",
".",
"_name",
")",
"self",
".",
"apply_action",
"(",
"\"lock\"",
")"
] | [
59,
4
] | [
62,
33
] | python | en | ['id', 'et', 'en'] | False |
TahomaLock.name | (self) | Return the name of the lock. | Return the name of the lock. | def name(self):
"""Return the name of the lock."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
65,
4
] | [
67,
25
] | python | en | ['en', 'en', 'en'] | True |
TahomaLock.available | (self) | Return True if the lock is available. | Return True if the lock is available. | def available(self):
"""Return True if the lock is available."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
70,
4
] | [
72,
30
] | python | en | ['en', 'en', 'en'] | True |
TahomaLock.is_locked | (self) | Return True if the lock is locked. | Return True if the lock is locked. | def is_locked(self):
"""Return True if the lock is locked."""
return self._lock_status == STATE_LOCKED | [
"def",
"is_locked",
"(",
"self",
")",
":",
"return",
"self",
".",
"_lock_status",
"==",
"STATE_LOCKED"
] | [
75,
4
] | [
77,
48
] | python | en | ['en', 'mt', 'en'] | True |
TahomaLock.device_state_attributes | (self) | Return the lock state attributes. | Return the lock state attributes. | def device_state_attributes(self):
"""Return the lock state attributes."""
attr = {
ATTR_BATTERY_LEVEL: self._battery_level,
}
super_attr = super().device_state_attributes
if super_attr is not None:
attr.update(super_attr)
return attr | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"attr",
"=",
"{",
"ATTR_BATTERY_LEVEL",
":",
"self",
".",
"_battery_level",
",",
"}",
"super_attr",
"=",
"super",
"(",
")",
".",
"device_state_attributes",
"if",
"super_attr",
"is",
"not",
"None",
":",
... | [
80,
4
] | [
88,
19
] | python | en | ['en', 'en', 'en'] | True |
test_ptvsd | (hass) | Test loading ptvsd component. | Test loading ptvsd component. | async def test_ptvsd(hass):
"""Test loading ptvsd component."""
with patch("ptvsd.enable_attach") as attach:
with patch("ptvsd.wait_for_attach") as wait:
assert await async_setup_component(
hass, ptvsd_component.DOMAIN, {ptvsd_component.DOMAIN: {}}
)
... | [
"async",
"def",
"test_ptvsd",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"ptvsd.enable_attach\"",
")",
"as",
"attach",
":",
"with",
"patch",
"(",
"\"ptvsd.wait_for_attach\"",
")",
"as",
"wait",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
... | [
12,
0
] | [
21,
39
] | python | en | ['de', 'en', 'en'] | True |
test_ptvsd_wait | (hass) | Test loading ptvsd component with wait. | Test loading ptvsd component with wait. | async def test_ptvsd_wait(hass):
"""Test loading ptvsd component with wait."""
with patch("ptvsd.enable_attach") as attach:
with patch("ptvsd.wait_for_attach") as wait:
assert await async_setup_component(
hass,
ptvsd_component.DOMAIN,
{ptvsd_co... | [
"async",
"def",
"test_ptvsd_wait",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"ptvsd.enable_attach\"",
")",
"as",
"attach",
":",
"with",
"patch",
"(",
"\"ptvsd.wait_for_attach\"",
")",
"as",
"wait",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass... | [
25,
0
] | [
36,
39
] | python | en | ['en', 'en', 'en'] | True |
test_ptvsd_bootstrap | (hass) | Test loading ptvsd component with wait. | Test loading ptvsd component with wait. | async def test_ptvsd_bootstrap(hass):
"""Test loading ptvsd component with wait."""
config = {ptvsd_component.DOMAIN: {ptvsd_component.CONF_WAIT: True}}
with patch("homeassistant.components.ptvsd.async_setup", AsyncMock()) as setup_mock:
setup_mock.return_value = True
await _async_set_up_in... | [
"async",
"def",
"test_ptvsd_bootstrap",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"ptvsd_component",
".",
"DOMAIN",
":",
"{",
"ptvsd_component",
".",
"CONF_WAIT",
":",
"True",
"}",
"}",
"with",
"patch",
"(",
"\"homeassistant.components.ptvsd.async_setup\"",
",",
... | [
39,
0
] | [
47,
41
] | python | en | ['en', 'en', 'en'] | True |
mock_camera_prefs | (hass, entity_id, prefs=None) | Fixture for cloud component. | Fixture for cloud component. | def mock_camera_prefs(hass, entity_id, prefs=None):
"""Fixture for cloud component."""
prefs_to_set = {PREF_PRELOAD_STREAM: True}
if prefs is not None:
prefs_to_set.update(prefs)
hass.data[DATA_CAMERA_PREFS]._prefs[entity_id] = prefs_to_set
return prefs_to_set | [
"def",
"mock_camera_prefs",
"(",
"hass",
",",
"entity_id",
",",
"prefs",
"=",
"None",
")",
":",
"prefs_to_set",
"=",
"{",
"PREF_PRELOAD_STREAM",
":",
"True",
"}",
"if",
"prefs",
"is",
"not",
"None",
":",
"prefs_to_set",
".",
"update",
"(",
"prefs",
")",
... | [
8,
0
] | [
14,
23
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Soma component. | Set up the Soma component. | async def async_setup(hass, config):
"""Set up the Soma component."""
if DOMAIN not in config:
return True
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
data=config[DOMAIN],
context={"source": config_entries.SOURCE_IMPORT},
... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"if",
"DOMAIN",
"not",
"in",
"config",
":",
"return",
"True",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"... | [
32,
0
] | [
45,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Set up Soma from a config entry. | Set up Soma from a config entry. | async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Set up Soma from a config entry."""
hass.data[DOMAIN] = {}
hass.data[DOMAIN][API] = SomaApi(entry.data[HOST], entry.data[PORT])
devices = await hass.async_add_executor_job(hass.data[DOMAIN][API].list_devices)
hass.data[DOMA... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"API",
"]",
"=",
"SomaApi",
... | [
48,
0
] | [
60,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Unload a config entry."""
return True | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"return",
"True"
] | [
63,
0
] | [
65,
15
] | python | en | ['en', 'es', 'en'] | True |
SomaEntity.__init__ | (self, device, api) | Initialize the Soma device. | Initialize the Soma device. | def __init__(self, device, api):
"""Initialize the Soma device."""
self.device = device
self.api = api
self.current_position = 50
self.is_available = True | [
"def",
"__init__",
"(",
"self",
",",
"device",
",",
"api",
")",
":",
"self",
".",
"device",
"=",
"device",
"self",
".",
"api",
"=",
"api",
"self",
".",
"current_position",
"=",
"50",
"self",
".",
"is_available",
"=",
"True"
] | [
71,
4
] | [
76,
32
] | python | en | ['en', 'en', 'en'] | True |
SomaEntity.available | (self) | Return true if the last API commands returned successfully. | Return true if the last API commands returned successfully. | def available(self):
"""Return true if the last API commands returned successfully."""
return self.is_available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"is_available"
] | [
79,
4
] | [
81,
32
] | python | en | ['en', 'en', 'en'] | True |
SomaEntity.unique_id | (self) | Return the unique id base on the id returned by pysoma API. | Return the unique id base on the id returned by pysoma API. | def unique_id(self):
"""Return the unique id base on the id returned by pysoma API."""
return self.device["mac"] | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
"[",
"\"mac\"",
"]"
] | [
84,
4
] | [
86,
33
] | python | en | ['en', 'en', 'en'] | True |
SomaEntity.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.device["name"] | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
"[",
"\"name\"",
"]"
] | [
89,
4
] | [
91,
34
] | python | en | ['en', 'en', 'en'] | True |
SomaEntity.device_info | (self) | Return device specific attributes.
Implemented by platform classes.
| Return device specific attributes. | def device_info(self):
"""Return device specific attributes.
Implemented by platform classes.
"""
return {
"identifiers": {(DOMAIN, self.unique_id)},
"name": self.name,
"manufacturer": "Wazombi Labs",
} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"unique_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"manufacturer\"",
":",
"\"Wazombi Labs\"",
",",
"}"
] | [
94,
4
] | [
103,
9
] | python | en | ['fr', 'it', 'en'] | False |
SomaEntity.async_update | (self) | Update the device with the latest data. | Update the device with the latest data. | async def async_update(self):
"""Update the device with the latest data."""
try:
response = await self.hass.async_add_executor_job(
self.api.get_shade_state, self.device["mac"]
)
except RequestException:
_LOGGER.error("Connection to SOMA Connec... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"response",
"=",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"api",
".",
"get_shade_state",
",",
"self",
".",
"device",
"[",
"\"mac\"",
"]",
")",
"excep... | [
105,
4
] | [
122,
32
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, base_config: dict) | Set up for Gogogate2 controllers. | Set up for Gogogate2 controllers. | async def async_setup(hass: HomeAssistant, base_config: dict) -> bool:
"""Set up for Gogogate2 controllers."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"base_config",
":",
"dict",
")",
"->",
"bool",
":",
"return",
"True"
] | [
11,
0
] | [
13,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, config_entry: ConfigEntry) | Do setup of Gogogate2. | Do setup of Gogogate2. | async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Do setup of Gogogate2."""
# Update the config entry.
config_updates = {}
if CONF_DEVICE not in config_entry.data:
config_updates["data"] = {
**config_entry.data,
**{CONF_DEVICE: DEVIC... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"# Update the config entry.",
"config_updates",
"=",
"{",
"}",
"if",
"CONF_DEVICE",
"not",
"in",
"config_entry",
".",
"data",
... | [
16,
0
] | [
40,
15
] | python | en | ['en', 'zu', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, config_entry: ConfigEntry) | Unload Gogogate2 config entry. | Unload Gogogate2 config entry. | async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Unload Gogogate2 config entry."""
hass.async_create_task(
hass.config_entries.async_forward_entry_unload(config_entry, COVER_DOMAIN)
)
return True | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"config_entry",
... | [
43,
0
] | [
49,
15
] | python | en | ['da', 'en', 'en'] | True |
async_process_integration_platforms | (
hass: HomeAssistant,
platform_name: str,
# Any = platform.
process_platform: Callable[[HomeAssistant, str, Any], Awaitable[None]],
) | Process a specific platform for all current and future loaded integrations. | Process a specific platform for all current and future loaded integrations. | async def async_process_integration_platforms(
hass: HomeAssistant,
platform_name: str,
# Any = platform.
process_platform: Callable[[HomeAssistant, str, Any], Awaitable[None]],
) -> None:
"""Process a specific platform for all current and future loaded integrations."""
async def _process(compo... | [
"async",
"def",
"async_process_integration_platforms",
"(",
"hass",
":",
"HomeAssistant",
",",
"platform_name",
":",
"str",
",",
"# Any = platform.",
"process_platform",
":",
"Callable",
"[",
"[",
"HomeAssistant",
",",
"str",
",",
"Any",
"]",
",",
"Awaitable",
"["... | [
13,
0
] | [
55,
36
] | python | en | ['en', 'en', 'en'] | True |
_async_create_entities | (hass, config) | Create the Template cover. | Create the Template cover. | async def _async_create_entities(hass, config):
"""Create the Template cover."""
covers = []
for device, device_config in config[CONF_COVERS].items():
state_template = device_config.get(CONF_VALUE_TEMPLATE)
position_template = device_config.get(CONF_POSITION_TEMPLATE)
tilt_template ... | [
"async",
"def",
"_async_create_entities",
"(",
"hass",
",",
"config",
")",
":",
"covers",
"=",
"[",
"]",
"for",
"device",
",",
"device_config",
"in",
"config",
"[",
"CONF_COVERS",
"]",
".",
"items",
"(",
")",
":",
"state_template",
"=",
"device_config",
".... | [
112,
0
] | [
158,
17
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Template cover. | Set up the Template cover. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Template cover."""
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
async_add_entities(await _async_create_entities(hass, config)) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"await",
"async_setup_reload_service",
"(",
"hass",
",",
"DOMAIN",
",",
"PLATFORMS",
")",
"async_add_entities",
"(",
"await... | [
161,
0
] | [
165,
66
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.__init__ | (
self,
hass,
device_id,
friendly_name,
device_class,
state_template,
position_template,
tilt_template,
icon_template,
entity_picture_template,
availability_template,
open_action,
close_action,
stop_action,
... | Initialize the Template cover. | Initialize the Template cover. | def __init__(
self,
hass,
device_id,
friendly_name,
device_class,
state_template,
position_template,
tilt_template,
icon_template,
entity_picture_template,
availability_template,
open_action,
close_action,
st... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"device_id",
",",
"friendly_name",
",",
"device_class",
",",
"state_template",
",",
"position_template",
",",
"tilt_template",
",",
"icon_template",
",",
"entity_picture_template",
",",
"availability_template",
",",
... | [
171,
4
] | [
226,
35
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
if self._template:
self.add_template_attribute(
"_position", self._template, None, self._update_state
)
if self._position_template:
self.add_template_attribute(
"_p... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"if",
"self",
".",
"_template",
":",
"self",
".",
"add_template_attribute",
"(",
"\"_position\"",
",",
"self",
".",
"_template",
",",
"None",
",",
"self",
".",
"_update_state",
")",
"if",
"self",
... | [
228,
4
] | [
251,
43
] | python | en | ['en', 'no', 'en'] | False |
CoverTemplate.name | (self) | Return the name of the cover. | Return the name of the cover. | def name(self):
"""Return the name of the cover."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
312,
4
] | [
314,
25
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.unique_id | (self) | Return the unique id of this cover. | Return the unique id of this cover. | def unique_id(self):
"""Return the unique id of this cover."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
317,
4
] | [
319,
30
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.is_closed | (self) | Return if the cover is closed. | Return if the cover is closed. | def is_closed(self):
"""Return if the cover is closed."""
return self._position == 0 | [
"def",
"is_closed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_position",
"==",
"0"
] | [
322,
4
] | [
324,
34
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.current_cover_position | (self) | Return current position of cover.
None is unknown, 0 is closed, 100 is fully open.
| Return current position of cover. | def current_cover_position(self):
"""Return current position of cover.
None is unknown, 0 is closed, 100 is fully open.
"""
if self._position_template or self._position_script:
return self._position
return None | [
"def",
"current_cover_position",
"(",
"self",
")",
":",
"if",
"self",
".",
"_position_template",
"or",
"self",
".",
"_position_script",
":",
"return",
"self",
".",
"_position",
"return",
"None"
] | [
327,
4
] | [
334,
19
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.current_cover_tilt_position | (self) | Return current position of cover tilt.
None is unknown, 0 is closed, 100 is fully open.
| Return current position of cover tilt. | def current_cover_tilt_position(self):
"""Return current position of cover tilt.
None is unknown, 0 is closed, 100 is fully open.
"""
return self._tilt_value | [
"def",
"current_cover_tilt_position",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tilt_value"
] | [
337,
4
] | [
342,
31
] | python | en | ['en', 'da', 'en'] | True |
CoverTemplate.device_class | (self) | Return the device class of the cover. | Return the device class of the cover. | def device_class(self):
"""Return the device class of the cover."""
return self._device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_class"
] | [
345,
4
] | [
347,
33
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
supported_features = SUPPORT_OPEN | SUPPORT_CLOSE
if self._stop_script is not None:
supported_features |= SUPPORT_STOP
if self._position_script is not None:
supported_features |= SUPPORT_SET_POSITION
... | [
"def",
"supported_features",
"(",
"self",
")",
":",
"supported_features",
"=",
"SUPPORT_OPEN",
"|",
"SUPPORT_CLOSE",
"if",
"self",
".",
"_stop_script",
"is",
"not",
"None",
":",
"supported_features",
"|=",
"SUPPORT_STOP",
"if",
"self",
".",
"_position_script",
"is... | [
350,
4
] | [
363,
33
] | python | en | ['da', 'en', 'en'] | True |
CoverTemplate.async_open_cover | (self, **kwargs) | Move the cover up. | Move the cover up. | async def async_open_cover(self, **kwargs):
"""Move the cover up."""
if self._open_script:
await self._open_script.async_run(context=self._context)
elif self._position_script:
await self._position_script.async_run(
{"position": 100}, context=self._context
... | [
"async",
"def",
"async_open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_open_script",
":",
"await",
"self",
".",
"_open_script",
".",
"async_run",
"(",
"context",
"=",
"self",
".",
"_context",
")",
"elif",
"self",
".",
... | [
365,
4
] | [
375,
39
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.async_close_cover | (self, **kwargs) | Move the cover down. | Move the cover down. | async def async_close_cover(self, **kwargs):
"""Move the cover down."""
if self._close_script:
await self._close_script.async_run(context=self._context)
elif self._position_script:
await self._position_script.async_run(
{"position": 0}, context=self._conte... | [
"async",
"def",
"async_close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_close_script",
":",
"await",
"self",
".",
"_close_script",
".",
"async_run",
"(",
"context",
"=",
"self",
".",
"_context",
")",
"elif",
"self",
".",... | [
377,
4
] | [
387,
39
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.async_stop_cover | (self, **kwargs) | Fire the stop action. | Fire the stop action. | async def async_stop_cover(self, **kwargs):
"""Fire the stop action."""
if self._stop_script:
await self._stop_script.async_run(context=self._context) | [
"async",
"def",
"async_stop_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_stop_script",
":",
"await",
"self",
".",
"_stop_script",
".",
"async_run",
"(",
"context",
"=",
"self",
".",
"_context",
")"
] | [
389,
4
] | [
392,
68
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.async_set_cover_position | (self, **kwargs) | Set cover position. | Set cover position. | async def async_set_cover_position(self, **kwargs):
"""Set cover position."""
self._position = kwargs[ATTR_POSITION]
await self._position_script.async_run(
{"position": self._position}, context=self._context
)
if self._optimistic:
self.async_write_ha_state... | [
"async",
"def",
"async_set_cover_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_position",
"=",
"kwargs",
"[",
"ATTR_POSITION",
"]",
"await",
"self",
".",
"_position_script",
".",
"async_run",
"(",
"{",
"\"position\"",
":",
"self",... | [
394,
4
] | [
401,
39
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.async_open_cover_tilt | (self, **kwargs) | Tilt the cover open. | Tilt the cover open. | async def async_open_cover_tilt(self, **kwargs):
"""Tilt the cover open."""
self._tilt_value = 100
await self._tilt_script.async_run(
{"tilt": self._tilt_value}, context=self._context
)
if self._tilt_optimistic:
self.async_write_ha_state() | [
"async",
"def",
"async_open_cover_tilt",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_tilt_value",
"=",
"100",
"await",
"self",
".",
"_tilt_script",
".",
"async_run",
"(",
"{",
"\"tilt\"",
":",
"self",
".",
"_tilt_value",
"}",
",",
"con... | [
403,
4
] | [
410,
39
] | python | en | ['en', 'no', 'en'] | True |
CoverTemplate.async_close_cover_tilt | (self, **kwargs) | Tilt the cover closed. | Tilt the cover closed. | async def async_close_cover_tilt(self, **kwargs):
"""Tilt the cover closed."""
self._tilt_value = 0
await self._tilt_script.async_run(
{"tilt": self._tilt_value}, context=self._context
)
if self._tilt_optimistic:
self.async_write_ha_state() | [
"async",
"def",
"async_close_cover_tilt",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_tilt_value",
"=",
"0",
"await",
"self",
".",
"_tilt_script",
".",
"async_run",
"(",
"{",
"\"tilt\"",
":",
"self",
".",
"_tilt_value",
"}",
",",
"cont... | [
412,
4
] | [
419,
39
] | python | en | ['en', 'en', 'en'] | True |
CoverTemplate.async_set_cover_tilt_position | (self, **kwargs) | Move the cover tilt to a specific position. | Move the cover tilt to a specific position. | async def async_set_cover_tilt_position(self, **kwargs):
"""Move the cover tilt to a specific position."""
self._tilt_value = kwargs[ATTR_TILT_POSITION]
await self._tilt_script.async_run(
{"tilt": self._tilt_value}, context=self._context
)
if self._tilt_optimistic:
... | [
"async",
"def",
"async_set_cover_tilt_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_tilt_value",
"=",
"kwargs",
"[",
"ATTR_TILT_POSITION",
"]",
"await",
"self",
".",
"_tilt_script",
".",
"async_run",
"(",
"{",
"\"tilt\"",
":",
"se... | [
421,
4
] | [
428,
39
] | python | en | ['en', 'en', 'en'] | True |
TrainerCallback.on_init_end | (self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs) |
Event called at the end of the initialization of the :class:`~transformers.Trainer`.
|
Event called at the end of the initialization of the :class:`~transformers.Trainer`.
| def on_init_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs):
"""
Event called at the end of the initialization of the :class:`~transformers.Trainer`.
"""
pass | [
"def",
"on_init_end",
"(",
"self",
",",
"args",
":",
"TrainingArguments",
",",
"state",
":",
"TrainerState",
",",
"control",
":",
"TrainerControl",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | [
207,
4
] | [
211,
12
] | python | en | ['en', 'error', 'th'] | False |
TrainerCallback.on_train_begin | (self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs) |
Event called at the beginning of training.
|
Event called at the beginning of training.
| def on_train_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs):
"""
Event called at the beginning of training.
"""
pass | [
"def",
"on_train_begin",
"(",
"self",
",",
"args",
":",
"TrainingArguments",
",",
"state",
":",
"TrainerState",
",",
"control",
":",
"TrainerControl",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | [
213,
4
] | [
217,
12
] | python | en | ['en', 'error', 'th'] | False |
TrainerCallback.on_train_end | (self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs) |
Event called at the end of training.
|
Event called at the end of training.
| def on_train_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs):
"""
Event called at the end of training.
"""
pass | [
"def",
"on_train_end",
"(",
"self",
",",
"args",
":",
"TrainingArguments",
",",
"state",
":",
"TrainerState",
",",
"control",
":",
"TrainerControl",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | [
219,
4
] | [
223,
12
] | python | en | ['en', 'error', 'th'] | False |
TrainerCallback.on_epoch_begin | (self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs) |
Event called at the beginning of an epoch.
|
Event called at the beginning of an epoch.
| def on_epoch_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs):
"""
Event called at the beginning of an epoch.
"""
pass | [
"def",
"on_epoch_begin",
"(",
"self",
",",
"args",
":",
"TrainingArguments",
",",
"state",
":",
"TrainerState",
",",
"control",
":",
"TrainerControl",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | [
225,
4
] | [
229,
12
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.