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_alarm_control_panel_armed | (hass) | Test alarm_control_panel discovery. | Test alarm_control_panel discovery. | async def test_alarm_control_panel_armed(hass):
"""Test alarm_control_panel discovery."""
device = (
"alarm_control_panel.test_2",
"armed_away",
{
"friendly_name": "Test Alarm Control Panel 2",
"code_arm_required": False,
"code_format": "FORMAT_NUMBER"... | [
"async",
"def",
"test_alarm_control_panel_armed",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"alarm_control_panel.test_2\"",
",",
"\"armed_away\"",
",",
"{",
"\"friendly_name\"",
":",
"\"Test Alarm Control Panel 2\"",
",",
"\"code_arm_required\"",
":",
"False",
",",
"... | [
2493,
0
] | [
2538,
70
] | python | en | ['tr', 'en', 'en'] | True |
test_alarm_control_panel_code_arm_required | (hass) | Test alarm_control_panel with code_arm_required not in discovery. | Test alarm_control_panel with code_arm_required not in discovery. | async def test_alarm_control_panel_code_arm_required(hass):
"""Test alarm_control_panel with code_arm_required not in discovery."""
device = (
"alarm_control_panel.test_3",
"disarmed",
{
"friendly_name": "Test Alarm Control Panel 3",
"code_arm_required": True,
... | [
"async",
"def",
"test_alarm_control_panel_code_arm_required",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"alarm_control_panel.test_3\"",
",",
"\"disarmed\"",
",",
"{",
"\"friendly_name\"",
":",
"\"Test Alarm Control Panel 3\"",
",",
"\"code_arm_required\"",
":",
"True",
... | [
2541,
0
] | [
2552,
60
] | python | en | ['en', 'en', 'en'] | True |
test_range_unsupported_domain | (hass) | Test rangeController with unsupported domain. | Test rangeController with unsupported domain. | async def test_range_unsupported_domain(hass):
"""Test rangeController with unsupported domain."""
device = ("switch.test", "on", {"friendly_name": "Test switch"})
await discovery_test(device, hass)
context = Context()
request = get_new_request("Alexa.RangeController", "SetRangeValue", "switch#test... | [
"async",
"def",
"test_range_unsupported_domain",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"switch.test\"",
",",
"\"on\"",
",",
"{",
"\"friendly_name\"",
":",
"\"Test switch\"",
"}",
")",
"await",
"discovery_test",
"(",
"device",
",",
"hass",
")",
"context",
... | [
2555,
0
] | [
2571,
56
] | python | en | ['en', 'en', 'en'] | True |
test_mode_unsupported_domain | (hass) | Test modeController with unsupported domain. | Test modeController with unsupported domain. | async def test_mode_unsupported_domain(hass):
"""Test modeController with unsupported domain."""
device = ("switch.test", "on", {"friendly_name": "Test switch"})
await discovery_test(device, hass)
context = Context()
request = get_new_request("Alexa.ModeController", "SetMode", "switch#test")
re... | [
"async",
"def",
"test_mode_unsupported_domain",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"switch.test\"",
",",
"\"on\"",
",",
"{",
"\"friendly_name\"",
":",
"\"Test switch\"",
"}",
")",
"await",
"discovery_test",
"(",
"device",
",",
"hass",
")",
"context",
... | [
2574,
0
] | [
2590,
56
] | python | en | ['en', 'en', 'en'] | True |
test_cover_garage_door | (hass) | Test garage door cover discovery. | Test garage door cover discovery. | async def test_cover_garage_door(hass):
"""Test garage door cover discovery."""
device = (
"cover.test_garage_door",
"off",
{
"friendly_name": "Test cover garage door",
"supported_features": 3,
"device_class": "garage",
},
)
appliance =... | [
"async",
"def",
"test_cover_garage_door",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"cover.test_garage_door\"",
",",
"\"off\"",
",",
"{",
"\"friendly_name\"",
":",
"\"Test cover garage door\"",
",",
"\"supported_features\"",
":",
"3",
",",
"\"device_class\"",
":",
... | [
2593,
0
] | [
2612,
5
] | python | nl | ['nl', 'nl', 'en'] | True |
test_cover_gate | (hass) | Test gate cover discovery. | Test gate cover discovery. | async def test_cover_gate(hass):
"""Test gate cover discovery."""
device = (
"cover.test_gate",
"off",
{
"friendly_name": "Test cover gate",
"supported_features": 3,
"device_class": DEVICE_CLASS_GATE,
},
)
appliance = await discovery_te... | [
"async",
"def",
"test_cover_gate",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"cover.test_gate\"",
",",
"\"off\"",
",",
"{",
"\"friendly_name\"",
":",
"\"Test cover gate\"",
",",
"\"supported_features\"",
":",
"3",
",",
"\"device_class\"",
":",
"DEVICE_CLASS_GATE"... | [
2615,
0
] | [
2634,
5
] | python | en | ['nl', 'en', 'en'] | True |
test_cover_position_mode | (hass) | Test cover discovery and position using modeController. | Test cover discovery and position using modeController. | async def test_cover_position_mode(hass):
"""Test cover discovery and position using modeController."""
device = (
"cover.test_mode",
"open",
{
"friendly_name": "Test cover mode",
"device_class": "blind",
"supported_features": 3,
},
)
a... | [
"async",
"def",
"test_cover_position_mode",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"cover.test_mode\"",
",",
"\"open\"",
",",
"{",
"\"friendly_name\"",
":",
"\"Test cover mode\"",
",",
"\"device_class\"",
":",
"\"blind\"",
",",
"\"supported_features\"",
":",
"... | [
2637,
0
] | [
2775,
51
] | python | en | ['en', 'en', 'en'] | True |
test_image_processing | (hass) | Test image_processing discovery as event detection. | Test image_processing discovery as event detection. | async def test_image_processing(hass):
"""Test image_processing discovery as event detection."""
device = (
"image_processing.test_face",
0,
{
"friendly_name": "Test face",
"device_class": "face",
"faces": [],
"total_faces": 0,
},
... | [
"async",
"def",
"test_image_processing",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"image_processing.test_face\"",
",",
"0",
",",
"{",
"\"friendly_name\"",
":",
"\"Test face\"",
",",
"\"device_class\"",
":",
"\"face\"",
",",
"\"faces\"",
":",
"[",
"]",
",",
... | [
2778,
0
] | [
2798,
5
] | python | en | ['en', 'en', 'en'] | True |
test_motion_sensor_event_detection | (hass) | Test motion sensor with EventDetectionSensor discovery. | Test motion sensor with EventDetectionSensor discovery. | async def test_motion_sensor_event_detection(hass):
"""Test motion sensor with EventDetectionSensor discovery."""
device = (
"binary_sensor.test_motion_camera_event",
"off",
{"friendly_name": "Test motion camera event", "device_class": "motion"},
)
appliance = await discovery_tes... | [
"async",
"def",
"test_motion_sensor_event_detection",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"binary_sensor.test_motion_camera_event\"",
",",
"\"off\"",
",",
"{",
"\"friendly_name\"",
":",
"\"Test motion camera event\"",
",",
"\"device_class\"",
":",
"\"motion\"",
"... | [
2801,
0
] | [
2829,
77
] | python | en | ['en', 'en', 'en'] | True |
test_presence_sensor | (hass) | Test presence sensor. | Test presence sensor. | async def test_presence_sensor(hass):
"""Test presence sensor."""
device = (
"binary_sensor.test_presence_sensor",
"off",
{"friendly_name": "Test presence sensor", "device_class": "presence"},
)
appliance = await discovery_test(device, hass)
assert appliance["endpointId"] ==... | [
"async",
"def",
"test_presence_sensor",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"binary_sensor.test_presence_sensor\"",
",",
"\"off\"",
",",
"{",
"\"friendly_name\"",
":",
"\"Test presence sensor\"",
",",
"\"device_class\"",
":",
"\"presence\"",
"}",
",",
")",
... | [
2832,
0
] | [
2856,
77
] | python | en | ['en', 'bs', 'en'] | True |
test_cover_tilt_position_range | (hass) | Test cover discovery and tilt position using rangeController. | Test cover discovery and tilt position using rangeController. | async def test_cover_tilt_position_range(hass):
"""Test cover discovery and tilt position using rangeController."""
device = (
"cover.test_tilt_range",
"open",
{
"friendly_name": "Test cover tilt range",
"device_class": "blind",
"supported_features": 2... | [
"async",
"def",
"test_cover_tilt_position_range",
"(",
"hass",
")",
":",
"device",
"=",
"(",
"\"cover.test_tilt_range\"",
",",
"\"open\"",
",",
"{",
"\"friendly_name\"",
":",
"\"Test cover tilt range\"",
",",
"\"device_class\"",
":",
"\"blind\"",
",",
"\"supported_featu... | [
2859,
0
] | [
2974,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unload_config_entry | (hass) | Test unload config entry flow. | Test unload config entry flow. | async def test_unload_config_entry(hass):
"""Test unload config entry flow."""
with patch("pysmappee.api.SmappeeLocalApi.logon", return_value={}), patch(
"pysmappee.api.SmappeeLocalApi.load_advanced_config",
return_value=[{"key": "mdnsHostName", "value": "Smappee1006000212"}],
), patch(
... | [
"async",
"def",
"test_unload_config_entry",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"pysmappee.api.SmappeeLocalApi.logon\"",
",",
"return_value",
"=",
"{",
"}",
")",
",",
"patch",
"(",
"\"pysmappee.api.SmappeeLocalApi.load_advanced_config\"",
",",
"return_value",
... | [
8,
0
] | [
31,
40
] | python | en | ['en', 'da', 'en'] | True |
get_all_builtin_names | (algo_type) | Get all builtin names of registered algorithms of specified type
Parameters
----------
algo_type: str
can be one of 'tuners', 'assessors' or 'advisors'
Returns: list of string
-------
All builtin names of specified type, for example, if algo_type is 'tuners', returns
all builtin tu... | Get all builtin names of registered algorithms of specified type | def get_all_builtin_names(algo_type):
"""Get all builtin names of registered algorithms of specified type
Parameters
----------
algo_type: str
can be one of 'tuners', 'assessors' or 'advisors'
Returns: list of string
-------
All builtin names of specified type, for example, if algo... | [
"def",
"get_all_builtin_names",
"(",
"algo_type",
")",
":",
"assert",
"algo_type",
"in",
"ALGO_TYPES",
"return",
"[",
"x",
"[",
"'builtinName'",
"]",
"for",
"x",
"in",
"read_registerd_algo_meta",
"(",
")",
"[",
"algo_type",
"]",
"]"
] | [
13,
0
] | [
28,
76
] | python | en | ['en', 'en', 'en'] | True |
get_registered_algo_meta | (builtin_name, algo_type=None) | Get meta information of registered algorithms.
Parameters
----------
builtin_name: str
builtin name.
algo_type: str | None
can be one of 'tuners', 'assessors', 'advisors' or None
Returns: dict | None
-------
Returns meta information of speicified builtin alogorithms, f... | Get meta information of registered algorithms. | def get_registered_algo_meta(builtin_name, algo_type=None):
""" Get meta information of registered algorithms.
Parameters
----------
builtin_name: str
builtin name.
algo_type: str | None
can be one of 'tuners', 'assessors', 'advisors' or None
Returns: dict | None
-------
... | [
"def",
"get_registered_algo_meta",
"(",
"builtin_name",
",",
"algo_type",
"=",
"None",
")",
":",
"assert",
"builtin_name",
"is",
"not",
"None",
"if",
"algo_type",
":",
"assert",
"algo_type",
"in",
"ALGO_TYPES",
"config",
"=",
"read_registerd_algo_meta",
"(",
")",
... | [
31,
0
] | [
64,
15
] | python | en | ['en', 'da', 'en'] | True |
get_builtin_module_class_name | (algo_type, builtin_name) | Get module name and class name of all builtin algorithms
Parameters
----------
algo_type: str
can be one of 'tuners', 'assessors', 'advisors'
builtin_name: str
builtin name.
Returns: tuple
-------
tuple of (module name, class name)
| Get module name and class name of all builtin algorithms | def get_builtin_module_class_name(algo_type, builtin_name):
"""Get module name and class name of all builtin algorithms
Parameters
----------
algo_type: str
can be one of 'tuners', 'assessors', 'advisors'
builtin_name: str
builtin name.
Returns: tuple
-------
tuple ... | [
"def",
"get_builtin_module_class_name",
"(",
"algo_type",
",",
"builtin_name",
")",
":",
"assert",
"algo_type",
"in",
"ALGO_TYPES",
"assert",
"builtin_name",
"is",
"not",
"None",
"meta",
"=",
"get_registered_algo_meta",
"(",
"builtin_name",
",",
"algo_type",
")",
"i... | [
73,
0
] | [
92,
51
] | python | en | ['en', 'en', 'en'] | True |
create_validator_instance | (algo_type, builtin_name) | Create instance of validator class
Parameters
----------
algo_type: str
can be one of 'tuners', 'assessors', 'advisors'
builtin_name: str
builtin name.
Returns: object | None
-------
Returns validator class instance.
If specified validator class does not exist, ... | Create instance of validator class | def create_validator_instance(algo_type, builtin_name):
"""Create instance of validator class
Parameters
----------
algo_type: str
can be one of 'tuners', 'assessors', 'advisors'
builtin_name: str
builtin name.
Returns: object | None
-------
Returns validator class ... | [
"def",
"create_validator_instance",
"(",
"algo_type",
",",
"builtin_name",
")",
":",
"assert",
"algo_type",
"in",
"ALGO_TYPES",
"assert",
"builtin_name",
"is",
"not",
"None",
"meta",
"=",
"get_registered_algo_meta",
"(",
"builtin_name",
",",
"algo_type",
")",
"if",
... | [
94,
0
] | [
118,
30
] | python | en | ['en', 'en', 'en'] | True |
create_builtin_class_instance | (builtin_name, input_class_args, algo_type) | Create instance of builtin algorithms
Parameters
----------
builtin_name: str
builtin name.
input_class_args: dict
kwargs for builtin class constructor
algo_type: str
can be one of 'tuners', 'assessors', 'advisors'
Returns: object
-------
Returns builtin cla... | Create instance of builtin algorithms | def create_builtin_class_instance(builtin_name, input_class_args, algo_type):
"""Create instance of builtin algorithms
Parameters
----------
builtin_name: str
builtin name.
input_class_args: dict
kwargs for builtin class constructor
algo_type: str
can be one of 'tuners',... | [
"def",
"create_builtin_class_instance",
"(",
"builtin_name",
",",
"input_class_args",
",",
"algo_type",
")",
":",
"assert",
"algo_type",
"in",
"ALGO_TYPES",
"if",
"builtin_name",
"not",
"in",
"get_all_builtin_names",
"(",
"algo_type",
")",
":",
"raise",
"RuntimeError"... | [
120,
0
] | [
171,
19
] | python | en | ['en', 'ro', 'en'] | True |
create_customized_class_instance | (class_params) | Create instance of customized algorithms
Parameters
----------
class_params: dict
class_params should contains following keys:
codeDirectory: code directory
className: qualified class name
classArgs (optional): kwargs pass to class constructor
Returns: objec... | Create instance of customized algorithms | def create_customized_class_instance(class_params):
"""Create instance of customized algorithms
Parameters
----------
class_params: dict
class_params should contains following keys:
codeDirectory: code directory
className: qualified class name
classArgs (opti... | [
"def",
"create_customized_class_instance",
"(",
"class_params",
")",
":",
"code_dir",
"=",
"class_params",
".",
"get",
"(",
"'classDirectory'",
")",
"qualified_class_name",
"=",
"class_params",
".",
"get",
"(",
"'className'",
")",
"class_args",
"=",
"class_params",
... | [
173,
0
] | [
205,
19
] | python | en | ['en', 'ro', 'en'] | True |
async_setup | (hass, config) | Import the Mikrotik component from config. | Import the Mikrotik component from config. | async def async_setup(hass, config):
"""Import the Mikrotik component from config."""
if DOMAIN in config:
for entry in config[DOMAIN]:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=entry
... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"if",
"DOMAIN",
"in",
"config",
":",
"for",
"entry",
"in",
"config",
"[",
"DOMAIN",
"]",
":",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"flow",
".",
"... | [
49,
0
] | [
60,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry) | Set up the Mikrotik component. | Set up the Mikrotik component. | async def async_setup_entry(hass, config_entry):
"""Set up the Mikrotik component."""
hub = MikrotikHub(hass, config_entry)
if not await hub.async_setup():
return False
hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = hub
device_registry = await hass.helpers.device_registry.async_... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"hub",
"=",
"MikrotikHub",
"(",
"hass",
",",
"config_entry",
")",
"if",
"not",
"await",
"hub",
".",
"async_setup",
"(",
")",
":",
"return",
"False",
"hass",
".",
"data",
"."... | [
63,
0
] | [
81,
15
] | python | en | ['en', 'fr', 'en'] | True |
async_unload_entry | (hass, config_entry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, config_entry):
"""Unload a config entry."""
await hass.config_entries.async_forward_entry_unload(config_entry, "device_tracker")
hass.data[DOMAIN].pop(config_entry.entry_id)
return True | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"config_entry",
",",
"\"device_tracker\"",
")",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"pop",... | [
84,
0
] | [
90,
15
] | python | en | ['en', 'es', 'en'] | True |
async_setup | (hass, config) | Initialize the Sure Petcare component. | Initialize the Sure Petcare component. | async def async_setup(hass, config) -> bool:
"""Initialize the Sure Petcare component."""
conf = config[DOMAIN]
# update interval
scan_interval = conf[CONF_SCAN_INTERVAL]
# shared data
hass.data[DOMAIN] = hass.data[DATA_SURE_PETCARE] = {}
# sure petcare api connection
try:
sur... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
"->",
"bool",
":",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"# update interval",
"scan_interval",
"=",
"conf",
"[",
"CONF_SCAN_INTERVAL",
"]",
"# shared data",
"hass",
".",
"data",
"[",
"DOMAI... | [
64,
0
] | [
144,
15
] | python | en | ['en', 'en', 'en'] | True |
SurePetcareAPI.__init__ | (self, hass, surepy: SurePetcare, ids: List[Dict[str, Any]]) | Initialize the Sure Petcare object. | Initialize the Sure Petcare object. | def __init__(self, hass, surepy: SurePetcare, ids: List[Dict[str, Any]]) -> None:
"""Initialize the Sure Petcare object."""
self.hass = hass
self.surepy = surepy
self.ids = ids
self.states: Dict[str, Any] = {} | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"surepy",
":",
"SurePetcare",
",",
"ids",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
")",
"->",
"None",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"surepy",
"=",
"surepy"... | [
150,
4
] | [
155,
40
] | python | en | ['en', 'en', 'en'] | True |
SurePetcareAPI.async_update | (self, arg: Any = None) | Refresh Sure Petcare data. | Refresh Sure Petcare data. | async def async_update(self, arg: Any = None) -> None:
"""Refresh Sure Petcare data."""
await self.surepy.get_data()
for thing in self.ids:
sure_id = thing[CONF_ID]
sure_type = thing[CONF_TYPE]
try:
type_state = self.states.setdefault(sure_t... | [
"async",
"def",
"async_update",
"(",
"self",
",",
"arg",
":",
"Any",
"=",
"None",
")",
"->",
"None",
":",
"await",
"self",
".",
"surepy",
".",
"get_data",
"(",
")",
"for",
"thing",
"in",
"self",
".",
"ids",
":",
"sure_id",
"=",
"thing",
"[",
"CONF_... | [
157,
4
] | [
182,
54
] | python | en | ['ro', 'it', 'en'] | False |
test_random_sensor | (hass) | Test the Random number sensor. | Test the Random number sensor. | async def test_random_sensor(hass):
"""Test the Random number sensor."""
config = {
"sensor": {
"platform": "random",
"name": "test",
"minimum": 10,
"maximum": 20,
}
}
assert await async_setup_component(
hass,
"sensor",
... | [
"async",
"def",
"test_random_sensor",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"\"sensor\"",
":",
"{",
"\"platform\"",
":",
"\"random\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"minimum\"",
":",
"10",
",",
"\"maximum\"",
":",
"20",
",",
"}",
"}",
"as... | [
4,
0
] | [
25,
58
] | python | en | ['en', 'da', 'en'] | True |
SongpalConfig.__init__ | (self, name, host, endpoint) | Initialize Configuration. | Initialize Configuration. | def __init__(self, name, host, endpoint):
"""Initialize Configuration."""
self.name = name
self.host = host
self.endpoint = endpoint | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"host",
",",
"endpoint",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"host",
"=",
"host",
"self",
".",
"endpoint",
"=",
"endpoint"
] | [
21,
4
] | [
25,
32
] | python | en | ['en', 'en', 'en'] | False |
SongpalConfigFlow.__init__ | (self) | Initialize the flow. | Initialize the flow. | def __init__(self):
"""Initialize the flow."""
self.conf: Optional[SongpalConfig] = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"conf",
":",
"Optional",
"[",
"SongpalConfig",
"]",
"=",
"None"
] | [
34,
4
] | [
36,
49
] | python | en | ['en', 'en', 'en'] | True |
SongpalConfigFlow.async_step_user | (self, user_input=None) | Handle a flow initiated by the user. | Handle a flow initiated by the user. | async def async_step_user(self, user_input=None):
"""Handle a flow initiated by the user."""
if user_input is None:
return self.async_show_form(
step_id="user",
data_schema=vol.Schema({vol.Required(CONF_ENDPOINT): str}),
)
# Validate input... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"None",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"user\"",
",",
"data_schema",
"=",
"vol",
".",
"Schema",
"(",
... | [
38,
4
] | [
72,
53
] | python | en | ['en', 'en', 'en'] | True |
SongpalConfigFlow.async_step_init | (self, user_input=None) | Handle a flow start. | Handle a flow start. | async def async_step_init(self, user_input=None):
"""Handle a flow start."""
# Check if already configured
if self._async_endpoint_already_configured():
return self.async_abort(reason="already_configured")
if user_input is None:
return self.async_show_form(
... | [
"async",
"def",
"async_step_init",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"# Check if already configured",
"if",
"self",
".",
"_async_endpoint_already_configured",
"(",
")",
":",
"return",
"self",
".",
"async_abort",
"(",
"reason",
"=",
"\"already_... | [
74,
4
] | [
95,
9
] | python | en | ['en', 'lb', 'en'] | True |
SongpalConfigFlow.async_step_ssdp | (self, discovery_info) | Handle a discovered Songpal device. | Handle a discovered Songpal device. | async def async_step_ssdp(self, discovery_info):
"""Handle a discovered Songpal device."""
await self.async_set_unique_id(discovery_info[ssdp.ATTR_UPNP_UDN])
self._abort_if_unique_id_configured()
_LOGGER.debug("Discovered: %s", discovery_info)
friendly_name = discovery_info[ssd... | [
"async",
"def",
"async_step_ssdp",
"(",
"self",
",",
"discovery_info",
")",
":",
"await",
"self",
".",
"async_set_unique_id",
"(",
"discovery_info",
"[",
"ssdp",
".",
"ATTR_UPNP_UDN",
"]",
")",
"self",
".",
"_abort_if_unique_id_configured",
"(",
")",
"_LOGGER",
... | [
97,
4
] | [
124,
43
] | python | en | ['es', 'en', 'en'] | True |
SongpalConfigFlow.async_step_import | (self, user_input=None) | Import a config entry. | Import a config entry. | async def async_step_import(self, user_input=None):
"""Import a config entry."""
name = user_input.get(CONF_NAME)
endpoint = user_input.get(CONF_ENDPOINT)
parsed_url = urlparse(endpoint)
# Try to connect to test the endpoint
try:
device = Device(endpoint)
... | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"name",
"=",
"user_input",
".",
"get",
"(",
"CONF_NAME",
")",
"endpoint",
"=",
"user_input",
".",
"get",
"(",
"CONF_ENDPOINT",
")",
"parsed_url",
"=",
"urlparse",
"... | [
126,
4
] | [
146,
53
] | python | en | ['en', 'en', 'en'] | True |
SongpalConfigFlow._async_endpoint_already_configured | (self) | See if we already have an endpoint matching user input configured. | See if we already have an endpoint matching user input configured. | def _async_endpoint_already_configured(self):
"""See if we already have an endpoint matching user input configured."""
for entry in self._async_current_entries():
if entry.data.get(CONF_ENDPOINT) == self.conf.endpoint:
return True
return False | [
"def",
"_async_endpoint_already_configured",
"(",
"self",
")",
":",
"for",
"entry",
"in",
"self",
".",
"_async_current_entries",
"(",
")",
":",
"if",
"entry",
".",
"data",
".",
"get",
"(",
"CONF_ENDPOINT",
")",
"==",
"self",
".",
"conf",
".",
"endpoint",
"... | [
149,
4
] | [
154,
20
] | python | en | ['en', 'en', 'en'] | True |
_async_has_devices | (hass) | Return if there are devices that can be discovered. | Return if there are devices that can be discovered. | async def _async_has_devices(hass):
"""Return if there are devices that can be discovered."""
return bool(await hass.async_add_executor_job(pywemo.discover_devices)) | [
"async",
"def",
"_async_has_devices",
"(",
"hass",
")",
":",
"return",
"bool",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"pywemo",
".",
"discover_devices",
")",
")"
] | [
10,
0
] | [
12,
75
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up sensors for a Nexia device. | Set up sensors for a Nexia device. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up sensors for a Nexia device."""
nexia_data = hass.data[DOMAIN][config_entry.entry_id]
nexia_home = nexia_data[NEXIA_DEVICE]
coordinator = nexia_data[UPDATE_COORDINATOR]
entities = []
for thermostat_id in nexia_home.g... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"nexia_data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"nexia_home",
"=",
"nexia_data",
"[",
"NEXIA_DEVI... | [
8,
0
] | [
33,
38
] | python | en | ['en', 'pt', 'en'] | True |
NexiaBinarySensor.__init__ | (self, coordinator, thermostat, sensor_call, sensor_name) | Initialize the nexia sensor. | Initialize the nexia sensor. | def __init__(self, coordinator, thermostat, sensor_call, sensor_name):
"""Initialize the nexia sensor."""
super().__init__(
coordinator,
thermostat,
name=f"{thermostat.get_name()} {sensor_name}",
unique_id=f"{thermostat.thermostat_id}_{sensor_call}",
... | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"thermostat",
",",
"sensor_call",
",",
"sensor_name",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"thermostat",
",",
"name",
"=",
"f\"{thermostat.get_name()} {sensor_name}\"",
",... | [
39,
4
] | [
48,
26
] | python | en | ['en', 'pt', 'en'] | True |
NexiaBinarySensor.is_on | (self) | Return the status of the sensor. | Return the status of the sensor. | def is_on(self):
"""Return the status of the sensor."""
return getattr(self._thermostat, self._call)() | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"_thermostat",
",",
"self",
".",
"_call",
")",
"(",
")"
] | [
51,
4
] | [
53,
54
] | python | en | ['en', 'id', 'en'] | True |
test_full_user_flow_implementation | (hass) | Test we get the form. | Test we get the form. | async def test_full_user_flow_implementation(hass):
"""Test we get the form."""
await async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == RESULT_TYPE_FORM
assert ... | [
"async",
"def",
"test_full_user_flow_implementation",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init... | [
24,
0
] | [
52,
48
] | python | en | ['en', 'en', 'en'] | True |
test_integration_already_exists | (hass) | Test we only allow a single config flow. | Test we only allow a single config flow. | async def test_integration_already_exists(hass):
"""Test we only allow a single config flow."""
MockConfigEntry(domain=DOMAIN).add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == RESULT_TYPE_ABORT
asser... | [
"async",
"def",
"test_integration_already_exists",
"(",
"hass",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
")",
".",
"add_to_hass",
"(",
"hass",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
... | [
55,
0
] | [
63,
56
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_bad_dsn | (hass) | Test we handle bad dsn error. | Test we handle bad dsn error. | async def test_user_flow_bad_dsn(hass):
"""Test we handle bad dsn error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
with patch(
"homeassistant.components.sentry.config_flow.Dsn",
side_effect=BadDsn,
):
result2 = a... | [
"async",
"def",
"test_user_flow_bad_dsn",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_USER",
"}",
")",
"with",
"patch",
"(... | [
66,
0
] | [
82,
51
] | python | de | ['de', 'nl', 'en'] | False |
test_user_flow_unkown_exception | (hass) | Test we handle any unknown exception error. | Test we handle any unknown exception error. | async def test_user_flow_unkown_exception(hass):
"""Test we handle any unknown exception error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
with patch(
"homeassistant.components.sentry.config_flow.Dsn",
side_effect=Exception,
... | [
"async",
"def",
"test_user_flow_unkown_exception",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_USER",
"}",
")",
"with",
"pat... | [
85,
0
] | [
101,
51
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow | (hass) | Test options config flow. | Test options config flow. | async def test_options_flow(hass):
"""Test options config flow."""
entry = MockConfigEntry(
domain=DOMAIN,
data={"dsn": "http://public@sentry.local/1"},
)
entry.add_to_hass(hass)
with patch("homeassistant.components.sentry.async_setup_entry", return_value=True):
assert await... | [
"async",
"def",
"test_options_flow",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"\"dsn\"",
":",
"\"http://public@sentry.local/1\"",
"}",
",",
")",
"entry",
".",
"add_to_hass",
"(",
"hass",
")"... | [
104,
0
] | [
145,
5
] | python | en | ['en', 'fr', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Create the ViCare sensor devices. | Create the ViCare sensor devices. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Create the ViCare sensor devices."""
if discovery_info is None:
return
vicare_api = hass.data[VICARE_DOMAIN][VICARE_API]
heating_type = hass.data[VICARE_DOMAIN][VICARE_HEATING_TYPE]
sensors = SENSORS_GENERIC.copy()
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"vicare_api",
"=",
"hass",
".",
"data",
"[",
"VICARE_DOMAIN",
"]",
"[",
"VICARE_API",... | [
56,
0
] | [
76,
5
] | python | en | ['en', 'en', 'en'] | True |
ViCareBinarySensor.__init__ | (self, name, api, sensor_type) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, api, sensor_type):
"""Initialize the sensor."""
self._sensor = SENSOR_TYPES[sensor_type]
self._name = f"{name} {self._sensor[CONF_NAME]}"
self._api = api
self._sensor_type = sensor_type
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"api",
",",
"sensor_type",
")",
":",
"self",
".",
"_sensor",
"=",
"SENSOR_TYPES",
"[",
"sensor_type",
"]",
"self",
".",
"_name",
"=",
"f\"{name} {self._sensor[CONF_NAME]}\"",
"self",
".",
"_api",
"=",
"api",
... | [
82,
4
] | [
88,
26
] | python | en | ['en', 'en', 'en'] | True |
ViCareBinarySensor.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self):
"""Return True if entity is available."""
return self._state is not None and self._state != PYVICARE_ERROR | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"is",
"not",
"None",
"and",
"self",
".",
"_state",
"!=",
"PYVICARE_ERROR"
] | [
91,
4
] | [
93,
72
] | python | en | ['en', 'en', 'en'] | True |
ViCareBinarySensor.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return f"{self._api.service.id}-{self._sensor_type}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._api.service.id}-{self._sensor_type}\""
] | [
96,
4
] | [
98,
60
] | python | ca | ['fr', 'ca', 'en'] | False |
ViCareBinarySensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
101,
4
] | [
103,
25
] | python | en | ['en', 'mi', 'en'] | True |
ViCareBinarySensor.is_on | (self) | Return the state of the sensor. | Return the state of the sensor. | def is_on(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
106,
4
] | [
108,
26
] | python | en | ['en', 'en', 'en'] | True |
ViCareBinarySensor.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return self._sensor[CONF_DEVICE_CLASS] | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sensor",
"[",
"CONF_DEVICE_CLASS",
"]"
] | [
111,
4
] | [
113,
46
] | python | en | ['en', 'en', 'en'] | True |
ViCareBinarySensor.update | (self) | Update state of sensor. | Update state of sensor. | def update(self):
"""Update state of sensor."""
try:
self._state = self._sensor[CONF_GETTER](self._api)
except requests.exceptions.ConnectionError:
_LOGGER.error("Unable to retrieve data from ViCare server")
except ValueError:
_LOGGER.error("Unable to ... | [
"def",
"update",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_state",
"=",
"self",
".",
"_sensor",
"[",
"CONF_GETTER",
"]",
"(",
"self",
".",
"_api",
")",
"except",
"requests",
".",
"exceptions",
".",
"ConnectionError",
":",
"_LOGGER",
".",
"error... | [
115,
4
] | [
122,
69
] | python | en | ['en', 'co', 'en'] | True |
setup | (hass, config) | Set up the Digital Ocean component. | Set up the Digital Ocean component. | def setup(hass, config):
"""Set up the Digital Ocean component."""
conf = config[DOMAIN]
access_token = conf[CONF_ACCESS_TOKEN]
digital = DigitalOcean(access_token)
try:
if not digital.manager.get_account():
_LOGGER.error("No account found for the given API token")
... | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"access_token",
"=",
"conf",
"[",
"CONF_ACCESS_TOKEN",
"]",
"digital",
"=",
"DigitalOcean",
"(",
"access_token",
")",
"try",
":",
"if",
"not",
"digital",
"."... | [
39,
0
] | [
57,
15
] | python | en | ['en', 'ca', 'en'] | True |
DigitalOcean.__init__ | (self, access_token) | Initialize the Digital Ocean connection. | Initialize the Digital Ocean connection. | def __init__(self, access_token):
"""Initialize the Digital Ocean connection."""
self._access_token = access_token
self.data = None
self.manager = digitalocean.Manager(token=self._access_token) | [
"def",
"__init__",
"(",
"self",
",",
"access_token",
")",
":",
"self",
".",
"_access_token",
"=",
"access_token",
"self",
".",
"data",
"=",
"None",
"self",
".",
"manager",
"=",
"digitalocean",
".",
"Manager",
"(",
"token",
"=",
"self",
".",
"_access_token"... | [
63,
4
] | [
68,
69
] | python | en | ['en', 'en', 'en'] | True |
DigitalOcean.get_droplet_id | (self, droplet_name) | Get the status of a Digital Ocean droplet. | Get the status of a Digital Ocean droplet. | def get_droplet_id(self, droplet_name):
"""Get the status of a Digital Ocean droplet."""
droplet_id = None
all_droplets = self.manager.get_all_droplets()
for droplet in all_droplets:
if droplet_name == droplet.name:
droplet_id = droplet.id
return dro... | [
"def",
"get_droplet_id",
"(",
"self",
",",
"droplet_name",
")",
":",
"droplet_id",
"=",
"None",
"all_droplets",
"=",
"self",
".",
"manager",
".",
"get_all_droplets",
"(",
")",
"for",
"droplet",
"in",
"all_droplets",
":",
"if",
"droplet_name",
"==",
"droplet",
... | [
70,
4
] | [
79,
25
] | python | en | ['en', 'af', 'en'] | True |
DigitalOcean.update | (self) | Use the data from Digital Ocean API. | Use the data from Digital Ocean API. | def update(self):
"""Use the data from Digital Ocean API."""
self.data = self.manager.get_all_droplets() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"data",
"=",
"self",
".",
"manager",
".",
"get_all_droplets",
"(",
")"
] | [
82,
4
] | [
84,
51
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Monoprice Blackbird 4k 8x8 HDBaseT Matrix platform. | Set up the Monoprice Blackbird 4k 8x8 HDBaseT Matrix platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Monoprice Blackbird 4k 8x8 HDBaseT Matrix platform."""
if DATA_BLACKBIRD not in hass.data:
hass.data[DATA_BLACKBIRD] = {}
port = config.get(CONF_PORT)
host = config.get(CONF_HOST)
connection = None
if po... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"DATA_BLACKBIRD",
"not",
"in",
"hass",
".",
"data",
":",
"hass",
".",
"data",
"[",
"DATA_BLACKBIRD",
"]",
"=",
"{",
"}",
"port",... | [
68,
0
] | [
127,
5
] | python | en | ['en', 'lv', 'en'] | True |
BlackbirdZone.__init__ | (self, blackbird, sources, zone_id, zone_name) | Initialize new zone. | Initialize new zone. | def __init__(self, blackbird, sources, zone_id, zone_name):
"""Initialize new zone."""
self._blackbird = blackbird
# dict source_id -> source name
self._source_id_name = sources
# dict source name -> source_id
self._source_name_id = {v: k for k, v in sources.items()}
... | [
"def",
"__init__",
"(",
"self",
",",
"blackbird",
",",
"sources",
",",
"zone_id",
",",
"zone_name",
")",
":",
"self",
".",
"_blackbird",
"=",
"blackbird",
"# dict source_id -> source name",
"self",
".",
"_source_id_name",
"=",
"sources",
"# dict source name -> sourc... | [
133,
4
] | [
147,
27
] | python | pl | ['pl', 'pl', 'en'] | True |
BlackbirdZone.update | (self) | Retrieve latest state. | Retrieve latest state. | def update(self):
"""Retrieve latest state."""
state = self._blackbird.zone_status(self._zone_id)
if not state:
return
self._state = STATE_ON if state.power else STATE_OFF
idx = state.av
if idx in self._source_id_name:
self._source = self._source_i... | [
"def",
"update",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"_blackbird",
".",
"zone_status",
"(",
"self",
".",
"_zone_id",
")",
"if",
"not",
"state",
":",
"return",
"self",
".",
"_state",
"=",
"STATE_ON",
"if",
"state",
".",
"power",
"else",
... | [
149,
4
] | [
159,
31
] | python | en | ['es', 'sk', 'en'] | False |
BlackbirdZone.name | (self) | Return the name of the zone. | Return the name of the zone. | def name(self):
"""Return the name of the zone."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
162,
4
] | [
164,
25
] | python | en | ['en', 'en', 'en'] | True |
BlackbirdZone.state | (self) | Return the state of the zone. | Return the state of the zone. | def state(self):
"""Return the state of the zone."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
167,
4
] | [
169,
26
] | python | en | ['en', 'en', 'en'] | True |
BlackbirdZone.supported_features | (self) | Return flag of media commands that are supported. | Return flag of media commands that are supported. | def supported_features(self):
"""Return flag of media commands that are supported."""
return SUPPORT_BLACKBIRD | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_BLACKBIRD"
] | [
172,
4
] | [
174,
32
] | python | en | ['en', 'en', 'en'] | True |
BlackbirdZone.media_title | (self) | Return the current source as media title. | Return the current source as media title. | def media_title(self):
"""Return the current source as media title."""
return self._source | [
"def",
"media_title",
"(",
"self",
")",
":",
"return",
"self",
".",
"_source"
] | [
177,
4
] | [
179,
27
] | python | en | ['en', 'en', 'en'] | True |
BlackbirdZone.source | (self) | Return the current input source of the device. | Return the current input source of the device. | def source(self):
"""Return the current input source of the device."""
return self._source | [
"def",
"source",
"(",
"self",
")",
":",
"return",
"self",
".",
"_source"
] | [
182,
4
] | [
184,
27
] | python | en | ['en', 'en', 'en'] | True |
BlackbirdZone.source_list | (self) | List of available input sources. | List of available input sources. | def source_list(self):
"""List of available input sources."""
return self._source_names | [
"def",
"source_list",
"(",
"self",
")",
":",
"return",
"self",
".",
"_source_names"
] | [
187,
4
] | [
189,
33
] | python | en | ['en', 'en', 'en'] | True |
BlackbirdZone.set_all_zones | (self, source) | Set all zones to one source. | Set all zones to one source. | def set_all_zones(self, source):
"""Set all zones to one source."""
if source not in self._source_name_id:
return
idx = self._source_name_id[source]
_LOGGER.debug("Setting all zones source to %s", idx)
self._blackbird.set_all_zone_source(idx) | [
"def",
"set_all_zones",
"(",
"self",
",",
"source",
")",
":",
"if",
"source",
"not",
"in",
"self",
".",
"_source_name_id",
":",
"return",
"idx",
"=",
"self",
".",
"_source_name_id",
"[",
"source",
"]",
"_LOGGER",
".",
"debug",
"(",
"\"Setting all zones sourc... | [
191,
4
] | [
197,
48
] | python | en | ['en', 'en', 'en'] | True |
BlackbirdZone.select_source | (self, source) | Set input source. | Set input source. | def select_source(self, source):
"""Set input source."""
if source not in self._source_name_id:
return
idx = self._source_name_id[source]
_LOGGER.debug("Setting zone %d source to %s", self._zone_id, idx)
self._blackbird.set_zone_source(self._zone_id, idx) | [
"def",
"select_source",
"(",
"self",
",",
"source",
")",
":",
"if",
"source",
"not",
"in",
"self",
".",
"_source_name_id",
":",
"return",
"idx",
"=",
"self",
".",
"_source_name_id",
"[",
"source",
"]",
"_LOGGER",
".",
"debug",
"(",
"\"Setting zone %d source ... | [
199,
4
] | [
205,
59
] | python | en | ['fr', 'su', 'en'] | False |
BlackbirdZone.turn_on | (self) | Turn the media player on. | Turn the media player on. | def turn_on(self):
"""Turn the media player on."""
_LOGGER.debug("Turning zone %d on", self._zone_id)
self._blackbird.set_zone_power(self._zone_id, True) | [
"def",
"turn_on",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turning zone %d on\"",
",",
"self",
".",
"_zone_id",
")",
"self",
".",
"_blackbird",
".",
"set_zone_power",
"(",
"self",
".",
"_zone_id",
",",
"True",
")"
] | [
207,
4
] | [
210,
59
] | python | en | ['en', 'en', 'en'] | True |
BlackbirdZone.turn_off | (self) | Turn the media player off. | Turn the media player off. | def turn_off(self):
"""Turn the media player off."""
_LOGGER.debug("Turning zone %d off", self._zone_id)
self._blackbird.set_zone_power(self._zone_id, False) | [
"def",
"turn_off",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turning zone %d off\"",
",",
"self",
".",
"_zone_id",
")",
"self",
".",
"_blackbird",
".",
"set_zone_power",
"(",
"self",
".",
"_zone_id",
",",
"False",
")"
] | [
212,
4
] | [
215,
60
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: dict) | Set up the Bond component. | Set up the Bond component. | async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Bond component."""
hass.data.setdefault(DOMAIN, {})
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"return",
"True"
] | [
21,
0
] | [
24,
15
] | python | en | ['en', 'fr', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Bond from a config entry. | Set up Bond from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Bond from a config entry."""
host = entry.data[CONF_HOST]
token = entry.data[CONF_ACCESS_TOKEN]
bond = Bond(host=host, token=token, timeout=ClientTimeout(total=_API_TIMEOUT))
hub = BondHub(bond)
try:
await h... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"host",
"=",
"entry",
".",
"data",
"[",
"CONF_HOST",
"]",
"token",
"=",
"entry",
".",
"data",
"[",
"CONF_ACCESS_TOKEN",
"]",
"bond",
"=",
... | [
27,
0
] | [
59,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
]
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"async_fo... | [
62,
0
] | [
76,
20
] | python | en | ['en', 'es', 'en'] | True |
user_flow | (hass) | Return a user-initiated flow after filling in host info. | Return a user-initiated flow after filling in host info. | async def user_flow(hass):
"""Return a user-initiated flow after filling in host info."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["errors"] == {}
return result["flow_id"] | [
"async",
"def",
"user_flow",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")",
"assert",... | [
27,
0
] | [
35,
28
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow | (hass, user_flow) | Test a successful user initiated flow. | Test a successful user initiated flow. | async def test_user_flow(hass, user_flow):
"""Test a successful user initiated flow."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
return_value=True,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value=MockConnection... | [
"async",
"def",
"test_user_flow",
"(",
"hass",
",",
"user_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.get_kodi... | [
38,
0
] | [
67,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_valid_auth | (hass, user_flow) | Test we handle valid auth. | Test we handle valid auth. | async def test_form_valid_auth(hass, user_flow):
"""Test we handle valid auth."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
side_effect=InvalidAuthError,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value=MockConne... | [
"async",
"def",
"test_form_valid_auth",
"(",
"hass",
",",
"user_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"side_effect",
"=",
"InvalidAuthError",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.con... | [
70,
0
] | [
113,
48
] | python | en | ['de', 'en', 'en'] | True |
test_form_valid_ws_port | (hass, user_flow) | Test we handle valid websocket port. | Test we handle valid websocket port. | async def test_form_valid_ws_port(hass, user_flow):
"""Test we handle valid websocket port."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
return_value=True,
), patch.object(
MockWSConnection,
"connect",
AsyncMock(side_effect=CannotConnectError)... | [
"async",
"def",
"test_form_valid_ws_port",
"(",
"hass",
",",
"user_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
".",
"object",
"(",
"MockWSConnection",
","... | [
116,
0
] | [
164,
48
] | python | en | ['en', 'da', 'en'] | True |
test_form_empty_ws_port | (hass, user_flow) | Test we handle an empty websocket port input. | Test we handle an empty websocket port input. | async def test_form_empty_ws_port(hass, user_flow):
"""Test we handle an empty websocket port input."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
return_value=True,
), patch.object(
MockWSConnection,
"connect",
AsyncMock(side_effect=CannotConn... | [
"async",
"def",
"test_form_empty_ws_port",
"(",
"hass",
",",
"user_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
".",
"object",
"(",
"MockWSConnection",
","... | [
167,
0
] | [
209,
48
] | python | en | ['en', 'lb', 'en'] | True |
test_form_invalid_auth | (hass, user_flow) | Test we handle invalid auth. | Test we handle invalid auth. | async def test_form_invalid_auth(hass, user_flow):
"""Test we handle invalid auth."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
side_effect=InvalidAuthError,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value=MockC... | [
"async",
"def",
"test_form_invalid_auth",
"(",
"hass",
",",
"user_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"side_effect",
"=",
"InvalidAuthError",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.c... | [
212,
0
] | [
289,
33
] | python | en | ['en', 'en', 'en'] | True |
test_form_cannot_connect_http | (hass, user_flow) | Test we handle cannot connect over HTTP error. | Test we handle cannot connect over HTTP error. | async def test_form_cannot_connect_http(hass, user_flow):
"""Test we handle cannot connect over HTTP error."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
side_effect=CannotConnectError,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",... | [
"async",
"def",
"test_form_cannot_connect_http",
"(",
"hass",
",",
"user_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"side_effect",
"=",
"CannotConnectError",
",",
")",
",",
"patch",
"(",
"\"homeassistant.componen... | [
292,
0
] | [
305,
57
] | python | en | ['en', 'en', 'en'] | True |
test_form_exception_http | (hass, user_flow) | Test we handle generic exception over HTTP. | Test we handle generic exception over HTTP. | async def test_form_exception_http(hass, user_flow):
"""Test we handle generic exception over HTTP."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
side_effect=Exception,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return_v... | [
"async",
"def",
"test_form_exception_http",
"(",
"hass",
",",
"user_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"side_effect",
"=",
"Exception",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.config... | [
308,
0
] | [
321,
50
] | python | en | ['en', 'en', 'en'] | True |
test_form_cannot_connect_ws | (hass, user_flow) | Test we handle cannot connect over WebSocket error. | Test we handle cannot connect over WebSocket error. | async def test_form_cannot_connect_ws(hass, user_flow):
"""Test we handle cannot connect over WebSocket error."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
return_value=True,
), patch.object(
MockWSConnection,
"connect",
AsyncMock(side_effect=... | [
"async",
"def",
"test_form_cannot_connect_ws",
"(",
"hass",
",",
"user_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
".",
"object",
"(",
"MockWSConnection",
... | [
324,
0
] | [
373,
57
] | python | br | ['br', 'da', 'en'] | False |
test_form_exception_ws | (hass, user_flow) | Test we handle generic exception over WebSocket. | Test we handle generic exception over WebSocket. | async def test_form_exception_ws(hass, user_flow):
"""Test we handle generic exception over WebSocket."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
return_value=True,
), patch.object(
MockWSConnection,
"connect",
AsyncMock(side_effect=CannotCo... | [
"async",
"def",
"test_form_exception_ws",
"(",
"hass",
",",
"user_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
".",
"object",
"(",
"MockWSConnection",
",",... | [
376,
0
] | [
410,
50
] | python | en | ['en', 'da', 'en'] | True |
test_discovery | (hass) | Test discovery flow works. | Test discovery flow works. | async def test_discovery(hass):
"""Test discovery flow works."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
return_value=True,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value=MockConnection(),
):
resu... | [
"async",
"def",
"test_discovery",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.get_kodi_connection\"",
",",... | [
413,
0
] | [
452,
48
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_cannot_connect_http | (hass) | Test discovery aborts if cannot connect. | Test discovery aborts if cannot connect. | async def test_discovery_cannot_connect_http(hass):
"""Test discovery aborts if cannot connect."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
side_effect=CannotConnectError,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
ret... | [
"async",
"def",
"test_discovery_cannot_connect_http",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"side_effect",
"=",
"CannotConnectError",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.config_fl... | [
455,
0
] | [
469,
47
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_cannot_connect_ws | (hass) | Test discovery aborts if cannot connect to websocket. | Test discovery aborts if cannot connect to websocket. | async def test_discovery_cannot_connect_ws(hass):
"""Test discovery aborts if cannot connect to websocket."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
return_value=True,
), patch.object(
MockWSConnection,
"connect",
AsyncMock(side_effect=Cann... | [
"async",
"def",
"test_discovery_cannot_connect_ws",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
".",
"object",
"(",
"MockWSConnection",
",",
"\"connec... | [
472,
0
] | [
491,
33
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_exception_http | (hass, user_flow) | Test we handle generic exception during discovery validation. | Test we handle generic exception during discovery validation. | async def test_discovery_exception_http(hass, user_flow):
"""Test we handle generic exception during discovery validation."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
side_effect=Exception,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connec... | [
"async",
"def",
"test_discovery_exception_http",
"(",
"hass",
",",
"user_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"side_effect",
"=",
"Exception",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.c... | [
494,
0
] | [
508,
40
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_invalid_auth | (hass) | Test we handle invalid auth during discovery. | Test we handle invalid auth during discovery. | async def test_discovery_invalid_auth(hass):
"""Test we handle invalid auth during discovery."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
side_effect=InvalidAuthError,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return_... | [
"async",
"def",
"test_discovery_invalid_auth",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"side_effect",
"=",
"InvalidAuthError",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.get_ko... | [
511,
0
] | [
526,
33
] | python | en | ['id', 'en', 'en'] | True |
test_discovery_duplicate_data | (hass) | Test discovery aborts if same mDNS packet arrives. | Test discovery aborts if same mDNS packet arrives. | async def test_discovery_duplicate_data(hass):
"""Test discovery aborts if same mDNS packet arrives."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
return_value=True,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return_valu... | [
"async",
"def",
"test_discovery_duplicate_data",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.get_kodi_connec... | [
529,
0
] | [
550,
52
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_updates_unique_id | (hass) | Test a duplicate discovery id aborts and updates existing entry. | Test a duplicate discovery id aborts and updates existing entry. | async def test_discovery_updates_unique_id(hass):
"""Test a duplicate discovery id aborts and updates existing entry."""
entry = MockConfigEntry(
domain=DOMAIN,
unique_id=UUID,
data={"host": "dummy", "port": 11, "namename": "dummy.local."},
)
entry.add_to_hass(hass)
result ... | [
"async",
"def",
"test_discovery_updates_unique_id",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"UUID",
",",
"data",
"=",
"{",
"\"host\"",
":",
"\"dummy\"",
",",
"\"port\"",
":",
"11",
",",
"... | [
553,
0
] | [
572,
43
] | python | en | ['en', 'en', 'en'] | True |
test_form_import | (hass) | Test we get the form with import source. | Test we get the form with import source. | async def test_form_import(hass):
"""Test we get the form with import source."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
return_value=True,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value=MockConnection(),
... | [
"async",
"def",
"test_form_import",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.get_kodi_connection\"",
",... | [
575,
0
] | [
601,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_import_invalid_auth | (hass) | Test we handle invalid auth on import. | Test we handle invalid auth on import. | async def test_form_import_invalid_auth(hass):
"""Test we handle invalid auth on import."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
side_effect=InvalidAuthError,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value... | [
"async",
"def",
"test_form_import_invalid_auth",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"side_effect",
"=",
"InvalidAuthError",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.get_... | [
604,
0
] | [
620,
45
] | python | en | ['en', 'et', 'en'] | True |
test_form_import_cannot_connect | (hass) | Test we handle cannot connect on import. | Test we handle cannot connect on import. | async def test_form_import_cannot_connect(hass):
"""Test we handle cannot connect on import."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
side_effect=CannotConnectError,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return... | [
"async",
"def",
"test_form_import_cannot_connect",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"side_effect",
"=",
"CannotConnectError",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.... | [
623,
0
] | [
639,
47
] | python | en | ['en', 'en', 'en'] | True |
test_form_import_exception | (hass) | Test we handle unknown exception on import. | Test we handle unknown exception on import. | async def test_form_import_exception(hass):
"""Test we handle unknown exception on import."""
with patch(
"homeassistant.components.kodi.config_flow.Kodi.ping",
side_effect=Exception,
), patch(
"homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value=Mock... | [
"async",
"def",
"test_form_import_exception",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.Kodi.ping\"",
",",
"side_effect",
"=",
"Exception",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.kodi.config_flow.get_kodi_conne... | [
642,
0
] | [
658,
40
] | python | en | ['en', 'en', 'en'] | True |
map_named_channels_deep_1010 | (channel_names: list, EOG=None, ear_ref=None, extra_channels=None) |
Maps channel names to the Deep1010 format, will automatically map EOG and extra channels if they have been
named according to standard convention. Otherwise provide as keyword arguments.
Parameters
----------
channel_names : list
List of channel names from dataset
EOG : list... |
Maps channel names to the Deep1010 format, will automatically map EOG and extra channels if they have been
named according to standard convention. Otherwise provide as keyword arguments. | def map_named_channels_deep_1010(channel_names: list, EOG=None, ear_ref=None, extra_channels=None):
"""
Maps channel names to the Deep1010 format, will automatically map EOG and extra channels if they have been
named according to standard convention. Otherwise provide as keyword arguments.
Parameters
... | [
"def",
"map_named_channels_deep_1010",
"(",
"channel_names",
":",
"list",
",",
"EOG",
"=",
"None",
",",
"ear_ref",
"=",
"None",
",",
"extra_channels",
"=",
"None",
")",
":",
"map",
"=",
"np",
".",
"zeros",
"(",
"(",
"len",
"(",
"channel_names",
")",
",",... | [
158,
0
] | [
220,
71
] | python | en | ['en', 'error', 'th'] | False |
map_dataset_channels_deep_1010 | (channels: np.ndarray, exclude_stim=True) |
Maps channels as stored by a :any:`DN3ataset` to the Deep1010 format, will automatically map EOG and extra channels
by type.
Parameters
----------
channels : np.ndarray
Channels that remain a 1D sequence (they should not have been projected into 2 or 3D grids) of name and
... |
Maps channels as stored by a :any:`DN3ataset` to the Deep1010 format, will automatically map EOG and extra channels
by type. | def map_dataset_channels_deep_1010(channels: np.ndarray, exclude_stim=True):
"""
Maps channels as stored by a :any:`DN3ataset` to the Deep1010 format, will automatically map EOG and extra channels
by type.
Parameters
----------
channels : np.ndarray
Channels that remain a 1D sequ... | [
"def",
"map_dataset_channels_deep_1010",
"(",
"channels",
":",
"np",
".",
"ndarray",
",",
"exclude_stim",
"=",
"True",
")",
":",
"if",
"len",
"(",
"channels",
".",
"shape",
")",
"!=",
"2",
"or",
"channels",
".",
"shape",
"[",
"1",
"]",
"!=",
"2",
":",
... | [
223,
0
] | [
288,
92
] | python | en | ['en', 'error', 'th'] | False |
mock_all | (aioclient_mock) | Mock all setup requests. | Mock all setup requests. | def mock_all(aioclient_mock):
"""Mock all setup requests."""
aioclient_mock.post("http://127.0.0.1/homeassistant/options", json={"result": "ok"})
aioclient_mock.get("http://127.0.0.1/supervisor/ping", json={"result": "ok"})
aioclient_mock.post("http://127.0.0.1/supervisor/options", json={"result": "ok"}... | [
"def",
"mock_all",
"(",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"post",
"(",
"\"http://127.0.0.1/homeassistant/options\"",
",",
"json",
"=",
"{",
"\"result\"",
":",
"\"ok\"",
"}",
")",
"aioclient_mock",
".",
"get",
"(",
"\"http://127.0.0.1/supervisor/ping\"... | [
9,
0
] | [
17,
5
] | python | en | ['en', 'bg', 'en'] | True |
test_hassio_addon_panel_startup | (hass, aioclient_mock, hassio_env) | Test startup and panel setup after event. | Test startup and panel setup after event. | async def test_hassio_addon_panel_startup(hass, aioclient_mock, hassio_env):
"""Test startup and panel setup after event."""
aioclient_mock.get(
"http://127.0.0.1/ingress/panels",
json={
"result": "ok",
"data": {
"panels": {
"test1": {
... | [
"async",
"def",
"test_hassio_addon_panel_startup",
"(",
"hass",
",",
"aioclient_mock",
",",
"hassio_env",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://127.0.0.1/ingress/panels\"",
",",
"json",
"=",
"{",
"\"result\"",
":",
"\"ok\"",
",",
"\"data\"",
":",
... | [
20,
0
] | [
59,
9
] | python | en | ['en', 'en', 'en'] | True |
test_hassio_addon_panel_api | (hass, aioclient_mock, hassio_env, hass_client) | Test panel api after event. | Test panel api after event. | async def test_hassio_addon_panel_api(hass, aioclient_mock, hassio_env, hass_client):
"""Test panel api after event."""
aioclient_mock.get(
"http://127.0.0.1/ingress/panels",
json={
"result": "ok",
"data": {
"panels": {
"test1": {
... | [
"async",
"def",
"test_hassio_addon_panel_api",
"(",
"hass",
",",
"aioclient_mock",
",",
"hassio_env",
",",
"hass_client",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://127.0.0.1/ingress/panels\"",
",",
"json",
"=",
"{",
"\"result\"",
":",
"\"ok\"",
",",
"... | [
62,
0
] | [
116,
9
] | python | da | ['da', 'da', 'en'] | True |
setup | (hass, config) | Set up the Vultr component. | Set up the Vultr component. | def setup(hass, config):
"""Set up the Vultr component."""
api_key = config[DOMAIN].get(CONF_API_KEY)
vultr = Vultr(api_key)
try:
vultr.update()
except RuntimeError as ex:
_LOGGER.error("Failed to make update API request because: %s", ex)
hass.components.persistent_notifica... | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"api_key",
"=",
"config",
"[",
"DOMAIN",
"]",
".",
"get",
"(",
"CONF_API_KEY",
")",
"vultr",
"=",
"Vultr",
"(",
"api_key",
")",
"try",
":",
"vultr",
".",
"update",
"(",
")",
"except",
"RuntimeErro... | [
46,
0
] | [
64,
15
] | python | en | ['en', 'en', 'en'] | True |
Vultr.__init__ | (self, api_key) | Initialize the Vultr connection. | Initialize the Vultr connection. | def __init__(self, api_key):
"""Initialize the Vultr connection."""
self._api_key = api_key
self.data = None
self.api = VultrAPI(self._api_key) | [
"def",
"__init__",
"(",
"self",
",",
"api_key",
")",
":",
"self",
".",
"_api_key",
"=",
"api_key",
"self",
".",
"data",
"=",
"None",
"self",
".",
"api",
"=",
"VultrAPI",
"(",
"self",
".",
"_api_key",
")"
] | [
70,
4
] | [
75,
42
] | python | en | ['en', 'en', 'en'] | True |
Vultr.update | (self) | Use the data from Vultr API. | Use the data from Vultr API. | def update(self):
"""Use the data from Vultr API."""
self.data = self.api.server_list() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"data",
"=",
"self",
".",
"api",
".",
"server_list",
"(",
")"
] | [
78,
4
] | [
80,
42
] | python | en | ['en', 'en', 'en'] | True |
Vultr._force_update | (self) | Use the data from Vultr API. | Use the data from Vultr API. | def _force_update(self):
"""Use the data from Vultr API."""
self.data = self.api.server_list() | [
"def",
"_force_update",
"(",
"self",
")",
":",
"self",
".",
"data",
"=",
"self",
".",
"api",
".",
"server_list",
"(",
")"
] | [
82,
4
] | [
84,
42
] | python | en | ['en', 'en', 'en'] | True |
Vultr.halt | (self, subscription) | Halt a subscription (hard power off). | Halt a subscription (hard power off). | def halt(self, subscription):
"""Halt a subscription (hard power off)."""
self.api.server_halt(subscription)
self._force_update() | [
"def",
"halt",
"(",
"self",
",",
"subscription",
")",
":",
"self",
".",
"api",
".",
"server_halt",
"(",
"subscription",
")",
"self",
".",
"_force_update",
"(",
")"
] | [
86,
4
] | [
89,
28
] | python | en | ['en', 'ga', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.