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
SighthoundEntity.process_image
(self, image)
Process an image.
Process an image.
def process_image(self, image): """Process an image.""" detections = self._api.detect(image) people = hound.get_people(detections) self._state = len(people) if self._state > 0: self._last_detection = dt_util.now().strftime(DATETIME_FORMAT) metadata = hound.ge...
[ "def", "process_image", "(", "self", ",", "image", ")", ":", "detections", "=", "self", ".", "_api", ".", "detect", "(", "image", ")", "people", "=", "hound", ".", "get_people", "(", "detections", ")", "self", ".", "_state", "=", "len", "(", "people", ...
[ 95, 4 ]
[ 109, 66 ]
python
en
['en', 'su', 'en']
True
SighthoundEntity.fire_person_detected_event
(self, person)
Send event with detected total_persons.
Send event with detected total_persons.
def fire_person_detected_event(self, person): """Send event with detected total_persons.""" self.hass.bus.fire( EVENT_PERSON_DETECTED, { ATTR_ENTITY_ID: self.entity_id, ATTR_BOUNDING_BOX: hound.bbox_to_tf_style( person["bounding...
[ "def", "fire_person_detected_event", "(", "self", ",", "person", ")", ":", "self", ".", "hass", ".", "bus", ".", "fire", "(", "EVENT_PERSON_DETECTED", ",", "{", "ATTR_ENTITY_ID", ":", "self", ".", "entity_id", ",", "ATTR_BOUNDING_BOX", ":", "hound", ".", "bb...
[ 111, 4 ]
[ 121, 9 ]
python
en
['en', 'en', 'en']
True
SighthoundEntity.save_image
(self, image, people, directory)
Save a timestamped image with bounding boxes around targets.
Save a timestamped image with bounding boxes around targets.
def save_image(self, image, people, directory): """Save a timestamped image with bounding boxes around targets.""" try: img = Image.open(io.BytesIO(bytearray(image))).convert("RGB") except UnidentifiedImageError: _LOGGER.warning("Sighthound unable to process image, bad da...
[ "def", "save_image", "(", "self", ",", "image", ",", "people", ",", "directory", ")", ":", "try", ":", "img", "=", "Image", ".", "open", "(", "io", ".", "BytesIO", "(", "bytearray", "(", "image", ")", ")", ")", ".", "convert", "(", "\"RGB\"", ")", ...
[ 123, 4 ]
[ 144, 73 ]
python
en
['en', 'en', 'en']
True
SighthoundEntity.camera_entity
(self)
Return camera entity id from process pictures.
Return camera entity id from process pictures.
def camera_entity(self): """Return camera entity id from process pictures.""" return self._camera
[ "def", "camera_entity", "(", "self", ")", ":", "return", "self", ".", "_camera" ]
[ 147, 4 ]
[ 149, 27 ]
python
en
['en', 'en', 'en']
True
SighthoundEntity.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 152, 4 ]
[ 154, 25 ]
python
en
['en', 'mi', 'en']
True
SighthoundEntity.should_poll
(self)
Return the polling state.
Return the polling state.
def should_poll(self): """Return the polling state.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 157, 4 ]
[ 159, 20 ]
python
en
['en', 'en', 'en']
True
SighthoundEntity.state
(self)
Return the state of the entity.
Return the state of the entity.
def state(self): """Return the state of the entity.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 162, 4 ]
[ 164, 26 ]
python
en
['en', 'en', 'en']
True
SighthoundEntity.unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def unit_of_measurement(self): """Return the unit of measurement.""" return ATTR_PEOPLE
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "ATTR_PEOPLE" ]
[ 167, 4 ]
[ 169, 26 ]
python
en
['en', 'la', 'en']
True
SighthoundEntity.device_state_attributes
(self)
Return the attributes.
Return the attributes.
def device_state_attributes(self): """Return the attributes.""" if not self._last_detection: return {} return {"last_person": self._last_detection}
[ "def", "device_state_attributes", "(", "self", ")", ":", "if", "not", "self", ".", "_last_detection", ":", "return", "{", "}", "return", "{", "\"last_person\"", ":", "self", ".", "_last_detection", "}" ]
[ 172, 4 ]
[ 176, 52 ]
python
en
['en', 'la', 'en']
True
CimDataGenerator.gen_data
(self, config_file: str, max_tick: int, start_tick: int = 0)
Generate data with specified configurations. Args: config_file(str): File of configuration (yaml). max_tick(int): Max tick to generate. start_tick(int): Start tick to generate. Returns: CimDataCollection: Data collection contains all cim data.
Generate data with specified configurations.
def gen_data(self, config_file: str, max_tick: int, start_tick: int = 0) -> CimDataCollection: """Generate data with specified configurations. Args: config_file(str): File of configuration (yaml). max_tick(int): Max tick to generate. start_tick(int): Start tick to ge...
[ "def", "gen_data", "(", "self", ",", "config_file", ":", "str", ",", "max_tick", ":", "int", ",", "start_tick", ":", "int", "=", "0", ")", "->", "CimDataCollection", ":", "# read config", "with", "open", "(", "config_file", ",", "\"r\"", ")", "as", "fp",...
[ 31, 4 ]
[ 87, 34 ]
python
en
['en', 'en', 'en']
True
CimDataGenerator._extend_route
( self, future_stop_number: int, max_tick: int, vessels_setting, ports_setting, port_mapping, routes, route_mapping )
Extend route with specified tick range.
Extend route with specified tick range.
def _extend_route( self, future_stop_number: int, max_tick: int, vessels_setting, ports_setting, port_mapping, routes, route_mapping ): """Extend route with specified tick range.""" vessels_stops: List[List[Stop]] = [] vessel_period_no_noise: list = [] # fill the re...
[ "def", "_extend_route", "(", "self", ",", "future_stop_number", ":", "int", ",", "max_tick", ":", "int", ",", "vessels_setting", ",", "ports_setting", ",", "port_mapping", ",", "routes", ",", "route_mapping", ")", ":", "vessels_stops", ":", "List", "[", "List"...
[ 89, 4 ]
[ 176, 52 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, entry, async_add_entities)
Set up the Roku config entry.
Set up the Roku config entry.
async def async_setup_entry(hass, entry, async_add_entities): """Set up the Roku config entry.""" coordinator = hass.data[DOMAIN][entry.entry_id] unique_id = coordinator.data.info.serial_number async_add_entities([RokuMediaPlayer(unique_id, coordinator)], True) platform = entity_platform.current_pl...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ",", "async_add_entities", ")", ":", "coordinator", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", "]", "unique_id", "=", "coordinator", ".", "data", ".", "info",...
[ 60, 0 ]
[ 72, 5 ]
python
en
['en', 'pt', 'en']
True
RokuMediaPlayer.__init__
(self, unique_id: str, coordinator: RokuDataUpdateCoordinator)
Initialize the Roku device.
Initialize the Roku device.
def __init__(self, unique_id: str, coordinator: RokuDataUpdateCoordinator) -> None: """Initialize the Roku device.""" super().__init__( coordinator=coordinator, name=coordinator.data.info.name, device_id=unique_id, ) self._unique_id = unique_id
[ "def", "__init__", "(", "self", ",", "unique_id", ":", "str", ",", "coordinator", ":", "RokuDataUpdateCoordinator", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", "=", "coordinator", ",", "name", "=", "coordinator", ".", "d...
[ 78, 4 ]
[ 86, 35 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer._media_playback_trackable
(self)
Detect if we have enough media data to track playback.
Detect if we have enough media data to track playback.
def _media_playback_trackable(self) -> bool: """Detect if we have enough media data to track playback.""" if self.coordinator.data.media is None or self.coordinator.data.media.live: return False return self.coordinator.data.media.duration > 0
[ "def", "_media_playback_trackable", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "coordinator", ".", "data", ".", "media", "is", "None", "or", "self", ".", "coordinator", ".", "data", ".", "media", ".", "live", ":", "return", "False", "return"...
[ 88, 4 ]
[ 93, 55 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.unique_id
(self)
Return the unique ID for this entity.
Return the unique ID for this entity.
def unique_id(self) -> str: """Return the unique ID for this entity.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_unique_id" ]
[ 96, 4 ]
[ 98, 30 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.device_class
(self)
Return the class of this device.
Return the class of this device.
def device_class(self) -> Optional[str]: """Return the class of this device.""" if self.coordinator.data.info.device_type == "tv": return DEVICE_CLASS_TV return DEVICE_CLASS_RECEIVER
[ "def", "device_class", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "self", ".", "coordinator", ".", "data", ".", "info", ".", "device_type", "==", "\"tv\"", ":", "return", "DEVICE_CLASS_TV", "return", "DEVICE_CLASS_RECEIVER" ]
[ 101, 4 ]
[ 106, 36 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.state
(self)
Return the state of the device.
Return the state of the device.
def state(self) -> str: """Return the state of the device.""" if self.coordinator.data.state.standby: return STATE_STANDBY if self.coordinator.data.app is None: return None if ( self.coordinator.data.app.name == "Power Saver" or self.coor...
[ "def", "state", "(", "self", ")", "->", "str", ":", "if", "self", ".", "coordinator", ".", "data", ".", "state", ".", "standby", ":", "return", "STATE_STANDBY", "if", "self", ".", "coordinator", ".", "data", ".", "app", "is", "None", ":", "return", "...
[ 109, 4 ]
[ 134, 19 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.supported_features
(self)
Flag media player features that are supported.
Flag media player features that are supported.
def supported_features(self): """Flag media player features that are supported.""" return SUPPORT_ROKU
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_ROKU" ]
[ 137, 4 ]
[ 139, 27 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.media_content_type
(self)
Content type of current playing media.
Content type of current playing media.
def media_content_type(self) -> str: """Content type of current playing media.""" if self.app_id is None or self.app_name in ("Power Saver", "Roku"): return None if self.app_id == "tvinput.dtv" and self.coordinator.data.channel is not None: return MEDIA_TYPE_CHANNEL ...
[ "def", "media_content_type", "(", "self", ")", "->", "str", ":", "if", "self", ".", "app_id", "is", "None", "or", "self", ".", "app_name", "in", "(", "\"Power Saver\"", ",", "\"Roku\"", ")", ":", "return", "None", "if", "self", ".", "app_id", "==", "\"...
[ 142, 4 ]
[ 150, 29 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.media_image_url
(self)
Image url of current playing media.
Image url of current playing media.
def media_image_url(self) -> str: """Image url of current playing media.""" if self.app_id is None or self.app_name in ("Power Saver", "Roku"): return None return self.coordinator.roku.app_icon_url(self.app_id)
[ "def", "media_image_url", "(", "self", ")", "->", "str", ":", "if", "self", ".", "app_id", "is", "None", "or", "self", ".", "app_name", "in", "(", "\"Power Saver\"", ",", "\"Roku\"", ")", ":", "return", "None", "return", "self", ".", "coordinator", ".", ...
[ 153, 4 ]
[ 158, 62 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.app_name
(self)
Name of the current running app.
Name of the current running app.
def app_name(self) -> str: """Name of the current running app.""" if self.coordinator.data.app is not None: return self.coordinator.data.app.name return None
[ "def", "app_name", "(", "self", ")", "->", "str", ":", "if", "self", ".", "coordinator", ".", "data", ".", "app", "is", "not", "None", ":", "return", "self", ".", "coordinator", ".", "data", ".", "app", ".", "name", "return", "None" ]
[ 161, 4 ]
[ 166, 19 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.app_id
(self)
Return the ID of the current running app.
Return the ID of the current running app.
def app_id(self) -> str: """Return the ID of the current running app.""" if self.coordinator.data.app is not None: return self.coordinator.data.app.app_id return None
[ "def", "app_id", "(", "self", ")", "->", "str", ":", "if", "self", ".", "coordinator", ".", "data", ".", "app", "is", "not", "None", ":", "return", "self", ".", "coordinator", ".", "data", ".", "app", ".", "app_id", "return", "None" ]
[ 169, 4 ]
[ 174, 19 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.media_channel
(self)
Return the TV channel currently tuned.
Return the TV channel currently tuned.
def media_channel(self): """Return the TV channel currently tuned.""" if self.app_id != "tvinput.dtv" or self.coordinator.data.channel is None: return None if self.coordinator.data.channel.name is not None: return f"{self.coordinator.data.channel.name} ({self.coordinator...
[ "def", "media_channel", "(", "self", ")", ":", "if", "self", ".", "app_id", "!=", "\"tvinput.dtv\"", "or", "self", ".", "coordinator", ".", "data", ".", "channel", "is", "None", ":", "return", "None", "if", "self", ".", "coordinator", ".", "data", ".", ...
[ 177, 4 ]
[ 185, 51 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.media_title
(self)
Return the title of current playing media.
Return the title of current playing media.
def media_title(self): """Return the title of current playing media.""" if self.app_id != "tvinput.dtv" or self.coordinator.data.channel is None: return None if self.coordinator.data.channel.program_title is not None: return self.coordinator.data.channel.program_title ...
[ "def", "media_title", "(", "self", ")", ":", "if", "self", ".", "app_id", "!=", "\"tvinput.dtv\"", "or", "self", ".", "coordinator", ".", "data", ".", "channel", "is", "None", ":", "return", "None", "if", "self", ".", "coordinator", ".", "data", ".", "...
[ 188, 4 ]
[ 196, 19 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.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.""" if self._media_playback_trackable(): return self.coordinator.data.media.duration return None
[ "def", "media_duration", "(", "self", ")", ":", "if", "self", ".", "_media_playback_trackable", "(", ")", ":", "return", "self", ".", "coordinator", ".", "data", ".", "media", ".", "duration", "return", "None" ]
[ 199, 4 ]
[ 204, 19 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.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.""" if self._media_playback_trackable(): return self.coordinator.data.media.position return None
[ "def", "media_position", "(", "self", ")", ":", "if", "self", ".", "_media_playback_trackable", "(", ")", ":", "return", "self", ".", "coordinator", ".", "data", ".", "media", ".", "position", "return", "None" ]
[ 207, 4 ]
[ 212, 19 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.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.""" if self._media_playback_trackable(): return self.coordinator.data.media.at return None
[ "def", "media_position_updated_at", "(", "self", ")", ":", "if", "self", ".", "_media_playback_trackable", "(", ")", ":", "return", "self", ".", "coordinator", ".", "data", ".", "media", ".", "at", "return", "None" ]
[ 215, 4 ]
[ 220, 19 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.source
(self)
Return the current input source.
Return the current input source.
def source(self) -> str: """Return the current input source.""" if self.coordinator.data.app is not None: return self.coordinator.data.app.name return None
[ "def", "source", "(", "self", ")", "->", "str", ":", "if", "self", ".", "coordinator", ".", "data", ".", "app", "is", "not", "None", ":", "return", "self", ".", "coordinator", ".", "data", ".", "app", ".", "name", "return", "None" ]
[ 223, 4 ]
[ 228, 19 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.source_list
(self)
List of available input sources.
List of available input sources.
def source_list(self) -> List: """List of available input sources.""" return ["Home"] + sorted(app.name for app in self.coordinator.data.apps)
[ "def", "source_list", "(", "self", ")", "->", "List", ":", "return", "[", "\"Home\"", "]", "+", "sorted", "(", "app", ".", "name", "for", "app", "in", "self", ".", "coordinator", ".", "data", ".", "apps", ")" ]
[ 231, 4 ]
[ 233, 80 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.search
(self, keyword)
Emulate opening the search screen and entering the search keyword.
Emulate opening the search screen and entering the search keyword.
async def search(self, keyword): """Emulate opening the search screen and entering the search keyword.""" await self.coordinator.roku.search(keyword)
[ "async", "def", "search", "(", "self", ",", "keyword", ")", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "search", "(", "keyword", ")" ]
[ 236, 4 ]
[ 238, 51 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.async_get_browse_image
( self, media_content_type, media_content_id, media_image_id=None )
Fetch media browser image to serve via proxy.
Fetch media browser image to serve via proxy.
async def async_get_browse_image( self, media_content_type, media_content_id, media_image_id=None ): """Fetch media browser image to serve via proxy.""" if media_content_type == MEDIA_TYPE_APP and media_content_id: image_url = self.coordinator.roku.app_icon_url(media_content_id) ...
[ "async", "def", "async_get_browse_image", "(", "self", ",", "media_content_type", ",", "media_content_id", ",", "media_image_id", "=", "None", ")", ":", "if", "media_content_type", "==", "MEDIA_TYPE_APP", "and", "media_content_id", ":", "image_url", "=", "self", "."...
[ 240, 4 ]
[ 248, 27 ]
python
en
['en', 'cs', 'en']
True
RokuMediaPlayer.async_browse_media
(self, media_content_type=None, media_content_id=None)
Implement the websocket media browsing helper.
Implement the websocket media browsing helper.
async def async_browse_media(self, media_content_type=None, media_content_id=None): """Implement the websocket media browsing helper.""" def _get_thumbnail_url(*args, **kwargs): return self.get_browse_image_url(*args, **kwargs) if media_content_type in [None, "library"]: ...
[ "async", "def", "async_browse_media", "(", "self", ",", "media_content_type", "=", "None", ",", "media_content_id", "=", "None", ")", ":", "def", "_get_thumbnail_url", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "get_browse_im...
[ 250, 4 ]
[ 270, 23 ]
python
en
['en', 'af', 'en']
True
RokuMediaPlayer.async_turn_on
(self)
Turn on the Roku.
Turn on the Roku.
async def async_turn_on(self) -> None: """Turn on the Roku.""" await self.coordinator.roku.remote("poweron") await self.coordinator.async_request_refresh()
[ "async", "def", "async_turn_on", "(", "self", ")", "->", "None", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"poweron\"", ")", "await", "self", ".", "coordinator", ".", "async_request_refresh", "(", ")" ]
[ 273, 4 ]
[ 276, 54 ]
python
en
['en', 'tg', 'en']
True
RokuMediaPlayer.async_turn_off
(self)
Turn off the Roku.
Turn off the Roku.
async def async_turn_off(self) -> None: """Turn off the Roku.""" await self.coordinator.roku.remote("poweroff") await self.coordinator.async_request_refresh()
[ "async", "def", "async_turn_off", "(", "self", ")", "->", "None", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"poweroff\"", ")", "await", "self", ".", "coordinator", ".", "async_request_refresh", "(", ")" ]
[ 279, 4 ]
[ 282, 54 ]
python
en
['en', 'tg', 'en']
True
RokuMediaPlayer.async_media_pause
(self)
Send pause command.
Send pause command.
async def async_media_pause(self) -> None: """Send pause command.""" if self.state not in (STATE_STANDBY, STATE_PAUSED): await self.coordinator.roku.remote("play") await self.coordinator.async_request_refresh()
[ "async", "def", "async_media_pause", "(", "self", ")", "->", "None", ":", "if", "self", ".", "state", "not", "in", "(", "STATE_STANDBY", ",", "STATE_PAUSED", ")", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"play\"", ")",...
[ 285, 4 ]
[ 289, 58 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.async_media_play
(self)
Send play command.
Send play command.
async def async_media_play(self) -> None: """Send play command.""" if self.state not in (STATE_STANDBY, STATE_PLAYING): await self.coordinator.roku.remote("play") await self.coordinator.async_request_refresh()
[ "async", "def", "async_media_play", "(", "self", ")", "->", "None", ":", "if", "self", ".", "state", "not", "in", "(", "STATE_STANDBY", ",", "STATE_PLAYING", ")", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"play\"", ")",...
[ 292, 4 ]
[ 296, 58 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.async_media_play_pause
(self)
Send play/pause command.
Send play/pause command.
async def async_media_play_pause(self) -> None: """Send play/pause command.""" if self.state != STATE_STANDBY: await self.coordinator.roku.remote("play") await self.coordinator.async_request_refresh()
[ "async", "def", "async_media_play_pause", "(", "self", ")", "->", "None", ":", "if", "self", ".", "state", "!=", "STATE_STANDBY", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"play\"", ")", "await", "self", ".", "coordinator...
[ 299, 4 ]
[ 303, 58 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.async_media_previous_track
(self)
Send previous track command.
Send previous track command.
async def async_media_previous_track(self) -> None: """Send previous track command.""" await self.coordinator.roku.remote("reverse") await self.coordinator.async_request_refresh()
[ "async", "def", "async_media_previous_track", "(", "self", ")", "->", "None", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"reverse\"", ")", "await", "self", ".", "coordinator", ".", "async_request_refresh", "(", ")" ]
[ 306, 4 ]
[ 309, 54 ]
python
en
['en', 'it', 'en']
True
RokuMediaPlayer.async_media_next_track
(self)
Send next track command.
Send next track command.
async def async_media_next_track(self) -> None: """Send next track command.""" await self.coordinator.roku.remote("forward") await self.coordinator.async_request_refresh()
[ "async", "def", "async_media_next_track", "(", "self", ")", "->", "None", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"forward\"", ")", "await", "self", ".", "coordinator", ".", "async_request_refresh", "(", ")" ]
[ 312, 4 ]
[ 315, 54 ]
python
en
['en', 'pt', 'en']
True
RokuMediaPlayer.async_mute_volume
(self, mute)
Mute the volume.
Mute the volume.
async def async_mute_volume(self, mute) -> None: """Mute the volume.""" await self.coordinator.roku.remote("volume_mute") await self.coordinator.async_request_refresh()
[ "async", "def", "async_mute_volume", "(", "self", ",", "mute", ")", "->", "None", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"volume_mute\"", ")", "await", "self", ".", "coordinator", ".", "async_request_refresh", "(", ")" ]
[ 318, 4 ]
[ 321, 54 ]
python
en
['en', 'sn', 'en']
True
RokuMediaPlayer.async_volume_up
(self)
Volume up media player.
Volume up media player.
async def async_volume_up(self) -> None: """Volume up media player.""" await self.coordinator.roku.remote("volume_up")
[ "async", "def", "async_volume_up", "(", "self", ")", "->", "None", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"volume_up\"", ")" ]
[ 324, 4 ]
[ 326, 55 ]
python
en
['en', 'no', 'en']
True
RokuMediaPlayer.async_volume_down
(self)
Volume down media player.
Volume down media player.
async def async_volume_down(self) -> None: """Volume down media player.""" await self.coordinator.roku.remote("volume_down")
[ "async", "def", "async_volume_down", "(", "self", ")", "->", "None", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"volume_down\"", ")" ]
[ 329, 4 ]
[ 331, 57 ]
python
en
['en', 'sl', 'en']
True
RokuMediaPlayer.async_play_media
(self, media_type: str, media_id: str, **kwargs)
Tune to channel.
Tune to channel.
async def async_play_media(self, media_type: str, media_id: str, **kwargs) -> None: """Tune to channel.""" if media_type not in (MEDIA_TYPE_APP, MEDIA_TYPE_CHANNEL): _LOGGER.error( "Invalid media type %s. Only %s and %s are supported", media_type, ...
[ "async", "def", "async_play_media", "(", "self", ",", "media_type", ":", "str", ",", "media_id", ":", "str", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "media_type", "not", "in", "(", "MEDIA_TYPE_APP", ",", "MEDIA_TYPE_CHANNEL", ")", ":", "_L...
[ 334, 4 ]
[ 350, 54 ]
python
en
['en', 'en', 'en']
True
RokuMediaPlayer.async_select_source
(self, source: str)
Select input source.
Select input source.
async def async_select_source(self, source: str) -> None: """Select input source.""" if source == "Home": await self.coordinator.roku.remote("home") appl = next( ( app for app in self.coordinator.data.apps if source in (app...
[ "async", "def", "async_select_source", "(", "self", ",", "source", ":", "str", ")", "->", "None", ":", "if", "source", "==", "\"Home\"", ":", "await", "self", ".", "coordinator", ".", "roku", ".", "remote", "(", "\"home\"", ")", "appl", "=", "next", "(...
[ 353, 4 ]
[ 370, 54 ]
python
en
['fr', 'su', 'en']
False
async_setup_entry
(hass, config_entry, async_add_entities)
Set up August locks.
Set up August locks.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up August locks.""" data = hass.data[DOMAIN][config_entry.entry_id][DATA_AUGUST] devices = [] for lock in data.locks: _LOGGER.debug("Adding lock for %s", lock.device_name) devices.append(AugustLock(data, lock)) ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "[", "DATA_AUGUST", "]", "devices", "=", "[", "]", ...
[ 18, 0 ]
[ 27, 37 ]
python
en
['en', 'et', 'en']
True
AugustLock.__init__
(self, data, device)
Initialize the lock.
Initialize the lock.
def __init__(self, data, device): """Initialize the lock.""" super().__init__(data, device) self._data = data self._device = device self._lock_status = None self._changed_by = None self._available = False self._update_from_data()
[ "def", "__init__", "(", "self", ",", "data", ",", "device", ")", ":", "super", "(", ")", ".", "__init__", "(", "data", ",", "device", ")", "self", ".", "_data", "=", "data", "self", ".", "_device", "=", "device", "self", ".", "_lock_status", "=", "...
[ 33, 4 ]
[ 41, 32 ]
python
en
['en', 'en', 'en']
True
AugustLock.async_lock
(self, **kwargs)
Lock the device.
Lock the device.
async def async_lock(self, **kwargs): """Lock the device.""" await self._call_lock_operation(self._data.async_lock)
[ "async", "def", "async_lock", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_call_lock_operation", "(", "self", ".", "_data", ".", "async_lock", ")" ]
[ 43, 4 ]
[ 45, 62 ]
python
en
['en', 'en', 'en']
True
AugustLock.async_unlock
(self, **kwargs)
Unlock the device.
Unlock the device.
async def async_unlock(self, **kwargs): """Unlock the device.""" await self._call_lock_operation(self._data.async_unlock)
[ "async", "def", "async_unlock", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_call_lock_operation", "(", "self", ".", "_data", ".", "async_unlock", ")" ]
[ 47, 4 ]
[ 49, 64 ]
python
en
['en', 'zh', 'en']
True
AugustLock._update_from_data
(self)
Get the latest state of the sensor and update activity.
Get the latest state of the sensor and update activity.
def _update_from_data(self): """Get the latest state of the sensor and update activity.""" lock_activity = self._data.activity_stream.get_latest_device_activity( self._device_id, [ActivityType.LOCK_OPERATION] ) if lock_activity is not None: self._changed_by = loc...
[ "def", "_update_from_data", "(", "self", ")", ":", "lock_activity", "=", "self", ".", "_data", ".", "activity_stream", ".", "get_latest_device_activity", "(", "self", ".", "_device_id", ",", "[", "ActivityType", ".", "LOCK_OPERATION", "]", ")", "if", "lock_activ...
[ 72, 4 ]
[ 82, 46 ]
python
en
['en', 'en', 'en']
True
AugustLock.name
(self)
Return the name of this device.
Return the name of this device.
def name(self): """Return the name of this device.""" return self._device.device_name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "device_name" ]
[ 85, 4 ]
[ 87, 39 ]
python
en
['en', 'en', 'en']
True
AugustLock.available
(self)
Return the availability of this sensor.
Return the availability of this sensor.
def available(self): """Return the availability of this sensor.""" return self._available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_available" ]
[ 90, 4 ]
[ 92, 30 ]
python
en
['en', 'en', 'en']
True
AugustLock.is_locked
(self)
Return true if device is on.
Return true if device is on.
def is_locked(self): """Return true if device is on.""" if self._lock_status is None or self._lock_status is LockStatus.UNKNOWN: return None return self._lock_status is LockStatus.LOCKED
[ "def", "is_locked", "(", "self", ")", ":", "if", "self", ".", "_lock_status", "is", "None", "or", "self", ".", "_lock_status", "is", "LockStatus", ".", "UNKNOWN", ":", "return", "None", "return", "self", ".", "_lock_status", "is", "LockStatus", ".", "LOCKE...
[ 95, 4 ]
[ 99, 53 ]
python
en
['en', 'fy', 'en']
True
AugustLock.changed_by
(self)
Last change triggered by.
Last change triggered by.
def changed_by(self): """Last change triggered by.""" return self._changed_by
[ "def", "changed_by", "(", "self", ")", ":", "return", "self", ".", "_changed_by" ]
[ 102, 4 ]
[ 104, 31 ]
python
en
['en', 'en', 'en']
True
AugustLock.device_state_attributes
(self)
Return the device specific state attributes.
Return the device specific state attributes.
def device_state_attributes(self): """Return the device specific state attributes.""" attributes = {ATTR_BATTERY_LEVEL: self._detail.battery_level} if self._detail.keypad is not None: attributes["keypad_battery_level"] = self._detail.keypad.battery_level return attributes
[ "def", "device_state_attributes", "(", "self", ")", ":", "attributes", "=", "{", "ATTR_BATTERY_LEVEL", ":", "self", ".", "_detail", ".", "battery_level", "}", "if", "self", ".", "_detail", ".", "keypad", "is", "not", "None", ":", "attributes", "[", "\"keypad...
[ 107, 4 ]
[ 114, 25 ]
python
en
['en', 'en', 'en']
True
AugustLock.async_added_to_hass
(self)
Restore ATTR_CHANGED_BY on startup since it is likely no longer in the activity log.
Restore ATTR_CHANGED_BY on startup since it is likely no longer in the activity log.
async def async_added_to_hass(self): """Restore ATTR_CHANGED_BY on startup since it is likely no longer in the activity log.""" await super().async_added_to_hass() last_state = await self.async_get_last_state() if not last_state: return if ATTR_CHANGED_BY in last_st...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "last_state", "=", "await", "self", ".", "async_get_last_state", "(", ")", "if", "not", "last_state", ":", "return", "if", "ATTR_C...
[ 116, 4 ]
[ 125, 69 ]
python
en
['en', 'en', 'en']
True
AugustLock.unique_id
(self)
Get the unique id of the lock.
Get the unique id of the lock.
def unique_id(self) -> str: """Get the unique id of the lock.""" return f"{self._device_id:s}_lock"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "f\"{self._device_id:s}_lock\"" ]
[ 128, 4 ]
[ 130, 42 ]
python
en
['en', 'en', 'en']
True
BrowseMediaSource.__init__
(self, *, domain: Optional[str], identifier: Optional[str], **kwargs)
Initialize media source browse media.
Initialize media source browse media.
def __init__(self, *, domain: Optional[str], identifier: Optional[str], **kwargs): """Initialize media source browse media.""" media_content_id = f"{URI_SCHEME}{domain or ''}" if identifier: media_content_id += f"/{identifier}" super().__init__(media_content_id=media_content...
[ "def", "__init__", "(", "self", ",", "*", ",", "domain", ":", "Optional", "[", "str", "]", ",", "identifier", ":", "Optional", "[", "str", "]", ",", "*", "*", "kwargs", ")", ":", "media_content_id", "=", "f\"{URI_SCHEME}{domain or ''}\"", "if", "identifier...
[ 30, 4 ]
[ 39, 36 ]
python
en
['fr', 'en', 'it']
False
MediaSource.__init__
(self, domain: str)
Initialize a media source.
Initialize a media source.
def __init__(self, domain: str): """Initialize a media source.""" self.domain = domain if not self.name: self.name = domain
[ "def", "__init__", "(", "self", ",", "domain", ":", "str", ")", ":", "self", ".", "domain", "=", "domain", "if", "not", "self", ".", "name", ":", "self", ".", "name", "=", "domain" ]
[ 107, 4 ]
[ 111, 30 ]
python
en
['en', 'en', 'en']
True
MediaSource.async_resolve_media
(self, item: MediaSourceItem)
Resolve a media item to a playable item.
Resolve a media item to a playable item.
async def async_resolve_media(self, item: MediaSourceItem) -> PlayMedia: """Resolve a media item to a playable item.""" raise NotImplementedError
[ "async", "def", "async_resolve_media", "(", "self", ",", "item", ":", "MediaSourceItem", ")", "->", "PlayMedia", ":", "raise", "NotImplementedError" ]
[ 113, 4 ]
[ 115, 33 ]
python
en
['en', 'en', 'en']
True
MediaSource.async_browse_media
( self, item: MediaSourceItem, media_types: Tuple[str] )
Browse media.
Browse media.
async def async_browse_media( self, item: MediaSourceItem, media_types: Tuple[str] ) -> BrowseMediaSource: """Browse media.""" raise NotImplementedError
[ "async", "def", "async_browse_media", "(", "self", ",", "item", ":", "MediaSourceItem", ",", "media_types", ":", "Tuple", "[", "str", "]", ")", "->", "BrowseMediaSource", ":", "raise", "NotImplementedError" ]
[ 117, 4 ]
[ 121, 33 ]
python
en
['en', 'en', 'en']
False
test_constructor_loads_info_from_config
(hass)
Test non-dev mode loads info from SERVERS constant.
Test non-dev mode loads info from SERVERS constant.
async def test_constructor_loads_info_from_config(hass): """Test non-dev mode loads info from SERVERS constant.""" with patch("hass_nabucasa.Cloud.start"): result = await async_setup_component( hass, "cloud", { "http": {}, "cloud": { ...
[ "async", "def", "test_constructor_loads_info_from_config", "(", "hass", ")", ":", "with", "patch", "(", "\"hass_nabucasa.Cloud.start\"", ")", ":", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"cloud\"", ",", "{", "\"http\"", ":", "{", "}", ...
[ 15, 0 ]
[ 54, 5 ]
python
en
['en', 'en', 'en']
True
test_remote_services
(hass, mock_cloud_fixture, hass_read_only_user)
Setup cloud component and test services.
Setup cloud component and test services.
async def test_remote_services(hass, mock_cloud_fixture, hass_read_only_user): """Setup cloud component and test services.""" cloud = hass.data[DOMAIN] assert hass.services.has_service(DOMAIN, "remote_connect") assert hass.services.has_service(DOMAIN, "remote_disconnect") with patch("hass_nabucasa...
[ "async", "def", "test_remote_services", "(", "hass", ",", "mock_cloud_fixture", ",", "hass_read_only_user", ")", ":", "cloud", "=", "hass", ".", "data", "[", "DOMAIN", "]", "assert", "hass", ".", "services", ".", "has_service", "(", "DOMAIN", ",", "\"remote_co...
[ 57, 0 ]
[ 95, 42 ]
python
en
['en', 'en', 'en']
True
test_startup_shutdown_events
(hass, mock_cloud_fixture)
Test if the cloud will start on startup event.
Test if the cloud will start on startup event.
async def test_startup_shutdown_events(hass, mock_cloud_fixture): """Test if the cloud will start on startup event.""" with patch("hass_nabucasa.Cloud.stop") as mock_stop: hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP) await hass.async_block_till_done() assert mock_stop.called
[ "async", "def", "test_startup_shutdown_events", "(", "hass", ",", "mock_cloud_fixture", ")", ":", "with", "patch", "(", "\"hass_nabucasa.Cloud.stop\"", ")", "as", "mock_stop", ":", "hass", ".", "bus", ".", "async_fire", "(", "EVENT_HOMEASSISTANT_STOP", ")", "await",...
[ 98, 0 ]
[ 104, 27 ]
python
en
['en', 'en', 'en']
True
test_setup_existing_cloud_user
(hass, hass_storage)
Test setup with API push default data.
Test setup with API push default data.
async def test_setup_existing_cloud_user(hass, hass_storage): """Test setup with API push default data.""" user = await hass.auth.async_create_system_user("Cloud test") hass_storage[STORAGE_KEY] = {"version": 1, "data": {"cloud_user": user.id}} with patch("hass_nabucasa.Cloud.start"): result = a...
[ "async", "def", "test_setup_existing_cloud_user", "(", "hass", ",", "hass_storage", ")", ":", "user", "=", "await", "hass", ".", "auth", ".", "async_create_system_user", "(", "\"Cloud test\"", ")", "hass_storage", "[", "STORAGE_KEY", "]", "=", "{", "\"version\"", ...
[ 107, 0 ]
[ 128, 69 ]
python
en
['en', 'hi-Latn', 'en']
True
test_on_connect
(hass, mock_cloud_fixture)
Test cloud on connect triggers.
Test cloud on connect triggers.
async def test_on_connect(hass, mock_cloud_fixture): """Test cloud on connect triggers.""" cl = hass.data["cloud"] assert len(cl.iot._on_connect) == 3 assert len(hass.states.async_entity_ids("binary_sensor")) == 0 assert "async_setup" in str(cl.iot._on_connect[-1]) await cl.iot._on_connect[-1...
[ "async", "def", "test_on_connect", "(", "hass", ",", "mock_cloud_fixture", ")", ":", "cl", "=", "hass", ".", "data", "[", "\"cloud\"", "]", "assert", "len", "(", "cl", ".", "iot", ".", "_on_connect", ")", "==", "3", "assert", "len", "(", "hass", ".", ...
[ 131, 0 ]
[ 149, 41 ]
python
en
['en', 'en', 'en']
True
test_remote_ui_url
(hass, mock_cloud_fixture)
Test getting remote ui url.
Test getting remote ui url.
async def test_remote_ui_url(hass, mock_cloud_fixture): """Test getting remote ui url.""" cl = hass.data["cloud"] # Not logged in with pytest.raises(cloud.CloudNotAvailable): cloud.async_remote_ui_url(hass) with patch.object(cloud, "async_is_logged_in", return_value=True): # Remote...
[ "async", "def", "test_remote_ui_url", "(", "hass", ",", "mock_cloud_fixture", ")", ":", "cl", "=", "hass", ".", "data", "[", "\"cloud\"", "]", "# Not logged in", "with", "pytest", ".", "raises", "(", "cloud", ".", "CloudNotAvailable", ")", ":", "cloud", ".",...
[ 152, 0 ]
[ 173, 71 ]
python
cy
['nl', 'cy', 'en']
False
async_setup
(hass, config)
Set up the Ness Alarm platform.
Set up the Ness Alarm platform.
async def async_setup(hass, config): """Set up the Ness Alarm platform.""" conf = config[DOMAIN] zones = conf[CONF_ZONES] host = conf[CONF_HOST] port = conf[CONF_DEVICE_PORT] scan_interval = conf[CONF_SCAN_INTERVAL] infer_arming_state = conf[CONF_INFER_ARMING_STATE] client = Client( ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "zones", "=", "conf", "[", "CONF_ZONES", "]", "host", "=", "conf", "[", "CONF_HOST", "]", "port", "=", "conf", "[", "CONF_DEVICE_PORT", "]",...
[ 80, 0 ]
[ 142, 15 ]
python
en
['en', 'lv', 'en']
True
send_message
(hass, topic, message)
Test the sending of a message.
Test the sending of a message.
async def send_message(hass, topic, message): """Test the sending of a message.""" async_fire_mqtt_message(hass, topic, json.dumps(message)) await hass.async_block_till_done() await hass.async_block_till_done()
[ "async", "def", "send_message", "(", "hass", ",", "topic", ",", "message", ")", ":", "async_fire_mqtt_message", "(", "hass", ",", "topic", ",", "json", ".", "dumps", "(", "message", ")", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "await"...
[ 33, 0 ]
[ 37, 38 ]
python
en
['en', 'en', 'en']
True
assert_state
(hass, room)
Test the assertion of a room state.
Test the assertion of a room state.
async def assert_state(hass, room): """Test the assertion of a room state.""" state = hass.states.get(SENSOR_STATE) assert state.state == room
[ "async", "def", "assert_state", "(", "hass", ",", "room", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "SENSOR_STATE", ")", "assert", "state", ".", "state", "==", "room" ]
[ 40, 0 ]
[ 43, 30 ]
python
en
['en', 'en', 'en']
True
assert_distance
(hass, distance)
Test the assertion of a distance state.
Test the assertion of a distance state.
async def assert_distance(hass, distance): """Test the assertion of a distance state.""" state = hass.states.get(SENSOR_STATE) assert state.attributes.get("distance") == distance
[ "async", "def", "assert_distance", "(", "hass", ",", "distance", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "SENSOR_STATE", ")", "assert", "state", ".", "attributes", ".", "get", "(", "\"distance\"", ")", "==", "distance" ]
[ 46, 0 ]
[ 49, 55 ]
python
en
['en', 'en', 'en']
True
test_room_update
(hass, mqtt_mock)
Test the updating between rooms.
Test the updating between rooms.
async def test_room_update(hass, mqtt_mock): """Test the updating between rooms.""" assert await async_setup_component( hass, sensor.DOMAIN, { sensor.DOMAIN: { CONF_PLATFORM: "mqtt_room", CONF_NAME: NAME, CONF_DEVICE_ID: DEVICE_...
[ "async", "def", "test_room_update", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "sensor", ".", "DOMAIN", ",", "{", "sensor", ".", "DOMAIN", ":", "{", "CONF_PLATFORM", ":", "\"mqtt_room\"", ",", "CONF...
[ 52, 0 ]
[ 86, 39 ]
python
en
['en', 'nl', 'en']
True
test_fail_setup_if_no_command_topic
(hass, mqtt_mock)
Test if command fails with command topic.
Test if command fails with command topic.
async def test_fail_setup_if_no_command_topic(hass, mqtt_mock): """Test if command fails with command topic.""" assert await async_setup_component( hass, fan.DOMAIN, {fan.DOMAIN: {"platform": "mqtt", "name": "test"}} ) await hass.async_block_till_done() assert hass.states.get("fan.test") is ...
[ "async", "def", "test_fail_setup_if_no_command_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "fan", ".", "DOMAIN", ",", "{", "fan", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", ...
[ 50, 0 ]
[ 56, 46 ]
python
en
['en', 'en', 'en']
True
test_controlling_state_via_topic
(hass, mqtt_mock)
Test the controlling state via topic.
Test the controlling state via topic.
async def test_controlling_state_via_topic(hass, mqtt_mock): """Test the controlling state via topic.""" assert await async_setup_component( hass, fan.DOMAIN, { fan.DOMAIN: { "platform": "mqtt", "name": "test", "state_topic": "s...
[ "async", "def", "test_controlling_state_via_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "fan", ".", "DOMAIN", ",", "{", "fan", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "...
[ 59, 0 ]
[ 124, 57 ]
python
en
['en', 'en', 'en']
True
test_controlling_state_via_topic_and_json_message
(hass, mqtt_mock)
Test the controlling state via topic and JSON message.
Test the controlling state via topic and JSON message.
async def test_controlling_state_via_topic_and_json_message(hass, mqtt_mock): """Test the controlling state via topic and JSON message.""" assert await async_setup_component( hass, fan.DOMAIN, { fan.DOMAIN: { "platform": "mqtt", "name": "test",...
[ "async", "def", "test_controlling_state_via_topic_and_json_message", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "fan", ".", "DOMAIN", ",", "{", "fan", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mq...
[ 127, 0 ]
[ 187, 57 ]
python
en
['en', 'en', 'en']
True
test_sending_mqtt_commands_and_optimistic
(hass, mqtt_mock)
Test optimistic mode without state topic.
Test optimistic mode without state topic.
async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock): """Test optimistic mode without state topic.""" assert await async_setup_component( hass, fan.DOMAIN, { fan.DOMAIN: { "platform": "mqtt", "name": "test", "com...
[ "async", "def", "test_sending_mqtt_commands_and_optimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "fan", ".", "DOMAIN", ",", "{", "fan", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ...
[ 190, 0 ]
[ 291, 51 ]
python
en
['en', 'en', 'en']
True
test_on_sending_mqtt_commands_and_optimistic
(hass, mqtt_mock)
Test on with speed.
Test on with speed.
async def test_on_sending_mqtt_commands_and_optimistic(hass, mqtt_mock): """Test on with speed.""" assert await async_setup_component( hass, fan.DOMAIN, { fan.DOMAIN: { "platform": "mqtt", "name": "test", "command_topic": "comma...
[ "async", "def", "test_on_sending_mqtt_commands_and_optimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "fan", ".", "DOMAIN", ",", "{", "fan", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\""...
[ 294, 0 ]
[ 340, 61 ]
python
en
['en', 'en', 'en']
True
test_sending_mqtt_commands_and_explicit_optimistic
(hass, mqtt_mock)
Test optimistic mode with state topic.
Test optimistic mode with state topic.
async def test_sending_mqtt_commands_and_explicit_optimistic(hass, mqtt_mock): """Test optimistic mode with state topic.""" assert await async_setup_component( hass, fan.DOMAIN, { fan.DOMAIN: { "platform": "mqtt", "name": "test", ...
[ "async", "def", "test_sending_mqtt_commands_and_explicit_optimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "fan", ".", "DOMAIN", ",", "{", "fan", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"m...
[ 343, 0 ]
[ 443, 51 ]
python
en
['en', 'en', 'en']
True
test_attributes
(hass, mqtt_mock)
Test attributes.
Test attributes.
async def test_attributes(hass, mqtt_mock): """Test attributes.""" assert await async_setup_component( hass, fan.DOMAIN, { fan.DOMAIN: { "platform": "mqtt", "name": "test", "command_topic": "command-topic", "osci...
[ "async", "def", "test_attributes", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "fan", ".", "DOMAIN", ",", "{", "fan", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":",...
[ 446, 0 ]
[ 528, 62 ]
python
en
['en', 'la', 'en']
False
test_custom_speed_list
(hass, mqtt_mock)
Test optimistic mode without state topic.
Test optimistic mode without state topic.
async def test_custom_speed_list(hass, mqtt_mock): """Test optimistic mode without state topic.""" assert await async_setup_component( hass, fan.DOMAIN, { fan.DOMAIN: { "platform": "mqtt", "name": "test", "command_topic": "comma...
[ "async", "def", "test_custom_speed_list", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "fan", ".", "DOMAIN", ",", "{", "fan", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"",...
[ 531, 0 ]
[ 553, 71 ]
python
en
['en', 'en', 'en']
True
test_supported_features
(hass, mqtt_mock)
Test optimistic mode without state topic.
Test optimistic mode without state topic.
async def test_supported_features(hass, mqtt_mock): """Test optimistic mode without state topic.""" assert await async_setup_component( hass, fan.DOMAIN, { fan.DOMAIN: [ { "platform": "mqtt", "name": "test1", ...
[ "async", "def", "test_supported_features", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "fan", ".", "DOMAIN", ",", "{", "fan", ".", "DOMAIN", ":", "[", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"...
[ 556, 0 ]
[ 602, 5 ]
python
en
['en', 'en', 'en']
True
test_availability_when_connection_lost
(hass, mqtt_mock)
Test availability after MQTT disconnection.
Test availability after MQTT disconnection.
async def test_availability_when_connection_lost(hass, mqtt_mock): """Test availability after MQTT disconnection.""" await help_test_availability_when_connection_lost( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_availability_when_connection_lost", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_availability_when_connection_lost", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 605, 0 ]
[ 609, 5 ]
python
en
['en', 'en', 'en']
True
test_availability_without_topic
(hass, mqtt_mock)
Test availability without defined availability topic.
Test availability without defined availability topic.
async def test_availability_without_topic(hass, mqtt_mock): """Test availability without defined availability topic.""" await help_test_availability_without_topic( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_availability_without_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_availability_without_topic", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 612, 0 ]
[ 616, 5 ]
python
en
['en', 'en', 'en']
True
test_default_availability_payload
(hass, mqtt_mock)
Test availability by default payload with defined topic.
Test availability by default payload with defined topic.
async def test_default_availability_payload(hass, mqtt_mock): """Test availability by default payload with defined topic.""" await help_test_default_availability_payload( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG, True, "state-topic", "1" )
[ "async", "def", "test_default_availability_payload", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_default_availability_payload", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ",", "True", ",", "\"state-topic\"", ","...
[ 619, 0 ]
[ 623, 5 ]
python
en
['en', 'en', 'en']
True
test_custom_availability_payload
(hass, mqtt_mock)
Test availability by custom payload with defined topic.
Test availability by custom payload with defined topic.
async def test_custom_availability_payload(hass, mqtt_mock): """Test availability by custom payload with defined topic.""" await help_test_custom_availability_payload( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG, True, "state-topic", "1" )
[ "async", "def", "test_custom_availability_payload", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_custom_availability_payload", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ",", "True", ",", "\"state-topic\"", ",", ...
[ 626, 0 ]
[ 630, 5 ]
python
en
['en', 'en', 'en']
True
test_setting_attribute_via_mqtt_json_message
(hass, mqtt_mock)
Test the setting of attribute via MQTT with JSON payload.
Test the setting of attribute via MQTT with JSON payload.
async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock): """Test the setting of attribute via MQTT with JSON payload.""" await help_test_setting_attribute_via_mqtt_json_message( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_setting_attribute_via_mqtt_json_message", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_setting_attribute_via_mqtt_json_message", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 633, 0 ]
[ 637, 5 ]
python
en
['en', 'en', 'en']
True
test_setting_attribute_with_template
(hass, mqtt_mock)
Test the setting of attribute via MQTT with JSON payload.
Test the setting of attribute via MQTT with JSON payload.
async def test_setting_attribute_with_template(hass, mqtt_mock): """Test the setting of attribute via MQTT with JSON payload.""" await help_test_setting_attribute_with_template( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_setting_attribute_with_template", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_setting_attribute_with_template", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 640, 0 ]
[ 644, 5 ]
python
en
['en', 'en', 'en']
True
test_update_with_json_attrs_not_dict
(hass, mqtt_mock, caplog)
Test attributes get extracted from a JSON result.
Test attributes get extracted from a JSON result.
async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog): """Test attributes get extracted from a JSON result.""" await help_test_update_with_json_attrs_not_dict( hass, mqtt_mock, caplog, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_update_with_json_attrs_not_dict", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_update_with_json_attrs_not_dict", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ...
[ 647, 0 ]
[ 651, 5 ]
python
en
['en', 'en', 'en']
True
test_update_with_json_attrs_bad_JSON
(hass, mqtt_mock, caplog)
Test attributes get extracted from a JSON result.
Test attributes get extracted from a JSON result.
async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog): """Test attributes get extracted from a JSON result.""" await help_test_update_with_json_attrs_bad_JSON( hass, mqtt_mock, caplog, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_update_with_json_attrs_bad_JSON", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_update_with_json_attrs_bad_JSON", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ...
[ 654, 0 ]
[ 658, 5 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_attr
(hass, mqtt_mock, caplog)
Test update of discovered MQTTAttributes.
Test update of discovered MQTTAttributes.
async def test_discovery_update_attr(hass, mqtt_mock, caplog): """Test update of discovered MQTTAttributes.""" await help_test_discovery_update_attr( hass, mqtt_mock, caplog, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_discovery_update_attr", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_discovery_update_attr", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 661, 0 ]
[ 665, 5 ]
python
en
['en', 'en', 'en']
True
test_unique_id
(hass, mqtt_mock)
Test unique_id option only creates one fan per id.
Test unique_id option only creates one fan per id.
async def test_unique_id(hass, mqtt_mock): """Test unique_id option only creates one fan per id.""" config = { fan.DOMAIN: [ { "platform": "mqtt", "name": "Test 1", "state_topic": "test-topic", "command_topic": "test_topic", ...
[ "async", "def", "test_unique_id", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "{", "fan", ".", "DOMAIN", ":", "[", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"Test 1\"", ",", "\"state_topic\"", ":", "\"test-topic\"", ",", "\"...
[ 668, 0 ]
[ 688, 66 ]
python
en
['en', 'en', 'en']
True
test_discovery_removal_fan
(hass, mqtt_mock, caplog)
Test removal of discovered fan.
Test removal of discovered fan.
async def test_discovery_removal_fan(hass, mqtt_mock, caplog): """Test removal of discovered fan.""" data = '{ "name": "test", "command_topic": "test_topic" }' await help_test_discovery_removal(hass, mqtt_mock, caplog, fan.DOMAIN, data)
[ "async", "def", "test_discovery_removal_fan", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data", "=", "'{ \"name\": \"test\", \"command_topic\": \"test_topic\" }'", "await", "help_test_discovery_removal", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "...
[ 691, 0 ]
[ 694, 80 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_fan
(hass, mqtt_mock, caplog)
Test update of discovered fan.
Test update of discovered fan.
async def test_discovery_update_fan(hass, mqtt_mock, caplog): """Test update of discovered fan.""" data1 = '{ "name": "Beer", "command_topic": "test_topic" }' data2 = '{ "name": "Milk", "command_topic": "test_topic" }' await help_test_discovery_update(hass, mqtt_mock, caplog, fan.DOMAIN, data1, data2)
[ "async", "def", "test_discovery_update_fan", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data1", "=", "'{ \"name\": \"Beer\", \"command_topic\": \"test_topic\" }'", "data2", "=", "'{ \"name\": \"Milk\", \"command_topic\": \"test_topic\" }'", "await", "help_test_disco...
[ 697, 0 ]
[ 701, 87 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_unchanged_fan
(hass, mqtt_mock, caplog)
Test update of discovered fan.
Test update of discovered fan.
async def test_discovery_update_unchanged_fan(hass, mqtt_mock, caplog): """Test update of discovered fan.""" data1 = '{ "name": "Beer", "command_topic": "test_topic" }' with patch( "homeassistant.components.mqtt.fan.MqttFan.discovery_update" ) as discovery_update: await help_test_discove...
[ "async", "def", "test_discovery_update_unchanged_fan", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data1", "=", "'{ \"name\": \"Beer\", \"command_topic\": \"test_topic\" }'", "with", "patch", "(", "\"homeassistant.components.mqtt.fan.MqttFan.discovery_update\"", ")",...
[ 704, 0 ]
[ 712, 9 ]
python
en
['en', 'en', 'en']
True
test_discovery_broken
(hass, mqtt_mock, caplog)
Test handling of bad discovery message.
Test handling of bad discovery message.
async def test_discovery_broken(hass, mqtt_mock, caplog): """Test handling of bad discovery message.""" data1 = '{ "name": "Beer" }' data2 = '{ "name": "Milk", "command_topic": "test_topic" }' await help_test_discovery_broken(hass, mqtt_mock, caplog, fan.DOMAIN, data1, data2)
[ "async", "def", "test_discovery_broken", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data1", "=", "'{ \"name\": \"Beer\" }'", "data2", "=", "'{ \"name\": \"Milk\", \"command_topic\": \"test_topic\" }'", "await", "help_test_discovery_broken", "(", "hass", ",", ...
[ 716, 0 ]
[ 720, 87 ]
python
en
['en', 'en', 'en']
True
test_entity_device_info_with_connection
(hass, mqtt_mock)
Test MQTT fan device registry integration.
Test MQTT fan device registry integration.
async def test_entity_device_info_with_connection(hass, mqtt_mock): """Test MQTT fan device registry integration.""" await help_test_entity_device_info_with_connection( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_with_connection", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_with_connection", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 723, 0 ]
[ 727, 5 ]
python
en
['en', 'fy', 'nl']
False
test_entity_device_info_with_identifier
(hass, mqtt_mock)
Test MQTT fan device registry integration.
Test MQTT fan device registry integration.
async def test_entity_device_info_with_identifier(hass, mqtt_mock): """Test MQTT fan device registry integration.""" await help_test_entity_device_info_with_identifier( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_with_identifier", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_with_identifier", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 730, 0 ]
[ 734, 5 ]
python
en
['en', 'fy', 'nl']
False
test_entity_device_info_update
(hass, mqtt_mock)
Test device registry update.
Test device registry update.
async def test_entity_device_info_update(hass, mqtt_mock): """Test device registry update.""" await help_test_entity_device_info_update( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_update", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_update", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 737, 0 ]
[ 741, 5 ]
python
en
['fr', 'fy', 'en']
False
test_entity_device_info_remove
(hass, mqtt_mock)
Test device registry remove.
Test device registry remove.
async def test_entity_device_info_remove(hass, mqtt_mock): """Test device registry remove.""" await help_test_entity_device_info_remove( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_remove", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_remove", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 744, 0 ]
[ 748, 5 ]
python
en
['fr', 'en', 'en']
True
test_entity_id_update_subscriptions
(hass, mqtt_mock)
Test MQTT subscriptions are managed when entity_id is updated.
Test MQTT subscriptions are managed when entity_id is updated.
async def test_entity_id_update_subscriptions(hass, mqtt_mock): """Test MQTT subscriptions are managed when entity_id is updated.""" await help_test_entity_id_update_subscriptions( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_id_update_subscriptions", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_id_update_subscriptions", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 751, 0 ]
[ 755, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_id_update_discovery_update
(hass, mqtt_mock)
Test MQTT discovery update when entity_id is updated.
Test MQTT discovery update when entity_id is updated.
async def test_entity_id_update_discovery_update(hass, mqtt_mock): """Test MQTT discovery update when entity_id is updated.""" await help_test_entity_id_update_discovery_update( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_id_update_discovery_update", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_id_update_discovery_update", "(", "hass", ",", "mqtt_mock", ",", "fan", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 758, 0 ]
[ 762, 5 ]
python
en
['en', 'en', 'en']
True