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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
mock_setup | () | Mock entry setup. | Mock entry setup. | def mock_setup():
"""Mock entry setup."""
with patch(
"homeassistant.components.speedtestdotnet.async_setup_entry",
return_value=True,
):
yield | [
"def",
"mock_setup",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.speedtestdotnet.async_setup_entry\"",
",",
"return_value",
"=",
"True",
",",
")",
":",
"yield"
] | [
24,
0
] | [
30,
13
] | python | en | ['en', 'da', 'en'] | True |
test_flow_works | (hass, mock_setup) | Test user config. | Test user config. | async def test_flow_works(hass, mock_setup):
"""Test user config."""
result = await hass.config_entries.flow.async_init(
speedtestdotnet.DOMAIN, context={"source": "user"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user"
result = await hass.... | [
"async",
"def",
"test_flow_works",
"(",
"hass",
",",
"mock_setup",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"speedtestdotnet",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\""... | [
33,
0
] | [
45,
41
] | python | en | ['en', 'da', 'en'] | True |
test_import_fails | (hass, mock_setup) | Test import step fails if server_id is not valid. | Test import step fails if server_id is not valid. | async def test_import_fails(hass, mock_setup):
"""Test import step fails if server_id is not valid."""
with patch("speedtest.Speedtest") as mock_api:
mock_api.return_value.get_servers.side_effect = NoMatchedServers
result = await hass.config_entries.flow.async_init(
speedtestdotnet.... | [
"async",
"def",
"test_import_fails",
"(",
"hass",
",",
"mock_setup",
")",
":",
"with",
"patch",
"(",
"\"speedtest.Speedtest\"",
")",
"as",
"mock_api",
":",
"mock_api",
".",
"return_value",
".",
"get_servers",
".",
"side_effect",
"=",
"NoMatchedServers",
"result",
... | [
48,
0
] | [
64,
52
] | python | en | ['en', 'en', 'en'] | True |
test_import_success | (hass, mock_setup) | Test import step is successful if server_id is valid. | Test import step is successful if server_id is valid. | async def test_import_success(hass, mock_setup):
"""Test import step is successful if server_id is valid."""
with patch("speedtest.Speedtest"):
result = await hass.config_entries.flow.async_init(
speedtestdotnet.DOMAIN,
context={"source": "import"},
data={
... | [
"async",
"def",
"test_import_success",
"(",
"hass",
",",
"mock_setup",
")",
":",
"with",
"patch",
"(",
"\"speedtest.Speedtest\"",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"speedtestdotnet",
".",
"DOM... | [
67,
0
] | [
86,
54
] | python | en | ['en', 'en', 'en'] | True |
test_options | (hass) | Test updating options. | Test updating options. | async def test_options(hass):
"""Test updating options."""
entry = MockConfigEntry(
domain=DOMAIN,
title="SpeedTest",
data={},
options={},
)
entry.add_to_hass(hass)
with patch("speedtest.Speedtest") as mock_api:
mock_api.return_value.get_servers.return_value ... | [
"async",
"def",
"test_options",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"title",
"=",
"\"SpeedTest\"",
",",
"data",
"=",
"{",
"}",
",",
"options",
"=",
"{",
"}",
",",
")",
"entry",
".",
"add_to_hass",
... | [
89,
0
] | [
122,
9
] | python | en | ['en', 'en', 'en'] | True |
test_integration_already_configured | (hass) | Test integration is already configured. | Test integration is already configured. | async def test_integration_already_configured(hass):
"""Test integration is already configured."""
entry = MockConfigEntry(
domain=DOMAIN,
data={},
options={},
)
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
speedtestdotnet.DOMAIN, contex... | [
"async",
"def",
"test_integration_already_configured",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"}",
",",
"options",
"=",
"{",
"}",
",",
")",
"entry",
".",
"add_to_hass",
"(",
"hass",
")... | [
125,
0
] | [
137,
56
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config, async_add_entities) | Set up a Blink Camera. | Set up a Blink Camera. | async def async_setup_entry(hass, config, async_add_entities):
"""Set up a Blink Camera."""
data = hass.data[DOMAIN][config.entry_id]
entities = []
for name, camera in data.cameras.items():
entities.append(BlinkCamera(data, name, camera))
async_add_entities(entities)
platform = entity_... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
")",
":",
"data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config",
".",
"entry_id",
"]",
"entities",
"=",
"[",
"]",
"for",
"name",
",",
"camera",
"i... | [
20,
0
] | [
33,
5
] | python | en | ['en', 'da', 'en'] | True |
BlinkCamera.__init__ | (self, data, name, camera) | Initialize a camera. | Initialize a camera. | def __init__(self, data, name, camera):
"""Initialize a camera."""
super().__init__()
self.data = data
self._name = f"{DOMAIN} {name}"
self._camera = camera
self._unique_id = f"{camera.serial}-camera"
self.response = None
self.current_image = None
... | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"name",
",",
"camera",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"data",
"=",
"data",
"self",
".",
"_name",
"=",
"f\"{DOMAIN} {name}\"",
"self",
".",
"_camera",
"=",
"camera... | [
39,
4
] | [
49,
64
] | python | co | ['es', 'co', 'it'] | False |
BlinkCamera.name | (self) | Return the camera name. | Return the camera name. | def name(self):
"""Return the camera name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
52,
4
] | [
54,
25
] | python | en | ['en', 'mi', 'en'] | True |
BlinkCamera.unique_id | (self) | Return the unique camera id. | Return the unique camera id. | def unique_id(self):
"""Return the unique camera id."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
57,
4
] | [
59,
30
] | python | en | ['en', 'la', 'en'] | True |
BlinkCamera.device_state_attributes | (self) | Return the camera attributes. | Return the camera attributes. | def device_state_attributes(self):
"""Return the camera attributes."""
return self._camera.attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_camera",
".",
"attributes"
] | [
62,
4
] | [
64,
38
] | python | en | ['en', 'la', 'en'] | True |
BlinkCamera.enable_motion_detection | (self) | Enable motion detection for the camera. | Enable motion detection for the camera. | def enable_motion_detection(self):
"""Enable motion detection for the camera."""
self._camera.set_motion_detect(True) | [
"def",
"enable_motion_detection",
"(",
"self",
")",
":",
"self",
".",
"_camera",
".",
"set_motion_detect",
"(",
"True",
")"
] | [
66,
4
] | [
68,
44
] | python | en | ['en', 'en', 'en'] | True |
BlinkCamera.disable_motion_detection | (self) | Disable motion detection for the camera. | Disable motion detection for the camera. | def disable_motion_detection(self):
"""Disable motion detection for the camera."""
self._camera.set_motion_detect(False) | [
"def",
"disable_motion_detection",
"(",
"self",
")",
":",
"self",
".",
"_camera",
".",
"set_motion_detect",
"(",
"False",
")"
] | [
70,
4
] | [
72,
45
] | python | en | ['en', 'en', 'en'] | True |
BlinkCamera.motion_detection_enabled | (self) | Return the state of the camera. | Return the state of the camera. | def motion_detection_enabled(self):
"""Return the state of the camera."""
return self._camera.motion_enabled | [
"def",
"motion_detection_enabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"_camera",
".",
"motion_enabled"
] | [
75,
4
] | [
77,
42
] | python | en | ['en', 'en', 'en'] | True |
BlinkCamera.brand | (self) | Return the camera brand. | Return the camera brand. | def brand(self):
"""Return the camera brand."""
return DEFAULT_BRAND | [
"def",
"brand",
"(",
"self",
")",
":",
"return",
"DEFAULT_BRAND"
] | [
80,
4
] | [
82,
28
] | python | en | ['en', 'bs', 'en'] | True |
BlinkCamera.trigger_camera | (self) | Trigger camera to take a snapshot. | Trigger camera to take a snapshot. | def trigger_camera(self):
"""Trigger camera to take a snapshot."""
self._camera.snap_picture()
self.data.refresh() | [
"def",
"trigger_camera",
"(",
"self",
")",
":",
"self",
".",
"_camera",
".",
"snap_picture",
"(",
")",
"self",
".",
"data",
".",
"refresh",
"(",
")"
] | [
84,
4
] | [
87,
27
] | python | en | ['en', 'jv', 'en'] | True |
BlinkCamera.camera_image | (self) | Return a still image response from the camera. | Return a still image response from the camera. | def camera_image(self):
"""Return a still image response from the camera."""
return self._camera.image_from_cache.content | [
"def",
"camera_image",
"(",
"self",
")",
":",
"return",
"self",
".",
"_camera",
".",
"image_from_cache",
".",
"content"
] | [
89,
4
] | [
91,
52
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Find and return LightWave lights. | Find and return LightWave lights. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Find and return LightWave lights."""
if not discovery_info:
return
lights = []
lwlink = hass.data[LIGHTWAVE_LINK]
for device_id, device_config in discovery_info.items():
name = device_config[C... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"not",
"discovery_info",
":",
"return",
"lights",
"=",
"[",
"]",
"lwlink",
"=",
"hass",
".",
"data",
"[",
"LI... | [
13,
0
] | [
25,
30
] | python | en | ['en', 'da', 'en'] | True |
LWRFLight.__init__ | (self, name, device_id, lwlink) | Initialize LWRFLight entity. | Initialize LWRFLight entity. | def __init__(self, name, device_id, lwlink):
"""Initialize LWRFLight entity."""
self._name = name
self._device_id = device_id
self._state = None
self._brightness = MAX_BRIGHTNESS
self._lwlink = lwlink | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"device_id",
",",
"lwlink",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_device_id",
"=",
"device_id",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_brightness",
"=",
"MAX_BRIGHTNESS",... | [
31,
4
] | [
37,
29
] | python | en | ['en', 'fy', 'it'] | False |
LWRFLight.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_BRIGHTNESS | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_BRIGHTNESS"
] | [
40,
4
] | [
42,
33
] | python | en | ['da', 'en', 'en'] | True |
LWRFLight.should_poll | (self) | No polling needed for a LightWave light. | No polling needed for a LightWave light. | def should_poll(self):
"""No polling needed for a LightWave light."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
45,
4
] | [
47,
20
] | python | en | ['en', 'en', 'en'] | True |
LWRFLight.name | (self) | Lightwave light name. | Lightwave light name. | def name(self):
"""Lightwave light name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
50,
4
] | [
52,
25
] | python | en | ['en', 'da', 'en'] | True |
LWRFLight.brightness | (self) | Brightness of this light between 0..MAX_BRIGHTNESS. | Brightness of this light between 0..MAX_BRIGHTNESS. | def brightness(self):
"""Brightness of this light between 0..MAX_BRIGHTNESS."""
return self._brightness | [
"def",
"brightness",
"(",
"self",
")",
":",
"return",
"self",
".",
"_brightness"
] | [
55,
4
] | [
57,
31
] | python | en | ['en', 'ky', 'en'] | True |
LWRFLight.is_on | (self) | Lightwave light is on state. | Lightwave light is on state. | def is_on(self):
"""Lightwave light is on state."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
60,
4
] | [
62,
26
] | python | en | ['en', 'da', 'en'] | True |
LWRFLight.async_turn_on | (self, **kwargs) | Turn the LightWave light on. | Turn the LightWave light on. | async def async_turn_on(self, **kwargs):
"""Turn the LightWave light on."""
self._state = True
if ATTR_BRIGHTNESS in kwargs:
self._brightness = kwargs[ATTR_BRIGHTNESS]
if self._brightness != MAX_BRIGHTNESS:
self._lwlink.turn_on_with_brightness(
s... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_state",
"=",
"True",
"if",
"ATTR_BRIGHTNESS",
"in",
"kwargs",
":",
"self",
".",
"_brightness",
"=",
"kwargs",
"[",
"ATTR_BRIGHTNESS",
"]",
"if",
"self",
".",
... | [
64,
4
] | [
78,
35
] | python | en | ['en', 'da', 'en'] | True |
LWRFLight.async_turn_off | (self, **kwargs) | Turn the LightWave light off. | Turn the LightWave light off. | async def async_turn_off(self, **kwargs):
"""Turn the LightWave light off."""
self._state = False
self._lwlink.turn_off(self._device_id, self._name)
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_state",
"=",
"False",
"self",
".",
"_lwlink",
".",
"turn_off",
"(",
"self",
".",
"_device_id",
",",
"self",
".",
"_name",
")",
"self",
".",
"async_write_ha... | [
80,
4
] | [
84,
35
] | python | en | ['en', 'da', 'en'] | True |
IcloudFlowHandler.__init__ | (self) | Initialize iCloud config flow. | Initialize iCloud config flow. | def __init__(self):
"""Initialize iCloud config flow."""
self.api = None
self._username = None
self._password = None
self._with_family = None
self._max_interval = None
self._gps_accuracy_threshold = None
self._trusted_device = None
self._verificat... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"api",
"=",
"None",
"self",
".",
"_username",
"=",
"None",
"self",
".",
"_password",
"=",
"None",
"self",
".",
"_with_family",
"=",
"None",
"self",
".",
"_max_interval",
"=",
"None",
"self",
".",
... | [
40,
4
] | [
53,
45
] | python | en | ['nl', 'en', 'en'] | True |
IcloudFlowHandler._show_setup_form | (self, user_input=None, errors=None, step_id="user") | Show the setup form to the user. | Show the setup form to the user. | def _show_setup_form(self, user_input=None, errors=None, step_id="user"):
"""Show the setup form to the user."""
if user_input is None:
user_input = {}
if step_id == "user":
schema = {
vol.Required(
CONF_USERNAME, default=user_input.g... | [
"def",
"_show_setup_form",
"(",
"self",
",",
"user_input",
"=",
"None",
",",
"errors",
"=",
"None",
",",
"step_id",
"=",
"\"user\"",
")",
":",
"if",
"user_input",
"is",
"None",
":",
"user_input",
"=",
"{",
"}",
"if",
"step_id",
"==",
"\"user\"",
":",
"... | [
55,
4
] | [
86,
9
] | python | en | ['en', 'en', 'en'] | True |
IcloudFlowHandler._validate_and_create_entry | (self, user_input, step_id) | Check if config is valid and create entry if so. | Check if config is valid and create entry if so. | async def _validate_and_create_entry(self, user_input, step_id):
"""Check if config is valid and create entry if so."""
self._password = user_input[CONF_PASSWORD]
extra_inputs = user_input
# If an existing entry was found, meaning this is a password update attempt,
# use those ... | [
"async",
"def",
"_validate_and_create_entry",
"(",
"self",
",",
"user_input",
",",
"step_id",
")",
":",
"self",
".",
"_password",
"=",
"user_input",
"[",
"CONF_PASSWORD",
"]",
"extra_inputs",
"=",
"user_input",
"# If an existing entry was found, meaning this is a password... | [
88,
4
] | [
157,
67
] | python | en | ['en', 'en', 'en'] | True |
IcloudFlowHandler.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."""
errors = {}
icloud_dir = self.hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
if not os.path.exists(icloud_dir.path):
await self.hass.async_add_executor_job(os.makedirs, ic... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"icloud_dir",
"=",
"self",
".",
"hass",
".",
"helpers",
".",
"storage",
".",
"Store",
"(",
"STORAGE_VERSION",
",",
"STORAGE_KEY",
")",
"if"... | [
159,
4
] | [
171,
72
] | python | en | ['en', 'en', 'en'] | True |
IcloudFlowHandler.async_step_import | (self, user_input) | Import a config entry. | Import a config entry. | async def async_step_import(self, user_input):
"""Import a config entry."""
return await self.async_step_user(user_input) | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"user_input",
")",
":",
"return",
"await",
"self",
".",
"async_step_user",
"(",
"user_input",
")"
] | [
173,
4
] | [
175,
53
] | python | en | ['en', 'en', 'en'] | True |
IcloudFlowHandler.async_step_reauth | (self, user_input=None) | Update password for a config entry that can't authenticate. | Update password for a config entry that can't authenticate. | async def async_step_reauth(self, user_input=None):
"""Update password for a config entry that can't authenticate."""
# Store existing entry data so it can be used later and set unique ID
# so existing config entry can be updated
if not self._existing_entry:
await self.async_... | [
"async",
"def",
"async_step_reauth",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"# Store existing entry data so it can be used later and set unique ID",
"# so existing config entry can be updated",
"if",
"not",
"self",
".",
"_existing_entry",
":",
"await",
"self",... | [
177,
4
] | [
192,
9
] | python | en | ['en', 'en', 'en'] | True |
IcloudFlowHandler.async_step_trusted_device | (self, user_input=None, errors=None) | We need a trusted device. | We need a trusted device. | async def async_step_trusted_device(self, user_input=None, errors=None):
"""We need a trusted device."""
if errors is None:
errors = {}
trusted_devices = await self.hass.async_add_executor_job(
getattr, self.api, "trusted_devices"
)
trusted_devices_for_fo... | [
"async",
"def",
"async_step_trusted_device",
"(",
"self",
",",
"user_input",
"=",
"None",
",",
"errors",
"=",
"None",
")",
":",
"if",
"errors",
"is",
"None",
":",
"errors",
"=",
"{",
"}",
"trusted_devices",
"=",
"await",
"self",
".",
"hass",
".",
"async_... | [
194,
4
] | [
226,
56
] | python | en | ['en', 'en', 'en'] | True |
IcloudFlowHandler._show_trusted_device_form | (
self, trusted_devices, user_input=None, errors=None
) | Show the trusted_device form to the user. | Show the trusted_device form to the user. | async def _show_trusted_device_form(
self, trusted_devices, user_input=None, errors=None
):
"""Show the trusted_device form to the user."""
return self.async_show_form(
step_id=CONF_TRUSTED_DEVICE,
data_schema=vol.Schema(
{
vol.Req... | [
"async",
"def",
"_show_trusted_device_form",
"(",
"self",
",",
"trusted_devices",
",",
"user_input",
"=",
"None",
",",
"errors",
"=",
"None",
")",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"CONF_TRUSTED_DEVICE",
",",
"data_schema",
"=",... | [
228,
4
] | [
243,
9
] | python | en | ['en', 'en', 'en'] | True |
IcloudFlowHandler.async_step_verification_code | (self, user_input=None) | Ask the verification code to the user. | Ask the verification code to the user. | async def async_step_verification_code(self, user_input=None):
"""Ask the verification code to the user."""
errors = {}
if user_input is None:
return await self._show_verification_code_form(user_input)
self._verification_code = user_input[CONF_VERIFICATION_CODE]
tr... | [
"async",
"def",
"async_step_verification_code",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"None",
":",
"return",
"await",
"self",
".",
"_show_verification_code_form",
"(",
"user_input",
")",
"self... | [
245,
4
] | [
278,
9
] | python | en | ['en', 'en', 'en'] | True |
IcloudFlowHandler._show_verification_code_form | (self, user_input=None) | Show the verification_code form to the user. | Show the verification_code form to the user. | async def _show_verification_code_form(self, user_input=None):
"""Show the verification_code form to the user."""
return self.async_show_form(
step_id=CONF_VERIFICATION_CODE,
data_schema=vol.Schema({vol.Required(CONF_VERIFICATION_CODE): str}),
errors=None,
) | [
"async",
"def",
"_show_verification_code_form",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"CONF_VERIFICATION_CODE",
",",
"data_schema",
"=",
"vol",
".",
"Schema",
"(",
"{",
"vol",
".",... | [
280,
4
] | [
287,
9
] | python | en | ['en', 'en', 'en'] | True |
TFBertEmbeddings.call | (
self,
input_ids: tf.Tensor = None,
position_ids: tf.Tensor = None,
token_type_ids: tf.Tensor = None,
inputs_embeds: tf.Tensor = None,
training: bool = False,
) |
Applies embedding based on inputs tensor.
Returns:
final_embeddings (:obj:`tf.Tensor`): output embedding tensor.
|
Applies embedding based on inputs tensor. | def call(
self,
input_ids: tf.Tensor = None,
position_ids: tf.Tensor = None,
token_type_ids: tf.Tensor = None,
inputs_embeds: tf.Tensor = None,
training: bool = False,
) -> tf.Tensor:
"""
Applies embedding based on inputs tensor.
Returns:
... | [
"def",
"call",
"(",
"self",
",",
"input_ids",
":",
"tf",
".",
"Tensor",
"=",
"None",
",",
"position_ids",
":",
"tf",
".",
"Tensor",
"=",
"None",
",",
"token_type_ids",
":",
"tf",
".",
"Tensor",
"=",
"None",
",",
"inputs_embeds",
":",
"tf",
".",
"Tens... | [
170,
4
] | [
204,
31
] | python | en | ['en', 'error', 'th'] | False |
TFBertLMHeadModel.call | (
self,
input_ids: Optional[TFModelInputType] = None,
attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
token_type_ids: Optional[Union[np.ndarray, tf.Tensor]] = None,
position_ids: Optional[Union[np.ndarray, tf.Tensor]] = None,
head_mask: Optional[Union[np.nd... | r"""
labels (:obj:`tf.Tensor` or :obj:`np.ndarray` of shape :obj:`(batch_size, sequence_length)`, `optional`):
Labels for computing the cross entropy classification loss. Indices should be in ``[0, ...,
config.vocab_size - 1]``.
| r"""
labels (:obj:`tf.Tensor` or :obj:`np.ndarray` of shape :obj:`(batch_size, sequence_length)`, `optional`):
Labels for computing the cross entropy classification loss. Indices should be in ``[0, ...,
config.vocab_size - 1]``.
| def call(
self,
input_ids: Optional[TFModelInputType] = None,
attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
token_type_ids: Optional[Union[np.ndarray, tf.Tensor]] = None,
position_ids: Optional[Union[np.ndarray, tf.Tensor]] = None,
head_mask: Optional[Uni... | [
"def",
"call",
"(",
"self",
",",
"input_ids",
":",
"Optional",
"[",
"TFModelInputType",
"]",
"=",
"None",
",",
"attention_mask",
":",
"Optional",
"[",
"Union",
"[",
"np",
".",
"ndarray",
",",
"tf",
".",
"Tensor",
"]",
"]",
"=",
"None",
",",
"token_type... | [
1191,
4
] | [
1258,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
init | (empty=False) | Initialize the platform with entities. | Initialize the platform with entities. | def init(empty=False):
"""Initialize the platform with entities."""
global ENTITIES
ENTITIES = (
{}
if empty
else {
device_class: MockSensor(
name=f"{device_class} sensor",
unique_id=f"unique_{device_class}",
device_class=d... | [
"def",
"init",
"(",
"empty",
"=",
"False",
")",
":",
"global",
"ENTITIES",
"ENTITIES",
"=",
"(",
"{",
"}",
"if",
"empty",
"else",
"{",
"device_class",
":",
"MockSensor",
"(",
"name",
"=",
"f\"{device_class} sensor\"",
",",
"unique_id",
"=",
"f\"unique_{devic... | [
31,
0
] | [
47,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (
hass, config, async_add_entities_callback, discovery_info=None
) | Return mock entities. | Return mock entities. | async def async_setup_platform(
hass, config, async_add_entities_callback, discovery_info=None
):
"""Return mock entities."""
async_add_entities_callback(list(ENTITIES.values())) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities_callback",
",",
"discovery_info",
"=",
"None",
")",
":",
"async_add_entities_callback",
"(",
"list",
"(",
"ENTITIES",
".",
"values",
"(",
")",
")",
")"
] | [
50,
0
] | [
54,
56
] | python | af | ['nl', 'af', 'en'] | False |
MockSensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self):
"""Return the class of this sensor."""
return self._handle("device_class") | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_handle",
"(",
"\"device_class\"",
")"
] | [
61,
4
] | [
63,
43
] | python | en | ['en', 'en', 'en'] | True |
MockSensor.unit_of_measurement | (self) | Return the unit_of_measurement of this sensor. | Return the unit_of_measurement of this sensor. | def unit_of_measurement(self):
"""Return the unit_of_measurement of this sensor."""
return self._handle("unit_of_measurement") | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_handle",
"(",
"\"unit_of_measurement\"",
")"
] | [
66,
4
] | [
68,
50
] | python | en | ['en', 'id', 'en'] | True |
setup_scanner | (hass, config: dict, see, discovery_info=None) | Set up the DeviceScanner and check if login is valid. | Set up the DeviceScanner and check if login is valid. | def setup_scanner(hass, config: dict, see, discovery_info=None):
"""Set up the DeviceScanner and check if login is valid."""
scanner = FleetGoDeviceScanner(config, see)
if not scanner.login(hass):
_LOGGER.error("FleetGO authentication failed")
return False
return True | [
"def",
"setup_scanner",
"(",
"hass",
",",
"config",
":",
"dict",
",",
"see",
",",
"discovery_info",
"=",
"None",
")",
":",
"scanner",
"=",
"FleetGoDeviceScanner",
"(",
"config",
",",
"see",
")",
"if",
"not",
"scanner",
".",
"login",
"(",
"hass",
")",
"... | [
32,
0
] | [
38,
15
] | python | en | ['en', 'en', 'en'] | True |
FleetGoDeviceScanner.__init__ | (self, config, see) | Initialize FleetGoDeviceScanner. | Initialize FleetGoDeviceScanner. | def __init__(self, config, see):
"""Initialize FleetGoDeviceScanner."""
self._include = config.get(CONF_INCLUDE)
self._see = see
self._api = API(
config.get(CONF_CLIENT_ID),
config.get(CONF_CLIENT_SECRET),
config.get(CONF_USERNAME),
confi... | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"see",
")",
":",
"self",
".",
"_include",
"=",
"config",
".",
"get",
"(",
"CONF_INCLUDE",
")",
"self",
".",
"_see",
"=",
"see",
"self",
".",
"_api",
"=",
"API",
"(",
"config",
".",
"get",
"(",
"... | [
44,
4
] | [
55,
9
] | python | en | ['en', 'en', 'it'] | False |
FleetGoDeviceScanner.setup | (self, hass) | Set up a timer and start gathering devices. | Set up a timer and start gathering devices. | def setup(self, hass):
"""Set up a timer and start gathering devices."""
self._refresh()
track_utc_time_change(
hass, lambda now: self._refresh(), second=range(0, 60, 30)
) | [
"def",
"setup",
"(",
"self",
",",
"hass",
")",
":",
"self",
".",
"_refresh",
"(",
")",
"track_utc_time_change",
"(",
"hass",
",",
"lambda",
"now",
":",
"self",
".",
"_refresh",
"(",
")",
",",
"second",
"=",
"range",
"(",
"0",
",",
"60",
",",
"30",
... | [
57,
4
] | [
62,
9
] | python | en | ['en', 'en', 'en'] | True |
FleetGoDeviceScanner.login | (self, hass) | Perform a login on the FleetGO API. | Perform a login on the FleetGO API. | def login(self, hass):
"""Perform a login on the FleetGO API."""
if self._api.login():
self.setup(hass)
return True
return False | [
"def",
"login",
"(",
"self",
",",
"hass",
")",
":",
"if",
"self",
".",
"_api",
".",
"login",
"(",
")",
":",
"self",
".",
"setup",
"(",
"hass",
")",
"return",
"True",
"return",
"False"
] | [
64,
4
] | [
69,
20
] | python | en | ['en', 'hu', 'en'] | True |
FleetGoDeviceScanner._refresh | (self) | Refresh device information from the platform. | Refresh device information from the platform. | def _refresh(self) -> None:
"""Refresh device information from the platform."""
try:
devices = self._api.get_devices()
for device in devices:
if not self._include or device.license_plate in self._include:
if device.active or device.current_ad... | [
"def",
"_refresh",
"(",
"self",
")",
"->",
"None",
":",
"try",
":",
"devices",
"=",
"self",
".",
"_api",
".",
"get_devices",
"(",
")",
"for",
"device",
"in",
"devices",
":",
"if",
"not",
"self",
".",
"_include",
"or",
"device",
".",
"license_plate",
... | [
71,
4
] | [
90,
74
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Hangouts bot component. | Set up the Hangouts bot component. | async def async_setup(hass, config):
"""Set up the Hangouts bot component."""
config = config.get(DOMAIN)
if config is None:
hass.data[DOMAIN] = {
CONF_INTENTS: {},
CONF_DEFAULT_CONVERSATIONS: [],
CONF_ERROR_SUPPRESSED_CONVERSATIONS: [],
}
return T... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"config",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
"if",
"config",
"is",
"None",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"CONF_INTENTS",
":",
"{",
"}",
",",
... | [
57,
0
] | [
95,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config) | Set up a config entry. | Set up a config entry. | async def async_setup_entry(hass, config):
"""Set up a config entry."""
try:
bot = HangoutsBot(
hass,
config.data.get(CONF_REFRESH_TOKEN),
hass.data[DOMAIN][CONF_INTENTS],
hass.data[DOMAIN][CONF_DEFAULT_CONVERSATIONS],
hass.data[DOMAIN][CONF_ER... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config",
")",
":",
"try",
":",
"bot",
"=",
"HangoutsBot",
"(",
"hass",
",",
"config",
".",
"data",
".",
"get",
"(",
"CONF_REFRESH_TOKEN",
")",
",",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
... | [
98,
0
] | [
150,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, _) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, _):
"""Unload a config entry."""
bot = hass.data[DOMAIN].pop(CONF_BOT)
await bot.async_disconnect()
return True | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"_",
")",
":",
"bot",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"pop",
"(",
"CONF_BOT",
")",
"await",
"bot",
".",
"async_disconnect",
"(",
")",
"return",
"True"
] | [
153,
0
] | [
157,
15
] | python | en | ['en', 'es', 'en'] | True |
async_call_action_from_config | (
hass: HomeAssistant,
config: ConfigType,
variables: TemplateVarsType,
context: Context,
) | Change state based on configuration. | Change state based on configuration. | async def async_call_action_from_config(
hass: HomeAssistant,
config: ConfigType,
variables: TemplateVarsType,
context: Context,
) -> None:
"""Change state based on configuration."""
if (
config[CONF_TYPE] in toggle_entity.DEVICE_ACTION_TYPES
and config[CONF_TYPE] != toggle_entit... | [
"async",
"def",
"async_call_action_from_config",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"variables",
":",
"TemplateVarsType",
",",
"context",
":",
"Context",
",",
")",
"->",
"None",
":",
"if",
"(",
"config",
"[",
"CONF_TYPE",... | [
44,
0
] | [
77,
5
] | python | en | ['en', 'en', 'en'] | True |
async_get_actions | (hass: HomeAssistant, device_id: str) | List device actions. | List device actions. | async def async_get_actions(hass: HomeAssistant, device_id: str) -> List[dict]:
"""List device actions."""
actions = await toggle_entity.async_get_actions(hass, device_id, DOMAIN)
registry = await entity_registry.async_get_registry(hass)
for entry in entity_registry.async_entries_for_device(registry, ... | [
"async",
"def",
"async_get_actions",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"List",
"[",
"dict",
"]",
":",
"actions",
"=",
"await",
"toggle_entity",
".",
"async_get_actions",
"(",
"hass",
",",
"device_id",
",",
"DOMAIN",
... | [
80,
0
] | [
127,
18
] | python | en | ['fr', 'en', 'en'] | True |
async_get_action_capabilities | (hass: HomeAssistant, config: dict) | List action capabilities. | List action capabilities. | async def async_get_action_capabilities(hass: HomeAssistant, config: dict) -> dict:
"""List action capabilities."""
if config[CONF_TYPE] != toggle_entity.CONF_TURN_ON:
return {}
registry = await entity_registry.async_get_registry(hass)
entry = registry.async_get(config[ATTR_ENTITY_ID])
stat... | [
"async",
"def",
"async_get_action_capabilities",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
"->",
"dict",
":",
"if",
"config",
"[",
"CONF_TYPE",
"]",
"!=",
"toggle_entity",
".",
"CONF_TURN_ON",
":",
"return",
"{",
"}",
"registry",
"=... | [
130,
0
] | [
154,
77
] | python | en | ['ro', 'ga', 'en'] | False |
test_sensor_without_forecast | (hass) | Test states of the sensor without forecast. | Test states of the sensor without forecast. | async def test_sensor_without_forecast(hass):
"""Test states of the sensor without forecast."""
await init_integration(hass)
registry = await hass.helpers.entity_registry.async_get_registry()
state = hass.states.get("sensor.home_cloud_ceiling")
assert state
assert state.state == "3200"
asse... | [
"async",
"def",
"test_sensor_without_forecast",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",
"async_get_registry",
"(",
")",
"state",
"=",
"hass",
".",
"sta... | [
31,
0
] | [
90,
47
] | python | en | ['en', 'en', 'en'] | True |
test_sensor_with_forecast | (hass) | Test states of the sensor with forecast. | Test states of the sensor with forecast. | async def test_sensor_with_forecast(hass):
"""Test states of the sensor with forecast."""
await init_integration(hass, forecast=True)
registry = await hass.helpers.entity_registry.async_get_registry()
state = hass.states.get("sensor.home_hours_of_sun_0d")
assert state
assert state.state == "7.2... | [
"async",
"def",
"test_sensor_with_forecast",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
",",
"forecast",
"=",
"True",
")",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",
"async_get_registry",
"(",
")",
"sta... | [
93,
0
] | [
162,
49
] | python | en | ['en', 'en', 'en'] | True |
test_sensor_disabled | (hass) | Test sensor disabled by default. | Test sensor disabled by default. | async def test_sensor_disabled(hass):
"""Test sensor disabled by default."""
await init_integration(hass)
registry = await hass.helpers.entity_registry.async_get_registry()
entry = registry.async_get("sensor.home_apparent_temperature")
assert entry
assert entry.unique_id == "0123456-apparenttem... | [
"async",
"def",
"test_sensor_disabled",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",
"async_get_registry",
"(",
")",
"entry",
"=",
"registry",
".",
"async_g... | [
165,
0
] | [
182,
42
] | python | en | ['en', 'da', 'en'] | True |
test_sensor_enabled_without_forecast | (hass) | Test enabling an advanced sensor. | Test enabling an advanced sensor. | async def test_sensor_enabled_without_forecast(hass):
"""Test enabling an advanced sensor."""
registry = await hass.helpers.entity_registry.async_get_registry()
registry.async_get_or_create(
SENSOR_DOMAIN,
DOMAIN,
"0123456-apparenttemperature",
suggested_object_id="home_appa... | [
"async",
"def",
"test_sensor_enabled_without_forecast",
"(",
"hass",
")",
":",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",
"async_get_registry",
"(",
")",
"registry",
".",
"async_get_or_create",
"(",
"SENSOR_DOMAIN",
",",
"DOMAIN",... | [
185,
0
] | [
531,
55
] | python | en | ['en', 'ht', 'en'] | True |
test_availability | (hass) | Ensure that we mark the entities unavailable correctly when service is offline. | Ensure that we mark the entities unavailable correctly when service is offline. | async def test_availability(hass):
"""Ensure that we mark the entities unavailable correctly when service is offline."""
await init_integration(hass)
state = hass.states.get("sensor.home_cloud_ceiling")
assert state
assert state.state != STATE_UNAVAILABLE
assert state.state == "3200"
futur... | [
"async",
"def",
"test_availability",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"sensor.home_cloud_ceiling\"",
")",
"assert",
"state",
"assert",
"state",
".",
"state",
"!=",
"... | [
534,
0
] | [
568,
36
] | python | en | ['en', 'en', 'en'] | True |
test_manual_update_entity | (hass) | Test manual update entity via service homeasasistant/update_entity. | Test manual update entity via service homeasasistant/update_entity. | async def test_manual_update_entity(hass):
"""Test manual update entity via service homeasasistant/update_entity."""
await init_integration(hass, forecast=True)
await async_setup_component(hass, "homeassistant", {})
current = json.loads(load_fixture("accuweather/current_conditions_data.json"))
for... | [
"async",
"def",
"test_manual_update_entity",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
",",
"forecast",
"=",
"True",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"homeassistant\"",
",",
"{",
"}",
")",
"current",
"=",
"json"... | [
571,
0
] | [
594,
44
] | python | en | ['en', 'en', 'en'] | True |
mock_api | () | Mock SimpliSafe API class. | Mock SimpliSafe API class. | def mock_api():
"""Mock SimpliSafe API class."""
api = MagicMock()
type(api).refresh_token = PropertyMock(return_value="12345abc")
return api | [
"def",
"mock_api",
"(",
")",
":",
"api",
"=",
"MagicMock",
"(",
")",
"type",
"(",
"api",
")",
".",
"refresh_token",
"=",
"PropertyMock",
"(",
"return_value",
"=",
"\"12345abc\"",
")",
"return",
"api"
] | [
16,
0
] | [
20,
14
] | python | en | ['en', 'su', 'en'] | True |
test_duplicate_error | (hass) | Test that errors are shown when duplicates are added. | Test that errors are shown when duplicates are added. | async def test_duplicate_error(hass):
"""Test that errors are shown when duplicates are added."""
conf = {
CONF_USERNAME: "user@email.com",
CONF_PASSWORD: "password",
CONF_CODE: "1234",
}
MockConfigEntry(
domain=DOMAIN,
unique_id="user@email.com",
data={C... | [
"async",
"def",
"test_duplicate_error",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_USERNAME",
":",
"\"user@email.com\"",
",",
"CONF_PASSWORD",
":",
"\"password\"",
",",
"CONF_CODE",
":",
"\"1234\"",
",",
"}",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
... | [
23,
0
] | [
42,
51
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_credentials | (hass) | Test that invalid credentials throws an error. | Test that invalid credentials throws an error. | async def test_invalid_credentials(hass):
"""Test that invalid credentials throws an error."""
conf = {CONF_USERNAME: "user@email.com", CONF_PASSWORD: "password"}
with patch(
"simplipy.API.login_via_credentials",
new=AsyncMock(side_effect=InvalidCredentialsError),
):
result = aw... | [
"async",
"def",
"test_invalid_credentials",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_USERNAME",
":",
"\"user@email.com\"",
",",
"CONF_PASSWORD",
":",
"\"password\"",
"}",
"with",
"patch",
"(",
"\"simplipy.API.login_via_credentials\"",
",",
"new",
"=",
"AsyncMo... | [
45,
0
] | [
56,
59
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow | (hass) | Test config flow options. | Test config flow options. | async def test_options_flow(hass):
"""Test config flow options."""
conf = {CONF_USERNAME: "user@email.com", CONF_PASSWORD: "password"}
config_entry = MockConfigEntry(
domain=DOMAIN,
unique_id="abcde12345",
data=conf,
options={CONF_CODE: "1234"},
)
config_entry.add_to... | [
"async",
"def",
"test_options_flow",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_USERNAME",
":",
"\"user@email.com\"",
",",
"CONF_PASSWORD",
":",
"\"password\"",
"}",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",... | [
59,
0
] | [
84,
58
] | python | en | ['en', 'fr', 'en'] | True |
test_show_form | (hass) | Test that the form is served with no input. | Test that the form is served with no input. | async def test_show_form(hass):
"""Test that the form is served with no input."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user" | [
"async",
"def",
"test_show_form",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_USER",
"}",
")",
"assert",
"result",
"[",
... | [
87,
0
] | [
94,
38
] | python | en | ['en', 'en', 'en'] | True |
test_step_reauth | (hass) | Test that the reauth step works. | Test that the reauth step works. | async def test_step_reauth(hass):
"""Test that the reauth step works."""
MockConfigEntry(
domain=DOMAIN,
unique_id="user@email.com",
data={CONF_USERNAME: "user@email.com", CONF_TOKEN: "12345", CONF_CODE: "1234"},
).add_to_hass(hass)
result = await hass.config_entries.flow.async_... | [
"async",
"def",
"test_step_reauth",
"(",
"hass",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"\"user@email.com\"",
",",
"data",
"=",
"{",
"CONF_USERNAME",
":",
"\"user@email.com\"",
",",
"CONF_TOKEN",
":",
"\"12345\"",
",",
... | [
97,
0
] | [
127,
56
] | python | en | ['en', 'en', 'en'] | True |
test_step_user | (hass) | Test that the user step works (without MFA). | Test that the user step works (without MFA). | async def test_step_user(hass):
"""Test that the user step works (without MFA)."""
conf = {
CONF_USERNAME: "user@email.com",
CONF_PASSWORD: "password",
CONF_CODE: "1234",
}
with patch(
"homeassistant.components.simplisafe.async_setup_entry", return_value=True
), patc... | [
"async",
"def",
"test_step_user",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_USERNAME",
":",
"\"user@email.com\"",
",",
"CONF_PASSWORD",
":",
"\"password\"",
",",
"CONF_CODE",
":",
"\"1234\"",
",",
"}",
"with",
"patch",
"(",
"\"homeassistant.components.simplis... | [
130,
0
] | [
153,
9
] | python | en | ['en', 'en', 'en'] | True |
test_step_user_mfa | (hass) | Test that the user step works when MFA is in the middle. | Test that the user step works when MFA is in the middle. | async def test_step_user_mfa(hass):
"""Test that the user step works when MFA is in the middle."""
conf = {
CONF_USERNAME: "user@email.com",
CONF_PASSWORD: "password",
CONF_CODE: "1234",
}
with patch(
"simplipy.API.login_via_credentials",
new=AsyncMock(side_effec... | [
"async",
"def",
"test_step_user_mfa",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_USERNAME",
":",
"\"user@email.com\"",
",",
"CONF_PASSWORD",
":",
"\"password\"",
",",
"CONF_CODE",
":",
"\"1234\"",
",",
"}",
"with",
"patch",
"(",
"\"simplipy.API.login_via_crede... | [
156,
0
] | [
199,
9
] | python | en | ['en', 'en', 'en'] | True |
test_unknown_error | (hass) | Test that an unknown error raises the correct error. | Test that an unknown error raises the correct error. | async def test_unknown_error(hass):
"""Test that an unknown error raises the correct error."""
conf = {CONF_USERNAME: "user@email.com", CONF_PASSWORD: "password"}
with patch(
"simplipy.API.login_via_credentials",
new=AsyncMock(side_effect=SimplipyError),
):
result = await hass.c... | [
"async",
"def",
"test_unknown_error",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_USERNAME",
":",
"\"user@email.com\"",
",",
"CONF_PASSWORD",
":",
"\"password\"",
"}",
"with",
"patch",
"(",
"\"simplipy.API.login_via_credentials\"",
",",
"new",
"=",
"AsyncMock",
... | [
202,
0
] | [
213,
54
] | python | en | ['en', 'en', 'en'] | True |
test_setting_sensor_value_expires_availability_topic | (hass, mqtt_mock, caplog) | Test the expiration of the value. | Test the expiration of the value. | async def test_setting_sensor_value_expires_availability_topic(hass, mqtt_mock, caplog):
"""Test the expiration of the value."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
"name... | [
"async",
"def",
"test_setting_sensor_value_expires_availability_topic",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
":... | [
54,
0
] | [
81,
49
] | python | en | ['en', 'en', 'en'] | True |
test_setting_sensor_value_expires | (hass, mqtt_mock, caplog) | Test the expiration of the value. | Test the expiration of the value. | async def test_setting_sensor_value_expires(hass, mqtt_mock, caplog):
"""Test the expiration of the value."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
... | [
"async",
"def",
"test_setting_sensor_value_expires",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
":",
"{",
"\"plat... | [
84,
0
] | [
105,
49
] | python | en | ['en', 'en', 'en'] | True |
expires_helper | (hass, mqtt_mock, caplog) | Run the basic expiry code. | Run the basic expiry code. | async def expires_helper(hass, mqtt_mock, caplog):
"""Run the basic expiry code."""
realnow = dt_util.utcnow()
now = datetime(realnow.year + 1, 1, 1, 1, tzinfo=dt_util.UTC)
with patch(("homeassistant.helpers.event.dt_util.utcnow"), return_value=now):
async_fire_time_changed(hass, now)
as... | [
"async",
"def",
"expires_helper",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"realnow",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"now",
"=",
"datetime",
"(",
"realnow",
".",
"year",
"+",
"1",
",",
"1",
",",
"1",
",",
"1",
",",
"tzinfo"... | [
108,
0
] | [
156,
43
] | python | en | ['en', 'sn', 'en'] | True |
test_expiration_on_discovery_and_discovery_update_of_binary_sensor | (
hass, mqtt_mock, caplog
) | Test that binary_sensor with expire_after set behaves correctly on discovery and discovery update. | Test that binary_sensor with expire_after set behaves correctly on discovery and discovery update. | async def test_expiration_on_discovery_and_discovery_update_of_binary_sensor(
hass, mqtt_mock, caplog
):
"""Test that binary_sensor with expire_after set behaves correctly on discovery and discovery update."""
config = {
"name": "Test",
"state_topic": "test-topic",
"expire_after": 4,... | [
"async",
"def",
"test_expiration_on_discovery_and_discovery_update_of_binary_sensor",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config",
"=",
"{",
"\"name\"",
":",
"\"Test\"",
",",
"\"state_topic\"",
":",
"\"test-topic\"",
",",
"\"expire_after\"",
":",
... | [
159,
0
] | [
236,
43
] | python | en | ['en', 'en', 'en'] | True |
test_setting_sensor_value_via_mqtt_message | (hass, mqtt_mock) | Test the setting of the value via MQTT. | Test the setting of the value via MQTT. | async def test_setting_sensor_value_via_mqtt_message(hass, mqtt_mock):
"""Test the setting of the value via MQTT."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
... | [
"async",
"def",
"test_setting_sensor_value_via_mqtt_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
... | [
239,
0
] | [
266,
35
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_sensor_value_via_mqtt_message | (hass, mqtt_mock, caplog) | Test the setting of the value via MQTT. | Test the setting of the value via MQTT. | async def test_invalid_sensor_value_via_mqtt_message(hass, mqtt_mock, caplog):
"""Test the setting of the value via MQTT."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
"name": "... | [
"async",
"def",
"test_invalid_sensor_value_via_mqtt_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
":",
"{",
... | [
269,
0
] | [
304,
64
] | python | en | ['en', 'en', 'en'] | True |
test_setting_sensor_value_via_mqtt_message_and_template | (hass, mqtt_mock) | Test the setting of the value via MQTT. | Test the setting of the value via MQTT. | async def test_setting_sensor_value_via_mqtt_message_and_template(hass, mqtt_mock):
"""Test the setting of the value via MQTT."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
"nam... | [
"async",
"def",
"test_setting_sensor_value_via_mqtt_message_and_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
":",
"{",
"\"p... | [
307,
0
] | [
335,
35
] | python | en | ['en', 'en', 'en'] | True |
test_setting_sensor_value_via_mqtt_message_and_template2 | (
hass, mqtt_mock, caplog
) | Test the setting of the value via MQTT. | Test the setting of the value via MQTT. | async def test_setting_sensor_value_via_mqtt_message_and_template2(
hass, mqtt_mock, caplog
):
"""Test the setting of the value via MQTT."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
... | [
"async",
"def",
"test_setting_sensor_value_via_mqtt_message_and_template2",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
... | [
338,
0
] | [
372,
54
] | python | en | ['en', 'en', 'en'] | True |
test_setting_sensor_value_via_mqtt_message_empty_template | (
hass, mqtt_mock, caplog
) | Test the setting of the value via MQTT. | Test the setting of the value via MQTT. | async def test_setting_sensor_value_via_mqtt_message_empty_template(
hass, mqtt_mock, caplog
):
"""Test the setting of the value via MQTT."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
... | [
"async",
"def",
"test_setting_sensor_value_via_mqtt_message_empty_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",... | [
375,
0
] | [
405,
34
] | python | en | ['en', 'en', 'en'] | True |
test_valid_device_class | (hass, mqtt_mock) | Test the setting of a valid sensor class. | Test the setting of a valid sensor class. | async def test_valid_device_class(hass, mqtt_mock):
"""Test the setting of a valid sensor class."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
"d... | [
"async",
"def",
"test_valid_device_class",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",... | [
408,
0
] | [
425,
59
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_device_class | (hass, mqtt_mock) | Test the setting of an invalid sensor class. | Test the setting of an invalid sensor class. | async def test_invalid_device_class(hass, mqtt_mock):
"""Test the setting of an invalid sensor class."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
... | [
"async",
"def",
"test_invalid_device_class",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"... | [
428,
0
] | [
445,
24
] | python | en | ['en', 'en', 'en'] | True |
test_availability_when_connection_lost | (hass, mqtt_mock) | Test availability after MQTT disconnection. | Test availability after MQTT disconnection. | async def test_availability_when_connection_lost(hass, mqtt_mock):
"""Test availability after MQTT disconnection."""
await help_test_availability_when_connection_lost(
hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
448,
0
] | [
452,
5
] | python | en | ['en', 'en', 'en'] | True |
test_availability_without_topic | (hass, mqtt_mock) | Test availability without defined availability topic. | Test availability without defined availability topic. | async def test_availability_without_topic(hass, mqtt_mock):
"""Test availability without defined availability topic."""
await help_test_availability_without_topic(
hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
455,
0
] | [
459,
5
] | python | en | ['en', 'en', 'en'] | True |
test_default_availability_payload | (hass, mqtt_mock) | Test availability by default payload with defined topic. | Test availability by default payload with defined topic. | async def test_default_availability_payload(hass, mqtt_mock):
"""Test availability by default payload with defined topic."""
await help_test_default_availability_payload(
hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
462,
0
] | [
466,
5
] | python | en | ['en', 'en', 'en'] | True |
test_custom_availability_payload | (hass, mqtt_mock) | Test availability by custom payload with defined topic. | Test availability by custom payload with defined topic. | async def test_custom_availability_payload(hass, mqtt_mock):
"""Test availability by custom payload with defined topic."""
await help_test_custom_availability_payload(
hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
469,
0
] | [
473,
5
] | python | en | ['en', 'en', 'en'] | True |
test_force_update_disabled | (hass, mqtt_mock) | Test force update option. | Test force update option. | async def test_force_update_disabled(hass, mqtt_mock):
"""Test force update option."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": ... | [
"async",
"def",
"test_force_update_disabled",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\... | [
476,
0
] | [
508,
27
] | python | en | ['en', 'en', 'en'] | True |
test_force_update_enabled | (hass, mqtt_mock) | Test force update option. | Test force update option. | async def test_force_update_enabled(hass, mqtt_mock):
"""Test force update option."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "... | [
"async",
"def",
"test_force_update_enabled",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"... | [
511,
0
] | [
544,
27
] | python | en | ['en', 'en', 'en'] | True |
test_off_delay | (hass, mqtt_mock) | Test off_delay option. | Test off_delay option. | async def test_off_delay(hass, mqtt_mock):
"""Test off_delay option."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
binary_sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "test-topic",
... | [
"async",
"def",
"test_off_delay",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"binary_sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
... | [
547,
0
] | [
591,
27
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_via_mqtt_json_message | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_via_mqtt_json_message(
hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
594,
0
] | [
598,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_with_template | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_with_template(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_with_template(
hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
601,
0
] | [
605,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_not_dict | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_not_dict(
hass, mqtt_mock, caplog, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFI... | [
608,
0
] | [
612,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_bad_JSON | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_bad_JSON(
hass, mqtt_mock, caplog, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFI... | [
615,
0
] | [
619,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_attr | (hass, mqtt_mock, caplog) | Test update of discovered MQTTAttributes. | Test update of discovered MQTTAttributes. | async def test_discovery_update_attr(hass, mqtt_mock, caplog):
"""Test update of discovered MQTTAttributes."""
await help_test_discovery_update_attr(
hass, mqtt_mock, caplog, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
622,
0
] | [
626,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unique_id | (hass, mqtt_mock) | Test unique id option only creates one sensor per unique_id. | Test unique id option only creates one sensor per unique_id. | async def test_unique_id(hass, mqtt_mock):
"""Test unique id option only creates one sensor per unique_id."""
config = {
binary_sensor.DOMAIN: [
{
"platform": "mqtt",
"name": "Test 1",
"state_topic": "test-topic",
"unique_id": "... | [
"async",
"def",
"test_unique_id",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"binary_sensor",
".",
"DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"Test 1\"",
",",
"\"state_topic\"",
":",
"\"test-topic\"",
... | [
629,
0
] | [
647,
76
] | python | en | ['en', 'fr', 'en'] | True |
test_discovery_removal_binary_sensor | (hass, mqtt_mock, caplog) | Test removal of discovered binary_sensor. | Test removal of discovered binary_sensor. | async def test_discovery_removal_binary_sensor(hass, mqtt_mock, caplog):
"""Test removal of discovered binary_sensor."""
data = json.dumps(DEFAULT_CONFIG[binary_sensor.DOMAIN])
await help_test_discovery_removal(
hass, mqtt_mock, caplog, binary_sensor.DOMAIN, data
) | [
"async",
"def",
"test_discovery_removal_binary_sensor",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data",
"=",
"json",
".",
"dumps",
"(",
"DEFAULT_CONFIG",
"[",
"binary_sensor",
".",
"DOMAIN",
"]",
")",
"await",
"help_test_discovery_removal",
"(",
... | [
650,
0
] | [
655,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_binary_sensor_topic_template | (hass, mqtt_mock, caplog) | Test update of discovered binary_sensor. | Test update of discovered binary_sensor. | async def test_discovery_update_binary_sensor_topic_template(hass, mqtt_mock, caplog):
"""Test update of discovered binary_sensor."""
config1 = copy.deepcopy(DEFAULT_CONFIG[binary_sensor.DOMAIN])
config2 = copy.deepcopy(DEFAULT_CONFIG[binary_sensor.DOMAIN])
config1["name"] = "Beer"
config2["name"] =... | [
"async",
"def",
"test_discovery_update_binary_sensor_topic_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
"[",
"binary_sensor",
".",
"DOMAIN",
"]",
")",
"config2",
"=",
"copy",
"... | [
658,
0
] | [
692,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_binary_sensor_template | (hass, mqtt_mock, caplog) | Test update of discovered binary_sensor. | Test update of discovered binary_sensor. | async def test_discovery_update_binary_sensor_template(hass, mqtt_mock, caplog):
"""Test update of discovered binary_sensor."""
config1 = copy.deepcopy(DEFAULT_CONFIG[binary_sensor.DOMAIN])
config2 = copy.deepcopy(DEFAULT_CONFIG[binary_sensor.DOMAIN])
config1["name"] = "Beer"
config2["name"] = "Milk... | [
"async",
"def",
"test_discovery_update_binary_sensor_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
"[",
"binary_sensor",
".",
"DOMAIN",
"]",
")",
"config2",
"=",
"copy",
".",
... | [
695,
0
] | [
727,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_unchanged_binary_sensor | (hass, mqtt_mock, caplog) | Test update of discovered binary_sensor. | Test update of discovered binary_sensor. | async def test_discovery_update_unchanged_binary_sensor(hass, mqtt_mock, caplog):
"""Test update of discovered binary_sensor."""
config1 = copy.deepcopy(DEFAULT_CONFIG[binary_sensor.DOMAIN])
config1["name"] = "Beer"
data1 = json.dumps(config1)
with patch(
"homeassistant.components.mqtt.bina... | [
"async",
"def",
"test_discovery_update_unchanged_binary_sensor",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
"[",
"binary_sensor",
".",
"DOMAIN",
"]",
")",
"config1",
"[",
"\"name\"",
"]... | [
730,
0
] | [
741,
9
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_broken | (hass, mqtt_mock, caplog) | Test handling of bad discovery message. | Test handling of bad discovery message. | async def test_discovery_broken(hass, mqtt_mock, caplog):
"""Test handling of bad discovery message."""
data1 = '{ "name": "Beer",' ' "off_delay": -1 }'
data2 = '{ "name": "Milk",' ' "state_topic": "test_topic" }'
await help_test_discovery_broken(
hass, mqtt_mock, caplog, binary_sensor.DOMAIN,... | [
"async",
"def",
"test_discovery_broken",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\",'",
"' \"off_delay\": -1 }'",
"data2",
"=",
"'{ \"name\": \"Milk\",'",
"' \"state_topic\": \"test_topic\" }'",
"await",
"help_test_discovery... | [
745,
0
] | [
751,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_connection | (hass, mqtt_mock) | Test MQTT binary sensor device registry integration. | Test MQTT binary sensor device registry integration. | async def test_entity_device_info_with_connection(hass, mqtt_mock):
"""Test MQTT binary sensor device registry integration."""
await help_test_entity_device_info_with_connection(
hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
754,
0
] | [
758,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_with_identifier | (hass, mqtt_mock) | Test MQTT binary sensor device registry integration. | Test MQTT binary sensor device registry integration. | async def test_entity_device_info_with_identifier(hass, mqtt_mock):
"""Test MQTT binary sensor device registry integration."""
await help_test_entity_device_info_with_identifier(
hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
761,
0
] | [
765,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_update | (hass, mqtt_mock) | Test device registry update. | Test device registry update. | async def test_entity_device_info_update(hass, mqtt_mock):
"""Test device registry update."""
await help_test_entity_device_info_update(
hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
768,
0
] | [
772,
5
] | python | en | ['fr', 'fy', 'en'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.