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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
TellstickDevice.update | (self) | Poll the current state of the device. | Poll the current state of the device. | def update(self):
"""Poll the current state of the device."""
self._update_from_tellcore() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_update_from_tellcore",
"(",
")"
] | [
303,
4
] | [
305,
36
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Perform the setup for Xiaomi devices. | Perform the setup for Xiaomi devices. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Perform the setup for Xiaomi devices."""
entities = []
gateway = hass.data[DOMAIN][GATEWAYS_KEY][config_entry.entry_id]
for device in gateway.devices["cover"]:
model = device["model"]
if model in ("curtain", "curtain... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"entities",
"=",
"[",
"]",
"gateway",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"GATEWAYS_KEY",
"]",
"[",
"config_entry",
".",
"entry_id",
... | [
12,
0
] | [
26,
32
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericCover.__init__ | (self, device, name, data_key, xiaomi_hub, config_entry) | Initialize the XiaomiGenericCover. | Initialize the XiaomiGenericCover. | def __init__(self, device, name, data_key, xiaomi_hub, config_entry):
"""Initialize the XiaomiGenericCover."""
self._data_key = data_key
self._pos = 0
super().__init__(device, name, xiaomi_hub, config_entry) | [
"def",
"__init__",
"(",
"self",
",",
"device",
",",
"name",
",",
"data_key",
",",
"xiaomi_hub",
",",
"config_entry",
")",
":",
"self",
".",
"_data_key",
"=",
"data_key",
"self",
".",
"_pos",
"=",
"0",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
... | [
32,
4
] | [
36,
64
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericCover.current_cover_position | (self) | Return the current position of the cover. | Return the current position of the cover. | def current_cover_position(self):
"""Return the current position of the cover."""
return self._pos | [
"def",
"current_cover_position",
"(",
"self",
")",
":",
"return",
"self",
".",
"_pos"
] | [
39,
4
] | [
41,
24
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericCover.is_closed | (self) | Return if the cover is closed. | Return if the cover is closed. | def is_closed(self):
"""Return if the cover is closed."""
return self.current_cover_position <= 0 | [
"def",
"is_closed",
"(",
"self",
")",
":",
"return",
"self",
".",
"current_cover_position",
"<=",
"0"
] | [
44,
4
] | [
46,
47
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericCover.close_cover | (self, **kwargs) | Close the cover. | Close the cover. | def close_cover(self, **kwargs):
"""Close the cover."""
self._write_to_hub(self._sid, **{self._data_key: "close"}) | [
"def",
"close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_write_to_hub",
"(",
"self",
".",
"_sid",
",",
"*",
"*",
"{",
"self",
".",
"_data_key",
":",
"\"close\"",
"}",
")"
] | [
48,
4
] | [
50,
66
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericCover.open_cover | (self, **kwargs) | Open the cover. | Open the cover. | def open_cover(self, **kwargs):
"""Open the cover."""
self._write_to_hub(self._sid, **{self._data_key: "open"}) | [
"def",
"open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_write_to_hub",
"(",
"self",
".",
"_sid",
",",
"*",
"*",
"{",
"self",
".",
"_data_key",
":",
"\"open\"",
"}",
")"
] | [
52,
4
] | [
54,
65
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericCover.stop_cover | (self, **kwargs) | Stop the cover. | Stop the cover. | def stop_cover(self, **kwargs):
"""Stop the cover."""
self._write_to_hub(self._sid, **{self._data_key: "stop"}) | [
"def",
"stop_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_write_to_hub",
"(",
"self",
".",
"_sid",
",",
"*",
"*",
"{",
"self",
".",
"_data_key",
":",
"\"stop\"",
"}",
")"
] | [
56,
4
] | [
58,
65
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericCover.set_cover_position | (self, **kwargs) | Move the cover to a specific position. | Move the cover to a specific position. | def set_cover_position(self, **kwargs):
"""Move the cover to a specific position."""
position = kwargs.get(ATTR_POSITION)
if self._data_key == DATA_KEY_PROTO_V2:
self._write_to_hub(self._sid, **{ATTR_CURTAIN_LEVEL: position})
else:
self._write_to_hub(self._sid, **... | [
"def",
"set_cover_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"position",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_POSITION",
")",
"if",
"self",
".",
"_data_key",
"==",
"DATA_KEY_PROTO_V2",
":",
"self",
".",
"_write_to_hub",
"(",
"self",
".",
... | [
60,
4
] | [
66,
80
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericCover.parse_data | (self, data, raw_data) | Parse data sent by gateway. | Parse data sent by gateway. | def parse_data(self, data, raw_data):
"""Parse data sent by gateway."""
if ATTR_CURTAIN_LEVEL in data:
self._pos = int(data[ATTR_CURTAIN_LEVEL])
return True
return False | [
"def",
"parse_data",
"(",
"self",
",",
"data",
",",
"raw_data",
")",
":",
"if",
"ATTR_CURTAIN_LEVEL",
"in",
"data",
":",
"self",
".",
"_pos",
"=",
"int",
"(",
"data",
"[",
"ATTR_CURTAIN_LEVEL",
"]",
")",
"return",
"True",
"return",
"False"
] | [
68,
4
] | [
73,
20
] | python | en | ['en', 'de', 'en'] | True |
create_registrations | (hass, authed_api_client) | Return two new registrations. | Return two new registrations. | async def create_registrations(hass, authed_api_client):
"""Return two new registrations."""
await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
enc_reg = await authed_api_client.post(
"/api/mobile_app/registrations", json=REGISTER
)
assert enc_reg.status == 201
enc_reg_json = awai... | [
"async",
"def",
"create_registrations",
"(",
"hass",
",",
"authed_api_client",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"}",
"}",
")",
"enc_reg",
"=",
"await",
"authed_api_client",
".",
"post",
"("... | [
11,
0
] | [
31,
41
] | python | en | ['en', 'bg', 'en'] | True |
push_registration | (hass, authed_api_client) | Return registration with push notifications enabled. | Return registration with push notifications enabled. | async def push_registration(hass, authed_api_client):
"""Return registration with push notifications enabled."""
await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
enc_reg = await authed_api_client.post(
"/api/mobile_app/registrations",
json={
**REGISTER,
"app_d... | [
"async",
"def",
"push_registration",
"(",
"hass",
",",
"authed_api_client",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"}",
"}",
")",
"enc_reg",
"=",
"await",
"authed_api_client",
".",
"post",
"(",
... | [
35,
0
] | [
51,
31
] | python | en | ['en', 'en', 'en'] | True |
webhook_client | (hass, authed_api_client, aiohttp_client) | mobile_app mock client. | mobile_app mock client. | async def webhook_client(hass, authed_api_client, aiohttp_client):
"""mobile_app mock client."""
# We pass in the authed_api_client server instance because
# it is used inside create_registrations and just passing in
# the app instance would cause the server to start twice,
# which caused deprecatio... | [
"async",
"def",
"webhook_client",
"(",
"hass",
",",
"authed_api_client",
",",
"aiohttp_client",
")",
":",
"# We pass in the authed_api_client server instance because",
"# it is used inside create_registrations and just passing in",
"# the app instance would cause the server to start twice,... | [
55,
0
] | [
61,
57
] | python | en | ['en', 'fr', 'en'] | True |
authed_api_client | (hass, hass_client) | Provide an authenticated client for mobile_app to use. | Provide an authenticated client for mobile_app to use. | async def authed_api_client(hass, hass_client):
"""Provide an authenticated client for mobile_app to use."""
await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
await hass.async_block_till_done()
return await hass_client() | [
"async",
"def",
"authed_api_client",
"(",
"hass",
",",
"hass_client",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"}",
"}",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"return",
"a... | [
65,
0
] | [
69,
30
] | python | en | ['en', 'en', 'en'] | True |
setup_ws | (hass) | Configure the websocket_api component. | Configure the websocket_api component. | async def setup_ws(hass):
"""Configure the websocket_api component."""
assert await async_setup_component(hass, "websocket_api", {})
await hass.async_block_till_done() | [
"async",
"def",
"setup_ws",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"websocket_api\"",
",",
"{",
"}",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")"
] | [
73,
0
] | [
76,
38
] | python | en | ['en', 'ca', 'en'] | True |
HDEntity.__init__ | (self, coordinator, device_info, room_name, unique_id) | Initialize the entity. | Initialize the entity. | def __init__(self, coordinator, device_info, room_name, unique_id):
"""Initialize the entity."""
super().__init__(coordinator)
self._room_name = room_name
self._unique_id = unique_id
self._device_info = device_info | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"device_info",
",",
"room_name",
",",
"unique_id",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_room_name",
"=",
"room_name",
"self",
".",
"_unique_id",
"=",
... | [
25,
4
] | [
30,
39
] | python | en | ['en', 'en', 'en'] | True |
HDEntity.unique_id | (self) | Return the unique id. | Return the unique id. | def unique_id(self):
"""Return the unique id."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
33,
4
] | [
35,
30
] | python | en | ['en', 'la', 'en'] | True |
HDEntity.device_info | (self) | Return the device_info of the device. | Return the device_info of the device. | def device_info(self):
"""Return the device_info of the device."""
firmware = self._device_info[DEVICE_FIRMWARE]
sw_version = f"{firmware[FIRMWARE_REVISION]}.{firmware[FIRMWARE_SUB_REVISION]}.{firmware[FIRMWARE_BUILD]}"
return {
"identifiers": {(DOMAIN, self._device_info[DEVI... | [
"def",
"device_info",
"(",
"self",
")",
":",
"firmware",
"=",
"self",
".",
"_device_info",
"[",
"DEVICE_FIRMWARE",
"]",
"sw_version",
"=",
"f\"{firmware[FIRMWARE_REVISION]}.{firmware[FIRMWARE_SUB_REVISION]}.{firmware[FIRMWARE_BUILD]}\"",
"return",
"{",
"\"identifiers\"",
":",... | [
38,
4
] | [
52,
9
] | python | en | ['en', 'en', 'en'] | True |
ShadeEntity.__init__ | (self, coordinator, device_info, room_name, shade, shade_name) | Initialize the shade. | Initialize the shade. | def __init__(self, coordinator, device_info, room_name, shade, shade_name):
"""Initialize the shade."""
super().__init__(coordinator, device_info, room_name, shade.id)
self._shade_name = shade_name
self._shade = shade | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"device_info",
",",
"room_name",
",",
"shade",
",",
"shade_name",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"device_info",
",",
"room_name",
",",
"shade",
".",
"id",
")... | [
58,
4
] | [
62,
27
] | python | en | ['en', 'en', 'en'] | True |
ShadeEntity.device_info | (self) | Return the device_info of the device. | Return the device_info of the device. | def device_info(self):
"""Return the device_info of the device."""
device_info = {
"identifiers": {(DOMAIN, self._shade.id)},
"name": self._shade_name,
"suggested_area": self._room_name,
"manufacturer": MANUFACTURER,
"model": str(self._shade.r... | [
"def",
"device_info",
"(",
"self",
")",
":",
"device_info",
"=",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_shade",
".",
"id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"_shade_name",
",",
"\"suggested_area\"",
":",
"self",
... | [
65,
4
] | [
90,
26
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the demo environment. | Set up the demo environment. | async def async_setup(hass, config):
"""Set up the demo environment."""
if DOMAIN not in config:
return True
if not hass.config_entries.async_entries(DOMAIN):
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.S... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"if",
"DOMAIN",
"not",
"in",
"config",
":",
"return",
"True",
"if",
"not",
"hass",
".",
"config_entries",
".",
"async_entries",
"(",
"DOMAIN",
")",
":",
"hass",
".",
"async_create_task",
... | [
45,
0
] | [
148,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry) | Set the config entry up. | Set the config entry up. | async def async_setup_entry(hass, config_entry):
"""Set the config entry up."""
# Set up demo platforms with config entry
for platform in COMPONENTS_WITH_CONFIG_ENTRY_DEMO_PLATFORM:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"# Set up demo platforms with config entry",
"for",
"platform",
"in",
"COMPONENTS_WITH_CONFIG_ENTRY_DEMO_PLATFORM",
":",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
... | [
151,
0
] | [
158,
15
] | python | en | ['en', 'en', 'en'] | True |
finish_setup | (hass, config) | Finish set up once demo platforms are set up. | Finish set up once demo platforms are set up. | async def finish_setup(hass, config):
"""Finish set up once demo platforms are set up."""
switches = None
lights = None
while not switches and not lights:
# Not all platforms might be loaded.
if switches is not None:
await asyncio.sleep(0)
switches = sorted(hass.stat... | [
"async",
"def",
"finish_setup",
"(",
"hass",
",",
"config",
")",
":",
"switches",
"=",
"None",
"lights",
"=",
"None",
"while",
"not",
"switches",
"and",
"not",
"lights",
":",
"# Not all platforms might be loaded.",
"if",
"switches",
"is",
"not",
"None",
":",
... | [
161,
0
] | [
225,
5
] | python | en | ['en', 'da', 'en'] | True |
test__replace_nan | () | Test that _replace_nan returns the original array if there are no
NaNs, not a copy.
| Test that _replace_nan returns the original array if there are no
NaNs, not a copy.
| def test__replace_nan():
""" Test that _replace_nan returns the original array if there are no
NaNs, not a copy.
"""
for dtype in [np.bool, np.int32, np.int64]:
arr = np.array([0, 1], dtype=dtype)
result, mask = _replace_nan(arr, 0)
assert mask is None
# do not make a cop... | [
"def",
"test__replace_nan",
"(",
")",
":",
"for",
"dtype",
"in",
"[",
"np",
".",
"bool",
",",
"np",
".",
"int32",
",",
"np",
".",
"int64",
"]",
":",
"arr",
"=",
"np",
".",
"array",
"(",
"[",
"0",
",",
"1",
"]",
",",
"dtype",
"=",
"dtype",
")"... | [
955,
0
] | [
979,
36
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the LG WebOS TV platform. | Set up the LG WebOS TV platform. | async def async_setup(hass, config):
"""Set up the LG WebOS TV platform."""
hass.data[DOMAIN] = {}
async def async_service_handler(service):
method = SERVICE_TO_METHOD.get(service.service)
data = service.data.copy()
data["method"] = method["method"]
async_dispatcher_send(has... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"async",
"def",
"async_service_handler",
"(",
"service",
")",
":",
"method",
"=",
"SERVICE_TO_METHOD",
".",
"get",
"(",
"service"... | [
84,
0
] | [
104,
15
] | python | en | ['en', 'da', 'en'] | True |
convert_client_keys | (config_file) | In case the config file contains JSON, convert it to a Sqlite config file. | In case the config file contains JSON, convert it to a Sqlite config file. | def convert_client_keys(config_file):
"""In case the config file contains JSON, convert it to a Sqlite config file."""
# Return early if config file is non-existing
if not os.path.isfile(config_file):
return
# Try to parse the file as being JSON
with open(config_file, encoding="utf8") as js... | [
"def",
"convert_client_keys",
"(",
"config_file",
")",
":",
"# Return early if config file is non-existing",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"config_file",
")",
":",
"return",
"# Try to parse the file as being JSON",
"with",
"open",
"(",
"config_file... | [
107,
0
] | [
131,
25
] | python | en | ['en', 'en', 'en'] | True |
async_setup_tv | (hass, config, conf) | Set up a LG WebOS TV based on host parameter. | Set up a LG WebOS TV based on host parameter. | async def async_setup_tv(hass, config, conf):
"""Set up a LG WebOS TV based on host parameter."""
host = conf[CONF_HOST]
config_file = hass.config.path(WEBOSTV_CONFIG_FILE)
await hass.async_add_executor_job(convert_client_keys, config_file)
client = await WebOsClient.create(host, config_file)
... | [
"async",
"def",
"async_setup_tv",
"(",
"hass",
",",
"config",
",",
"conf",
")",
":",
"host",
"=",
"conf",
"[",
"CONF_HOST",
"]",
"config_file",
"=",
"hass",
".",
"config",
".",
"path",
"(",
"WEBOSTV_CONFIG_FILE",
")",
"await",
"hass",
".",
"async_add_execu... | [
134,
0
] | [
148,
69
] | python | en | ['en', 'da', 'en'] | True |
async_connect | (client) | Attempt a connection, but fail gracefully if tv is off for example. | Attempt a connection, but fail gracefully if tv is off for example. | async def async_connect(client):
"""Attempt a connection, but fail gracefully if tv is off for example."""
with suppress(
OSError,
ConnectionClosed,
ConnectionRefusedError,
asyncio.TimeoutError,
asyncio.CancelledError,
PyLGTVPairException,
PyLGTVCmdExcepti... | [
"async",
"def",
"async_connect",
"(",
"client",
")",
":",
"with",
"suppress",
"(",
"OSError",
",",
"ConnectionClosed",
",",
"ConnectionRefusedError",
",",
"asyncio",
".",
"TimeoutError",
",",
"asyncio",
".",
"CancelledError",
",",
"PyLGTVPairException",
",",
"PyLG... | [
151,
0
] | [
162,
30
] | python | en | ['en', 'en', 'en'] | True |
async_setup_tv_finalize | (hass, config, conf, client) | Make initial connection attempt and call platform setup. | Make initial connection attempt and call platform setup. | async def async_setup_tv_finalize(hass, config, conf, client):
"""Make initial connection attempt and call platform setup."""
async def async_on_stop(event):
"""Unregister callbacks and disconnect."""
client.clear_state_update_callbacks()
await client.disconnect()
hass.bus.async_li... | [
"async",
"def",
"async_setup_tv_finalize",
"(",
"hass",
",",
"config",
",",
"conf",
",",
"client",
")",
":",
"async",
"def",
"async_on_stop",
"(",
"event",
")",
":",
"\"\"\"Unregister callbacks and disconnect.\"\"\"",
"client",
".",
"clear_state_update_callbacks",
"("... | [
165,
0
] | [
181,
5
] | python | en | ['en', 'en', 'en'] | True |
async_request_configuration | (hass, config, conf, client) | Request configuration steps from the user. | Request configuration steps from the user. | async def async_request_configuration(hass, config, conf, client):
"""Request configuration steps from the user."""
host = conf.get(CONF_HOST)
name = conf.get(CONF_NAME)
configurator = hass.components.configurator
async def lgtv_configuration_callback(data):
"""Handle actions when configura... | [
"async",
"def",
"async_request_configuration",
"(",
"hass",
",",
"config",
",",
"conf",
",",
"client",
")",
":",
"host",
"=",
"conf",
".",
"get",
"(",
"CONF_HOST",
")",
"name",
"=",
"conf",
".",
"get",
"(",
"CONF_NAME",
")",
"configurator",
"=",
"hass",
... | [
184,
0
] | [
216,
5
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Lutron occupancy sensors. | Set up the Lutron occupancy sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Lutron occupancy sensors."""
if discovery_info is None:
return
devs = []
for (area_name, device) in hass.data[LUTRON_DEVICES]["binary_sensor"]:
dev = LutronOccupancySensor(area_name, device, hass.data[LUTR... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"devs",
"=",
"[",
"]",
"for",
"(",
"area_name",
",",
"device",
")",
"in",
"hass",... | [
11,
0
] | [
20,
22
] | python | en | ['en', 'en', 'en'] | True |
LutronOccupancySensor.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."""
# Error cases will end up treated as unoccupied.
return self._lutron_device.state == OccupancyGroup.State.OCCUPIED | [
"def",
"is_on",
"(",
"self",
")",
":",
"# Error cases will end up treated as unoccupied.",
"return",
"self",
".",
"_lutron_device",
".",
"state",
"==",
"OccupancyGroup",
".",
"State",
".",
"OCCUPIED"
] | [
34,
4
] | [
37,
73
] | python | en | ['en', 'fy', 'en'] | True |
LutronOccupancySensor.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
# The default LutronDevice naming would create 'Kitchen Occ Kitchen',
# but since there can only be one OccupancyGroup per area we go
# with something shorter.
return f"{self._area_name} Occupancy" | [
"def",
"name",
"(",
"self",
")",
":",
"# The default LutronDevice naming would create 'Kitchen Occ Kitchen',",
"# but since there can only be one OccupancyGroup per area we go",
"# with something shorter.",
"return",
"f\"{self._area_name} Occupancy\""
] | [
40,
4
] | [
45,
45
] | python | en | ['en', 'en', 'en'] | True |
LutronOccupancySensor.extra_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def extra_state_attributes(self):
"""Return the state attributes."""
return {"lutron_integration_id": self._lutron_device.id} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"\"lutron_integration_id\"",
":",
"self",
".",
"_lutron_device",
".",
"id",
"}"
] | [
48,
4
] | [
50,
64
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the vlc platform. | Set up the vlc platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the vlc platform."""
add_entities(
[VlcDevice(config.get(CONF_NAME, DEFAULT_NAME), config.get(CONF_ARGUMENTS))]
) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"add_entities",
"(",
"[",
"VlcDevice",
"(",
"config",
".",
"get",
"(",
"CONF_NAME",
",",
"DEFAULT_NAME",
")",
",",
"config",
".",
"get",... | [
42,
0
] | [
46,
5
] | python | en | ['en', 'da', 'en'] | True |
VlcDevice.__init__ | (self, name, arguments) | Initialize the vlc device. | Initialize the vlc device. | def __init__(self, name, arguments):
"""Initialize the vlc device."""
self._instance = vlc.Instance(arguments)
self._vlc = self._instance.media_player_new()
self._name = name
self._volume = None
self._muted = None
self._state = None
self._media_position_up... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"arguments",
")",
":",
"self",
".",
"_instance",
"=",
"vlc",
".",
"Instance",
"(",
"arguments",
")",
"self",
".",
"_vlc",
"=",
"self",
".",
"_instance",
".",
"media_player_new",
"(",
")",
"self",
".",
... | [
52,
4
] | [
62,
35
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.update | (self) | Get the latest details from the device. | Get the latest details from the device. | def update(self):
"""Get the latest details from the device."""
status = self._vlc.get_state()
if status == vlc.State.Playing:
self._state = STATE_PLAYING
elif status == vlc.State.Paused:
self._state = STATE_PAUSED
else:
self._state = STATE_IDL... | [
"def",
"update",
"(",
"self",
")",
":",
"status",
"=",
"self",
".",
"_vlc",
".",
"get_state",
"(",
")",
"if",
"status",
"==",
"vlc",
".",
"State",
".",
"Playing",
":",
"self",
".",
"_state",
"=",
"STATE_PLAYING",
"elif",
"status",
"==",
"vlc",
".",
... | [
64,
4
] | [
82,
19
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
85,
4
] | [
87,
25
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
90,
4
] | [
92,
26
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.volume_level | (self) | Volume level of the media player (0..1). | Volume level of the media player (0..1). | def volume_level(self):
"""Volume level of the media player (0..1)."""
return self._volume | [
"def",
"volume_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_volume"
] | [
95,
4
] | [
97,
27
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.is_volume_muted | (self) | Boolean if volume is currently muted. | Boolean if volume is currently muted. | def is_volume_muted(self):
"""Boolean if volume is currently muted."""
return self._muted | [
"def",
"is_volume_muted",
"(",
"self",
")",
":",
"return",
"self",
".",
"_muted"
] | [
100,
4
] | [
102,
26
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.supported_features | (self) | Flag media player features that are supported. | Flag media player features that are supported. | def supported_features(self):
"""Flag media player features that are supported."""
return SUPPORT_VLC | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_VLC"
] | [
105,
4
] | [
107,
26
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.media_content_type | (self) | Content type of current playing media. | Content type of current playing media. | def media_content_type(self):
"""Content type of current playing media."""
return MEDIA_TYPE_MUSIC | [
"def",
"media_content_type",
"(",
"self",
")",
":",
"return",
"MEDIA_TYPE_MUSIC"
] | [
110,
4
] | [
112,
31
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.media_duration | (self) | Duration of current playing media in seconds. | Duration of current playing media in seconds. | def media_duration(self):
"""Duration of current playing media in seconds."""
return self._media_duration | [
"def",
"media_duration",
"(",
"self",
")",
":",
"return",
"self",
".",
"_media_duration"
] | [
115,
4
] | [
117,
35
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.media_position | (self) | Position of current playing media in seconds. | Position of current playing media in seconds. | def media_position(self):
"""Position of current playing media in seconds."""
return self._media_position | [
"def",
"media_position",
"(",
"self",
")",
":",
"return",
"self",
".",
"_media_position"
] | [
120,
4
] | [
122,
35
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.media_position_updated_at | (self) | When was the position of the current playing media valid. | When was the position of the current playing media valid. | def media_position_updated_at(self):
"""When was the position of the current playing media valid."""
return self._media_position_updated_at | [
"def",
"media_position_updated_at",
"(",
"self",
")",
":",
"return",
"self",
".",
"_media_position_updated_at"
] | [
125,
4
] | [
127,
46
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.media_seek | (self, position) | Seek the media to a specific location. | Seek the media to a specific location. | def media_seek(self, position):
"""Seek the media to a specific location."""
track_length = self._vlc.get_length() / 1000
self._vlc.set_position(position / track_length) | [
"def",
"media_seek",
"(",
"self",
",",
"position",
")",
":",
"track_length",
"=",
"self",
".",
"_vlc",
".",
"get_length",
"(",
")",
"/",
"1000",
"self",
".",
"_vlc",
".",
"set_position",
"(",
"position",
"/",
"track_length",
")"
] | [
129,
4
] | [
132,
55
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.mute_volume | (self, mute) | Mute the volume. | Mute the volume. | def mute_volume(self, mute):
"""Mute the volume."""
self._vlc.audio_set_mute(mute)
self._muted = mute | [
"def",
"mute_volume",
"(",
"self",
",",
"mute",
")",
":",
"self",
".",
"_vlc",
".",
"audio_set_mute",
"(",
"mute",
")",
"self",
".",
"_muted",
"=",
"mute"
] | [
134,
4
] | [
137,
26
] | python | en | ['en', 'sn', 'en'] | True |
VlcDevice.set_volume_level | (self, volume) | Set volume level, range 0..1. | Set volume level, range 0..1. | def set_volume_level(self, volume):
"""Set volume level, range 0..1."""
self._vlc.audio_set_volume(int(volume * 100))
self._volume = volume | [
"def",
"set_volume_level",
"(",
"self",
",",
"volume",
")",
":",
"self",
".",
"_vlc",
".",
"audio_set_volume",
"(",
"int",
"(",
"volume",
"*",
"100",
")",
")",
"self",
".",
"_volume",
"=",
"volume"
] | [
139,
4
] | [
142,
29
] | python | en | ['fr', 'zu', 'en'] | False |
VlcDevice.media_play | (self) | Send play command. | Send play command. | def media_play(self):
"""Send play command."""
self._vlc.play()
self._state = STATE_PLAYING | [
"def",
"media_play",
"(",
"self",
")",
":",
"self",
".",
"_vlc",
".",
"play",
"(",
")",
"self",
".",
"_state",
"=",
"STATE_PLAYING"
] | [
144,
4
] | [
147,
35
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.media_pause | (self) | Send pause command. | Send pause command. | def media_pause(self):
"""Send pause command."""
self._vlc.pause()
self._state = STATE_PAUSED | [
"def",
"media_pause",
"(",
"self",
")",
":",
"self",
".",
"_vlc",
".",
"pause",
"(",
")",
"self",
".",
"_state",
"=",
"STATE_PAUSED"
] | [
149,
4
] | [
152,
34
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.media_stop | (self) | Send stop command. | Send stop command. | def media_stop(self):
"""Send stop command."""
self._vlc.stop()
self._state = STATE_IDLE | [
"def",
"media_stop",
"(",
"self",
")",
":",
"self",
".",
"_vlc",
".",
"stop",
"(",
")",
"self",
".",
"_state",
"=",
"STATE_IDLE"
] | [
154,
4
] | [
157,
32
] | python | en | ['en', 'en', 'en'] | True |
VlcDevice.play_media | (self, media_type, media_id, **kwargs) | Play media from a URL or file. | Play media from a URL or file. | def play_media(self, media_type, media_id, **kwargs):
"""Play media from a URL or file."""
if media_type != MEDIA_TYPE_MUSIC:
_LOGGER.error(
"Invalid media type %s. Only %s is supported",
media_type,
MEDIA_TYPE_MUSIC,
)
... | [
"def",
"play_media",
"(",
"self",
",",
"media_type",
",",
"media_id",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"media_type",
"!=",
"MEDIA_TYPE_MUSIC",
":",
"_LOGGER",
".",
"error",
"(",
"\"Invalid media type %s. Only %s is supported\"",
",",
"media_type",
",",
"... | [
159,
4
] | [
170,
35
] | python | en | ['en', 'en', 'en'] | True |
TestUsageApi.test_any_key | (self) | Test case for any_key
Use any API key # noqa: E501
| Test case for any_key | def test_any_key(self):
"""Test case for any_key
Use any API key # noqa: E501
"""
pass | [
"def",
"test_any_key",
"(",
"self",
")",
":",
"pass"
] | [
27,
4
] | [
32,
12
] | python | en | ['en', 'en', 'en'] | True |
TestUsageApi.test_both_keys | (self) | Test case for both_keys
Use both API keys # noqa: E501
| Test case for both_keys | def test_both_keys(self):
"""Test case for both_keys
Use both API keys # noqa: E501
"""
pass | [
"def",
"test_both_keys",
"(",
"self",
")",
":",
"pass"
] | [
34,
4
] | [
39,
12
] | python | en | ['en', 'no', 'en'] | True |
TestUsageApi.test_key_in_header | (self) | Test case for key_in_header
Use API key in header # noqa: E501
| Test case for key_in_header | def test_key_in_header(self):
"""Test case for key_in_header
Use API key in header # noqa: E501
"""
pass | [
"def",
"test_key_in_header",
"(",
"self",
")",
":",
"pass"
] | [
41,
4
] | [
46,
12
] | python | en | ['en', 'da', 'en'] | True |
TestUsageApi.test_key_in_query | (self) | Test case for key_in_query
Use API key in query # noqa: E501
| Test case for key_in_query | def test_key_in_query(self):
"""Test case for key_in_query
Use API key in query # noqa: E501
"""
pass | [
"def",
"test_key_in_query",
"(",
"self",
")",
":",
"pass"
] | [
48,
4
] | [
53,
12
] | python | en | ['en', 'en', 'en'] | True |
test_setup_success | (hass, caplog) | Test successful setup. | Test successful setup. | async def test_setup_success(hass, caplog):
"""Test successful setup."""
with caplog.at_level(logging.ERROR, logger="homeassistant.components.nest"):
await async_setup_sdm_platform(hass, PLATFORM)
assert not caplog.records
entries = hass.config_entries.async_entries(DOMAIN)
assert len(e... | [
"async",
"def",
"test_setup_success",
"(",
"hass",
",",
"caplog",
")",
":",
"with",
"caplog",
".",
"at_level",
"(",
"logging",
".",
"ERROR",
",",
"logger",
"=",
"\"homeassistant.components.nest\"",
")",
":",
"await",
"async_setup_sdm_platform",
"(",
"hass",
",",... | [
21,
0
] | [
29,
54
] | python | en | ['en', 'ro', 'en'] | True |
async_setup_sdm | (hass, config=CONFIG) | Prepare test setup. | Prepare test setup. | async def async_setup_sdm(hass, config=CONFIG):
"""Prepare test setup."""
create_config_entry(hass)
with patch(
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation"
):
return await async_setup_component(hass, DOMAIN, config) | [
"async",
"def",
"async_setup_sdm",
"(",
"hass",
",",
"config",
"=",
"CONFIG",
")",
":",
"create_config_entry",
"(",
"hass",
")",
"with",
"patch",
"(",
"\"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation\"",
")",
":",
"return",
"await",
... | [
32,
0
] | [
38,
64
] | python | en | ['en', 'bs', 'en'] | True |
test_setup_configuration_failure | (hass, caplog) | Test configuration error. | Test configuration error. | async def test_setup_configuration_failure(hass, caplog):
"""Test configuration error."""
config = CONFIG.copy()
config[DOMAIN]["subscriber_id"] = "invalid-subscriber-format"
result = await async_setup_sdm(hass, config)
assert result
entries = hass.config_entries.async_entries(DOMAIN)
asse... | [
"async",
"def",
"test_setup_configuration_failure",
"(",
"hass",
",",
"caplog",
")",
":",
"config",
"=",
"CONFIG",
".",
"copy",
"(",
")",
"config",
"[",
"DOMAIN",
"]",
"[",
"\"subscriber_id\"",
"]",
"=",
"\"invalid-subscriber-format\"",
"result",
"=",
"await",
... | [
41,
0
] | [
55,
78
] | python | en | ['eu', 'la', 'en'] | False |
test_setup_susbcriber_failure | (hass, caplog) | Test configuration error. | Test configuration error. | async def test_setup_susbcriber_failure(hass, caplog):
"""Test configuration error."""
with patch(
"homeassistant.components.nest.GoogleNestSubscriber.start_async",
side_effect=GoogleNestException(),
), caplog.at_level(logging.ERROR, logger="homeassistant.components.nest"):
result = ... | [
"async",
"def",
"test_setup_susbcriber_failure",
"(",
"hass",
",",
"caplog",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.nest.GoogleNestSubscriber.start_async\"",
",",
"side_effect",
"=",
"GoogleNestException",
"(",
")",
",",
")",
",",
"caplog",
".",
"... | [
58,
0
] | [
70,
59
] | python | en | ['eu', 'la', 'en'] | False |
test_setup_device_manager_failure | (hass, caplog) | Test configuration error. | Test configuration error. | async def test_setup_device_manager_failure(hass, caplog):
"""Test configuration error."""
with patch("homeassistant.components.nest.GoogleNestSubscriber.start_async"), patch(
"homeassistant.components.nest.GoogleNestSubscriber.async_get_device_manager",
side_effect=GoogleNestException(),
),... | [
"async",
"def",
"test_setup_device_manager_failure",
"(",
"hass",
",",
"caplog",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.nest.GoogleNestSubscriber.start_async\"",
")",
",",
"patch",
"(",
"\"homeassistant.components.nest.GoogleNestSubscriber.async_get_device_mana... | [
73,
0
] | [
86,
59
] | python | en | ['eu', 'la', 'en'] | False |
test_subscriber_auth_failure | (hass, caplog) | Test configuration error. | Test configuration error. | async def test_subscriber_auth_failure(hass, caplog):
"""Test configuration error."""
with patch(
"homeassistant.components.nest.GoogleNestSubscriber.start_async",
side_effect=AuthException(),
):
result = await async_setup_sdm(hass, CONFIG)
assert result
entries = hass.c... | [
"async",
"def",
"test_subscriber_auth_failure",
"(",
"hass",
",",
"caplog",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.nest.GoogleNestSubscriber.start_async\"",
",",
"side_effect",
"=",
"AuthException",
"(",
")",
",",
")",
":",
"result",
"=",
"await",... | [
89,
0
] | [
104,
50
] | python | en | ['eu', 'la', 'en'] | False |
test_setup_missing_subscriber_id | (hass, caplog) | Test successful setup. | Test successful setup. | async def test_setup_missing_subscriber_id(hass, caplog):
"""Test successful setup."""
config = CONFIG
del config[DOMAIN]["subscriber_id"]
with caplog.at_level(logging.ERROR, logger="homeassistant.components.nest"):
result = await async_setup_sdm(hass, config)
assert not result
a... | [
"async",
"def",
"test_setup_missing_subscriber_id",
"(",
"hass",
",",
"caplog",
")",
":",
"config",
"=",
"CONFIG",
"del",
"config",
"[",
"DOMAIN",
"]",
"[",
"\"subscriber_id\"",
"]",
"with",
"caplog",
".",
"at_level",
"(",
"logging",
".",
"ERROR",
",",
"logg... | [
107,
0
] | [
118,
58
] | python | en | ['en', 'ro', 'en'] | True |
test_empty_config | (hass, caplog) | Test successful setup. | Test successful setup. | async def test_empty_config(hass, caplog):
"""Test successful setup."""
with caplog.at_level(logging.ERROR, logger="homeassistant.components.nest"):
result = await async_setup_component(hass, DOMAIN, {})
assert result
assert not caplog.records
entries = hass.config_entries.async_ent... | [
"async",
"def",
"test_empty_config",
"(",
"hass",
",",
"caplog",
")",
":",
"with",
"caplog",
".",
"at_level",
"(",
"logging",
".",
"ERROR",
",",
"logger",
"=",
"\"homeassistant.components.nest\"",
")",
":",
"result",
"=",
"await",
"async_setup_component",
"(",
... | [
121,
0
] | [
129,
28
] | python | en | ['en', 'ro', 'en'] | True |
test_platform_manually_configured | (hass) | Test that nothing happens when platform is manually configured. | Test that nothing happens when platform is manually configured. | async def test_platform_manually_configured(hass):
"""Test that nothing happens when platform is manually configured."""
assert await async_setup_component(
hass, LIGHT_DOMAIN, {LIGHT_DOMAIN: {"platform": AXIS_DOMAIN}}
)
assert AXIS_DOMAIN not in hass.data | [
"async",
"def",
"test_platform_manually_configured",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"LIGHT_DOMAIN",
",",
"{",
"LIGHT_DOMAIN",
":",
"{",
"\"platform\"",
":",
"AXIS_DOMAIN",
"}",
"}",
")",
"assert",
"AXIS_DOMAIN"... | [
30,
0
] | [
36,
39
] | python | en | ['en', 'en', 'en'] | True |
test_no_lights | (hass) | Test that no light events in Axis results in no light entities. | Test that no light events in Axis results in no light entities. | async def test_no_lights(hass):
"""Test that no light events in Axis results in no light entities."""
await setup_axis_integration(hass)
assert not hass.states.async_entity_ids(LIGHT_DOMAIN) | [
"async",
"def",
"test_no_lights",
"(",
"hass",
")",
":",
"await",
"setup_axis_integration",
"(",
"hass",
")",
"assert",
"not",
"hass",
".",
"states",
".",
"async_entity_ids",
"(",
"LIGHT_DOMAIN",
")"
] | [
39,
0
] | [
43,
57
] | python | en | ['en', 'en', 'en'] | True |
test_no_light_entity_without_light_control_representation | (
hass, mock_rtsp_event
) | Verify no lights entities get created without light control representation. | Verify no lights entities get created without light control representation. | async def test_no_light_entity_without_light_control_representation(
hass, mock_rtsp_event
):
"""Verify no lights entities get created without light control representation."""
api_discovery = deepcopy(API_DISCOVERY_RESPONSE)
api_discovery["data"]["apiList"].append(API_DISCOVERY_LIGHT_CONTROL)
light... | [
"async",
"def",
"test_no_light_entity_without_light_control_representation",
"(",
"hass",
",",
"mock_rtsp_event",
")",
":",
"api_discovery",
"=",
"deepcopy",
"(",
"API_DISCOVERY_RESPONSE",
")",
"api_discovery",
"[",
"\"data\"",
"]",
"[",
"\"apiList\"",
"]",
".",
"append... | [
46,
0
] | [
70,
57
] | python | en | ['en', 'en', 'en'] | True |
test_lights | (hass, mock_rtsp_event) | Test that lights are loaded properly. | Test that lights are loaded properly. | async def test_lights(hass, mock_rtsp_event):
"""Test that lights are loaded properly."""
api_discovery = deepcopy(API_DISCOVERY_RESPONSE)
api_discovery["data"]["apiList"].append(API_DISCOVERY_LIGHT_CONTROL)
with patch.dict(API_DISCOVERY_RESPONSE, api_discovery):
await setup_axis_integration(ha... | [
"async",
"def",
"test_lights",
"(",
"hass",
",",
"mock_rtsp_event",
")",
":",
"api_discovery",
"=",
"deepcopy",
"(",
"API_DISCOVERY_RESPONSE",
")",
"api_discovery",
"[",
"\"data\"",
"]",
"[",
"\"apiList\"",
"]",
".",
"append",
"(",
"API_DISCOVERY_LIGHT_CONTROL",
"... | [
73,
0
] | [
183,
43
] | python | en | ['en', 'en', 'en'] | True |
cli | (ctx, organism_id="", genus="", species="", common="", abbr="", comment="") | Delete all organisms
Output:
None
| Delete all organisms | def cli(ctx, organism_id="", genus="", species="", common="", abbr="", comment=""):
"""Delete all organisms
Output:
None
"""
return ctx.gi.organism.delete_organisms(organism_id=organism_id, genus=genus, species=species, common=common, abbr=abbr, comment=comment) | [
"def",
"cli",
"(",
"ctx",
",",
"organism_id",
"=",
"\"\"",
",",
"genus",
"=",
"\"\"",
",",
"species",
"=",
"\"\"",
",",
"common",
"=",
"\"\"",
",",
"abbr",
"=",
"\"\"",
",",
"comment",
"=",
"\"\"",
")",
":",
"return",
"ctx",
".",
"gi",
".",
"orga... | [
39,
0
] | [
46,
141
] | python | en | ['en', 'en', 'en'] | True |
test_set_auto_configuration | (isfile_mock, read_systemid_file_mock, open_mock, set_auto_configuration_mock) |
set_auto_configuration_mock is called with correct arguments.
|
set_auto_configuration_mock is called with correct arguments.
| def test_set_auto_configuration(isfile_mock, read_systemid_file_mock, open_mock, set_auto_configuration_mock):
"""
set_auto_configuration_mock is called with correct arguments.
"""
config_mock = Mock()
_try_satellite5_configuration(config_mock)
set_auto_configuration_mock.assert_called_once_with... | [
"def",
"test_set_auto_configuration",
"(",
"isfile_mock",
",",
"read_systemid_file_mock",
",",
"open_mock",
",",
"set_auto_configuration_mock",
")",
":",
"config_mock",
"=",
"Mock",
"(",
")",
"_try_satellite5_configuration",
"(",
"config_mock",
")",
"set_auto_configuration_... | [
10,
0
] | [
21,
62
] | python | en | ['en', 'error', 'th'] | False |
Command.__init__ | (self, dist) | Create and initialize a new Command object. Most importantly,
invokes the 'initialize_options()' method, which is the real
initializer and depends on the actual command being
instantiated.
| Create and initialize a new Command object. Most importantly,
invokes the 'initialize_options()' method, which is the real
initializer and depends on the actual command being
instantiated.
| def __init__(self, dist):
"""Create and initialize a new Command object. Most importantly,
invokes the 'initialize_options()' method, which is the real
initializer and depends on the actual command being
instantiated.
"""
# late import because of mutual dependence betwee... | [
"def",
"__init__",
"(",
"self",
",",
"dist",
")",
":",
"# late import because of mutual dependence between these classes",
"from",
"distutils",
".",
"dist",
"import",
"Distribution",
"if",
"not",
"isinstance",
"(",
"dist",
",",
"Distribution",
")",
":",
"raise",
"Ty... | [
46,
4
] | [
91,
26
] | python | en | ['en', 'en', 'en'] | True |
Command.initialize_options | (self) | Set default values for all the options that this command
supports. Note that these defaults may be overridden by other
commands, by the setup script, by config files, or by the
command-line. Thus, this is not the place to code dependencies
between options; generally, 'initialize_option... | Set default values for all the options that this command
supports. Note that these defaults may be overridden by other
commands, by the setup script, by config files, or by the
command-line. Thus, this is not the place to code dependencies
between options; generally, 'initialize_option... | def initialize_options(self):
"""Set default values for all the options that this command
supports. Note that these defaults may be overridden by other
commands, by the setup script, by config files, or by the
command-line. Thus, this is not the place to code dependencies
betwe... | [
"def",
"initialize_options",
"(",
"self",
")",
":",
"raise",
"RuntimeError",
"(",
"\"abstract method -- subclass %s must override\"",
"%",
"self",
".",
"__class__",
")"
] | [
122,
4
] | [
133,
44
] | python | en | ['en', 'en', 'en'] | True |
Command.finalize_options | (self) | Set final values for all the options that this command supports.
This is always called as late as possible, ie. after any option
assignments from the command-line or from other commands have been
done. Thus, this is the place to code option dependencies: if
'foo' depends on 'bar', then... | Set final values for all the options that this command supports.
This is always called as late as possible, ie. after any option
assignments from the command-line or from other commands have been
done. Thus, this is the place to code option dependencies: if
'foo' depends on 'bar', then... | def finalize_options(self):
"""Set final values for all the options that this command supports.
This is always called as late as possible, ie. after any option
assignments from the command-line or from other commands have been
done. Thus, this is the place to code option dependencies: ... | [
"def",
"finalize_options",
"(",
"self",
")",
":",
"raise",
"RuntimeError",
"(",
"\"abstract method -- subclass %s must override\"",
"%",
"self",
".",
"__class__",
")"
] | [
135,
4
] | [
147,
44
] | python | en | ['en', 'en', 'en'] | True |
Command.run | (self) | A command's raison d'etre: carry out the action it exists to
perform, controlled by the options initialized in
'initialize_options()', customized by other commands, the setup
script, the command-line, and config files, and finalized in
'finalize_options()'. All terminal output and files... | A command's raison d'etre: carry out the action it exists to
perform, controlled by the options initialized in
'initialize_options()', customized by other commands, the setup
script, the command-line, and config files, and finalized in
'finalize_options()'. All terminal output and files... | def run(self):
"""A command's raison d'etre: carry out the action it exists to
perform, controlled by the options initialized in
'initialize_options()', customized by other commands, the setup
script, the command-line, and config files, and finalized in
'finalize_options()'. All... | [
"def",
"run",
"(",
"self",
")",
":",
"raise",
"RuntimeError",
"(",
"\"abstract method -- subclass %s must override\"",
"%",
"self",
".",
"__class__",
")"
] | [
164,
4
] | [
175,
44
] | python | en | ['en', 'fr', 'en'] | True |
Command.announce | (self, msg, level=1) | If the current verbosity level is of greater than or equal to
'level' print 'msg' to stdout.
| If the current verbosity level is of greater than or equal to
'level' print 'msg' to stdout.
| def announce(self, msg, level=1):
"""If the current verbosity level is of greater than or equal to
'level' print 'msg' to stdout.
"""
log.log(level, msg) | [
"def",
"announce",
"(",
"self",
",",
"msg",
",",
"level",
"=",
"1",
")",
":",
"log",
".",
"log",
"(",
"level",
",",
"msg",
")"
] | [
177,
4
] | [
181,
27
] | python | en | ['en', 'en', 'en'] | True |
Command.debug_print | (self, msg) | Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
| Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
| def debug_print(self, msg):
"""Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
"""
from distutils.debug import DEBUG
if DEBUG:
print(msg)
sys.stdout.flush() | [
"def",
"debug_print",
"(",
"self",
",",
"msg",
")",
":",
"from",
"distutils",
".",
"debug",
"import",
"DEBUG",
"if",
"DEBUG",
":",
"print",
"(",
"msg",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")"
] | [
183,
4
] | [
190,
30
] | python | en | ['en', 'en', 'en'] | True |
Command.ensure_string | (self, option, default=None) | Ensure that 'option' is a string; if not defined, set it to
'default'.
| Ensure that 'option' is a string; if not defined, set it to
'default'.
| def ensure_string(self, option, default=None):
"""Ensure that 'option' is a string; if not defined, set it to
'default'.
"""
self._ensure_stringlike(option, "string", default) | [
"def",
"ensure_string",
"(",
"self",
",",
"option",
",",
"default",
"=",
"None",
")",
":",
"self",
".",
"_ensure_stringlike",
"(",
"option",
",",
"\"string\"",
",",
"default",
")"
] | [
216,
4
] | [
220,
58
] | python | en | ['en', 'en', 'en'] | True |
Command.ensure_string_list | (self, option) | r"""Ensure that 'option' is a list of strings. If 'option' is
currently a string, we split it either on /,\s*/ or /\s+/, so
"foo bar baz", "foo,bar,baz", and "foo, bar baz" all become
["foo", "bar", "baz"].
| r"""Ensure that 'option' is a list of strings. If 'option' is
currently a string, we split it either on /,\s*/ or /\s+/, so
"foo bar baz", "foo,bar,baz", and "foo, bar baz" all become
["foo", "bar", "baz"].
| def ensure_string_list(self, option):
r"""Ensure that 'option' is a list of strings. If 'option' is
currently a string, we split it either on /,\s*/ or /\s+/, so
"foo bar baz", "foo,bar,baz", and "foo, bar baz" all become
["foo", "bar", "baz"].
"""
val = getattr(self, ... | [
"def",
"ensure_string_list",
"(",
"self",
",",
"option",
")",
":",
"val",
"=",
"getattr",
"(",
"self",
",",
"option",
")",
"if",
"val",
"is",
"None",
":",
"return",
"elif",
"isinstance",
"(",
"val",
",",
"str",
")",
":",
"setattr",
"(",
"self",
",",
... | [
222,
4
] | [
241,
38
] | python | en | ['en', 'en', 'en'] | True |
Command.ensure_filename | (self, option) | Ensure that 'option' is the name of an existing file. | Ensure that 'option' is the name of an existing file. | def ensure_filename(self, option):
"""Ensure that 'option' is the name of an existing file."""
self._ensure_tested_string(option, os.path.isfile,
"filename",
"'%s' does not exist or is not a file") | [
"def",
"ensure_filename",
"(",
"self",
",",
"option",
")",
":",
"self",
".",
"_ensure_tested_string",
"(",
"option",
",",
"os",
".",
"path",
".",
"isfile",
",",
"\"filename\"",
",",
"\"'%s' does not exist or is not a file\"",
")"
] | [
250,
4
] | [
254,
74
] | python | en | ['en', 'en', 'en'] | True |
Command.set_undefined_options | (self, src_cmd, *option_pairs) | Set the values of any "undefined" options from corresponding
option values in some other command object. "Undefined" here means
"is None", which is the convention used to indicate that an option
has not been changed between 'initialize_options()' and
'finalize_options()'. Usually calle... | Set the values of any "undefined" options from corresponding
option values in some other command object. "Undefined" here means
"is None", which is the convention used to indicate that an option
has not been changed between 'initialize_options()' and
'finalize_options()'. Usually calle... | def set_undefined_options(self, src_cmd, *option_pairs):
"""Set the values of any "undefined" options from corresponding
option values in some other command object. "Undefined" here means
"is None", which is the convention used to indicate that an option
has not been changed between 'in... | [
"def",
"set_undefined_options",
"(",
"self",
",",
"src_cmd",
",",
"*",
"option_pairs",
")",
":",
"# Option_pairs: list of (src_option, dst_option) tuples",
"src_cmd_obj",
"=",
"self",
".",
"distribution",
".",
"get_command_obj",
"(",
"src_cmd",
")",
"src_cmd_obj",
".",
... | [
270,
4
] | [
289,
75
] | python | en | ['en', 'en', 'en'] | True |
Command.get_finalized_command | (self, command, create=1) | Wrapper around Distribution's 'get_command_obj()' method: find
(create if necessary and 'create' is true) the command object for
'command', call its 'ensure_finalized()' method, and return the
finalized command object.
| Wrapper around Distribution's 'get_command_obj()' method: find
(create if necessary and 'create' is true) the command object for
'command', call its 'ensure_finalized()' method, and return the
finalized command object.
| def get_finalized_command(self, command, create=1):
"""Wrapper around Distribution's 'get_command_obj()' method: find
(create if necessary and 'create' is true) the command object for
'command', call its 'ensure_finalized()' method, and return the
finalized command object.
"""
... | [
"def",
"get_finalized_command",
"(",
"self",
",",
"command",
",",
"create",
"=",
"1",
")",
":",
"cmd_obj",
"=",
"self",
".",
"distribution",
".",
"get_command_obj",
"(",
"command",
",",
"create",
")",
"cmd_obj",
".",
"ensure_finalized",
"(",
")",
"return",
... | [
291,
4
] | [
299,
22
] | python | en | ['en', 'de', 'en'] | True |
Command.run_command | (self, command) | Run some other command: uses the 'run_command()' method of
Distribution, which creates and finalizes the command object if
necessary and then invokes its 'run()' method.
| Run some other command: uses the 'run_command()' method of
Distribution, which creates and finalizes the command object if
necessary and then invokes its 'run()' method.
| def run_command(self, command):
"""Run some other command: uses the 'run_command()' method of
Distribution, which creates and finalizes the command object if
necessary and then invokes its 'run()' method.
"""
self.distribution.run_command(command) | [
"def",
"run_command",
"(",
"self",
",",
"command",
")",
":",
"self",
".",
"distribution",
".",
"run_command",
"(",
"command",
")"
] | [
307,
4
] | [
312,
46
] | python | en | ['en', 'en', 'en'] | True |
Command.get_sub_commands | (self) | Determine the sub-commands that are relevant in the current
distribution (ie., that need to be run). This is based on the
'sub_commands' class attribute: each tuple in that list may include
a method that we call to determine if the subcommand needs to be
run for the current distribution... | Determine the sub-commands that are relevant in the current
distribution (ie., that need to be run). This is based on the
'sub_commands' class attribute: each tuple in that list may include
a method that we call to determine if the subcommand needs to be
run for the current distribution... | def get_sub_commands(self):
"""Determine the sub-commands that are relevant in the current
distribution (ie., that need to be run). This is based on the
'sub_commands' class attribute: each tuple in that list may include
a method that we call to determine if the subcommand needs to be
... | [
"def",
"get_sub_commands",
"(",
"self",
")",
":",
"commands",
"=",
"[",
"]",
"for",
"(",
"cmd_name",
",",
"method",
")",
"in",
"self",
".",
"sub_commands",
":",
"if",
"method",
"is",
"None",
"or",
"method",
"(",
"self",
")",
":",
"commands",
".",
"ap... | [
314,
4
] | [
325,
23
] | python | en | ['en', 'en', 'en'] | True |
Command.copy_file | (self, infile, outfile, preserve_mode=1, preserve_times=1,
link=None, level=1) | Copy a file respecting verbose, dry-run and force flags. (The
former two default to whatever is in the Distribution object, and
the latter defaults to false for commands that don't define it.) | Copy a file respecting verbose, dry-run and force flags. (The
former two default to whatever is in the Distribution object, and
the latter defaults to false for commands that don't define it.) | def copy_file(self, infile, outfile, preserve_mode=1, preserve_times=1,
link=None, level=1):
"""Copy a file respecting verbose, dry-run and force flags. (The
former two default to whatever is in the Distribution object, and
the latter defaults to false for commands that don't ... | [
"def",
"copy_file",
"(",
"self",
",",
"infile",
",",
"outfile",
",",
"preserve_mode",
"=",
"1",
",",
"preserve_times",
"=",
"1",
",",
"link",
"=",
"None",
",",
"level",
"=",
"1",
")",
":",
"return",
"file_util",
".",
"copy_file",
"(",
"infile",
",",
... | [
339,
4
] | [
346,
56
] | python | en | ['en', 'en', 'en'] | True |
Command.copy_tree | (self, infile, outfile, preserve_mode=1, preserve_times=1,
preserve_symlinks=0, level=1) | Copy an entire directory tree respecting verbose, dry-run,
and force flags.
| Copy an entire directory tree respecting verbose, dry-run,
and force flags.
| def copy_tree(self, infile, outfile, preserve_mode=1, preserve_times=1,
preserve_symlinks=0, level=1):
"""Copy an entire directory tree respecting verbose, dry-run,
and force flags.
"""
return dir_util.copy_tree(infile, outfile, preserve_mode,
... | [
"def",
"copy_tree",
"(",
"self",
",",
"infile",
",",
"outfile",
",",
"preserve_mode",
"=",
"1",
",",
"preserve_times",
"=",
"1",
",",
"preserve_symlinks",
"=",
"0",
",",
"level",
"=",
"1",
")",
":",
"return",
"dir_util",
".",
"copy_tree",
"(",
"infile",
... | [
348,
4
] | [
355,
71
] | python | en | ['en', 'en', 'en'] | True |
Command.move_file | (self, src, dst, level=1) | Move a file respecting dry-run flag. | Move a file respecting dry-run flag. | def move_file (self, src, dst, level=1):
"""Move a file respecting dry-run flag."""
return file_util.move_file(src, dst, dry_run=self.dry_run) | [
"def",
"move_file",
"(",
"self",
",",
"src",
",",
"dst",
",",
"level",
"=",
"1",
")",
":",
"return",
"file_util",
".",
"move_file",
"(",
"src",
",",
"dst",
",",
"dry_run",
"=",
"self",
".",
"dry_run",
")"
] | [
357,
4
] | [
359,
66
] | python | en | ['id', 'en', 'en'] | True |
Command.spawn | (self, cmd, search_path=1, level=1) | Spawn an external command respecting dry-run flag. | Spawn an external command respecting dry-run flag. | def spawn(self, cmd, search_path=1, level=1):
"""Spawn an external command respecting dry-run flag."""
from distutils.spawn import spawn
spawn(cmd, search_path, dry_run=self.dry_run) | [
"def",
"spawn",
"(",
"self",
",",
"cmd",
",",
"search_path",
"=",
"1",
",",
"level",
"=",
"1",
")",
":",
"from",
"distutils",
".",
"spawn",
"import",
"spawn",
"spawn",
"(",
"cmd",
",",
"search_path",
",",
"dry_run",
"=",
"self",
".",
"dry_run",
")"
] | [
361,
4
] | [
364,
53
] | python | en | ['en', 'lb', 'en'] | True |
Command.make_file | (self, infiles, outfile, func, args,
exec_msg=None, skip_msg=None, level=1) | Special case of 'execute()' for operations that process one or
more input files and generate one output file. Works just like
'execute()', except the operation is skipped and a different
message printed if 'outfile' already exists and is newer than all
files listed in 'infiles'. If the... | Special case of 'execute()' for operations that process one or
more input files and generate one output file. Works just like
'execute()', except the operation is skipped and a different
message printed if 'outfile' already exists and is newer than all
files listed in 'infiles'. If the... | def make_file(self, infiles, outfile, func, args,
exec_msg=None, skip_msg=None, level=1):
"""Special case of 'execute()' for operations that process one or
more input files and generate one output file. Works just like
'execute()', except the operation is skipped and a differe... | [
"def",
"make_file",
"(",
"self",
",",
"infiles",
",",
"outfile",
",",
"func",
",",
"args",
",",
"exec_msg",
"=",
"None",
",",
"skip_msg",
"=",
"None",
",",
"level",
"=",
"1",
")",
":",
"if",
"skip_msg",
"is",
"None",
":",
"skip_msg",
"=",
"\"skipping... | [
372,
4
] | [
402,
31
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the iGlo lights. | Set up the iGlo lights. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the iGlo lights."""
host = config.get(CONF_HOST)
name = config.get(CONF_NAME)
port = config.get(CONF_PORT)
add_entities([IGloLamp(name, host, port)], True) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"host",
"=",
"config",
".",
"get",
"(",
"CONF_HOST",
")",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"port",
"=",
"co... | [
34,
0
] | [
39,
52
] | python | en | ['en', 'haw', 'en'] | True |
IGloLamp.__init__ | (self, name, host, port) | Initialize the light. | Initialize the light. | def __init__(self, name, host, port):
"""Initialize the light."""
self._name = name
self._lamp = Lamp(0, host, port) | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"host",
",",
"port",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_lamp",
"=",
"Lamp",
"(",
"0",
",",
"host",
",",
"port",
")"
] | [
45,
4
] | [
49,
40
] | python | en | ['en', 'en', 'en'] | True |
IGloLamp.name | (self) | Return the name of the light. | Return the name of the light. | def name(self):
"""Return the name of the light."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
52,
4
] | [
54,
25
] | python | en | ['en', 'en', 'en'] | True |
IGloLamp.brightness | (self) | Return the brightness of this light between 0..255. | Return the brightness of this light between 0..255. | def brightness(self):
"""Return the brightness of this light between 0..255."""
return int((self._lamp.state()["brightness"] / 200.0) * 255) | [
"def",
"brightness",
"(",
"self",
")",
":",
"return",
"int",
"(",
"(",
"self",
".",
"_lamp",
".",
"state",
"(",
")",
"[",
"\"brightness\"",
"]",
"/",
"200.0",
")",
"*",
"255",
")"
] | [
57,
4
] | [
59,
68
] | python | en | ['en', 'en', 'en'] | True |
IGloLamp.color_temp | (self) | Return the color temperature. | Return the color temperature. | def color_temp(self):
"""Return the color temperature."""
return color_util.color_temperature_kelvin_to_mired(self._lamp.state()["white"]) | [
"def",
"color_temp",
"(",
"self",
")",
":",
"return",
"color_util",
".",
"color_temperature_kelvin_to_mired",
"(",
"self",
".",
"_lamp",
".",
"state",
"(",
")",
"[",
"\"white\"",
"]",
")"
] | [
62,
4
] | [
64,
88
] | python | en | ['en', 'la', 'en'] | True |
IGloLamp.min_mireds | (self) | Return the coldest color_temp that this light supports. | Return the coldest color_temp that this light supports. | def min_mireds(self):
"""Return the coldest color_temp that this light supports."""
return math.ceil(
color_util.color_temperature_kelvin_to_mired(self._lamp.max_kelvin)
) | [
"def",
"min_mireds",
"(",
"self",
")",
":",
"return",
"math",
".",
"ceil",
"(",
"color_util",
".",
"color_temperature_kelvin_to_mired",
"(",
"self",
".",
"_lamp",
".",
"max_kelvin",
")",
")"
] | [
67,
4
] | [
71,
9
] | python | en | ['en', 'en', 'en'] | True |
IGloLamp.max_mireds | (self) | Return the warmest color_temp that this light supports. | Return the warmest color_temp that this light supports. | def max_mireds(self):
"""Return the warmest color_temp that this light supports."""
return math.ceil(
color_util.color_temperature_kelvin_to_mired(self._lamp.min_kelvin)
) | [
"def",
"max_mireds",
"(",
"self",
")",
":",
"return",
"math",
".",
"ceil",
"(",
"color_util",
".",
"color_temperature_kelvin_to_mired",
"(",
"self",
".",
"_lamp",
".",
"min_kelvin",
")",
")"
] | [
74,
4
] | [
78,
9
] | python | en | ['en', 'en', 'en'] | True |
IGloLamp.hs_color | (self) | Return the hs value. | Return the hs value. | def hs_color(self):
"""Return the hs value."""
return color_util.color_RGB_to_hs(*self._lamp.state()["rgb"]) | [
"def",
"hs_color",
"(",
"self",
")",
":",
"return",
"color_util",
".",
"color_RGB_to_hs",
"(",
"*",
"self",
".",
"_lamp",
".",
"state",
"(",
")",
"[",
"\"rgb\"",
"]",
")"
] | [
81,
4
] | [
83,
69
] | python | en | ['en', 'en', 'en'] | True |
IGloLamp.effect | (self) | Return the current effect. | Return the current effect. | def effect(self):
"""Return the current effect."""
return self._lamp.state()["effect"] | [
"def",
"effect",
"(",
"self",
")",
":",
"return",
"self",
".",
"_lamp",
".",
"state",
"(",
")",
"[",
"\"effect\"",
"]"
] | [
86,
4
] | [
88,
43
] | python | en | ['en', 'en', 'en'] | True |
IGloLamp.effect_list | (self) | Return the list of supported effects. | Return the list of supported effects. | def effect_list(self):
"""Return the list of supported effects."""
return self._lamp.effect_list() | [
"def",
"effect_list",
"(",
"self",
")",
":",
"return",
"self",
".",
"_lamp",
".",
"effect_list",
"(",
")"
] | [
91,
4
] | [
93,
39
] | python | en | ['en', 'en', 'en'] | True |
IGloLamp.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_COLOR | SUPPORT_EFFECT | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_BRIGHTNESS",
"|",
"SUPPORT_COLOR_TEMP",
"|",
"SUPPORT_COLOR",
"|",
"SUPPORT_EFFECT"
] | [
96,
4
] | [
98,
87
] | python | en | ['da', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.