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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
GPT2Tokenizer._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.decoder.get(index) | [
"def",
"_convert_id_to_token",
"(",
"self",
",",
"index",
")",
":",
"return",
"self",
".",
"decoder",
".",
"get",
"(",
"index",
")"
] | [
257,
4
] | [
259,
38
] | python | en | ['en', 'en', 'en'] | True |
GPT2Tokenizer.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. """
text = "".join(tokens)
text = bytearray([self.byte_decoder[c] for c in text]).decode("utf-8", errors=self.errors)
return text | [
"def",
"convert_tokens_to_string",
"(",
"self",
",",
"tokens",
")",
":",
"text",
"=",
"\"\"",
".",
"join",
"(",
"tokens",
")",
"text",
"=",
"bytearray",
"(",
"[",
"self",
".",
"byte_decoder",
"[",
"c",
"]",
"for",
"c",
"in",
"text",
"]",
")",
".",
... | [
261,
4
] | [
265,
19
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up tuya sensors dynamically through tuya discovery. | Set up tuya sensors dynamically through tuya discovery. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up tuya sensors dynamically through tuya discovery."""
platform = config_entry.data[CONF_PLATFORM]
async def async_discover_sensor(dev_ids):
"""Discover and add a discovered tuya sensor."""
if not dev_ids:
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"platform",
"=",
"config_entry",
".",
"data",
"[",
"CONF_PLATFORM",
"]",
"async",
"def",
"async_discover_sensor",
"(",
"dev_ids",
")",
":",
"\"\"\"Discover ... | [
44,
0
] | [
66,
44
] | python | en | ['en', 'zu', 'en'] | True |
_setup_entities | (hass, dev_ids, platform) | Set up Tuya Light device. | Set up Tuya Light device. | def _setup_entities(hass, dev_ids, platform):
"""Set up Tuya Light device."""
tuya = hass.data[DOMAIN][TUYA_DATA]
entities = []
for dev_id in dev_ids:
device = tuya.get_device_by_id(dev_id)
if device is None:
continue
entities.append(TuyaLight(device, platform))
r... | [
"def",
"_setup_entities",
"(",
"hass",
",",
"dev_ids",
",",
"platform",
")",
":",
"tuya",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"TUYA_DATA",
"]",
"entities",
"=",
"[",
"]",
"for",
"dev_id",
"in",
"dev_ids",
":",
"device",
"=",
"tuya",
".... | [
69,
0
] | [
78,
19
] | python | en | ['en', 'zu', 'en'] | True |
TuyaLight.__init__ | (self, tuya, platform) | Init Tuya light device. | Init Tuya light device. | def __init__(self, tuya, platform):
"""Init Tuya light device."""
super().__init__(tuya, platform)
self.entity_id = ENTITY_ID_FORMAT.format(tuya.object_id())
self._min_kelvin = tuya.max_color_temp()
self._max_kelvin = tuya.min_color_temp() | [
"def",
"__init__",
"(",
"self",
",",
"tuya",
",",
"platform",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"tuya",
",",
"platform",
")",
"self",
".",
"entity_id",
"=",
"ENTITY_ID_FORMAT",
".",
"format",
"(",
"tuya",
".",
"object_id",
"(",
")",
... | [
84,
4
] | [
89,
48
] | python | ca | ['ca', 'zh', 'en'] | False |
TuyaLight._process_config | (self) | Set device config parameter. | Set device config parameter. | def _process_config(self):
"""Set device config parameter."""
config = self._get_device_config()
if not config:
return
# support color config
supp_color = config.get(CONF_SUPPORT_COLOR, False)
if supp_color:
self._tuya.force_support_color()
... | [
"def",
"_process_config",
"(",
"self",
")",
":",
"config",
"=",
"self",
".",
"_get_device_config",
"(",
")",
"if",
"not",
"config",
":",
"return",
"# support color config",
"supp_color",
"=",
"config",
".",
"get",
"(",
"CONF_SUPPORT_COLOR",
",",
"False",
")",
... | [
92,
4
] | [
119,
60
] | python | en | ['nl', 'pt', 'en'] | False |
TuyaLight.async_added_to_hass | (self) | Set config parameter when add to hass. | Set config parameter when add to hass. | async def async_added_to_hass(self):
"""Set config parameter when add to hass."""
await super().async_added_to_hass()
self._process_config()
self.async_on_remove(
async_dispatcher_connect(
self.hass, SIGNAL_CONFIG_ENTITY, self._process_config
)
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"self",
".",
"_process_config",
"(",
")",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",... | [
121,
4
] | [
130,
14
] | python | en | ['en', 'en', 'en'] | True |
TuyaLight.brightness | (self) | Return the brightness of the light. | Return the brightness of the light. | def brightness(self):
"""Return the brightness of the light."""
if self._tuya.brightness() is None:
return None
return int(self._tuya.brightness()) | [
"def",
"brightness",
"(",
"self",
")",
":",
"if",
"self",
".",
"_tuya",
".",
"brightness",
"(",
")",
"is",
"None",
":",
"return",
"None",
"return",
"int",
"(",
"self",
".",
"_tuya",
".",
"brightness",
"(",
")",
")"
] | [
133,
4
] | [
137,
43
] | python | en | ['en', 'no', 'en'] | True |
TuyaLight.hs_color | (self) | Return the hs_color of the light. | Return the hs_color of the light. | def hs_color(self):
"""Return the hs_color of the light."""
return tuple(map(int, self._tuya.hs_color())) | [
"def",
"hs_color",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"map",
"(",
"int",
",",
"self",
".",
"_tuya",
".",
"hs_color",
"(",
")",
")",
")"
] | [
140,
4
] | [
142,
53
] | python | en | ['en', 'en', 'en'] | True |
TuyaLight.color_temp | (self) | Return the color_temp of the light. | Return the color_temp of the light. | def color_temp(self):
"""Return the color_temp of the light."""
color_temp = int(self._tuya.color_temp())
if color_temp is None:
return None
return colorutil.color_temperature_kelvin_to_mired(color_temp) | [
"def",
"color_temp",
"(",
"self",
")",
":",
"color_temp",
"=",
"int",
"(",
"self",
".",
"_tuya",
".",
"color_temp",
"(",
")",
")",
"if",
"color_temp",
"is",
"None",
":",
"return",
"None",
"return",
"colorutil",
".",
"color_temperature_kelvin_to_mired",
"(",
... | [
145,
4
] | [
150,
70
] | python | en | ['en', 'en', 'en'] | True |
TuyaLight.is_on | (self) | Return true if light is on. | Return true if light is on. | def is_on(self):
"""Return true if light is on."""
return self._tuya.state() | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tuya",
".",
"state",
"(",
")"
] | [
153,
4
] | [
155,
33
] | python | en | ['en', 'et', 'en'] | True |
TuyaLight.min_mireds | (self) | Return color temperature min mireds. | Return color temperature min mireds. | def min_mireds(self):
"""Return color temperature min mireds."""
return colorutil.color_temperature_kelvin_to_mired(self._max_kelvin) | [
"def",
"min_mireds",
"(",
"self",
")",
":",
"return",
"colorutil",
".",
"color_temperature_kelvin_to_mired",
"(",
"self",
".",
"_max_kelvin",
")"
] | [
158,
4
] | [
160,
76
] | python | en | ['en', 'la', 'it'] | False |
TuyaLight.max_mireds | (self) | Return color temperature max mireds. | Return color temperature max mireds. | def max_mireds(self):
"""Return color temperature max mireds."""
return colorutil.color_temperature_kelvin_to_mired(self._min_kelvin) | [
"def",
"max_mireds",
"(",
"self",
")",
":",
"return",
"colorutil",
".",
"color_temperature_kelvin_to_mired",
"(",
"self",
".",
"_min_kelvin",
")"
] | [
163,
4
] | [
165,
76
] | python | en | ['en', 'la', 'it'] | False |
TuyaLight.turn_on | (self, **kwargs) | Turn on or control the light. | Turn on or control the light. | def turn_on(self, **kwargs):
"""Turn on or control the light."""
if (
ATTR_BRIGHTNESS not in kwargs
and ATTR_HS_COLOR not in kwargs
and ATTR_COLOR_TEMP not in kwargs
):
self._tuya.turn_on()
if ATTR_BRIGHTNESS in kwargs:
self._tu... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"ATTR_BRIGHTNESS",
"not",
"in",
"kwargs",
"and",
"ATTR_HS_COLOR",
"not",
"in",
"kwargs",
"and",
"ATTR_COLOR_TEMP",
"not",
"in",
"kwargs",
")",
":",
"self",
".",
"_tuya",
".",
... | [
167,
4
] | [
183,
49
] | python | en | ['en', 'en', 'en'] | True |
TuyaLight.turn_off | (self, **kwargs) | Instruct the light to turn off. | Instruct the light to turn off. | def turn_off(self, **kwargs):
"""Instruct the light to turn off."""
self._tuya.turn_off() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_tuya",
".",
"turn_off",
"(",
")"
] | [
185,
4
] | [
187,
29
] | python | en | ['en', 'en', 'en'] | True |
TuyaLight.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
supports = SUPPORT_BRIGHTNESS
if self._tuya.support_color():
supports = supports | SUPPORT_COLOR
if self._tuya.support_color_temp():
supports = supports | SUPPORT_COLOR_TEMP
return supports | [
"def",
"supported_features",
"(",
"self",
")",
":",
"supports",
"=",
"SUPPORT_BRIGHTNESS",
"if",
"self",
".",
"_tuya",
".",
"support_color",
"(",
")",
":",
"supports",
"=",
"supports",
"|",
"SUPPORT_COLOR",
"if",
"self",
".",
"_tuya",
".",
"support_color_temp"... | [
190,
4
] | [
197,
23
] | python | en | ['da', 'en', 'en'] | True |
test_config_with_accesspoint_passed_to_config_entry | (
hass, mock_connection, simple_mock_home
) | Test that config for a accesspoint are loaded via config entry. | Test that config for a accesspoint are loaded via config entry. | async def test_config_with_accesspoint_passed_to_config_entry(
hass, mock_connection, simple_mock_home
):
"""Test that config for a accesspoint are loaded via config entry."""
entry_config = {
CONF_ACCESSPOINT: "ABC123",
CONF_AUTHTOKEN: "123",
CONF_NAME: "name",
}
# no confi... | [
"async",
"def",
"test_config_with_accesspoint_passed_to_config_entry",
"(",
"hass",
",",
"mock_connection",
",",
"simple_mock_home",
")",
":",
"entry_config",
"=",
"{",
"CONF_ACCESSPOINT",
":",
"\"ABC123\"",
",",
"CONF_AUTHTOKEN",
":",
"\"123\"",
",",
"CONF_NAME",
":",
... | [
26,
0
] | [
57,
72
] | python | en | ['en', 'en', 'en'] | True |
test_config_already_registered_not_passed_to_config_entry | (
hass, simple_mock_home
) | Test that an already registered accesspoint does not get imported. | Test that an already registered accesspoint does not get imported. | async def test_config_already_registered_not_passed_to_config_entry(
hass, simple_mock_home
):
"""Test that an already registered accesspoint does not get imported."""
mock_config = {HMIPC_AUTHTOKEN: "123", HMIPC_HAPID: "ABC123", HMIPC_NAME: "name"}
MockConfigEntry(domain=HMIPC_DOMAIN, data=mock_config... | [
"async",
"def",
"test_config_already_registered_not_passed_to_config_entry",
"(",
"hass",
",",
"simple_mock_home",
")",
":",
"mock_config",
"=",
"{",
"HMIPC_AUTHTOKEN",
":",
"\"123\"",
",",
"HMIPC_HAPID",
":",
"\"ABC123\"",
",",
"HMIPC_NAME",
":",
"\"name\"",
"}",
"Mo... | [
60,
0
] | [
101,
50
] | python | en | ['en', 'en', 'en'] | True |
test_load_entry_fails_due_to_connection_error | (
hass, hmip_config_entry, mock_connection_init
) | Test load entry fails due to connection error. | Test load entry fails due to connection error. | async def test_load_entry_fails_due_to_connection_error(
hass, hmip_config_entry, mock_connection_init
):
"""Test load entry fails due to connection error."""
hmip_config_entry.add_to_hass(hass)
with patch(
"homeassistant.components.homematicip_cloud.hap.AsyncHome.get_current_state",
si... | [
"async",
"def",
"test_load_entry_fails_due_to_connection_error",
"(",
"hass",
",",
"hmip_config_entry",
",",
"mock_connection_init",
")",
":",
"hmip_config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"homeassistant.components.homematicip_cloud.hap.As... | [
104,
0
] | [
117,
61
] | python | en | ['en', 'en', 'en'] | True |
test_load_entry_fails_due_to_generic_exception | (hass, hmip_config_entry) | Test load entry fails due to generic exception. | Test load entry fails due to generic exception. | async def test_load_entry_fails_due_to_generic_exception(hass, hmip_config_entry):
"""Test load entry fails due to generic exception."""
hmip_config_entry.add_to_hass(hass)
with patch(
"homeassistant.components.homematicip_cloud.hap.AsyncHome.get_current_state",
side_effect=Exception,
)... | [
"async",
"def",
"test_load_entry_fails_due_to_generic_exception",
"(",
"hass",
",",
"hmip_config_entry",
")",
":",
"hmip_config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"homeassistant.components.homematicip_cloud.hap.AsyncHome.get_current_state\"",
... | [
120,
0
] | [
133,
61
] | python | en | ['en', 'en', 'en'] | True |
test_unload_entry | (hass) | Test being able to unload an entry. | Test being able to unload an entry. | async def test_unload_entry(hass):
"""Test being able to unload an entry."""
mock_config = {HMIPC_AUTHTOKEN: "123", HMIPC_HAPID: "ABC123", HMIPC_NAME: "name"}
MockConfigEntry(domain=HMIPC_DOMAIN, data=mock_config).add_to_hass(hass)
with patch("homeassistant.components.homematicip_cloud.HomematicipHAP")... | [
"async",
"def",
"test_unload_entry",
"(",
"hass",
")",
":",
"mock_config",
"=",
"{",
"HMIPC_AUTHTOKEN",
":",
"\"123\"",
",",
"HMIPC_HAPID",
":",
"\"ABC123\"",
",",
"HMIPC_NAME",
":",
"\"name\"",
"}",
"MockConfigEntry",
"(",
"domain",
"=",
"HMIPC_DOMAIN",
",",
... | [
136,
0
] | [
163,
40
] | python | en | ['en', 'en', 'en'] | True |
test_hmip_dump_hap_config_services | (hass, mock_hap_with_service) | Test dump configuration services. | Test dump configuration services. | async def test_hmip_dump_hap_config_services(hass, mock_hap_with_service):
"""Test dump configuration services."""
with patch("pathlib.Path.write_text", return_value=Mock()) as write_mock:
await hass.services.async_call(
"homematicip_cloud", "dump_hap_config", {"anonymize": True}, blocking=... | [
"async",
"def",
"test_hmip_dump_hap_config_services",
"(",
"hass",
",",
"mock_hap_with_service",
")",
":",
"with",
"patch",
"(",
"\"pathlib.Path.write_text\"",
",",
"return_value",
"=",
"Mock",
"(",
")",
")",
"as",
"write_mock",
":",
"await",
"hass",
".",
"service... | [
166,
0
] | [
176,
36
] | python | fr | ['fr', 'fr', 'en'] | True |
test_setup_services_and_unload_services | (hass) | Test setup services and unload services. | Test setup services and unload services. | async def test_setup_services_and_unload_services(hass):
"""Test setup services and unload services."""
mock_config = {HMIPC_AUTHTOKEN: "123", HMIPC_HAPID: "ABC123", HMIPC_NAME: "name"}
MockConfigEntry(domain=HMIPC_DOMAIN, data=mock_config).add_to_hass(hass)
with patch("homeassistant.components.homemat... | [
"async",
"def",
"test_setup_services_and_unload_services",
"(",
"hass",
")",
":",
"mock_config",
"=",
"{",
"HMIPC_AUTHTOKEN",
":",
"\"123\"",
",",
"HMIPC_HAPID",
":",
"\"ABC123\"",
",",
"HMIPC_NAME",
":",
"\"name\"",
"}",
"MockConfigEntry",
"(",
"domain",
"=",
"HM... | [
179,
0
] | [
205,
63
] | python | en | ['en', 'en', 'en'] | True |
test_setup_two_haps_unload_one_by_one | (hass) | Test setup two access points and unload one by one and check services. | Test setup two access points and unload one by one and check services. | async def test_setup_two_haps_unload_one_by_one(hass):
"""Test setup two access points and unload one by one and check services."""
# Setup AP1
mock_config = {HMIPC_AUTHTOKEN: "123", HMIPC_HAPID: "ABC123", HMIPC_NAME: "name"}
MockConfigEntry(domain=HMIPC_DOMAIN, data=mock_config).add_to_hass(hass)
... | [
"async",
"def",
"test_setup_two_haps_unload_one_by_one",
"(",
"hass",
")",
":",
"# Setup AP1",
"mock_config",
"=",
"{",
"HMIPC_AUTHTOKEN",
":",
"\"123\"",
",",
"HMIPC_HAPID",
":",
"\"ABC123\"",
",",
"HMIPC_NAME",
":",
"\"name\"",
"}",
"MockConfigEntry",
"(",
"domain... | [
208,
0
] | [
246,
63
] | python | en | ['en', 'en', 'en'] | True |
test_platform_manually_configured | (hass) | Test that we do not discover anything or try to set up a gateway. | Test that we do not discover anything or try to set up a gateway. | async def test_platform_manually_configured(hass):
"""Test that we do not discover anything or try to set up a gateway."""
assert (
await async_setup_component(
hass, LIGHT_DOMAIN, {"light": {"platform": DECONZ_DOMAIN}}
)
is True
)
assert DECONZ_DOMAIN not in hass.dat... | [
"async",
"def",
"test_platform_manually_configured",
"(",
"hass",
")",
":",
"assert",
"(",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"DECONZ_DOMAIN",
"}",
"}",
")",
"is",
"True",
"... | [
107,
0
] | [
115,
41
] | python | en | ['en', 'en', 'en'] | True |
test_no_lights_or_groups | (hass) | Test that no lights or groups entities are created. | Test that no lights or groups entities are created. | async def test_no_lights_or_groups(hass):
"""Test that no lights or groups entities are created."""
await setup_deconz_integration(hass)
assert len(hass.states.async_all()) == 0 | [
"async",
"def",
"test_no_lights_or_groups",
"(",
"hass",
")",
":",
"await",
"setup_deconz_integration",
"(",
"hass",
")",
"assert",
"len",
"(",
"hass",
".",
"states",
".",
"async_all",
"(",
")",
")",
"==",
"0"
] | [
118,
0
] | [
121,
44
] | python | en | ['en', 'en', 'en'] | True |
test_lights_and_groups | (hass) | Test that lights or groups entities are created. | Test that lights or groups entities are created. | async def test_lights_and_groups(hass):
"""Test that lights or groups entities are created."""
data = deepcopy(DECONZ_WEB_REQUEST)
data["groups"] = deepcopy(GROUPS)
data["lights"] = deepcopy(LIGHTS)
config_entry = await setup_deconz_integration(hass, get_state_response=data)
gateway = get_gatewa... | [
"async",
"def",
"test_lights_and_groups",
"(",
"hass",
")",
":",
"data",
"=",
"deepcopy",
"(",
"DECONZ_WEB_REQUEST",
")",
"data",
"[",
"\"groups\"",
"]",
"=",
"deepcopy",
"(",
"GROUPS",
")",
"data",
"[",
"\"lights\"",
"]",
"=",
"deepcopy",
"(",
"LIGHTS",
"... | [
124,
0
] | [
297,
44
] | python | en | ['en', 'en', 'en'] | True |
test_disable_light_groups | (hass) | Test disallowing light groups work. | Test disallowing light groups work. | async def test_disable_light_groups(hass):
"""Test disallowing light groups work."""
data = deepcopy(DECONZ_WEB_REQUEST)
data["groups"] = deepcopy(GROUPS)
data["lights"] = deepcopy(LIGHTS)
config_entry = await setup_deconz_integration(
hass,
options={CONF_ALLOW_DECONZ_GROUPS: False},... | [
"async",
"def",
"test_disable_light_groups",
"(",
"hass",
")",
":",
"data",
"=",
"deepcopy",
"(",
"DECONZ_WEB_REQUEST",
")",
"data",
"[",
"\"groups\"",
"]",
"=",
"deepcopy",
"(",
"GROUPS",
")",
"data",
"[",
"\"lights\"",
"]",
"=",
"deepcopy",
"(",
"LIGHTS",
... | [
300,
0
] | [
331,
55
] | python | en | ['en', 'lb', 'en'] | True |
AsyncConfigEntryAuth.__init__ | (
self,
websession: ClientSession,
oauth_session: config_entry_oauth2_flow.OAuth2Session,
api_url: str,
) | Initialize Google Nest Device Access auth. | Initialize Google Nest Device Access auth. | def __init__(
self,
websession: ClientSession,
oauth_session: config_entry_oauth2_flow.OAuth2Session,
api_url: str,
):
"""Initialize Google Nest Device Access auth."""
super().__init__(websession, api_url)
self._oauth_session = oauth_session | [
"def",
"__init__",
"(",
"self",
",",
"websession",
":",
"ClientSession",
",",
"oauth_session",
":",
"config_entry_oauth2_flow",
".",
"OAuth2Session",
",",
"api_url",
":",
"str",
",",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"websession",
",",
"api_... | [
14,
4
] | [
22,
43
] | python | en | ['fr', 'en', 'it'] | False |
AsyncConfigEntryAuth.async_get_access_token | (self) | Return a valid access token. | Return a valid access token. | async def async_get_access_token(self):
"""Return a valid access token."""
if not self._oauth_session.valid_token:
await self._oauth_session.async_ensure_token_valid()
return self._oauth_session.token["access_token"] | [
"async",
"def",
"async_get_access_token",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_oauth_session",
".",
"valid_token",
":",
"await",
"self",
".",
"_oauth_session",
".",
"async_ensure_token_valid",
"(",
")",
"return",
"self",
".",
"_oauth_session",
".",... | [
24,
4
] | [
29,
56
] | python | en | ['en', 'lb', 'en'] | True |
AsyncConfigEntryAuth.async_get_creds | (self) | Return a minimal OAuth credential. | Return a minimal OAuth credential. | async def async_get_creds(self):
"""Return a minimal OAuth credential."""
token = await self.async_get_access_token()
return Credentials(token=token) | [
"async",
"def",
"async_get_creds",
"(",
"self",
")",
":",
"token",
"=",
"await",
"self",
".",
"async_get_access_token",
"(",
")",
"return",
"Credentials",
"(",
"token",
"=",
"token",
")"
] | [
31,
4
] | [
34,
39
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Verisure switch platform. | Set up the Verisure switch platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Verisure switch platform."""
if not int(hub.config.get(CONF_SMARTPLUGS, 1)):
return False
hub.update_overview()
switches = []
switches.extend(
[
VerisureSmartplug(device_label)
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"not",
"int",
"(",
"hub",
".",
"config",
".",
"get",
"(",
"CONF_SMARTPLUGS",
",",
"1",
")",
")",
":",
"return",
"False",
"hub"... | [
8,
0
] | [
21,
26
] | python | en | ['en', 'cs', 'en'] | True |
VerisureSmartplug.__init__ | (self, device_id) | Initialize the Verisure device. | Initialize the Verisure device. | def __init__(self, device_id):
"""Initialize the Verisure device."""
self._device_label = device_id
self._change_timestamp = 0
self._state = False | [
"def",
"__init__",
"(",
"self",
",",
"device_id",
")",
":",
"self",
".",
"_device_label",
"=",
"device_id",
"self",
".",
"_change_timestamp",
"=",
"0",
"self",
".",
"_state",
"=",
"False"
] | [
27,
4
] | [
31,
27
] | python | en | ['en', 'en', 'en'] | True |
VerisureSmartplug.name | (self) | Return the name or location of the smartplug. | Return the name or location of the smartplug. | def name(self):
"""Return the name or location of the smartplug."""
return hub.get_first(
"$.smartPlugs[?(@.deviceLabel == '%s')].area", self._device_label
) | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"hub",
".",
"get_first",
"(",
"\"$.smartPlugs[?(@.deviceLabel == '%s')].area\"",
",",
"self",
".",
"_device_label",
")"
] | [
34,
4
] | [
38,
9
] | python | en | ['en', 'en', 'en'] | True |
VerisureSmartplug.is_on | (self) | Return true if on. | Return true if on. | def is_on(self):
"""Return true if on."""
if monotonic() - self._change_timestamp < 10:
return self._state
self._state = (
hub.get_first(
"$.smartPlugs[?(@.deviceLabel == '%s')].currentState",
self._device_label,
)
=... | [
"def",
"is_on",
"(",
"self",
")",
":",
"if",
"monotonic",
"(",
")",
"-",
"self",
".",
"_change_timestamp",
"<",
"10",
":",
"return",
"self",
".",
"_state",
"self",
".",
"_state",
"=",
"(",
"hub",
".",
"get_first",
"(",
"\"$.smartPlugs[?(@.deviceLabel == '%... | [
41,
4
] | [
52,
26
] | python | en | ['en', 'mt', 'en'] | True |
VerisureSmartplug.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self):
"""Return True if entity is available."""
return (
hub.get_first("$.smartPlugs[?(@.deviceLabel == '%s')]", self._device_label)
is not None
) | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"(",
"hub",
".",
"get_first",
"(",
"\"$.smartPlugs[?(@.deviceLabel == '%s')]\"",
",",
"self",
".",
"_device_label",
")",
"is",
"not",
"None",
")"
] | [
55,
4
] | [
60,
9
] | python | en | ['en', 'en', 'en'] | True |
VerisureSmartplug.turn_on | (self, **kwargs) | Set smartplug status on. | Set smartplug status on. | def turn_on(self, **kwargs):
"""Set smartplug status on."""
hub.session.set_smartplug_state(self._device_label, True)
self._state = True
self._change_timestamp = monotonic() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"hub",
".",
"session",
".",
"set_smartplug_state",
"(",
"self",
".",
"_device_label",
",",
"True",
")",
"self",
".",
"_state",
"=",
"True",
"self",
".",
"_change_timestamp",
"=",
"monotoni... | [
62,
4
] | [
66,
44
] | python | en | ['en', 'et', 'en'] | True |
VerisureSmartplug.turn_off | (self, **kwargs) | Set smartplug status off. | Set smartplug status off. | def turn_off(self, **kwargs):
"""Set smartplug status off."""
hub.session.set_smartplug_state(self._device_label, False)
self._state = False
self._change_timestamp = monotonic() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"hub",
".",
"session",
".",
"set_smartplug_state",
"(",
"self",
".",
"_device_label",
",",
"False",
")",
"self",
".",
"_state",
"=",
"False",
"self",
".",
"_change_timestamp",
"=",
"monot... | [
68,
4
] | [
72,
44
] | python | en | ['en', 'bs', 'en'] | True |
VerisureSmartplug.update | (self) | Get the latest date of the smartplug. | Get the latest date of the smartplug. | def update(self):
"""Get the latest date of the smartplug."""
hub.update_overview() | [
"def",
"update",
"(",
"self",
")",
":",
"hub",
".",
"update_overview",
"(",
")"
] | [
75,
4
] | [
77,
29
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Time and Date sensor. | Set up the Time and Date sensor. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Time and Date sensor."""
if hass.config.time_zone is None:
_LOGGER.error("Timezone is not set in Home Assistant configuration")
return False
async_add_entities(
[TimeDateSensor(hass,... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"hass",
".",
"config",
".",
"time_zone",
"is",
"None",
":",
"_LOGGER",
".",
"error",
"(",
"\"Timezone is not set ... | [
38,
0
] | [
46,
5
] | python | en | ['en', 'en', 'en'] | True |
TimeDateSensor.__init__ | (self, hass, option_type) | Initialize the sensor. | Initialize the sensor. | def __init__(self, hass, option_type):
"""Initialize the sensor."""
self._name = OPTION_TYPES[option_type]
self.type = option_type
self._state = None
self.hass = hass
self.unsub = None
self._update_internal_state(dt_util.utcnow()) | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"option_type",
")",
":",
"self",
".",
"_name",
"=",
"OPTION_TYPES",
"[",
"option_type",
"]",
"self",
".",
"type",
"=",
"option_type",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"hass",
"=",
"hass"... | [
52,
4
] | [
60,
53
] | python | en | ['en', 'en', 'en'] | True |
TimeDateSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
63,
4
] | [
65,
25
] | python | en | ['en', 'mi', 'en'] | True |
TimeDateSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
68,
4
] | [
70,
26
] | python | en | ['en', 'en', 'en'] | True |
TimeDateSensor.icon | (self) | Icon to use in the frontend, if any. | Icon to use in the frontend, if any. | def icon(self):
"""Icon to use in the frontend, if any."""
if "date" in self.type and "time" in self.type:
return "mdi:calendar-clock"
if "date" in self.type:
return "mdi:calendar"
return "mdi:clock" | [
"def",
"icon",
"(",
"self",
")",
":",
"if",
"\"date\"",
"in",
"self",
".",
"type",
"and",
"\"time\"",
"in",
"self",
".",
"type",
":",
"return",
"\"mdi:calendar-clock\"",
"if",
"\"date\"",
"in",
"self",
".",
"type",
":",
"return",
"\"mdi:calendar\"",
"retur... | [
73,
4
] | [
79,
26
] | python | en | ['en', 'en', 'en'] | True |
TimeDateSensor.async_added_to_hass | (self) | Set up first update. | Set up first update. | async def async_added_to_hass(self) -> None:
"""Set up first update."""
self.unsub = async_track_point_in_utc_time(
self.hass, self.point_in_time_listener, self.get_next_interval()
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"unsub",
"=",
"async_track_point_in_utc_time",
"(",
"self",
".",
"hass",
",",
"self",
".",
"point_in_time_listener",
",",
"self",
".",
"get_next_interval",
"(",
")",
")"
] | [
81,
4
] | [
85,
9
] | python | en | ['en', 'lb', 'en'] | True |
TimeDateSensor.async_will_remove_from_hass | (self) | Cancel next update. | Cancel next update. | async def async_will_remove_from_hass(self) -> None:
"""Cancel next update."""
if self.unsub:
self.unsub()
self.unsub = None | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"unsub",
":",
"self",
".",
"unsub",
"(",
")",
"self",
".",
"unsub",
"=",
"None"
] | [
87,
4
] | [
91,
29
] | python | de | ['es', 'de', 'en'] | False |
TimeDateSensor.get_next_interval | (self) | Compute next time an update should occur. | Compute next time an update should occur. | def get_next_interval(self):
"""Compute next time an update should occur."""
now = dt_util.utcnow()
if self.type == "date":
tomorrow = dt_util.as_local(now) + timedelta(days=1)
return dt_util.start_of_local_day(tomorrow)
if self.type == "beat":
# Add... | [
"def",
"get_next_interval",
"(",
"self",
")",
":",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"if",
"self",
".",
"type",
"==",
"\"date\"",
":",
"tomorrow",
"=",
"dt_util",
".",
"as_local",
"(",
"now",
")",
"+",
"timedelta",
"(",
"days",
"=",
"1"... | [
93,
4
] | [
113,
28
] | python | en | ['en', 'en', 'en'] | True |
TimeDateSensor.point_in_time_listener | (self, time_date) | Get the latest data and update state. | Get the latest data and update state. | def point_in_time_listener(self, time_date):
"""Get the latest data and update state."""
self._update_internal_state(time_date)
self.async_write_ha_state()
self.unsub = async_track_point_in_utc_time(
self.hass, self.point_in_time_listener, self.get_next_interval()
) | [
"def",
"point_in_time_listener",
"(",
"self",
",",
"time_date",
")",
":",
"self",
".",
"_update_internal_state",
"(",
"time_date",
")",
"self",
".",
"async_write_ha_state",
"(",
")",
"self",
".",
"unsub",
"=",
"async_track_point_in_utc_time",
"(",
"self",
".",
"... | [
152,
4
] | [
158,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Smappee Comfort Plugs. | Set up the Smappee Comfort Plugs. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Smappee Comfort Plugs."""
smappee_base = hass.data[DOMAIN][config_entry.entry_id]
entities = []
for service_location in smappee_base.smappee.service_locations.values():
for actuator_id, actuator in service_locati... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"smappee_base",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"entities",
"=",
"[",
"]",
"for",
"service_lo... | [
9,
0
] | [
41,
38
] | python | en | ['en', 'en', 'en'] | True |
SmappeeActuator.__init__ | (
self,
smappee_base,
service_location,
name,
actuator_id,
actuator_type,
actuator_serialnumber,
actuator_state_option=None,
) | Initialize a new Smappee Comfort Plug. | Initialize a new Smappee Comfort Plug. | def __init__(
self,
smappee_base,
service_location,
name,
actuator_id,
actuator_type,
actuator_serialnumber,
actuator_state_option=None,
):
"""Initialize a new Smappee Comfort Plug."""
self._smappee_base = smappee_base
self._ser... | [
"def",
"__init__",
"(",
"self",
",",
"smappee_base",
",",
"service_location",
",",
"name",
",",
"actuator_id",
",",
"actuator_type",
",",
"actuator_serialnumber",
",",
"actuator_state_option",
"=",
"None",
",",
")",
":",
"self",
".",
"_smappee_base",
"=",
"smapp... | [
47,
4
] | [
68,
26
] | python | en | ['en', 'en', 'en'] | True |
SmappeeActuator.name | (self) | Return the name of the switch. | Return the name of the switch. | def name(self):
"""Return the name of the switch."""
if self._actuator_type == "INFINITY_OUTPUT_MODULE":
return (
f"{self._service_location.service_location_name} - "
f"Output module - {self._actuator_name} - {self._actuator_state_option}"
)
... | [
"def",
"name",
"(",
"self",
")",
":",
"if",
"self",
".",
"_actuator_type",
"==",
"\"INFINITY_OUTPUT_MODULE\"",
":",
"return",
"(",
"f\"{self._service_location.service_location_name} - \"",
"f\"Output module - {self._actuator_name} - {self._actuator_state_option}\"",
")",
"# Switc... | [
71,
4
] | [
83,
9
] | python | en | ['en', 'en', 'en'] | True |
SmappeeActuator.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."""
if self._actuator_type == "INFINITY_OUTPUT_MODULE":
return (
self._service_location.actuators.get(self._actuator_id).state
== self._actuator_state_option
)
# Switch or comfort plug
... | [
"def",
"is_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_actuator_type",
"==",
"\"INFINITY_OUTPUT_MODULE\"",
":",
"return",
"(",
"self",
".",
"_service_location",
".",
"actuators",
".",
"get",
"(",
"self",
".",
"_actuator_id",
")",
".",
"state",
"==",
"... | [
86,
4
] | [
95,
37
] | python | en | ['en', 'fy', 'en'] | True |
SmappeeActuator.icon | (self) | Icon to use in the frontend. | Icon to use in the frontend. | def icon(self):
"""Icon to use in the frontend."""
return ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"ICON"
] | [
98,
4
] | [
100,
19
] | python | en | ['en', 'en', 'en'] | True |
SmappeeActuator.turn_on | (self, **kwargs) | Turn on Comport Plug. | Turn on Comport Plug. | def turn_on(self, **kwargs):
"""Turn on Comport Plug."""
if self._actuator_type in ["SWITCH", "COMFORT_PLUG"]:
self._service_location.set_actuator_state(self._actuator_id, state="ON_ON")
elif self._actuator_type == "INFINITY_OUTPUT_MODULE":
self._service_location.set_actu... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_actuator_type",
"in",
"[",
"\"SWITCH\"",
",",
"\"COMFORT_PLUG\"",
"]",
":",
"self",
".",
"_service_location",
".",
"set_actuator_state",
"(",
"self",
".",
"_actuator_id",
... | [
102,
4
] | [
109,
13
] | python | en | ['en', 'et', 'en'] | True |
SmappeeActuator.turn_off | (self, **kwargs) | Turn off Comport Plug. | Turn off Comport Plug. | def turn_off(self, **kwargs):
"""Turn off Comport Plug."""
if self._actuator_type in ["SWITCH", "COMFORT_PLUG"]:
self._service_location.set_actuator_state(
self._actuator_id, state="OFF_OFF"
)
elif self._actuator_type == "INFINITY_OUTPUT_MODULE":
... | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_actuator_type",
"in",
"[",
"\"SWITCH\"",
",",
"\"COMFORT_PLUG\"",
"]",
":",
"self",
".",
"_service_location",
".",
"set_actuator_state",
"(",
"self",
".",
"_actuator_id",... | [
111,
4
] | [
120,
13
] | python | en | ['en', 'et', 'en'] | True |
SmappeeActuator.available | (self) | Return True if entity is available. Unavailable for COMFORT_PLUGS. | Return True if entity is available. Unavailable for COMFORT_PLUGS. | def available(self):
"""Return True if entity is available. Unavailable for COMFORT_PLUGS."""
return (
self._connection_state == "CONNECTED"
or self._actuator_type == "COMFORT_PLUG"
) | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"_connection_state",
"==",
"\"CONNECTED\"",
"or",
"self",
".",
"_actuator_type",
"==",
"\"COMFORT_PLUG\"",
")"
] | [
123,
4
] | [
128,
9
] | python | en | ['en', 'en', 'en'] | True |
SmappeeActuator.today_energy_kwh | (self) | Return the today total energy usage in kWh. | Return the today total energy usage in kWh. | def today_energy_kwh(self):
"""Return the today total energy usage in kWh."""
if self._actuator_type == "SWITCH":
cons = self._service_location.actuators.get(
self._actuator_id
).consumption_today
if cons is not None:
return round(cons ... | [
"def",
"today_energy_kwh",
"(",
"self",
")",
":",
"if",
"self",
".",
"_actuator_type",
"==",
"\"SWITCH\"",
":",
"cons",
"=",
"self",
".",
"_service_location",
".",
"actuators",
".",
"get",
"(",
"self",
".",
"_actuator_id",
")",
".",
"consumption_today",
"if"... | [
131,
4
] | [
139,
19
] | python | en | ['en', 'en', 'en'] | True |
SmappeeActuator.unique_id | (
self,
) | Return the unique ID for this switch. | Return the unique ID for this switch. | def unique_id(
self,
):
"""Return the unique ID for this switch."""
if self._actuator_type == "INFINITY_OUTPUT_MODULE":
return (
f"{self._service_location.device_serial_number}-"
f"{self._service_location.service_location_id}-actuator-"
... | [
"def",
"unique_id",
"(",
"self",
",",
")",
":",
"if",
"self",
".",
"_actuator_type",
"==",
"\"INFINITY_OUTPUT_MODULE\"",
":",
"return",
"(",
"f\"{self._service_location.device_serial_number}-\"",
"f\"{self._service_location.service_location_id}-actuator-\"",
"f\"{self._actuator_i... | [
142,
4
] | [
158,
9
] | python | en | ['en', 'en', 'en'] | True |
SmappeeActuator.device_info | (self) | Return the device info for this switch. | Return the device info for this switch. | def device_info(self):
"""Return the device info for this switch."""
return {
"identifiers": {(DOMAIN, self._service_location.device_serial_number)},
"name": self._service_location.service_location_name,
"manufacturer": "Smappee",
"model": self._service_lo... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_service_location",
".",
"device_serial_number",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"_service_location",
".",
"service_location... | [
161,
4
] | [
169,
9
] | python | en | ['en', 'en', 'en'] | True |
SmappeeActuator.async_update | (self) | Get the latest data from Smappee and update the state. | Get the latest data from Smappee and update the state. | async def async_update(self):
"""Get the latest data from Smappee and update the state."""
await self._smappee_base.async_update()
new_state = self._service_location.actuators.get(self._actuator_id).state
if new_state != self._state:
self._state = new_state
self.... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"_smappee_base",
".",
"async_update",
"(",
")",
"new_state",
"=",
"self",
".",
"_service_location",
".",
"actuators",
".",
"get",
"(",
"self",
".",
"_actuator_id",
")",
".",
"stat... | [
171,
4
] | [
182,
26
] | python | en | ['en', 'en', 'en'] | True |
async_call_action_from_config | (
hass: HomeAssistant,
config: ConfigType,
variables: TemplateVarsType,
context: Context,
) | Perform an action based on configuration. | Perform an action based on configuration. | async def async_call_action_from_config(
hass: HomeAssistant,
config: ConfigType,
variables: TemplateVarsType,
context: Context,
) -> None:
"""Perform an action based on configuration."""
await ZHA_ACTION_TYPES[DEVICE_ACTION_TYPES[config[CONF_TYPE]]](
hass, config, variables, context
... | [
"async",
"def",
"async_call_action_from_config",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"variables",
":",
"TemplateVarsType",
",",
"context",
":",
"Context",
",",
")",
"->",
"None",
":",
"await",
"ZHA_ACTION_TYPES",
"[",
"DEVIC... | [
44,
0
] | [
53,
5
] | python | en | ['en', 'en', 'en'] | True |
async_get_actions | (hass: HomeAssistant, device_id: str) | List device actions. | List device actions. | async def async_get_actions(hass: HomeAssistant, device_id: str) -> List[dict]:
"""List device actions."""
try:
zha_device = await async_get_zha_device(hass, device_id)
except (KeyError, AttributeError):
return []
cluster_channels = [
ch.name
for pool in zha_device.channe... | [
"async",
"def",
"async_get_actions",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"List",
"[",
"dict",
"]",
":",
"try",
":",
"zha_device",
"=",
"await",
"async_get_zha_device",
"(",
"hass",
",",
"device_id",
")",
"except",
"(... | [
56,
0
] | [
75,
18
] | python | en | ['fr', 'en', 'en'] | True |
async_setup | (hass, config) | Track states and offer events for sensors. | Track states and offer events for sensors. | async def async_setup(hass, config):
"""Track states and offer events for sensors."""
component = hass.data[DOMAIN] = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
)
await component.async_setup(config)
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"component",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
",",
"SCAN_INTERVAL",
")",
"await",
"component",
".",
"asy... | [
54,
0
] | [
61,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry) | Set up a config entry. | Set up a config entry. | async def async_setup_entry(hass, entry):
"""Set up a config entry."""
return await hass.data[DOMAIN].async_setup_entry(entry) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"return",
"await",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"async_setup_entry",
"(",
"entry",
")"
] | [
64,
0
] | [
66,
59
] | python | en | ['en', 'en', '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.data[DOMAIN].async_unload_entry(entry) | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"return",
"await",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"async_unload_entry",
"(",
"entry",
")"
] | [
69,
0
] | [
71,
60
] | python | en | ['en', 'es', 'en'] | True |
test_koogeek_ls1_setup | (hass) | Test that a Koogeek LS1 can be correctly setup in HA. | Test that a Koogeek LS1 can be correctly setup in HA. | async def test_koogeek_ls1_setup(hass):
"""Test that a Koogeek LS1 can be correctly setup in HA."""
accessories = await setup_accessories_from_file(hass, "koogeek_ls1.json")
config_entry, pairing = await setup_test_accessories(hass, accessories)
entity_registry = await hass.helpers.entity_registry.asyn... | [
"async",
"def",
"test_koogeek_ls1_setup",
"(",
"hass",
")",
":",
"accessories",
"=",
"await",
"setup_accessories_from_file",
"(",
"hass",
",",
"\"koogeek_ls1.json\"",
")",
"config_entry",
",",
"pairing",
"=",
"await",
"setup_test_accessories",
"(",
"hass",
",",
"acc... | [
22,
0
] | [
53,
39
] | python | en | ['en', 'ig', 'en'] | True |
test_recover_from_failure | (hass, utcnow, failure_cls) |
Test that entity actually recovers from a network connection drop.
See https://github.com/home-assistant/core/issues/18949
|
Test that entity actually recovers from a network connection drop. | async def test_recover_from_failure(hass, utcnow, failure_cls):
"""
Test that entity actually recovers from a network connection drop.
See https://github.com/home-assistant/core/issues/18949
"""
accessories = await setup_accessories_from_file(hass, "koogeek_ls1.json")
config_entry, pairing = aw... | [
"async",
"def",
"test_recover_from_failure",
"(",
"hass",
",",
"utcnow",
",",
"failure_cls",
")",
":",
"accessories",
"=",
"await",
"setup_accessories_from_file",
"(",
"hass",
",",
"\"koogeek_ls1.json\"",
")",
"config_entry",
",",
"pairing",
"=",
"await",
"setup_tes... | [
57,
0
] | [
97,
30
] | python | en | ['en', 'error', 'th'] | False |
problem3_4 | (mon, day, year) | Takes date such as July 17, 2016 and write it as 7/17/2016 | Takes date such as July 17, 2016 and write it as 7/17/2016 | def problem3_4(mon, day, year):
""" Takes date such as July 17, 2016 and write it as 7/17/2016 """
month_mapping = {'January':1,
"Febuary":2,
"March":3,
"April":4,
"May" : 5,
"June" : 6,
... | [
"def",
"problem3_4",
"(",
"mon",
",",
"day",
",",
"year",
")",
":",
"month_mapping",
"=",
"{",
"'January'",
":",
"1",
",",
"\"Febuary\"",
":",
"2",
",",
"\"March\"",
":",
"3",
",",
"\"April\"",
":",
"4",
",",
"\"May\"",
":",
"5",
",",
"\"June\"",
"... | [
23,
0
] | [
38,
59
] | python | en | ['en', 'en', 'en'] | True |
test_mqtt_abort_if_existing_entry | (hass, mqtt_mock) | Check MQTT flow aborts when an entry already exist. | Check MQTT flow aborts when an entry already exist. | async def test_mqtt_abort_if_existing_entry(hass, mqtt_mock):
"""Check MQTT flow aborts when an entry already exist."""
MockConfigEntry(domain="tasmota").add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
"tasmota", context={"source": "mqtt"}
)
assert result["type"] == "... | [
"async",
"def",
"test_mqtt_abort_if_existing_entry",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"\"tasmota\"",
")",
".",
"add_to_hass",
"(",
"hass",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
"... | [
6,
0
] | [
15,
56
] | python | en | ['en', 'en', 'en'] | True |
test_mqtt_abort_invalid_topic | (hass, mqtt_mock) | Check MQTT flow aborts if discovery topic is invalid. | Check MQTT flow aborts if discovery topic is invalid. | async def test_mqtt_abort_invalid_topic(hass, mqtt_mock):
"""Check MQTT flow aborts if discovery topic is invalid."""
discovery_info = Message("", "", 0, False, subscribed_topic="custom_prefix/##")
result = await hass.config_entries.flow.async_init(
"tasmota", context={"source": "mqtt"}, data=discov... | [
"async",
"def",
"test_mqtt_abort_invalid_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"discovery_info",
"=",
"Message",
"(",
"\"\"",
",",
"\"\"",
",",
"0",
",",
"False",
",",
"subscribed_topic",
"=",
"\"custom_prefix/##\"",
")",
"result",
"=",
"await",
"ha... | [
18,
0
] | [
25,
55
] | python | en | ['en', 'en', 'en'] | True |
test_mqtt_setup | (hass, mqtt_mock) | Test we can finish a config flow through MQTT with custom prefix. | Test we can finish a config flow through MQTT with custom prefix. | async def test_mqtt_setup(hass, mqtt_mock) -> None:
"""Test we can finish a config flow through MQTT with custom prefix."""
discovery_info = Message("", "", 0, False, subscribed_topic="custom_prefix/123/#")
result = await hass.config_entries.flow.async_init(
"tasmota", context={"source": "mqtt"}, da... | [
"async",
"def",
"test_mqtt_setup",
"(",
"hass",
",",
"mqtt_mock",
")",
"->",
"None",
":",
"discovery_info",
"=",
"Message",
"(",
"\"\"",
",",
"\"\"",
",",
"0",
",",
"False",
",",
"subscribed_topic",
"=",
"\"custom_prefix/123/#\"",
")",
"result",
"=",
"await"... | [
28,
0
] | [
41,
5
] | python | en | ['en', 'en', 'en'] | True |
test_user_setup | (hass, mqtt_mock) | Test we can finish a config flow. | Test we can finish a config flow. | async def test_user_setup(hass, mqtt_mock):
"""Test we can finish a config flow."""
result = await hass.config_entries.flow.async_init(
"tasmota", context={"source": "user"}
)
assert result["type"] == "form"
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
... | [
"async",
"def",
"test_user_setup",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"\"tasmota\"",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\"",
"}",
")",
"asser... | [
44,
0
] | [
56,
5
] | python | en | ['en', 'en', 'en'] | True |
test_user_setup_advanced | (hass, mqtt_mock) | Test we can finish a config flow. | Test we can finish a config flow. | async def test_user_setup_advanced(hass, mqtt_mock):
"""Test we can finish a config flow."""
result = await hass.config_entries.flow.async_init(
"tasmota", context={"source": "user", "show_advanced_options": True}
)
assert result["type"] == "form"
result = await hass.config_entries.flow.asy... | [
"async",
"def",
"test_user_setup_advanced",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"\"tasmota\"",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\"",
",",
"\"s... | [
59,
0
] | [
73,
5
] | python | en | ['en', 'en', 'en'] | True |
test_user_setup_advanced_strip_wildcard | (hass, mqtt_mock) | Test we can finish a config flow. | Test we can finish a config flow. | async def test_user_setup_advanced_strip_wildcard(hass, mqtt_mock):
"""Test we can finish a config flow."""
result = await hass.config_entries.flow.async_init(
"tasmota", context={"source": "user", "show_advanced_options": True}
)
assert result["type"] == "form"
result = await hass.config_e... | [
"async",
"def",
"test_user_setup_advanced_strip_wildcard",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"\"tasmota\"",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\""... | [
76,
0
] | [
90,
5
] | python | en | ['en', 'en', 'en'] | True |
test_user_setup_invalid_topic_prefix | (hass, mqtt_mock) | Test abort on invalid discovery topic. | Test abort on invalid discovery topic. | async def test_user_setup_invalid_topic_prefix(hass, mqtt_mock):
"""Test abort on invalid discovery topic."""
result = await hass.config_entries.flow.async_init(
"tasmota", context={"source": "user", "show_advanced_options": True}
)
assert result["type"] == "form"
result = await hass.config... | [
"async",
"def",
"test_user_setup_invalid_topic_prefix",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"\"tasmota\"",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\"",
... | [
93,
0
] | [
105,
64
] | python | en | ['en', 'en', 'en'] | True |
test_user_single_instance | (hass, mqtt_mock) | Test we only allow a single config flow. | Test we only allow a single config flow. | async def test_user_single_instance(hass, mqtt_mock):
"""Test we only allow a single config flow."""
MockConfigEntry(domain="tasmota").add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
"tasmota", context={"source": "user"}
)
assert result["type"] == "abort"
assert re... | [
"async",
"def",
"test_user_single_instance",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"\"tasmota\"",
")",
".",
"add_to_hass",
"(",
"hass",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"a... | [
108,
0
] | [
116,
56
] | python | en | ['en', 'en', 'en'] | True |
setup | (hass, config) | Set up the IDTECK proximity card component. | Set up the IDTECK proximity card component. | def setup(hass, config):
"""Set up the IDTECK proximity card component."""
conf = config[DOMAIN]
for unit in conf:
host = unit[CONF_HOST]
port = unit[CONF_PORT]
name = unit[CONF_NAME]
try:
reader = IdteckReader(hass, host, port, name)
reader.connect()... | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"for",
"unit",
"in",
"conf",
":",
"host",
"=",
"unit",
"[",
"CONF_HOST",
"]",
"port",
"=",
"unit",
"[",
"CONF_PORT",
"]",
"name",
"=",
"unit",
"[",
"... | [
39,
0
] | [
55,
15
] | python | en | ['en', 'en', 'en'] | True |
IdteckReader.__init__ | (self, hass, host, port, name) | Initialize the reader. | Initialize the reader. | def __init__(self, hass, host, port, name):
"""Initialize the reader."""
self.hass = hass
self._host = host
self._port = port
self._name = name
self._connection = None | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"host",
",",
"port",
",",
"name",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"_host",
"=",
"host",
"self",
".",
"_port",
"=",
"port",
"self",
".",
"_name",
"=",
"name",
"self",
".",
... | [
61,
4
] | [
67,
31
] | python | en | ['en', 'en', 'en'] | True |
IdteckReader.connect | (self) | Connect to the reader. | Connect to the reader. | def connect(self):
"""Connect to the reader."""
self._connection = rfk101py(self._host, self._port, self._callback) | [
"def",
"connect",
"(",
"self",
")",
":",
"self",
".",
"_connection",
"=",
"rfk101py",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_callback",
")"
] | [
69,
4
] | [
72,
75
] | python | en | ['en', 'en', 'en'] | True |
IdteckReader._callback | (self, card) | Send a keycard event message into Home Assistant whenever a card is read. | Send a keycard event message into Home Assistant whenever a card is read. | def _callback(self, card):
"""Send a keycard event message into Home Assistant whenever a card is read."""
self.hass.bus.fire(
EVENT_IDTECK_PROX_KEYCARD, {"card": card, "name": self._name}
) | [
"def",
"_callback",
"(",
"self",
",",
"card",
")",
":",
"self",
".",
"hass",
".",
"bus",
".",
"fire",
"(",
"EVENT_IDTECK_PROX_KEYCARD",
",",
"{",
"\"card\"",
":",
"card",
",",
"\"name\"",
":",
"self",
".",
"_name",
"}",
")"
] | [
74,
4
] | [
78,
9
] | python | en | ['en', 'en', 'en'] | True |
IdteckReader.stop | (self) | Close resources. | Close resources. | def stop(self):
"""Close resources."""
if self._connection:
self._connection.close()
self._connection = None | [
"def",
"stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"_connection",
":",
"self",
".",
"_connection",
".",
"close",
"(",
")",
"self",
".",
"_connection",
"=",
"None"
] | [
80,
4
] | [
84,
35
] | python | en | ['en', 'la', 'en'] | False |
TestFrame.test_node_number | (self) | Test if node number same as defined | Test if node number same as defined | def test_node_number(self):
"""Test if node number same as defined"""
for backend_name in backends_to_test:
frame = build_frame(backend_name=backend_name)
self.assertEqual(STATIC_NODE_NUM, len(
frame.static_nodes), backend_name)
self.assertEqual(DYNAM... | [
"def",
"test_node_number",
"(",
"self",
")",
":",
"for",
"backend_name",
"in",
"backends_to_test",
":",
"frame",
"=",
"build_frame",
"(",
"backend_name",
"=",
"backend_name",
")",
"self",
".",
"assertEqual",
"(",
"STATIC_NODE_NUM",
",",
"len",
"(",
"frame",
".... | [
50,
4
] | [
58,
51
] | python | da | ['pt', 'da', 'en'] | False |
TestFrame.test_node_accessing | (self) | Test node accessing correct | Test node accessing correct | def test_node_accessing(self):
"""Test node accessing correct"""
for backend_name in backends_to_test:
frame = build_frame(backend_name=backend_name)
# accessing for 1st node for both static and dynamic node
static_node: StaticNode = frame.static_nodes[0]
... | [
"def",
"test_node_accessing",
"(",
"self",
")",
":",
"for",
"backend_name",
"in",
"backends_to_test",
":",
"frame",
"=",
"build_frame",
"(",
"backend_name",
"=",
"backend_name",
")",
"# accessing for 1st node for both static and dynamic node",
"static_node",
":",
"StaticN... | [
60,
4
] | [
109,
73
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Bravia TV component. | Set up the Bravia TV component. | async def async_setup(hass, config):
"""Set up the Bravia TV component."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"return",
"True"
] | [
12,
0
] | [
14,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry) | Set up a config entry. | Set up a config entry. | async def async_setup_entry(hass, config_entry):
"""Set up a config entry."""
host = config_entry.data[CONF_HOST]
mac = config_entry.data[CONF_MAC]
undo_listener = config_entry.add_update_listener(update_listener)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][config_entry.entry_id] = {
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"host",
"=",
"config_entry",
".",
"data",
"[",
"CONF_HOST",
"]",
"mac",
"=",
"config_entry",
".",
"data",
"[",
"CONF_MAC",
"]",
"undo_listener",
"=",
"config_entry",
".",
"add_u... | [
17,
0
] | [
35,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, config_entry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, config_entry):
"""Unload a config entry."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
]
)
)
hass.... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"config_entry",
",",
"compo... | [
38,
0
] | [
54,
20
] | python | en | ['en', 'es', 'en'] | True |
update_listener | (hass, config_entry) | Handle options update. | Handle options update. | async def update_listener(hass, config_entry):
"""Handle options update."""
await hass.config_entries.async_reload(config_entry.entry_id) | [
"async",
"def",
"update_listener",
"(",
"hass",
",",
"config_entry",
")",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_reload",
"(",
"config_entry",
".",
"entry_id",
")"
] | [
57,
0
] | [
59,
65
] | python | en | ['en', 'nl', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Dovado sensor platform. | Set up the Dovado sensor platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Dovado sensor platform."""
dovado = hass.data[DOVADO_DOMAIN]
entities = []
for sensor in config[CONF_SENSORS]:
entities.append(DovadoSensor(dovado, sensor))
add_entities(entities) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"dovado",
"=",
"hass",
".",
"data",
"[",
"DOVADO_DOMAIN",
"]",
"entities",
"=",
"[",
"]",
"for",
"sensor",
"in",
"config",
"[",
"CONF_... | [
44,
0
] | [
52,
26
] | python | en | ['en', 'pt', 'en'] | True |
DovadoSensor.__init__ | (self, data, sensor) | Initialize the sensor. | Initialize the sensor. | def __init__(self, data, sensor):
"""Initialize the sensor."""
self._data = data
self._sensor = sensor
self._state = self._compute_state() | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"sensor",
")",
":",
"self",
".",
"_data",
"=",
"data",
"self",
".",
"_sensor",
"=",
"sensor",
"self",
".",
"_state",
"=",
"self",
".",
"_compute_state",
"(",
")"
] | [
58,
4
] | [
62,
43
] | python | en | ['en', 'en', 'en'] | True |
DovadoSensor._compute_state | (self) | Compute the state of the sensor. | Compute the state of the sensor. | def _compute_state(self):
"""Compute the state of the sensor."""
state = self._data.state.get(SENSORS[self._sensor][0])
if self._sensor == SENSOR_NETWORK:
match = re.search(r"\((.+)\)", state)
return match.group(1) if match else None
if self._sensor == SENSOR_SIGN... | [
"def",
"_compute_state",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"_data",
".",
"state",
".",
"get",
"(",
"SENSORS",
"[",
"self",
".",
"_sensor",
"]",
"[",
"0",
"]",
")",
"if",
"self",
".",
"_sensor",
"==",
"SENSOR_NETWORK",
":",
"match",
... | [
64,
4
] | [
79,
20
] | python | en | ['en', 'en', 'en'] | True |
DovadoSensor.update | (self) | Update sensor values. | Update sensor values. | def update(self):
"""Update sensor values."""
self._data.update()
self._state = self._compute_state() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_data",
".",
"update",
"(",
")",
"self",
".",
"_state",
"=",
"self",
".",
"_compute_state",
"(",
")"
] | [
81,
4
] | [
84,
43
] | python | en | ['en', 'nl', 'en'] | True |
DovadoSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return f"{self._data.name} {SENSORS[self._sensor][1]}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self._data.name} {SENSORS[self._sensor][1]}\""
] | [
87,
4
] | [
89,
62
] | python | en | ['en', 'mi', 'en'] | True |
DovadoSensor.state | (self) | Return the sensor state. | Return the sensor state. | def state(self):
"""Return the sensor state."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
92,
4
] | [
94,
26
] | python | en | ['en', 'bs', 'en'] | True |
DovadoSensor.icon | (self) | Return the icon for the sensor. | Return the icon for the sensor. | def icon(self):
"""Return the icon for the sensor."""
return SENSORS[self._sensor][3] | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"SENSORS",
"[",
"self",
".",
"_sensor",
"]",
"[",
"3",
"]"
] | [
97,
4
] | [
99,
39
] | python | en | ['en', 'en', 'en'] | True |
DovadoSensor.unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def unit_of_measurement(self):
"""Return the unit of measurement."""
return SENSORS[self._sensor][2] | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"SENSORS",
"[",
"self",
".",
"_sensor",
"]",
"[",
"2",
"]"
] | [
102,
4
] | [
104,
39
] | python | en | ['en', 'la', 'en'] | True |
DovadoSensor.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
return {k: v for k, v in self._data.state.items() if k not in ["date", "time"]} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_data",
".",
"state",
".",
"items",
"(",
")",
"if",
"k",
"not",
"in",
"[",
"\"date\"",
",",
"\"time\"",
"]",
"}"
] | [
107,
4
] | [
109,
87
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up cover(s) for Slide platform. | Set up cover(s) for Slide platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up cover(s) for Slide platform."""
if discovery_info is None:
return
entities = []
for slide in hass.data[DOMAIN][SLIDES].values():
_LOGGER.debug("Setting up Slide entity: %s", slide)
... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"entities",
"=",
"[",
"]",
"for",
"slide",
"in",
"hass",
".",
... | [
19,
0
] | [
31,
32
] | python | en | ['en', 'da', 'en'] | True |
SlideCover.__init__ | (self, api, slide) | Initialize the cover. | Initialize the cover. | def __init__(self, api, slide):
"""Initialize the cover."""
self._api = api
self._slide = slide
self._id = slide["id"]
self._unique_id = slide["mac"]
self._name = slide["name"]
self._invert = slide["invert"] | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"slide",
")",
":",
"self",
".",
"_api",
"=",
"api",
"self",
".",
"_slide",
"=",
"slide",
"self",
".",
"_id",
"=",
"slide",
"[",
"\"id\"",
"]",
"self",
".",
"_unique_id",
"=",
"slide",
"[",
"\"mac\"",... | [
37,
4
] | [
44,
38
] | python | en | ['en', 'en', 'en'] | True |
SlideCover.unique_id | (self) | Return the device unique id. | Return the device unique id. | def unique_id(self):
"""Return the device unique id."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
47,
4
] | [
49,
30
] | python | en | ['en', 'it', 'en'] | True |
SlideCover.name | (self) | Return the device name. | Return the device name. | def name(self):
"""Return the device name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
52,
4
] | [
54,
25
] | 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.