Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
test_admin_change_password_no_user
(hass, hass_ws_client, owner_access_token)
Test that change password fails with unknown user.
Test that change password fails with unknown user.
async def test_admin_change_password_no_user(hass, hass_ws_client, owner_access_token): """Test that change password fails with unknown user.""" client = await hass_ws_client(hass, owner_access_token) await client.send_json( { "id": 6, "type": "config/auth_provider/homeassis...
[ "async", "def", "test_admin_change_password_no_user", "(", "hass", ",", "hass_ws_client", ",", "owner_access_token", ")", ":", "client", "=", "await", "hass_ws_client", "(", "hass", ",", "owner_access_token", ")", "await", "client", ".", "send_json", "(", "{", "\"...
[ 338, 0 ]
[ 353, 54 ]
python
en
['en', 'en', 'en']
True
test_admin_change_password_no_cred
( hass, hass_ws_client, owner_access_token, hass_admin_user )
Test that change password fails with unknown credential.
Test that change password fails with unknown credential.
async def test_admin_change_password_no_cred( hass, hass_ws_client, owner_access_token, hass_admin_user ): """Test that change password fails with unknown credential.""" client = await hass_ws_client(hass, owner_access_token) await client.send_json( { "id": 6, "type": "c...
[ "async", "def", "test_admin_change_password_no_cred", "(", "hass", ",", "hass_ws_client", ",", "owner_access_token", ",", "hass_admin_user", ")", ":", "client", "=", "await", "hass_ws_client", "(", "hass", ",", "owner_access_token", ")", "await", "client", ".", "sen...
[ 356, 0 ]
[ 373, 61 ]
python
en
['en', 'en', 'en']
True
test_admin_change_password
( hass, hass_ws_client, owner_access_token, auth_provider, test_user_credential, hass_admin_user, )
Test that owners can change any password.
Test that owners can change any password.
async def test_admin_change_password( hass, hass_ws_client, owner_access_token, auth_provider, test_user_credential, hass_admin_user, ): """Test that owners can change any password.""" await hass.auth.async_link_user(hass_admin_user, test_user_credential) client = await hass_ws_clie...
[ "async", "def", "test_admin_change_password", "(", "hass", ",", "hass_ws_client", ",", "owner_access_token", ",", "auth_provider", ",", "test_user_credential", ",", "hass_admin_user", ",", ")", ":", "await", "hass", ".", "auth", ".", "async_link_user", "(", "hass_ad...
[ 376, 0 ]
[ 401, 69 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up forked-daapd from a config entry.
Set up forked-daapd from a config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up forked-daapd from a config entry.""" host = config_entry.data[CONF_HOST] port = config_entry.data[CONF_PORT] password = config_entry.data[CONF_PASSWORD] forked_daapd_api = ForkedDaapdAPI( async_get_clientsession(h...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "host", "=", "config_entry", ".", "data", "[", "CONF_HOST", "]", "port", "=", "config_entry", ".", "data", "[", "CONF_PORT", "]", "password", "=", "co...
[ 64, 0 ]
[ 108, 28 ]
python
en
['en', 'en', 'en']
True
update_listener
(hass, entry)
Handle options update.
Handle options update.
async def update_listener(hass, entry): """Handle options update.""" async_dispatcher_send( hass, SIGNAL_CONFIG_OPTIONS_UPDATE.format(entry.entry_id), entry.options )
[ "async", "def", "update_listener", "(", "hass", ",", "entry", ")", ":", "async_dispatcher_send", "(", "hass", ",", "SIGNAL_CONFIG_OPTIONS_UPDATE", ".", "format", "(", "entry", ".", "entry_id", ")", ",", "entry", ".", "options", ")" ]
[ 111, 0 ]
[ 115, 5 ]
python
en
['en', 'nl', 'en']
True
ForkedDaapdZone.__init__
(self, api, output, entry_id)
Initialize the ForkedDaapd Zone.
Initialize the ForkedDaapd Zone.
def __init__(self, api, output, entry_id): """Initialize the ForkedDaapd Zone.""" self._api = api self._output = output self._output_id = output["id"] self._last_volume = DEFAULT_UNMUTE_VOLUME # used for mute/unmute self._available = True self._entry_id = entry_i...
[ "def", "__init__", "(", "self", ",", "api", ",", "output", ",", "entry_id", ")", ":", "self", ".", "_api", "=", "api", "self", ".", "_output", "=", "output", "self", ".", "_output_id", "=", "output", "[", "\"id\"", "]", "self", ".", "_last_volume", "...
[ 121, 4 ]
[ 128, 33 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdZone.async_added_to_hass
(self)
Use lifecycle hooks.
Use lifecycle hooks.
async def async_added_to_hass(self): """Use lifecycle hooks.""" self.async_on_remove( async_dispatcher_connect( self.hass, SIGNAL_UPDATE_OUTPUTS.format(self._entry_id), self._async_update_output_callback, ) )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "SIGNAL_UPDATE_OUTPUTS", ".", "format", "(", "self", ".", "_entry_id", ")", ",", "self", ".", "_async_...
[ 130, 4 ]
[ 138, 9 ]
python
en
['en', 'zu', 'en']
True
ForkedDaapdZone.unique_id
(self)
Return unique ID.
Return unique ID.
def unique_id(self): """Return unique ID.""" return f"{self._entry_id}-{self._output_id}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._entry_id}-{self._output_id}\"" ]
[ 151, 4 ]
[ 153, 52 ]
python
en
['fr', 'la', 'en']
False
ForkedDaapdZone.should_poll
(self)
Entity pushes its state to HA.
Entity pushes its state to HA.
def should_poll(self) -> bool: """Entity pushes its state to HA.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 156, 4 ]
[ 158, 20 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdZone.async_toggle
(self)
Toggle the power on the zone.
Toggle the power on the zone.
async def async_toggle(self): """Toggle the power on the zone.""" if self.state == STATE_OFF: await self.async_turn_on() else: await self.async_turn_off()
[ "async", "def", "async_toggle", "(", "self", ")", ":", "if", "self", ".", "state", "==", "STATE_OFF", ":", "await", "self", ".", "async_turn_on", "(", ")", "else", ":", "await", "self", ".", "async_turn_off", "(", ")" ]
[ 160, 4 ]
[ 165, 39 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdZone.available
(self)
Return whether the zone is available.
Return whether the zone is available.
def available(self) -> bool: """Return whether the zone is available.""" return self._available
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_available" ]
[ 168, 4 ]
[ 170, 30 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdZone.async_turn_on
(self)
Enable the output.
Enable the output.
async def async_turn_on(self): """Enable the output.""" await self._api.change_output(self._output_id, selected=True)
[ "async", "def", "async_turn_on", "(", "self", ")", ":", "await", "self", ".", "_api", ".", "change_output", "(", "self", ".", "_output_id", ",", "selected", "=", "True", ")" ]
[ 172, 4 ]
[ 174, 69 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdZone.async_turn_off
(self)
Disable the output.
Disable the output.
async def async_turn_off(self): """Disable the output.""" await self._api.change_output(self._output_id, selected=False)
[ "async", "def", "async_turn_off", "(", "self", ")", ":", "await", "self", ".", "_api", ".", "change_output", "(", "self", ".", "_output_id", ",", "selected", "=", "False", ")" ]
[ 176, 4 ]
[ 178, 70 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdZone.name
(self)
Return the name of the zone.
Return the name of the zone.
def name(self): """Return the name of the zone.""" return f"{FD_NAME} output ({self._output['name']})"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{FD_NAME} output ({self._output['name']})\"" ]
[ 181, 4 ]
[ 183, 59 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdZone.state
(self)
State of the zone.
State of the zone.
def state(self): """State of the zone.""" if self._output["selected"]: return STATE_ON return STATE_OFF
[ "def", "state", "(", "self", ")", ":", "if", "self", ".", "_output", "[", "\"selected\"", "]", ":", "return", "STATE_ON", "return", "STATE_OFF" ]
[ 186, 4 ]
[ 190, 24 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdZone.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).""" return self._output["volume"] / 100
[ "def", "volume_level", "(", "self", ")", ":", "return", "self", ".", "_output", "[", "\"volume\"", "]", "/", "100" ]
[ 193, 4 ]
[ 195, 43 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdZone.is_volume_muted
(self)
Boolean if volume is currently muted.
Boolean if volume is currently muted.
def is_volume_muted(self): """Boolean if volume is currently muted.""" return self._output["volume"] == 0
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "_output", "[", "\"volume\"", "]", "==", "0" ]
[ 198, 4 ]
[ 200, 42 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdZone.async_mute_volume
(self, mute)
Mute the volume.
Mute the volume.
async def async_mute_volume(self, mute): """Mute the volume.""" if mute: if self.volume_level == 0: return self._last_volume = self.volume_level # store volume level to restore later target_volume = 0 else: target_volume = self._la...
[ "async", "def", "async_mute_volume", "(", "self", ",", "mute", ")", ":", "if", "mute", ":", "if", "self", ".", "volume_level", "==", "0", ":", "return", "self", ".", "_last_volume", "=", "self", ".", "volume_level", "# store volume level to restore later", "ta...
[ 202, 4 ]
[ 211, 63 ]
python
en
['en', 'sn', 'en']
True
ForkedDaapdZone.async_set_volume_level
(self, volume)
Set volume - input range [0,1].
Set volume - input range [0,1].
async def async_set_volume_level(self, volume): """Set volume - input range [0,1].""" await self._api.set_volume(volume=volume * 100, output_id=self._output_id)
[ "async", "def", "async_set_volume_level", "(", "self", ",", "volume", ")", ":", "await", "self", ".", "_api", ".", "set_volume", "(", "volume", "=", "volume", "*", "100", ",", "output_id", "=", "self", ".", "_output_id", ")" ]
[ 213, 4 ]
[ 215, 82 ]
python
en
['nl', 'fi', 'en']
False
ForkedDaapdZone.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 SUPPORTED_FEATURES_ZONE
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORTED_FEATURES_ZONE" ]
[ 218, 4 ]
[ 220, 38 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.__init__
( self, clientsession, api, ip_address, api_port, api_password, config_entry )
Initialize the ForkedDaapd Master Device.
Initialize the ForkedDaapd Master Device.
def __init__( self, clientsession, api, ip_address, api_port, api_password, config_entry ): """Initialize the ForkedDaapd Master Device.""" self._api = api self._player = STARTUP_DATA[ "player" ] # _player, _outputs, and _queue are loaded straight from api ...
[ "def", "__init__", "(", "self", ",", "clientsession", ",", "api", ",", "ip_address", ",", "api_port", ",", "api_password", ",", "config_entry", ")", ":", "self", ".", "_api", "=", "api", "self", ".", "_player", "=", "STARTUP_DATA", "[", "\"player\"", "]", ...
[ 226, 4 ]
[ 260, 34 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.async_added_to_hass
(self)
Use lifecycle hooks.
Use lifecycle hooks.
async def async_added_to_hass(self): """Use lifecycle hooks.""" self.async_on_remove( async_dispatcher_connect( self.hass, SIGNAL_UPDATE_PLAYER.format(self._config_entry.entry_id), self._update_player, ) ) self.async...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "SIGNAL_UPDATE_PLAYER", ".", "format", "(", "self", ".", "_config_entry", ".", "entry_id", ")", ",", "...
[ 262, 4 ]
[ 305, 9 ]
python
en
['en', 'zu', 'en']
True
ForkedDaapdMaster._update_callback
(self, available)
Call update method.
Call update method.
def _update_callback(self, available): """Call update method.""" self._available = available self.async_write_ha_state()
[ "def", "_update_callback", "(", "self", ",", "available", ")", ":", "self", ".", "_available", "=", "available", "self", ".", "async_write_ha_state", "(", ")" ]
[ 308, 4 ]
[ 311, 35 ]
python
en
['en', 'sn', 'en']
True
ForkedDaapdMaster.update_options
(self, options)
Update forked-daapd server options.
Update forked-daapd server options.
def update_options(self, options): """Update forked-daapd server options.""" if CONF_LIBRESPOT_JAVA_PORT in options: self._pipe_control_api["librespot-java"] = LibrespotJavaAPI( self._clientsession, self._ip_address, options[CONF_LIBRESPOT_JAVA_PORT] ) if ...
[ "def", "update_options", "(", "self", ",", "options", ")", ":", "if", "CONF_LIBRESPOT_JAVA_PORT", "in", "options", ":", "self", ".", "_pipe_control_api", "[", "\"librespot-java\"", "]", "=", "LibrespotJavaAPI", "(", "self", ".", "_clientsession", ",", "self", "....
[ 314, 4 ]
[ 326, 61 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.unique_id
(self)
Return unique ID.
Return unique ID.
def unique_id(self): """Return unique ID.""" return self._config_entry.entry_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_config_entry", ".", "entry_id" ]
[ 399, 4 ]
[ 401, 42 ]
python
en
['fr', 'la', 'en']
False
ForkedDaapdMaster.should_poll
(self)
Entity pushes its state to HA.
Entity pushes its state to HA.
def should_poll(self) -> bool: """Entity pushes its state to HA.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 404, 4 ]
[ 406, 20 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.available
(self)
Return whether the master is available.
Return whether the master is available.
def available(self) -> bool: """Return whether the master is available.""" return self._available
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_available" ]
[ 409, 4 ]
[ 411, 30 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.async_turn_on
(self)
Restore the last on outputs state.
Restore the last on outputs state.
async def async_turn_on(self): """Restore the last on outputs state.""" # restore state await self._api.set_volume(volume=self._last_volume * 100) if self._last_outputs: futures = [] for output in self._last_outputs: futures.append( ...
[ "async", "def", "async_turn_on", "(", "self", ")", ":", "# restore state", "await", "self", ".", "_api", ".", "set_volume", "(", "volume", "=", "self", ".", "_last_volume", "*", "100", ")", "if", "self", ".", "_last_outputs", ":", "futures", "=", "[", "]...
[ 413, 4 ]
[ 431, 13 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.async_turn_off
(self)
Pause player and store outputs state.
Pause player and store outputs state.
async def async_turn_off(self): """Pause player and store outputs state.""" await self.async_media_pause() self._last_outputs = self._outputs if any(output["selected"] for output in self._outputs): await self._api.set_enabled_outputs([])
[ "async", "def", "async_turn_off", "(", "self", ")", ":", "await", "self", ".", "async_media_pause", "(", ")", "self", ".", "_last_outputs", "=", "self", ".", "_outputs", "if", "any", "(", "output", "[", "\"selected\"", "]", "for", "output", "in", "self", ...
[ 433, 4 ]
[ 438, 51 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.async_toggle
(self)
Toggle the power on the device. Default media player component method counts idle as off. We consider idle to be on but just not playing.
Toggle the power on the device.
async def async_toggle(self): """Toggle the power on the device. Default media player component method counts idle as off. We consider idle to be on but just not playing. """ if self.state == STATE_OFF: await self.async_turn_on() else: await self....
[ "async", "def", "async_toggle", "(", "self", ")", ":", "if", "self", ".", "state", "==", "STATE_OFF", ":", "await", "self", ".", "async_turn_on", "(", ")", "else", ":", "await", "self", ".", "async_turn_off", "(", ")" ]
[ 440, 4 ]
[ 449, 39 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return f"{FD_NAME} server"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{FD_NAME} server\"" ]
[ 452, 4 ]
[ 454, 34 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.state
(self)
State of the player.
State of the player.
def state(self): """State of the player.""" if self._player["state"] == "play": return STATE_PLAYING if self._player["state"] == "pause": return STATE_PAUSED if not any(output["selected"] for output in self._outputs): return STATE_OFF if self._...
[ "def", "state", "(", "self", ")", ":", "if", "self", ".", "_player", "[", "\"state\"", "]", "==", "\"play\"", ":", "return", "STATE_PLAYING", "if", "self", ".", "_player", "[", "\"state\"", "]", "==", "\"pause\"", ":", "return", "STATE_PAUSED", "if", "no...
[ 457, 4 ]
[ 466, 29 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.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).""" return self._player["volume"] / 100
[ "def", "volume_level", "(", "self", ")", ":", "return", "self", ".", "_player", "[", "\"volume\"", "]", "/", "100" ]
[ 469, 4 ]
[ 471, 43 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.is_volume_muted
(self)
Boolean if volume is currently muted.
Boolean if volume is currently muted.
def is_volume_muted(self): """Boolean if volume is currently muted.""" return self._player["volume"] == 0
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "_player", "[", "\"volume\"", "]", "==", "0" ]
[ 474, 4 ]
[ 476, 42 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.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.""" return self._player["item_id"]
[ "def", "media_content_id", "(", "self", ")", ":", "return", "self", ".", "_player", "[", "\"item_id\"", "]" ]
[ 479, 4 ]
[ 481, 38 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.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.""" return self._track_info["media_kind"]
[ "def", "media_content_type", "(", "self", ")", ":", "return", "self", ".", "_track_info", "[", "\"media_kind\"", "]" ]
[ 484, 4 ]
[ 486, 45 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.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["item_length_ms"] / 1000
[ "def", "media_duration", "(", "self", ")", ":", "return", "self", ".", "_player", "[", "\"item_length_ms\"", "]", "/", "1000" ]
[ 489, 4 ]
[ 491, 52 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.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["item_progress_ms"] / 1000
[ "def", "media_position", "(", "self", ")", ":", "return", "self", ".", "_player", "[", "\"item_progress_ms\"", "]", "/", "1000" ]
[ 494, 4 ]
[ 496, 54 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.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.""" return self._player_last_updated
[ "def", "media_position_updated_at", "(", "self", ")", ":", "return", "self", ".", "_player_last_updated" ]
[ 499, 4 ]
[ 501, 40 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.media_title
(self)
Title of current playing media.
Title of current playing media.
def media_title(self): """Title of current playing media.""" # Use album field when data_kind is url # https://github.com/ejurgensen/forked-daapd/issues/351 if self._track_info["data_kind"] == "url": return self._track_info["album"] return self._track_info["title"]
[ "def", "media_title", "(", "self", ")", ":", "# Use album field when data_kind is url", "# https://github.com/ejurgensen/forked-daapd/issues/351", "if", "self", ".", "_track_info", "[", "\"data_kind\"", "]", "==", "\"url\"", ":", "return", "self", ".", "_track_info", "[",...
[ 504, 4 ]
[ 510, 40 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.media_artist
(self)
Artist of current playing media, music track only.
Artist of current playing media, music track only.
def media_artist(self): """Artist of current playing media, music track only.""" return self._track_info["artist"]
[ "def", "media_artist", "(", "self", ")", ":", "return", "self", ".", "_track_info", "[", "\"artist\"", "]" ]
[ 513, 4 ]
[ 515, 41 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.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): """Album name of current playing media, music track only.""" # Use title field when data_kind is url # https://github.com/ejurgensen/forked-daapd/issues/351 if self._track_info["data_kind"] == "url": return self._track_info["title"] return ...
[ "def", "media_album_name", "(", "self", ")", ":", "# Use title field when data_kind is url", "# https://github.com/ejurgensen/forked-daapd/issues/351", "if", "self", ".", "_track_info", "[", "\"data_kind\"", "]", "==", "\"url\"", ":", "return", "self", ".", "_track_info", ...
[ 518, 4 ]
[ 524, 40 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.media_album_artist
(self)
Album artist of current playing media, music track only.
Album artist of current playing media, music track only.
def media_album_artist(self): """Album artist of current playing media, music track only.""" return self._track_info["album_artist"]
[ "def", "media_album_artist", "(", "self", ")", ":", "return", "self", ".", "_track_info", "[", "\"album_artist\"", "]" ]
[ 527, 4 ]
[ 529, 47 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.media_track
(self)
Track number of current playing media, music track only.
Track number of current playing media, music track only.
def media_track(self): """Track number of current playing media, music track only.""" return self._track_info["track_number"]
[ "def", "media_track", "(", "self", ")", ":", "return", "self", ".", "_track_info", "[", "\"track_number\"", "]" ]
[ 532, 4 ]
[ 534, 47 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.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\"", "]" ]
[ 537, 4 ]
[ 539, 38 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.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 SUPPORTED_FEATURES
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORTED_FEATURES" ]
[ 542, 4 ]
[ 544, 33 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.source
(self)
Name of the current input source.
Name of the current input source.
def source(self): """Name of the current input source.""" return self._source
[ "def", "source", "(", "self", ")", ":", "return", "self", ".", "_source" ]
[ 547, 4 ]
[ 549, 27 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.source_list
(self)
List of available input sources.
List of available input sources.
def source_list(self): """List of available input sources.""" return [*self._sources_uris]
[ "def", "source_list", "(", "self", ")", ":", "return", "[", "*", "self", ".", "_sources_uris", "]" ]
[ 552, 4 ]
[ 554, 36 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.async_mute_volume
(self, mute)
Mute the volume.
Mute the volume.
async def async_mute_volume(self, mute): """Mute the volume.""" if mute: if self.volume_level == 0: return self._last_volume = self.volume_level # store volume level to restore later target_volume = 0 else: target_volume = self._la...
[ "async", "def", "async_mute_volume", "(", "self", ",", "mute", ")", ":", "if", "mute", ":", "if", "self", ".", "volume_level", "==", "0", ":", "return", "self", ".", "_last_volume", "=", "self", ".", "volume_level", "# store volume level to restore later", "ta...
[ 556, 4 ]
[ 565, 62 ]
python
en
['en', 'sn', 'en']
True
ForkedDaapdMaster.async_set_volume_level
(self, volume)
Set volume - input range [0,1].
Set volume - input range [0,1].
async def async_set_volume_level(self, volume): """Set volume - input range [0,1].""" await self._api.set_volume(volume=volume * 100)
[ "async", "def", "async_set_volume_level", "(", "self", ",", "volume", ")", ":", "await", "self", ".", "_api", ".", "set_volume", "(", "volume", "=", "volume", "*", "100", ")" ]
[ 567, 4 ]
[ 569, 55 ]
python
en
['nl', 'fi', 'en']
False
ForkedDaapdMaster.async_media_play
(self)
Start playback.
Start playback.
async def async_media_play(self): """Start playback.""" if self._use_pipe_control(): await self._pipe_call(self._use_pipe_control(), "async_media_play") else: await self._api.start_playback()
[ "async", "def", "async_media_play", "(", "self", ")", ":", "if", "self", ".", "_use_pipe_control", "(", ")", ":", "await", "self", ".", "_pipe_call", "(", "self", ".", "_use_pipe_control", "(", ")", ",", "\"async_media_play\"", ")", "else", ":", "await", "...
[ 571, 4 ]
[ 576, 44 ]
python
en
['en', 'ny', 'en']
False
ForkedDaapdMaster.async_media_pause
(self)
Pause playback.
Pause playback.
async def async_media_pause(self): """Pause playback.""" if self._use_pipe_control(): await self._pipe_call(self._use_pipe_control(), "async_media_pause") else: await self._api.pause_playback()
[ "async", "def", "async_media_pause", "(", "self", ")", ":", "if", "self", ".", "_use_pipe_control", "(", ")", ":", "await", "self", ".", "_pipe_call", "(", "self", ".", "_use_pipe_control", "(", ")", ",", "\"async_media_pause\"", ")", "else", ":", "await", ...
[ 578, 4 ]
[ 583, 44 ]
python
de
['de', 'lt', 'en']
False
ForkedDaapdMaster.async_media_stop
(self)
Stop playback.
Stop playback.
async def async_media_stop(self): """Stop playback.""" if self._use_pipe_control(): await self._pipe_call(self._use_pipe_control(), "async_media_stop") else: await self._api.stop_playback()
[ "async", "def", "async_media_stop", "(", "self", ")", ":", "if", "self", ".", "_use_pipe_control", "(", ")", ":", "await", "self", ".", "_pipe_call", "(", "self", ".", "_use_pipe_control", "(", ")", ",", "\"async_media_stop\"", ")", "else", ":", "await", "...
[ 585, 4 ]
[ 590, 43 ]
python
en
['en', 'en', 'en']
False
ForkedDaapdMaster.async_media_previous_track
(self)
Skip to previous track.
Skip to previous track.
async def async_media_previous_track(self): """Skip to previous track.""" if self._use_pipe_control(): await self._pipe_call( self._use_pipe_control(), "async_media_previous_track" ) else: await self._api.previous_track()
[ "async", "def", "async_media_previous_track", "(", "self", ")", ":", "if", "self", ".", "_use_pipe_control", "(", ")", ":", "await", "self", ".", "_pipe_call", "(", "self", ".", "_use_pipe_control", "(", ")", ",", "\"async_media_previous_track\"", ")", "else", ...
[ 592, 4 ]
[ 599, 44 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.async_media_next_track
(self)
Skip to next track.
Skip to next track.
async def async_media_next_track(self): """Skip to next track.""" if self._use_pipe_control(): await self._pipe_call(self._use_pipe_control(), "async_media_next_track") else: await self._api.next_track()
[ "async", "def", "async_media_next_track", "(", "self", ")", ":", "if", "self", ".", "_use_pipe_control", "(", ")", ":", "await", "self", ".", "_pipe_call", "(", "self", ".", "_use_pipe_control", "(", ")", ",", "\"async_media_next_track\"", ")", "else", ":", ...
[ 601, 4 ]
[ 606, 40 ]
python
en
['en', 'bg-Latn', 'en']
True
ForkedDaapdMaster.async_media_seek
(self, position)
Seek to position.
Seek to position.
async def async_media_seek(self, position): """Seek to position.""" await self._api.seek(position_ms=position * 1000)
[ "async", "def", "async_media_seek", "(", "self", ",", "position", ")", ":", "await", "self", ".", "_api", ".", "seek", "(", "position_ms", "=", "position", "*", "1000", ")" ]
[ 608, 4 ]
[ 610, 57 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.async_clear_playlist
(self)
Clear playlist.
Clear playlist.
async def async_clear_playlist(self): """Clear playlist.""" await self._api.clear_queue()
[ "async", "def", "async_clear_playlist", "(", "self", ")", ":", "await", "self", ".", "_api", ".", "clear_queue", "(", ")" ]
[ 612, 4 ]
[ 614, 37 ]
python
en
['en', 'en', 'en']
False
ForkedDaapdMaster.async_set_shuffle
(self, shuffle)
Enable/disable shuffle mode.
Enable/disable shuffle mode.
async def async_set_shuffle(self, shuffle): """Enable/disable shuffle mode.""" await self._api.shuffle(shuffle)
[ "async", "def", "async_set_shuffle", "(", "self", ",", "shuffle", ")", ":", "await", "self", ".", "_api", ".", "shuffle", "(", "shuffle", ")" ]
[ 616, 4 ]
[ 618, 40 ]
python
en
['en', 'st', 'en']
True
ForkedDaapdMaster.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.""" url = self._track_info.get("artwork_url") if url: url = self._api.full_url(url) return url
[ "def", "media_image_url", "(", "self", ")", ":", "url", "=", "self", ".", "_track_info", ".", "get", "(", "\"artwork_url\"", ")", "if", "url", ":", "url", "=", "self", ".", "_api", ".", "full_url", "(", "url", ")", "return", "url" ]
[ 621, 4 ]
[ 626, 18 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster._pause_and_wait_for_callback
(self)
Send pause and wait for the pause callback to be received.
Send pause and wait for the pause callback to be received.
async def _pause_and_wait_for_callback(self): """Send pause and wait for the pause callback to be received.""" self._pause_requested = True await self.async_media_pause() try: await asyncio.wait_for( self._paused_event.wait(), timeout=CALLBACK_TIMEOUT ...
[ "async", "def", "_pause_and_wait_for_callback", "(", "self", ")", ":", "self", ".", "_pause_requested", "=", "True", "await", "self", ".", "async_media_pause", "(", ")", "try", ":", "await", "asyncio", ".", "wait_for", "(", "self", ".", "_paused_event", ".", ...
[ 643, 4 ]
[ 653, 34 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdMaster.async_play_media
(self, media_type, media_id, **kwargs)
Play a URI.
Play a URI.
async def async_play_media(self, media_type, media_id, **kwargs): """Play a URI.""" if media_type == MEDIA_TYPE_MUSIC: saved_state = self.state # save play state saved_mute = self.is_volume_muted sleep_future = asyncio.create_task( asyncio.sleep(self....
[ "async", "def", "async_play_media", "(", "self", ",", "media_type", ",", "media_id", ",", "*", "*", "kwargs", ")", ":", "if", "media_type", "==", "MEDIA_TYPE_MUSIC", ":", "saved_state", "=", "self", ".", "state", "# save play state", "saved_mute", "=", "self",...
[ 655, 4 ]
[ 720, 70 ]
python
en
['en', 'zh', 'en']
True
ForkedDaapdMaster.async_select_source
(self, source)
Change source. Source name reflects whether in default mode or pipe mode. Selecting playlists/clear sets the playlists/clears but ends up in default mode.
Change source.
async def async_select_source(self, source): """Change source. Source name reflects whether in default mode or pipe mode. Selecting playlists/clear sets the playlists/clears but ends up in default mode. """ if source == self._source: return if self._use_pipe...
[ "async", "def", "async_select_source", "(", "self", ",", "source", ")", ":", "if", "source", "==", "self", ".", "_source", ":", "return", "if", "self", ".", "_use_pipe_control", "(", ")", ":", "# if pipe was playing, we need to stop it first", "await", "self", "...
[ 722, 4 ]
[ 740, 35 ]
python
en
['fr', 'sw', 'en']
False
ForkedDaapdMaster._use_pipe_control
(self)
Return which pipe control from KNOWN_PIPES to use.
Return which pipe control from KNOWN_PIPES to use.
def _use_pipe_control(self): """Return which pipe control from KNOWN_PIPES to use.""" if self._source[-7:] == " (pipe)": return self._source[:-7] return ""
[ "def", "_use_pipe_control", "(", "self", ")", ":", "if", "self", ".", "_source", "[", "-", "7", ":", "]", "==", "\" (pipe)\"", ":", "return", "self", ".", "_source", "[", ":", "-", "7", "]", "return", "\"\"" ]
[ 742, 4 ]
[ 746, 17 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdUpdater.__init__
(self, hass, api, entry_id)
Initialize.
Initialize.
def __init__(self, hass, api, entry_id): """Initialize.""" self.hass = hass self._api = api self.websocket_handler = None self._all_output_ids = set() self._entry_id = entry_id
[ "def", "__init__", "(", "self", ",", "hass", ",", "api", ",", "entry_id", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "_api", "=", "api", "self", ".", "websocket_handler", "=", "None", "self", ".", "_all_output_ids", "=", "set", "(", ")"...
[ 760, 4 ]
[ 766, 33 ]
python
en
['en', 'en', 'it']
False
ForkedDaapdUpdater.async_init
(self)
Perform async portion of class initialization.
Perform async portion of class initialization.
async def async_init(self): """Perform async portion of class initialization.""" server_config = await self._api.get_request("config") websocket_port = server_config.get("websocket_port") if websocket_port: self.websocket_handler = asyncio.create_task( self._a...
[ "async", "def", "async_init", "(", "self", ")", ":", "server_config", "=", "await", "self", ".", "_api", ".", "get_request", "(", "\"config\"", ")", "websocket_port", "=", "server_config", ".", "get", "(", "\"websocket_port\"", ")", "if", "websocket_port", ":"...
[ 768, 4 ]
[ 783, 51 ]
python
en
['en', 'en', 'en']
True
ForkedDaapdUpdater._update
(self, update_types)
Private update method.
Private update method.
async def _update(self, update_types): """Private update method.""" update_types = set(update_types) update_events = {} _LOGGER.debug("Updating %s", update_types) if ( "queue" in update_types ): # update queue, queue before player for async_play_media ...
[ "async", "def", "_update", "(", "self", ",", "update_types", ")", ":", "update_types", "=", "set", "(", "update_types", ")", "update_events", "=", "{", "}", "_LOGGER", ".", "debug", "(", "\"Updating %s\"", ",", "update_types", ")", "if", "(", "\"queue\"", ...
[ 793, 4 ]
[ 861, 13 ]
python
en
['en', 'la', 'en']
True
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 18, 0 ]
[ 20, 37 ]
python
en
['en', 'fy', 'en']
True
entity_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def entity_reg(hass): """Return an empty, loaded, registry.""" return mock_registry(hass)
[ "def", "entity_reg", "(", "hass", ")", ":", "return", "mock_registry", "(", "hass", ")" ]
[ 24, 0 ]
[ 26, 30 ]
python
en
['en', 'fy', 'en']
True
test_websocket_get_actions
(hass, hass_ws_client, device_reg, entity_reg)
Test we get the expected conditions from a light through websocket.
Test we get the expected conditions from a light through websocket.
async def test_websocket_get_actions(hass, hass_ws_client, device_reg, entity_reg): """Test we get the expected conditions from a light through websocket.""" await async_setup_component(hass, "device_automation", {}) config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) ...
[ "async", "def", "test_websocket_get_actions", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "config_entry", "=", "MockConfigEntry",...
[ 39, 0 ]
[ 80, 49 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_conditions
(hass, hass_ws_client, device_reg, entity_reg)
Test we get the expected conditions from a light through websocket.
Test we get the expected conditions from a light through websocket.
async def test_websocket_get_conditions(hass, hass_ws_client, device_reg, entity_reg): """Test we get the expected conditions from a light through websocket.""" await async_setup_component(hass, "device_automation", {}) config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass...
[ "async", "def", "test_websocket_get_conditions", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "config_entry", "=", "MockConfigEntr...
[ 83, 0 ]
[ 124, 55 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_triggers
(hass, hass_ws_client, device_reg, entity_reg)
Test we get the expected triggers from a light through websocket.
Test we get the expected triggers from a light through websocket.
async def test_websocket_get_triggers(hass, hass_ws_client, device_reg, entity_reg): """Test we get the expected triggers from a light through websocket.""" await async_setup_component(hass, "device_automation", {}) config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) ...
[ "async", "def", "test_websocket_get_triggers", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "config_entry", "=", "MockConfigEntry"...
[ 127, 0 ]
[ 168, 51 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_action_capabilities
( hass, hass_ws_client, device_reg, entity_reg )
Test we get the expected action capabilities for an alarm through websocket.
Test we get the expected action capabilities for an alarm through websocket.
async def test_websocket_get_action_capabilities( hass, hass_ws_client, device_reg, entity_reg ): """Test we get the expected action capabilities for an alarm through websocket.""" await async_setup_component(hass, "device_automation", {}) config_entry = MockConfigEntry(domain="test", data={}) confi...
[ "async", "def", "test_websocket_get_action_capabilities", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "config_entry", "=", "MockC...
[ 171, 0 ]
[ 225, 19 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_bad_action_capabilities
( hass, hass_ws_client, device_reg, entity_reg )
Test we get no action capabilities for a non existing domain.
Test we get no action capabilities for a non existing domain.
async def test_websocket_get_bad_action_capabilities( hass, hass_ws_client, device_reg, entity_reg ): """Test we get no action capabilities for a non existing domain.""" await async_setup_component(hass, "device_automation", {}) expected_capabilities = {} client = await hass_ws_client(hass) awa...
[ "async", "def", "test_websocket_get_bad_action_capabilities", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "expected_capabilities", ...
[ 228, 0 ]
[ 248, 48 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_no_action_capabilities
( hass, hass_ws_client, device_reg, entity_reg )
Test we get no action capabilities for a domain with no device action capabilities.
Test we get no action capabilities for a domain with no device action capabilities.
async def test_websocket_get_no_action_capabilities( hass, hass_ws_client, device_reg, entity_reg ): """Test we get no action capabilities for a domain with no device action capabilities.""" await async_setup_component(hass, "device_automation", {}) expected_capabilities = {} client = await hass_ws...
[ "async", "def", "test_websocket_get_no_action_capabilities", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "expected_capabilities", "...
[ 251, 0 ]
[ 271, 48 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_condition_capabilities
( hass, hass_ws_client, device_reg, entity_reg )
Test we get the expected condition capabilities for a light through websocket.
Test we get the expected condition capabilities for a light through websocket.
async def test_websocket_get_condition_capabilities( hass, hass_ws_client, device_reg, entity_reg ): """Test we get the expected condition capabilities for a light through websocket.""" await async_setup_component(hass, "device_automation", {}) config_entry = MockConfigEntry(domain="test", data={}) ...
[ "async", "def", "test_websocket_get_condition_capabilities", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "config_entry", "=", "Mo...
[ 274, 0 ]
[ 323, 19 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_bad_condition_capabilities
( hass, hass_ws_client, device_reg, entity_reg )
Test we get no condition capabilities for a non existing domain.
Test we get no condition capabilities for a non existing domain.
async def test_websocket_get_bad_condition_capabilities( hass, hass_ws_client, device_reg, entity_reg ): """Test we get no condition capabilities for a non existing domain.""" await async_setup_component(hass, "device_automation", {}) expected_capabilities = {} client = await hass_ws_client(hass) ...
[ "async", "def", "test_websocket_get_bad_condition_capabilities", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "expected_capabilities",...
[ 326, 0 ]
[ 346, 48 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_no_condition_capabilities
( hass, hass_ws_client, device_reg, entity_reg )
Test we get no condition capabilities for a domain with no device condition capabilities.
Test we get no condition capabilities for a domain with no device condition capabilities.
async def test_websocket_get_no_condition_capabilities( hass, hass_ws_client, device_reg, entity_reg ): """Test we get no condition capabilities for a domain with no device condition capabilities.""" await async_setup_component(hass, "device_automation", {}) expected_capabilities = {} client = awai...
[ "async", "def", "test_websocket_get_no_condition_capabilities", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "expected_capabilities", ...
[ 349, 0 ]
[ 369, 48 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_trigger_capabilities
( hass, hass_ws_client, device_reg, entity_reg )
Test we get the expected trigger capabilities for a light through websocket.
Test we get the expected trigger capabilities for a light through websocket.
async def test_websocket_get_trigger_capabilities( hass, hass_ws_client, device_reg, entity_reg ): """Test we get the expected trigger capabilities for a light through websocket.""" await async_setup_component(hass, "device_automation", {}) config_entry = MockConfigEntry(domain="test", data={}) conf...
[ "async", "def", "test_websocket_get_trigger_capabilities", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "config_entry", "=", "Mock...
[ 372, 0 ]
[ 421, 19 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_bad_trigger_capabilities
( hass, hass_ws_client, device_reg, entity_reg )
Test we get no trigger capabilities for a non existing domain.
Test we get no trigger capabilities for a non existing domain.
async def test_websocket_get_bad_trigger_capabilities( hass, hass_ws_client, device_reg, entity_reg ): """Test we get no trigger capabilities for a non existing domain.""" await async_setup_component(hass, "device_automation", {}) expected_capabilities = {} client = await hass_ws_client(hass) a...
[ "async", "def", "test_websocket_get_bad_trigger_capabilities", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "expected_capabilities", ...
[ 424, 0 ]
[ 444, 48 ]
python
en
['en', 'en', 'en']
True
test_websocket_get_no_trigger_capabilities
( hass, hass_ws_client, device_reg, entity_reg )
Test we get no trigger capabilities for a domain with no device trigger capabilities.
Test we get no trigger capabilities for a domain with no device trigger capabilities.
async def test_websocket_get_no_trigger_capabilities( hass, hass_ws_client, device_reg, entity_reg ): """Test we get no trigger capabilities for a domain with no device trigger capabilities.""" await async_setup_component(hass, "device_automation", {}) expected_capabilities = {} client = await hass...
[ "async", "def", "test_websocket_get_no_trigger_capabilities", "(", "hass", ",", "hass_ws_client", ",", "device_reg", ",", "entity_reg", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "expected_capabilities", ...
[ 447, 0 ]
[ 467, 48 ]
python
en
['en', 'en', 'en']
True
test_automation_with_non_existing_integration
(hass, caplog)
Test device automation with non existing integration.
Test device automation with non existing integration.
async def test_automation_with_non_existing_integration(hass, caplog): """Test device automation with non existing integration.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trigger": ...
[ "async", "def", "test_automation_with_non_existing_integration", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "...
[ 470, 0 ]
[ 488, 56 ]
python
en
['en', 'en', 'en']
True
test_automation_with_integration_without_device_action
(hass, caplog)
Test automation with integration without device action support.
Test automation with integration without device action support.
async def test_automation_with_integration_without_device_action(hass, caplog): """Test automation with integration without device action support.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", ...
[ "async", "def", "test_automation_with_integration_without_device_action", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ...
[ 491, 0 ]
[ 507, 5 ]
python
en
['en', 'en', 'en']
True
test_automation_with_integration_without_device_condition
(hass, caplog)
Test automation with integration without device condition support.
Test automation with integration without device condition support.
async def test_automation_with_integration_without_device_condition(hass, caplog): """Test automation with integration without device condition support.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", ...
[ "async", "def", "test_automation_with_integration_without_device_condition", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\""...
[ 510, 0 ]
[ 532, 5 ]
python
en
['en', 'en', 'en']
True
test_automation_with_integration_without_device_trigger
(hass, caplog)
Test automation with integration without device trigger support.
Test automation with integration without device trigger support.
async def test_automation_with_integration_without_device_trigger(hass, caplog): """Test automation with integration without device trigger support.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", ...
[ "async", "def", "test_automation_with_integration_without_device_trigger", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ...
[ 535, 0 ]
[ 555, 5 ]
python
en
['en', 'en', 'en']
True
test_automation_with_bad_action
(hass, caplog)
Test automation with bad device action.
Test automation with bad device action.
async def test_automation_with_bad_action(hass, caplog): """Test automation with bad device action.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trigger": {"platform": "event", "event...
[ "async", "def", "test_automation_with_bad_action", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"hello\"", ...
[ 558, 0 ]
[ 572, 53 ]
python
en
['en', 'en', 'en']
True
test_automation_with_bad_condition_action
(hass, caplog)
Test automation with bad device action.
Test automation with bad device action.
async def test_automation_with_bad_condition_action(hass, caplog): """Test automation with bad device action.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trigger": {"platform": "even...
[ "async", "def", "test_automation_with_bad_condition_action", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"he...
[ 575, 0 ]
[ 589, 53 ]
python
en
['en', 'en', 'en']
True
test_automation_with_bad_condition
(hass, caplog)
Test automation with bad device condition.
Test automation with bad device condition.
async def test_automation_with_bad_condition(hass, caplog): """Test automation with bad device condition.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trigger": {"platform": "event", ...
[ "async", "def", "test_automation_with_bad_condition", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"hello\"",...
[ 592, 0 ]
[ 607, 53 ]
python
en
['en', 'en', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 611, 0 ]
[ 613, 57 ]
python
en
['en', 'en', 'en']
True
test_automation_with_sub_condition
(hass, calls)
Test automation with device condition under and/or conditions.
Test automation with device condition under and/or conditions.
async def test_automation_with_sub_condition(hass, calls): """Test automation with device condition under and/or conditions.""" DOMAIN = "light" platform = getattr(hass.components, f"test.{DOMAIN}") platform.init() assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}}) ...
[ "async", "def", "test_automation_with_sub_condition", "(", "hass", ",", "calls", ")", ":", "DOMAIN", "=", "\"light\"", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "f\"test.{DOMAIN}\"", ")", "platform", ".", "init", "(", ")", "assert", "awa...
[ 616, 0 ]
[ 724, 5 ]
python
en
['en', 'en', 'en']
True
test_automation_with_bad_sub_condition
(hass, caplog)
Test automation with bad device condition under and/or conditions.
Test automation with bad device condition under and/or conditions.
async def test_automation_with_bad_sub_condition(hass, caplog): """Test automation with bad device condition under and/or conditions.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trig...
[ "async", "def", "test_automation_with_bad_sub_condition", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"hello...
[ 727, 0 ]
[ 745, 53 ]
python
en
['en', 'en', 'en']
True
test_automation_with_bad_trigger
(hass, caplog)
Test automation with bad device trigger.
Test automation with bad device trigger.
async def test_automation_with_bad_trigger(hass, caplog): """Test automation with bad device trigger.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "alias": "hello", "trigger": {"platform": "device", "do...
[ "async", "def", "test_automation_with_bad_trigger", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"alias\"", ":", "\"hello\"", ...
[ 748, 0 ]
[ 762, 53 ]
python
en
['en', 'en', 'en']
True
test_websocket_device_not_found
(hass, hass_ws_client)
Test calling command with unknown device.
Test calling command with unknown device.
async def test_websocket_device_not_found(hass, hass_ws_client): """Test calling command with unknown device.""" await async_setup_component(hass, "device_automation", {}) client = await hass_ws_client(hass) await client.send_json( {"id": 1, "type": "device_automation/action/list", "device_id": ...
[ "async", "def", "test_websocket_device_not_found", "(", "hass", ",", "hass_ws_client", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"device_automation\"", ",", "{", "}", ")", "client", "=", "await", "hass_ws_client", "(", "hass", ")", "await", ...
[ 765, 0 ]
[ 776, 79 ]
python
en
['en', 'en', 'en']
True
create_lock_service
(accessory)
Define a lock characteristics as per page 219 of HAP spec.
Define a lock characteristics as per page 219 of HAP spec.
def create_lock_service(accessory): """Define a lock characteristics as per page 219 of HAP spec.""" service = accessory.add_service(ServicesTypes.LOCK_MECHANISM) cur_state = service.add_char(CharacteristicsTypes.LOCK_MECHANISM_CURRENT_STATE) cur_state.value = 0 targ_state = service.add_char(Chara...
[ "def", "create_lock_service", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "LOCK_MECHANISM", ")", "cur_state", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "LOCK_MECHANISM_CURRENT_STATE",...
[ 10, 0 ]
[ 27, 18 ]
python
en
['en', 'ca', 'en']
True
test_switch_change_lock_state
(hass, utcnow)
Test that we can turn a HomeKit lock on and off again.
Test that we can turn a HomeKit lock on and off again.
async def test_switch_change_lock_state(hass, utcnow): """Test that we can turn a HomeKit lock on and off again.""" helper = await setup_test_component(hass, create_lock_service) await hass.services.async_call( "lock", "lock", {"entity_id": "lock.testdevice"}, blocking=True ) assert helper....
[ "async", "def", "test_switch_change_lock_state", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_lock_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "\"lock\"", ",", "\"loc...
[ 30, 0 ]
[ 42, 63 ]
python
en
['en', 'en', 'en']
True
test_switch_read_lock_state
(hass, utcnow)
Test that we can read the state of a HomeKit lock accessory.
Test that we can read the state of a HomeKit lock accessory.
async def test_switch_read_lock_state(hass, utcnow): """Test that we can read the state of a HomeKit lock accessory.""" helper = await setup_test_component(hass, create_lock_service) helper.characteristics[LOCK_CURRENT_STATE].value = 0 helper.characteristics[LOCK_TARGET_STATE].value = 0 state = awa...
[ "async", "def", "test_switch_read_lock_state", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_lock_service", ")", "helper", ".", "characteristics", "[", "LOCK_CURRENT_STATE", "]", ".", "value", "=", ...
[ 45, 0 ]
[ 58, 34 ]
python
en
['en', 'en', 'en']
True
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 27, 0 ]
[ 29, 37 ]
python
en
['en', 'fy', 'en']
True
entity_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def entity_reg(hass): """Return an empty, loaded, registry.""" return mock_registry(hass)
[ "def", "entity_reg", "(", "hass", ")", ":", "return", "mock_registry", "(", "hass", ")" ]
[ 33, 0 ]
[ 35, 30 ]
python
en
['en', 'fy', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 39, 0 ]
[ 41, 57 ]
python
en
['en', 'en', 'en']
True
test_get_triggers
(hass, device_reg, entity_reg)
Test we get the expected triggers from a cover.
Test we get the expected triggers from a cover.
async def test_get_triggers(hass, device_reg, entity_reg): """Test we get the expected triggers from a cover.""" platform = getattr(hass.components, f"test.{DOMAIN}") platform.init() ent = platform.ENTITIES[0] config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass)...
[ "async", "def", "test_get_triggers", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "f\"test.{DOMAIN}\"", ")", "platform", ".", "init", "(", ")", "ent", "=", "platform", ".", "E...
[ 44, 0 ]
[ 92, 50 ]
python
en
['en', 'en', 'en']
True
test_get_triggers_set_pos
(hass, device_reg, entity_reg)
Test we get the expected triggers from a cover.
Test we get the expected triggers from a cover.
async def test_get_triggers_set_pos(hass, device_reg, entity_reg): """Test we get the expected triggers from a cover.""" platform = getattr(hass.components, f"test.{DOMAIN}") platform.init() ent = platform.ENTITIES[1] config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_ha...
[ "async", "def", "test_get_triggers_set_pos", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "f\"test.{DOMAIN}\"", ")", "platform", ".", "init", "(", ")", "ent", "=", "platform", "...
[ 95, 0 ]
[ 150, 50 ]
python
en
['en', 'en', 'en']
True