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
KefMediaPlayer.available
(self)
Return if the speaker is reachable online.
Return if the speaker is reachable online.
def available(self): """Return if the speaker is reachable online.""" return self._is_online
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_is_online" ]
[ 302, 4 ]
[ 304, 30 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.unique_id
(self)
Return the device unique id.
Return the device unique id.
def unique_id(self): """Return the device unique id.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 307, 4 ]
[ 309, 30 ]
python
en
['en', 'it', 'en']
True
KefMediaPlayer.icon
(self)
Return the device's icon.
Return the device's icon.
def icon(self): """Return the device's icon.""" return "mdi:speaker-wireless"
[ "def", "icon", "(", "self", ")", ":", "return", "\"mdi:speaker-wireless\"" ]
[ 312, 4 ]
[ 314, 37 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.async_turn_off
(self)
Turn the media player off.
Turn the media player off.
async def async_turn_off(self): """Turn the media player off.""" await self._speaker.turn_off()
[ "async", "def", "async_turn_off", "(", "self", ")", ":", "await", "self", ".", "_speaker", ".", "turn_off", "(", ")" ]
[ 316, 4 ]
[ 318, 38 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.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.""" if not self._supports_on: raise NotImplementedError() await self._speaker.turn_on()
[ "async", "def", "async_turn_on", "(", "self", ")", ":", "if", "not", "self", ".", "_supports_on", ":", "raise", "NotImplementedError", "(", ")", "await", "self", ".", "_speaker", ".", "turn_on", "(", ")" ]
[ 320, 4 ]
[ 324, 37 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.async_volume_up
(self)
Volume up the media player.
Volume up the media player.
async def async_volume_up(self): """Volume up the media player.""" await self._speaker.increase_volume()
[ "async", "def", "async_volume_up", "(", "self", ")", ":", "await", "self", ".", "_speaker", ".", "increase_volume", "(", ")" ]
[ 326, 4 ]
[ 328, 45 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.async_volume_down
(self)
Volume down the media player.
Volume down the media player.
async def async_volume_down(self): """Volume down the media player.""" await self._speaker.decrease_volume()
[ "async", "def", "async_volume_down", "(", "self", ")", ":", "await", "self", ".", "_speaker", ".", "decrease_volume", "(", ")" ]
[ 330, 4 ]
[ 332, 45 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.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.""" await self._speaker.set_volume(volume)
[ "async", "def", "async_set_volume_level", "(", "self", ",", "volume", ")", ":", "await", "self", ".", "_speaker", ".", "set_volume", "(", "volume", ")" ]
[ 334, 4 ]
[ 336, 46 ]
python
en
['fr', 'zu', 'en']
False
KefMediaPlayer.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.""" if mute: await self._speaker.mute() else: await self._speaker.unmute()
[ "async", "def", "async_mute_volume", "(", "self", ",", "mute", ")", ":", "if", "mute", ":", "await", "self", ".", "_speaker", ".", "mute", "(", ")", "else", ":", "await", "self", ".", "_speaker", ".", "unmute", "(", ")" ]
[ 338, 4 ]
[ 343, 40 ]
python
en
['en', 'la', 'it']
False
KefMediaPlayer.async_select_source
(self, source: str)
Select input source.
Select input source.
async def async_select_source(self, source: str): """Select input source.""" if source in self.source_list: await self._speaker.set_source(source) else: raise ValueError(f"Unknown input source: {source}.")
[ "async", "def", "async_select_source", "(", "self", ",", "source", ":", "str", ")", ":", "if", "source", "in", "self", ".", "source_list", ":", "await", "self", ".", "_speaker", ".", "set_source", "(", "source", ")", "else", ":", "raise", "ValueError", "...
[ 345, 4 ]
[ 350, 64 ]
python
en
['fr', 'su', 'en']
False
KefMediaPlayer.async_media_play
(self)
Send play command.
Send play command.
async def async_media_play(self): """Send play command.""" await self._speaker.set_play_pause()
[ "async", "def", "async_media_play", "(", "self", ")", ":", "await", "self", ".", "_speaker", ".", "set_play_pause", "(", ")" ]
[ 352, 4 ]
[ 354, 44 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.async_media_pause
(self)
Send pause command.
Send pause command.
async def async_media_pause(self): """Send pause command.""" await self._speaker.set_play_pause()
[ "async", "def", "async_media_pause", "(", "self", ")", ":", "await", "self", ".", "_speaker", ".", "set_play_pause", "(", ")" ]
[ 356, 4 ]
[ 358, 44 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.async_media_previous_track
(self)
Send previous track command.
Send previous track command.
async def async_media_previous_track(self): """Send previous track command.""" await self._speaker.prev_track()
[ "async", "def", "async_media_previous_track", "(", "self", ")", ":", "await", "self", ".", "_speaker", ".", "prev_track", "(", ")" ]
[ 360, 4 ]
[ 362, 40 ]
python
en
['en', 'it', 'en']
True
KefMediaPlayer.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._speaker.next_track()
[ "async", "def", "async_media_next_track", "(", "self", ")", ":", "await", "self", ".", "_speaker", ".", "next_track", "(", ")" ]
[ 364, 4 ]
[ 366, 40 ]
python
en
['en', 'pt', 'en']
True
KefMediaPlayer.update_dsp
(self, _=None)
Update the DSP settings.
Update the DSP settings.
async def update_dsp(self, _=None) -> None: """Update the DSP settings.""" if self._speaker_type == "LS50" and self._state == STATE_OFF: # The LSX is able to respond when off the LS50 has to be on. return mode = await self._speaker.get_mode() self._dsp = dict( ...
[ "async", "def", "update_dsp", "(", "self", ",", "_", "=", "None", ")", "->", "None", ":", "if", "self", ".", "_speaker_type", "==", "\"LS50\"", "and", "self", ".", "_state", "==", "STATE_OFF", ":", "# The LSX is able to respond when off the LS50 has to be on.", ...
[ 368, 4 ]
[ 383, 9 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.async_added_to_hass
(self)
Subscribe to DSP updates.
Subscribe to DSP updates.
async def async_added_to_hass(self): """Subscribe to DSP updates.""" self._update_dsp_task_remover = async_track_time_interval( self.hass, self.update_dsp, DSP_SCAN_INTERVAL )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_update_dsp_task_remover", "=", "async_track_time_interval", "(", "self", ".", "hass", ",", "self", ".", "update_dsp", ",", "DSP_SCAN_INTERVAL", ")" ]
[ 385, 4 ]
[ 389, 9 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.async_will_remove_from_hass
(self)
Unsubscribe to DSP updates.
Unsubscribe to DSP updates.
async def async_will_remove_from_hass(self): """Unsubscribe to DSP updates.""" self._update_dsp_task_remover() self._update_dsp_task_remover = None
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", ":", "self", ".", "_update_dsp_task_remover", "(", ")", "self", ".", "_update_dsp_task_remover", "=", "None" ]
[ 391, 4 ]
[ 394, 44 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.extra_state_attributes
(self)
Return the DSP settings of the KEF device.
Return the DSP settings of the KEF device.
def extra_state_attributes(self): """Return the DSP settings of the KEF device.""" return self._dsp or {}
[ "def", "extra_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_dsp", "or", "{", "}" ]
[ 397, 4 ]
[ 399, 30 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.set_mode
( self, desk_mode=None, wall_mode=None, phase_correction=None, high_pass=None, sub_polarity=None, bass_extension=None, )
Set the speaker mode.
Set the speaker mode.
async def set_mode( self, desk_mode=None, wall_mode=None, phase_correction=None, high_pass=None, sub_polarity=None, bass_extension=None, ): """Set the speaker mode.""" await self._speaker.set_mode( desk_mode=desk_mode, w...
[ "async", "def", "set_mode", "(", "self", ",", "desk_mode", "=", "None", ",", "wall_mode", "=", "None", ",", "phase_correction", "=", "None", ",", "high_pass", "=", "None", ",", "sub_polarity", "=", "None", ",", "bass_extension", "=", "None", ",", ")", ":...
[ 401, 4 ]
[ 419, 24 ]
python
en
['en', 'no', 'en']
True
KefMediaPlayer.set_desk_db
(self, db_value)
Set desk_db of the KEF speakers.
Set desk_db of the KEF speakers.
async def set_desk_db(self, db_value): """Set desk_db of the KEF speakers.""" await self._speaker.set_desk_db(db_value) self._dsp = None
[ "async", "def", "set_desk_db", "(", "self", ",", "db_value", ")", ":", "await", "self", ".", "_speaker", ".", "set_desk_db", "(", "db_value", ")", "self", ".", "_dsp", "=", "None" ]
[ 421, 4 ]
[ 424, 24 ]
python
en
['en', 'af', 'en']
True
KefMediaPlayer.set_wall_db
(self, db_value)
Set wall_db of the KEF speakers.
Set wall_db of the KEF speakers.
async def set_wall_db(self, db_value): """Set wall_db of the KEF speakers.""" await self._speaker.set_wall_db(db_value) self._dsp = None
[ "async", "def", "set_wall_db", "(", "self", ",", "db_value", ")", ":", "await", "self", ".", "_speaker", ".", "set_wall_db", "(", "db_value", ")", "self", ".", "_dsp", "=", "None" ]
[ 426, 4 ]
[ 429, 24 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.set_treble_db
(self, db_value)
Set treble_db of the KEF speakers.
Set treble_db of the KEF speakers.
async def set_treble_db(self, db_value): """Set treble_db of the KEF speakers.""" await self._speaker.set_treble_db(db_value) self._dsp = None
[ "async", "def", "set_treble_db", "(", "self", ",", "db_value", ")", ":", "await", "self", ".", "_speaker", ".", "set_treble_db", "(", "db_value", ")", "self", ".", "_dsp", "=", "None" ]
[ 431, 4 ]
[ 434, 24 ]
python
en
['en', 'af', 'en']
True
KefMediaPlayer.set_high_hz
(self, hz_value)
Set high_hz of the KEF speakers.
Set high_hz of the KEF speakers.
async def set_high_hz(self, hz_value): """Set high_hz of the KEF speakers.""" await self._speaker.set_high_hz(hz_value) self._dsp = None
[ "async", "def", "set_high_hz", "(", "self", ",", "hz_value", ")", ":", "await", "self", ".", "_speaker", ".", "set_high_hz", "(", "hz_value", ")", "self", ".", "_dsp", "=", "None" ]
[ 436, 4 ]
[ 439, 24 ]
python
en
['en', 'en', 'en']
True
KefMediaPlayer.set_low_hz
(self, hz_value)
Set low_hz of the KEF speakers.
Set low_hz of the KEF speakers.
async def set_low_hz(self, hz_value): """Set low_hz of the KEF speakers.""" await self._speaker.set_low_hz(hz_value) self._dsp = None
[ "async", "def", "set_low_hz", "(", "self", ",", "hz_value", ")", ":", "await", "self", ".", "_speaker", ".", "set_low_hz", "(", "hz_value", ")", "self", ".", "_dsp", "=", "None" ]
[ 441, 4 ]
[ 444, 24 ]
python
en
['en', 'af', 'en']
True
KefMediaPlayer.set_sub_db
(self, db_value)
Set sub_db of the KEF speakers.
Set sub_db of the KEF speakers.
async def set_sub_db(self, db_value): """Set sub_db of the KEF speakers.""" await self._speaker.set_sub_db(db_value) self._dsp = None
[ "async", "def", "set_sub_db", "(", "self", ",", "db_value", ")", ":", "await", "self", ".", "_speaker", ".", "set_sub_db", "(", "db_value", ")", "self", ".", "_dsp", "=", "None" ]
[ 446, 4 ]
[ 449, 24 ]
python
en
['en', 'en', 'en']
True
ialarm_api_fixture
()
Set up IAlarm API fixture.
Set up IAlarm API fixture.
def ialarm_api_fixture(): """Set up IAlarm API fixture.""" with patch("homeassistant.components.ialarm.IAlarm") as mock_ialarm_api: yield mock_ialarm_api
[ "def", "ialarm_api_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.ialarm.IAlarm\"", ")", "as", "mock_ialarm_api", ":", "yield", "mock_ialarm_api" ]
[ 14, 0 ]
[ 17, 29 ]
python
en
['en', 'su', 'en']
True
mock_config_fixture
()
Return a fake config entry.
Return a fake config entry.
def mock_config_fixture(): """Return a fake config entry.""" return MockConfigEntry( domain=DOMAIN, data={CONF_HOST: "192.168.10.20", CONF_PORT: 18034}, entry_id=str(uuid4()), )
[ "def", "mock_config_fixture", "(", ")", ":", "return", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_HOST", ":", "\"192.168.10.20\"", ",", "CONF_PORT", ":", "18034", "}", ",", "entry_id", "=", "str", "(", "uuid4", "(", ")", ...
[ 21, 0 ]
[ 27, 5 ]
python
en
['en', 'pt', 'en']
True
test_setup_entry
(hass, ialarm_api, mock_config_entry)
Test setup entry.
Test setup entry.
async def test_setup_entry(hass, ialarm_api, mock_config_entry): """Test setup entry.""" ialarm_api.return_value.get_mac = Mock(return_value="00:00:54:12:34:56") mock_config_entry.add_to_hass(hass) assert await hass.config_entries.async_setup(mock_config_entry.entry_id) await hass.async_block_till_...
[ "async", "def", "test_setup_entry", "(", "hass", ",", "ialarm_api", ",", "mock_config_entry", ")", ":", "ialarm_api", ".", "return_value", ".", "get_mac", "=", "Mock", "(", "return_value", "=", "\"00:00:54:12:34:56\"", ")", "mock_config_entry", ".", "add_to_hass", ...
[ 30, 0 ]
[ 39, 61 ]
python
en
['en', 'be', 'en']
True
test_setup_not_ready
(hass, ialarm_api, mock_config_entry)
Test setup failed because we can't connect to the alarm system.
Test setup failed because we can't connect to the alarm system.
async def test_setup_not_ready(hass, ialarm_api, mock_config_entry): """Test setup failed because we can't connect to the alarm system.""" ialarm_api.return_value.get_mac = Mock(side_effect=ConnectionError) mock_config_entry.add_to_hass(hass) assert not await hass.config_entries.async_setup(mock_config...
[ "async", "def", "test_setup_not_ready", "(", "hass", ",", "ialarm_api", ",", "mock_config_entry", ")", ":", "ialarm_api", ".", "return_value", ".", "get_mac", "=", "Mock", "(", "side_effect", "=", "ConnectionError", ")", "mock_config_entry", ".", "add_to_hass", "(...
[ 42, 0 ]
[ 49, 66 ]
python
en
['en', 'en', 'en']
True
test_unload_entry
(hass, ialarm_api, mock_config_entry)
Test being able to unload an entry.
Test being able to unload an entry.
async def test_unload_entry(hass, ialarm_api, mock_config_entry): """Test being able to unload an entry.""" ialarm_api.return_value.get_mac = Mock(return_value="00:00:54:12:34:56") mock_config_entry.add_to_hass(hass) assert await hass.config_entries.async_setup(mock_config_entry.entry_id) await has...
[ "async", "def", "test_unload_entry", "(", "hass", ",", "ialarm_api", ",", "mock_config_entry", ")", ":", "ialarm_api", ".", "return_value", ".", "get_mac", "=", "Mock", "(", "return_value", "=", "\"00:00:54:12:34:56\"", ")", "mock_config_entry", ".", "add_to_hass", ...
[ 52, 0 ]
[ 62, 65 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up MinioClient and event listeners.
Set up MinioClient and event listeners.
def setup(hass, config): """Set up MinioClient and event listeners.""" conf = config[DOMAIN] host = conf[CONF_HOST] port = conf[CONF_PORT] access_key = conf[CONF_ACCESS_KEY] secret_key = conf[CONF_SECRET_KEY] secure = conf[CONF_SECURE] queue_listener = QueueListener(hass) queue = q...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "host", "=", "conf", "[", "CONF_HOST", "]", "port", "=", "conf", "[", "CONF_PORT", "]", "access_key", "=", "conf", "[", "CONF_ACCESS_KEY", "]", "secret_key...
[ 80, 0 ]
[ 164, 15 ]
python
en
['en', 'en', 'en']
True
get_minio_endpoint
(host: str, port: int)
Create minio endpoint from host and port.
Create minio endpoint from host and port.
def get_minio_endpoint(host: str, port: int) -> str: """Create minio endpoint from host and port.""" return f"{host}:{port}"
[ "def", "get_minio_endpoint", "(", "host", ":", "str", ",", "port", ":", "int", ")", "->", "str", ":", "return", "f\"{host}:{port}\"" ]
[ 167, 0 ]
[ 169, 27 ]
python
en
['en', 'en', 'en']
True
QueueListener.__init__
(self, hass)
Create queue.
Create queue.
def __init__(self, hass): """Create queue.""" super().__init__() self._hass = hass self._queue = Queue()
[ "def", "__init__", "(", "self", ",", "hass", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "_hass", "=", "hass", "self", ".", "_queue", "=", "Queue", "(", ")" ]
[ 175, 4 ]
[ 179, 29 ]
python
en
['fr', 'la', 'en']
False
QueueListener.run
(self)
Listen to queue events, and forward them to Home Assistant event bus.
Listen to queue events, and forward them to Home Assistant event bus.
def run(self): """Listen to queue events, and forward them to Home Assistant event bus.""" _LOGGER.info("Running QueueListener") while True: event = self._queue.get() if event is None: break _, file_name = os.path.split(event[ATTR_KEY]) ...
[ "def", "run", "(", "self", ")", ":", "_LOGGER", ".", "info", "(", "\"Running QueueListener\"", ")", "while", "True", ":", "event", "=", "self", ".", "_queue", ".", "get", "(", ")", "if", "event", "is", "None", ":", "break", "_", ",", "file_name", "="...
[ 181, 4 ]
[ 197, 74 ]
python
en
['en', 'en', 'en']
True
QueueListener.queue
(self)
Return wrapped queue.
Return wrapped queue.
def queue(self): """Return wrapped queue.""" return self._queue
[ "def", "queue", "(", "self", ")", ":", "return", "self", ".", "_queue" ]
[ 200, 4 ]
[ 202, 26 ]
python
en
['fr', 'la', 'en']
False
QueueListener.stop
(self)
Stop run by putting None into queue and join the thread.
Stop run by putting None into queue and join the thread.
def stop(self): """Stop run by putting None into queue and join the thread.""" _LOGGER.info("Stopping QueueListener") self._queue.put(None) self.join() _LOGGER.info("Stopped QueueListener")
[ "def", "stop", "(", "self", ")", ":", "_LOGGER", ".", "info", "(", "\"Stopping QueueListener\"", ")", "self", ".", "_queue", ".", "put", "(", "None", ")", "self", ".", "join", "(", ")", "_LOGGER", ".", "info", "(", "\"Stopped QueueListener\"", ")" ]
[ 204, 4 ]
[ 209, 45 ]
python
en
['en', 'en', 'en']
True
QueueListener.start_handler
(self, _)
Start handler helper method.
Start handler helper method.
def start_handler(self, _): """Start handler helper method.""" self.start()
[ "def", "start_handler", "(", "self", ",", "_", ")", ":", "self", ".", "start", "(", ")" ]
[ 211, 4 ]
[ 213, 20 ]
python
da
['da', 'no', 'en']
False
QueueListener.stop_handler
(self, _)
Stop handler helper method.
Stop handler helper method.
def stop_handler(self, _): """Stop handler helper method.""" self.stop()
[ "def", "stop_handler", "(", "self", ",", "_", ")", ":", "self", ".", "stop", "(", ")" ]
[ 215, 4 ]
[ 217, 19 ]
python
da
['da', 'nl', 'en']
False
MinioListener.__init__
( self, queue: Queue, endpoint: str, access_key: str, secret_key: str, secure: bool, bucket_name: str, prefix: str, suffix: str, events: list[str], )
Create Listener.
Create Listener.
def __init__( self, queue: Queue, endpoint: str, access_key: str, secret_key: str, secure: bool, bucket_name: str, prefix: str, suffix: str, events: list[str], ) -> None: """Create Listener.""" self._queue = queue ...
[ "def", "__init__", "(", "self", ",", "queue", ":", "Queue", ",", "endpoint", ":", "str", ",", "access_key", ":", "str", ",", "secret_key", ":", "str", ",", "secure", ":", "bool", ",", "bucket_name", ":", "str", ",", "prefix", ":", "str", ",", "suffix...
[ 223, 4 ]
[ 245, 39 ]
python
en
['en', 'et', 'en']
False
MinioListener.start_handler
(self, _)
Create and start the event thread.
Create and start the event thread.
def start_handler(self, _): """Create and start the event thread.""" self._minio_event_thread = MinioEventThread( self._queue, self._endpoint, self._access_key, self._secret_key, self._secure, self._bucket_name, self._pr...
[ "def", "start_handler", "(", "self", ",", "_", ")", ":", "self", ".", "_minio_event_thread", "=", "MinioEventThread", "(", "self", ".", "_queue", ",", "self", ".", "_endpoint", ",", "self", ".", "_access_key", ",", "self", ".", "_secret_key", ",", "self", ...
[ 247, 4 ]
[ 260, 40 ]
python
en
['en', 'en', 'en']
True
MinioListener.stop_handler
(self, _)
Issue stop and wait for thread to join.
Issue stop and wait for thread to join.
def stop_handler(self, _): """Issue stop and wait for thread to join.""" if self._minio_event_thread is not None: self._minio_event_thread.stop()
[ "def", "stop_handler", "(", "self", ",", "_", ")", ":", "if", "self", ".", "_minio_event_thread", "is", "not", "None", ":", "self", ".", "_minio_event_thread", ".", "stop", "(", ")" ]
[ 262, 4 ]
[ 265, 43 ]
python
en
['en', 'en', 'en']
True
test_form
(hass)
Test we get the form.
Test we get the form.
async def test_form(hass): """Test we get the 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["type"] == "form" assert result["errors...
[ "async", "def", "test_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(...
[ 13, 0 ]
[ 52, 45 ]
python
en
['en', 'en', 'en']
True
test_form_invalid_auth
(hass)
Test we handle invalid auth.
Test we handle invalid auth.
async def test_form_invalid_auth(hass): """Test we handle invalid auth.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "pyprosegur.installation.Installation", side_effect=ConnectionRefusedError, ): ...
[ "async", "def", "test_form_invalid_auth", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")"...
[ 55, 0 ]
[ 75, 56 ]
python
en
['en', 'en', 'en']
True
test_form_cannot_connect
(hass)
Test we handle cannot connect error.
Test we handle cannot connect error.
async def test_form_cannot_connect(hass): """Test we handle cannot connect error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "pyprosegur.installation.Installation", side_effect=ConnectionError, ...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", "...
[ 78, 0 ]
[ 98, 58 ]
python
en
['en', 'en', 'en']
True
test_form_unknown_exception
(hass)
Test we handle unknown exceptions.
Test we handle unknown exceptions.
async def test_form_unknown_exception(hass): """Test we handle unknown exceptions.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "pyprosegur.installation.Installation", side_effect=ValueError, ): ...
[ "async", "def", "test_form_unknown_exception", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ...
[ 101, 0 ]
[ 121, 51 ]
python
en
['en', 'en', 'en']
True
test_reauth_flow
(hass)
Test a reauthentication flow.
Test a reauthentication flow.
async def test_reauth_flow(hass): """Test a reauthentication flow.""" entry = MockConfigEntry( domain=DOMAIN, unique_id="12345", data={ "username": "test-username", "password": "test-password", "country": "PT", }, ) entry.add_to_hass(ha...
[ "async", "def", "test_reauth_flow", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "\"12345\"", ",", "data", "=", "{", "\"username\"", ":", "\"test-username\"", ",", "\"password\"", ":", "\"test-pas...
[ 124, 0 ]
[ 178, 48 ]
python
en
['en', 'fr', 'en']
True
test_reauth_flow_error
(hass, exception, base_error)
Test a reauthentication flow with errors.
Test a reauthentication flow with errors.
async def test_reauth_flow_error(hass, exception, base_error): """Test a reauthentication flow with errors.""" entry = MockConfigEntry( domain=DOMAIN, unique_id="12345", data={ "username": "test-username", "password": "test-password", "country": "PT", ...
[ "async", "def", "test_reauth_flow_error", "(", "hass", ",", "exception", ",", "base_error", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "\"12345\"", ",", "data", "=", "{", "\"username\"", ":", "\"test-usernam...
[ 189, 0 ]
[ 226, 50 ]
python
en
['en', 'en', 'en']
True
mock_call_rate_limit_sleep
()
Patch the call rate limit sleep time.
Patch the call rate limit sleep time.
def mock_call_rate_limit_sleep(): """Patch the call rate limit sleep time.""" with patch("homeassistant.components.kraken.CALL_RATE_LIMIT_SLEEP", new=0): yield
[ "def", "mock_call_rate_limit_sleep", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.kraken.CALL_RATE_LIMIT_SLEEP\"", ",", "new", "=", "0", ")", ":", "yield" ]
[ 7, 0 ]
[ 10, 13 ]
python
en
['en', 'en', 'en']
True
test_config_no_config
(hass)
Component setup succeeds when there are no config entry for the domain.
Component setup succeeds when there are no config entry for the domain.
async def test_config_no_config(hass): """Component setup succeeds when there are no config entry for the domain.""" assert await async_setup_component(hass, DOMAIN, {})
[ "async", "def", "test_config_no_config", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "}", ")" ]
[ 17, 0 ]
[ 19, 56 ]
python
en
['en', 'en', 'en']
True
test_config_no_static
(hass)
Component setup succeeds when there are no static config entries.
Component setup succeeds when there are no static config entries.
async def test_config_no_static(hass): """Component setup succeeds when there are no static config entries.""" assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_DISCOVERY: False}})
[ "async", "def", "test_config_no_static", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "CONF_DISCOVERY", ":", "False", "}", "}", ")" ]
[ 22, 0 ]
[ 24, 87 ]
python
en
['en', 'en', 'en']
True
test_static_duplicate_static_entry
(hass, pywemo_device)
Duplicate static entries are merged into a single entity.
Duplicate static entries are merged into a single entity.
async def test_static_duplicate_static_entry(hass, pywemo_device): """Duplicate static entries are merged into a single entity.""" static_config_entry = f"{MOCK_HOST}:{MOCK_PORT}" assert await async_setup_component( hass, DOMAIN, { DOMAIN: { CONF_DISCOVERY...
[ "async", "def", "test_static_duplicate_static_entry", "(", "hass", ",", "pywemo_device", ")", ":", "static_config_entry", "=", "f\"{MOCK_HOST}:{MOCK_PORT}\"", "assert", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "CONF_D...
[ 27, 0 ]
[ 46, 35 ]
python
en
['en', 'en', 'en']
True
test_static_config_with_port
(hass, pywemo_device)
Static device with host and port is added and removed.
Static device with host and port is added and removed.
async def test_static_config_with_port(hass, pywemo_device): """Static device with host and port is added and removed.""" assert await async_setup_component( hass, DOMAIN, { DOMAIN: { CONF_DISCOVERY: False, CONF_STATIC: [f"{MOCK_HOST}:{MOCK_POR...
[ "async", "def", "test_static_config_with_port", "(", "hass", ",", "pywemo_device", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "CONF_DISCOVERY", ":", "False", ",", "CONF_STATIC", ":", "[", "f\...
[ 49, 0 ]
[ 64, 35 ]
python
en
['en', 'en', 'en']
True
test_static_config_without_port
(hass, pywemo_device)
Static device with host and no port is added and removed.
Static device with host and no port is added and removed.
async def test_static_config_without_port(hass, pywemo_device): """Static device with host and no port is added and removed.""" assert await async_setup_component( hass, DOMAIN, { DOMAIN: { CONF_DISCOVERY: False, CONF_STATIC: [MOCK_HOST], ...
[ "async", "def", "test_static_config_without_port", "(", "hass", ",", "pywemo_device", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "CONF_DISCOVERY", ":", "False", ",", "CONF_STATIC", ":", "[", ...
[ 67, 0 ]
[ 82, 35 ]
python
en
['en', 'en', 'en']
True
test_static_config_with_invalid_host
(hass)
Component setup fails if a static host is invalid.
Component setup fails if a static host is invalid.
async def test_static_config_with_invalid_host(hass): """Component setup fails if a static host is invalid.""" setup_success = await async_setup_component( hass, DOMAIN, { DOMAIN: { CONF_DISCOVERY: False, CONF_STATIC: [""], }, ...
[ "async", "def", "test_static_config_with_invalid_host", "(", "hass", ")", ":", "setup_success", "=", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "CONF_DISCOVERY", ":", "False", ",", "CONF_STATIC", ":", "[", "\"\"",...
[ 85, 0 ]
[ 97, 28 ]
python
en
['en', 'en', 'en']
True
test_discovery
(hass, pywemo_registry)
Verify that discovery dispatches devices to the platform for setup.
Verify that discovery dispatches devices to the platform for setup.
async def test_discovery(hass, pywemo_registry): """Verify that discovery dispatches devices to the platform for setup.""" def create_device(counter): """Create a unique mock Motion detector device for each counter value.""" device = create_autospec(pywemo.Motion, instance=True) device....
[ "async", "def", "test_discovery", "(", "hass", ",", "pywemo_registry", ")", ":", "def", "create_device", "(", "counter", ")", ":", "\"\"\"Create a unique mock Motion detector device for each counter value.\"\"\"", "device", "=", "create_autospec", "(", "pywemo", ".", "Mot...
[ 100, 0 ]
[ 148, 38 ]
python
en
['en', 'en', 'en']
True
test_packages
(root)
Yields test package directories under root.
Yields test package directories under root.
def test_packages(root): """Yields test package directories under root.""" for package, _, files in os.walk(root): if 'test.xml' in files and 'test.log' in files: yield package
[ "def", "test_packages", "(", "root", ")", ":", "for", "package", ",", "_", ",", "files", "in", "os", ".", "walk", "(", "root", ")", ":", "if", "'test.xml'", "in", "files", "and", "'test.log'", "in", "files", ":", "yield", "package" ]
[ 37, 0 ]
[ 41, 25 ]
python
en
['fr', 'en', 'en']
True
result
(pkg)
Given a directory, create a testcase element describing it.
Given a directory, create a testcase element describing it.
def result(pkg): """Given a directory, create a testcase element describing it.""" elem = ET.Element('testcase') elem.set('classname', 'go_test') pkg_parts = pkg.split('/') elem.set('name', '//%s:%s' % ('/'.join(pkg_parts[1:-1]), pkg_parts[-1])) elem.set('time', '0') suites = ET.parse(pkg + ...
[ "def", "result", "(", "pkg", ")", ":", "elem", "=", "ET", ".", "Element", "(", "'testcase'", ")", "elem", ".", "set", "(", "'classname'", ",", "'go_test'", ")", "pkg_parts", "=", "pkg", ".", "split", "(", "'/'", ")", "elem", ".", "set", "(", "'name...
[ 54, 0 ]
[ 73, 15 ]
python
ca
['ca', 'gl', 'en']
False
test_connection_failed_error
(mock_error, hass)
Try to connect at 127.0.0.1:5001 with socket error.
Try to connect at 127.0.0.1:5001 with socket error.
async def test_connection_failed_error(mock_error, hass): """Try to connect at 127.0.0.1:5001 with socket error.""" with assert_setup_component(4), patch( "pilight.pilight.Client", side_effect=socket.error ) as mock_client: assert not await async_setup_component( hass, pilight.DO...
[ "async", "def", "test_connection_failed_error", "(", "mock_error", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ",", "patch", "(", "\"pilight.pilight.Client\"", ",", "side_effect", "=", "socket", ".", "error", ")", "as", "mock_client", ...
[ 64, 0 ]
[ 75, 41 ]
python
en
['en', 'en', 'en']
True
test_connection_timeout_error
(mock_error, hass)
Try to connect at 127.0.0.1:5001 with socket timeout.
Try to connect at 127.0.0.1:5001 with socket timeout.
async def test_connection_timeout_error(mock_error, hass): """Try to connect at 127.0.0.1:5001 with socket timeout.""" with assert_setup_component(4), patch( "pilight.pilight.Client", side_effect=socket.timeout ) as mock_client: assert not await async_setup_component( hass, pilig...
[ "async", "def", "test_connection_timeout_error", "(", "mock_error", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ",", "patch", "(", "\"pilight.pilight.Client\"", ",", "side_effect", "=", "socket", ".", "timeout", ")", "as", "mock_client"...
[ 79, 0 ]
[ 90, 41 ]
python
en
['en', 'en', 'en']
True
test_send_code_no_protocol
(hass)
Try to send data without protocol information, should give error.
Try to send data without protocol information, should give error.
async def test_send_code_no_protocol(hass): """Try to send data without protocol information, should give error.""" with assert_setup_component(4): assert await async_setup_component(hass, pilight.DOMAIN, {pilight.DOMAIN: {}}) # Call without protocol info, should raise an error try: ...
[ "async", "def", "test_send_code_no_protocol", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "pilight", ".", "DOMAIN", ",", "{", "pilight", ".", "DOMAIN", ":", "{", "...
[ 94, 0 ]
[ 109, 79 ]
python
en
['en', 'en', 'en']
True
test_send_code
(mock_pilight_error, hass)
Try to send proper data.
Try to send proper data.
async def test_send_code(mock_pilight_error, hass): """Try to send proper data.""" with assert_setup_component(4): assert await async_setup_component(hass, pilight.DOMAIN, {pilight.DOMAIN: {}}) # Call with protocol info, should not give error service_data = {"protocol": "test", "value":...
[ "async", "def", "test_send_code", "(", "mock_pilight_error", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "pilight", ".", "DOMAIN", ",", "{", "pilight", ".", "DOMAIN"...
[ 115, 0 ]
[ 131, 55 ]
python
en
['en', 'en', 'en']
True
test_send_code_fail
(mock_pilight_error, hass)
Check IOError exception error message.
Check IOError exception error message.
async def test_send_code_fail(mock_pilight_error, hass): """Check IOError exception error message.""" with assert_setup_component(4), patch( "pilight.pilight.Client.send_code", side_effect=IOError ): assert await async_setup_component(hass, pilight.DOMAIN, {pilight.DOMAIN: {}}) # Ca...
[ "async", "def", "test_send_code_fail", "(", "mock_pilight_error", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ",", "patch", "(", "\"pilight.pilight.Client.send_code\"", ",", "side_effect", "=", "IOError", ")", ":", "assert", "await", "a...
[ 136, 0 ]
[ 153, 59 ]
python
es
['eu', 'es', 'it']
False
test_send_code_delay
(mock_pilight_error, hass)
Try to send proper data with delay afterwards.
Try to send proper data with delay afterwards.
async def test_send_code_delay(mock_pilight_error, hass): """Try to send proper data with delay afterwards.""" with assert_setup_component(4): assert await async_setup_component( hass, pilight.DOMAIN, {pilight.DOMAIN: {pilight.CONF_SEND_DELAY: 5.0}}, ) ...
[ "async", "def", "test_send_code_delay", "(", "mock_pilight_error", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "pilight", ".", "DOMAIN", ",", "{", "pilight", ".", "D...
[ 159, 0 ]
[ 195, 56 ]
python
en
['en', 'en', 'en']
True
test_start_stop
(mock_pilight_error, hass)
Check correct startup and stop of pilight daemon.
Check correct startup and stop of pilight daemon.
async def test_start_stop(mock_pilight_error, hass): """Check correct startup and stop of pilight daemon.""" with assert_setup_component(4): assert await async_setup_component(hass, pilight.DOMAIN, {pilight.DOMAIN: {}}) # Test startup await hass.async_start() await hass.async_bl...
[ "async", "def", "test_start_stop", "(", "mock_pilight_error", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "pilight", ".", "DOMAIN", ",", "{", "pilight", ".", "DOMAIN...
[ 201, 0 ]
[ 219, 61 ]
python
en
['en', 'en', 'en']
True
test_receive_code
(mock_debug, hass)
Check if code receiving via pilight daemon works.
Check if code receiving via pilight daemon works.
async def test_receive_code(mock_debug, hass): """Check if code receiving via pilight daemon works.""" with assert_setup_component(4): assert await async_setup_component(hass, pilight.DOMAIN, {pilight.DOMAIN: {}}) # Test startup await hass.async_start() await hass.async_block_ti...
[ "async", "def", "test_receive_code", "(", "mock_debug", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "pilight", ".", "DOMAIN", ",", "{", "pilight", ".", "DOMAIN", "...
[ 224, 0 ]
[ 245, 52 ]
python
en
['nl', 'en', 'en']
True
test_whitelist_exact_match
(mock_debug, hass)
Check whitelist filter with matched data.
Check whitelist filter with matched data.
async def test_whitelist_exact_match(mock_debug, hass): """Check whitelist filter with matched data.""" with assert_setup_component(4): whitelist = { "protocol": [PilightDaemonSim.test_message["protocol"]], "uuid": [PilightDaemonSim.test_message["uuid"]], "id": [Pilig...
[ "async", "def", "test_whitelist_exact_match", "(", "mock_debug", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ":", "whitelist", "=", "{", "\"protocol\"", ":", "[", "PilightDaemonSim", ".", "test_message", "[", "\"protocol\"", "]", "]",...
[ 250, 0 ]
[ 278, 52 ]
python
en
['en', 'en', 'en']
True
test_whitelist_partial_match
(mock_debug, hass)
Check whitelist filter with partially matched data, should work.
Check whitelist filter with partially matched data, should work.
async def test_whitelist_partial_match(mock_debug, hass): """Check whitelist filter with partially matched data, should work.""" with assert_setup_component(4): whitelist = { "protocol": [PilightDaemonSim.test_message["protocol"]], "id": [PilightDaemonSim.test_message["message"][...
[ "async", "def", "test_whitelist_partial_match", "(", "mock_debug", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ":", "whitelist", "=", "{", "\"protocol\"", ":", "[", "PilightDaemonSim", ".", "test_message", "[", "\"protocol\"", "]", "]...
[ 283, 0 ]
[ 309, 52 ]
python
en
['en', 'en', 'en']
True
test_whitelist_or_match
(mock_debug, hass)
Check whitelist filter with several subsection, should work.
Check whitelist filter with several subsection, should work.
async def test_whitelist_or_match(mock_debug, hass): """Check whitelist filter with several subsection, should work.""" with assert_setup_component(4): whitelist = { "protocol": [ PilightDaemonSim.test_message["protocol"], "other_protocol", ], ...
[ "async", "def", "test_whitelist_or_match", "(", "mock_debug", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ":", "whitelist", "=", "{", "\"protocol\"", ":", "[", "PilightDaemonSim", ".", "test_message", "[", "\"protocol\"", "]", ",", ...
[ 314, 0 ]
[ 343, 52 ]
python
en
['en', 'en', 'en']
True
test_whitelist_no_match
(mock_debug, hass)
Check whitelist filter with unmatched data, should not work.
Check whitelist filter with unmatched data, should not work.
async def test_whitelist_no_match(mock_debug, hass): """Check whitelist filter with unmatched data, should not work.""" with assert_setup_component(4): whitelist = { "protocol": ["wrong_protocol"], "id": [PilightDaemonSim.test_message["message"]["id"]], } assert a...
[ "async", "def", "test_whitelist_no_match", "(", "mock_debug", ",", "hass", ")", ":", "with", "assert_setup_component", "(", "4", ")", ":", "whitelist", "=", "{", "\"protocol\"", ":", "[", "\"wrong_protocol\"", "]", ",", "\"id\"", ":", "[", "PilightDaemonSim", ...
[ 348, 0 ]
[ 363, 61 ]
python
en
['en', 'en', 'en']
True
test_call_rate_delay_throttle_enabled
(hass)
Test that throttling actually work.
Test that throttling actually work.
async def test_call_rate_delay_throttle_enabled(hass): """Test that throttling actually work.""" runs = [] delay = 5.0 limit = pilight.CallRateDelayThrottle(hass, delay) action = limit.limited(lambda x: runs.append(x)) for i in range(3): await hass.async_add_executor_job(action, i) ...
[ "async", "def", "test_call_rate_delay_throttle_enabled", "(", "hass", ")", ":", "runs", "=", "[", "]", "delay", "=", "5.0", "limit", "=", "pilight", ".", "CallRateDelayThrottle", "(", "hass", ",", "delay", ")", "action", "=", "limit", ".", "limited", "(", ...
[ 366, 0 ]
[ 387, 26 ]
python
en
['en', 'en', 'en']
True
test_call_rate_delay_throttle_disabled
(hass)
Test that the limiter is a noop if no delay set.
Test that the limiter is a noop if no delay set.
def test_call_rate_delay_throttle_disabled(hass): """Test that the limiter is a noop if no delay set.""" runs = [] limit = pilight.CallRateDelayThrottle(hass, 0.0) action = limit.limited(lambda x: runs.append(x)) for i in range(3): action(i) assert runs == [0, 1, 2]
[ "def", "test_call_rate_delay_throttle_disabled", "(", "hass", ")", ":", "runs", "=", "[", "]", "limit", "=", "pilight", ".", "CallRateDelayThrottle", "(", "hass", ",", "0.0", ")", "action", "=", "limit", ".", "limited", "(", "lambda", "x", ":", "runs", "."...
[ 390, 0 ]
[ 400, 28 ]
python
en
['en', 'en', 'en']
True
PilightDaemonSim.__init__
(self, host, port)
Init pilight client, ignore parameters.
Init pilight client, ignore parameters.
def __init__(self, host, port): """Init pilight client, ignore parameters."""
[ "def", "__init__", "(", "self", ",", "host", ",", "port", ")", ":" ]
[ 35, 4 ]
[ 36, 53 ]
python
en
['fr', 'la', 'en']
False
PilightDaemonSim.send_code
(self, call)
Handle pilight.send service callback.
Handle pilight.send service callback.
def send_code(self, call): # pylint: disable=no-self-use """Handle pilight.send service callback.""" _LOGGER.error("PilightDaemonSim payload: %s", call)
[ "def", "send_code", "(", "self", ",", "call", ")", ":", "# pylint: disable=no-self-use", "_LOGGER", ".", "error", "(", "\"PilightDaemonSim payload: %s\"", ",", "call", ")" ]
[ 38, 4 ]
[ 40, 59 ]
python
en
['en', 'ro', 'en']
True
PilightDaemonSim.start
(self)
Handle homeassistant.start callback. Also sends one test message after start up
Handle homeassistant.start callback.
def start(self): """Handle homeassistant.start callback. Also sends one test message after start up """ _LOGGER.error("PilightDaemonSim start") # Fake one code receive after daemon started if not self.called: self.callback(self.test_message) self....
[ "def", "start", "(", "self", ")", ":", "_LOGGER", ".", "error", "(", "\"PilightDaemonSim start\"", ")", "# Fake one code receive after daemon started", "if", "not", "self", ".", "called", ":", "self", ".", "callback", "(", "self", ".", "test_message", ")", "self...
[ 42, 4 ]
[ 51, 30 ]
python
en
['en', 'da', 'en']
True
PilightDaemonSim.stop
(self)
Handle homeassistant.stop callback.
Handle homeassistant.stop callback.
def stop(self): # pylint: disable=no-self-use """Handle homeassistant.stop callback.""" _LOGGER.error("PilightDaemonSim stop")
[ "def", "stop", "(", "self", ")", ":", "# pylint: disable=no-self-use", "_LOGGER", ".", "error", "(", "\"PilightDaemonSim stop\"", ")" ]
[ 53, 4 ]
[ 55, 46 ]
python
en
['en', 'en', 'en']
True
PilightDaemonSim.set_callback
(self, function)
Handle pilight.pilight_received event callback.
Handle pilight.pilight_received event callback.
def set_callback(self, function): """Handle pilight.pilight_received event callback.""" self.callback = function _LOGGER.error("PilightDaemonSim callback: %s", function)
[ "def", "set_callback", "(", "self", ",", "function", ")", ":", "self", ".", "callback", "=", "function", "_LOGGER", ".", "error", "(", "\"PilightDaemonSim callback: %s\"", ",", "function", ")" ]
[ 57, 4 ]
[ 60, 64 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up Lupusec switch devices.
Set up Lupusec switch devices.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up Lupusec switch devices.""" if discovery_info is None: return data = hass.data[LUPUSEC_DOMAIN] devices = [] for device in data.lupusec.get_devices(generic_type=CONST.TYPE_SWITCH): devices.append(Lupusec...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "data", "=", "hass", ".", "data", "[", "LUPUSEC_DOMAIN", "]", "devices", "=", "[", ...
[ 12, 0 ]
[ 25, 25 ]
python
en
['en', 'en', 'en']
True
LupusecSwitch.turn_on
(self, **kwargs)
Turn on the device.
Turn on the device.
def turn_on(self, **kwargs): """Turn on the device.""" self._device.switch_on()
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_device", ".", "switch_on", "(", ")" ]
[ 31, 4 ]
[ 33, 32 ]
python
en
['en', 'en', 'en']
True
LupusecSwitch.turn_off
(self, **kwargs)
Turn off the device.
Turn off the device.
def turn_off(self, **kwargs): """Turn off the device.""" self._device.switch_off()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_device", ".", "switch_off", "(", ")" ]
[ 35, 4 ]
[ 37, 33 ]
python
en
['en', 'en', 'en']
True
LupusecSwitch.is_on
(self)
Return true if device is on.
Return true if device is on.
def is_on(self): """Return true if device is on.""" return self._device.is_on
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "is_on" ]
[ 40, 4 ]
[ 42, 33 ]
python
en
['en', 'fy', 'en']
True
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback, )
Set up Plum Lightpad dimmer lights and glow rings.
Set up Plum Lightpad dimmer lights and glow rings.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Set up Plum Lightpad dimmer lights and glow rings.""" plum: Plum = hass.data[DOMAIN][entry.entry_id] def setup_entities(device) -> None: entities = [] i...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", ")", "->", "None", ":", "plum", ":", "Plum", "=", "hass", ".", "data", "[", "DOMAIN", "]", ...
[ 23, 0 ]
[ 60, 5 ]
python
en
['en', 'en', 'en']
True
PlumLight.__init__
(self, load)
Initialize the light.
Initialize the light.
def __init__(self, load): """Initialize the light.""" self._load = load self._brightness = load.level
[ "def", "__init__", "(", "self", ",", "load", ")", ":", "self", ".", "_load", "=", "load", "self", ".", "_brightness", "=", "load", ".", "level" ]
[ 66, 4 ]
[ 69, 37 ]
python
en
['en', 'en', 'en']
True
PlumLight.async_added_to_hass
(self)
Subscribe to dimmerchange events.
Subscribe to dimmerchange events.
async def async_added_to_hass(self): """Subscribe to dimmerchange events.""" self._load.add_event_listener("dimmerchange", self.dimmerchange)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_load", ".", "add_event_listener", "(", "\"dimmerchange\"", ",", "self", ".", "dimmerchange", ")" ]
[ 71, 4 ]
[ 73, 72 ]
python
en
['it', 'en', 'en']
True
PlumLight.dimmerchange
(self, event)
Change event handler updating the brightness.
Change event handler updating the brightness.
def dimmerchange(self, event): """Change event handler updating the brightness.""" self._brightness = event["level"] self.schedule_update_ha_state()
[ "def", "dimmerchange", "(", "self", ",", "event", ")", ":", "self", ".", "_brightness", "=", "event", "[", "\"level\"", "]", "self", ".", "schedule_update_ha_state", "(", ")" ]
[ 75, 4 ]
[ 78, 39 ]
python
en
['en', 'da', 'en']
True
PlumLight.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 81, 4 ]
[ 83, 20 ]
python
en
['en', 'en', 'en']
True
PlumLight.unique_id
(self)
Combine logical load ID with .light to guarantee it is unique.
Combine logical load ID with .light to guarantee it is unique.
def unique_id(self): """Combine logical load ID with .light to guarantee it is unique.""" return f"{self._load.llid}.light"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._load.llid}.light\"" ]
[ 86, 4 ]
[ 88, 41 ]
python
en
['en', 'en', 'en']
True
PlumLight.name
(self)
Return the name of the switch if any.
Return the name of the switch if any.
def name(self): """Return the name of the switch if any.""" return self._load.name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_load", ".", "name" ]
[ 91, 4 ]
[ 93, 30 ]
python
en
['en', 'en', 'en']
True
PlumLight.device_info
(self)
Return the device info.
Return the device info.
def device_info(self): """Return the device info.""" return { "name": self.name, "identifiers": {(DOMAIN, self.unique_id)}, "model": "Dimmer", "manufacturer": "Plum", }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"name\"", ":", "self", ".", "name", ",", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "unique_id", ")", "}", ",", "\"model\"", ":", "\"Dimmer\"", ",", "\"manufacturer\"", ":",...
[ 96, 4 ]
[ 103, 9 ]
python
en
['en', 'en', 'en']
True
PlumLight.brightness
(self)
Return the brightness of this switch between 0..255.
Return the brightness of this switch between 0..255.
def brightness(self) -> int: """Return the brightness of this switch between 0..255.""" return self._brightness
[ "def", "brightness", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_brightness" ]
[ 106, 4 ]
[ 108, 31 ]
python
en
['en', 'en', 'en']
True
PlumLight.is_on
(self)
Return true if light is on.
Return true if light is on.
def is_on(self) -> bool: """Return true if light is on.""" return self._brightness > 0
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_brightness", ">", "0" ]
[ 111, 4 ]
[ 113, 35 ]
python
en
['en', 'et', 'en']
True
PlumLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" if self._load.dimmable: return SUPPORT_BRIGHTNESS return 0
[ "def", "supported_features", "(", "self", ")", ":", "if", "self", ".", "_load", ".", "dimmable", ":", "return", "SUPPORT_BRIGHTNESS", "return", "0" ]
[ 116, 4 ]
[ 120, 16 ]
python
en
['da', 'en', 'en']
True
PlumLight.async_turn_on
(self, **kwargs)
Turn the light on.
Turn the light on.
async def async_turn_on(self, **kwargs): """Turn the light on.""" if ATTR_BRIGHTNESS in kwargs: await self._load.turn_on(kwargs[ATTR_BRIGHTNESS]) else: await self._load.turn_on()
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "ATTR_BRIGHTNESS", "in", "kwargs", ":", "await", "self", ".", "_load", ".", "turn_on", "(", "kwargs", "[", "ATTR_BRIGHTNESS", "]", ")", "else", ":", "await", "self", ...
[ 122, 4 ]
[ 127, 38 ]
python
en
['en', 'et', 'en']
True
PlumLight.async_turn_off
(self, **kwargs)
Turn the light off.
Turn the light off.
async def async_turn_off(self, **kwargs): """Turn the light off.""" await self._load.turn_off()
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_load", ".", "turn_off", "(", ")" ]
[ 129, 4 ]
[ 131, 35 ]
python
en
['en', 'zh', 'en']
True
GlowRing.__init__
(self, lightpad)
Initialize the light.
Initialize the light.
def __init__(self, lightpad): """Initialize the light.""" self._lightpad = lightpad self._name = f"{lightpad.friendly_name} Glow Ring" self._state = lightpad.glow_enabled self._glow_intensity = lightpad.glow_intensity self._red = lightpad.glow_color["red"] self....
[ "def", "__init__", "(", "self", ",", "lightpad", ")", ":", "self", ".", "_lightpad", "=", "lightpad", "self", ".", "_name", "=", "f\"{lightpad.friendly_name} Glow Ring\"", "self", ".", "_state", "=", "lightpad", ".", "glow_enabled", "self", ".", "_glow_intensity...
[ 137, 4 ]
[ 147, 48 ]
python
en
['en', 'en', 'en']
True
GlowRing.async_added_to_hass
(self)
Subscribe to configchange events.
Subscribe to configchange events.
async def async_added_to_hass(self): """Subscribe to configchange events.""" self._lightpad.add_event_listener("configchange", self.configchange_event)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_lightpad", ".", "add_event_listener", "(", "\"configchange\"", ",", "self", ".", "configchange_event", ")" ]
[ 149, 4 ]
[ 151, 82 ]
python
en
['en', 'en', 'en']
True
GlowRing.configchange_event
(self, event)
Handle Configuration change event.
Handle Configuration change event.
def configchange_event(self, event): """Handle Configuration change event.""" config = event["changes"] self._state = config["glowEnabled"] self._glow_intensity = config["glowIntensity"] self._red = config["glowColor"]["red"] self._green = config["glowColor"]["green"] ...
[ "def", "configchange_event", "(", "self", ",", "event", ")", ":", "config", "=", "event", "[", "\"changes\"", "]", "self", ".", "_state", "=", "config", "[", "\"glowEnabled\"", "]", "self", ".", "_glow_intensity", "=", "config", "[", "\"glowIntensity\"", "]"...
[ 153, 4 ]
[ 164, 39 ]
python
en
['es', 'fr', 'en']
False
GlowRing.hs_color
(self)
Return the hue and saturation color value [float, float].
Return the hue and saturation color value [float, float].
def hs_color(self): """Return the hue and saturation color value [float, float].""" return color_util.color_RGB_to_hs(self._red, self._green, self._blue)
[ "def", "hs_color", "(", "self", ")", ":", "return", "color_util", ".", "color_RGB_to_hs", "(", "self", ".", "_red", ",", "self", ".", "_green", ",", "self", ".", "_blue", ")" ]
[ 167, 4 ]
[ 169, 77 ]
python
en
['en', 'en', 'en']
True
GlowRing.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 172, 4 ]
[ 174, 20 ]
python
en
['en', 'en', 'en']
True
GlowRing.unique_id
(self)
Combine LightPad ID with .glow to guarantee it is unique.
Combine LightPad ID with .glow to guarantee it is unique.
def unique_id(self): """Combine LightPad ID with .glow to guarantee it is unique.""" return f"{self._lightpad.lpid}.glow"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._lightpad.lpid}.glow\"" ]
[ 177, 4 ]
[ 179, 44 ]
python
en
['en', 'en', 'en']
True
GlowRing.name
(self)
Return the name of the switch if any.
Return the name of the switch if any.
def name(self): """Return the name of the switch if any.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 182, 4 ]
[ 184, 25 ]
python
en
['en', 'en', 'en']
True