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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test_humidity_change_humidifier_trigger_on_long_enough | (hass, setup_comp_6) | Test if humidity change turn humidifier on after min cycle. | Test if humidity change turn humidifier on after min cycle. | async def test_humidity_change_humidifier_trigger_on_long_enough(hass, setup_comp_6):
"""Test if humidity change turn humidifier on after min cycle."""
fake_changed = datetime.datetime(
1918, 11, 11, 11, 11, 11, tzinfo=datetime.timezone.utc
)
with patch(
"homeassistant.helpers.condition.... | [
"async",
"def",
"test_humidity_change_humidifier_trigger_on_long_enough",
"(",
"hass",
",",
"setup_comp_6",
")",
":",
"fake_changed",
"=",
"datetime",
".",
"datetime",
"(",
"1918",
",",
"11",
",",
"11",
",",
"11",
",",
"11",
",",
"11",
",",
"tzinfo",
"=",
"d... | [
966,
0
] | [
985,
47
] | python | en | ['en', 'en', 'en'] | True |
test_humidity_change_humidifier_trigger_off_long_enough | (hass, setup_comp_6) | Test if humidity change turn humidifier off after min cycle. | Test if humidity change turn humidifier off after min cycle. | async def test_humidity_change_humidifier_trigger_off_long_enough(hass, setup_comp_6):
"""Test if humidity change turn humidifier off after min cycle."""
fake_changed = datetime.datetime(
1918, 11, 11, 11, 11, 11, tzinfo=datetime.timezone.utc
)
with patch(
"homeassistant.helpers.conditio... | [
"async",
"def",
"test_humidity_change_humidifier_trigger_off_long_enough",
"(",
"hass",
",",
"setup_comp_6",
")",
":",
"fake_changed",
"=",
"datetime",
".",
"datetime",
"(",
"1918",
",",
"11",
",",
"11",
",",
"11",
",",
"11",
",",
"11",
",",
"tzinfo",
"=",
"... | [
988,
0
] | [
1007,
47
] | python | en | ['en', 'en', 'en'] | True |
test_mode_change_humidifier_trigger_off_not_long_enough | (hass, setup_comp_6) | Test if mode change turns humidifier off despite minimum cycle. | Test if mode change turns humidifier off despite minimum cycle. | async def test_mode_change_humidifier_trigger_off_not_long_enough(hass, setup_comp_6):
"""Test if mode change turns humidifier off despite minimum cycle."""
calls = await _setup_switch(hass, True)
_setup_sensor(hass, 35)
await hass.async_block_till_done()
assert len(calls) == 0
await hass.servi... | [
"async",
"def",
"test_mode_change_humidifier_trigger_off_not_long_enough",
"(",
"hass",
",",
"setup_comp_6",
")",
":",
"calls",
"=",
"await",
"_setup_switch",
"(",
"hass",
",",
"True",
")",
"_setup_sensor",
"(",
"hass",
",",
"35",
")",
"await",
"hass",
".",
"asy... | [
1010,
0
] | [
1028,
47
] | python | en | ['en', 'en', 'en'] | True |
test_mode_change_humidifier_trigger_on_not_long_enough | (hass, setup_comp_6) | Test if mode change turns humidifier on despite minimum cycle. | Test if mode change turns humidifier on despite minimum cycle. | async def test_mode_change_humidifier_trigger_on_not_long_enough(hass, setup_comp_6):
"""Test if mode change turns humidifier on despite minimum cycle."""
calls = await _setup_switch(hass, False)
_setup_sensor(hass, 45)
await hass.async_block_till_done()
assert len(calls) == 0
await hass.servic... | [
"async",
"def",
"test_mode_change_humidifier_trigger_on_not_long_enough",
"(",
"hass",
",",
"setup_comp_6",
")",
":",
"calls",
"=",
"await",
"_setup_switch",
"(",
"hass",
",",
"False",
")",
"_setup_sensor",
"(",
"hass",
",",
"45",
")",
"await",
"hass",
".",
"asy... | [
1031,
0
] | [
1062,
47
] | python | en | ['fr', 'en', 'en'] | True |
setup_comp_7 | (hass) | Initialize components. | Initialize components. | async def setup_comp_7(hass):
"""Initialize components."""
assert await async_setup_component(
hass,
DOMAIN,
{
"humidifier": {
"platform": "generic_hygrostat",
"name": "test",
"dry_tolerance": 3,
"wet_tolerance":... | [
"async",
"def",
"setup_comp_7",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"\"humidifier\"",
":",
"{",
"\"platform\"",
":",
"\"generic_hygrostat\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"dry_toler... | [
1066,
0
] | [
1087,
38
] | python | en | ['de', 'en', 'en'] | False |
test_humidity_change_dry_trigger_on_long_enough_3 | (hass, setup_comp_7) | Test if turn on signal is sent at keep-alive intervals. | Test if turn on signal is sent at keep-alive intervals. | async def test_humidity_change_dry_trigger_on_long_enough_3(hass, setup_comp_7):
"""Test if turn on signal is sent at keep-alive intervals."""
calls = await _setup_switch(hass, True)
_setup_sensor(hass, 45)
await hass.async_block_till_done()
assert len(calls) == 0
async_fire_time_changed(hass, d... | [
"async",
"def",
"test_humidity_change_dry_trigger_on_long_enough_3",
"(",
"hass",
",",
"setup_comp_7",
")",
":",
"calls",
"=",
"await",
"_setup_switch",
"(",
"hass",
",",
"True",
")",
"_setup_sensor",
"(",
"hass",
",",
"45",
")",
"await",
"hass",
".",
"async_blo... | [
1090,
0
] | [
1105,
47
] | python | en | ['en', 'en', 'en'] | True |
test_humidity_change_dry_trigger_off_long_enough_3 | (hass, setup_comp_7) | Test if turn on signal is sent at keep-alive intervals. | Test if turn on signal is sent at keep-alive intervals. | async def test_humidity_change_dry_trigger_off_long_enough_3(hass, setup_comp_7):
"""Test if turn on signal is sent at keep-alive intervals."""
calls = await _setup_switch(hass, False)
_setup_sensor(hass, 35)
await hass.async_block_till_done()
assert len(calls) == 0
async_fire_time_changed(hass,... | [
"async",
"def",
"test_humidity_change_dry_trigger_off_long_enough_3",
"(",
"hass",
",",
"setup_comp_7",
")",
":",
"calls",
"=",
"await",
"_setup_switch",
"(",
"hass",
",",
"False",
")",
"_setup_sensor",
"(",
"hass",
",",
"35",
")",
"await",
"hass",
".",
"async_b... | [
1108,
0
] | [
1123,
47
] | python | en | ['en', 'en', 'en'] | True |
setup_comp_8 | (hass) | Initialize components. | Initialize components. | async def setup_comp_8(hass):
"""Initialize components."""
assert await async_setup_component(
hass,
DOMAIN,
{
"humidifier": {
"platform": "generic_hygrostat",
"name": "test",
"dry_tolerance": 3,
"wet_tolerance":... | [
"async",
"def",
"setup_comp_8",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"\"humidifier\"",
":",
"{",
"\"platform\"",
":",
"\"generic_hygrostat\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"dry_toler... | [
1127,
0
] | [
1147,
38
] | python | en | ['de', 'en', 'en'] | False |
test_humidity_change_humidifier_trigger_on_long_enough_2 | (hass, setup_comp_8) | Test if turn on signal is sent at keep-alive intervals. | Test if turn on signal is sent at keep-alive intervals. | async def test_humidity_change_humidifier_trigger_on_long_enough_2(hass, setup_comp_8):
"""Test if turn on signal is sent at keep-alive intervals."""
calls = await _setup_switch(hass, True)
_setup_sensor(hass, 35)
await hass.async_block_till_done()
assert len(calls) == 0
async_fire_time_changed(... | [
"async",
"def",
"test_humidity_change_humidifier_trigger_on_long_enough_2",
"(",
"hass",
",",
"setup_comp_8",
")",
":",
"calls",
"=",
"await",
"_setup_switch",
"(",
"hass",
",",
"True",
")",
"_setup_sensor",
"(",
"hass",
",",
"35",
")",
"await",
"hass",
".",
"as... | [
1150,
0
] | [
1165,
47
] | python | en | ['en', 'en', 'en'] | True |
test_humidity_change_humidifier_trigger_off_long_enough_2 | (hass, setup_comp_8) | Test if turn on signal is sent at keep-alive intervals. | Test if turn on signal is sent at keep-alive intervals. | async def test_humidity_change_humidifier_trigger_off_long_enough_2(hass, setup_comp_8):
"""Test if turn on signal is sent at keep-alive intervals."""
calls = await _setup_switch(hass, False)
_setup_sensor(hass, 45)
await hass.async_block_till_done()
assert len(calls) == 0
async_fire_time_change... | [
"async",
"def",
"test_humidity_change_humidifier_trigger_off_long_enough_2",
"(",
"hass",
",",
"setup_comp_8",
")",
":",
"calls",
"=",
"await",
"_setup_switch",
"(",
"hass",
",",
"False",
")",
"_setup_sensor",
"(",
"hass",
",",
"45",
")",
"await",
"hass",
".",
"... | [
1168,
0
] | [
1183,
47
] | python | en | ['en', 'en', 'en'] | True |
test_float_tolerance_values | (hass) | Test if dehumidifier does not turn on within floating point tolerance. | Test if dehumidifier does not turn on within floating point tolerance. | async def test_float_tolerance_values(hass):
"""Test if dehumidifier does not turn on within floating point tolerance."""
assert await async_setup_component(
hass,
DOMAIN,
{
"humidifier": {
"platform": "generic_hygrostat",
"name": "test",
... | [
"async",
"def",
"test_float_tolerance_values",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"\"humidifier\"",
":",
"{",
"\"platform\"",
":",
"\"generic_hygrostat\"",
",",
"\"name\"",
":",
"\"test\"",
",",... | [
1186,
0
] | [
1209,
26
] | python | en | ['en', 'en', 'en'] | True |
test_float_tolerance_values_2 | (hass) | Test if dehumidifier turns off when oudside of floating point tolerance values. | Test if dehumidifier turns off when oudside of floating point tolerance values. | async def test_float_tolerance_values_2(hass):
"""Test if dehumidifier turns off when oudside of floating point tolerance values."""
assert await async_setup_component(
hass,
DOMAIN,
{
"humidifier": {
"platform": "generic_hygrostat",
"name": "t... | [
"async",
"def",
"test_float_tolerance_values_2",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"\"humidifier\"",
":",
"{",
"\"platform\"",
":",
"\"generic_hygrostat\"",
",",
"\"name\"",
":",
"\"test\"",
",... | [
1212,
0
] | [
1238,
47
] | python | en | ['en', 'en', 'en'] | True |
test_custom_setup_params | (hass) | Test the setup with custom parameters. | Test the setup with custom parameters. | async def test_custom_setup_params(hass):
"""Test the setup with custom parameters."""
_setup_sensor(hass, 45)
await hass.async_block_till_done()
result = await async_setup_component(
hass,
DOMAIN,
{
"humidifier": {
"platform": "generic_hygrostat",
... | [
"async",
"def",
"test_custom_setup_params",
"(",
"hass",
")",
":",
"_setup_sensor",
"(",
"hass",
",",
"45",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"result",
"=",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"... | [
1241,
0
] | [
1265,
62
] | python | en | ['en', 'en', 'en'] | True |
test_restore_state | (hass) | Ensure states are restored on startup. | Ensure states are restored on startup. | async def test_restore_state(hass):
"""Ensure states are restored on startup."""
_setup_sensor(hass, 45)
await hass.async_block_till_done()
mock_restore_cache(
hass,
(
State(
"humidifier.test_hygrostat",
STATE_OFF,
{ATTR_ENTITY_... | [
"async",
"def",
"test_restore_state",
"(",
"hass",
")",
":",
"_setup_sensor",
"(",
"hass",
",",
"45",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"mock_restore_cache",
"(",
"hass",
",",
"(",
"State",
"(",
"\"humidifier.test_hygrostat\"",
",",
... | [
1268,
0
] | [
1303,
35
] | python | en | ['en', 'en', 'en'] | True |
test_restore_state_target_humidity | (hass) | Ensure restore target humidity if available. | Ensure restore target humidity if available. | async def test_restore_state_target_humidity(hass):
"""Ensure restore target humidity if available."""
_setup_sensor(hass, 45)
await hass.async_block_till_done()
mock_restore_cache(
hass,
(
State(
"humidifier.test_hygrostat",
STATE_OFF,
... | [
"async",
"def",
"test_restore_state_target_humidity",
"(",
"hass",
")",
":",
"_setup_sensor",
"(",
"hass",
",",
"45",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"mock_restore_cache",
"(",
"hass",
",",
"(",
"State",
"(",
"\"humidifier.test_hygros... | [
1306,
0
] | [
1341,
35
] | python | en | ['en', 'en', 'en'] | True |
test_restore_state_and_return_to_normal | (hass) | Ensure retain of target humidity for normal mode. | Ensure retain of target humidity for normal mode. | async def test_restore_state_and_return_to_normal(hass):
"""Ensure retain of target humidity for normal mode."""
_setup_sensor(hass, 55)
await hass.async_block_till_done()
mock_restore_cache(
hass,
(
State(
"humidifier.test_hygrostat",
STATE_OF... | [
"async",
"def",
"test_restore_state_and_return_to_normal",
"(",
"hass",
")",
":",
"_setup_sensor",
"(",
"hass",
",",
"55",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"mock_restore_cache",
"(",
"hass",
",",
"(",
"State",
"(",
"\"humidifier.test_h... | [
1344,
0
] | [
1398,
35
] | python | en | ['en', 'en', 'en'] | True |
test_no_restore_state | (hass) | Ensure states are restored on startup if they exist.
Allows for graceful reboot.
| Ensure states are restored on startup if they exist. | async def test_no_restore_state(hass):
"""Ensure states are restored on startup if they exist.
Allows for graceful reboot.
"""
_setup_sensor(hass, 45)
await hass.async_block_till_done()
mock_restore_cache(
hass,
(
State(
"humidifier.test_hygrostat",
... | [
"async",
"def",
"test_no_restore_state",
"(",
"hass",
")",
":",
"_setup_sensor",
"(",
"hass",
",",
"45",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"mock_restore_cache",
"(",
"hass",
",",
"(",
"State",
"(",
"\"humidifier.test_hygrostat\"",
","... | [
1401,
0
] | [
1439,
35
] | python | en | ['en', 'en', 'en'] | True |
test_restore_state_uncoherence_case | (hass) |
Test restore from a strange state.
- Turn the generic hygrostat off
- Restart HA and restore state from DB
|
Test restore from a strange state. | async def test_restore_state_uncoherence_case(hass):
"""
Test restore from a strange state.
- Turn the generic hygrostat off
- Restart HA and restore state from DB
"""
_mock_restore_cache(hass, humidity=40)
calls = await _setup_switch(hass, False)
_setup_sensor(hass, 35)
await _set... | [
"async",
"def",
"test_restore_state_uncoherence_case",
"(",
"hass",
")",
":",
"_mock_restore_cache",
"(",
"hass",
",",
"humidity",
"=",
"40",
")",
"calls",
"=",
"await",
"_setup_switch",
"(",
"hass",
",",
"False",
")",
"_setup_sensor",
"(",
"hass",
",",
"35",
... | [
1442,
0
] | [
1464,
35
] | python | en | ['en', 'error', 'th'] | False |
test_away_fixed_humidity_mode | (hass) | Ensure retain of target humidity for normal mode. | Ensure retain of target humidity for normal mode. | async def test_away_fixed_humidity_mode(hass):
"""Ensure retain of target humidity for normal mode."""
_setup_sensor(hass, 45)
await hass.async_block_till_done()
await async_setup_component(
hass,
DOMAIN,
{
"humidifier": {
"platform": "generic_hygrosta... | [
"async",
"def",
"test_away_fixed_humidity_mode",
"(",
"hass",
")",
":",
"_setup_sensor",
"(",
"hass",
",",
"45",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"\"humidifier\"... | [
1504,
0
] | [
1576,
35
] | python | en | ['en', 'en', 'en'] | True |
test_sensor_stale_duration | (hass, setup_comp_1, caplog) | Test turn off on sensor stale. | Test turn off on sensor stale. | async def test_sensor_stale_duration(hass, setup_comp_1, caplog):
"""Test turn off on sensor stale."""
humidifier_switch = "input_boolean.test"
assert await async_setup_component(
hass, input_boolean.DOMAIN, {"input_boolean": {"test": None}}
)
await hass.async_block_till_done()
assert ... | [
"async",
"def",
"test_sensor_stale_duration",
"(",
"hass",
",",
"setup_comp_1",
",",
"caplog",
")",
":",
"humidifier_switch",
"=",
"\"input_boolean.test\"",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"input_boolean",
".",
"DOMAIN",
",",
"{",
"\"in... | [
1579,
0
] | [
1656,
64
] | python | en | ['en', 'et', '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 |
determine_hostname | (display_name=None) |
Find fqdn if we can
|
Find fqdn if we can
| def determine_hostname(display_name=None):
"""
Find fqdn if we can
"""
if display_name:
# if display_name is provided, just return the given name
return display_name
else:
socket_gethostname = socket.gethostname()
socket_fqdn = socket.getfqdn()
try:
... | [
"def",
"determine_hostname",
"(",
"display_name",
"=",
"None",
")",
":",
"if",
"display_name",
":",
"# if display_name is provided, just return the given name",
"return",
"display_name",
"else",
":",
"socket_gethostname",
"=",
"socket",
".",
"gethostname",
"(",
")",
"so... | [
35,
0
] | [
61,
33
] | python | en | ['en', 'error', 'th'] | False |
write_unregistered_file | (date=None) |
Write .unregistered out to disk
|
Write .unregistered out to disk
| def write_unregistered_file(date=None):
"""
Write .unregistered out to disk
"""
delete_registered_file()
if date is None:
date = get_time()
for f in constants.unregistered_files:
if os.path.lexists(f):
if os.path.islink(f):
# kill symlinks and regenera... | [
"def",
"write_unregistered_file",
"(",
"date",
"=",
"None",
")",
":",
"delete_registered_file",
"(",
")",
"if",
"date",
"is",
"None",
":",
"date",
"=",
"get_time",
"(",
")",
"for",
"f",
"in",
"constants",
".",
"unregistered_files",
":",
"if",
"os",
".",
... | [
80,
0
] | [
94,
47
] | python | en | ['en', 'error', 'th'] | False |
write_to_disk | (filename, delete=False, content=get_time()) |
Write filename out to disk
|
Write filename out to disk
| def write_to_disk(filename, delete=False, content=get_time()):
"""
Write filename out to disk
"""
if not os.path.exists(os.path.dirname(filename)):
return
if delete:
if os.path.lexists(filename):
os.remove(filename)
else:
with open(filename, 'wb') as f:
... | [
"def",
"write_to_disk",
"(",
"filename",
",",
"delete",
"=",
"False",
",",
"content",
"=",
"get_time",
"(",
")",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"filename",
")",
")",
":",
"retur... | [
112,
0
] | [
123,
44
] | python | en | ['en', 'error', 'th'] | False |
generate_machine_id | (new=False,
destination_file=constants.machine_id_file) |
Generate a machine-id if /etc/insights-client/machine-id does not exist
|
Generate a machine-id if /etc/insights-client/machine-id does not exist
| def generate_machine_id(new=False,
destination_file=constants.machine_id_file):
"""
Generate a machine-id if /etc/insights-client/machine-id does not exist
"""
machine_id = None
machine_id_file = None
logging_name = 'machine-id'
if os.path.isfile(destination_file) an... | [
"def",
"generate_machine_id",
"(",
"new",
"=",
"False",
",",
"destination_file",
"=",
"constants",
".",
"machine_id_file",
")",
":",
"machine_id",
"=",
"None",
"machine_id_file",
"=",
"None",
"logging_name",
"=",
"'machine-id'",
"if",
"os",
".",
"path",
".",
"... | [
126,
0
] | [
154,
40
] | python | en | ['en', 'error', 'th'] | False |
_expand_paths | (path) |
Expand wildcarded paths
|
Expand wildcarded paths
| def _expand_paths(path):
"""
Expand wildcarded paths
"""
dir_name = os.path.dirname(path)
paths = []
logger.debug("Attempting to expand %s", path)
if os.path.isdir(dir_name):
files = os.listdir(dir_name)
match = os.path.basename(path)
for file_path in files:
... | [
"def",
"_expand_paths",
"(",
"path",
")",
":",
"dir_name",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
"paths",
"=",
"[",
"]",
"logger",
".",
"debug",
"(",
"\"Attempting to expand %s\"",
",",
"path",
")",
"if",
"os",
".",
"path",
".",
"... | [
157,
0
] | [
174,
49
] | python | en | ['en', 'error', 'th'] | False |
validate_remove_file | (config) |
Validate the remove file and tags file
|
Validate the remove file and tags file
| def validate_remove_file(config):
"""
Validate the remove file and tags file
"""
return InsightsUploadConf(config).validate() | [
"def",
"validate_remove_file",
"(",
"config",
")",
":",
"return",
"InsightsUploadConf",
"(",
"config",
")",
".",
"validate",
"(",
")"
] | [
177,
0
] | [
181,
48
] | python | en | ['en', 'error', 'th'] | False |
write_data_to_file | (data, filepath) |
Write data to file
|
Write data to file
| def write_data_to_file(data, filepath):
'''
Write data to file
'''
try:
os.makedirs(os.path.dirname(filepath), 0o700)
except OSError:
pass
write_to_disk(filepath, content=data) | [
"def",
"write_data_to_file",
"(",
"data",
",",
"filepath",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"filepath",
")",
",",
"0o700",
")",
"except",
"OSError",
":",
"pass",
"write_to_disk",
"(",
"filepath",
... | [
184,
0
] | [
193,
41
] | python | en | ['en', 'error', 'th'] | False |
magic_plan_b | (filename) |
Use this in instances where
python-magic is MIA and can't be installed
for whatever reason
|
Use this in instances where
python-magic is MIA and can't be installed
for whatever reason
| def magic_plan_b(filename):
'''
Use this in instances where
python-magic is MIA and can't be installed
for whatever reason
'''
cmd = shlex.split('file --mime-type --mime-encoding ' + filename)
stdout, stderr = Popen(cmd, stdout=PIPE).communicate()
stdout = stdout.decode("utf-8")
mime... | [
"def",
"magic_plan_b",
"(",
"filename",
")",
":",
"cmd",
"=",
"shlex",
".",
"split",
"(",
"'file --mime-type --mime-encoding '",
"+",
"filename",
")",
"stdout",
",",
"stderr",
"=",
"Popen",
"(",
"cmd",
",",
"stdout",
"=",
"PIPE",
")",
".",
"communicate",
"... | [
196,
0
] | [
206,
19
] | python | en | ['en', 'error', 'th'] | False |
modify_config_file | (updates) |
Update the config file with certain things
|
Update the config file with certain things
| def modify_config_file(updates):
'''
Update the config file with certain things
'''
cmd = '/bin/sed '
for key in updates:
cmd = cmd + '-e \'s/^#*{key}.*=.*$/{key}={value}/\' '.format(key=key, value=updates[key])
cmd = cmd + constants.default_conf_file
status = run_command_get_output(... | [
"def",
"modify_config_file",
"(",
"updates",
")",
":",
"cmd",
"=",
"'/bin/sed '",
"for",
"key",
"in",
"updates",
":",
"cmd",
"=",
"cmd",
"+",
"'-e \\'s/^#*{key}.*=.*$/{key}={value}/\\' '",
".",
"format",
"(",
"key",
"=",
"key",
",",
"value",
"=",
"updates",
... | [
220,
0
] | [
229,
72
] | python | en | ['en', 'error', 'th'] | False |
get_version_info | () |
Get the insights client and core versions for archival
|
Get the insights client and core versions for archival
| def get_version_info():
'''
Get the insights client and core versions for archival
'''
try:
client_version = wrapper_constants.version
except AttributeError:
# wrapper_constants is None or has no attribute "version"
client_version = None
version_info = {}
version_info... | [
"def",
"get_version_info",
"(",
")",
":",
"try",
":",
"client_version",
"=",
"wrapper_constants",
".",
"version",
"except",
"AttributeError",
":",
"# wrapper_constants is None or has no attribute \"version\"",
"client_version",
"=",
"None",
"version_info",
"=",
"{",
"}",
... | [
232,
0
] | [
244,
23
] | python | en | ['en', 'error', 'th'] | False |
print_egg_versions | () |
Log all available eggs' versions
|
Log all available eggs' versions
| def print_egg_versions():
'''
Log all available eggs' versions
'''
versions = get_version_info()
logger.debug('Client version: %s', versions['client_version'])
logger.debug('Core version: %s', versions['core_version'])
logger.debug('All egg versions:')
eggs = [
os.getenv('EGG'),
... | [
"def",
"print_egg_versions",
"(",
")",
":",
"versions",
"=",
"get_version_info",
"(",
")",
"logger",
".",
"debug",
"(",
"'Client version: %s'",
",",
"versions",
"[",
"'client_version'",
"]",
")",
"logger",
".",
"debug",
"(",
"'Core version: %s'",
",",
"versions"... | [
247,
0
] | [
281,
44
] | python | en | ['en', 'error', 'th'] | False |
read_pidfile | () |
Read the pidfile we wrote at launch
|
Read the pidfile we wrote at launch
| def read_pidfile():
'''
Read the pidfile we wrote at launch
'''
pid = None
try:
with open(constants.pidfile) as pidfile:
pid = pidfile.read()
except IOError:
logger.debug('Could not open pidfile for reading.')
return pid | [
"def",
"read_pidfile",
"(",
")",
":",
"pid",
"=",
"None",
"try",
":",
"with",
"open",
"(",
"constants",
".",
"pidfile",
")",
"as",
"pidfile",
":",
"pid",
"=",
"pidfile",
".",
"read",
"(",
")",
"except",
"IOError",
":",
"logger",
".",
"debug",
"(",
... | [
284,
0
] | [
294,
14
] | python | en | ['en', 'error', 'th'] | False |
_systemd_notify | (pid) |
Ping the systemd watchdog with the main PID so that
the watchdog doesn't kill the process
|
Ping the systemd watchdog with the main PID so that
the watchdog doesn't kill the process
| def _systemd_notify(pid):
'''
Ping the systemd watchdog with the main PID so that
the watchdog doesn't kill the process
'''
try:
proc = Popen(['/usr/bin/systemd-notify', '--pid=' + str(pid), 'WATCHDOG=1'])
except OSError as e:
logger.debug('Could not launch systemd-notify: %s', s... | [
"def",
"_systemd_notify",
"(",
"pid",
")",
":",
"try",
":",
"proc",
"=",
"Popen",
"(",
"[",
"'/usr/bin/systemd-notify'",
",",
"'--pid='",
"+",
"str",
"(",
"pid",
")",
",",
"'WATCHDOG=1'",
"]",
")",
"except",
"OSError",
"as",
"e",
":",
"logger",
".",
"d... | [
297,
0
] | [
311,
15
] | python | en | ['en', 'error', 'th'] | False |
systemd_notify_init_thread | () |
Use a thread to periodically ping systemd instead
of calling it on a per-command basis
|
Use a thread to periodically ping systemd instead
of calling it on a per-command basis
| def systemd_notify_init_thread():
'''
Use a thread to periodically ping systemd instead
of calling it on a per-command basis
'''
pid = read_pidfile()
if not pid:
logger.debug('No PID specified.')
return
if not os.getenv('NOTIFY_SOCKET'):
# running standalone, not via ... | [
"def",
"systemd_notify_init_thread",
"(",
")",
":",
"pid",
"=",
"read_pidfile",
"(",
")",
"if",
"not",
"pid",
":",
"logger",
".",
"debug",
"(",
"'No PID specified.'",
")",
"return",
"if",
"not",
"os",
".",
"getenv",
"(",
"'NOTIFY_SOCKET'",
")",
":",
"# run... | [
314,
0
] | [
340,
27
] | python | en | ['en', 'error', 'th'] | False |
get_tags | (tags_file_path=constants.default_tags_file) |
Load tag data from the tags file.
Returns: a dict containing tags defined on the host.
|
Load tag data from the tags file. | def get_tags(tags_file_path=constants.default_tags_file):
'''
Load tag data from the tags file.
Returns: a dict containing tags defined on the host.
'''
tags = None
if os.path.isfile(tags_file_path):
try:
tags = load_yaml(tags_file_path)
except RuntimeError:
... | [
"def",
"get_tags",
"(",
"tags_file_path",
"=",
"constants",
".",
"default_tags_file",
")",
":",
"tags",
"=",
"None",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"tags_file_path",
")",
":",
"try",
":",
"tags",
"=",
"load_yaml",
"(",
"tags_file_path",
")",
... | [
343,
0
] | [
360,
15
] | python | en | ['en', 'error', 'th'] | False |
write_tags | (tags, tags_file_path=constants.default_tags_file) |
Writes tags to tags_file_path
Arguments:
- tags (dict): the tags to write
- tags_file_path (string): path to which tag data will be written
Returns: None
|
Writes tags to tags_file_path | def write_tags(tags, tags_file_path=constants.default_tags_file):
"""
Writes tags to tags_file_path
Arguments:
- tags (dict): the tags to write
- tags_file_path (string): path to which tag data will be written
Returns: None
"""
with open(tags_file_path, mode="w+") as f:
dat... | [
"def",
"write_tags",
"(",
"tags",
",",
"tags_file_path",
"=",
"constants",
".",
"default_tags_file",
")",
":",
"with",
"open",
"(",
"tags_file_path",
",",
"mode",
"=",
"\"w+\"",
")",
"as",
"f",
":",
"data",
"=",
"yaml",
".",
"dump",
"(",
"tags",
",",
"... | [
363,
0
] | [
375,
21
] | python | en | ['en', 'error', 'th'] | False |
migrate_tags | () |
We initially released the tags feature with the tags file set as
tags.conf, but soon after switched it over to tags.yaml. There may be
installations out there with tags.conf files, so rename the files.
|
We initially released the tags feature with the tags file set as
tags.conf, but soon after switched it over to tags.yaml. There may be
installations out there with tags.conf files, so rename the files.
| def migrate_tags():
'''
We initially released the tags feature with the tags file set as
tags.conf, but soon after switched it over to tags.yaml. There may be
installations out there with tags.conf files, so rename the files.
'''
tags_conf = os.path.join(constants.default_conf_dir, 'tags.conf')
... | [
"def",
"migrate_tags",
"(",
")",
":",
"tags_conf",
"=",
"os",
".",
"path",
".",
"join",
"(",
"constants",
".",
"default_conf_dir",
",",
"'tags.conf'",
")",
"tags_yaml",
"=",
"os",
".",
"path",
".",
"join",
"(",
"constants",
".",
"default_conf_dir",
",",
... | [
378,
0
] | [
397,
27
] | python | en | ['en', 'error', 'th'] | False |
get_parent_process | () |
Get parent process of the client
Returns: string
|
Get parent process of the client | def get_parent_process():
'''
Get parent process of the client
Returns: string
'''
ppid = os.getppid()
output = run_command_get_output('cat /proc/%s/status' % ppid)
if output['status'] == 0:
name = output['output'].splitlines()[0].split('\t')[1]
return name
else:
... | [
"def",
"get_parent_process",
"(",
")",
":",
"ppid",
"=",
"os",
".",
"getppid",
"(",
")",
"output",
"=",
"run_command_get_output",
"(",
"'cat /proc/%s/status'",
"%",
"ppid",
")",
"if",
"output",
"[",
"'status'",
"]",
"==",
"0",
":",
"name",
"=",
"output",
... | [
400,
0
] | [
412,
24
] | python | en | ['en', 'error', 'th'] | False |
device_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def device_reg(hass):
"""Return an empty, loaded, registry."""
return mock_device_registry(hass) | [
"def",
"device_reg",
"(",
"hass",
")",
":",
"return",
"mock_device_registry",
"(",
"hass",
")"
] | [
29,
0
] | [
31,
37
] | python | en | ['en', 'fy', 'en'] | True |
entity_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def entity_reg(hass):
"""Return an empty, loaded, registry."""
return mock_registry(hass) | [
"def",
"entity_reg",
"(",
"hass",
")",
":",
"return",
"mock_registry",
"(",
"hass",
")"
] | [
35,
0
] | [
37,
30
] | python | en | ['en', 'fy', 'en'] | True |
calls | (hass) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
")",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
41,
0
] | [
43,
57
] | python | en | ['en', 'en', 'en'] | True |
test_get_conditions | (
hass,
device_reg,
entity_reg,
set_state,
features_reg,
features_state,
expected_condition_types,
) | Test we get the expected conditions from a alarm_control_panel. | Test we get the expected conditions from a alarm_control_panel. | async def test_get_conditions(
hass,
device_reg,
entity_reg,
set_state,
features_reg,
features_state,
expected_condition_types,
):
"""Test we get the expected conditions from a alarm_control_panel."""
config_entry = MockConfigEntry(domain="test", data={})
config_entry.add_to_hass... | [
"async",
"def",
"test_get_conditions",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
",",
"set_state",
",",
"features_reg",
",",
"features_state",
",",
"expected_condition_types",
",",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"t... | [
63,
0
] | [
115,
54
] | python | en | ['en', 'en', 'en'] | True |
test_if_state | (hass, calls) | Test for all conditions. | Test for all conditions. | async def test_if_state(hass, calls):
"""Test for all conditions."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: [
{
"trigger": {"platform": "event", "event_type": "test_event1"},
"c... | [
"async",
"def",
"test_if_state",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"[",
"{",
"\"trigger\"",
":",
"{",
"\"platform\"",
... | [
118,
0
] | [
336,
82
] | python | en | ['en', 'en', 'en'] | True |
parse | (doc, treebuilder="etree", namespaceHTMLElements=True, **kwargs) | Parse an HTML document as a string or file-like object into a tree
:arg doc: the document to parse as a string or file-like object
:arg treebuilder: the treebuilder to use when parsing
:arg namespaceHTMLElements: whether or not to namespace HTML elements
:returns: parsed tree
Example:
>>> ... | Parse an HTML document as a string or file-like object into a tree | def parse(doc, treebuilder="etree", namespaceHTMLElements=True, **kwargs):
"""Parse an HTML document as a string or file-like object into a tree
:arg doc: the document to parse as a string or file-like object
:arg treebuilder: the treebuilder to use when parsing
:arg namespaceHTMLElements: whether or... | [
"def",
"parse",
"(",
"doc",
",",
"treebuilder",
"=",
"\"etree\"",
",",
"namespaceHTMLElements",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"tb",
"=",
"treebuilders",
".",
"getTreeBuilder",
"(",
"treebuilder",
")",
"p",
"=",
"HTMLParser",
"(",
"tb",
... | [
25,
0
] | [
45,
33
] | python | en | ['en', 'en', 'en'] | True |
parseFragment | (doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs) | Parse an HTML fragment as a string or file-like object into a tree
:arg doc: the fragment to parse as a string or file-like object
:arg container: the container context to parse the fragment in
:arg treebuilder: the treebuilder to use when parsing
:arg namespaceHTMLElements: whether or not to namesp... | Parse an HTML fragment as a string or file-like object into a tree | def parseFragment(doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs):
"""Parse an HTML fragment as a string or file-like object into a tree
:arg doc: the fragment to parse as a string or file-like object
:arg container: the container context to parse the fragment in
:arg... | [
"def",
"parseFragment",
"(",
"doc",
",",
"container",
"=",
"\"div\"",
",",
"treebuilder",
"=",
"\"etree\"",
",",
"namespaceHTMLElements",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"tb",
"=",
"treebuilders",
".",
"getTreeBuilder",
"(",
"treebuilder",
")... | [
48,
0
] | [
70,
62
] | python | en | ['en', 'en', 'en'] | True |
log | (function) | Logger that records which phase processes each token | Logger that records which phase processes each token | def log(function):
"""Logger that records which phase processes each token"""
type_names = {value: key for key, value in tokenTypes.items()}
def wrapped(self, *args, **kwargs):
if function.__name__.startswith("process") and len(args) > 0:
token = args[0]
... | [
"def",
"log",
"(",
"function",
")",
":",
"type_names",
"=",
"{",
"value",
":",
"key",
"for",
"key",
",",
"value",
"in",
"tokenTypes",
".",
"items",
"(",
")",
"}",
"def",
"wrapped",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",... | [
397,
4
] | [
416,
22
] | python | en | ['en', 'en', 'en'] | True |
HTMLParser.__init__ | (self, tree=None, strict=False, namespaceHTMLElements=True, debug=False) |
:arg tree: a treebuilder class controlling the type of tree that will be
returned. Built in treebuilders can be accessed through
html5lib.treebuilders.getTreeBuilder(treeType)
:arg strict: raise an exception when a parse error is encountered
:arg namespaceHTMLElements:... |
:arg tree: a treebuilder class controlling the type of tree that will be
returned. Built in treebuilders can be accessed through
html5lib.treebuilders.getTreeBuilder(treeType) | def __init__(self, tree=None, strict=False, namespaceHTMLElements=True, debug=False):
"""
:arg tree: a treebuilder class controlling the type of tree that will be
returned. Built in treebuilders can be accessed through
html5lib.treebuilders.getTreeBuilder(treeType)
:arg ... | [
"def",
"__init__",
"(",
"self",
",",
"tree",
"=",
"None",
",",
"strict",
"=",
"False",
",",
"namespaceHTMLElements",
"=",
"True",
",",
"debug",
"=",
"False",
")",
":",
"# Raise an exception on the first error encountered",
"self",
".",
"strict",
"=",
"strict",
... | [
92,
4
] | [
121,
48
] | python | en | ['en', 'error', 'th'] | False |
HTMLParser.documentEncoding | (self) | Name of the character encoding that was used to decode the input stream, or
:obj:`None` if that is not determined yet
| Name of the character encoding that was used to decode the input stream, or
:obj:`None` if that is not determined yet | def documentEncoding(self):
"""Name of the character encoding that was used to decode the input stream, or
:obj:`None` if that is not determined yet
"""
if not hasattr(self, 'tokenizer'):
return None
return self.tokenizer.stream.charEncoding[0].name | [
"def",
"documentEncoding",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'tokenizer'",
")",
":",
"return",
"None",
"return",
"self",
".",
"tokenizer",
".",
"stream",
".",
"charEncoding",
"[",
"0",
"]",
".",
"name"
] | [
172,
4
] | [
179,
57
] | python | en | ['en', 'en', 'en'] | True |
HTMLParser.parse | (self, stream, *args, **kwargs) | Parse a HTML document into a well-formed tree
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, that encoding will be used,
regardless of any BOM or later d... | Parse a HTML document into a well-formed tree | def parse(self, stream, *args, **kwargs):
"""Parse a HTML document into a well-formed tree
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, that encoding will ... | [
"def",
"parse",
"(",
"self",
",",
"stream",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_parse",
"(",
"stream",
",",
"False",
",",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"tree",
"."... | [
261,
4
] | [
284,
38
] | python | en | ['en', 'en', 'en'] | True |
HTMLParser.parseFragment | (self, stream, *args, **kwargs) | Parse a HTML fragment into a well-formed tree fragment
:arg container: name of the element we're setting the innerHTML
property if set to None, default to 'div'
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a... | Parse a HTML fragment into a well-formed tree fragment | def parseFragment(self, stream, *args, **kwargs):
"""Parse a HTML fragment into a well-formed tree fragment
:arg container: name of the element we're setting the innerHTML
property if set to None, default to 'div'
:arg stream: a file-like object or string containing the HTML to be ... | [
"def",
"parseFragment",
"(",
"self",
",",
"stream",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_parse",
"(",
"stream",
",",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"tree",
".",
"getFr... | [
286,
4
] | [
312,
38
] | python | en | ['en', 'en', 'en'] | True |
InBodyPhase.startTagRawtext | (self, token) | iframe, noembed noframes, noscript(if scripting enabled) | iframe, noembed noframes, noscript(if scripting enabled) | def startTagRawtext(self, token):
"""iframe, noembed noframes, noscript(if scripting enabled)"""
self.parser.parseRCDataRawtext(token, "RAWTEXT") | [
"def",
"startTagRawtext",
"(",
"self",
",",
"token",
")",
":",
"self",
".",
"parser",
".",
"parseRCDataRawtext",
"(",
"token",
",",
"\"RAWTEXT\"",
")"
] | [
1239,
8
] | [
1241,
60
] | python | en | ['en', 'en', 'nl'] | True |
InBodyPhase.startTagMisplaced | (self, token) | Elements that should be children of other elements that have a
different insertion mode; here they are ignored
"caption", "col", "colgroup", "frame", "frameset", "head",
"option", "optgroup", "tbody", "td", "tfoot", "th", "thead",
"tr", "noscript"
| Elements that should be children of other elements that have a
different insertion mode; here they are ignored
"caption", "col", "colgroup", "frame", "frameset", "head",
"option", "optgroup", "tbody", "td", "tfoot", "th", "thead",
"tr", "noscript"
| def startTagMisplaced(self, token):
""" Elements that should be children of other elements that have a
different insertion mode; here they are ignored
"caption", "col", "colgroup", "frame", "frameset", "head",
"option", "optgroup", "tbody", "td", "tfoot", "th", "thead",
... | [
"def",
"startTagMisplaced",
"(",
"self",
",",
"token",
")",
":",
"self",
".",
"parser",
".",
"parseError",
"(",
"\"unexpected-start-tag-ignored\"",
",",
"{",
"\"name\"",
":",
"token",
"[",
"\"name\"",
"]",
"}",
")"
] | [
1294,
8
] | [
1301,
91
] | python | en | ['en', 'en', 'en'] | True |
InBodyPhase.endTagFormatting | (self, token) | The much-feared adoption agency algorithm | The much-feared adoption agency algorithm | def endTagFormatting(self, token):
"""The much-feared adoption agency algorithm"""
# http://svn.whatwg.org/webapps/complete.html#adoptionAgency revision 7867
# XXX Better parseError messages appreciated.
# Step 1
outerLoopCounter = 0
# Step 2
... | [
"def",
"endTagFormatting",
"(",
"self",
",",
"token",
")",
":",
"# http://svn.whatwg.org/webapps/complete.html#adoptionAgency revision 7867",
"# XXX Better parseError messages appreciated.",
"# Step 1",
"outerLoopCounter",
"=",
"0",
"# Step 2",
"while",
"outerLoopCounter",
"<",
"... | [
1403,
8
] | [
1564,
75
] | python | en | ['en', 'en', 'en'] | True |
is_running | (context) |
.. warning::
This function parser is deprecated, please use :py:class:`KSMState`
instead.
Check if Kernel Samepage Merging is enabled. 'True' if KSM is
on (i.e. ``/sys/kernel/mm/ksm/run`` is '1') or 'False' if not.
|
.. warning::
This function parser is deprecated, please use :py:class:`KSMState`
instead. | def is_running(context):
"""
.. warning::
This function parser is deprecated, please use :py:class:`KSMState`
instead.
Check if Kernel Samepage Merging is enabled. 'True' if KSM is
on (i.e. ``/sys/kernel/mm/ksm/run`` is '1') or 'False' if not.
"""
deprecated(is_running, "Use the... | [
"def",
"is_running",
"(",
"context",
")",
":",
"deprecated",
"(",
"is_running",
",",
"\"Use the `KSMState` class instead.\"",
")",
"ksminfo",
"=",
"{",
"}",
"ksminfo",
"[",
"'running'",
"]",
"=",
"(",
"context",
".",
"content",
"[",
"0",
"]",
".",
"split",
... | [
15,
0
] | [
27,
18
] | python | en | ['en', 'error', 'th'] | False |
test_checkin_success | (insights_config, insights_client) |
InsightsSupport is constructed with InsightsConfig and collect_support_info is called.
|
InsightsSupport is constructed with InsightsConfig and collect_support_info is called.
| def test_checkin_success(insights_config, insights_client):
"""
InsightsSupport is constructed with InsightsConfig and collect_support_info is called.
"""
with raises(SystemExit) as exc_info:
pre_update()
insights_client.return_value.checkin.assert_called_once_with()
assert exc_info.val... | [
"def",
"test_checkin_success",
"(",
"insights_config",
",",
"insights_client",
")",
":",
"with",
"raises",
"(",
"SystemExit",
")",
"as",
"exc_info",
":",
"pre_update",
"(",
")",
"insights_client",
".",
"return_value",
".",
"checkin",
".",
"assert_called_once_with",
... | [
25,
0
] | [
33,
63
] | python | en | ['en', 'error', 'th'] | False |
test_checkin_failure | (insights_config, insights_client) |
Support collection replaces the normal client run.
|
Support collection replaces the normal client run.
| def test_checkin_failure(insights_config, insights_client):
"""
Support collection replaces the normal client run.
"""
with raises(SystemExit) as exc_info:
pre_update()
insights_client.return_value.checkin.assert_called_once_with()
assert exc_info.value.code == InsightsConstants.sig_kil... | [
"def",
"test_checkin_failure",
"(",
"insights_config",
",",
"insights_client",
")",
":",
"with",
"raises",
"(",
"SystemExit",
")",
"as",
"exc_info",
":",
"pre_update",
"(",
")",
"insights_client",
".",
"return_value",
".",
"checkin",
".",
"assert_called_once_with",
... | [
38,
0
] | [
46,
64
] | python | en | ['en', 'error', 'th'] | False |
setup_demo_vacuum | (hass) | Initialize setup demo vacuum. | Initialize setup demo vacuum. | async def setup_demo_vacuum(hass):
"""Initialize setup demo vacuum."""
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "demo"}})
await hass.async_block_till_done() | [
"async",
"def",
"setup_demo_vacuum",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"CONF_PLATFORM",
":",
"\"demo\"",
"}",
"}",
")",
"await",
"hass",
".",
"async_block_till_done",
... | [
50,
0
] | [
53,
38
] | python | en | ['en', 'la', 'en'] | True |
test_supported_features | (hass) | Test vacuum supported features. | Test vacuum supported features. | async def test_supported_features(hass):
"""Test vacuum supported features."""
state = hass.states.get(ENTITY_VACUUM_COMPLETE)
assert state.attributes.get(ATTR_SUPPORTED_FEATURES) == 2047
assert state.attributes.get(ATTR_STATUS) == "Charging"
assert state.attributes.get(ATTR_BATTERY_LEVEL) == 100
... | [
"async",
"def",
"test_supported_features",
"(",
"hass",
")",
":",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"ENTITY_VACUUM_COMPLETE",
")",
"assert",
"state",
".",
"attributes",
".",
"get",
"(",
"ATTR_SUPPORTED_FEATURES",
")",
"==",
"2047",
"assert"... | [
56,
0
] | [
103,
66
] | python | en | ['en', 'en', 'en'] | True |
test_methods | (hass) | Test if methods call the services as expected. | Test if methods call the services as expected. | async def test_methods(hass):
"""Test if methods call the services as expected."""
hass.states.async_set(ENTITY_VACUUM_BASIC, STATE_ON)
await hass.async_block_till_done()
assert vacuum.is_on(hass, ENTITY_VACUUM_BASIC)
hass.states.async_set(ENTITY_VACUUM_BASIC, STATE_OFF)
await hass.async_block_... | [
"async",
"def",
"test_methods",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"ENTITY_VACUUM_BASIC",
",",
"STATE_ON",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"assert",
"vacuum",
".",
"is_on",
"(",
"hass",
",",
"... | [
106,
0
] | [
185,
40
] | python | en | ['en', 'en', 'en'] | True |
test_unsupported_methods | (hass) | Test service calls for unsupported vacuums. | Test service calls for unsupported vacuums. | async def test_unsupported_methods(hass):
"""Test service calls for unsupported vacuums."""
hass.states.async_set(ENTITY_VACUUM_NONE, STATE_ON)
await hass.async_block_till_done()
assert vacuum.is_on(hass, ENTITY_VACUUM_NONE)
await common.async_turn_off(hass, ENTITY_VACUUM_NONE)
assert vacuum.is... | [
"async",
"def",
"test_unsupported_methods",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"ENTITY_VACUUM_NONE",
",",
"STATE_ON",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"assert",
"vacuum",
".",
"is_on",
"(",
"hass",... | [
188,
0
] | [
257,
40
] | python | en | ['en', 'en', 'en'] | True |
test_services | (hass) | Test vacuum services. | Test vacuum services. | async def test_services(hass):
"""Test vacuum services."""
# Test send_command
send_command_calls = async_mock_service(hass, DOMAIN, SERVICE_SEND_COMMAND)
params = {"rotate": 150, "speed": 20}
await common.async_send_command(
hass, "test_command", entity_id=ENTITY_VACUUM_BASIC, params=param... | [
"async",
"def",
"test_services",
"(",
"hass",
")",
":",
"# Test send_command",
"send_command_calls",
"=",
"async_mock_service",
"(",
"hass",
",",
"DOMAIN",
",",
"SERVICE_SEND_COMMAND",
")",
"params",
"=",
"{",
"\"rotate\"",
":",
"150",
",",
"\"speed\"",
":",
"20... | [
260,
0
] | [
290,
53
] | python | en | ['nl', 'la', 'en'] | False |
test_set_fan_speed | (hass) | Test vacuum service to set the fan speed. | Test vacuum service to set the fan speed. | async def test_set_fan_speed(hass):
"""Test vacuum service to set the fan speed."""
group_vacuums = ",".join(
[ENTITY_VACUUM_BASIC, ENTITY_VACUUM_COMPLETE, ENTITY_VACUUM_STATE]
)
old_state_basic = hass.states.get(ENTITY_VACUUM_BASIC)
old_state_complete = hass.states.get(ENTITY_VACUUM_COMPLET... | [
"async",
"def",
"test_set_fan_speed",
"(",
"hass",
")",
":",
"group_vacuums",
"=",
"\",\"",
".",
"join",
"(",
"[",
"ENTITY_VACUUM_BASIC",
",",
"ENTITY_VACUUM_COMPLETE",
",",
"ENTITY_VACUUM_STATE",
"]",
")",
"old_state_basic",
"=",
"hass",
".",
"states",
".",
"ge... | [
293,
0
] | [
317,
70
] | python | en | ['en', 'en', 'en'] | True |
test_send_command | (hass) | Test vacuum service to send a command. | Test vacuum service to send a command. | async def test_send_command(hass):
"""Test vacuum service to send a command."""
group_vacuums = ",".join([ENTITY_VACUUM_BASIC, ENTITY_VACUUM_COMPLETE])
old_state_basic = hass.states.get(ENTITY_VACUUM_BASIC)
old_state_complete = hass.states.get(ENTITY_VACUUM_COMPLETE)
await common.async_send_command... | [
"async",
"def",
"test_send_command",
"(",
"hass",
")",
":",
"group_vacuums",
"=",
"\",\"",
".",
"join",
"(",
"[",
"ENTITY_VACUUM_BASIC",
",",
"ENTITY_VACUUM_COMPLETE",
"]",
")",
"old_state_basic",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"ENTITY_VACUUM_BASIC... | [
320,
0
] | [
339,
5
] | python | en | ['en', 'en', 'en'] | True |
parse_structure | (astr, level) |
The returned line number is from the beginning of the string, starting
at zero. Returns an empty list if no loops found.
|
The returned line number is from the beginning of the string, starting
at zero. Returns an empty list if no loops found. | def parse_structure(astr, level):
"""
The returned line number is from the beginning of the string, starting
at zero. Returns an empty list if no loops found.
"""
if level == 0 :
loopbeg = "/**begin repeat"
loopend = "/**end repeat**/"
else :
loopbeg = "/**begin repeat%d... | [
"def",
"parse_structure",
"(",
"astr",
",",
"level",
")",
":",
"if",
"level",
"==",
"0",
":",
"loopbeg",
"=",
"\"/**begin repeat\"",
"loopend",
"=",
"\"/**end repeat**/\"",
"else",
":",
"loopbeg",
"=",
"\"/**begin repeat%d\"",
"%",
"level",
"loopend",
"=",
"\"... | [
102,
0
] | [
131,
19
] | python | en | ['en', 'error', 'th'] | False |
parse_loop_header | (loophead) | Find all named replacements in the header
Returns a list of dictionaries, one for each loop iteration,
where each key is a name to be substituted and the corresponding
value is the replacement string.
Also return a list of exclusions. The exclusions are dictionaries
of key value pairs. There can... | Find all named replacements in the header | def parse_loop_header(loophead) :
"""Find all named replacements in the header
Returns a list of dictionaries, one for each loop iteration,
where each key is a name to be substituted and the corresponding
value is the replacement string.
Also return a list of exclusions. The exclusions are dictio... | [
"def",
"parse_loop_header",
"(",
"loophead",
")",
":",
"# Strip out '\\n' and leading '*', if any, in continuation lines.",
"# This should not effect code previous to this change as",
"# continuation lines were not allowed.",
"loophead",
"=",
"stripast",
".",
"sub",
"(",
"\"\"",
",",... | [
157,
0
] | [
207,
16
] | python | en | ['en', 'en', 'en'] | True |
format_condition | (condition: str) | Return condition from dict CONDITION_CLASSES. | Return condition from dict CONDITION_CLASSES. | def format_condition(condition: str):
"""Return condition from dict CONDITION_CLASSES."""
for key, value in CONDITION_CLASSES.items():
if condition in value:
return key
return condition | [
"def",
"format_condition",
"(",
"condition",
":",
"str",
")",
":",
"for",
"key",
",",
"value",
"in",
"CONDITION_CLASSES",
".",
"items",
"(",
")",
":",
"if",
"condition",
"in",
"value",
":",
"return",
"key",
"return",
"condition"
] | [
37,
0
] | [
42,
20
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) | Set up the Meteo-France weather platform. | Set up the Meteo-France weather platform. | async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the Meteo-France weather platform."""
coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR_FORECAST]
async_add_entities(
[
MeteoFranceWeather(
coordin... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
")",
"->",
"None",
":",
"coordinator",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"[... | [
45,
0
] | [
64,
5
] | python | en | ['en', 'da', 'en'] | True |
MeteoFranceWeather.__init__ | (self, coordinator: DataUpdateCoordinator, mode: str) | Initialise the platform with a data instance and station name. | Initialise the platform with a data instance and station name. | def __init__(self, coordinator: DataUpdateCoordinator, mode: str) -> None:
"""Initialise the platform with a data instance and station name."""
super().__init__(coordinator)
self._city_name = self.coordinator.data.position["name"]
self._mode = mode
self._unique_id = f"{self.coord... | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"DataUpdateCoordinator",
",",
"mode",
":",
"str",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_city_name",
"=",
"self",
".",
"coordinator",
".... | [
70,
4
] | [
75,
108
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceWeather.unique_id | (self) | Return the unique id of the sensor. | Return the unique id of the sensor. | def unique_id(self):
"""Return the unique id of the sensor."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
78,
4
] | [
80,
30
] | python | en | ['en', 'la', 'en'] | True |
MeteoFranceWeather.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._city_name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_city_name"
] | [
83,
4
] | [
85,
30
] | python | en | ['en', 'mi', 'en'] | True |
MeteoFranceWeather.device_info | (self) | Return the device info. | Return the device info. | def device_info(self):
"""Return the device info."""
return {
"identifiers": {(DOMAIN, self.platform.config_entry.unique_id)},
"name": self.coordinator.name,
"manufacturer": MANUFACTURER,
"model": MODEL,
"entry_type": "service",
} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"platform",
".",
"config_entry",
".",
"unique_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"coordinator",
".",
"name",
",",
"... | [
88,
4
] | [
96,
9
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceWeather.condition | (self) | Return the current condition. | Return the current condition. | def condition(self):
"""Return the current condition."""
return format_condition(
self.coordinator.data.current_forecast["weather"]["desc"]
) | [
"def",
"condition",
"(",
"self",
")",
":",
"return",
"format_condition",
"(",
"self",
".",
"coordinator",
".",
"data",
".",
"current_forecast",
"[",
"\"weather\"",
"]",
"[",
"\"desc\"",
"]",
")"
] | [
99,
4
] | [
103,
9
] | python | en | ['en', 'en', 'en'] | True |
MeteoFranceWeather.temperature | (self) | Return the temperature. | Return the temperature. | def temperature(self):
"""Return the temperature."""
return self.coordinator.data.current_forecast["T"]["value"] | [
"def",
"temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
".",
"current_forecast",
"[",
"\"T\"",
"]",
"[",
"\"value\"",
"]"
] | [
106,
4
] | [
108,
67
] | python | en | ['en', 'la', 'en'] | True |
MeteoFranceWeather.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
111,
4
] | [
113,
27
] | python | en | ['en', 'la', 'en'] | True |
MeteoFranceWeather.pressure | (self) | Return the pressure. | Return the pressure. | def pressure(self):
"""Return the pressure."""
return self.coordinator.data.current_forecast["sea_level"] | [
"def",
"pressure",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
".",
"current_forecast",
"[",
"\"sea_level\"",
"]"
] | [
116,
4
] | [
118,
66
] | python | en | ['en', 'ig', 'en'] | True |
MeteoFranceWeather.humidity | (self) | Return the humidity. | Return the humidity. | def humidity(self):
"""Return the humidity."""
return self.coordinator.data.current_forecast["humidity"] | [
"def",
"humidity",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
".",
"current_forecast",
"[",
"\"humidity\"",
"]"
] | [
121,
4
] | [
123,
65
] | python | en | ['en', 'sw', 'en'] | True |
MeteoFranceWeather.wind_speed | (self) | Return the wind speed. | Return the wind speed. | def wind_speed(self):
"""Return the wind speed."""
# convert from API m/s to km/h
return round(self.coordinator.data.current_forecast["wind"]["speed"] * 3.6) | [
"def",
"wind_speed",
"(",
"self",
")",
":",
"# convert from API m/s to km/h",
"return",
"round",
"(",
"self",
".",
"coordinator",
".",
"data",
".",
"current_forecast",
"[",
"\"wind\"",
"]",
"[",
"\"speed\"",
"]",
"*",
"3.6",
")"
] | [
126,
4
] | [
129,
83
] | python | en | ['en', 'zh', 'en'] | True |
MeteoFranceWeather.wind_bearing | (self) | Return the wind bearing. | Return the wind bearing. | def wind_bearing(self):
"""Return the wind bearing."""
wind_bearing = self.coordinator.data.current_forecast["wind"]["direction"]
if wind_bearing != -1:
return wind_bearing | [
"def",
"wind_bearing",
"(",
"self",
")",
":",
"wind_bearing",
"=",
"self",
".",
"coordinator",
".",
"data",
".",
"current_forecast",
"[",
"\"wind\"",
"]",
"[",
"\"direction\"",
"]",
"if",
"wind_bearing",
"!=",
"-",
"1",
":",
"return",
"wind_bearing"
] | [
132,
4
] | [
136,
31
] | python | en | ['en', 'ig', 'en'] | True |
MeteoFranceWeather.forecast | (self) | Return the forecast. | Return the forecast. | def forecast(self):
"""Return the forecast."""
forecast_data = []
if self._mode == FORECAST_MODE_HOURLY:
today = time.time()
for forecast in self.coordinator.data.forecast:
# Can have data in the past
if forecast["dt"] < today:
... | [
"def",
"forecast",
"(",
"self",
")",
":",
"forecast_data",
"=",
"[",
"]",
"if",
"self",
".",
"_mode",
"==",
"FORECAST_MODE_HOURLY",
":",
"today",
"=",
"time",
".",
"time",
"(",
")",
"for",
"forecast",
"in",
"self",
".",
"coordinator",
".",
"data",
".",... | [
139,
4
] | [
183,
28
] | python | en | ['en', 'no', 'en'] | True |
MeteoFranceWeather.attribution | (self) | Return the attribution. | Return the attribution. | def attribution(self):
"""Return the attribution."""
return ATTRIBUTION | [
"def",
"attribution",
"(",
"self",
")",
":",
"return",
"ATTRIBUTION"
] | [
186,
4
] | [
188,
26
] | python | en | ['en', 'ja', 'en'] | True |
generic_data_fixture | () | Load generic MQTT data and return it. | Load generic MQTT data and return it. | def generic_data_fixture():
"""Load generic MQTT data and return it."""
return load_fixture("ozw/generic_network_dump.csv") | [
"def",
"generic_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/generic_network_dump.csv\"",
")"
] | [
15,
0
] | [
17,
55
] | python | en | ['en', 'mt', 'en'] | True |
migration_data_fixture | () | Load migration MQTT data and return it. | Load migration MQTT data and return it. | def migration_data_fixture():
"""Load migration MQTT data and return it."""
return load_fixture("ozw/migration_fixture.csv") | [
"def",
"migration_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/migration_fixture.csv\"",
")"
] | [
21,
0
] | [
23,
52
] | python | en | ['en', 'mt', 'en'] | True |
fan_data_fixture | () | Load fan MQTT data and return it. | Load fan MQTT data and return it. | def fan_data_fixture():
"""Load fan MQTT data and return it."""
return load_fixture("ozw/fan_network_dump.csv") | [
"def",
"fan_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/fan_network_dump.csv\"",
")"
] | [
27,
0
] | [
29,
51
] | python | en | ['en', 'mt', 'en'] | True |
light_data_fixture | () | Load light dimmer MQTT data and return it. | Load light dimmer MQTT data and return it. | def light_data_fixture():
"""Load light dimmer MQTT data and return it."""
return load_fixture("ozw/light_network_dump.csv") | [
"def",
"light_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/light_network_dump.csv\"",
")"
] | [
33,
0
] | [
35,
53
] | python | en | ['en', 'no', 'en'] | True |
light_new_ozw_data_fixture | () | Load light dimmer MQTT data and return it. | Load light dimmer MQTT data and return it. | def light_new_ozw_data_fixture():
"""Load light dimmer MQTT data and return it."""
return load_fixture("ozw/light_new_ozw_network_dump.csv") | [
"def",
"light_new_ozw_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/light_new_ozw_network_dump.csv\"",
")"
] | [
39,
0
] | [
41,
61
] | python | en | ['en', 'no', 'en'] | True |
light_no_ww_data_fixture | () | Load light dimmer MQTT data and return it. | Load light dimmer MQTT data and return it. | def light_no_ww_data_fixture():
"""Load light dimmer MQTT data and return it."""
return load_fixture("ozw/light_no_ww_network_dump.csv") | [
"def",
"light_no_ww_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/light_no_ww_network_dump.csv\"",
")"
] | [
45,
0
] | [
47,
59
] | python | en | ['en', 'no', 'en'] | True |
light_no_cw_data_fixture | () | Load light dimmer MQTT data and return it. | Load light dimmer MQTT data and return it. | def light_no_cw_data_fixture():
"""Load light dimmer MQTT data and return it."""
return load_fixture("ozw/light_no_cw_network_dump.csv") | [
"def",
"light_no_cw_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/light_no_cw_network_dump.csv\"",
")"
] | [
51,
0
] | [
53,
59
] | python | en | ['en', 'no', 'en'] | True |
light_wc_only_data_fixture | () | Load light dimmer MQTT data and return it. | Load light dimmer MQTT data and return it. | def light_wc_only_data_fixture():
"""Load light dimmer MQTT data and return it."""
return load_fixture("ozw/light_wc_network_dump.csv") | [
"def",
"light_wc_only_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/light_wc_network_dump.csv\"",
")"
] | [
57,
0
] | [
59,
56
] | python | en | ['en', 'no', 'en'] | True |
cover_data_fixture | () | Load cover MQTT data and return it. | Load cover MQTT data and return it. | def cover_data_fixture():
"""Load cover MQTT data and return it."""
return load_fixture("ozw/cover_network_dump.csv") | [
"def",
"cover_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/cover_network_dump.csv\"",
")"
] | [
63,
0
] | [
65,
53
] | python | en | ['en', 'en', 'en'] | True |
cover_gdo_data_fixture | () | Load cover_gdo MQTT data and return it. | Load cover_gdo MQTT data and return it. | def cover_gdo_data_fixture():
"""Load cover_gdo MQTT data and return it."""
return load_fixture("ozw/cover_gdo_network_dump.csv") | [
"def",
"cover_gdo_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/cover_gdo_network_dump.csv\"",
")"
] | [
69,
0
] | [
71,
57
] | python | en | ['en', 'en', 'en'] | True |
climate_data_fixture | () | Load climate MQTT data and return it. | Load climate MQTT data and return it. | def climate_data_fixture():
"""Load climate MQTT data and return it."""
return load_fixture("ozw/climate_network_dump.csv") | [
"def",
"climate_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/climate_network_dump.csv\"",
")"
] | [
75,
0
] | [
77,
55
] | python | en | ['en', 'en', 'en'] | True |
lock_data_fixture | () | Load lock MQTT data and return it. | Load lock MQTT data and return it. | def lock_data_fixture():
"""Load lock MQTT data and return it."""
return load_fixture("ozw/lock_network_dump.csv") | [
"def",
"lock_data_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/lock_network_dump.csv\"",
")"
] | [
81,
0
] | [
83,
52
] | python | en | ['en', 'mt', 'en'] | True |
string_sensor_fixture | () | Load string sensor MQTT data and return it. | Load string sensor MQTT data and return it. | def string_sensor_fixture():
"""Load string sensor MQTT data and return it."""
return load_fixture("ozw/sensor_string_value_network_dump.csv") | [
"def",
"string_sensor_fixture",
"(",
")",
":",
"return",
"load_fixture",
"(",
"\"ozw/sensor_string_value_network_dump.csv\"",
")"
] | [
87,
0
] | [
89,
67
] | python | en | ['en', 'mt', 'en'] | True |
sent_messages_fixture | () | Fixture to capture sent messages. | Fixture to capture sent messages. | def sent_messages_fixture():
"""Fixture to capture sent messages."""
sent_messages = []
with patch(
"homeassistant.components.mqtt.async_publish",
side_effect=lambda hass, topic, payload: sent_messages.append(
{"topic": topic, "payload": json.loads(payload)}
),
):
... | [
"def",
"sent_messages_fixture",
"(",
")",
":",
"sent_messages",
"=",
"[",
"]",
"with",
"patch",
"(",
"\"homeassistant.components.mqtt.async_publish\"",
",",
"side_effect",
"=",
"lambda",
"hass",
",",
"topic",
",",
"payload",
":",
"sent_messages",
".",
"append",
"(... | [
93,
0
] | [
103,
27
] | python | en | ['en', 'fr', 'en'] | True |
fan_msg_fixture | (hass) | Return a mock MQTT msg with a fan actuator message. | Return a mock MQTT msg with a fan actuator message. | async def fan_msg_fixture(hass):
"""Return a mock MQTT msg with a fan actuator message."""
fan_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/fan.json")
)
message = MQTTMessage(topic=fan_json["topic"], payload=fan_json["payload"])
message.encode()
return message | [
"async",
"def",
"fan_msg_fixture",
"(",
"hass",
")",
":",
"fan_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/fan.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",
"topic",
"=",
"f... | [
107,
0
] | [
114,
18
] | python | en | ['en', 'en', 'en'] | True |
light_msg_fixture | (hass) | Return a mock MQTT msg with a light actuator message. | Return a mock MQTT msg with a light actuator message. | async def light_msg_fixture(hass):
"""Return a mock MQTT msg with a light actuator message."""
light_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/light.json")
)
message = MQTTMessage(topic=light_json["topic"], payload=light_json["payload"])
message.encode()
ret... | [
"async",
"def",
"light_msg_fixture",
"(",
"hass",
")",
":",
"light_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/light.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",
"topic",
"="... | [
118,
0
] | [
125,
18
] | python | en | ['en', 'lb', 'en'] | True |
light_no_rgb_msg_fixture | (hass) | Return a mock MQTT msg with a light actuator message. | Return a mock MQTT msg with a light actuator message. | async def light_no_rgb_msg_fixture(hass):
"""Return a mock MQTT msg with a light actuator message."""
light_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/light_no_rgb.json")
)
message = MQTTMessage(topic=light_json["topic"], payload=light_json["payload"])
message.en... | [
"async",
"def",
"light_no_rgb_msg_fixture",
"(",
"hass",
")",
":",
"light_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/light_no_rgb.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",
... | [
129,
0
] | [
136,
18
] | python | en | ['en', 'lb', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.