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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
playlists_fixture | () | Create favorites fixture. | Create favorites fixture. | def playlists_fixture() -> Sequence[HeosSource]:
"""Create favorites fixture."""
playlist = Mock(HeosSource)
playlist.type = const.TYPE_PLAYLIST
playlist.name = "Awesome Music"
return [playlist] | [
"def",
"playlists_fixture",
"(",
")",
"->",
"Sequence",
"[",
"HeosSource",
"]",
":",
"playlist",
"=",
"Mock",
"(",
"HeosSource",
")",
"playlist",
".",
"type",
"=",
"const",
".",
"TYPE_PLAYLIST",
"playlist",
".",
"name",
"=",
"\"Awesome Music\"",
"return",
"[... | [
146,
0
] | [
151,
21
] | python | en | ['en', 'la', 'en'] | True |
change_data_fixture | () | Create player change data for testing. | Create player change data for testing. | def change_data_fixture() -> Dict:
"""Create player change data for testing."""
return {const.DATA_MAPPED_IDS: {}, const.DATA_NEW: []} | [
"def",
"change_data_fixture",
"(",
")",
"->",
"Dict",
":",
"return",
"{",
"const",
".",
"DATA_MAPPED_IDS",
":",
"{",
"}",
",",
"const",
".",
"DATA_NEW",
":",
"[",
"]",
"}"
] | [
155,
0
] | [
157,
58
] | python | en | ['en', 'en', 'en'] | True |
change_data_mapped_ids_fixture | () | Create player change data for testing. | Create player change data for testing. | def change_data_mapped_ids_fixture() -> Dict:
"""Create player change data for testing."""
return {const.DATA_MAPPED_IDS: {101: 1}, const.DATA_NEW: []} | [
"def",
"change_data_mapped_ids_fixture",
"(",
")",
"->",
"Dict",
":",
"return",
"{",
"const",
".",
"DATA_MAPPED_IDS",
":",
"{",
"101",
":",
"1",
"}",
",",
"const",
".",
"DATA_NEW",
":",
"[",
"]",
"}"
] | [
161,
0
] | [
163,
64
] | python | en | ['en', 'en', 'en'] | True |
NotionFlowHandler.__init__ | (self) | Initialize the config flow. | Initialize the config flow. | def __init__(self):
"""Initialize the config flow."""
self.data_schema = vol.Schema(
{vol.Required(CONF_USERNAME): str, vol.Required(CONF_PASSWORD): str}
) | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"data_schema",
"=",
"vol",
".",
"Schema",
"(",
"{",
"vol",
".",
"Required",
"(",
"CONF_USERNAME",
")",
":",
"str",
",",
"vol",
".",
"Required",
"(",
"CONF_PASSWORD",
")",
":",
"str",
"}",
")"
] | [
18,
4
] | [
22,
9
] | python | en | ['en', 'en', 'en'] | True |
NotionFlowHandler._show_form | (self, errors=None) | Show the form to the user. | Show the form to the user. | async def _show_form(self, errors=None):
"""Show the form to the user."""
return self.async_show_form(
step_id="user", data_schema=self.data_schema, errors=errors or {}
) | [
"async",
"def",
"_show_form",
"(",
"self",
",",
"errors",
"=",
"None",
")",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"user\"",
",",
"data_schema",
"=",
"self",
".",
"data_schema",
",",
"errors",
"=",
"errors",
"or",
"{",
"}",... | [
24,
4
] | [
28,
9
] | python | en | ['en', 'en', 'en'] | True |
NotionFlowHandler.async_step_user | (self, user_input=None) | Handle the start of the config flow. | Handle the start of the config flow. | async def async_step_user(self, user_input=None):
"""Handle the start of the config flow."""
if not user_input:
return await self._show_form()
await self.async_set_unique_id(user_input[CONF_USERNAME])
self._abort_if_unique_id_configured()
session = aiohttp_client.as... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"not",
"user_input",
":",
"return",
"await",
"self",
".",
"_show_form",
"(",
")",
"await",
"self",
".",
"async_set_unique_id",
"(",
"user_input",
"[",
"CONF_USERN... | [
30,
4
] | [
47,
88
] | python | en | ['en', 'en', 'en'] | True |
JuiceNetApi.__init__ | (self, api) | Create an object from the provided API instance. | Create an object from the provided API instance. | def __init__(self, api):
"""Create an object from the provided API instance."""
self.api = api
self._devices = [] | [
"def",
"__init__",
"(",
"self",
",",
"api",
")",
":",
"self",
".",
"api",
"=",
"api",
"self",
".",
"_devices",
"=",
"[",
"]"
] | [
6,
4
] | [
9,
26
] | python | en | ['en', 'en', 'en'] | True |
JuiceNetApi.setup | (self) | JuiceNet device setup. | JuiceNet device setup. | async def setup(self):
"""JuiceNet device setup.""" # noqa: D403
self._devices = await self.api.get_devices() | [
"async",
"def",
"setup",
"(",
"self",
")",
":",
"# noqa: D403",
"self",
".",
"_devices",
"=",
"await",
"self",
".",
"api",
".",
"get_devices",
"(",
")"
] | [
11,
4
] | [
13,
52
] | python | en | ['fr', 'zu', 'en'] | False |
JuiceNetApi.devices | (self) | Get a list of devices managed by this account. | Get a list of devices managed by this account. | def devices(self) -> list:
"""Get a list of devices managed by this account."""
return self._devices | [
"def",
"devices",
"(",
"self",
")",
"->",
"list",
":",
"return",
"self",
".",
"_devices"
] | [
16,
4
] | [
18,
28
] | python | en | ['en', 'en', 'en'] | True |
test_creating_entry_sets_up_media_player | (hass) | Test setting up Sonos loads the media player. | Test setting up Sonos loads the media player. | async def test_creating_entry_sets_up_media_player(hass):
"""Test setting up Sonos loads the media player."""
with patch(
"homeassistant.components.sonos.media_player.async_setup_entry",
return_value=mock_coro(True),
) as mock_setup, patch("pysonos.discover", return_value=True):
resu... | [
"async",
"def",
"test_creating_entry_sets_up_media_player",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.sonos.media_player.async_setup_entry\"",
",",
"return_value",
"=",
"mock_coro",
"(",
"True",
")",
",",
")",
"as",
"mock_setup",
",",
"pat... | [
10,
0
] | [
28,
42
] | python | en | ['en', 'en', 'en'] | True |
test_configuring_sonos_creates_entry | (hass) | Test that specifying config will create an entry. | Test that specifying config will create an entry. | async def test_configuring_sonos_creates_entry(hass):
"""Test that specifying config will create an entry."""
with patch(
"homeassistant.components.sonos.async_setup_entry", return_value=mock_coro(True)
) as mock_setup, patch("pysonos.discover", return_value=True):
await async_setup_componen... | [
"async",
"def",
"test_configuring_sonos_creates_entry",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.sonos.async_setup_entry\"",
",",
"return_value",
"=",
"mock_coro",
"(",
"True",
")",
")",
"as",
"mock_setup",
",",
"patch",
"(",
"\"pysonos... | [
31,
0
] | [
43,
42
] | python | en | ['en', 'en', 'en'] | True |
test_not_configuring_sonos_not_creates_entry | (hass) | Test that no config will not create an entry. | Test that no config will not create an entry. | async def test_not_configuring_sonos_not_creates_entry(hass):
"""Test that no config will not create an entry."""
with patch(
"homeassistant.components.sonos.async_setup_entry", return_value=mock_coro(True)
) as mock_setup, patch("pysonos.discover", return_value=True):
await async_setup_comp... | [
"async",
"def",
"test_not_configuring_sonos_not_creates_entry",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.sonos.async_setup_entry\"",
",",
"return_value",
"=",
"mock_coro",
"(",
"True",
")",
")",
"as",
"mock_setup",
",",
"patch",
"(",
"\... | [
46,
0
] | [
54,
42
] | python | en | ['en', 'en', 'en'] | True |
problem4_3 | (product, cost) | Prints the product name in a space of 25 characters, left-justified
and the price in a space of 6 characters, right-justified | Prints the product name in a space of 25 characters, left-justified
and the price in a space of 6 characters, right-justified | def problem4_3(product, cost):
""" Prints the product name in a space of 25 characters, left-justified
and the price in a space of 6 characters, right-justified"""
print('{}${:6.2f}'.format(product.ljust(25), cost)) | [
"def",
"problem4_3",
"(",
"product",
",",
"cost",
")",
":",
"print",
"(",
"'{}${:6.2f}'",
".",
"format",
"(",
"product",
".",
"ljust",
"(",
"25",
")",
",",
"cost",
")",
")"
] | [
14,
0
] | [
17,
55
] | python | en | ['en', 'en', 'en'] | True |
test_setup | (hass, aioclient_mock) | Test that the component is loaded. | Test that the component is loaded. | async def test_setup(hass, aioclient_mock):
"""Test that the component is loaded."""
aioclient_mock.get(URL, text=load_fixture("wunderground-valid.json"))
with assert_setup_component(1, "sensor"):
await async_setup_component(hass, "sensor", {"sensor": VALID_CONFIG})
await hass.async_block_t... | [
"async",
"def",
"test_setup",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"URL",
",",
"text",
"=",
"load_fixture",
"(",
"\"wunderground-valid.json\"",
")",
")",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"sensor\"",
... | [
62,
0
] | [
68,
42
] | python | en | ['en', 'en', 'en'] | True |
test_setup_pws | (hass, aioclient_mock) | Test that the component is loaded with PWS id. | Test that the component is loaded with PWS id. | async def test_setup_pws(hass, aioclient_mock):
"""Test that the component is loaded with PWS id."""
aioclient_mock.get(PWS_URL, text=load_fixture("wunderground-valid.json"))
with assert_setup_component(1, "sensor"):
await async_setup_component(hass, "sensor", {"sensor": VALID_CONFIG_PWS}) | [
"async",
"def",
"test_setup_pws",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"PWS_URL",
",",
"text",
"=",
"load_fixture",
"(",
"\"wunderground-valid.json\"",
")",
")",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"sens... | [
71,
0
] | [
76,
81
] | python | en | ['en', 'en', 'en'] | True |
test_setup_invalid | (hass, aioclient_mock) | Test that the component is not loaded with invalid config. | Test that the component is not loaded with invalid config. | async def test_setup_invalid(hass, aioclient_mock):
"""Test that the component is not loaded with invalid config."""
aioclient_mock.get(INVALID_URL, text=load_fixture("wunderground-error.json"))
with assert_setup_component(0, "sensor"):
await async_setup_component(hass, "sensor", {"sensor": INVALID... | [
"async",
"def",
"test_setup_invalid",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"INVALID_URL",
",",
"text",
"=",
"load_fixture",
"(",
"\"wunderground-error.json\"",
")",
")",
"with",
"assert_setup_component",
"(",
"0",
",",
... | [
79,
0
] | [
84,
79
] | python | en | ['en', 'en', 'en'] | True |
test_sensor | (hass, aioclient_mock) | Test the WUnderground sensor class and methods. | Test the WUnderground sensor class and methods. | async def test_sensor(hass, aioclient_mock):
"""Test the WUnderground sensor class and methods."""
aioclient_mock.get(URL, text=load_fixture("wunderground-valid.json"))
await async_setup_component(hass, "sensor", {"sensor": VALID_CONFIG})
await hass.async_block_till_done()
state = hass.states.get(... | [
"async",
"def",
"test_sensor",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"URL",
",",
"text",
"=",
"load_fixture",
"(",
"\"wunderground-valid.json\"",
")",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"sensor\"... | [
87,
0
] | [
130,
70
] | python | en | ['en', 'en', 'en'] | True |
test_connect_failed | (hass, aioclient_mock) | Test the WUnderground connection error. | Test the WUnderground connection error. | async def test_connect_failed(hass, aioclient_mock):
"""Test the WUnderground connection error."""
aioclient_mock.get(URL, exc=aiohttp.ClientError())
with raises(PlatformNotReady):
await wunderground.async_setup_platform(hass, VALID_CONFIG, lambda _: None) | [
"async",
"def",
"test_connect_failed",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"URL",
",",
"exc",
"=",
"aiohttp",
".",
"ClientError",
"(",
")",
")",
"with",
"raises",
"(",
"PlatformNotReady",
")",
":",
"await",
"wun... | [
133,
0
] | [
137,
83
] | python | en | ['en', 'de', 'en'] | True |
test_invalid_data | (hass, aioclient_mock) | Test the WUnderground invalid data. | Test the WUnderground invalid data. | async def test_invalid_data(hass, aioclient_mock):
"""Test the WUnderground invalid data."""
aioclient_mock.get(URL, text=load_fixture("wunderground-invalid.json"))
await async_setup_component(hass, "sensor", {"sensor": VALID_CONFIG})
await hass.async_block_till_done()
for condition in VALID_CONFI... | [
"async",
"def",
"test_invalid_data",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"URL",
",",
"text",
"=",
"load_fixture",
"(",
"\"wunderground-invalid.json\"",
")",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"... | [
140,
0
] | [
149,
43
] | python | en | ['en', 'zu', 'en'] | True |
test_entity_id_with_multiple_stations | (hass, aioclient_mock) | Test not generating duplicate entity ids with multiple stations. | Test not generating duplicate entity ids with multiple stations. | async def test_entity_id_with_multiple_stations(hass, aioclient_mock):
"""Test not generating duplicate entity ids with multiple stations."""
aioclient_mock.get(URL, text=load_fixture("wunderground-valid.json"))
aioclient_mock.get(PWS_URL, text=load_fixture("wunderground-valid.json"))
config = [VALID_C... | [
"async",
"def",
"test_entity_id_with_multiple_stations",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"URL",
",",
"text",
"=",
"load_fixture",
"(",
"\"wunderground-valid.json\"",
")",
")",
"aioclient_mock",
".",
"get",
"(",
"PWS... | [
152,
0
] | [
167,
33
] | python | en | ['en', 'en', 'en'] | True |
test_fails_because_of_unique_id | (hass, aioclient_mock) | Test same config twice fails because of unique_id. | Test same config twice fails because of unique_id. | async def test_fails_because_of_unique_id(hass, aioclient_mock):
"""Test same config twice fails because of unique_id."""
aioclient_mock.get(URL, text=load_fixture("wunderground-valid.json"))
aioclient_mock.get(PWS_URL, text=load_fixture("wunderground-valid.json"))
config = [
VALID_CONFIG,
... | [
"async",
"def",
"test_fails_because_of_unique_id",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"URL",
",",
"text",
"=",
"load_fixture",
"(",
"\"wunderground-valid.json\"",
")",
")",
"aioclient_mock",
".",
"get",
"(",
"PWS_URL",... | [
170,
0
] | [
187,
34
] | python | en | ['en', 'en', 'en'] | True |
get_changed_since | (
states: Iterable[State], utc_point_in_time: dt.datetime
) | Return list of states that have been changed since utc_point_in_time. | Return list of states that have been changed since utc_point_in_time. | def get_changed_since(
states: Iterable[State], utc_point_in_time: dt.datetime
) -> List[State]:
"""Return list of states that have been changed since utc_point_in_time."""
return [state for state in states if state.last_updated >= utc_point_in_time] | [
"def",
"get_changed_since",
"(",
"states",
":",
"Iterable",
"[",
"State",
"]",
",",
"utc_point_in_time",
":",
"dt",
".",
"datetime",
")",
"->",
"List",
"[",
"State",
"]",
":",
"return",
"[",
"state",
"for",
"state",
"in",
"states",
"if",
"state",
".",
... | [
60,
0
] | [
64,
81
] | python | en | ['en', 'en', 'en'] | True |
async_reproduce_state | (
hass: HomeAssistantType,
states: Union[State, Iterable[State]],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) | Reproduce a list of states on multiple domains. | Reproduce a list of states on multiple domains. | async def async_reproduce_state(
hass: HomeAssistantType,
states: Union[State, Iterable[State]],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce a list of states on multiple domains."""
if isinstance(states, State):
st... | [
"async",
"def",
"async_reproduce_state",
"(",
"hass",
":",
"HomeAssistantType",
",",
"states",
":",
"Union",
"[",
"State",
",",
"Iterable",
"[",
"State",
"]",
"]",
",",
"*",
",",
"context",
":",
"Optional",
"[",
"Context",
"]",
"=",
"None",
",",
"reprodu... | [
68,
0
] | [
107,
9
] | python | en | ['en', 'en', 'en'] | True |
state_as_number | (state: State) |
Try to coerce our state to a number.
Raises ValueError if this is not possible.
|
Try to coerce our state to a number. | def state_as_number(state: State) -> float:
"""
Try to coerce our state to a number.
Raises ValueError if this is not possible.
"""
if state.state in (
STATE_ON,
STATE_LOCKED,
STATE_ABOVE_HORIZON,
STATE_OPEN,
STATE_HOME,
):
return 1
if state.s... | [
"def",
"state_as_number",
"(",
"state",
":",
"State",
")",
"->",
"float",
":",
"if",
"state",
".",
"state",
"in",
"(",
"STATE_ON",
",",
"STATE_LOCKED",
",",
"STATE_ABOVE_HORIZON",
",",
"STATE_OPEN",
",",
"STATE_HOME",
",",
")",
":",
"return",
"1",
"if",
... | [
110,
0
] | [
134,
29
] | python | en | ['en', 'error', 'th'] | False |
AsyncTrackStates.__init__ | (self, hass: HomeAssistantType) | Initialize a TrackStates block. | Initialize a TrackStates block. | def __init__(self, hass: HomeAssistantType) -> None:
"""Initialize a TrackStates block."""
self.hass = hass
self.states: List[State] = [] | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
")",
"->",
"None",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"states",
":",
"List",
"[",
"State",
"]",
"=",
"[",
"]"
] | [
39,
4
] | [
42,
37
] | python | en | ['en', 'co', 'en'] | True |
AsyncTrackStates.__enter__ | (self) | Record time from which to track changes. | Record time from which to track changes. | def __enter__(self) -> List[State]:
"""Record time from which to track changes."""
self.now = dt_util.utcnow()
return self.states | [
"def",
"__enter__",
"(",
"self",
")",
"->",
"List",
"[",
"State",
"]",
":",
"self",
".",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"return",
"self",
".",
"states"
] | [
45,
4
] | [
48,
26
] | python | en | ['en', 'en', 'en'] | True |
AsyncTrackStates.__exit__ | (
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[TracebackType],
) | Add changes states to changes list. | Add changes states to changes list. | def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[TracebackType],
) -> None:
"""Add changes states to changes list."""
self.states.extend(get_changed_since(self.hass.states.async_all(), self.now)) | [
"def",
"__exit__",
"(",
"self",
",",
"exc_type",
":",
"Optional",
"[",
"Type",
"[",
"BaseException",
"]",
"]",
",",
"exc_value",
":",
"Optional",
"[",
"BaseException",
"]",
",",
"traceback",
":",
"Optional",
"[",
"TracebackType",
"]",
",",
")",
"->",
"No... | [
50,
4
] | [
57,
85
] | python | en | ['en', 'en', 'en'] | True |
mock_light | (hass) | Create a mock light entity. | Create a mock light entity. | async def mock_light(hass):
"""Create a mock light entity."""
await setup.async_setup_component(hass, "persistent_notification", {})
mock_entry = MockConfigEntry(domain=DOMAIN)
mock_entry.add_to_hass(hass)
light = pyzerproc.Light("AA:BB:CC:DD:EE:FF", "LEDBlue-CCDDEEFF")
mock_state = pyzerproc... | [
"async",
"def",
"mock_light",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"mock_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
")",
"mock_entry",
"."... | [
31,
0
] | [
51,
16
] | python | en | ['en', 'sm', 'en'] | True |
test_init | (hass) | Test platform setup. | Test platform setup. | async def test_init(hass):
"""Test platform setup."""
await setup.async_setup_component(hass, "persistent_notification", {})
mock_entry = MockConfigEntry(domain=DOMAIN)
mock_entry.add_to_hass(hass)
mock_light_1 = pyzerproc.Light("AA:BB:CC:DD:EE:FF", "LEDBlue-CCDDEEFF")
mock_light_2 = pyzerproc... | [
"async",
"def",
"test_init",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"mock_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
")",
"mock_entry",
".",... | [
54,
0
] | [
108,
35
] | python | en | ['en', 'da', 'en'] | True |
test_discovery_exception | (hass) | Test platform setup. | Test platform setup. | async def test_discovery_exception(hass):
"""Test platform setup."""
await setup.async_setup_component(hass, "persistent_notification", {})
mock_entry = MockConfigEntry(domain=DOMAIN)
mock_entry.add_to_hass(hass)
with patch(
"homeassistant.components.zerproc.light.pyzerproc.discover",
... | [
"async",
"def",
"test_discovery_exception",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"mock_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
")",
"mock... | [
111,
0
] | [
126,
51
] | python | en | ['en', 'da', 'en'] | True |
test_connect_exception | (hass) | Test platform setup. | Test platform setup. | async def test_connect_exception(hass):
"""Test platform setup."""
await setup.async_setup_component(hass, "persistent_notification", {})
mock_entry = MockConfigEntry(domain=DOMAIN)
mock_entry.add_to_hass(hass)
mock_light = pyzerproc.Light("AA:BB:CC:DD:EE:FF", "LEDBlue-CCDDEEFF")
with patch(
... | [
"async",
"def",
"test_connect_exception",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"mock_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
")",
"mock_e... | [
129,
0
] | [
148,
51
] | python | en | ['en', 'da', 'en'] | True |
test_light_turn_on | (hass, mock_light) | Test ZerprocLight turn_on. | Test ZerprocLight turn_on. | async def test_light_turn_on(hass, mock_light):
"""Test ZerprocLight turn_on."""
utcnow = dt_util.utcnow()
with patch.object(mock_light, "turn_on") as mock_turn_on:
await hass.services.async_call(
"light",
"turn_on",
{ATTR_ENTITY_ID: "light.ledblue_ccddeeff"},
... | [
"async",
"def",
"test_light_turn_on",
"(",
"hass",
",",
"mock_light",
")",
":",
"utcnow",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"with",
"patch",
".",
"object",
"(",
"mock_light",
",",
"\"turn_on\"",
")",
"as",
"mock_turn_on",
":",
"await",
"hass",
".",
... | [
151,
0
] | [
240,
55
] | python | de | ['de', 'hr', 'it'] | False |
test_light_turn_off | (hass, mock_light) | Test ZerprocLight turn_on. | Test ZerprocLight turn_on. | async def test_light_turn_off(hass, mock_light):
"""Test ZerprocLight turn_on."""
with patch.object(mock_light, "turn_off") as mock_turn_off:
await hass.services.async_call(
"light",
"turn_off",
{ATTR_ENTITY_ID: "light.ledblue_ccddeeff"},
blocking=True,
... | [
"async",
"def",
"test_light_turn_off",
"(",
"hass",
",",
"mock_light",
")",
":",
"with",
"patch",
".",
"object",
"(",
"mock_light",
",",
"\"turn_off\"",
")",
"as",
"mock_turn_off",
":",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"light\"",
"... | [
243,
0
] | [
253,
33
] | python | de | ['de', 'hr', 'it'] | False |
test_light_update | (hass, mock_light) | Test ZerprocLight update. | Test ZerprocLight update. | async def test_light_update(hass, mock_light):
"""Test ZerprocLight update."""
utcnow = dt_util.utcnow()
state = hass.states.get("light.ledblue_ccddeeff")
assert state.state == STATE_OFF
assert state.attributes == {
ATTR_FRIENDLY_NAME: "LEDBlue-CCDDEEFF",
ATTR_SUPPORTED_FEATURES: SU... | [
"async",
"def",
"test_light_update",
"(",
"hass",
",",
"mock_light",
")",
":",
"utcnow",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"light.ledblue_ccddeeff\"",
")",
"assert",
"state",
".",
"state",
"=="... | [
256,
0
] | [
322,
9
] | python | de | ['de', 'hr', 'it'] | False |
test_flow_works | (hass, aioclient_mock, mock_discovery) | Test config flow. | Test config flow. | async def test_flow_works(hass, aioclient_mock, mock_discovery):
"""Test config flow."""
mock_discovery.return_value = "1"
result = await hass.config_entries.flow.async_init(
UNIFI_DOMAIN, context={"source": "user"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert resu... | [
"async",
"def",
"test_flow_works",
"(",
"hass",
",",
"aioclient_mock",
",",
"mock_discovery",
")",
":",
"mock_discovery",
".",
"return_value",
"=",
"\"1\"",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"UNIFI_DOMAIN... | [
84,
0
] | [
140,
5
] | python | da | ['de', 'da', 'en'] | False |
test_flow_works_multiple_sites | (hass, aioclient_mock) | Test config flow works when finding multiple sites. | Test config flow works when finding multiple sites. | async def test_flow_works_multiple_sites(hass, aioclient_mock):
"""Test config flow works when finding multiple sites."""
result = await hass.config_entries.flow.async_init(
UNIFI_DOMAIN, context={"source": "user"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["s... | [
"async",
"def",
"test_flow_works_multiple_sites",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"UNIFI_DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\"",
... | [
143,
0
] | [
186,
56
] | python | en | ['en', 'en', 'en'] | True |
test_flow_fails_site_already_configured | (hass, aioclient_mock) | Test config flow. | Test config flow. | async def test_flow_fails_site_already_configured(hass, aioclient_mock):
"""Test config flow."""
entry = MockConfigEntry(
domain=UNIFI_DOMAIN, data={"controller": {"host": "1.2.3.4", "site": "site_id"}}
)
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
UN... | [
"async",
"def",
"test_flow_fails_site_already_configured",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"UNIFI_DOMAIN",
",",
"data",
"=",
"{",
"\"controller\"",
":",
"{",
"\"host\"",
":",
"\"1.2.3.4\"",
",",
... | [
189,
0
] | [
232,
51
] | python | da | ['de', 'da', 'en'] | False |
test_flow_fails_user_credentials_faulty | (hass, aioclient_mock) | Test config flow. | Test config flow. | async def test_flow_fails_user_credentials_faulty(hass, aioclient_mock):
"""Test config flow."""
result = await hass.config_entries.flow.async_init(
UNIFI_DOMAIN, context={"source": "user"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user"
a... | [
"async",
"def",
"test_flow_fails_user_credentials_faulty",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"UNIFI_DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"u... | [
235,
0
] | [
259,
61
] | python | da | ['de', 'da', 'en'] | False |
test_flow_fails_controller_unavailable | (hass, aioclient_mock) | Test config flow. | Test config flow. | async def test_flow_fails_controller_unavailable(hass, aioclient_mock):
"""Test config flow."""
result = await hass.config_entries.flow.async_init(
UNIFI_DOMAIN, context={"source": "user"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user"
ai... | [
"async",
"def",
"test_flow_fails_controller_unavailable",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"UNIFI_DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"us... | [
262,
0
] | [
286,
62
] | python | da | ['de', 'da', 'en'] | False |
test_flow_fails_unknown_problem | (hass, aioclient_mock) | Test config flow. | Test config flow. | async def test_flow_fails_unknown_problem(hass, aioclient_mock):
"""Test config flow."""
result = await hass.config_entries.flow.async_init(
UNIFI_DOMAIN, context={"source": "user"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user"
aioclient... | [
"async",
"def",
"test_flow_fails_unknown_problem",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"UNIFI_DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\"",
... | [
289,
0
] | [
312,
62
] | python | da | ['de', 'da', 'en'] | False |
test_advanced_option_flow | (hass) | Test advanced config flow options. | Test advanced config flow options. | async def test_advanced_option_flow(hass):
"""Test advanced config flow options."""
controller = await setup_unifi_integration(
hass,
clients_response=CLIENTS,
devices_response=DEVICES,
wlans_response=WLANS,
dpigroup_response=DPI_GROUPS,
dpiapp_response=[],
)
... | [
"async",
"def",
"test_advanced_option_flow",
"(",
"hass",
")",
":",
"controller",
"=",
"await",
"setup_unifi_integration",
"(",
"hass",
",",
"clients_response",
"=",
"CLIENTS",
",",
"devices_response",
"=",
"DEVICES",
",",
"wlans_response",
"=",
"WLANS",
",",
"dpi... | [
315,
0
] | [
383,
5
] | python | en | ['en', 'fr', 'en'] | True |
test_simple_option_flow | (hass) | Test simple config flow options. | Test simple config flow options. | async def test_simple_option_flow(hass):
"""Test simple config flow options."""
controller = await setup_unifi_integration(
hass,
clients_response=CLIENTS,
wlans_response=WLANS,
dpigroup_response=DPI_GROUPS,
dpiapp_response=[],
)
result = await hass.config_entrie... | [
"async",
"def",
"test_simple_option_flow",
"(",
"hass",
")",
":",
"controller",
"=",
"await",
"setup_unifi_integration",
"(",
"hass",
",",
"clients_response",
"=",
"CLIENTS",
",",
"wlans_response",
"=",
"WLANS",
",",
"dpigroup_response",
"=",
"DPI_GROUPS",
",",
"d... | [
386,
0
] | [
417,
5
] | python | en | ['en', 'en', 'en'] | True |
async_get_registry | (hass: HomeAssistantType) | Create entity registry. | Create entity registry. | async def async_get_registry(hass: HomeAssistantType) -> EntityRegistry:
"""Create entity registry."""
reg = EntityRegistry(hass)
await reg.async_load()
return reg | [
"async",
"def",
"async_get_registry",
"(",
"hass",
":",
"HomeAssistantType",
")",
"->",
"EntityRegistry",
":",
"reg",
"=",
"EntityRegistry",
"(",
"hass",
")",
"await",
"reg",
".",
"async_load",
"(",
")",
"return",
"reg"
] | [
523,
0
] | [
527,
14
] | python | en | ['en', 'cy', 'en'] | True |
async_entries_for_device | (
registry: EntityRegistry, device_id: str
) | Return entries that match a device. | Return entries that match a device. | def async_entries_for_device(
registry: EntityRegistry, device_id: str
) -> List[RegistryEntry]:
"""Return entries that match a device."""
return [
entry for entry in registry.entities.values() if entry.device_id == device_id
] | [
"def",
"async_entries_for_device",
"(",
"registry",
":",
"EntityRegistry",
",",
"device_id",
":",
"str",
")",
"->",
"List",
"[",
"RegistryEntry",
"]",
":",
"return",
"[",
"entry",
"for",
"entry",
"in",
"registry",
".",
"entities",
".",
"values",
"(",
")",
... | [
531,
0
] | [
537,
5
] | python | en | ['en', 'en', 'en'] | True |
async_entries_for_area | (
registry: EntityRegistry, area_id: str
) | Return entries that match an area. | Return entries that match an area. | def async_entries_for_area(
registry: EntityRegistry, area_id: str
) -> List[RegistryEntry]:
"""Return entries that match an area."""
return [entry for entry in registry.entities.values() if entry.area_id == area_id] | [
"def",
"async_entries_for_area",
"(",
"registry",
":",
"EntityRegistry",
",",
"area_id",
":",
"str",
")",
"->",
"List",
"[",
"RegistryEntry",
"]",
":",
"return",
"[",
"entry",
"for",
"entry",
"in",
"registry",
".",
"entities",
".",
"values",
"(",
")",
"if"... | [
541,
0
] | [
545,
86
] | python | en | ['en', 'en', 'en'] | True |
async_entries_for_config_entry | (
registry: EntityRegistry, config_entry_id: str
) | Return entries that match a config entry. | Return entries that match a config entry. | def async_entries_for_config_entry(
registry: EntityRegistry, config_entry_id: str
) -> List[RegistryEntry]:
"""Return entries that match a config entry."""
return [
entry
for entry in registry.entities.values()
if entry.config_entry_id == config_entry_id
] | [
"def",
"async_entries_for_config_entry",
"(",
"registry",
":",
"EntityRegistry",
",",
"config_entry_id",
":",
"str",
")",
"->",
"List",
"[",
"RegistryEntry",
"]",
":",
"return",
"[",
"entry",
"for",
"entry",
"in",
"registry",
".",
"entities",
".",
"values",
"(... | [
549,
0
] | [
557,
5
] | python | en | ['en', 'en', 'en'] | True |
_async_migrate | (entities: Dict[str, Any]) | Migrate the YAML config file to storage helper format. | Migrate the YAML config file to storage helper format. | async def _async_migrate(entities: Dict[str, Any]) -> Dict[str, List[Dict[str, Any]]]:
"""Migrate the YAML config file to storage helper format."""
return {
"entities": [
{"entity_id": entity_id, **info} for entity_id, info in entities.items()
]
} | [
"async",
"def",
"_async_migrate",
"(",
"entities",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
"]",
":",
"return",
"{",
"\"entities\"",
":",
"[",
"{",
"\"ent... | [
560,
0
] | [
566,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entity_restore | (
hass: HomeAssistantType, registry: EntityRegistry
) | Set up the entity restore mechanism. | Set up the entity restore mechanism. | def async_setup_entity_restore(
hass: HomeAssistantType, registry: EntityRegistry
) -> None:
"""Set up the entity restore mechanism."""
@callback
def cleanup_restored_states(event: Event) -> None:
"""Clean up restored states."""
if event.data["action"] != "remove":
return
... | [
"def",
"async_setup_entity_restore",
"(",
"hass",
":",
"HomeAssistantType",
",",
"registry",
":",
"EntityRegistry",
")",
"->",
"None",
":",
"@",
"callback",
"def",
"cleanup_restored_states",
"(",
"event",
":",
"Event",
")",
"->",
"None",
":",
"\"\"\"Clean up resto... | [
570,
0
] | [
627,
79
] | python | en | ['en', 'fr', 'en'] | True |
async_migrate_entries | (
hass: HomeAssistantType,
config_entry_id: str,
entry_callback: Callable[[RegistryEntry], Optional[dict]],
) | Migrator of unique IDs. | Migrator of unique IDs. | async def async_migrate_entries(
hass: HomeAssistantType,
config_entry_id: str,
entry_callback: Callable[[RegistryEntry], Optional[dict]],
) -> None:
"""Migrator of unique IDs."""
ent_reg = await async_get_registry(hass)
for entry in ent_reg.entities.values():
if entry.config_entry_id !... | [
"async",
"def",
"async_migrate_entries",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config_entry_id",
":",
"str",
",",
"entry_callback",
":",
"Callable",
"[",
"[",
"RegistryEntry",
"]",
",",
"Optional",
"[",
"dict",
"]",
"]",
",",
")",
"->",
"None",
":",
... | [
630,
0
] | [
645,
67
] | python | en | ['en', 'la', 'en'] | True |
EntityRegistry.__init__ | (self, hass: HomeAssistantType) | Initialize the registry. | Initialize the registry. | def __init__(self, hass: HomeAssistantType):
"""Initialize the registry."""
self.hass = hass
self.entities: Dict[str, RegistryEntry]
self._index: Dict[Tuple[str, str, str], str] = {}
self._store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
self.hass.bus.asyn... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"entities",
":",
"Dict",
"[",
"str",
",",
"RegistryEntry",
"]",
"self",
".",
"_index",
":",
"Dict",
"[",
"Tuple",
"[",
"st... | [
122,
4
] | [
130,
9
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_get_device_class_lookup | (self, domain_device_classes: set) | Return a lookup for the device class by domain. | Return a lookup for the device class by domain. | def async_get_device_class_lookup(self, domain_device_classes: set) -> dict:
"""Return a lookup for the device class by domain."""
lookup: Dict[str, Dict[Tuple[Any, Any], str]] = {}
for entity in self.entities.values():
if not entity.device_id:
continue
do... | [
"def",
"async_get_device_class_lookup",
"(",
"self",
",",
"domain_device_classes",
":",
"set",
")",
"->",
"dict",
":",
"lookup",
":",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"Tuple",
"[",
"Any",
",",
"Any",
"]",
",",
"str",
"]",
"]",
"=",
"{",
"}",
"fo... | [
133,
4
] | [
146,
21
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_is_registered | (self, entity_id: str) | Check if an entity_id is currently registered. | Check if an entity_id is currently registered. | def async_is_registered(self, entity_id: str) -> bool:
"""Check if an entity_id is currently registered."""
return entity_id in self.entities | [
"def",
"async_is_registered",
"(",
"self",
",",
"entity_id",
":",
"str",
")",
"->",
"bool",
":",
"return",
"entity_id",
"in",
"self",
".",
"entities"
] | [
149,
4
] | [
151,
41
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_get | (self, entity_id: str) | Get EntityEntry for an entity_id. | Get EntityEntry for an entity_id. | def async_get(self, entity_id: str) -> Optional[RegistryEntry]:
"""Get EntityEntry for an entity_id."""
return self.entities.get(entity_id) | [
"def",
"async_get",
"(",
"self",
",",
"entity_id",
":",
"str",
")",
"->",
"Optional",
"[",
"RegistryEntry",
"]",
":",
"return",
"self",
".",
"entities",
".",
"get",
"(",
"entity_id",
")"
] | [
154,
4
] | [
156,
43
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_get_entity_id | (
self, domain: str, platform: str, unique_id: str
) | Check if an entity_id is currently registered. | Check if an entity_id is currently registered. | def async_get_entity_id(
self, domain: str, platform: str, unique_id: str
) -> Optional[str]:
"""Check if an entity_id is currently registered."""
return self._index.get((domain, platform, unique_id)) | [
"def",
"async_get_entity_id",
"(",
"self",
",",
"domain",
":",
"str",
",",
"platform",
":",
"str",
",",
"unique_id",
":",
"str",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_index",
".",
"get",
"(",
"(",
"domain",
",",
"platf... | [
159,
4
] | [
163,
61
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_generate_entity_id | (
self,
domain: str,
suggested_object_id: str,
known_object_ids: Optional[Iterable[str]] = None,
) | Generate an entity ID that does not conflict.
Conflicts checked against registered and currently existing entities.
| Generate an entity ID that does not conflict. | def async_generate_entity_id(
self,
domain: str,
suggested_object_id: str,
known_object_ids: Optional[Iterable[str]] = None,
) -> str:
"""Generate an entity ID that does not conflict.
Conflicts checked against registered and currently existing entities.
"""
... | [
"def",
"async_generate_entity_id",
"(",
"self",
",",
"domain",
":",
"str",
",",
"suggested_object_id",
":",
"str",
",",
"known_object_ids",
":",
"Optional",
"[",
"Iterable",
"[",
"str",
"]",
"]",
"=",
"None",
",",
")",
"->",
"str",
":",
"preferred_string",
... | [
166,
4
] | [
190,
26
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_get_or_create | (
self,
domain: str,
platform: str,
unique_id: str,
*,
# To influence entity ID generation
suggested_object_id: Optional[str] = None,
known_object_ids: Optional[Iterable[str]] = None,
# To disable an entity if it gets created
disabled_by: O... | Get entity. Create if it doesn't exist. | Get entity. Create if it doesn't exist. | def async_get_or_create(
self,
domain: str,
platform: str,
unique_id: str,
*,
# To influence entity ID generation
suggested_object_id: Optional[str] = None,
known_object_ids: Optional[Iterable[str]] = None,
# To disable an entity if it gets created... | [
"def",
"async_get_or_create",
"(",
"self",
",",
"domain",
":",
"str",
",",
"platform",
":",
"str",
",",
"unique_id",
":",
"str",
",",
"*",
",",
"# To influence entity ID generation",
"suggested_object_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
... | [
193,
4
] | [
277,
21
] | python | en | ['br', 'en', 'en'] | True |
EntityRegistry.async_remove | (self, entity_id: str) | Remove an entity from registry. | Remove an entity from registry. | def async_remove(self, entity_id: str) -> None:
"""Remove an entity from registry."""
self._unregister_entry(self.entities[entity_id])
self.hass.bus.async_fire(
EVENT_ENTITY_REGISTRY_UPDATED, {"action": "remove", "entity_id": entity_id}
)
self.async_schedule_save() | [
"def",
"async_remove",
"(",
"self",
",",
"entity_id",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"_unregister_entry",
"(",
"self",
".",
"entities",
"[",
"entity_id",
"]",
")",
"self",
".",
"hass",
".",
"bus",
".",
"async_fire",
"(",
"EVENT_ENTITY_R... | [
280,
4
] | [
286,
34
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_device_removed | (self, event: Event) | Handle the removal of a device.
Remove entities from the registry that are associated to a device when
the device is removed.
| Handle the removal of a device. | def async_device_removed(self, event: Event) -> None:
"""Handle the removal of a device.
Remove entities from the registry that are associated to a device when
the device is removed.
"""
if event.data["action"] != "remove":
return
entities = async_entries_for... | [
"def",
"async_device_removed",
"(",
"self",
",",
"event",
":",
"Event",
")",
"->",
"None",
":",
"if",
"event",
".",
"data",
"[",
"\"action\"",
"]",
"!=",
"\"remove\"",
":",
"return",
"entities",
"=",
"async_entries_for_device",
"(",
"self",
",",
"event",
"... | [
289,
4
] | [
299,
47
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_update_entity | (
self,
entity_id,
*,
name=_UNDEF,
icon=_UNDEF,
area_id=_UNDEF,
new_entity_id=_UNDEF,
new_unique_id=_UNDEF,
disabled_by=_UNDEF,
) | Update properties of an entity. | Update properties of an entity. | def async_update_entity(
self,
entity_id,
*,
name=_UNDEF,
icon=_UNDEF,
area_id=_UNDEF,
new_entity_id=_UNDEF,
new_unique_id=_UNDEF,
disabled_by=_UNDEF,
):
"""Update properties of an entity."""
return cast( # cast until we have _... | [
"def",
"async_update_entity",
"(",
"self",
",",
"entity_id",
",",
"*",
",",
"name",
"=",
"_UNDEF",
",",
"icon",
"=",
"_UNDEF",
",",
"area_id",
"=",
"_UNDEF",
",",
"new_entity_id",
"=",
"_UNDEF",
",",
"new_unique_id",
"=",
"_UNDEF",
",",
"disabled_by",
"=",... | [
302,
4
] | [
325,
9
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry._async_update_entity | (
self,
entity_id,
*,
name=_UNDEF,
icon=_UNDEF,
config_entry_id=_UNDEF,
new_entity_id=_UNDEF,
device_id=_UNDEF,
area_id=_UNDEF,
new_unique_id=_UNDEF,
disabled_by=_UNDEF,
capabilities=_UNDEF,
supported_features=_UNDEF... | Private facing update properties method. | Private facing update properties method. | def _async_update_entity(
self,
entity_id,
*,
name=_UNDEF,
icon=_UNDEF,
config_entry_id=_UNDEF,
new_entity_id=_UNDEF,
device_id=_UNDEF,
area_id=_UNDEF,
new_unique_id=_UNDEF,
disabled_by=_UNDEF,
capabilities=_UNDEF,
s... | [
"def",
"_async_update_entity",
"(",
"self",
",",
"entity_id",
",",
"*",
",",
"name",
"=",
"_UNDEF",
",",
"icon",
"=",
"_UNDEF",
",",
"config_entry_id",
"=",
"_UNDEF",
",",
"new_entity_id",
"=",
"_UNDEF",
",",
"device_id",
"=",
"_UNDEF",
",",
"area_id",
"="... | [
328,
4
] | [
409,
18
] | python | en | ['en', 'af', 'en'] | True |
EntityRegistry.async_load | (self) | Load the entity registry. | Load the entity registry. | async def async_load(self) -> None:
"""Load the entity registry."""
async_setup_entity_restore(self.hass, self)
data = await self.hass.helpers.storage.async_migrator(
self.hass.config.path(PATH_REGISTRY),
self._store,
old_conf_load_func=load_yaml,
... | [
"async",
"def",
"async_load",
"(",
"self",
")",
"->",
"None",
":",
"async_setup_entity_restore",
"(",
"self",
".",
"hass",
",",
"self",
")",
"data",
"=",
"await",
"self",
".",
"hass",
".",
"helpers",
".",
"storage",
".",
"async_migrator",
"(",
"self",
".... | [
411,
4
] | [
450,
29
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_schedule_save | (self) | Schedule saving the entity registry. | Schedule saving the entity registry. | def async_schedule_save(self) -> None:
"""Schedule saving the entity registry."""
self._store.async_delay_save(self._data_to_save, SAVE_DELAY) | [
"def",
"async_schedule_save",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_store",
".",
"async_delay_save",
"(",
"self",
".",
"_data_to_save",
",",
"SAVE_DELAY",
")"
] | [
453,
4
] | [
455,
68
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry._data_to_save | (self) | Return data of entity registry to store in a file. | Return data of entity registry to store in a file. | def _data_to_save(self) -> Dict[str, Any]:
"""Return data of entity registry to store in a file."""
data = {}
data["entities"] = [
{
"entity_id": entry.entity_id,
"config_entry_id": entry.config_entry_id,
"device_id": entry.device_id,
... | [
"def",
"_data_to_save",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"data",
"=",
"{",
"}",
"data",
"[",
"\"entities\"",
"]",
"=",
"[",
"{",
"\"entity_id\"",
":",
"entry",
".",
"entity_id",
",",
"\"config_entry_id\"",
":",
"entry",... | [
458,
4
] | [
483,
19
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_clear_config_entry | (self, config_entry: str) | Clear config entry from registry entries. | Clear config entry from registry entries. | def async_clear_config_entry(self, config_entry: str) -> None:
"""Clear config entry from registry entries."""
for entity_id in [
entity_id
for entity_id, entry in self.entities.items()
if config_entry == entry.config_entry_id
]:
self.async_remove(... | [
"def",
"async_clear_config_entry",
"(",
"self",
",",
"config_entry",
":",
"str",
")",
"->",
"None",
":",
"for",
"entity_id",
"in",
"[",
"entity_id",
"for",
"entity_id",
",",
"entry",
"in",
"self",
".",
"entities",
".",
"items",
"(",
")",
"if",
"config_entr... | [
486,
4
] | [
493,
40
] | python | en | ['en', 'en', 'en'] | True |
EntityRegistry.async_clear_area_id | (self, area_id: str) | Clear area id from registry entries. | Clear area id from registry entries. | def async_clear_area_id(self, area_id: str) -> None:
"""Clear area id from registry entries."""
for entity_id, entry in self.entities.items():
if area_id == entry.area_id:
self._async_update_entity(entity_id, area_id=None) | [
"def",
"async_clear_area_id",
"(",
"self",
",",
"area_id",
":",
"str",
")",
"->",
"None",
":",
"for",
"entity_id",
",",
"entry",
"in",
"self",
".",
"entities",
".",
"items",
"(",
")",
":",
"if",
"area_id",
"==",
"entry",
".",
"area_id",
":",
"self",
... | [
496,
4
] | [
500,
66
] | python | en | ['en', 'en', 'en'] | True |
test_form | (hass) | Test config entry configured successfully. | Test config entry configured successfully. | async def test_form(hass):
"""Test config entry configured successfully."""
result = await hass.config_entries.flow.async_init(
glances.DOMAIN, context={"source": "user"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user"
with patch("glances_... | [
"async",
"def",
"test_form",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"glances",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\"",
"}",
")",
"assert",
"result... | [
31,
0
] | [
50,
44
] | python | en | ['en', 'en', 'en'] | True |
test_form_cannot_connect | (hass) | Test to return error if we cannot connect. | Test to return error if we cannot connect. | async def test_form_cannot_connect(hass):
"""Test to return error if we cannot connect."""
with patch("glances_api.Glances"):
result = await hass.config_entries.flow.async_init(
glances.DOMAIN, context={"source": "user"}
)
result = await hass.config_entries.flow.async_config... | [
"async",
"def",
"test_form_cannot_connect",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"glances_api.Glances\"",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"glances",
".",
"DOMAIN",
",",
"context",
... | [
53,
0
] | [
65,
57
] | python | en | ['en', 'en', 'en'] | True |
test_form_wrong_version | (hass) | Test to check if wrong version is entered. | Test to check if wrong version is entered. | async def test_form_wrong_version(hass):
"""Test to check if wrong version is entered."""
user_input = DEMO_USER_INPUT.copy()
user_input.update(version=1)
result = await hass.config_entries.flow.async_init(
glances.DOMAIN, context={"source": "user"}
)
result = await hass.config_entries.... | [
"async",
"def",
"test_form_wrong_version",
"(",
"hass",
")",
":",
"user_input",
"=",
"DEMO_USER_INPUT",
".",
"copy",
"(",
")",
"user_input",
".",
"update",
"(",
"version",
"=",
"1",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
"... | [
68,
0
] | [
81,
59
] | python | en | ['en', 'en', 'en'] | True |
test_form_already_configured | (hass) | Test host is already configured. | Test host is already configured. | async def test_form_already_configured(hass):
"""Test host is already configured."""
entry = MockConfigEntry(
domain=glances.DOMAIN, data=DEMO_USER_INPUT, options={CONF_SCAN_INTERVAL: 60}
)
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
glances.DOMAIN, c... | [
"async",
"def",
"test_form_already_configured",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"glances",
".",
"DOMAIN",
",",
"data",
"=",
"DEMO_USER_INPUT",
",",
"options",
"=",
"{",
"CONF_SCAN_INTERVAL",
":",
"60",
"}",
")",
"e... | [
84,
0
] | [
98,
51
] | python | en | ['en', 'en', 'en'] | True |
test_options | (hass) | Test options for Glances. | Test options for Glances. | async def test_options(hass):
"""Test options for Glances."""
entry = MockConfigEntry(
domain=glances.DOMAIN, data=DEMO_USER_INPUT, options={CONF_SCAN_INTERVAL: 60}
)
entry.add_to_hass(hass)
result = await hass.config_entries.options.async_init(entry.entry_id)
assert result["type"] == ... | [
"async",
"def",
"test_options",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"glances",
".",
"DOMAIN",
",",
"data",
"=",
"DEMO_USER_INPUT",
",",
"options",
"=",
"{",
"CONF_SCAN_INTERVAL",
":",
"60",
"}",
")",
"entry",
".",
... | [
101,
0
] | [
120,
5
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Sense HAT sensor platform. | Set up the Sense HAT sensor platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Sense HAT sensor platform."""
try:
envirophat = importlib.import_module("envirophat")
except OSError:
_LOGGER.error("No Enviro pHAT was found")
return False
data = EnvirophatData(envirophat, confi... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"try",
":",
"envirophat",
"=",
"importlib",
".",
"import_module",
"(",
"\"envirophat\"",
")",
"except",
"OSError",
":",
"_LOGGER",
".",
"e... | [
56,
0
] | [
70,
27
] | python | en | ['en', 'da', 'en'] | True |
EnvirophatSensor.__init__ | (self, data, sensor_types) | Initialize the sensor. | Initialize the sensor. | def __init__(self, data, sensor_types):
"""Initialize the sensor."""
self.data = data
self._name = SENSOR_TYPES[sensor_types][0]
self._unit_of_measurement = SENSOR_TYPES[sensor_types][1]
self.type = sensor_types
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"sensor_types",
")",
":",
"self",
".",
"data",
"=",
"data",
"self",
".",
"_name",
"=",
"SENSOR_TYPES",
"[",
"sensor_types",
"]",
"[",
"0",
"]",
"self",
".",
"_unit_of_measurement",
"=",
"SENSOR_TYPES",
"[... | [
76,
4
] | [
82,
26
] | python | en | ['en', 'en', 'en'] | True |
EnvirophatSensor.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"
] | [
85,
4
] | [
87,
25
] | python | en | ['en', 'mi', 'en'] | True |
EnvirophatSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
90,
4
] | [
92,
26
] | python | en | ['en', 'en', 'en'] | True |
EnvirophatSensor.icon | (self) | Icon to use in the frontend, if any. | Icon to use in the frontend, if any. | def icon(self):
"""Icon to use in the frontend, if any."""
return SENSOR_TYPES[self.type][2] | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"type",
"]",
"[",
"2",
"]"
] | [
95,
4
] | [
97,
41
] | python | en | ['en', 'en', 'en'] | True |
EnvirophatSensor.unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def unit_of_measurement(self):
"""Return the unit the value is expressed in."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
100,
4
] | [
102,
40
] | python | en | ['en', 'en', 'en'] | True |
EnvirophatSensor.update | (self) | Get the latest data and updates the states. | Get the latest data and updates the states. | def update(self):
"""Get the latest data and updates the states."""
self.data.update()
if self.type == "light":
self._state = self.data.light
if self.type == "light_red":
self._state = self.data.light_red
if self.type == "light_green":
self._s... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"data",
".",
"update",
"(",
")",
"if",
"self",
".",
"type",
"==",
"\"light\"",
":",
"self",
".",
"_state",
"=",
"self",
".",
"data",
".",
"light",
"if",
"self",
".",
"type",
"==",
"\"light_red\""... | [
104,
4
] | [
139,
45
] | python | en | ['en', 'en', 'en'] | True |
EnvirophatData.__init__ | (self, envirophat, use_leds) | Initialize the data object. | Initialize the data object. | def __init__(self, envirophat, use_leds):
"""Initialize the data object."""
self.envirophat = envirophat
self.use_leds = use_leds
# sensors readings
self.light = None
self.light_red = None
self.light_green = None
self.light_blue = None
self.acceler... | [
"def",
"__init__",
"(",
"self",
",",
"envirophat",
",",
"use_leds",
")",
":",
"self",
".",
"envirophat",
"=",
"envirophat",
"self",
".",
"use_leds",
"=",
"use_leds",
"# sensors readings",
"self",
".",
"light",
"=",
"None",
"self",
".",
"light_red",
"=",
"N... | [
145,
4
] | [
165,
29
] | python | en | ['en', 'en', 'en'] | True |
EnvirophatData.update | (self) | Get the latest data from Enviro pHAT. | Get the latest data from Enviro pHAT. | def update(self):
"""Get the latest data from Enviro pHAT."""
# Light sensor reading: 16-bit integer
self.light = self.envirophat.light.light()
if self.use_leds:
self.envirophat.leds.on()
# the three color values scaled against the overall light, 0-255
self.li... | [
"def",
"update",
"(",
"self",
")",
":",
"# Light sensor reading: 16-bit integer",
"self",
".",
"light",
"=",
"self",
".",
"envirophat",
".",
"light",
".",
"light",
"(",
")",
"if",
"self",
".",
"use_leds",
":",
"self",
".",
"envirophat",
".",
"leds",
".",
... | [
168,
4
] | [
206,
45
] | python | en | ['en', 'en', 'en'] | True |
test_new | (hass, caplog) | Test new entry. | Test new entry. | async def test_new(hass, caplog):
"""Test new entry."""
await _async_setup_component(hass, False)
state = hass.states.get(ENTITY_ID)
assert state.state == STATE_OFF
assert not any(x.levelno == logging.WARNING for x in caplog.records) | [
"async",
"def",
"test_new",
"(",
"hass",
",",
"caplog",
")",
":",
"await",
"_async_setup_component",
"(",
"hass",
",",
"False",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"ENTITY_ID",
")",
"assert",
"state",
".",
"state",
"==",
"STATE_OFF... | [
32,
0
] | [
37,
72
] | python | en | ['en', 'en', 'en'] | True |
test_new_detected | (hass, caplog) | Test new entry with under voltage detected. | Test new entry with under voltage detected. | async def test_new_detected(hass, caplog):
"""Test new entry with under voltage detected."""
mocked_under_voltage = await _async_setup_component(hass, True)
state = hass.states.get(ENTITY_ID)
assert state.state == STATE_ON
assert (
len(
[
x
for x i... | [
"async",
"def",
"test_new_detected",
"(",
"hass",
",",
"caplog",
")",
":",
"mocked_under_voltage",
"=",
"await",
"_async_setup_component",
"(",
"hass",
",",
"True",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"ENTITY_ID",
")",
"assert",
"state... | [
40,
0
] | [
72,
5
] | python | en | ['en', 'en', 'en'] | True |
melissa_mock | () | Use this to mock the melissa api. | Use this to mock the melissa api. | def melissa_mock():
"""Use this to mock the melissa api."""
api = Mock()
api.async_fetch_devices = AsyncMock(
return_value=json.loads(load_fixture("melissa_fetch_devices.json"))
)
api.async_status = AsyncMock(
return_value=json.loads(load_fixture("melissa_status.json"))
)
api... | [
"def",
"melissa_mock",
"(",
")",
":",
"api",
"=",
"Mock",
"(",
")",
"api",
".",
"async_fetch_devices",
"=",
"AsyncMock",
"(",
"return_value",
"=",
"json",
".",
"loads",
"(",
"load_fixture",
"(",
"\"melissa_fetch_devices.json\"",
")",
")",
")",
"api",
".",
... | [
23,
0
] | [
57,
14
] | python | en | ['en', 'en', 'en'] | True |
test_setup_platform | (hass) | Test setup_platform. | Test setup_platform. | async def test_setup_platform(hass):
"""Test setup_platform."""
with patch(
"homeassistant.components.melissa.climate.MelissaClimate"
) as mocked_thermostat:
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = mocked_thermostat(api, device["s... | [
"async",
"def",
"test_setup_platform",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa.climate.MelissaClimate\"",
")",
"as",
"mocked_thermostat",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"... | [
60,
0
] | [
77,
57
] | python | en | ['en', 'da', 'en'] | False |
test_get_name | (hass) | Test name property. | Test name property. | async def test_get_name(hass):
"""Test name property."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
assert thermostat.name == "Melissa 12345678" | [
"async",
"def",
"test_get_name",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
"_SERIAL... | [
80,
0
] | [
86,
52
] | python | en | ['en', 'en', 'en'] | True |
test_current_fan_mode | (hass) | Test current_fan_mode property. | Test current_fan_mode property. | async def test_current_fan_mode(hass):
"""Test current_fan_mode property."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
await thermostat.async_update()
... | [
"async",
"def",
"test_current_fan_mode",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
... | [
89,
0
] | [
99,
42
] | python | en | ['en', 'en', 'en'] | True |
test_current_temperature | (hass) | Test current temperature. | Test current temperature. | async def test_current_temperature(hass):
"""Test current temperature."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
assert thermostat.current_temperatu... | [
"async",
"def",
"test_current_temperature",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",... | [
102,
0
] | [
108,
53
] | python | en | ['en', 'la', 'en'] | True |
test_current_temperature_no_data | (hass) | Test current temperature without data. | Test current temperature without data. | async def test_current_temperature_no_data(hass):
"""Test current temperature without data."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
thermostat._da... | [
"async",
"def",
"test_current_temperature_no_data",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")"... | [
111,
0
] | [
118,
53
] | python | en | ['en', 'en', 'en'] | True |
test_target_temperature_step | (hass) | Test current target_temperature_step. | Test current target_temperature_step. | async def test_target_temperature_step(hass):
"""Test current target_temperature_step."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
assert thermostat.t... | [
"async",
"def",
"test_target_temperature_step",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
... | [
121,
0
] | [
127,
54
] | python | en | ['en', 'la', 'en'] | True |
test_current_operation | (hass) | Test current operation. | Test current operation. | async def test_current_operation(hass):
"""Test current operation."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
await thermostat.async_update()
... | [
"async",
"def",
"test_current_operation",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
... | [
130,
0
] | [
140,
45
] | python | en | ['nl', 'en', 'en'] | True |
test_operation_list | (hass) | Test the operation list. | Test the operation list. | async def test_operation_list(hass):
"""Test the operation list."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
assert [
HVAC_MODE_HEAT,
... | [
"async",
"def",
"test_operation_list",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
"_... | [
143,
0
] | [
155,
34
] | python | en | ['en', 'en', 'en'] | True |
test_fan_modes | (hass) | Test the fan list. | Test the fan list. | async def test_fan_modes(hass):
"""Test the fan list."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
assert ["auto", SPEED_HIGH, SPEED_MEDIUM, SPEED_LOW]... | [
"async",
"def",
"test_fan_modes",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
"_SERIA... | [
158,
0
] | [
164,
84
] | python | en | ['en', 'fy', 'en'] | True |
test_target_temperature | (hass) | Test target temperature. | Test target temperature. | async def test_target_temperature(hass):
"""Test target temperature."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
await thermostat.async_update()
... | [
"async",
"def",
"test_target_temperature",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
... | [
167,
0
] | [
177,
52
] | python | en | ['en', 'la', 'en'] | True |
test_state | (hass) | Test state. | Test state. | async def test_state(hass):
"""Test state."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
await thermostat.async_update()
assert HVAC_MODE_HEAT =... | [
"async",
"def",
"test_state",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
"_SERIAL",
... | [
180,
0
] | [
190,
39
] | python | en | ['en', 'en', 'en'] | False |
test_temperature_unit | (hass) | Test temperature unit. | Test temperature unit. | async def test_temperature_unit(hass):
"""Test temperature unit."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
assert TEMP_CELSIUS == thermostat.tempera... | [
"async",
"def",
"test_temperature_unit",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
... | [
193,
0
] | [
199,
58
] | python | en | ['es', 'la', 'en'] | False |
test_min_temp | (hass) | Test min temp. | Test min temp. | async def test_min_temp(hass):
"""Test min temp."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
assert thermostat.min_temp == 16 | [
"async",
"def",
"test_min_temp",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
"_SERIAL... | [
202,
0
] | [
208,
40
] | python | en | ['en', 'mt', 'en'] | True |
test_max_temp | (hass) | Test max temp. | Test max temp. | async def test_max_temp(hass):
"""Test max temp."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
assert thermostat.max_temp == 30 | [
"async",
"def",
"test_max_temp",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
"_SERIAL... | [
211,
0
] | [
217,
40
] | python | en | ['en', 'mt', 'en'] | True |
test_supported_features | (hass) | Test supported_features property. | Test supported_features property. | async def test_supported_features(hass):
"""Test supported_features property."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
features = SUPPORT_TARGET_TE... | [
"async",
"def",
"test_supported_features",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
... | [
220,
0
] | [
227,
56
] | python | en | ['fr', 'en', 'en'] | True |
test_set_temperature | (hass) | Test set_temperature. | Test set_temperature. | async def test_set_temperature(hass):
"""Test set_temperature."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
await thermostat.async_update()
awa... | [
"async",
"def",
"test_set_temperature",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
"... | [
230,
0
] | [
238,
50
] | python | de | ['en', 'la', 'de'] | False |
test_fan_mode | (hass) | Test set_fan_mode. | Test set_fan_mode. | async def test_fan_mode(hass):
"""Test set_fan_mode."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
await thermostat.async_update()
await hass.as... | [
"async",
"def",
"test_fan_mode",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
"_SERIAL... | [
241,
0
] | [
251,
48
] | python | en | ['en', 'fy', 'en'] | False |
test_set_operation_mode | (hass) | Test set_operation_mode. | Test set_operation_mode. | async def test_set_operation_mode(hass):
"""Test set_operation_mode."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
device = (await api.async_fetch_devices())[_SERIAL]
thermostat = MelissaClimate(api, _SERIAL, device)
await thermostat.async_update()
... | [
"async",
"def",
"test_set_operation_mode",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melissa\"",
")",
":",
"api",
"=",
"melissa_mock",
"(",
")",
"device",
"=",
"(",
"await",
"api",
".",
"async_fetch_devices",
"(",
")",
")",
"[",
... | [
254,
0
] | [
264,
53
] | python | en | ['en', 'da', 'en'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.