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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
LifxCloudScene.__init__ | (self, hass, headers, timeout, scene_data) | Initialize the scene. | Initialize the scene. | def __init__(self, hass, headers, timeout, scene_data):
"""Initialize the scene."""
self.hass = hass
self._headers = headers
self._timeout = timeout
self._name = scene_data["name"]
self._uuid = scene_data["uuid"] | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"headers",
",",
"timeout",
",",
"scene_data",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"_headers",
"=",
"headers",
"self",
".",
"_timeout",
"=",
"timeout",
"self",
".",
"_name",
"=",
"... | [
69,
4
] | [
75,
39
] | python | en | ['en', 'it', 'en'] | True |
LifxCloudScene.name | (self) | Return the name of the scene. | Return the name of the scene. | def name(self):
"""Return the name of the scene."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
78,
4
] | [
80,
25
] | python | en | ['en', 'ig', 'en'] | True |
LifxCloudScene.async_activate | (self, **kwargs: Any) | Activate the scene. | Activate the scene. | async def async_activate(self, **kwargs: Any) -> None:
"""Activate the scene."""
url = f"https://api.lifx.com/v1/scenes/scene_id:{self._uuid}/activate"
try:
httpsession = async_get_clientsession(self.hass)
with async_timeout.timeout(self._timeout):
await ... | [
"async",
"def",
"async_activate",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"url",
"=",
"f\"https://api.lifx.com/v1/scenes/scene_id:{self._uuid}/activate\"",
"try",
":",
"httpsession",
"=",
"async_get_clientsession",
"(",
"self",
".",... | [
82,
4
] | [
92,
49
] | python | en | ['en', 'it', 'en'] | True |
async_setup | (hass: HomeAssistant, config: dict) | Set up by configuration file. | Set up by configuration file. | async def async_setup(hass: HomeAssistant, config: dict):
"""Set up by configuration file."""
if DOMAIN not in config:
return True
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_IMPORT},
data=config[DOMAIN],... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"if",
"DOMAIN",
"not",
"in",
"config",
":",
"return",
"True",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"flow",
".",
... | [
31,
0
] | [
44,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up upon config entry in user interface. | Set up upon config entry in user interface. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up upon config entry in user interface."""
hass.data.setdefault(DOMAIN, {})
conf = entry.data
username = conf[CONF_USERNAME]
password = conf[CONF_PASSWORD]
client = await hass.async_add_executor_job(
TotalConn... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"conf",
"=",
"entry",
".",
"data",
"username",
"=",
"conf",
"... | [
47,
0
] | [
70,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)
if unload... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"entry",
","... | [
73,
0
] | [
86,
20
] | python | en | ['en', 'es', 'en'] | True |
test_setup_no_config | (hass) | Test setup without configuration. | Test setup without configuration. | async def test_setup_no_config(hass):
"""Test setup without configuration."""
assert await async_setup_component(hass, AXIS_DOMAIN, {})
assert AXIS_DOMAIN not in hass.data | [
"async",
"def",
"test_setup_no_config",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"AXIS_DOMAIN",
",",
"{",
"}",
")",
"assert",
"AXIS_DOMAIN",
"not",
"in",
"hass",
".",
"data"
] | [
20,
0
] | [
23,
39
] | python | en | ['en', 'zu', 'en'] | True |
test_setup_entry | (hass) | Test successful setup of entry. | Test successful setup of entry. | async def test_setup_entry(hass):
"""Test successful setup of entry."""
await setup_axis_integration(hass)
assert len(hass.data[AXIS_DOMAIN]) == 1
assert MAC in hass.data[AXIS_DOMAIN] | [
"async",
"def",
"test_setup_entry",
"(",
"hass",
")",
":",
"await",
"setup_axis_integration",
"(",
"hass",
")",
"assert",
"len",
"(",
"hass",
".",
"data",
"[",
"AXIS_DOMAIN",
"]",
")",
"==",
"1",
"assert",
"MAC",
"in",
"hass",
".",
"data",
"[",
"AXIS_DOM... | [
26,
0
] | [
30,
40
] | python | en | ['en', 'en', 'en'] | True |
test_setup_entry_fails | (hass) | Test successful setup of entry. | Test successful setup of entry. | async def test_setup_entry_fails(hass):
"""Test successful setup of entry."""
config_entry = MockConfigEntry(
domain=AXIS_DOMAIN, data={CONF_MAC: "0123"}, version=2
)
config_entry.add_to_hass(hass)
mock_device = Mock()
mock_device.async_setup = AsyncMock(return_value=False)
with pa... | [
"async",
"def",
"test_setup_entry_fails",
"(",
"hass",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"AXIS_DOMAIN",
",",
"data",
"=",
"{",
"CONF_MAC",
":",
"\"0123\"",
"}",
",",
"version",
"=",
"2",
")",
"config_entry",
".",
"add_to_h... | [
33,
0
] | [
48,
37
] | python | en | ['en', 'en', 'en'] | True |
test_unload_entry | (hass) | Test successful unload of entry. | Test successful unload of entry. | async def test_unload_entry(hass):
"""Test successful unload of entry."""
config_entry = await setup_axis_integration(hass)
device = hass.data[AXIS_DOMAIN][config_entry.unique_id]
assert hass.data[AXIS_DOMAIN]
assert await hass.config_entries.async_unload(device.config_entry.entry_id)
assert no... | [
"async",
"def",
"test_unload_entry",
"(",
"hass",
")",
":",
"config_entry",
"=",
"await",
"setup_axis_integration",
"(",
"hass",
")",
"device",
"=",
"hass",
".",
"data",
"[",
"AXIS_DOMAIN",
"]",
"[",
"config_entry",
".",
"unique_id",
"]",
"assert",
"hass",
"... | [
51,
0
] | [
58,
37
] | python | en | ['en', 'en', 'en'] | True |
test_migrate_entry | (hass) | Test successful migration of entry data. | Test successful migration of entry data. | async def test_migrate_entry(hass):
"""Test successful migration of entry data."""
legacy_config = {
CONF_DEVICE: {
CONF_HOST: "1.2.3.4",
CONF_USERNAME: "username",
CONF_PASSWORD: "password",
CONF_PORT: 80,
},
CONF_MAC: "mac",
CONF_... | [
"async",
"def",
"test_migrate_entry",
"(",
"hass",
")",
":",
"legacy_config",
"=",
"{",
"CONF_DEVICE",
":",
"{",
"CONF_HOST",
":",
"\"1.2.3.4\"",
",",
"CONF_USERNAME",
":",
"\"username\"",
",",
"CONF_PASSWORD",
":",
"\"password\"",
",",
"CONF_PORT",
":",
"80",
... | [
61,
0
] | [
96,
29
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the SCSGate switches. | Set up the SCSGate switches. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the SCSGate switches."""
devices = config.get(CONF_DEVICES)
lights = []
logger = logging.getLogger(__name__)
scsgate = hass.data[DOMAIN]
if devices:
for entity_info in devices.values():
if entity_... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"devices",
"=",
"config",
".",
"get",
"(",
"CONF_DEVICES",
")",
"lights",
"=",
"[",
"]",
"logger",
"=",
"logging",
".",
"getLogger",
"... | [
17,
0
] | [
40,
43
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.__init__ | (self, scs_id, name, logger, scsgate) | Initialize the light. | Initialize the light. | def __init__(self, scs_id, name, logger, scsgate):
"""Initialize the light."""
self._name = name
self._scs_id = scs_id
self._toggled = False
self._logger = logger
self._scsgate = scsgate | [
"def",
"__init__",
"(",
"self",
",",
"scs_id",
",",
"name",
",",
"logger",
",",
"scsgate",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_scs_id",
"=",
"scs_id",
"self",
".",
"_toggled",
"=",
"False",
"self",
".",
"_logger",
"=",
"logger... | [
46,
4
] | [
52,
31
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.scs_id | (self) | Return the SCS ID. | Return the SCS ID. | def scs_id(self):
"""Return the SCS ID."""
return self._scs_id | [
"def",
"scs_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_scs_id"
] | [
55,
4
] | [
57,
27
] | python | en | ['en', 'la', 'en'] | True |
SCSGateLight.should_poll | (self) | No polling needed for a SCSGate light. | No polling needed for a SCSGate light. | def should_poll(self):
"""No polling needed for a SCSGate light."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
60,
4
] | [
62,
20
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.name | (self) | Return the name of the device if any. | Return the name of the device if any. | def name(self):
"""Return the name of the device if any."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
65,
4
] | [
67,
25
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.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._toggled | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_toggled"
] | [
70,
4
] | [
72,
28
] | python | en | ['en', 'et', 'en'] | True |
SCSGateLight.turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | def turn_on(self, **kwargs):
"""Turn the device on."""
self._scsgate.append_task(ToggleStatusTask(target=self._scs_id, toggled=True))
self._toggled = True
self.schedule_update_ha_state() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_scsgate",
".",
"append_task",
"(",
"ToggleStatusTask",
"(",
"target",
"=",
"self",
".",
"_scs_id",
",",
"toggled",
"=",
"True",
")",
")",
"self",
".",
"_toggled",
"=",
"... | [
74,
4
] | [
80,
39
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | def turn_off(self, **kwargs):
"""Turn the device off."""
self._scsgate.append_task(ToggleStatusTask(target=self._scs_id, toggled=False))
self._toggled = False
self.schedule_update_ha_state() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_scsgate",
".",
"append_task",
"(",
"ToggleStatusTask",
"(",
"target",
"=",
"self",
".",
"_scs_id",
",",
"toggled",
"=",
"False",
")",
")",
"self",
".",
"_toggled",
"=",
... | [
82,
4
] | [
88,
39
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.process_event | (self, message) | Handle a SCSGate message related with this light. | Handle a SCSGate message related with this light. | def process_event(self, message):
"""Handle a SCSGate message related with this light."""
if self._toggled == message.toggled:
self._logger.info(
"Light %s, ignoring message %s because state already active",
self._scs_id,
message,
)... | [
"def",
"process_event",
"(",
"self",
",",
"message",
")",
":",
"if",
"self",
".",
"_toggled",
"==",
"message",
".",
"toggled",
":",
"self",
".",
"_logger",
".",
"info",
"(",
"\"Light %s, ignoring message %s because state already active\"",
",",
"self",
".",
"_sc... | [
90,
4
] | [
110,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the OpenGarage covers. | Set up the OpenGarage covers. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the OpenGarage covers."""
covers = []
devices = config.get(CONF_COVERS)
for device_config in devices.values():
opengarage_url = (
f"{'https' if device_config[CONF_SSL] else 'http'}://"
... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"covers",
"=",
"[",
"]",
"devices",
"=",
"config",
".",
"get",
"(",
"CONF_COVERS",
")",
"for",
"device_config",
"in",... | [
58,
0
] | [
82,
36
] | python | en | ['en', 'en', 'en'] | True |
OpenGarageCover.__init__ | (self, name, open_garage, device_id) | Initialize the cover. | Initialize the cover. | def __init__(self, name, open_garage, device_id):
"""Initialize the cover."""
self._name = name
self._open_garage = open_garage
self._state = None
self._state_before_move = None
self._device_state_attributes = {}
self._available = True
self._device_id = de... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"open_garage",
",",
"device_id",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_open_garage",
"=",
"open_garage",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_state_before_move",
"=",
"... | [
88,
4
] | [
96,
35
] | python | en | ['en', 'en', 'en'] | True |
OpenGarageCover.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"
] | [
99,
4
] | [
101,
25
] | python | en | ['en', 'en', 'en'] | True |
OpenGarageCover.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self):
"""Return True if entity is available."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
104,
4
] | [
106,
30
] | python | en | ['en', 'en', 'en'] | True |
OpenGarageCover.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
return self._device_state_attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_state_attributes"
] | [
109,
4
] | [
111,
44
] | python | en | ['en', 'en', 'en'] | True |
OpenGarageCover.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."""
if self._state is None:
return None
return self._state in [STATE_CLOSED, STATE_OPENING] | [
"def",
"is_closed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_state",
"in",
"[",
"STATE_CLOSED",
",",
"STATE_OPENING",
"]"
] | [
114,
4
] | [
118,
59
] | python | en | ['en', 'en', 'en'] | True |
OpenGarageCover.async_close_cover | (self, **kwargs) | Close the cover. | Close the cover. | async def async_close_cover(self, **kwargs):
"""Close the cover."""
if self._state in [STATE_CLOSED, STATE_CLOSING]:
return
self._state_before_move = self._state
self._state = STATE_CLOSING
await self._push_button() | [
"async",
"def",
"async_close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_state",
"in",
"[",
"STATE_CLOSED",
",",
"STATE_CLOSING",
"]",
":",
"return",
"self",
".",
"_state_before_move",
"=",
"self",
".",
"_state",
"self",
... | [
120,
4
] | [
126,
33
] | python | en | ['en', 'en', 'en'] | True |
OpenGarageCover.async_open_cover | (self, **kwargs) | Open the cover. | Open the cover. | async def async_open_cover(self, **kwargs):
"""Open the cover."""
if self._state in [STATE_OPEN, STATE_OPENING]:
return
self._state_before_move = self._state
self._state = STATE_OPENING
await self._push_button() | [
"async",
"def",
"async_open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_state",
"in",
"[",
"STATE_OPEN",
",",
"STATE_OPENING",
"]",
":",
"return",
"self",
".",
"_state_before_move",
"=",
"self",
".",
"_state",
"self",
"."... | [
128,
4
] | [
134,
33
] | python | en | ['en', 'en', 'en'] | True |
OpenGarageCover.async_update | (self) | Get updated status from API. | Get updated status from API. | async def async_update(self):
"""Get updated status from API."""
status = await self._open_garage.update_state()
if status is None:
_LOGGER.error("Unable to connect to OpenGarage device")
self._available = False
return
if self._name is None and status... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"status",
"=",
"await",
"self",
".",
"_open_garage",
".",
"update_state",
"(",
")",
"if",
"status",
"is",
"None",
":",
"_LOGGER",
".",
"error",
"(",
"\"Unable to connect to OpenGarage device\"",
")",
"self... | [
136,
4
] | [
162,
30
] | python | en | ['en', 'en', 'en'] | True |
OpenGarageCover._push_button | (self) | Send commands to API. | Send commands to API. | async def _push_button(self):
"""Send commands to API."""
result = await self._open_garage.push_button()
if result is None:
_LOGGER.error("Unable to connect to OpenGarage device")
if result == 1:
return
if result == 2:
_LOGGER.error("Unable to... | [
"async",
"def",
"_push_button",
"(",
"self",
")",
":",
"result",
"=",
"await",
"self",
".",
"_open_garage",
".",
"push_button",
"(",
")",
"if",
"result",
"is",
"None",
":",
"_LOGGER",
".",
"error",
"(",
"\"Unable to connect to OpenGarage device\"",
")",
"if",
... | [
164,
4
] | [
178,
38
] | python | en | ['en', 'pt', 'en'] | True |
OpenGarageCover.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_GARAGE | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_GARAGE"
] | [
181,
4
] | [
183,
34
] | python | en | ['en', 'en', 'en'] | True |
OpenGarageCover.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_OPEN | SUPPORT_CLOSE | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_OPEN",
"|",
"SUPPORT_CLOSE"
] | [
186,
4
] | [
188,
43
] | python | en | ['da', 'en', 'en'] | True |
OpenGarageCover.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return self._device_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_id"
] | [
191,
4
] | [
193,
30
] | python | ca | ['fr', 'ca', 'en'] | False |
ping_client | () | Define a patched client that returns a successful ping response. | Define a patched client that returns a successful ping response. | def ping_client():
"""Define a patched client that returns a successful ping response."""
with patch(
"homeassistant.components.guardian.async_setup_entry", return_value=True
), patch("aioguardian.client.Client.connect"), patch(
"aioguardian.commands.system.SystemCommands.ping",
retu... | [
"def",
"ping_client",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.guardian.async_setup_entry\"",
",",
"return_value",
"=",
"True",
")",
",",
"patch",
"(",
"\"aioguardian.client.Client.connect\"",
")",
",",
"patch",
"(",
"\"aioguardian.commands.system.... | [
7,
0
] | [
17,
13
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up ecobee (temperature and humidity) sensors. | Set up ecobee (temperature and humidity) sensors. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up ecobee (temperature and humidity) sensors."""
data = hass.data[DOMAIN]
dev = []
for index in range(len(data.ecobee.thermostats)):
for sensor in data.ecobee.get_remote_sensors(index):
for item in sensor["ca... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"dev",
"=",
"[",
"]",
"for",
"index",
"in",
"range",
"(",
"len",
"(",
"data",
".",
"ecobee... | [
19,
0
] | [
31,
33
] | python | en | ['en', 'en', 'en'] | True |
EcobeeSensor.__init__ | (self, data, sensor_name, sensor_type, sensor_index) | Initialize the sensor. | Initialize the sensor. | def __init__(self, data, sensor_name, sensor_type, sensor_index):
"""Initialize the sensor."""
self.data = data
self._name = f"{sensor_name} {SENSOR_TYPES[sensor_type][0]}"
self.sensor_name = sensor_name
self.type = sensor_type
self.index = sensor_index
self._stat... | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"sensor_name",
",",
"sensor_type",
",",
"sensor_index",
")",
":",
"self",
".",
"data",
"=",
"data",
"self",
".",
"_name",
"=",
"f\"{sensor_name} {SENSOR_TYPES[sensor_type][0]}\"",
"self",
".",
"sensor_name",
"=",... | [
37,
4
] | [
45,
64
] | python | en | ['en', 'en', 'en'] | True |
EcobeeSensor.name | (self) | Return the name of the Ecobee sensor. | Return the name of the Ecobee sensor. | def name(self):
"""Return the name of the Ecobee sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
48,
4
] | [
50,
25
] | python | en | ['en', 'mi', 'en'] | True |
EcobeeSensor.unique_id | (self) | Return a unique identifier for this sensor. | Return a unique identifier for this sensor. | def unique_id(self):
"""Return a unique identifier for this sensor."""
for sensor in self.data.ecobee.get_remote_sensors(self.index):
if sensor["name"] == self.sensor_name:
if "code" in sensor:
return f"{sensor['code']}-{self.device_class}"
... | [
"def",
"unique_id",
"(",
"self",
")",
":",
"for",
"sensor",
"in",
"self",
".",
"data",
".",
"ecobee",
".",
"get_remote_sensors",
"(",
"self",
".",
"index",
")",
":",
"if",
"sensor",
"[",
"\"name\"",
"]",
"==",
"self",
".",
"sensor_name",
":",
"if",
"... | [
53,
4
] | [
60,
87
] | python | en | ['en', 'fr', 'en'] | True |
EcobeeSensor.device_info | (self) | Return device information for this sensor. | Return device information for this sensor. | def device_info(self):
"""Return device information for this sensor."""
identifier = None
model = None
for sensor in self.data.ecobee.get_remote_sensors(self.index):
if sensor["name"] != self.sensor_name:
continue
if "code" in sensor:
... | [
"def",
"device_info",
"(",
"self",
")",
":",
"identifier",
"=",
"None",
"model",
"=",
"None",
"for",
"sensor",
"in",
"self",
".",
"data",
".",
"ecobee",
".",
"get_remote_sensors",
"(",
"self",
".",
"index",
")",
":",
"if",
"sensor",
"[",
"\"name\"",
"]... | [
63,
4
] | [
98,
19
] | python | en | ['en', 'en', 'en'] | True |
EcobeeSensor.device_class | (self) | Return the device class of the sensor. | Return the device class of the sensor. | def device_class(self):
"""Return the device class of the sensor."""
if self.type in (DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE):
return self.type
return None | [
"def",
"device_class",
"(",
"self",
")",
":",
"if",
"self",
".",
"type",
"in",
"(",
"DEVICE_CLASS_HUMIDITY",
",",
"DEVICE_CLASS_TEMPERATURE",
")",
":",
"return",
"self",
".",
"type",
"return",
"None"
] | [
101,
4
] | [
105,
19
] | python | en | ['en', 'en', 'en'] | True |
EcobeeSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
if self._state in [
ECOBEE_STATE_CALIBRATING,
ECOBEE_STATE_UNKNOWN,
"unknown",
]:
return None
if self.type == "temperature":
return float(self._state) / 10
return ... | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
"in",
"[",
"ECOBEE_STATE_CALIBRATING",
",",
"ECOBEE_STATE_UNKNOWN",
",",
"\"unknown\"",
",",
"]",
":",
"return",
"None",
"if",
"self",
".",
"type",
"==",
"\"temperature\"",
":",
"return",
... | [
108,
4
] | [
120,
26
] | python | en | ['en', 'en', 'en'] | True |
EcobeeSensor.unit_of_measurement | (self) | Return the unit of measurement this sensor expresses itself in. | Return the unit of measurement this sensor expresses itself in. | def unit_of_measurement(self):
"""Return the unit of measurement this sensor expresses itself in."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
123,
4
] | [
125,
40
] | python | en | ['en', 'en', 'en'] | True |
EcobeeSensor.async_update | (self) | Get the latest state of the sensor. | Get the latest state of the sensor. | async def async_update(self):
"""Get the latest state of the sensor."""
await self.data.update()
for sensor in self.data.ecobee.get_remote_sensors(self.index):
if sensor["name"] != self.sensor_name:
continue
for item in sensor["capability"]:
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"data",
".",
"update",
"(",
")",
"for",
"sensor",
"in",
"self",
".",
"data",
".",
"ecobee",
".",
"get_remote_sensors",
"(",
"self",
".",
"index",
")",
":",
"if",
"sensor",
"... | [
127,
4
] | [
137,
21
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the SleepIQ sensors. | Set up the SleepIQ sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the SleepIQ sensors."""
if discovery_info is None:
return
data = hass.data[DOMAIN]
data.update()
dev = []
for bed_id, bed in data.beds.items():
for side in SIDES:
if getattr(bed, side) is... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"data",
".",
"update",
"(",... | [
10,
0
] | [
23,
21
] | python | en | ['en', 'bg', 'en'] | True |
IsInBedBinarySensor.__init__ | (self, sleepiq_data, bed_id, side) | Initialize the sensor. | Initialize the sensor. | def __init__(self, sleepiq_data, bed_id, side):
"""Initialize the sensor."""
super().__init__(sleepiq_data, bed_id, side)
self._state = None
self._name = SENSOR_TYPES[IS_IN_BED]
self.update() | [
"def",
"__init__",
"(",
"self",
",",
"sleepiq_data",
",",
"bed_id",
",",
"side",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"sleepiq_data",
",",
"bed_id",
",",
"side",
")",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_name",
"=",
"SENSO... | [
29,
4
] | [
34,
21
] | python | en | ['en', 'en', 'en'] | True |
IsInBedBinarySensor.is_on | (self) | Return the status of the sensor. | Return the status of the sensor. | def is_on(self):
"""Return the status of the sensor."""
return self._state is True | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"is",
"True"
] | [
37,
4
] | [
39,
34
] | python | en | ['en', 'id', 'en'] | True |
IsInBedBinarySensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self):
"""Return the class of this sensor."""
return DEVICE_CLASS_OCCUPANCY | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_OCCUPANCY"
] | [
42,
4
] | [
44,
37
] | python | en | ['en', 'en', 'en'] | True |
IsInBedBinarySensor.update | (self) | Get the latest data from SleepIQ and updates the states. | Get the latest data from SleepIQ and updates the states. | def update(self):
"""Get the latest data from SleepIQ and updates the states."""
super().update()
self._state = self.side.is_in_bed | [
"def",
"update",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"update",
"(",
")",
"self",
".",
"_state",
"=",
"self",
".",
"side",
".",
"is_in_bed"
] | [
46,
4
] | [
49,
41
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Defer binary sensor setup to the shared sensor module. | Defer binary sensor setup to the shared sensor module. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Defer binary sensor setup to the shared sensor module."""
await hass.data[HUE_DOMAIN][
config_entry.entry_id
].sensor_manager.async_register_component("binary_sensor", async_add_entities) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"await",
"hass",
".",
"data",
"[",
"HUE_DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
".",
"sensor_manager",
".",
"async_register_component",
"... | [
15,
0
] | [
19,
82
] | python | en | ['en', 'haw', 'en'] | True |
HuePresence.is_on | (self) | Return true if the binary sensor is on. | Return true if the binary sensor is on. | def is_on(self):
"""Return true if the binary sensor is on."""
return self.sensor.presence | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"sensor",
".",
"presence"
] | [
28,
4
] | [
30,
35
] | python | en | ['en', 'fy', 'en'] | True |
HuePresence.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
attributes = super().device_state_attributes
if "sensitivity" in self.sensor.config:
attributes["sensitivity"] = self.sensor.config["sensitivity"]
if "sensitivitymax" in self.sensor.config:
... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"attributes",
"=",
"super",
"(",
")",
".",
"device_state_attributes",
"if",
"\"sensitivity\"",
"in",
"self",
".",
"sensor",
".",
"config",
":",
"attributes",
"[",
"\"sensitivity\"",
"]",
"=",
"self",
"."... | [
33,
4
] | [
40,
25
] | python | en | ['en', 'en', 'en'] | True |
_generate_mock_feed_entry | (
external_id,
title,
distance_to_home,
coordinates,
place=None,
attribution=None,
time=None,
updated=None,
magnitude=None,
status=None,
entry_type=None,
alert=None,
) | Construct a mock feed entry for testing purposes. | Construct a mock feed entry for testing purposes. | def _generate_mock_feed_entry(
external_id,
title,
distance_to_home,
coordinates,
place=None,
attribution=None,
time=None,
updated=None,
magnitude=None,
status=None,
entry_type=None,
alert=None,
):
"""Construct a mock feed entry for testing purposes."""
feed_entry... | [
"def",
"_generate_mock_feed_entry",
"(",
"external_id",
",",
"title",
",",
"distance_to_home",
",",
"coordinates",
",",
"place",
"=",
"None",
",",
"attribution",
"=",
"None",
",",
"time",
"=",
"None",
",",
"updated",
"=",
"None",
",",
"magnitude",
"=",
"None... | [
59,
0
] | [
87,
21
] | python | en | ['en', 'en', 'en'] | True |
test_setup | (hass) | Test the general setup of the platform. | Test the general setup of the platform. | async def test_setup(hass):
"""Test the general setup of the platform."""
# Set up some mock feed entries for this test.
mock_entry_1 = _generate_mock_feed_entry(
"1234",
"Title 1",
15.5,
(-31.0, 150.0),
place="Location 1",
attribution="Attribution 1",
... | [
"async",
"def",
"test_setup",
"(",
"hass",
")",
":",
"# Set up some mock feed entries for this test.",
"mock_entry_1",
"=",
"_generate_mock_feed_entry",
"(",
"\"1234\"",
",",
"\"Title 1\"",
",",
"15.5",
",",
"(",
"-",
"31.0",
",",
"150.0",
")",
",",
"place",
"=",
... | [
90,
0
] | [
213,
39
] | python | en | ['en', 'da', 'en'] | True |
test_setup_with_custom_location | (hass) | Test the setup with a custom location. | Test the setup with a custom location. | async def test_setup_with_custom_location(hass):
"""Test the setup with a custom location."""
# Set up some mock feed entries for this test.
mock_entry_1 = _generate_mock_feed_entry("1234", "Title 1", 20.5, (-31.1, 150.1))
with patch(
"geojson_client.usgs_earthquake_hazards_program_feed."
... | [
"async",
"def",
"test_setup_with_custom_location",
"(",
"hass",
")",
":",
"# Set up some mock feed entries for this test.",
"mock_entry_1",
"=",
"_generate_mock_feed_entry",
"(",
"\"1234\"",
",",
"\"Title 1\"",
",",
"20.5",
",",
"(",
"-",
"31.1",
",",
"150.1",
")",
")... | [
216,
0
] | [
246,
13
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: dict) | Set up the zodiac component. | Set up the zodiac component. | async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the zodiac component."""
hass.async_create_task(async_load_platform(hass, "sensor", DOMAIN, {}, config))
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"hass",
".",
"async_create_task",
"(",
"async_load_platform",
"(",
"hass",
",",
"\"sensor\"",
",",
"DOMAIN",
",",
"{",
"}",
",",
"config",
")",
")",
"... | [
14,
0
] | [
18,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Platform setup, do nothing. | Platform setup, do nothing. | async def async_setup(hass, config):
"""Platform setup, do nothing."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"return",
"True"
] | [
20,
0
] | [
22,
15
] | python | en | ['en', 'zu', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Load the saved entities. | Load the saved entities. | async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Load the saved entities."""
host = entry.data[CONF_HOST]
port = entry.data[CONF_PORT]
coordinator = CertExpiryDataUpdateCoordinator(hass, host, port)
await coordinator.async_refresh()
if not coordinator.last_update_su... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"host",
"=",
"entry",
".",
"data",
"[",
"CONF_HOST",
"]",
"port",
"=",
"entry",
".",
"data",
"[",
"CONF_PORT",
"]",
"coordinator",
"=",
... | [
25,
0
] | [
45,
15
] | 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.config_entries.async_forward_entry_unload(entry, "sensor") | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"return",
"await",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"entry",
",",
"\"sensor\"",
")"
] | [
48,
0
] | [
50,
80
] | python | en | ['en', 'es', 'en'] | True |
CertExpiryDataUpdateCoordinator.__init__ | (self, hass, host, port) | Initialize global Cert Expiry data updater. | Initialize global Cert Expiry data updater. | def __init__(self, hass, host, port):
"""Initialize global Cert Expiry data updater."""
self.host = host
self.port = port
self.cert_error = None
self.is_cert_valid = False
display_port = f":{port}" if port != DEFAULT_PORT else ""
name = f"{self.host}{display_port... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"host",
",",
"port",
")",
":",
"self",
".",
"host",
"=",
"host",
"self",
".",
"port",
"=",
"port",
"self",
".",
"cert_error",
"=",
"None",
"self",
".",
"is_cert_valid",
"=",
"False",
"display_port",
"... | [
56,
4
] | [
71,
9
] | python | en | ['en', 'no', 'it'] | False |
CertExpiryDataUpdateCoordinator._async_update_data | (self) | Fetch certificate. | Fetch certificate. | async def _async_update_data(self) -> Optional[datetime]:
"""Fetch certificate."""
try:
timestamp = await get_cert_expiry_timestamp(self.hass, self.host, self.port)
except TemporaryFailure as err:
raise UpdateFailed(err.args[0]) from err
except ValidationFailure a... | [
"async",
"def",
"_async_update_data",
"(",
"self",
")",
"->",
"Optional",
"[",
"datetime",
"]",
":",
"try",
":",
"timestamp",
"=",
"await",
"get_cert_expiry_timestamp",
"(",
"self",
".",
"hass",
",",
"self",
".",
"host",
",",
"self",
".",
"port",
")",
"e... | [
73,
4
] | [
87,
24
] | python | en | ['en', 'co', 'en'] | False |
get_service | (hass, config, discovery_info=None) | Get the Join notification service. | Get the Join notification service. | def get_service(hass, config, discovery_info=None):
"""Get the Join notification service."""
api_key = config.get(CONF_API_KEY)
device_id = config.get(CONF_DEVICE_ID)
device_ids = config.get(CONF_DEVICE_IDS)
device_names = config.get(CONF_DEVICE_NAMES)
if api_key:
if not get_devices(api_... | [
"def",
"get_service",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"api_key",
"=",
"config",
".",
"get",
"(",
"CONF_API_KEY",
")",
"device_id",
"=",
"config",
".",
"get",
"(",
"CONF_DEVICE_ID",
")",
"device_ids",
"=",
"config",... | [
32,
0
] | [
48,
80
] | python | en | ['en', 'en', 'en'] | True |
JoinNotificationService.__init__ | (self, api_key, device_id, device_ids, device_names) | Initialize the service. | Initialize the service. | def __init__(self, api_key, device_id, device_ids, device_names):
"""Initialize the service."""
self._api_key = api_key
self._device_id = device_id
self._device_ids = device_ids
self._device_names = device_names | [
"def",
"__init__",
"(",
"self",
",",
"api_key",
",",
"device_id",
",",
"device_ids",
",",
"device_names",
")",
":",
"self",
".",
"_api_key",
"=",
"api_key",
"self",
".",
"_device_id",
"=",
"device_id",
"self",
".",
"_device_ids",
"=",
"device_ids",
"self",
... | [
54,
4
] | [
59,
41
] | python | en | ['en', 'en', 'en'] | True |
JoinNotificationService.send_message | (self, message="", **kwargs) | Send a message to a user. | Send a message to a user. | def send_message(self, message="", **kwargs):
"""Send a message to a user."""
title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
data = kwargs.get(ATTR_DATA) or {}
send_notification(
device_id=self._device_id,
device_ids=self._device_ids,
device_names... | [
"def",
"send_message",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"title",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TITLE",
",",
"ATTR_TITLE_DEFAULT",
")",
"data",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_DATA",
")",
"or",
... | [
61,
4
] | [
83,
9
] | python | en | ['en', 'en', 'en'] | True |
_async_reproduce_states | (
hass: HomeAssistantType,
state: State,
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) | Reproduce input boolean states. | Reproduce input boolean states. | async def _async_reproduce_states(
hass: HomeAssistantType,
state: State,
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce input boolean states."""
cur_state = hass.states.get(state.entity_id)
if cur_state is None:
... | [
"async",
"def",
"_async_reproduce_states",
"(",
"hass",
":",
"HomeAssistantType",
",",
"state",
":",
"State",
",",
"*",
",",
"context",
":",
"Optional",
"[",
"Context",
"]",
"=",
"None",
",",
"reproduce_options",
":",
"Optional",
"[",
"Dict",
"[",
"str",
"... | [
20,
0
] | [
51,
5
] | python | en | ['en', 'en', 'en'] | True |
async_reproduce_states | (
hass: HomeAssistantType,
states: Iterable[State],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) | Reproduce component states. | Reproduce component states. | async def async_reproduce_states(
hass: HomeAssistantType,
states: Iterable[State],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce component states."""
await asyncio.gather(
*(
_async_reproduce_states(
... | [
"async",
"def",
"async_reproduce_states",
"(",
"hass",
":",
"HomeAssistantType",
",",
"states",
":",
"Iterable",
"[",
"State",
"]",
",",
"*",
",",
"context",
":",
"Optional",
"[",
"Context",
"]",
"=",
"None",
",",
"reproduce_options",
":",
"Optional",
"[",
... | [
54,
0
] | [
69,
5
] | python | en | ['de', 'en', 'en'] | True |
mock_dummy_get_components_from_model_light | () | Mock a components list with light. | Mock a components list with light. | def mock_dummy_get_components_from_model_light():
"""Mock a components list with light."""
components = ["light"]
with patch(
"pywilight.get_components_from_model",
return_value=components,
):
yield components | [
"def",
"mock_dummy_get_components_from_model_light",
"(",
")",
":",
"components",
"=",
"[",
"\"light\"",
"]",
"with",
"patch",
"(",
"\"pywilight.get_components_from_model\"",
",",
"return_value",
"=",
"components",
",",
")",
":",
"yield",
"components"
] | [
34,
0
] | [
41,
24
] | python | en | ['en', 'en', 'en'] | True |
mock_dummy_device_from_host_light_fan | () | Mock a valid api_devce. | Mock a valid api_devce. | def mock_dummy_device_from_host_light_fan():
"""Mock a valid api_devce."""
device = pywilight.wilight_from_discovery(
f"http://{HOST}:45995/wilight.xml",
UPNP_MAC_ADDRESS,
UPNP_MODEL_NAME_LIGHT_FAN,
UPNP_SERIAL,
UPNP_MODEL_NUMBER,
)
device.set_dummy(True)
w... | [
"def",
"mock_dummy_device_from_host_light_fan",
"(",
")",
":",
"device",
"=",
"pywilight",
".",
"wilight_from_discovery",
"(",
"f\"http://{HOST}:45995/wilight.xml\"",
",",
"UPNP_MAC_ADDRESS",
",",
"UPNP_MODEL_NAME_LIGHT_FAN",
",",
"UPNP_SERIAL",
",",
"UPNP_MODEL_NUMBER",
",",... | [
45,
0
] | [
62,
20
] | python | en | ['en', 'ca', 'en'] | True |
mock_dummy_device_from_host_pb | () | Mock a valid api_devce. | Mock a valid api_devce. | def mock_dummy_device_from_host_pb():
"""Mock a valid api_devce."""
device = pywilight.wilight_from_discovery(
f"http://{HOST}:45995/wilight.xml",
UPNP_MAC_ADDRESS,
UPNP_MODEL_NAME_P_B,
UPNP_SERIAL,
UPNP_MODEL_NUMBER,
)
device.set_dummy(True)
with patch(
... | [
"def",
"mock_dummy_device_from_host_pb",
"(",
")",
":",
"device",
"=",
"pywilight",
".",
"wilight_from_discovery",
"(",
"f\"http://{HOST}:45995/wilight.xml\"",
",",
"UPNP_MAC_ADDRESS",
",",
"UPNP_MODEL_NAME_P_B",
",",
"UPNP_SERIAL",
",",
"UPNP_MODEL_NUMBER",
",",
")",
"de... | [
66,
0
] | [
83,
20
] | python | en | ['en', 'ca', 'en'] | True |
mock_dummy_device_from_host_dimmer | () | Mock a valid api_devce. | Mock a valid api_devce. | def mock_dummy_device_from_host_dimmer():
"""Mock a valid api_devce."""
device = pywilight.wilight_from_discovery(
f"http://{HOST}:45995/wilight.xml",
UPNP_MAC_ADDRESS,
UPNP_MODEL_NAME_DIMMER,
UPNP_SERIAL,
UPNP_MODEL_NUMBER,
)
device.set_dummy(True)
with pa... | [
"def",
"mock_dummy_device_from_host_dimmer",
"(",
")",
":",
"device",
"=",
"pywilight",
".",
"wilight_from_discovery",
"(",
"f\"http://{HOST}:45995/wilight.xml\"",
",",
"UPNP_MAC_ADDRESS",
",",
"UPNP_MODEL_NAME_DIMMER",
",",
"UPNP_SERIAL",
",",
"UPNP_MODEL_NUMBER",
",",
")"... | [
87,
0
] | [
104,
20
] | python | en | ['en', 'ca', 'en'] | True |
mock_dummy_device_from_host_color | () | Mock a valid api_devce. | Mock a valid api_devce. | def mock_dummy_device_from_host_color():
"""Mock a valid api_devce."""
device = pywilight.wilight_from_discovery(
f"http://{HOST}:45995/wilight.xml",
UPNP_MAC_ADDRESS,
UPNP_MODEL_NAME_COLOR,
UPNP_SERIAL,
UPNP_MODEL_NUMBER,
)
device.set_dummy(True)
with patc... | [
"def",
"mock_dummy_device_from_host_color",
"(",
")",
":",
"device",
"=",
"pywilight",
".",
"wilight_from_discovery",
"(",
"f\"http://{HOST}:45995/wilight.xml\"",
",",
"UPNP_MAC_ADDRESS",
",",
"UPNP_MODEL_NAME_COLOR",
",",
"UPNP_SERIAL",
",",
"UPNP_MODEL_NUMBER",
",",
")",
... | [
108,
0
] | [
125,
20
] | python | en | ['en', 'ca', 'en'] | True |
test_loading_light | (
hass: HomeAssistantType,
dummy_device_from_host_light_fan,
dummy_get_components_from_model_light,
) | Test the WiLight configuration entry loading. | Test the WiLight configuration entry loading. | async def test_loading_light(
hass: HomeAssistantType,
dummy_device_from_host_light_fan,
dummy_get_components_from_model_light,
) -> None:
"""Test the WiLight configuration entry loading."""
# Using light_fan and removind fan from get_components_from_model
# to test light.py line 28
entry =... | [
"async",
"def",
"test_loading_light",
"(",
"hass",
":",
"HomeAssistantType",
",",
"dummy_device_from_host_light_fan",
",",
"dummy_get_components_from_model_light",
",",
")",
"->",
"None",
":",
"# Using light_fan and removind fan from get_components_from_model",
"# to test light.py ... | [
128,
0
] | [
150,
48
] | python | en | ['en', 'en', 'en'] | True |
test_on_off_light_state | (
hass: HomeAssistantType, dummy_device_from_host_pb
) | Test the change of state of the light switches. | Test the change of state of the light switches. | async def test_on_off_light_state(
hass: HomeAssistantType, dummy_device_from_host_pb
) -> None:
"""Test the change of state of the light switches."""
await setup_integration(hass)
# Turn on
await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_ON,
{ATTR_ENTITY_ID: "lig... | [
"async",
"def",
"test_on_off_light_state",
"(",
"hass",
":",
"HomeAssistantType",
",",
"dummy_device_from_host_pb",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
")",
"# Turn on",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"LIGH... | [
153,
0
] | [
183,
35
] | python | en | ['en', 'en', 'en'] | True |
test_dimmer_light_state | (
hass: HomeAssistantType, dummy_device_from_host_dimmer
) | Test the change of state of the light switches. | Test the change of state of the light switches. | async def test_dimmer_light_state(
hass: HomeAssistantType, dummy_device_from_host_dimmer
) -> None:
"""Test the change of state of the light switches."""
await setup_integration(hass)
await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_ON,
{ATTR_BRIGHTNESS: 42, ATTR_ENTI... | [
"async",
"def",
"test_dimmer_light_state",
"(",
"hass",
":",
"HomeAssistantType",
",",
"dummy_device_from_host_dimmer",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"LIGHT_DOMAIN",
... | [
186,
0
] | [
253,
34
] | python | en | ['en', 'en', 'en'] | True |
test_color_light_state | (
hass: HomeAssistantType, dummy_device_from_host_color
) | Test the change of state of the light switches. | Test the change of state of the light switches. | async def test_color_light_state(
hass: HomeAssistantType, dummy_device_from_host_color
) -> None:
"""Test the change of state of the light switches."""
await setup_integration(hass)
await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_ON,
{
ATTR_BRIGHTNESS: 42... | [
"async",
"def",
"test_color_light_state",
"(",
"hass",
":",
"HomeAssistantType",
",",
"dummy_device_from_host_color",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"LIGHT_DOMAIN",
... | [
256,
0
] | [
373,
54
] | python | en | ['en', 'en', 'en'] | True |
async_describe_on_off_states | (
hass: HomeAssistantType, registry: GroupIntegrationRegistry
) | Describe group on off states. | Describe group on off states. | def async_describe_on_off_states(
hass: HomeAssistantType, registry: GroupIntegrationRegistry
) -> None:
"""Describe group on off states."""
# On means open, Off means closed
registry.on_off_states({STATE_OPEN}, STATE_CLOSED) | [
"def",
"async_describe_on_off_states",
"(",
"hass",
":",
"HomeAssistantType",
",",
"registry",
":",
"GroupIntegrationRegistry",
")",
"->",
"None",
":",
"# On means open, Off means closed",
"registry",
".",
"on_off_states",
"(",
"{",
"STATE_OPEN",
"}",
",",
"STATE_CLOSED... | [
10,
0
] | [
15,
54
] | python | en | ['en', 'en', 'en'] | True |
put_results_in_web_page | (html) | Takes an html string and puts it in a html file and opens it | Takes an html string and puts it in a html file and opens it | def put_results_in_web_page(html):
"""Takes an html string and puts it in a html file and opens it"""
with open("page.html", "w", encoding="utf-8") as file:
file.write(html)
webbrowser.open("page.html") | [
"def",
"put_results_in_web_page",
"(",
"html",
")",
":",
"with",
"open",
"(",
"\"page.html\"",
",",
"\"w\"",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"file",
":",
"file",
".",
"write",
"(",
"html",
")",
"webbrowser",
".",
"open",
"(",
"\"page.html\"",... | [
3,
0
] | [
8,
32
] | python | en | ['en', 'en', 'en'] | True |
remove_dublicates | (l) | removes dublicates in a list | removes dublicates in a list | def remove_dublicates(l):
"""removes dublicates in a list"""
final_l = []
for index ,item in enumerate(l):
if l.index(item) == index:
final_l.append(item)
return final_l | [
"def",
"remove_dublicates",
"(",
"l",
")",
":",
"final_l",
"=",
"[",
"]",
"for",
"index",
",",
"item",
"in",
"enumerate",
"(",
"l",
")",
":",
"if",
"l",
".",
"index",
"(",
"item",
")",
"==",
"index",
":",
"final_l",
".",
"append",
"(",
"item",
")... | [
10,
0
] | [
18,
18
] | python | en | ['fr', 'en', 'it'] | False |
check_soup | (soup, error: "the text that shows error in the page", error_msg: "the printed error message") | checks the page if there was error in it like too many requests if the ip was panned | checks the page if there was error in it like too many requests if the ip was panned | def check_soup(soup, error: "the text that shows error in the page", error_msg: "the printed error message"):
"""checks the page if there was error in it like too many requests if the ip was panned"""
if error in soup.prettify():
print(error_msg)
exit(1) | [
"def",
"check_soup",
"(",
"soup",
",",
"error",
":",
"\"the text that shows error in the page\"",
",",
"error_msg",
":",
"\"the printed error message\"",
")",
":",
"if",
"error",
"in",
"soup",
".",
"prettify",
"(",
")",
":",
"print",
"(",
"error_msg",
")",
"exit... | [
20,
0
] | [
25,
15
] | python | en | ['en', 'en', 'en'] | True |
ordinalText_to_int | (text) | returns the int of a ordinal number, and returns false if the ordinal text
was out of the function boundaries or it was invalid | returns the int of a ordinal number, and returns false if the ordinal text
was out of the function boundaries or it was invalid | def ordinalText_to_int(text):
"""returns the int of a ordinal number, and returns false if the ordinal text
was out of the function boundaries or it was invalid"""
data = {
"first": 1,
"second": 2,
"third": 3,
"fourth": 4,
"fifth": 5,
"sixth": 6,
"seve... | [
"def",
"ordinalText_to_int",
"(",
"text",
")",
":",
"data",
"=",
"{",
"\"first\"",
":",
"1",
",",
"\"second\"",
":",
"2",
",",
"\"third\"",
":",
"3",
",",
"\"fourth\"",
":",
"4",
",",
"\"fifth\"",
":",
"5",
",",
"\"sixth\"",
":",
"6",
",",
"\"seventh... | [
27,
0
] | [
92,
16
] | python | en | ['en', 'su', 'en'] | True |
get_service | (hass, config, discovery_info=None) | Get the LaMetric notification service. | Get the LaMetric notification service. | def get_service(hass, config, discovery_info=None):
"""Get the LaMetric notification service."""
hlmn = hass.data.get(LAMETRIC_DOMAIN)
return LaMetricNotificationService(
hlmn,
config[CONF_ICON],
config[CONF_LIFETIME] * 1000,
config[CONF_CYCLES],
config[CONF_PRIORITY]... | [
"def",
"get_service",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"hlmn",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"LAMETRIC_DOMAIN",
")",
"return",
"LaMetricNotificationService",
"(",
"hlmn",
",",
"config",
"[",
"CONF_ICON",
... | [
40,
0
] | [
50,
5
] | python | en | ['en', 'en', 'en'] | True |
LaMetricNotificationService.__init__ | (
self, hasslametricmanager, icon, lifetime, cycles, priority, icon_type
) | Initialize the service. | Initialize the service. | def __init__(
self, hasslametricmanager, icon, lifetime, cycles, priority, icon_type
):
"""Initialize the service."""
self.hasslametricmanager = hasslametricmanager
self._icon = icon
self._lifetime = lifetime
self._cycles = cycles
self._priority = priority
... | [
"def",
"__init__",
"(",
"self",
",",
"hasslametricmanager",
",",
"icon",
",",
"lifetime",
",",
"cycles",
",",
"priority",
",",
"icon_type",
")",
":",
"self",
".",
"hasslametricmanager",
"=",
"hasslametricmanager",
"self",
".",
"_icon",
"=",
"icon",
"self",
"... | [
56,
4
] | [
66,
26
] | python | en | ['en', 'en', 'en'] | True |
LaMetricNotificationService.send_message | (self, message="", **kwargs) | Send a message to some LaMetric device. | Send a message to some LaMetric device. | def send_message(self, message="", **kwargs):
"""Send a message to some LaMetric device."""
targets = kwargs.get(ATTR_TARGET)
data = kwargs.get(ATTR_DATA)
_LOGGER.debug("Targets/Data: %s/%s", targets, data)
icon = self._icon
cycles = self._cycles
sound = None
... | [
"def",
"send_message",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"targets",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TARGET",
")",
"data",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_DATA",
")",
"_LOGGER",
".",
"debug",
"(",... | [
68,
4
] | [
145,
81
] | python | en | ['en', 'en', 'en'] | True |
WithingsFlowHandler.logger | (self) | Return logger. | Return logger. | def logger(self) -> logging.Logger:
"""Return logger."""
return logging.getLogger(__name__) | [
"def",
"logger",
"(",
"self",
")",
"->",
"logging",
".",
"Logger",
":",
"return",
"logging",
".",
"getLogger",
"(",
"__name__",
")"
] | [
24,
4
] | [
26,
42
] | python | en | ['es', 'no', 'en'] | False |
WithingsFlowHandler.extra_authorize_data | (self) | Extra data that needs to be appended to the authorize url. | Extra data that needs to be appended to the authorize url. | def extra_authorize_data(self) -> dict:
"""Extra data that needs to be appended to the authorize url."""
return {
"scope": ",".join(
[
AuthScope.USER_INFO.value,
AuthScope.USER_METRICS.value,
AuthScope.USER_ACTIVITY.... | [
"def",
"extra_authorize_data",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"\"scope\"",
":",
"\",\"",
".",
"join",
"(",
"[",
"AuthScope",
".",
"USER_INFO",
".",
"value",
",",
"AuthScope",
".",
"USER_METRICS",
".",
"value",
",",
"AuthScope",
".",
... | [
29,
4
] | [
40,
9
] | python | en | ['en', 'en', 'en'] | True |
WithingsFlowHandler.async_oauth_create_entry | (self, data: dict) | Override the create entry so user can select a profile. | Override the create entry so user can select a profile. | async def async_oauth_create_entry(self, data: dict) -> dict:
"""Override the create entry so user can select a profile."""
self._current_data = data
return await self.async_step_profile(data) | [
"async",
"def",
"async_oauth_create_entry",
"(",
"self",
",",
"data",
":",
"dict",
")",
"->",
"dict",
":",
"self",
".",
"_current_data",
"=",
"data",
"return",
"await",
"self",
".",
"async_step_profile",
"(",
"data",
")"
] | [
42,
4
] | [
45,
50
] | python | en | ['en', 'en', 'en'] | True |
WithingsFlowHandler.async_step_profile | (self, data: dict) | Prompt the user to select a user profile. | Prompt the user to select a user profile. | async def async_step_profile(self, data: dict) -> dict:
"""Prompt the user to select a user profile."""
errors = {}
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
reauth_profile = (
self.context.get(const.PROFILE)
if self.context.get("so... | [
"async",
"def",
"async_step_profile",
"(",
"self",
",",
"data",
":",
"dict",
")",
"->",
"dict",
":",
"errors",
"=",
"{",
"}",
"# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167",
"reauth_profile",
"=",
"(",
"self",
".",
"context",
".",
"get",... | [
47,
4
] | [
76,
9
] | python | en | ['en', 'en', 'en'] | True |
WithingsFlowHandler.async_step_reauth | (self, data: dict = None) | Prompt user to re-authenticate. | Prompt user to re-authenticate. | async def async_step_reauth(self, data: dict = None) -> dict:
"""Prompt user to re-authenticate."""
if data is not None:
return await self.async_step_user()
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
placeholders = {const.PROFILE: self.context[... | [
"async",
"def",
"async_step_reauth",
"(",
"self",
",",
"data",
":",
"dict",
"=",
"None",
")",
"->",
"dict",
":",
"if",
"data",
"is",
"not",
"None",
":",
"return",
"await",
"self",
".",
"async_step_user",
"(",
")",
"# pylint: disable=no-member # https://github.... | [
78,
4
] | [
92,
9
] | python | en | ['en', 'en', 'en'] | True |
WithingsFlowHandler.async_step_finish | (self, data: dict) | Finish the flow. | Finish the flow. | async def async_step_finish(self, data: dict) -> dict:
"""Finish the flow."""
self._current_data = {}
await self.async_set_unique_id(
str(data["token"]["userid"]), raise_on_progress=False
)
self._abort_if_unique_id_configured(data)
return self.async_create_e... | [
"async",
"def",
"async_step_finish",
"(",
"self",
",",
"data",
":",
"dict",
")",
"->",
"dict",
":",
"self",
".",
"_current_data",
"=",
"{",
"}",
"await",
"self",
".",
"async_set_unique_id",
"(",
"str",
"(",
"data",
"[",
"\"token\"",
"]",
"[",
"\"userid\"... | [
94,
4
] | [
103,
76
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Kaiterra components. | Set up the Kaiterra components. | async def async_setup(hass, config):
"""Set up the Kaiterra components."""
conf = config[DOMAIN]
scan_interval = conf[CONF_SCAN_INTERVAL]
devices = conf[CONF_DEVICES]
session = async_get_clientsession(hass)
api = hass.data[DOMAIN] = KaiterraApiData(hass, conf, session)
await api.async_upda... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"scan_interval",
"=",
"conf",
"[",
"CONF_SCAN_INTERVAL",
"]",
"devices",
"=",
"conf",
"[",
"CONF_DEVICES",
"]",
"session",
"=",
"async_get_clients... | [
55,
0
] | [
89,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: dict) | Set up the Wolf SmartSet Service component. | Set up the Wolf SmartSet Service component. | async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Wolf SmartSet Service component."""
hass.data[DOMAIN] = {}
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"return",
"True"
] | [
25,
0
] | [
28,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Wolf SmartSet Service from a config entry. | Set up Wolf SmartSet Service from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Wolf SmartSet Service from a config entry."""
username = entry.data[CONF_USERNAME]
password = entry.data[CONF_PASSWORD]
device_name = entry.data[DEVICE_NAME]
device_id = entry.data[DEVICE_ID]
gateway_id = entry.data[... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"username",
"=",
"entry",
".",
"data",
"[",
"CONF_USERNAME",
"]",
"password",
"=",
"entry",
".",
"data",
"[",
"CONF_PASSWORD",
"]",
"device_na... | [
31,
0
] | [
84,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_forward_entry_unload(entry, "sensor")
if unload_ok:
hass.data[DOMAIN].pop(entry.entry_id)
return unload_ok | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"unload_ok",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"entry",
",",
"\"sensor\"",
")",
"if",
"unload_... | [
87,
0
] | [
93,
20
] | python | en | ['en', 'es', 'en'] | True |
fetch_parameters | (client: WolfClient, gateway_id: int, device_id: int) |
Fetch all available parameters with usage of WolfClient.
By default Reglertyp entity is removed because API will not provide value for this parameter.
|
Fetch all available parameters with usage of WolfClient. | async def fetch_parameters(client: WolfClient, gateway_id: int, device_id: int):
"""
Fetch all available parameters with usage of WolfClient.
By default Reglertyp entity is removed because API will not provide value for this parameter.
"""
try:
fetched_parameters = await client.fetch_parame... | [
"async",
"def",
"fetch_parameters",
"(",
"client",
":",
"WolfClient",
",",
"gateway_id",
":",
"int",
",",
"device_id",
":",
"int",
")",
":",
"try",
":",
"fetched_parameters",
"=",
"await",
"client",
".",
"fetch_parameters",
"(",
"gateway_id",
",",
"device_id",... | [
96,
0
] | [
108,
81
] | python | en | ['en', 'error', 'th'] | False |
_generate_mock_feed_entry | (external_id, title, distance_to_home, coordinates) | Construct a mock feed entry for testing purposes. | Construct a mock feed entry for testing purposes. | def _generate_mock_feed_entry(external_id, title, distance_to_home, coordinates):
"""Construct a mock feed entry for testing purposes."""
feed_entry = MagicMock()
feed_entry.external_id = external_id
feed_entry.title = title
feed_entry.distance_to_home = distance_to_home
feed_entry.coordinates =... | [
"def",
"_generate_mock_feed_entry",
"(",
"external_id",
",",
"title",
",",
"distance_to_home",
",",
"coordinates",
")",
":",
"feed_entry",
"=",
"MagicMock",
"(",
")",
"feed_entry",
".",
"external_id",
"=",
"external_id",
"feed_entry",
".",
"title",
"=",
"title",
... | [
46,
0
] | [
53,
21
] | python | en | ['en', 'en', 'en'] | True |
test_setup | (hass, legacy_patchable_time) | Test the general setup of the platform. | Test the general setup of the platform. | async def test_setup(hass, legacy_patchable_time):
"""Test the general setup of the platform."""
# Set up some mock feed entries for this test.
mock_entry_1 = _generate_mock_feed_entry("1234", "Title 1", 15.5, (-31.0, 150.0))
mock_entry_2 = _generate_mock_feed_entry("2345", "Title 2", 20.5, (-31.1, 150.... | [
"async",
"def",
"test_setup",
"(",
"hass",
",",
"legacy_patchable_time",
")",
":",
"# Set up some mock feed entries for this test.",
"mock_entry_1",
"=",
"_generate_mock_feed_entry",
"(",
"\"1234\"",
",",
"\"Title 1\"",
",",
"15.5",
",",
"(",
"-",
"31.0",
",",
"150.0"... | [
56,
0
] | [
150,
39
] | python | en | ['en', 'da', 'en'] | True |
test_setup_with_custom_location | (hass) | Test the setup with a custom location. | Test the setup with a custom location. | async def test_setup_with_custom_location(hass):
"""Test the setup with a custom location."""
# Set up some mock feed entries for this test.
mock_entry_1 = _generate_mock_feed_entry("1234", "Title 1", 2000.5, (-31.1, 150.1))
with patch("geojson_client.generic_feed.GenericFeed") as mock_feed:
mo... | [
"async",
"def",
"test_setup_with_custom_location",
"(",
"hass",
")",
":",
"# Set up some mock feed entries for this test.",
"mock_entry_1",
"=",
"_generate_mock_feed_entry",
"(",
"\"1234\"",
",",
"\"Title 1\"",
",",
"2000.5",
",",
"(",
"-",
"31.1",
",",
"150.1",
")",
... | [
153,
0
] | [
175,
86
] | python | en | ['en', 'en', 'en'] | True |
test_setup_race_condition | (hass, legacy_patchable_time) | Test a particular race condition experienced. | Test a particular race condition experienced. | async def test_setup_race_condition(hass, legacy_patchable_time):
"""Test a particular race condition experienced."""
# 1. Feed returns 1 entry -> Feed manager creates 1 entity.
# 2. Feed returns error -> Feed manager removes 1 entity.
# However, this stayed on and kept listening for dispatcher signa... | [
"async",
"def",
"test_setup_race_condition",
"(",
"hass",
",",
"legacy_patchable_time",
")",
":",
"# 1. Feed returns 1 entry -> Feed manager creates 1 entity.",
"# 2. Feed returns error -> Feed manager removes 1 entity.",
"# However, this stayed on and kept listening for dispatcher signals.... | [
178,
0
] | [
255,
70
] | python | en | ['es', 'en', 'en'] | True |
Actor.roll_out | (self, index: int, training: bool = True, model_by_agent: dict = None, exploration_params=None) | Perform one episode of roll-out.
Args:
index (int): Externally designated index to identify the roll-out round.
training (bool): If true, the roll-out is for training purposes, which usually means
some kind of training data, e.g., experiences, needs to be collected. Defau... | Perform one episode of roll-out.
Args:
index (int): Externally designated index to identify the roll-out round.
training (bool): If true, the roll-out is for training purposes, which usually means
some kind of training data, e.g., experiences, needs to be collected. Defau... | def roll_out(self, index: int, training: bool = True, model_by_agent: dict = None, exploration_params=None):
"""Perform one episode of roll-out.
Args:
index (int): Externally designated index to identify the roll-out round.
training (bool): If true, the roll-out is for training p... | [
"def",
"roll_out",
"(",
"self",
",",
"index",
":",
"int",
",",
"training",
":",
"bool",
"=",
"True",
",",
"model_by_agent",
":",
"dict",
"=",
"None",
",",
"exploration_params",
"=",
"None",
")",
":",
"self",
".",
"env",
".",
"reset",
"(",
")",
"self"... | [
37,
4
] | [
69,
82
] | python | en | ['en', 'en', 'en'] | True |
Actor.as_worker | (self, group: str, proxy_options=None, log_dir: str = getcwd()) | Executes an event loop where roll-outs are performed on demand from a remote learner.
Args:
group (str): Identifier of the group to which the actor belongs. It must be the same group name
assigned to the learner (and decision clients, if any).
proxy_options (dict): Keywo... | Executes an event loop where roll-outs are performed on demand from a remote learner. | def as_worker(self, group: str, proxy_options=None, log_dir: str = getcwd()):
"""Executes an event loop where roll-outs are performed on demand from a remote learner.
Args:
group (str): Identifier of the group to which the actor belongs. It must be the same group name
assign... | [
"def",
"as_worker",
"(",
"self",
",",
"group",
":",
"str",
",",
"proxy_options",
"=",
"None",
",",
"log_dir",
":",
"str",
"=",
"getcwd",
"(",
")",
")",
":",
"if",
"proxy_options",
"is",
"None",
":",
"proxy_options",
"=",
"{",
"}",
"proxy",
"=",
"Prox... | [
71,
4
] | [
113,
32
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistantType, config: ConfigType) | Set up the Aqualink component. | Set up the Aqualink component. | async def async_setup(hass: HomeAssistantType, config: ConfigType) -> None:
"""Set up the Aqualink component."""
conf = config.get(DOMAIN)
hass.data[DOMAIN] = {}
if conf is not None:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"sour... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"ConfigType",
")",
"->",
"None",
":",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"if",
"conf... | [
58,
0
] | [
71,
15
] | python | en | ['en', 'da', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.