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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
SqueezeBoxEntity.rediscovered | (self, unique_id, connected) | Make a player available again. | Make a player available again. | def rediscovered(self, unique_id, connected):
"""Make a player available again."""
if unique_id == self.unique_id and connected:
self._available = True
_LOGGER.info("Player %s is available again", self.name)
self._remove_dispatcher() | [
"def",
"rediscovered",
"(",
"self",
",",
"unique_id",
",",
"connected",
")",
":",
"if",
"unique_id",
"==",
"self",
".",
"unique_id",
"and",
"connected",
":",
"self",
".",
"_available",
"=",
"True",
"_LOGGER",
".",
"info",
"(",
"\"Player %s is available again\"... | [
293,
4
] | [
298,
37
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
if not self._player.power:
return STATE_OFF
if self._player.mode:
return SQUEEZEBOX_MODE.get(self._player.mode)
return None | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_player",
".",
"power",
":",
"return",
"STATE_OFF",
"if",
"self",
".",
"_player",
".",
"mode",
":",
"return",
"SQUEEZEBOX_MODE",
".",
"get",
"(",
"self",
".",
"_player",
".",
"mode",
"... | [
301,
4
] | [
307,
19
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_update | (self) | Update the Player() object. | Update the Player() object. | async def async_update(self):
"""Update the Player() object."""
# only update available players, newly available players will be rediscovered and marked available
if self._available:
last_media_position = self.media_position
await self._player.async_update()
i... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"# only update available players, newly available players will be rediscovered and marked available",
"if",
"self",
".",
"_available",
":",
"last_media_position",
"=",
"self",
".",
"media_position",
"await",
"self",
".",
... | [
309,
4
] | [
324,
17
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_will_remove_from_hass | (self) | Remove from list of known players when removed from hass. | Remove from list of known players when removed from hass. | async def async_will_remove_from_hass(self):
"""Remove from list of known players when removed from hass."""
self.hass.data[DOMAIN][KNOWN_PLAYERS].remove(self) | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"KNOWN_PLAYERS",
"]",
".",
"remove",
"(",
"self",
")"
] | [
326,
4
] | [
328,
58
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.volume_level | (self) | Volume level of the media player (0..1). | Volume level of the media player (0..1). | def volume_level(self):
"""Volume level of the media player (0..1)."""
if self._player.volume:
return int(float(self._player.volume)) / 100.0 | [
"def",
"volume_level",
"(",
"self",
")",
":",
"if",
"self",
".",
"_player",
".",
"volume",
":",
"return",
"int",
"(",
"float",
"(",
"self",
".",
"_player",
".",
"volume",
")",
")",
"/",
"100.0"
] | [
331,
4
] | [
334,
58
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.is_volume_muted | (self) | Return true if volume is muted. | Return true if volume is muted. | def is_volume_muted(self):
"""Return true if volume is muted."""
return self._player.muting | [
"def",
"is_volume_muted",
"(",
"self",
")",
":",
"return",
"self",
".",
"_player",
".",
"muting"
] | [
337,
4
] | [
339,
34
] | python | de | ['nl', 'de', 'en'] | False |
SqueezeBoxEntity.media_content_id | (self) | Content ID of current playing media. | Content ID of current playing media. | def media_content_id(self):
"""Content ID of current playing media."""
if not self._player.playlist:
return None
if len(self._player.playlist) > 1:
urls = [{"url": track["url"]} for track in self._player.playlist]
return json.dumps({"index": self._player.curre... | [
"def",
"media_content_id",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_player",
".",
"playlist",
":",
"return",
"None",
"if",
"len",
"(",
"self",
".",
"_player",
".",
"playlist",
")",
">",
"1",
":",
"urls",
"=",
"[",
"{",
"\"url\"",
":",
"tr... | [
342,
4
] | [
349,
31
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.media_content_type | (self) | Content type of current playing media. | Content type of current playing media. | def media_content_type(self):
"""Content type of current playing media."""
if not self._player.playlist:
return None
if len(self._player.playlist) > 1:
return MEDIA_TYPE_PLAYLIST
return MEDIA_TYPE_MUSIC | [
"def",
"media_content_type",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_player",
".",
"playlist",
":",
"return",
"None",
"if",
"len",
"(",
"self",
".",
"_player",
".",
"playlist",
")",
">",
"1",
":",
"return",
"MEDIA_TYPE_PLAYLIST",
"return",
"ME... | [
352,
4
] | [
358,
31
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.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."""
return self._player.duration | [
"def",
"media_duration",
"(",
"self",
")",
":",
"return",
"self",
".",
"_player",
".",
"duration"
] | [
361,
4
] | [
363,
36
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.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."""
return self._player.time | [
"def",
"media_position",
"(",
"self",
")",
":",
"return",
"self",
".",
"_player",
".",
"time"
] | [
366,
4
] | [
368,
32
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.media_position_updated_at | (self) | Last time status was updated. | Last time status was updated. | def media_position_updated_at(self):
"""Last time status was updated."""
return self._last_update | [
"def",
"media_position_updated_at",
"(",
"self",
")",
":",
"return",
"self",
".",
"_last_update"
] | [
371,
4
] | [
373,
32
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.media_image_url | (self) | Image url of current playing media. | Image url of current playing media. | def media_image_url(self):
"""Image url of current playing media."""
return self._player.image_url | [
"def",
"media_image_url",
"(",
"self",
")",
":",
"return",
"self",
".",
"_player",
".",
"image_url"
] | [
376,
4
] | [
378,
37
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.media_title | (self) | Title of current playing media. | Title of current playing media. | def media_title(self):
"""Title of current playing media."""
return self._player.title | [
"def",
"media_title",
"(",
"self",
")",
":",
"return",
"self",
".",
"_player",
".",
"title"
] | [
381,
4
] | [
383,
33
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.media_artist | (self) | Artist of current playing media. | Artist of current playing media. | def media_artist(self):
"""Artist of current playing media."""
return self._player.artist | [
"def",
"media_artist",
"(",
"self",
")",
":",
"return",
"self",
".",
"_player",
".",
"artist"
] | [
386,
4
] | [
388,
34
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.media_album_name | (self) | Album of current playing media. | Album of current playing media. | def media_album_name(self):
"""Album of current playing media."""
return self._player.album | [
"def",
"media_album_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_player",
".",
"album"
] | [
391,
4
] | [
393,
33
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.shuffle | (self) | Boolean if shuffle is enabled. | Boolean if shuffle is enabled. | def shuffle(self):
"""Boolean if shuffle is enabled."""
return self._player.shuffle | [
"def",
"shuffle",
"(",
"self",
")",
":",
"return",
"self",
".",
"_player",
".",
"shuffle"
] | [
396,
4
] | [
398,
35
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.supported_features | (self) | Flag media player features that are supported. | Flag media player features that are supported. | def supported_features(self):
"""Flag media player features that are supported."""
return SUPPORT_SQUEEZEBOX | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_SQUEEZEBOX"
] | [
401,
4
] | [
403,
33
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.sync_group | (self) | List players we are synced with. | List players we are synced with. | def sync_group(self):
"""List players we are synced with."""
player_ids = {
p.unique_id: p.entity_id for p in self.hass.data[DOMAIN][KNOWN_PLAYERS]
}
sync_group = []
for player in self._player.sync_group:
if player in player_ids:
sync_group... | [
"def",
"sync_group",
"(",
"self",
")",
":",
"player_ids",
"=",
"{",
"p",
".",
"unique_id",
":",
"p",
".",
"entity_id",
"for",
"p",
"in",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"KNOWN_PLAYERS",
"]",
"}",
"sync_group",
"=",
"[",
"... | [
406,
4
] | [
415,
25
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.query_result | (self) | Return the result from the call_query service. | Return the result from the call_query service. | def query_result(self):
"""Return the result from the call_query service."""
return self._query_result | [
"def",
"query_result",
"(",
"self",
")",
":",
"return",
"self",
".",
"_query_result"
] | [
418,
4
] | [
420,
33
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_turn_off | (self) | Turn off media player. | Turn off media player. | async def async_turn_off(self):
"""Turn off media player."""
await self._player.async_set_power(False) | [
"async",
"def",
"async_turn_off",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_set_power",
"(",
"False",
")"
] | [
422,
4
] | [
424,
49
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_volume_up | (self) | Volume up media player. | Volume up media player. | async def async_volume_up(self):
"""Volume up media player."""
await self._player.async_set_volume("+5") | [
"async",
"def",
"async_volume_up",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_set_volume",
"(",
"\"+5\"",
")"
] | [
426,
4
] | [
428,
49
] | python | en | ['en', 'no', 'en'] | True |
SqueezeBoxEntity.async_volume_down | (self) | Volume down media player. | Volume down media player. | async def async_volume_down(self):
"""Volume down media player."""
await self._player.async_set_volume("-5") | [
"async",
"def",
"async_volume_down",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_set_volume",
"(",
"\"-5\"",
")"
] | [
430,
4
] | [
432,
49
] | python | en | ['en', 'sl', 'en'] | True |
SqueezeBoxEntity.async_set_volume_level | (self, volume) | Set volume level, range 0..1. | Set volume level, range 0..1. | async def async_set_volume_level(self, volume):
"""Set volume level, range 0..1."""
volume_percent = str(int(volume * 100))
await self._player.async_set_volume(volume_percent) | [
"async",
"def",
"async_set_volume_level",
"(",
"self",
",",
"volume",
")",
":",
"volume_percent",
"=",
"str",
"(",
"int",
"(",
"volume",
"*",
"100",
")",
")",
"await",
"self",
".",
"_player",
".",
"async_set_volume",
"(",
"volume_percent",
")"
] | [
434,
4
] | [
437,
59
] | python | en | ['fr', 'zu', 'en'] | False |
SqueezeBoxEntity.async_mute_volume | (self, mute) | Mute (true) or unmute (false) media player. | Mute (true) or unmute (false) media player. | async def async_mute_volume(self, mute):
"""Mute (true) or unmute (false) media player."""
await self._player.async_set_muting(mute) | [
"async",
"def",
"async_mute_volume",
"(",
"self",
",",
"mute",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_set_muting",
"(",
"mute",
")"
] | [
439,
4
] | [
441,
49
] | python | en | ['en', 'la', 'it'] | False |
SqueezeBoxEntity.async_media_stop | (self) | Send stop command to media player. | Send stop command to media player. | async def async_media_stop(self):
"""Send stop command to media player."""
await self._player.async_stop() | [
"async",
"def",
"async_media_stop",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_stop",
"(",
")"
] | [
443,
4
] | [
445,
39
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_media_play_pause | (self) | Send pause command to media player. | Send pause command to media player. | async def async_media_play_pause(self):
"""Send pause command to media player."""
await self._player.async_toggle_pause() | [
"async",
"def",
"async_media_play_pause",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_toggle_pause",
"(",
")"
] | [
447,
4
] | [
449,
47
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_media_play | (self) | Send play command to media player. | Send play command to media player. | async def async_media_play(self):
"""Send play command to media player."""
await self._player.async_play() | [
"async",
"def",
"async_media_play",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_play",
"(",
")"
] | [
451,
4
] | [
453,
39
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_media_pause | (self) | Send pause command to media player. | Send pause command to media player. | async def async_media_pause(self):
"""Send pause command to media player."""
await self._player.async_pause() | [
"async",
"def",
"async_media_pause",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_pause",
"(",
")"
] | [
455,
4
] | [
457,
40
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_media_next_track | (self) | Send next track command. | Send next track command. | async def async_media_next_track(self):
"""Send next track command."""
await self._player.async_index("+1") | [
"async",
"def",
"async_media_next_track",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_index",
"(",
"\"+1\"",
")"
] | [
459,
4
] | [
461,
44
] | python | en | ['en', 'pt', 'en'] | True |
SqueezeBoxEntity.async_media_previous_track | (self) | Send next track command. | Send next track command. | async def async_media_previous_track(self):
"""Send next track command."""
await self._player.async_index("-1") | [
"async",
"def",
"async_media_previous_track",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_index",
"(",
"\"-1\"",
")"
] | [
463,
4
] | [
465,
44
] | python | en | ['en', 'pt', 'en'] | True |
SqueezeBoxEntity.async_media_seek | (self, position) | Send seek command. | Send seek command. | async def async_media_seek(self, position):
"""Send seek command."""
await self._player.async_time(position) | [
"async",
"def",
"async_media_seek",
"(",
"self",
",",
"position",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_time",
"(",
"position",
")"
] | [
467,
4
] | [
469,
47
] | python | en | ['en', 'ig', 'en'] | True |
SqueezeBoxEntity.async_turn_on | (self) | Turn the media player on. | Turn the media player on. | async def async_turn_on(self):
"""Turn the media player on."""
await self._player.async_set_power(True) | [
"async",
"def",
"async_turn_on",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_set_power",
"(",
"True",
")"
] | [
471,
4
] | [
473,
48
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_play_media | (self, media_type, media_id, **kwargs) |
Send the play_media command to the media player.
If ATTR_MEDIA_ENQUEUE is True, add `media_id` to the current playlist.
|
Send the play_media command to the media player. | async def async_play_media(self, media_type, media_id, **kwargs):
"""
Send the play_media command to the media player.
If ATTR_MEDIA_ENQUEUE is True, add `media_id` to the current playlist.
"""
cmd = "play"
index = None
if kwargs.get(ATTR_MEDIA_ENQUEUE):
... | [
"async",
"def",
"async_play_media",
"(",
"self",
",",
"media_type",
",",
"media_id",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"\"play\"",
"index",
"=",
"None",
"if",
"kwargs",
".",
"get",
"(",
"ATTR_MEDIA_ENQUEUE",
")",
":",
"cmd",
"=",
"\"add\"",
... | [
475,
4
] | [
515,
49
] | python | en | ['en', 'error', 'th'] | False |
SqueezeBoxEntity.async_set_shuffle | (self, shuffle) | Enable/disable shuffle mode. | Enable/disable shuffle mode. | async def async_set_shuffle(self, shuffle):
"""Enable/disable shuffle mode."""
shuffle_mode = "song" if shuffle else "none"
await self._player.async_set_shuffle(shuffle_mode) | [
"async",
"def",
"async_set_shuffle",
"(",
"self",
",",
"shuffle",
")",
":",
"shuffle_mode",
"=",
"\"song\"",
"if",
"shuffle",
"else",
"\"none\"",
"await",
"self",
".",
"_player",
".",
"async_set_shuffle",
"(",
"shuffle_mode",
")"
] | [
517,
4
] | [
520,
58
] | python | en | ['en', 'st', 'en'] | True |
SqueezeBoxEntity.async_clear_playlist | (self) | Send the media player the command for clear playlist. | Send the media player the command for clear playlist. | async def async_clear_playlist(self):
"""Send the media player the command for clear playlist."""
await self._player.async_clear_playlist() | [
"async",
"def",
"async_clear_playlist",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_clear_playlist",
"(",
")"
] | [
522,
4
] | [
524,
49
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_call_method | (self, command, parameters=None) |
Call Squeezebox JSON/RPC method.
Additional parameters are added to the command to form the list of
positional parameters (p0, p1..., pN) passed to JSON/RPC server.
|
Call Squeezebox JSON/RPC method. | async def async_call_method(self, command, parameters=None):
"""
Call Squeezebox JSON/RPC method.
Additional parameters are added to the command to form the list of
positional parameters (p0, p1..., pN) passed to JSON/RPC server.
"""
all_params = [command]
if pa... | [
"async",
"def",
"async_call_method",
"(",
"self",
",",
"command",
",",
"parameters",
"=",
"None",
")",
":",
"all_params",
"=",
"[",
"command",
"]",
"if",
"parameters",
":",
"for",
"parameter",
"in",
"parameters",
":",
"all_params",
".",
"append",
"(",
"par... | [
526,
4
] | [
537,
51
] | python | en | ['en', 'error', 'th'] | False |
SqueezeBoxEntity.async_call_query | (self, command, parameters=None) |
Call Squeezebox JSON/RPC method where we care about the result.
Additional parameters are added to the command to form the list of
positional parameters (p0, p1..., pN) passed to JSON/RPC server.
|
Call Squeezebox JSON/RPC method where we care about the result. | async def async_call_query(self, command, parameters=None):
"""
Call Squeezebox JSON/RPC method where we care about the result.
Additional parameters are added to the command to form the list of
positional parameters (p0, p1..., pN) passed to JSON/RPC server.
"""
all_pa... | [
"async",
"def",
"async_call_query",
"(",
"self",
",",
"command",
",",
"parameters",
"=",
"None",
")",
":",
"all_params",
"=",
"[",
"command",
"]",
"if",
"parameters",
":",
"for",
"parameter",
"in",
"parameters",
":",
"all_params",
".",
"append",
"(",
"para... | [
539,
4
] | [
551,
69
] | python | en | ['en', 'error', 'th'] | False |
SqueezeBoxEntity.async_sync | (self, other_player) |
Add another Squeezebox player to this player's sync group.
If the other player is a member of a sync group, it will leave the current sync group
without asking.
|
Add another Squeezebox player to this player's sync group. | async def async_sync(self, other_player):
"""
Add another Squeezebox player to this player's sync group.
If the other player is a member of a sync group, it will leave the current sync group
without asking.
"""
player_ids = {
p.entity_id: p.unique_id for p in... | [
"async",
"def",
"async_sync",
"(",
"self",
",",
"other_player",
")",
":",
"player_ids",
"=",
"{",
"p",
".",
"entity_id",
":",
"p",
".",
"unique_id",
"for",
"p",
"in",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"KNOWN_PLAYERS",
"]",
"}... | [
553,
4
] | [
567,
86
] | python | en | ['en', 'error', 'th'] | False |
SqueezeBoxEntity.async_unsync | (self) | Unsync this Squeezebox player. | Unsync this Squeezebox player. | async def async_unsync(self):
"""Unsync this Squeezebox player."""
await self._player.async_unsync() | [
"async",
"def",
"async_unsync",
"(",
"self",
")",
":",
"await",
"self",
".",
"_player",
".",
"async_unsync",
"(",
")"
] | [
569,
4
] | [
571,
41
] | python | en | ['en', 'en', 'en'] | True |
SqueezeBoxEntity.async_browse_media | (self, media_content_type=None, media_content_id=None) | Implement the websocket media browsing helper. | Implement the websocket media browsing helper. | async def async_browse_media(self, media_content_type=None, media_content_id=None):
"""Implement the websocket media browsing helper."""
_LOGGER.debug(
"Reached async_browse_media with content_type %s and content_id %s",
media_content_type,
media_content_id,
... | [
"async",
"def",
"async_browse_media",
"(",
"self",
",",
"media_content_type",
"=",
"None",
",",
"media_content_id",
"=",
"None",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Reached async_browse_media with content_type %s and content_id %s\"",
",",
"media_content_type",
","... | [
573,
4
] | [
590,
69
] | python | en | ['en', 'af', 'en'] | True |
SqueezeBoxEntity.async_get_browse_image | (
self, media_content_type, media_content_id, media_image_id=None
) | Get album art from Squeezebox server. | Get album art from Squeezebox server. | async def async_get_browse_image(
self, media_content_type, media_content_id, media_image_id=None
):
"""Get album art from Squeezebox server."""
if media_image_id:
image_url = self._player.generate_image_url_from_track_id(media_image_id)
result = await self._async_fet... | [
"async",
"def",
"async_get_browse_image",
"(",
"self",
",",
"media_content_type",
",",
"media_content_id",
",",
"media_image_id",
"=",
"None",
")",
":",
"if",
"media_image_id",
":",
"image_url",
"=",
"self",
".",
"_player",
".",
"generate_image_url_from_track_id",
"... | [
592,
4
] | [
603,
27
] | python | en | ['en', 'la', 'en'] | True |
test_user_form | (hass: core.HomeAssistant) | Test we get the user initiated form. | Test we get the user initiated form. | async def test_user_form(hass: core.HomeAssistant):
"""Test we get the user initiated form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["ty... | [
"async",
"def",
"test_user_form",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entrie... | [
15,
0
] | [
40,
48
] | python | en | ['en', 'en', 'en'] | True |
test_user_form_invalid_auth | (hass: core.HomeAssistant) | Test we handle invalid auth. | Test we handle invalid auth. | async def test_user_form_invalid_auth(hass: core.HomeAssistant):
"""Test we handle invalid auth."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch_bond_version(
return_value={"bond_id": "test-bond-id"}
), patch... | [
"async",
"def",
"test_user_form_invalid_auth",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"confi... | [
43,
0
] | [
60,
56
] | python | en | ['en', 'en', 'en'] | True |
test_user_form_cannot_connect | (hass: core.HomeAssistant) | Test we handle cannot connect error. | Test we handle cannot connect error. | async def test_user_form_cannot_connect(hass: core.HomeAssistant):
"""Test we handle cannot connect error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch_bond_version(
side_effect=ClientConnectionError()
), ... | [
"async",
"def",
"test_user_form_cannot_connect",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"con... | [
63,
0
] | [
78,
58
] | python | en | ['en', 'en', 'en'] | True |
test_user_form_old_firmware | (hass: core.HomeAssistant) | Test we handle unsupported old firmware. | Test we handle unsupported old firmware. | async def test_user_form_old_firmware(hass: core.HomeAssistant):
"""Test we handle unsupported old firmware."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch_bond_version(
return_value={"no_bond_id": "present"}
... | [
"async",
"def",
"test_user_form_old_firmware",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"confi... | [
81,
0
] | [
96,
56
] | python | en | ['en', 'en', 'en'] | True |
test_user_form_unexpected_client_error | (hass: core.HomeAssistant) | Test we handle unexpected client error gracefully. | Test we handle unexpected client error gracefully. | async def test_user_form_unexpected_client_error(hass: core.HomeAssistant):
"""Test we handle unexpected client error gracefully."""
await _help_test_form_unexpected_error(
hass,
source=config_entries.SOURCE_USER,
user_input={CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token"},
... | [
"async",
"def",
"test_user_form_unexpected_client_error",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"_help_test_form_unexpected_error",
"(",
"hass",
",",
"source",
"=",
"config_entries",
".",
"SOURCE_USER",
",",
"user_input",
"=",
"{",
"CONF... | [
99,
0
] | [
106,
5
] | python | en | ['de', 'en', 'en'] | True |
test_user_form_unexpected_error | (hass: core.HomeAssistant) | Test we handle unexpected error gracefully. | Test we handle unexpected error gracefully. | async def test_user_form_unexpected_error(hass: core.HomeAssistant):
"""Test we handle unexpected error gracefully."""
await _help_test_form_unexpected_error(
hass,
source=config_entries.SOURCE_USER,
user_input={CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token"},
error=Exce... | [
"async",
"def",
"test_user_form_unexpected_error",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"_help_test_form_unexpected_error",
"(",
"hass",
",",
"source",
"=",
"config_entries",
".",
"SOURCE_USER",
",",
"user_input",
"=",
"{",
"CONF_HOST",... | [
109,
0
] | [
116,
5
] | python | en | ['en', 'en', 'en'] | True |
test_user_form_one_entry_per_device_allowed | (hass: core.HomeAssistant) | Test that only one entry allowed per unique ID reported by Bond hub device. | Test that only one entry allowed per unique ID reported by Bond hub device. | async def test_user_form_one_entry_per_device_allowed(hass: core.HomeAssistant):
"""Test that only one entry allowed per unique ID reported by Bond hub device."""
MockConfigEntry(
domain=DOMAIN,
unique_id="already-registered-bond-id",
data={CONF_HOST: "some host", CONF_ACCESS_TOKEN: "tes... | [
"async",
"def",
"test_user_form_one_entry_per_device_allowed",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"\"already-registered-bond-id\"",
",",
"data",
"=",
"{",
"CONF_HOST",
":"... | [
119,
0
] | [
146,
48
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_form | (hass: core.HomeAssistant) | Test we get the discovery form. | Test we get the discovery form. | async def test_zeroconf_form(hass: core.HomeAssistant):
"""Test we get the discovery form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data={"... | [
"async",
"def",
"test_zeroconf_form",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_en... | [
149,
0
] | [
176,
48
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_already_configured | (hass: core.HomeAssistant) | Test starting a flow from discovery when already configured. | Test starting a flow from discovery when already configured. | async def test_zeroconf_already_configured(hass: core.HomeAssistant):
"""Test starting a flow from discovery when already configured."""
await setup.async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN,
unique_id="already-registered-bond-id",
... | [
"async",
"def",
"test_zeroconf_already_configured",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",... | [
179,
0
] | [
206,
48
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_form_unexpected_error | (hass: core.HomeAssistant) | Test we handle unexpected error gracefully. | Test we handle unexpected error gracefully. | async def test_zeroconf_form_unexpected_error(hass: core.HomeAssistant):
"""Test we handle unexpected error gracefully."""
await _help_test_form_unexpected_error(
hass,
source=config_entries.SOURCE_ZEROCONF,
initial_input={
"name": "test-bond-id.some-other-tail-info",
... | [
"async",
"def",
"test_zeroconf_form_unexpected_error",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"_help_test_form_unexpected_error",
"(",
"hass",
",",
"source",
"=",
"config_entries",
".",
"SOURCE_ZEROCONF",
",",
"initial_input",
"=",
"{",
"... | [
209,
0
] | [
220,
5
] | python | en | ['en', 'en', 'en'] | True |
_help_test_form_unexpected_error | (
hass: core.HomeAssistant,
*,
source: str,
initial_input: Dict[str, Any] = None,
user_input: Dict[str, Any],
error: Exception,
) | Test we handle unexpected error gracefully. | Test we handle unexpected error gracefully. | async def _help_test_form_unexpected_error(
hass: core.HomeAssistant,
*,
source: str,
initial_input: Dict[str, Any] = None,
user_input: Dict[str, Any],
error: Exception,
):
"""Test we handle unexpected error gracefully."""
result = await hass.config_entries.flow.async_init(
DOMAI... | [
"async",
"def",
"_help_test_form_unexpected_error",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"*",
",",
"source",
":",
"str",
",",
"initial_input",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
"=",
"None",
",",
"user_input",
":",
"Dict",
"[",
"st... | [
223,
0
] | [
244,
51
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
) | Set up the HomematicIP weather sensor from a config entry. | Set up the HomematicIP weather sensor from a config entry. | async def async_setup_entry(
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the HomematicIP weather sensor from a config entry."""
hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id]
entities = []
for device in hap.home.devices:
if isinstance(de... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
")",
"->",
"None",
":",
"hap",
"=",
"hass",
".",
"data",
"[",
"HMIPC_DOMAIN",
"]",
"[",
"config_entry",
".",
"unique... | [
35,
0
] | [
50,
36
] | python | en | ['en', 'en', 'en'] | True |
HomematicipWeatherSensor.__init__ | (self, hap: HomematicipHAP, device) | Initialize the weather sensor. | Initialize the weather sensor. | def __init__(self, hap: HomematicipHAP, device) -> None:
"""Initialize the weather sensor."""
super().__init__(hap, device) | [
"def",
"__init__",
"(",
"self",
",",
"hap",
":",
"HomematicipHAP",
",",
"device",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hap",
",",
"device",
")"
] | [
56,
4
] | [
58,
37
] | python | en | ['en', 'en', 'en'] | True |
HomematicipWeatherSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self) -> str:
"""Return the name of the sensor."""
return self._device.label | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device",
".",
"label"
] | [
61,
4
] | [
63,
33
] | python | en | ['en', 'mi', 'en'] | True |
HomematicipWeatherSensor.temperature | (self) | Return the platform temperature. | Return the platform temperature. | def temperature(self) -> float:
"""Return the platform temperature."""
return self._device.actualTemperature | [
"def",
"temperature",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device",
".",
"actualTemperature"
] | [
66,
4
] | [
68,
45
] | python | en | ['en', 'la', 'en'] | True |
HomematicipWeatherSensor.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self) -> str:
"""Return the unit of measurement."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
"->",
"str",
":",
"return",
"TEMP_CELSIUS"
] | [
71,
4
] | [
73,
27
] | python | en | ['en', 'la', 'en'] | True |
HomematicipWeatherSensor.humidity | (self) | Return the humidity. | Return the humidity. | def humidity(self) -> int:
"""Return the humidity."""
return self._device.humidity | [
"def",
"humidity",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_device",
".",
"humidity"
] | [
76,
4
] | [
78,
36
] | python | en | ['en', 'sw', 'en'] | True |
HomematicipWeatherSensor.wind_speed | (self) | Return the wind speed. | Return the wind speed. | def wind_speed(self) -> float:
"""Return the wind speed."""
return self._device.windSpeed | [
"def",
"wind_speed",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device",
".",
"windSpeed"
] | [
81,
4
] | [
83,
37
] | python | en | ['en', 'zh', 'en'] | True |
HomematicipWeatherSensor.attribution | (self) | Return the attribution. | Return the attribution. | def attribution(self) -> str:
"""Return the attribution."""
return "Powered by Homematic IP" | [
"def",
"attribution",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"Powered by Homematic IP\""
] | [
86,
4
] | [
88,
40
] | python | en | ['en', 'ja', 'en'] | True |
HomematicipWeatherSensor.condition | (self) | Return the current condition. | Return the current condition. | def condition(self) -> str:
"""Return the current condition."""
if getattr(self._device, "raining", None):
return "rainy"
if self._device.storm:
return "windy"
if self._device.sunshine:
return "sunny"
return "" | [
"def",
"condition",
"(",
"self",
")",
"->",
"str",
":",
"if",
"getattr",
"(",
"self",
".",
"_device",
",",
"\"raining\"",
",",
"None",
")",
":",
"return",
"\"rainy\"",
"if",
"self",
".",
"_device",
".",
"storm",
":",
"return",
"\"windy\"",
"if",
"self"... | [
91,
4
] | [
99,
17
] | python | en | ['en', 'en', 'en'] | True |
HomematicipWeatherSensorPro.wind_bearing | (self) | Return the wind bearing. | Return the wind bearing. | def wind_bearing(self) -> float:
"""Return the wind bearing."""
return self._device.windDirection | [
"def",
"wind_bearing",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device",
".",
"windDirection"
] | [
106,
4
] | [
108,
41
] | python | en | ['en', 'ig', 'en'] | True |
HomematicipHomeWeather.__init__ | (self, hap: HomematicipHAP) | Initialize the home weather. | Initialize the home weather. | def __init__(self, hap: HomematicipHAP) -> None:
"""Initialize the home weather."""
hap.home.modelType = "HmIP-Home-Weather"
super().__init__(hap, hap.home) | [
"def",
"__init__",
"(",
"self",
",",
"hap",
":",
"HomematicipHAP",
")",
"->",
"None",
":",
"hap",
".",
"home",
".",
"modelType",
"=",
"\"HmIP-Home-Weather\"",
"super",
"(",
")",
".",
"__init__",
"(",
"hap",
",",
"hap",
".",
"home",
")"
] | [
114,
4
] | [
117,
39
] | python | en | ['en', 'en', 'en'] | True |
HomematicipHomeWeather.available | (self) | Return if weather entity is available. | Return if weather entity is available. | def available(self) -> bool:
"""Return if weather entity is available."""
return self._home.connected | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_home",
".",
"connected"
] | [
120,
4
] | [
122,
35
] | python | en | ['en', 'en', 'en'] | True |
HomematicipHomeWeather.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self) -> str:
"""Return the name of the sensor."""
return f"Weather {self._home.location.city}" | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"Weather {self._home.location.city}\""
] | [
125,
4
] | [
127,
52
] | python | en | ['en', 'mi', 'en'] | True |
HomematicipHomeWeather.temperature | (self) | Return the temperature. | Return the temperature. | def temperature(self) -> float:
"""Return the temperature."""
return self._device.weather.temperature | [
"def",
"temperature",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device",
".",
"weather",
".",
"temperature"
] | [
130,
4
] | [
132,
47
] | python | en | ['en', 'la', 'en'] | True |
HomematicipHomeWeather.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self) -> str:
"""Return the unit of measurement."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
"->",
"str",
":",
"return",
"TEMP_CELSIUS"
] | [
135,
4
] | [
137,
27
] | python | en | ['en', 'la', 'en'] | True |
HomematicipHomeWeather.humidity | (self) | Return the humidity. | Return the humidity. | def humidity(self) -> int:
"""Return the humidity."""
return self._device.weather.humidity | [
"def",
"humidity",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_device",
".",
"weather",
".",
"humidity"
] | [
140,
4
] | [
142,
44
] | python | en | ['en', 'sw', 'en'] | True |
HomematicipHomeWeather.wind_speed | (self) | Return the wind speed. | Return the wind speed. | def wind_speed(self) -> float:
"""Return the wind speed."""
return round(self._device.weather.windSpeed, 1) | [
"def",
"wind_speed",
"(",
"self",
")",
"->",
"float",
":",
"return",
"round",
"(",
"self",
".",
"_device",
".",
"weather",
".",
"windSpeed",
",",
"1",
")"
] | [
145,
4
] | [
147,
55
] | python | en | ['en', 'zh', 'en'] | True |
HomematicipHomeWeather.wind_bearing | (self) | Return the wind bearing. | Return the wind bearing. | def wind_bearing(self) -> float:
"""Return the wind bearing."""
return self._device.weather.windDirection | [
"def",
"wind_bearing",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_device",
".",
"weather",
".",
"windDirection"
] | [
150,
4
] | [
152,
49
] | python | en | ['en', 'ig', 'en'] | True |
HomematicipHomeWeather.attribution | (self) | Return the attribution. | Return the attribution. | def attribution(self) -> str:
"""Return the attribution."""
return "Powered by Homematic IP" | [
"def",
"attribution",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"Powered by Homematic IP\""
] | [
155,
4
] | [
157,
40
] | python | en | ['en', 'ja', 'en'] | True |
HomematicipHomeWeather.condition | (self) | Return the current condition. | Return the current condition. | def condition(self) -> str:
"""Return the current condition."""
return HOME_WEATHER_CONDITION.get(self._device.weather.weatherCondition) | [
"def",
"condition",
"(",
"self",
")",
"->",
"str",
":",
"return",
"HOME_WEATHER_CONDITION",
".",
"get",
"(",
"self",
".",
"_device",
".",
"weather",
".",
"weatherCondition",
")"
] | [
160,
4
] | [
162,
80
] | python | en | ['en', 'en', 'en'] | True |
_generate_mock_feed_entry | (
external_id,
title,
distance_to_home,
coordinates,
category=None,
location=None,
attribution=None,
publication_date=None,
council_area=None,
status=None,
entry_type=None,
fire=True,
size=None,
responsible_agency=None,
) | Construct a mock feed entry for testing purposes. | Construct a mock feed entry for testing purposes. | def _generate_mock_feed_entry(
external_id,
title,
distance_to_home,
coordinates,
category=None,
location=None,
attribution=None,
publication_date=None,
council_area=None,
status=None,
entry_type=None,
fire=True,
size=None,
responsible_agency=None,
):
"""Const... | [
"def",
"_generate_mock_feed_entry",
"(",
"external_id",
",",
"title",
",",
"distance_to_home",
",",
"coordinates",
",",
"category",
"=",
"None",
",",
"location",
"=",
"None",
",",
"attribution",
"=",
"None",
",",
"publication_date",
"=",
"None",
",",
"council_ar... | [
56,
0
] | [
88,
21
] | python | en | ['en', 'en', 'en'] | True |
test_setup | (hass) | Test the general setup of the platform. | Test the general setup of the platform. | async def test_setup(hass):
"""Test the general setup of the platform."""
# Set up some mock feed entries for this test.
mock_entry_1 = _generate_mock_feed_entry(
"1234",
"Title 1",
15.5,
(-31.0, 150.0),
category="Category 1",
location="Location 1",
at... | [
"async",
"def",
"test_setup",
"(",
"hass",
")",
":",
"# Set up some mock feed entries for this test.",
"mock_entry_1",
"=",
"_generate_mock_feed_entry",
"(",
"\"1234\"",
",",
"\"Title 1\"",
",",
"15.5",
",",
"(",
"-",
"31.0",
",",
"150.0",
")",
",",
"category",
"=... | [
91,
0
] | [
225,
46
] | python | en | ['en', 'da', 'en'] | True |
test_setup_with_custom_location | (hass) | Test the setup with a custom location. | Test the setup with a custom location. | async def test_setup_with_custom_location(hass):
"""Test the setup with a custom location."""
# Set up some mock feed entries for this test.
mock_entry_1 = _generate_mock_feed_entry("1234", "Title 1", 20.5, (-31.1, 150.1))
with patch(
"aio_geojson_nsw_rfs_incidents.feed_manager.NswRuralFireServ... | [
"async",
"def",
"test_setup_with_custom_location",
"(",
"hass",
")",
":",
"# Set up some mock feed entries for this test.",
"mock_entry_1",
"=",
"_generate_mock_feed_entry",
"(",
"\"1234\"",
",",
"\"Title 1\"",
",",
"20.5",
",",
"(",
"-",
"31.1",
",",
"150.1",
")",
")... | [
228,
0
] | [
257,
13
] | python | en | ['en', 'en', 'en'] | True |
test_add_item | (hass, sl_setup) | Test adding an item intent. | Test adding an item intent. | async def test_add_item(hass, sl_setup):
"""Test adding an item intent."""
response = await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "beer"}}
)
assert response.speech["plain"]["speech"] == "I've added beer to your shopping list" | [
"async",
"def",
"test_add_item",
"(",
"hass",
",",
"sl_setup",
")",
":",
"response",
"=",
"await",
"intent",
".",
"async_handle",
"(",
"hass",
",",
"\"test\"",
",",
"\"HassShoppingListAddItem\"",
",",
"{",
"\"item\"",
":",
"{",
"\"value\"",
":",
"\"beer\"",
... | [
7,
0
] | [
14,
88
] | python | en | ['en', 'lb', 'en'] | True |
test_recent_items_intent | (hass, sl_setup) | Test recent items. | Test recent items. | async def test_recent_items_intent(hass, sl_setup):
"""Test recent items."""
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "beer"}}
)
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "wine"}}
)
await ... | [
"async",
"def",
"test_recent_items_intent",
"(",
"hass",
",",
"sl_setup",
")",
":",
"await",
"intent",
".",
"async_handle",
"(",
"hass",
",",
"\"test\"",
",",
"\"HassShoppingListAddItem\"",
",",
"{",
"\"item\"",
":",
"{",
"\"value\"",
":",
"\"beer\"",
"}",
"}"... | [
17,
0
] | [
35,
5
] | python | en | ['en', 'en', 'en'] | True |
test_deprecated_api_get_all | (hass, hass_client, sl_setup) | Test the API. | Test the API. | async def test_deprecated_api_get_all(hass, hass_client, sl_setup):
"""Test the API."""
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "beer"}}
)
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "wine"}}
)... | [
"async",
"def",
"test_deprecated_api_get_all",
"(",
"hass",
",",
"hass_client",
",",
"sl_setup",
")",
":",
"await",
"intent",
".",
"async_handle",
"(",
"hass",
",",
"\"test\"",
",",
"\"HassShoppingListAddItem\"",
",",
"{",
"\"item\"",
":",
"{",
"\"value\"",
":",... | [
38,
0
] | [
57,
34
] | python | en | ['en', 'sm', 'en'] | True |
test_ws_get_items | (hass, hass_ws_client, sl_setup) | Test get shopping_list items websocket command. | Test get shopping_list items websocket command. | async def test_ws_get_items(hass, hass_ws_client, sl_setup):
"""Test get shopping_list items websocket command."""
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "beer"}}
)
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item... | [
"async",
"def",
"test_ws_get_items",
"(",
"hass",
",",
"hass_ws_client",
",",
"sl_setup",
")",
":",
"await",
"intent",
".",
"async_handle",
"(",
"hass",
",",
"\"test\"",
",",
"\"HassShoppingListAddItem\"",
",",
"{",
"\"item\"",
":",
"{",
"\"value\"",
":",
"\"b... | [
60,
0
] | [
84,
34
] | python | en | ['nl', 'lb', 'en'] | False |
test_deprecated_api_update | (hass, hass_client, sl_setup) | Test the API. | Test the API. | async def test_deprecated_api_update(hass, hass_client, sl_setup):
"""Test the API."""
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "beer"}}
)
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "wine"}}
)
... | [
"async",
"def",
"test_deprecated_api_update",
"(",
"hass",
",",
"hass_client",
",",
"sl_setup",
")",
":",
"await",
"intent",
".",
"async_handle",
"(",
"hass",
",",
"\"test\"",
",",
"\"HassShoppingListAddItem\"",
",",
"{",
"\"item\"",
":",
"{",
"\"value\"",
":",
... | [
87,
0
] | [
119,
68
] | python | en | ['en', 'sm', 'en'] | True |
test_ws_update_item | (hass, hass_ws_client, sl_setup) | Test update shopping_list item websocket command. | Test update shopping_list item websocket command. | async def test_ws_update_item(hass, hass_ws_client, sl_setup):
"""Test update shopping_list item websocket command."""
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "beer"}}
)
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"i... | [
"async",
"def",
"test_ws_update_item",
"(",
"hass",
",",
"hass_ws_client",
",",
"sl_setup",
")",
":",
"await",
"intent",
".",
"async_handle",
"(",
"hass",
",",
"\"test\"",
",",
"\"HassShoppingListAddItem\"",
",",
"{",
"\"item\"",
":",
"{",
"\"value\"",
":",
"\... | [
122,
0
] | [
161,
68
] | python | en | ['en', 'lb', 'en'] | True |
test_api_update_fails | (hass, hass_client, sl_setup) | Test the API. | Test the API. | async def test_api_update_fails(hass, hass_client, sl_setup):
"""Test the API."""
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "beer"}}
)
client = await hass_client()
resp = await client.post("/api/shopping_list/non_existing", json={"name": "soda"}... | [
"async",
"def",
"test_api_update_fails",
"(",
"hass",
",",
"hass_client",
",",
"sl_setup",
")",
":",
"await",
"intent",
".",
"async_handle",
"(",
"hass",
",",
"\"test\"",
",",
"\"HassShoppingListAddItem\"",
",",
"{",
"\"item\"",
":",
"{",
"\"value\"",
":",
"\"... | [
164,
0
] | [
179,
29
] | python | en | ['en', 'sm', 'en'] | True |
test_ws_update_item_fail | (hass, hass_ws_client, sl_setup) | Test failure of update shopping_list item websocket command. | Test failure of update shopping_list item websocket command. | async def test_ws_update_item_fail(hass, hass_ws_client, sl_setup):
"""Test failure of update shopping_list item websocket command."""
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "beer"}}
)
client = await hass_ws_client(hass)
await client.send_json(... | [
"async",
"def",
"test_ws_update_item_fail",
"(",
"hass",
",",
"hass_ws_client",
",",
"sl_setup",
")",
":",
"await",
"intent",
".",
"async_handle",
"(",
"hass",
",",
"\"test\"",
",",
"\"HassShoppingListAddItem\"",
",",
"{",
"\"item\"",
":",
"{",
"\"value\"",
":",... | [
182,
0
] | [
202,
34
] | python | en | ['en', 'lb', 'en'] | True |
test_deprecated_api_clear_completed | (hass, hass_client, sl_setup) | Test the API. | Test the API. | async def test_deprecated_api_clear_completed(hass, hass_client, sl_setup):
"""Test the API."""
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "beer"}}
)
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "wine"... | [
"async",
"def",
"test_deprecated_api_clear_completed",
"(",
"hass",
",",
"hass_client",
",",
"sl_setup",
")",
":",
"await",
"intent",
".",
"async_handle",
"(",
"hass",
",",
"\"test\"",
",",
"\"HassShoppingListAddItem\"",
",",
"{",
"\"item\"",
":",
"{",
"\"value\""... | [
205,
0
] | [
232,
73
] | python | en | ['en', 'sm', 'en'] | True |
test_ws_clear_items | (hass, hass_ws_client, sl_setup) | Test clearing shopping_list items websocket command. | Test clearing shopping_list items websocket command. | async def test_ws_clear_items(hass, hass_ws_client, sl_setup):
"""Test clearing shopping_list items websocket command."""
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", {"item": {"value": "beer"}}
)
await intent.async_handle(
hass, "test", "HassShoppingListAddItem", ... | [
"async",
"def",
"test_ws_clear_items",
"(",
"hass",
",",
"hass_ws_client",
",",
"sl_setup",
")",
":",
"await",
"intent",
".",
"async_handle",
"(",
"hass",
",",
"\"test\"",
",",
"\"HassShoppingListAddItem\"",
",",
"{",
"\"item\"",
":",
"{",
"\"value\"",
":",
"\... | [
235,
0
] | [
261,
73
] | python | en | ['en', 'en', 'en'] | True |
test_deprecated_api_create | (hass, hass_client, sl_setup) | Test the API. | Test the API. | async def test_deprecated_api_create(hass, hass_client, sl_setup):
"""Test the API."""
client = await hass_client()
resp = await client.post("/api/shopping_list/item", json={"name": "soda"})
assert resp.status == 200
data = await resp.json()
assert data["name"] == "soda"
assert data["compl... | [
"async",
"def",
"test_deprecated_api_create",
"(",
"hass",
",",
"hass_client",
",",
"sl_setup",
")",
":",
"client",
"=",
"await",
"hass_client",
"(",
")",
"resp",
"=",
"await",
"client",
".",
"post",
"(",
"\"/api/shopping_list/item\"",
",",
"json",
"=",
"{",
... | [
264,
0
] | [
278,
40
] | python | en | ['en', 'sm', 'en'] | True |
test_deprecated_api_create_fail | (hass, hass_client, sl_setup) | Test the API. | Test the API. | async def test_deprecated_api_create_fail(hass, hass_client, sl_setup):
"""Test the API."""
client = await hass_client()
resp = await client.post("/api/shopping_list/item", json={"name": 1234})
assert resp.status == 400
assert len(hass.data["shopping_list"].items) == 0 | [
"async",
"def",
"test_deprecated_api_create_fail",
"(",
"hass",
",",
"hass_client",
",",
"sl_setup",
")",
":",
"client",
"=",
"await",
"hass_client",
"(",
")",
"resp",
"=",
"await",
"client",
".",
"post",
"(",
"\"/api/shopping_list/item\"",
",",
"json",
"=",
"... | [
281,
0
] | [
288,
53
] | python | en | ['en', 'sm', 'en'] | True |
test_ws_add_item | (hass, hass_ws_client, sl_setup) | Test adding shopping_list item websocket command. | Test adding shopping_list item websocket command. | async def test_ws_add_item(hass, hass_ws_client, sl_setup):
"""Test adding shopping_list item websocket command."""
client = await hass_ws_client(hass)
await client.send_json({"id": 5, "type": "shopping_list/items/add", "name": "soda"})
msg = await client.receive_json()
assert msg["success"] is True... | [
"async",
"def",
"test_ws_add_item",
"(",
"hass",
",",
"hass_ws_client",
",",
"sl_setup",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"await",
"client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"shopp... | [
291,
0
] | [
303,
40
] | python | en | ['en', 'lb', 'en'] | True |
test_ws_add_item_fail | (hass, hass_ws_client, sl_setup) | Test adding shopping_list item failure websocket command. | Test adding shopping_list item failure websocket command. | async def test_ws_add_item_fail(hass, hass_ws_client, sl_setup):
"""Test adding shopping_list item failure websocket command."""
client = await hass_ws_client(hass)
await client.send_json({"id": 5, "type": "shopping_list/items/add", "name": 123})
msg = await client.receive_json()
assert msg["success... | [
"async",
"def",
"test_ws_add_item_fail",
"(",
"hass",
",",
"hass_ws_client",
",",
"sl_setup",
")",
":",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"await",
"client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"... | [
306,
0
] | [
312,
53
] | python | en | ['ms', 'lb', 'en'] | False |
test_services_registered | (hass: HomeAssistantType) | Test if all services are registered. | Test if all services are registered. | async def test_services_registered(hass: HomeAssistantType):
"""Test if all services are registered."""
with patch(
"homeassistant.components.synology_dsm.SynoApi.async_setup", return_value=True
), patch("homeassistant.components.synology_dsm.PLATFORMS", return_value=[]):
entry = MockConfigE... | [
"async",
"def",
"test_services_registered",
"(",
"hass",
":",
"HomeAssistantType",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.synology_dsm.SynoApi.async_setup\"",
",",
"return_value",
"=",
"True",
")",
",",
"patch",
"(",
"\"homeassistant.components.synology... | [
21,
0
] | [
40,
61
] | python | en | ['en', 'en', 'en'] | True |
setup_mock_onvif_camera | (
mock_onvif_camera,
with_h264=True,
two_profiles=False,
with_interfaces=True,
with_serial=True,
) | Prepare mock onvif.ONVIFCamera. | Prepare mock onvif.ONVIFCamera. | def setup_mock_onvif_camera(
mock_onvif_camera,
with_h264=True,
two_profiles=False,
with_interfaces=True,
with_serial=True,
):
"""Prepare mock onvif.ONVIFCamera."""
devicemgmt = MagicMock()
device_info = MagicMock()
device_info.SerialNumber = SERIAL_NUMBER if with_serial else None
... | [
"def",
"setup_mock_onvif_camera",
"(",
"mock_onvif_camera",
",",
"with_h264",
"=",
"True",
",",
"two_profiles",
"=",
"False",
",",
"with_interfaces",
"=",
"True",
",",
"with_serial",
"=",
"True",
",",
")",
":",
"devicemgmt",
"=",
"MagicMock",
"(",
")",
"device... | [
37,
0
] | [
87,
52
] | python | en | ['en', 'sk', 'hi'] | False |
setup_mock_discovery | (
mock_discovery, with_name=False, with_mac=False, two_devices=False
) | Prepare mock discovery result. | Prepare mock discovery result. | def setup_mock_discovery(
mock_discovery, with_name=False, with_mac=False, two_devices=False
):
"""Prepare mock discovery result."""
services = []
for item in DISCOVERY:
service = MagicMock()
service.getXAddrs = MagicMock(
return_value=[
f"http://{item[config_... | [
"def",
"setup_mock_discovery",
"(",
"mock_discovery",
",",
"with_name",
"=",
"False",
",",
"with_mac",
"=",
"False",
",",
"two_devices",
"=",
"False",
")",
":",
"services",
"=",
"[",
"]",
"for",
"item",
"in",
"DISCOVERY",
":",
"service",
"=",
"MagicMock",
... | [
90,
0
] | [
118,
42
] | python | en | ['en', 'en', 'en'] | True |
setup_mock_device | (mock_device) | Prepare mock ONVIFDevice. | Prepare mock ONVIFDevice. | def setup_mock_device(mock_device):
"""Prepare mock ONVIFDevice."""
mock_device.async_setup = AsyncMock(return_value=True)
def mock_constructor(hass, config):
"""Fake the controller constructor."""
return mock_device
mock_device.side_effect = mock_constructor | [
"def",
"setup_mock_device",
"(",
"mock_device",
")",
":",
"mock_device",
".",
"async_setup",
"=",
"AsyncMock",
"(",
"return_value",
"=",
"True",
")",
"def",
"mock_constructor",
"(",
"hass",
",",
"config",
")",
":",
"\"\"\"Fake the controller constructor.\"\"\"",
"re... | [
121,
0
] | [
129,
46
] | python | en | ['en', 'sl', 'it'] | False |
setup_onvif_integration | (
hass,
config=None,
options=None,
unique_id=MAC,
entry_id="1",
source="user",
) | Create an ONVIF config entry. | Create an ONVIF config entry. | async def setup_onvif_integration(
hass,
config=None,
options=None,
unique_id=MAC,
entry_id="1",
source="user",
):
"""Create an ONVIF config entry."""
if not config:
config = {
config_flow.CONF_NAME: NAME,
config_flow.CONF_HOST: HOST,
config_fl... | [
"async",
"def",
"setup_onvif_integration",
"(",
"hass",
",",
"config",
"=",
"None",
",",
"options",
"=",
"None",
",",
"unique_id",
"=",
"MAC",
",",
"entry_id",
"=",
"\"1\"",
",",
"source",
"=",
"\"user\"",
",",
")",
":",
"if",
"not",
"config",
":",
"co... | [
132,
0
] | [
174,
23
] | python | en | ['en', 'gd', 'en'] | True |
test_flow_discovered_devices | (hass) | Test that config flow works for discovered devices. | Test that config flow works for discovered devices. | async def test_flow_discovered_devices(hass):
"""Test that config flow works for discovered devices."""
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN, context={"source": "user"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] ==... | [
"async",
"def",
"test_flow_discovered_devices",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"config_flow",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\"",
"}",
")"... | [
177,
0
] | [
238,
9
] | python | en | ['en', 'en', 'en'] | True |
test_flow_discovered_devices_ignore_configured_manual_input | (hass) | Test that config flow discovery ignores configured devices. | Test that config flow discovery ignores configured devices. | async def test_flow_discovered_devices_ignore_configured_manual_input(hass):
"""Test that config flow discovery ignores configured devices."""
await setup_onvif_integration(hass)
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN, context={"source": "user"}
)
assert res... | [
"async",
"def",
"test_flow_discovered_devices_ignore_configured_manual_input",
"(",
"hass",
")",
":",
"await",
"setup_onvif_integration",
"(",
"hass",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"config_flow",
".",
... | [
241,
0
] | [
277,
50
] | python | en | ['en', 'en', 'en'] | True |
test_flow_discovery_ignore_existing_and_abort | (hass) | Test that config flow discovery ignores setup devices. | Test that config flow discovery ignores setup devices. | async def test_flow_discovery_ignore_existing_and_abort(hass):
"""Test that config flow discovery ignores setup devices."""
await setup_onvif_integration(hass)
await setup_onvif_integration(
hass,
config={
config_flow.CONF_NAME: DISCOVERY[1]["EPR"],
config_flow.CONF_H... | [
"async",
"def",
"test_flow_discovery_ignore_existing_and_abort",
"(",
"hass",
")",
":",
"await",
"setup_onvif_integration",
"(",
"hass",
")",
"await",
"setup_onvif_integration",
"(",
"hass",
",",
"config",
"=",
"{",
"config_flow",
".",
"CONF_NAME",
":",
"DISCOVERY",
... | [
280,
0
] | [
343,
66
] | python | en | ['en', 'en', 'en'] | True |
test_flow_manual_entry | (hass) | Test that config flow works for discovered devices. | Test that config flow works for discovered devices. | async def test_flow_manual_entry(hass):
"""Test that config flow works for discovered devices."""
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN, context={"source": "user"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user"... | [
"async",
"def",
"test_flow_manual_entry",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"config_flow",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\"",
"}",
")",
"a... | [
346,
0
] | [
412,
9
] | python | en | ['en', 'en', 'en'] | True |
test_flow_import_no_mac | (hass) | Test that config flow uses Serial Number when no MAC available. | Test that config flow uses Serial Number when no MAC available. | async def test_flow_import_no_mac(hass):
"""Test that config flow uses Serial Number when no MAC available."""
with patch(
"homeassistant.components.onvif.config_flow.get_device"
) as mock_onvif_camera, patch(
"homeassistant.components.onvif.ONVIFDevice"
) as mock_device, patch(
... | [
"async",
"def",
"test_flow_import_no_mac",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.onvif.config_flow.get_device\"",
")",
"as",
"mock_onvif_camera",
",",
"patch",
"(",
"\"homeassistant.components.onvif.ONVIFDevice\"",
")",
"as",
"mock_device",
... | [
415,
0
] | [
453,
9
] | python | en | ['en', 'en', 'en'] | True |
test_flow_import_no_mac_or_serial | (hass) | Test that config flow fails when no MAC or Serial Number available. | Test that config flow fails when no MAC or Serial Number available. | async def test_flow_import_no_mac_or_serial(hass):
"""Test that config flow fails when no MAC or Serial Number available."""
with patch(
"homeassistant.components.onvif.config_flow.get_device"
) as mock_onvif_camera:
setup_mock_onvif_camera(
mock_onvif_camera, with_interfaces=Fal... | [
"async",
"def",
"test_flow_import_no_mac_or_serial",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.onvif.config_flow.get_device\"",
")",
"as",
"mock_onvif_camera",
":",
"setup_mock_onvif_camera",
"(",
"mock_onvif_camera",
",",
"with_interfaces",
"="... | [
456,
0
] | [
478,
43
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.