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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
HeosMediaPlayer.is_volume_muted | (self) | Boolean if volume is currently muted. | Boolean if volume is currently muted. | def is_volume_muted(self) -> bool:
"""Boolean if volume is currently muted."""
return self._player.is_muted | [
"def",
"is_volume_muted",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_player",
".",
"is_muted"
] | [
275,
4
] | [
277,
36
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.media_album_name | (self) | Album name of current playing media, music track only. | Album name of current playing media, music track only. | def media_album_name(self) -> str:
"""Album name of current playing media, music track only."""
return self._player.now_playing_media.album | [
"def",
"media_album_name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_player",
".",
"now_playing_media",
".",
"album"
] | [
280,
4
] | [
282,
51
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.media_artist | (self) | Artist of current playing media, music track only. | Artist of current playing media, music track only. | def media_artist(self) -> str:
"""Artist of current playing media, music track only."""
return self._player.now_playing_media.artist | [
"def",
"media_artist",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_player",
".",
"now_playing_media",
".",
"artist"
] | [
285,
4
] | [
287,
52
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.media_content_id | (self) | Content ID of current playing media. | Content ID of current playing media. | def media_content_id(self) -> str:
"""Content ID of current playing media."""
return self._player.now_playing_media.media_id | [
"def",
"media_content_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_player",
".",
"now_playing_media",
".",
"media_id"
] | [
290,
4
] | [
292,
54
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.media_content_type | (self) | Content type of current playing media. | Content type of current playing media. | def media_content_type(self) -> str:
"""Content type of current playing media."""
return MEDIA_TYPE_MUSIC | [
"def",
"media_content_type",
"(",
"self",
")",
"->",
"str",
":",
"return",
"MEDIA_TYPE_MUSIC"
] | [
295,
4
] | [
297,
31
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.media_duration | (self) | Duration of current playing media in seconds. | Duration of current playing media in seconds. | def media_duration(self):
"""Duration of current playing media in seconds."""
duration = self._player.now_playing_media.duration
if isinstance(duration, int):
return duration / 1000
return None | [
"def",
"media_duration",
"(",
"self",
")",
":",
"duration",
"=",
"self",
".",
"_player",
".",
"now_playing_media",
".",
"duration",
"if",
"isinstance",
"(",
"duration",
",",
"int",
")",
":",
"return",
"duration",
"/",
"1000",
"return",
"None"
] | [
300,
4
] | [
305,
19
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.media_position | (self) | Position of current playing media in seconds. | Position of current playing media in seconds. | def media_position(self):
"""Position of current playing media in seconds."""
# Some media doesn't have duration but reports position, return None
if not self._player.now_playing_media.duration:
return None
return self._player.now_playing_media.current_position / 1000 | [
"def",
"media_position",
"(",
"self",
")",
":",
"# Some media doesn't have duration but reports position, return None",
"if",
"not",
"self",
".",
"_player",
".",
"now_playing_media",
".",
"duration",
":",
"return",
"None",
"return",
"self",
".",
"_player",
".",
"now_p... | [
308,
4
] | [
313,
69
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.media_position_updated_at | (self) | When was the position of the current playing media valid. | When was the position of the current playing media valid. | def media_position_updated_at(self):
"""When was the position of the current playing media valid."""
# Some media doesn't have duration but reports position, return None
if not self._player.now_playing_media.duration:
return None
return self._media_position_updated_at | [
"def",
"media_position_updated_at",
"(",
"self",
")",
":",
"# Some media doesn't have duration but reports position, return None",
"if",
"not",
"self",
".",
"_player",
".",
"now_playing_media",
".",
"duration",
":",
"return",
"None",
"return",
"self",
".",
"_media_positio... | [
316,
4
] | [
321,
46
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.media_image_remotely_accessible | (self) | If the image url is remotely accessible. | If the image url is remotely accessible. | def media_image_remotely_accessible(self) -> bool:
"""If the image url is remotely accessible."""
return True | [
"def",
"media_image_remotely_accessible",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
324,
4
] | [
326,
19
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.media_image_url | (self) | Image url of current playing media. | Image url of current playing media. | def media_image_url(self) -> str:
"""Image url of current playing media."""
# May be an empty string, if so, return None
image_url = self._player.now_playing_media.image_url
return image_url if image_url else None | [
"def",
"media_image_url",
"(",
"self",
")",
"->",
"str",
":",
"# May be an empty string, if so, return None",
"image_url",
"=",
"self",
".",
"_player",
".",
"now_playing_media",
".",
"image_url",
"return",
"image_url",
"if",
"image_url",
"else",
"None"
] | [
329,
4
] | [
333,
47
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.media_title | (self) | Title of current playing media. | Title of current playing media. | def media_title(self) -> str:
"""Title of current playing media."""
return self._player.now_playing_media.song | [
"def",
"media_title",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_player",
".",
"now_playing_media",
".",
"song"
] | [
336,
4
] | [
338,
50
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.name | (self) | Return the name of the device. | Return the name of the device. | def name(self) -> str:
"""Return the name of the device."""
return self._player.name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_player",
".",
"name"
] | [
341,
4
] | [
343,
32
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.should_poll | (self) | No polling needed for this device. | No polling needed for this device. | def should_poll(self) -> bool:
"""No polling needed for this device."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
346,
4
] | [
348,
20
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.shuffle | (self) | Boolean if shuffle is enabled. | Boolean if shuffle is enabled. | def shuffle(self) -> bool:
"""Boolean if shuffle is enabled."""
return self._player.shuffle | [
"def",
"shuffle",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_player",
".",
"shuffle"
] | [
351,
4
] | [
353,
35
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.source | (self) | Name of the current input source. | Name of the current input source. | def source(self) -> str:
"""Name of the current input source."""
return self._source_manager.get_current_source(self._player.now_playing_media) | [
"def",
"source",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_source_manager",
".",
"get_current_source",
"(",
"self",
".",
"_player",
".",
"now_playing_media",
")"
] | [
356,
4
] | [
358,
86
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.source_list | (self) | List of available input sources. | List of available input sources. | def source_list(self) -> Sequence[str]:
"""List of available input sources."""
return self._source_manager.source_list | [
"def",
"source_list",
"(",
"self",
")",
"->",
"Sequence",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_source_manager",
".",
"source_list"
] | [
361,
4
] | [
363,
47
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.state | (self) | State of the player. | State of the player. | def state(self) -> str:
"""State of the player."""
return PLAY_STATE_TO_STATE[self._player.state] | [
"def",
"state",
"(",
"self",
")",
"->",
"str",
":",
"return",
"PLAY_STATE_TO_STATE",
"[",
"self",
".",
"_player",
".",
"state",
"]"
] | [
366,
4
] | [
368,
54
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.supported_features | (self) | Flag media player features that are supported. | Flag media player features that are supported. | def supported_features(self) -> int:
"""Flag media player features that are supported."""
return self._supported_features | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_supported_features"
] | [
371,
4
] | [
373,
39
] | python | en | ['en', 'en', 'en'] | True |
HeosMediaPlayer.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self) -> str:
"""Return a unique ID."""
return str(self._player.player_id) | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"str",
"(",
"self",
".",
"_player",
".",
"player_id",
")"
] | [
376,
4
] | [
378,
42
] | python | ca | ['fr', 'ca', 'en'] | False |
HeosMediaPlayer.volume_level | (self) | Volume level of the media player (0..1). | Volume level of the media player (0..1). | def volume_level(self) -> float:
"""Volume level of the media player (0..1)."""
return self._player.volume / 100 | [
"def",
"volume_level",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_player",
".",
"volume",
"/",
"100"
] | [
381,
4
] | [
383,
40
] | python | en | ['en', 'en', 'en'] | True |
Subprocess.run | (command: str, timeout: int = None) | Run one-time command with subprocess.run().
Args:
command (str): command to be executed.
timeout (int): timeout in seconds.
Returns:
str: return stdout of the command.
| Run one-time command with subprocess.run(). | def run(command: str, timeout: int = None) -> str:
"""Run one-time command with subprocess.run().
Args:
command (str): command to be executed.
timeout (int): timeout in seconds.
Returns:
str: return stdout of the command.
"""
# TODO: Windows ... | [
"def",
"run",
"(",
"command",
":",
"str",
",",
"timeout",
":",
"int",
"=",
"None",
")",
"->",
"str",
":",
"# TODO: Windows master",
"completed_process",
"=",
"subprocess",
".",
"run",
"(",
"command",
",",
"executable",
"=",
"\"/bin/bash\"",
",",
"shell",
"... | [
13,
4
] | [
35,
51
] | python | en | ['en', 'en', 'en'] | True |
Subprocess.interactive_run | (command: str) | Run one-time command with subprocess.popen() and write stdout output interactively.
Args:
command (str): command to be executed.
Returns:
None.
| Run one-time command with subprocess.popen() and write stdout output interactively. | def interactive_run(command: str) -> None:
"""Run one-time command with subprocess.popen() and write stdout output interactively.
Args:
command (str): command to be executed.
Returns:
None.
"""
# TODO: Windows master
process = subprocess.Popen(
... | [
"def",
"interactive_run",
"(",
"command",
":",
"str",
")",
"->",
"None",
":",
"# TODO: Windows master",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
",",
"executable",
"=",
"\"/bin/bash\"",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"subpr... | [
38,
4
] | [
64,
36
] | python | en | ['en', 'en', 'en'] | True |
panasonic_viera_setup_fixture | () | Mock panasonic_viera setup. | Mock panasonic_viera setup. | def panasonic_viera_setup_fixture():
"""Mock panasonic_viera setup."""
with patch(
"homeassistant.components.panasonic_viera.async_setup", return_value=True
), patch(
"homeassistant.components.panasonic_viera.async_setup_entry",
return_value=True,
):
yield | [
"def",
"panasonic_viera_setup_fixture",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.panasonic_viera.async_setup\"",
",",
"return_value",
"=",
"True",
")",
",",
"patch",
"(",
"\"homeassistant.components.panasonic_viera.async_setup_entry\"",
",",
"return_valu... | [
28,
0
] | [
36,
13
] | python | lv | ['lv', 'ny', 'sw'] | False |
get_mock_remote | (
host="1.2.3.4",
request_error=None,
authorize_error=None,
encrypted=False,
app_id=None,
encryption_key=None,
name=DEFAULT_NAME,
manufacturer=DEFAULT_MANUFACTURER,
model_number=DEFAULT_MODEL_NUMBER,
unique_id="mock-unique-id",
) | Return a mock remote. | Return a mock remote. | def get_mock_remote(
host="1.2.3.4",
request_error=None,
authorize_error=None,
encrypted=False,
app_id=None,
encryption_key=None,
name=DEFAULT_NAME,
manufacturer=DEFAULT_MANUFACTURER,
model_number=DEFAULT_MODEL_NUMBER,
unique_id="mock-unique-id",
):
"""Return a mock remote.""... | [
"def",
"get_mock_remote",
"(",
"host",
"=",
"\"1.2.3.4\"",
",",
"request_error",
"=",
"None",
",",
"authorize_error",
"=",
"None",
",",
"encrypted",
"=",
"False",
",",
"app_id",
"=",
"None",
",",
"encryption_key",
"=",
"None",
",",
"name",
"=",
"DEFAULT_NAME... | [
39,
0
] | [
83,
22
] | python | en | ['en', 'co', 'en'] | True |
test_flow_non_encrypted | (hass) | Test flow without encryption. | Test flow without encryption. | async def test_flow_non_encrypted(hass):
"""Test flow without encryption."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["step_id"] == "user"
mock_remote = get_mock_remote(en... | [
"async",
"def",
"test_flow_non_encrypted",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")... | [
86,
0
] | [
120,
5
] | python | en | ['en', 'en', 'en'] | True |
test_flow_not_connected_error | (hass) | Test flow with connection error. | Test flow with connection error. | async def test_flow_not_connected_error(hass):
"""Test flow with connection error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["step_id"] == "user"
with patch(
"ho... | [
"async",
"def",
"test_flow_not_connected_error",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}"... | [
123,
0
] | [
144,
57
] | python | en | ['en', 'en', 'en'] | True |
test_flow_unknown_abort | (hass) | Test flow with unknown error abortion. | Test flow with unknown error abortion. | async def test_flow_unknown_abort(hass):
"""Test flow with unknown error abortion."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["step_id"] == "user"
with patch(
"ho... | [
"async",
"def",
"test_flow_unknown_abort",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")... | [
147,
0
] | [
167,
40
] | python | en | ['en', 'de', 'en'] | True |
test_flow_encrypted_not_connected_pin_code_request | (hass) | Test flow with encryption and PIN code request connection error abortion during pairing request step. | Test flow with encryption and PIN code request connection error abortion during pairing request step. | async def test_flow_encrypted_not_connected_pin_code_request(hass):
"""Test flow with encryption and PIN code request connection error abortion during pairing request step."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert re... | [
"async",
"def",
"test_flow_encrypted_not_connected_pin_code_request",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
... | [
170,
0
] | [
192,
47
] | python | en | ['en', 'en', 'en'] | True |
test_flow_encrypted_unknown_pin_code_request | (hass) | Test flow with encryption and PIN code request unknown error abortion during pairing request step. | Test flow with encryption and PIN code request unknown error abortion during pairing request step. | async def test_flow_encrypted_unknown_pin_code_request(hass):
"""Test flow with encryption and PIN code request unknown error abortion during pairing request step."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["typ... | [
"async",
"def",
"test_flow_encrypted_unknown_pin_code_request",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOUR... | [
195,
0
] | [
217,
40
] | python | en | ['en', 'en', 'en'] | True |
test_flow_encrypted_valid_pin_code | (hass) | Test flow with encryption and valid PIN code. | Test flow with encryption and valid PIN code. | async def test_flow_encrypted_valid_pin_code(hass):
"""Test flow with encryption and valid PIN code."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["step_id"] == "user"
mock_... | [
"async",
"def",
"test_flow_encrypted_valid_pin_code",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
... | [
220,
0
] | [
268,
5
] | python | en | ['en', 'en', 'en'] | True |
test_flow_encrypted_invalid_pin_code_error | (hass) | Test flow with encryption and invalid PIN code error during pairing step. | Test flow with encryption and invalid PIN code error during pairing step. | async def test_flow_encrypted_invalid_pin_code_error(hass):
"""Test flow with encryption and invalid PIN code error during pairing step."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert re... | [
"async",
"def",
"test_flow_encrypted_invalid_pin_code_error",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE... | [
271,
0
] | [
306,
63
] | python | en | ['en', 'en', 'en'] | True |
test_flow_encrypted_not_connected_abort | (hass) | Test flow with encryption and PIN code connection error abortion during pairing step. | Test flow with encryption and PIN code connection error abortion during pairing step. | async def test_flow_encrypted_not_connected_abort(hass):
"""Test flow with encryption and PIN code connection error abortion during pairing step."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
... | [
"async",
"def",
"test_flow_encrypted_not_connected_abort",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_US... | [
309,
0
] | [
339,
47
] | python | en | ['en', 'en', 'en'] | True |
test_flow_encrypted_unknown_abort | (hass) | Test flow with encryption and PIN code unknown error abortion during pairing step. | Test flow with encryption and PIN code unknown error abortion during pairing step. | async def test_flow_encrypted_unknown_abort(hass):
"""Test flow with encryption and PIN code unknown error abortion during pairing step."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert re... | [
"async",
"def",
"test_flow_encrypted_unknown_abort",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
... | [
342,
0
] | [
372,
40
] | python | en | ['en', 'en', 'en'] | True |
test_flow_non_encrypted_already_configured_abort | (hass) | Test flow without encryption and existing config entry abortion. | Test flow without encryption and existing config entry abortion. | async def test_flow_non_encrypted_already_configured_abort(hass):
"""Test flow without encryption and existing config entry abortion."""
MockConfigEntry(
domain=DOMAIN,
unique_id="1.2.3.4",
data={CONF_HOST: "1.2.3.4", CONF_NAME: DEFAULT_NAME, CONF_PORT: DEFAULT_PORT},
).add_to_hass(... | [
"async",
"def",
"test_flow_non_encrypted_already_configured_abort",
"(",
"hass",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"\"1.2.3.4\"",
",",
"data",
"=",
"{",
"CONF_HOST",
":",
"\"1.2.3.4\"",
",",
"CONF_NAME",
":",
"DEFAUL... | [
375,
0
] | [
391,
51
] | python | en | ['en', 'en', 'en'] | True |
test_flow_encrypted_already_configured_abort | (hass) | Test flow with encryption and existing config entry abortion. | Test flow with encryption and existing config entry abortion. | async def test_flow_encrypted_already_configured_abort(hass):
"""Test flow with encryption and existing config entry abortion."""
MockConfigEntry(
domain=DOMAIN,
unique_id="1.2.3.4",
data={
CONF_HOST: "1.2.3.4",
CONF_NAME: DEFAULT_NAME,
CONF_PORT: DEF... | [
"async",
"def",
"test_flow_encrypted_already_configured_abort",
"(",
"hass",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"\"1.2.3.4\"",
",",
"data",
"=",
"{",
"CONF_HOST",
":",
"\"1.2.3.4\"",
",",
"CONF_NAME",
":",
"DEFAULT_NA... | [
394,
0
] | [
416,
51
] | python | en | ['en', 'en', 'en'] | True |
test_imported_flow_non_encrypted | (hass) | Test imported flow without encryption. | Test imported flow without encryption. | async def test_imported_flow_non_encrypted(hass):
"""Test imported flow without encryption."""
mock_remote = get_mock_remote(encrypted=False)
with patch(
"homeassistant.components.panasonic_viera.config_flow.RemoteControl",
return_value=mock_remote,
):
result = await hass.confi... | [
"async",
"def",
"test_imported_flow_non_encrypted",
"(",
"hass",
")",
":",
"mock_remote",
"=",
"get_mock_remote",
"(",
"encrypted",
"=",
"False",
")",
"with",
"patch",
"(",
"\"homeassistant.components.panasonic_viera.config_flow.RemoteControl\"",
",",
"return_value",
"=",
... | [
419,
0
] | [
452,
5
] | python | en | ['en', 'en', 'en'] | True |
test_imported_flow_encrypted_valid_pin_code | (hass) | Test imported flow with encryption and valid PIN code. | Test imported flow with encryption and valid PIN code. | async def test_imported_flow_encrypted_valid_pin_code(hass):
"""Test imported flow with encryption and valid PIN code."""
mock_remote = get_mock_remote(
encrypted=True,
app_id="test-app-id",
encryption_key="test-encryption-key",
)
with patch(
"homeassistant.components.p... | [
"async",
"def",
"test_imported_flow_encrypted_valid_pin_code",
"(",
"hass",
")",
":",
"mock_remote",
"=",
"get_mock_remote",
"(",
"encrypted",
"=",
"True",
",",
"app_id",
"=",
"\"test-app-id\"",
",",
"encryption_key",
"=",
"\"test-encryption-key\"",
",",
")",
"with",
... | [
455,
0
] | [
502,
5
] | python | en | ['en', 'en', 'en'] | True |
test_imported_flow_encrypted_invalid_pin_code_error | (hass) | Test imported flow with encryption and invalid PIN code error during pairing step. | Test imported flow with encryption and invalid PIN code error during pairing step. | async def test_imported_flow_encrypted_invalid_pin_code_error(hass):
"""Test imported flow with encryption and invalid PIN code error during pairing step."""
mock_remote = get_mock_remote(encrypted=True, authorize_error=SOAPError)
with patch(
"homeassistant.components.panasonic_viera.config_flow.R... | [
"async",
"def",
"test_imported_flow_encrypted_invalid_pin_code_error",
"(",
"hass",
")",
":",
"mock_remote",
"=",
"get_mock_remote",
"(",
"encrypted",
"=",
"True",
",",
"authorize_error",
"=",
"SOAPError",
")",
"with",
"patch",
"(",
"\"homeassistant.components.panasonic_v... | [
505,
0
] | [
539,
63
] | python | en | ['en', 'en', 'en'] | True |
test_imported_flow_encrypted_not_connected_abort | (hass) | Test imported flow with encryption and PIN code connection error abortion during pairing step. | Test imported flow with encryption and PIN code connection error abortion during pairing step. | async def test_imported_flow_encrypted_not_connected_abort(hass):
"""Test imported flow with encryption and PIN code connection error abortion during pairing step."""
mock_remote = get_mock_remote(encrypted=True, authorize_error=TimeoutError)
with patch(
"homeassistant.components.panasonic_viera.c... | [
"async",
"def",
"test_imported_flow_encrypted_not_connected_abort",
"(",
"hass",
")",
":",
"mock_remote",
"=",
"get_mock_remote",
"(",
"encrypted",
"=",
"True",
",",
"authorize_error",
"=",
"TimeoutError",
")",
"with",
"patch",
"(",
"\"homeassistant.components.panasonic_v... | [
542,
0
] | [
571,
47
] | python | en | ['en', 'en', 'en'] | True |
test_imported_flow_encrypted_unknown_abort | (hass) | Test imported flow with encryption and PIN code unknown error abortion during pairing step. | Test imported flow with encryption and PIN code unknown error abortion during pairing step. | async def test_imported_flow_encrypted_unknown_abort(hass):
"""Test imported flow with encryption and PIN code unknown error abortion during pairing step."""
mock_remote = get_mock_remote(encrypted=True, authorize_error=Exception)
with patch(
"homeassistant.components.panasonic_viera.config_flow.R... | [
"async",
"def",
"test_imported_flow_encrypted_unknown_abort",
"(",
"hass",
")",
":",
"mock_remote",
"=",
"get_mock_remote",
"(",
"encrypted",
"=",
"True",
",",
"authorize_error",
"=",
"Exception",
")",
"with",
"patch",
"(",
"\"homeassistant.components.panasonic_viera.conf... | [
574,
0
] | [
603,
40
] | python | en | ['en', 'en', 'en'] | True |
test_imported_flow_not_connected_error | (hass) | Test imported flow with connection error abortion. | Test imported flow with connection error abortion. | async def test_imported_flow_not_connected_error(hass):
"""Test imported flow with connection error abortion."""
with patch(
"homeassistant.components.panasonic_viera.config_flow.RemoteControl",
side_effect=TimeoutError,
):
result = await hass.config_entries.flow.async_init(
... | [
"async",
"def",
"test_imported_flow_not_connected_error",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.panasonic_viera.config_flow.RemoteControl\"",
",",
"side_effect",
"=",
"TimeoutError",
",",
")",
":",
"result",
"=",
"await",
"hass",
".",
... | [
606,
0
] | [
626,
57
] | python | en | ['en', 'en', 'en'] | True |
test_imported_flow_unknown_abort | (hass) | Test imported flow with unknown error abortion. | Test imported flow with unknown error abortion. | async def test_imported_flow_unknown_abort(hass):
"""Test imported flow with unknown error abortion."""
with patch(
"homeassistant.components.panasonic_viera.config_flow.RemoteControl",
side_effect=Exception,
):
result = await hass.config_entries.flow.async_init(
DOMAIN,... | [
"async",
"def",
"test_imported_flow_unknown_abort",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.panasonic_viera.config_flow.RemoteControl\"",
",",
"side_effect",
"=",
"Exception",
",",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_e... | [
629,
0
] | [
648,
40
] | python | en | ['en', 'en', 'en'] | True |
test_imported_flow_non_encrypted_already_configured_abort | (hass) | Test imported flow without encryption and existing config entry abortion. | Test imported flow without encryption and existing config entry abortion. | async def test_imported_flow_non_encrypted_already_configured_abort(hass):
"""Test imported flow without encryption and existing config entry abortion."""
MockConfigEntry(
domain=DOMAIN,
unique_id="1.2.3.4",
data={
CONF_HOST: "1.2.3.4",
CONF_NAME: DEFAULT_NAME,
... | [
"async",
"def",
"test_imported_flow_non_encrypted_already_configured_abort",
"(",
"hass",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"\"1.2.3.4\"",
",",
"data",
"=",
"{",
"CONF_HOST",
":",
"\"1.2.3.4\"",
",",
"CONF_NAME",
":",
... | [
651,
0
] | [
672,
51
] | python | en | ['en', 'en', 'en'] | True |
test_imported_flow_encrypted_already_configured_abort | (hass) | Test imported flow with encryption and existing config entry abortion. | Test imported flow with encryption and existing config entry abortion. | async def test_imported_flow_encrypted_already_configured_abort(hass):
"""Test imported flow with encryption and existing config entry abortion."""
MockConfigEntry(
domain=DOMAIN,
unique_id="1.2.3.4",
data={
CONF_HOST: "1.2.3.4",
CONF_NAME: DEFAULT_NAME,
... | [
"async",
"def",
"test_imported_flow_encrypted_already_configured_abort",
"(",
"hass",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"\"1.2.3.4\"",
",",
"data",
"=",
"{",
"CONF_HOST",
":",
"\"1.2.3.4\"",
",",
"CONF_NAME",
":",
"D... | [
675,
0
] | [
698,
51
] | python | en | ['en', 'en', 'en'] | True |
test_generate_entity_id_requires_hass_or_ids | () | Ensure we require at least hass or current ids. | Ensure we require at least hass or current ids. | def test_generate_entity_id_requires_hass_or_ids():
"""Ensure we require at least hass or current ids."""
with pytest.raises(ValueError):
entity.generate_entity_id("test.{}", "hello world") | [
"def",
"test_generate_entity_id_requires_hass_or_ids",
"(",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"ValueError",
")",
":",
"entity",
".",
"generate_entity_id",
"(",
"\"test.{}\"",
",",
"\"hello world\"",
")"
] | [
22,
0
] | [
25,
59
] | python | en | ['en', 'en', 'en'] | True |
test_generate_entity_id_given_keys | () | Test generating an entity id given current ids. | Test generating an entity id given current ids. | def test_generate_entity_id_given_keys():
"""Test generating an entity id given current ids."""
assert (
entity.generate_entity_id(
"test.{}",
"overwrite hidden true",
current_ids=["test.overwrite_hidden_true"],
)
== "test.overwrite_hidden_true_2"
... | [
"def",
"test_generate_entity_id_given_keys",
"(",
")",
":",
"assert",
"(",
"entity",
".",
"generate_entity_id",
"(",
"\"test.{}\"",
",",
"\"overwrite hidden true\"",
",",
"current_ids",
"=",
"[",
"\"test.overwrite_hidden_true\"",
"]",
",",
")",
"==",
"\"test.overwrite_h... | [
28,
0
] | [
43,
5
] | python | en | ['en', 'en', 'en'] | True |
test_async_update_support | (hass) | Test async update getting called. | Test async update getting called. | async def test_async_update_support(hass):
"""Test async update getting called."""
sync_update = []
async_update = []
class AsyncEntity(entity.Entity):
"""A test entity."""
entity_id = "sensor.test"
def update(self):
"""Update entity."""
sync_update.app... | [
"async",
"def",
"test_async_update_support",
"(",
"hass",
")",
":",
"sync_update",
"=",
"[",
"]",
"async_update",
"=",
"[",
"]",
"class",
"AsyncEntity",
"(",
"entity",
".",
"Entity",
")",
":",
"\"\"\"A test entity.\"\"\"",
"entity_id",
"=",
"\"sensor.test\"",
"d... | [
46,
0
] | [
77,
33
] | python | en | ['nl', 'en', 'en'] | True |
test_warn_slow_update | (hass, caplog) | Warn we log when entity update takes a long time. | Warn we log when entity update takes a long time. | async def test_warn_slow_update(hass, caplog):
"""Warn we log when entity update takes a long time."""
update_call = False
async def async_update():
"""Mock async update."""
nonlocal update_call
await asyncio.sleep(0.00001)
update_call = True
mock_entity = entity.Entity... | [
"async",
"def",
"test_warn_slow_update",
"(",
"hass",
",",
"caplog",
")",
":",
"update_call",
"=",
"False",
"async",
"def",
"async_update",
"(",
")",
":",
"\"\"\"Mock async update.\"\"\"",
"nonlocal",
"update_call",
"await",
"asyncio",
".",
"sleep",
"(",
"0.00001"... | [
116,
0
] | [
137,
26
] | python | en | ['en', 'en', 'en'] | True |
test_warn_slow_update_with_exception | (hass, caplog) | Warn we log when entity update takes a long time and trow exception. | Warn we log when entity update takes a long time and trow exception. | async def test_warn_slow_update_with_exception(hass, caplog):
"""Warn we log when entity update takes a long time and trow exception."""
update_call = False
async def async_update():
"""Mock async update."""
nonlocal update_call
update_call = True
await asyncio.sleep(0.00001... | [
"async",
"def",
"test_warn_slow_update_with_exception",
"(",
"hass",
",",
"caplog",
")",
":",
"update_call",
"=",
"False",
"async",
"def",
"async_update",
"(",
")",
":",
"\"\"\"Mock async update.\"\"\"",
"nonlocal",
"update_call",
"update_call",
"=",
"True",
"await",
... | [
140,
0
] | [
162,
26
] | python | en | ['en', 'en', 'en'] | True |
test_warn_slow_device_update_disabled | (hass, caplog) | Disable slow update warning with async_device_update. | Disable slow update warning with async_device_update. | async def test_warn_slow_device_update_disabled(hass, caplog):
"""Disable slow update warning with async_device_update."""
update_call = False
async def async_update():
"""Mock async update."""
nonlocal update_call
await asyncio.sleep(0.00001)
update_call = True
mock_en... | [
"async",
"def",
"test_warn_slow_device_update_disabled",
"(",
"hass",
",",
"caplog",
")",
":",
"update_call",
"=",
"False",
"async",
"def",
"async_update",
"(",
")",
":",
"\"\"\"Mock async update.\"\"\"",
"nonlocal",
"update_call",
"await",
"asyncio",
".",
"sleep",
... | [
165,
0
] | [
186,
26
] | python | en | ['en', 'en', 'en'] | True |
test_async_schedule_update_ha_state | (hass) | Warn we log when entity update takes a long time and trow exception. | Warn we log when entity update takes a long time and trow exception. | async def test_async_schedule_update_ha_state(hass):
"""Warn we log when entity update takes a long time and trow exception."""
update_call = False
async def async_update():
"""Mock async update."""
nonlocal update_call
update_call = True
mock_entity = entity.Entity()
mock_... | [
"async",
"def",
"test_async_schedule_update_ha_state",
"(",
"hass",
")",
":",
"update_call",
"=",
"False",
"async",
"def",
"async_update",
"(",
")",
":",
"\"\"\"Mock async update.\"\"\"",
"nonlocal",
"update_call",
"update_call",
"=",
"True",
"mock_entity",
"=",
"enti... | [
189,
0
] | [
206,
30
] | python | en | ['en', 'en', 'en'] | True |
test_async_async_request_call_without_lock | (hass) | Test for async_requests_call works without a lock. | Test for async_requests_call works without a lock. | async def test_async_async_request_call_without_lock(hass):
"""Test for async_requests_call works without a lock."""
updates = []
class AsyncEntity(entity.Entity):
"""Test entity."""
def __init__(self, entity_id):
"""Initialize Async test entity."""
self.entity_id =... | [
"async",
"def",
"test_async_async_request_call_without_lock",
"(",
"hass",
")",
":",
"updates",
"=",
"[",
"]",
"class",
"AsyncEntity",
"(",
"entity",
".",
"Entity",
")",
":",
"\"\"\"Test entity.\"\"\"",
"def",
"__init__",
"(",
"self",
",",
"entity_id",
")",
":",... | [
209,
0
] | [
241,
28
] | python | en | ['en', 'en', 'en'] | True |
test_async_async_request_call_with_lock | (hass) | Test for async_requests_call works with a semaphore. | Test for async_requests_call works with a semaphore. | async def test_async_async_request_call_with_lock(hass):
"""Test for async_requests_call works with a semaphore."""
updates = []
test_semaphore = asyncio.Semaphore(1)
class AsyncEntity(entity.Entity):
"""Test entity."""
def __init__(self, entity_id, lock):
"""Initialize As... | [
"async",
"def",
"test_async_async_request_call_with_lock",
"(",
"hass",
")",
":",
"updates",
"=",
"[",
"]",
"test_semaphore",
"=",
"asyncio",
".",
"Semaphore",
"(",
"1",
")",
"class",
"AsyncEntity",
"(",
"entity",
".",
"Entity",
")",
":",
"\"\"\"Test entity.\"\"... | [
244,
0
] | [
292,
28
] | python | en | ['en', 'en', 'en'] | True |
test_async_parallel_updates_with_zero | (hass) | Test parallel updates with 0 (disabled). | Test parallel updates with 0 (disabled). | async def test_async_parallel_updates_with_zero(hass):
"""Test parallel updates with 0 (disabled)."""
updates = []
test_lock = asyncio.Event()
class AsyncEntity(entity.Entity):
"""Test entity."""
def __init__(self, entity_id, count):
"""Initialize Async test entity."""
... | [
"async",
"def",
"test_async_parallel_updates_with_zero",
"(",
"hass",
")",
":",
"updates",
"=",
"[",
"]",
"test_lock",
"=",
"asyncio",
".",
"Event",
"(",
")",
"class",
"AsyncEntity",
"(",
"entity",
".",
"Entity",
")",
":",
"\"\"\"Test entity.\"\"\"",
"def",
"_... | [
295,
0
] | [
329,
23
] | python | en | ['en', 'en', 'en'] | True |
test_async_parallel_updates_with_zero_on_sync_update | (hass) | Test parallel updates with 0 (disabled). | Test parallel updates with 0 (disabled). | async def test_async_parallel_updates_with_zero_on_sync_update(hass):
"""Test parallel updates with 0 (disabled)."""
updates = []
test_lock = threading.Event()
class AsyncEntity(entity.Entity):
"""Test entity."""
def __init__(self, entity_id, count):
"""Initialize Async tes... | [
"async",
"def",
"test_async_parallel_updates_with_zero_on_sync_update",
"(",
"hass",
")",
":",
"updates",
"=",
"[",
"]",
"test_lock",
"=",
"threading",
".",
"Event",
"(",
")",
"class",
"AsyncEntity",
"(",
"entity",
".",
"Entity",
")",
":",
"\"\"\"Test entity.\"\"\... | [
332,
0
] | [
369,
30
] | python | en | ['en', 'en', 'en'] | True |
test_async_parallel_updates_with_one | (hass) | Test parallel updates with 1 (sequential). | Test parallel updates with 1 (sequential). | async def test_async_parallel_updates_with_one(hass):
"""Test parallel updates with 1 (sequential)."""
updates = []
test_lock = asyncio.Lock()
test_semaphore = asyncio.Semaphore(1)
class AsyncEntity(entity.Entity):
"""Test entity."""
def __init__(self, entity_id, count):
... | [
"async",
"def",
"test_async_parallel_updates_with_one",
"(",
"hass",
")",
":",
"updates",
"=",
"[",
"]",
"test_lock",
"=",
"asyncio",
".",
"Lock",
"(",
")",
"test_semaphore",
"=",
"asyncio",
".",
"Semaphore",
"(",
"1",
")",
"class",
"AsyncEntity",
"(",
"enti... | [
372,
0
] | [
445,
27
] | python | en | ['en', 'en', 'en'] | True |
test_async_parallel_updates_with_two | (hass) | Test parallel updates with 2 (parallel). | Test parallel updates with 2 (parallel). | async def test_async_parallel_updates_with_two(hass):
"""Test parallel updates with 2 (parallel)."""
updates = []
test_lock = asyncio.Lock()
test_semaphore = asyncio.Semaphore(2)
class AsyncEntity(entity.Entity):
"""Test entity."""
def __init__(self, entity_id, count):
... | [
"async",
"def",
"test_async_parallel_updates_with_two",
"(",
"hass",
")",
":",
"updates",
"=",
"[",
"]",
"test_lock",
"=",
"asyncio",
".",
"Lock",
"(",
")",
"test_semaphore",
"=",
"asyncio",
".",
"Semaphore",
"(",
"2",
")",
"class",
"AsyncEntity",
"(",
"enti... | [
448,
0
] | [
515,
27
] | python | en | ['en', 'en', 'en'] | True |
test_async_remove_no_platform | (hass) | Test async_remove method when no platform set. | Test async_remove method when no platform set. | async def test_async_remove_no_platform(hass):
"""Test async_remove method when no platform set."""
ent = entity.Entity()
ent.hass = hass
ent.entity_id = "test.test"
await ent.async_update_ha_state()
assert len(hass.states.async_entity_ids()) == 1
await ent.async_remove()
assert len(hass... | [
"async",
"def",
"test_async_remove_no_platform",
"(",
"hass",
")",
":",
"ent",
"=",
"entity",
".",
"Entity",
"(",
")",
"ent",
".",
"hass",
"=",
"hass",
"ent",
".",
"entity_id",
"=",
"\"test.test\"",
"await",
"ent",
".",
"async_update_ha_state",
"(",
")",
"... | [
518,
0
] | [
526,
51
] | python | en | ['en', 'de', 'en'] | True |
test_async_remove_runs_callbacks | (hass) | Test async_remove method when no platform set. | Test async_remove method when no platform set. | async def test_async_remove_runs_callbacks(hass):
"""Test async_remove method when no platform set."""
result = []
ent = entity.Entity()
ent.hass = hass
ent.entity_id = "test.test"
ent.async_on_remove(lambda: result.append(1))
await ent.async_remove()
assert len(result) == 1 | [
"async",
"def",
"test_async_remove_runs_callbacks",
"(",
"hass",
")",
":",
"result",
"=",
"[",
"]",
"ent",
"=",
"entity",
".",
"Entity",
"(",
")",
"ent",
".",
"hass",
"=",
"hass",
"ent",
".",
"entity_id",
"=",
"\"test.test\"",
"ent",
".",
"async_on_remove"... | [
529,
0
] | [
538,
27
] | python | en | ['en', 'de', 'en'] | True |
test_set_context | (hass) | Test setting context. | Test setting context. | async def test_set_context(hass):
"""Test setting context."""
context = Context()
ent = entity.Entity()
ent.hass = hass
ent.entity_id = "hello.world"
ent.async_set_context(context)
await ent.async_update_ha_state()
assert hass.states.get("hello.world").context == context | [
"async",
"def",
"test_set_context",
"(",
"hass",
")",
":",
"context",
"=",
"Context",
"(",
")",
"ent",
"=",
"entity",
".",
"Entity",
"(",
")",
"ent",
".",
"hass",
"=",
"hass",
"ent",
".",
"entity_id",
"=",
"\"hello.world\"",
"ent",
".",
"async_set_contex... | [
541,
0
] | [
549,
60
] | python | en | ['en', 'en', 'en'] | True |
test_set_context_expired | (hass) | Test setting context. | Test setting context. | async def test_set_context_expired(hass):
"""Test setting context."""
context = Context()
with patch.object(
entity.Entity, "context_recent_time", new_callable=PropertyMock
) as recent:
recent.return_value = timedelta(seconds=-5)
ent = entity.Entity()
ent.hass = hass
... | [
"async",
"def",
"test_set_context_expired",
"(",
"hass",
")",
":",
"context",
"=",
"Context",
"(",
")",
"with",
"patch",
".",
"object",
"(",
"entity",
".",
"Entity",
",",
"\"context_recent_time\"",
",",
"new_callable",
"=",
"PropertyMock",
")",
"as",
"recent",... | [
552,
0
] | [
568,
35
] | python | en | ['en', 'en', 'en'] | True |
test_warn_disabled | (hass, caplog) | Test we warn once if we write to a disabled entity. | Test we warn once if we write to a disabled entity. | async def test_warn_disabled(hass, caplog):
"""Test we warn once if we write to a disabled entity."""
entry = entity_registry.RegistryEntry(
entity_id="hello.world",
unique_id="test-unique-id",
platform="test-platform",
disabled_by="user",
)
mock_registry(hass, {"hello.wo... | [
"async",
"def",
"test_warn_disabled",
"(",
"hass",
",",
"caplog",
")",
":",
"entry",
"=",
"entity_registry",
".",
"RegistryEntry",
"(",
"entity_id",
"=",
"\"hello.world\"",
",",
"unique_id",
"=",
"\"test-unique-id\"",
",",
"platform",
"=",
"\"test-platform\"",
","... | [
571,
0
] | [
595,
28
] | python | en | ['en', 'en', 'en'] | True |
test_disabled_in_entity_registry | (hass) | Test entity is removed if we disable entity registry entry. | Test entity is removed if we disable entity registry entry. | async def test_disabled_in_entity_registry(hass):
"""Test entity is removed if we disable entity registry entry."""
entry = entity_registry.RegistryEntry(
entity_id="hello.world",
unique_id="test-unique-id",
platform="test-platform",
disabled_by=None,
)
registry = mock_re... | [
"async",
"def",
"test_disabled_in_entity_registry",
"(",
"hass",
")",
":",
"entry",
"=",
"entity_registry",
".",
"RegistryEntry",
"(",
"entity_id",
"=",
"\"hello.world\"",
",",
"unique_id",
"=",
"\"test-unique-id\"",
",",
"platform",
"=",
"\"test-platform\"",
",",
"... | [
598,
0
] | [
629,
39
] | python | en | ['en', 'en', 'en'] | True |
test_capability_attrs | (hass) | Test we still include capabilities even when unavailable. | Test we still include capabilities even when unavailable. | async def test_capability_attrs(hass):
"""Test we still include capabilities even when unavailable."""
with patch.object(
entity.Entity, "available", PropertyMock(return_value=False)
), patch.object(
entity.Entity,
"capability_attributes",
PropertyMock(return_value={"always":... | [
"async",
"def",
"test_capability_attrs",
"(",
"hass",
")",
":",
"with",
"patch",
".",
"object",
"(",
"entity",
".",
"Entity",
",",
"\"available\"",
",",
"PropertyMock",
"(",
"return_value",
"=",
"False",
")",
")",
",",
"patch",
".",
"object",
"(",
"entity"... | [
632,
0
] | [
649,
48
] | python | en | ['en', 'en', 'en'] | True |
test_warn_slow_write_state | (hass, caplog) | Check that we log a warning if reading properties takes too long. | Check that we log a warning if reading properties takes too long. | async def test_warn_slow_write_state(hass, caplog):
"""Check that we log a warning if reading properties takes too long."""
mock_entity = entity.Entity()
mock_entity.hass = hass
mock_entity.entity_id = "comp_test.test_entity"
mock_entity.platform = MagicMock(platform_name="hue")
with patch("hom... | [
"async",
"def",
"test_warn_slow_write_state",
"(",
"hass",
",",
"caplog",
")",
":",
"mock_entity",
"=",
"entity",
".",
"Entity",
"(",
")",
"mock_entity",
".",
"hass",
"=",
"hass",
"mock_entity",
".",
"entity_id",
"=",
"\"comp_test.test_entity\"",
"mock_entity",
... | [
652,
0
] | [
668,
20
] | python | en | ['en', 'en', 'en'] | True |
test_warn_slow_write_state_custom_component | (hass, caplog) | Check that we log a warning if reading properties takes too long. | Check that we log a warning if reading properties takes too long. | async def test_warn_slow_write_state_custom_component(hass, caplog):
"""Check that we log a warning if reading properties takes too long."""
class CustomComponentEntity(entity.Entity):
"""Custom component entity."""
__module__ = "custom_components.bla.sensor"
mock_entity = CustomComponent... | [
"async",
"def",
"test_warn_slow_write_state_custom_component",
"(",
"hass",
",",
"caplog",
")",
":",
"class",
"CustomComponentEntity",
"(",
"entity",
".",
"Entity",
")",
":",
"\"\"\"Custom component entity.\"\"\"",
"__module__",
"=",
"\"custom_components.bla.sensor\"",
"moc... | [
671,
0
] | [
691,
20
] | python | en | ['en', 'en', 'en'] | True |
test_setup_source | (hass) | Check that we register sources correctly. | Check that we register sources correctly. | async def test_setup_source(hass):
"""Check that we register sources correctly."""
platform = MockEntityPlatform(hass)
entity_platform = MockEntity(name="Platform Config Source")
await platform.async_add_entities([entity_platform])
platform.config_entry = MockConfigEntry()
entity_entry = MockE... | [
"async",
"def",
"test_setup_source",
"(",
"hass",
")",
":",
"platform",
"=",
"MockEntityPlatform",
"(",
"hass",
")",
"entity_platform",
"=",
"MockEntity",
"(",
"name",
"=",
"\"Platform Config Source\"",
")",
"await",
"platform",
".",
"async_add_entities",
"(",
"["... | [
694,
0
] | [
719,
44
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersEntity.setup_method | (self, method) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setup_method(self, method):
"""Set up things to be run when tests are started."""
self.entity = entity.Entity()
self.entity.entity_id = "test.overwrite_hidden_true"
self.hass = self.entity.hass = get_test_home_assistant()
self.entity.schedule_update_ha_state()
self.ha... | [
"def",
"setup_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"entity",
"=",
"entity",
".",
"Entity",
"(",
")",
"self",
".",
"entity",
".",
"entity_id",
"=",
"\"test.overwrite_hidden_true\"",
"self",
".",
"hass",
"=",
"self",
".",
"entity",
"... | [
83,
4
] | [
89,
35
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersEntity.teardown_method | (self, method) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self, method):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
91,
4
] | [
93,
24
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersEntity.test_generate_entity_id_given_hass | (self) | Test generating an entity id given hass object. | Test generating an entity id given hass object. | def test_generate_entity_id_given_hass(self):
"""Test generating an entity id given hass object."""
fmt = "test.{}"
assert (
entity.generate_entity_id(fmt, "overwrite hidden true", hass=self.hass)
== "test.overwrite_hidden_true_2"
) | [
"def",
"test_generate_entity_id_given_hass",
"(",
"self",
")",
":",
"fmt",
"=",
"\"test.{}\"",
"assert",
"(",
"entity",
".",
"generate_entity_id",
"(",
"fmt",
",",
"\"overwrite hidden true\"",
",",
"hass",
"=",
"self",
".",
"hass",
")",
"==",
"\"test.overwrite_hid... | [
95,
4
] | [
101,
9
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersEntity.test_device_class | (self) | Test device class attribute. | Test device class attribute. | def test_device_class(self):
"""Test device class attribute."""
state = self.hass.states.get(self.entity.entity_id)
assert state.attributes.get(ATTR_DEVICE_CLASS) is None
with patch(
"homeassistant.helpers.entity.Entity.device_class", new="test_class"
):
s... | [
"def",
"test_device_class",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"hass",
".",
"states",
".",
"get",
"(",
"self",
".",
"entity",
".",
"entity_id",
")",
"assert",
"state",
".",
"attributes",
".",
"get",
"(",
"ATTR_DEVICE_CLASS",
")",
"is",
"... | [
103,
4
] | [
113,
70
] | python | en | ['fr', 'en', 'en'] | True |
test_caching_data | (hass) | Test that we cache data. | Test that we cache data. | async def test_caching_data(hass):
"""Test that we cache data."""
now = dt_util.utcnow()
stored_states = [
StoredState(State("input_boolean.b0", "on"), now),
StoredState(State("input_boolean.b1", "on"), now),
StoredState(State("input_boolean.b2", "on"), now),
]
data = await ... | [
"async",
"def",
"test_caching_data",
"(",
"hass",
")",
":",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"stored_states",
"=",
"[",
"StoredState",
"(",
"State",
"(",
"\"input_boolean.b0\"",
",",
"\"on\"",
")",
",",
"now",
")",
",",
"StoredState",
"(",
... | [
19,
0
] | [
50,
33
] | python | en | ['en', 'de', 'en'] | True |
test_hass_starting | (hass) | Test that we cache data. | Test that we cache data. | async def test_hass_starting(hass):
"""Test that we cache data."""
hass.state = CoreState.starting
now = dt_util.utcnow()
stored_states = [
StoredState(State("input_boolean.b0", "on"), now),
StoredState(State("input_boolean.b1", "on"), now),
StoredState(State("input_boolean.b2",... | [
"async",
"def",
"test_hass_starting",
"(",
"hass",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"starting",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"stored_states",
"=",
"[",
"StoredState",
"(",
"State",
"(",
"\"input_boolean.b0\"",
",",
... | [
53,
0
] | [
98,
33
] | python | en | ['en', 'de', 'en'] | True |
test_dump_data | (hass) | Test that we cache data. | Test that we cache data. | async def test_dump_data(hass):
"""Test that we cache data."""
states = [
State("input_boolean.b0", "on"),
State("input_boolean.b1", "on"),
State("input_boolean.b2", "on"),
State("input_boolean.b5", "unavailable", {"restored": True}),
]
entity = Entity()
entity.hass ... | [
"async",
"def",
"test_dump_data",
"(",
"hass",
")",
":",
"states",
"=",
"[",
"State",
"(",
"\"input_boolean.b0\"",
",",
"\"on\"",
")",
",",
"State",
"(",
"\"input_boolean.b1\"",
",",
"\"on\"",
")",
",",
"State",
"(",
"\"input_boolean.b2\"",
",",
"\"on\"",
")... | [
101,
0
] | [
172,
55
] | python | en | ['en', 'de', 'en'] | True |
test_dump_error | (hass) | Test that we cache data. | Test that we cache data. | async def test_dump_error(hass):
"""Test that we cache data."""
states = [
State("input_boolean.b0", "on"),
State("input_boolean.b1", "on"),
State("input_boolean.b2", "on"),
]
entity = Entity()
entity.hass = hass
entity.entity_id = "input_boolean.b0"
await entity.asy... | [
"async",
"def",
"test_dump_error",
"(",
"hass",
")",
":",
"states",
"=",
"[",
"State",
"(",
"\"input_boolean.b0\"",
",",
"\"on\"",
")",
",",
"State",
"(",
"\"input_boolean.b1\"",
",",
"\"on\"",
")",
",",
"State",
"(",
"\"input_boolean.b2\"",
",",
"\"on\"",
"... | [
175,
0
] | [
201,
33
] | python | en | ['en', 'de', 'en'] | True |
test_load_error | (hass) | Test that we cache data. | Test that we cache data. | async def test_load_error(hass):
"""Test that we cache data."""
entity = RestoreEntity()
entity.hass = hass
entity.entity_id = "input_boolean.b1"
with patch(
"homeassistant.helpers.storage.Store.async_load",
side_effect=HomeAssistantError,
):
state = await entity.async_g... | [
"async",
"def",
"test_load_error",
"(",
"hass",
")",
":",
"entity",
"=",
"RestoreEntity",
"(",
")",
"entity",
".",
"hass",
"=",
"hass",
"entity",
".",
"entity_id",
"=",
"\"input_boolean.b1\"",
"with",
"patch",
"(",
"\"homeassistant.helpers.storage.Store.async_load\"... | [
204,
0
] | [
216,
24
] | python | en | ['en', 'de', 'en'] | True |
test_state_saved_on_remove | (hass) | Test that we save entity state on removal. | Test that we save entity state on removal. | async def test_state_saved_on_remove(hass):
"""Test that we save entity state on removal."""
entity = RestoreEntity()
entity.hass = hass
entity.entity_id = "input_boolean.b0"
await entity.async_internal_added_to_hass()
now = dt_util.utcnow()
hass.states.async_set(
"input_boolean.b0"... | [
"async",
"def",
"test_state_saved_on_remove",
"(",
"hass",
")",
":",
"entity",
"=",
"RestoreEntity",
"(",
")",
"entity",
".",
"hass",
"=",
"hass",
"entity",
".",
"entity_id",
"=",
"\"input_boolean.b0\"",
"await",
"entity",
".",
"async_internal_added_to_hass",
"(",... | [
219,
0
] | [
242,
83
] | python | en | ['en', 'en', 'en'] | True |
test_restoring_invalid_entity_id | (hass, hass_storage) | Test restoring invalid entity IDs. | Test restoring invalid entity IDs. | async def test_restoring_invalid_entity_id(hass, hass_storage):
"""Test restoring invalid entity IDs."""
entity = RestoreEntity()
entity.hass = hass
entity.entity_id = "test.invalid__entity_id"
now = dt_util.utcnow().isoformat()
hass_storage[STORAGE_KEY] = {
"version": 1,
"key": ... | [
"async",
"def",
"test_restoring_invalid_entity_id",
"(",
"hass",
",",
"hass_storage",
")",
":",
"entity",
"=",
"RestoreEntity",
"(",
")",
"entity",
".",
"hass",
"=",
"hass",
"entity",
".",
"entity_id",
"=",
"\"test.invalid__entity_id\"",
"now",
"=",
"dt_util",
"... | [
245,
0
] | [
273,
24
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: Callable
) | Set up Guardian switches based on a config entry. | Set up Guardian switches based on a config entry. | async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: Callable
) -> None:
"""Set up Guardian switches based on a config entry."""
@callback
def add_new_paired_sensor(uid: str) -> None:
"""Add a new paired sensor."""
coordinator = hass.data[DOMAIN][DAT... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"Callable",
")",
"->",
"None",
":",
"@",
"callback",
"def",
"add_new_paired_sensor",
"(",
"uid",
":",
"str",
")",
"->",
... | [
46,
0
] | [
107,
31
] | python | en | ['en', 'en', 'en'] | True |
PairedSensorSensor.__init__ | (
self,
entry: ConfigEntry,
coordinator: DataUpdateCoordinator,
kind: str,
name: str,
device_class: Optional[str],
icon: Optional[str],
unit: Optional[str],
) | Initialize. | Initialize. | def __init__(
self,
entry: ConfigEntry,
coordinator: DataUpdateCoordinator,
kind: str,
name: str,
device_class: Optional[str],
icon: Optional[str],
unit: Optional[str],
) -> None:
"""Initialize."""
super().__init__(entry, coordinator, k... | [
"def",
"__init__",
"(",
"self",
",",
"entry",
":",
"ConfigEntry",
",",
"coordinator",
":",
"DataUpdateCoordinator",
",",
"kind",
":",
"str",
",",
"name",
":",
"str",
",",
"device_class",
":",
"Optional",
"[",
"str",
"]",
",",
"icon",
":",
"Optional",
"["... | [
113,
4
] | [
127,
25
] | python | en | ['en', 'en', 'it'] | False |
PairedSensorSensor.available | (self) | Return whether the entity is available. | Return whether the entity is available. | def available(self) -> bool:
"""Return whether the entity is available."""
return self.coordinator.last_update_success | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"coordinator",
".",
"last_update_success"
] | [
130,
4
] | [
132,
51
] | python | en | ['en', 'en', 'en'] | True |
PairedSensorSensor.state | (self) | Return the sensor state. | Return the sensor state. | def state(self) -> str:
"""Return the sensor state."""
return self._state | [
"def",
"state",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_state"
] | [
135,
4
] | [
137,
26
] | python | en | ['en', 'bs', 'en'] | True |
PairedSensorSensor.unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def unit_of_measurement(self) -> str:
"""Return the unit of measurement of this entity, if any."""
return self._unit | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_unit"
] | [
140,
4
] | [
142,
25
] | python | en | ['en', 'en', 'en'] | True |
PairedSensorSensor._async_update_from_latest_data | (self) | Update the entity. | Update the entity. | def _async_update_from_latest_data(self) -> None:
"""Update the entity."""
if self._kind == SENSOR_KIND_BATTERY:
self._state = self.coordinator.data["battery"]
elif self._kind == SENSOR_KIND_TEMPERATURE:
self._state = self.coordinator.data["temperature"] | [
"def",
"_async_update_from_latest_data",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_kind",
"==",
"SENSOR_KIND_BATTERY",
":",
"self",
".",
"_state",
"=",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"battery\"",
"]",
"elif",
"self",
".",
"... | [
145,
4
] | [
150,
62
] | python | en | ['en', 'en', 'en'] | True |
ValveControllerSensor.__init__ | (
self,
entry: ConfigEntry,
coordinators: Dict[str, DataUpdateCoordinator],
kind: str,
name: str,
device_class: Optional[str],
icon: Optional[str],
unit: Optional[str],
) | Initialize. | Initialize. | def __init__(
self,
entry: ConfigEntry,
coordinators: Dict[str, DataUpdateCoordinator],
kind: str,
name: str,
device_class: Optional[str],
icon: Optional[str],
unit: Optional[str],
) -> None:
"""Initialize."""
super().__init__(entry, co... | [
"def",
"__init__",
"(",
"self",
",",
"entry",
":",
"ConfigEntry",
",",
"coordinators",
":",
"Dict",
"[",
"str",
",",
"DataUpdateCoordinator",
"]",
",",
"kind",
":",
"str",
",",
"name",
":",
"str",
",",
"device_class",
":",
"Optional",
"[",
"str",
"]",
... | [
156,
4
] | [
170,
25
] | python | en | ['en', 'en', 'it'] | False |
ValveControllerSensor.available | (self) | Return whether the entity is available. | Return whether the entity is available. | def available(self) -> bool:
"""Return whether the entity is available."""
if self._kind == SENSOR_KIND_TEMPERATURE:
return self.coordinators[
API_SYSTEM_ONBOARD_SENSOR_STATUS
].last_update_success
if self._kind == SENSOR_KIND_UPTIME:
return se... | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"if",
"self",
".",
"_kind",
"==",
"SENSOR_KIND_TEMPERATURE",
":",
"return",
"self",
".",
"coordinators",
"[",
"API_SYSTEM_ONBOARD_SENSOR_STATUS",
"]",
".",
"last_update_success",
"if",
"self",
".",
"_kind"... | [
173,
4
] | [
181,
20
] | python | en | ['en', 'en', 'en'] | True |
ValveControllerSensor.state | (self) | Return the sensor state. | Return the sensor state. | def state(self) -> str:
"""Return the sensor state."""
return self._state | [
"def",
"state",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_state"
] | [
184,
4
] | [
186,
26
] | python | en | ['en', 'bs', 'en'] | True |
ValveControllerSensor.unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def unit_of_measurement(self) -> str:
"""Return the unit of measurement of this entity, if any."""
return self._unit | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_unit"
] | [
189,
4
] | [
191,
25
] | python | en | ['en', 'en', 'en'] | True |
ValveControllerSensor._async_continue_entity_setup | (self) | Register API interest (and related tasks) when the entity is added. | Register API interest (and related tasks) when the entity is added. | async def _async_continue_entity_setup(self) -> None:
"""Register API interest (and related tasks) when the entity is added."""
if self._kind == SENSOR_KIND_TEMPERATURE:
self.async_add_coordinator_update_listener(API_SYSTEM_ONBOARD_SENSOR_STATUS) | [
"async",
"def",
"_async_continue_entity_setup",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_kind",
"==",
"SENSOR_KIND_TEMPERATURE",
":",
"self",
".",
"async_add_coordinator_update_listener",
"(",
"API_SYSTEM_ONBOARD_SENSOR_STATUS",
")"
] | [
193,
4
] | [
196,
88
] | python | en | ['en', 'en', 'en'] | True |
ValveControllerSensor._async_update_from_latest_data | (self) | Update the entity. | Update the entity. | def _async_update_from_latest_data(self) -> None:
"""Update the entity."""
if self._kind == SENSOR_KIND_TEMPERATURE:
self._state = self.coordinators[API_SYSTEM_ONBOARD_SENSOR_STATUS].data[
"temperature"
]
elif self._kind == SENSOR_KIND_UPTIME:
... | [
"def",
"_async_update_from_latest_data",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_kind",
"==",
"SENSOR_KIND_TEMPERATURE",
":",
"self",
".",
"_state",
"=",
"self",
".",
"coordinators",
"[",
"API_SYSTEM_ONBOARD_SENSOR_STATUS",
"]",
".",
"data",
"[... | [
199,
4
] | [
206,
82
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Dyson Sensors. | Set up the Dyson Sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Dyson Sensors."""
if discovery_info is None:
return
hass.data.setdefault(DYSON_SENSOR_DEVICES, [])
unit = hass.config.units.temperature_unit
devices = hass.data[DYSON_SENSOR_DEVICES]
# Get Dyson Devices... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DYSON_SENSOR_DEVICES",
",",
"[",
"]",
... | [
35,
0
] | [
76,
25
] | python | en | ['en', 'sq', 'en'] | True |
DysonSensor.__init__ | (self, device, sensor_type) | Create a new generic Dyson sensor. | Create a new generic Dyson sensor. | def __init__(self, device, sensor_type):
"""Create a new generic Dyson sensor."""
self._device = device
self._old_value = None
self._name = None
self._sensor_type = sensor_type | [
"def",
"__init__",
"(",
"self",
",",
"device",
",",
"sensor_type",
")",
":",
"self",
".",
"_device",
"=",
"device",
"self",
".",
"_old_value",
"=",
"None",
"self",
".",
"_name",
"=",
"None",
"self",
".",
"_sensor_type",
"=",
"sensor_type"
] | [
82,
4
] | [
87,
39
] | python | en | ['en', 'ga', 'en'] | True |
DysonSensor.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self._device.add_message_listener(self.on_message) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_device",
".",
"add_message_listener",
"(",
"self",
".",
"on_message",
")"
] | [
89,
4
] | [
91,
58
] | python | en | ['en', 'en', 'en'] | True |
DysonSensor.on_message | (self, message) | Handle new messages which are received from the fan. | Handle new messages which are received from the fan. | def on_message(self, message):
"""Handle new messages which are received from the fan."""
# Prevent refreshing if not needed
if self._old_value is None or self._old_value != self.state:
_LOGGER.debug("Message received for %s device: %s", self.name, message)
self._old_valu... | [
"def",
"on_message",
"(",
"self",
",",
"message",
")",
":",
"# Prevent refreshing if not needed",
"if",
"self",
".",
"_old_value",
"is",
"None",
"or",
"self",
".",
"_old_value",
"!=",
"self",
".",
"state",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Message received... | [
93,
4
] | [
99,
43
] | python | en | ['en', 'en', 'en'] | True |
DysonSensor.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
102,
4
] | [
104,
20
] | python | en | ['en', 'en', 'en'] | True |
DysonSensor.name | (self) | Return the name of the Dyson sensor name. | Return the name of the Dyson sensor name. | def name(self):
"""Return the name of the Dyson sensor name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
107,
4
] | [
109,
25
] | python | en | ['en', 'sq', 'en'] | True |
DysonSensor.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 SENSOR_UNITS[self._sensor_type] | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"SENSOR_UNITS",
"[",
"self",
".",
"_sensor_type",
"]"
] | [
112,
4
] | [
114,
46
] | python | en | ['en', 'en', 'en'] | True |
DysonSensor.icon | (self) | Return the icon for this sensor. | Return the icon for this sensor. | def icon(self):
"""Return the icon for this sensor."""
return SENSOR_ICONS[self._sensor_type] | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"SENSOR_ICONS",
"[",
"self",
".",
"_sensor_type",
"]"
] | [
117,
4
] | [
119,
46
] | python | en | ['en', 'en', 'en'] | True |
DysonSensor.unique_id | (self) | Return the sensor's unique id. | Return the sensor's unique id. | def unique_id(self):
"""Return the sensor's unique id."""
return f"{self._device.serial}-{self._sensor_type}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._device.serial}-{self._sensor_type}\""
] | [
122,
4
] | [
124,
59
] | python | en | ['en', 'ca', 'en'] | True |
DysonFilterLifeSensor.__init__ | (self, device) | Create a new Dyson Filter Life sensor. | Create a new Dyson Filter Life sensor. | def __init__(self, device):
"""Create a new Dyson Filter Life sensor."""
super().__init__(device, "filter_life")
self._name = f"{self._device.name} Filter Life" | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
",",
"\"filter_life\"",
")",
"self",
".",
"_name",
"=",
"f\"{self._device.name} Filter Life\""
] | [
130,
4
] | [
133,
55
] | python | en | ['en', 'gl', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.