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
FirmataBinaryDigitalInput.latch_callback
(self, data: list)
Update pin state on callback.
Update pin state on callback.
async def latch_callback(self, data: list) -> None: """Update pin state on callback.""" if data[1] != self._firmata_pin: return _LOGGER.debug( "Received latch %d for digital input pin %d on board %s", data[2], self._firmata_pin, self.bo...
[ "async", "def", "latch_callback", "(", "self", ",", "data", ":", "list", ")", "->", "None", ":", "if", "data", "[", "1", "]", "!=", "self", ".", "_firmata_pin", ":", "return", "_LOGGER", ".", "debug", "(", "\"Received latch %d for digital input pin %d on board...
[ 184, 4 ]
[ 200, 32 ]
python
en
['en', 'en', 'en']
True
FirmataAnalogInput.__init__
( self, board: FirmataBoard, pin: FirmataPinType, pin_mode: str, differential: int )
Initialize the analog input pin.
Initialize the analog input pin.
def __init__( self, board: FirmataBoard, pin: FirmataPinType, pin_mode: str, differential: int ): """Initialize the analog input pin.""" self._differential = differential self._forward_callback = None super().__init__(board, pin, pin_mode)
[ "def", "__init__", "(", "self", ",", "board", ":", "FirmataBoard", ",", "pin", ":", "FirmataPinType", ",", "pin_mode", ":", "str", ",", "differential", ":", "int", ")", ":", "self", ".", "_differential", "=", "differential", "self", ".", "_forward_callback",...
[ 206, 4 ]
[ 212, 46 ]
python
en
['en', 'en', 'en']
True
FirmataAnalogInput.start_pin
(self, forward_callback: Callable[[], None])
Get initial state and start reporting a pin.
Get initial state and start reporting a pin.
async def start_pin(self, forward_callback: Callable[[], None]) -> None: """Get initial state and start reporting a pin.""" _LOGGER.debug( "Starting reporting updates for analog input pin %s on board %s", self._pin, self.board.name, ) self._forward_cal...
[ "async", "def", "start_pin", "(", "self", ",", "forward_callback", ":", "Callable", "[", "[", "]", ",", "None", "]", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Starting reporting updates for analog input pin %s on board %s\"", ",", "self", ".", "_p...
[ 214, 4 ]
[ 230, 32 ]
python
en
['en', 'en', 'en']
True
FirmataAnalogInput.stop_pin
(self)
Stop reporting analog input pin.
Stop reporting analog input pin.
async def stop_pin(self) -> None: """Stop reporting analog input pin.""" _LOGGER.debug( "Stopping reporting updates for analog input pin %s on board %s", self._pin, self.board.name, ) api = self.board.api await api.disable_analog_reporting(self...
[ "async", "def", "stop_pin", "(", "self", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Stopping reporting updates for analog input pin %s on board %s\"", ",", "self", ".", "_pin", ",", "self", ".", "board", ".", "name", ",", ")", "api", "=", "self",...
[ 232, 4 ]
[ 240, 60 ]
python
da
['da', 'jv', 'en']
False
FirmataAnalogInput.state
(self)
Return sensor state.
Return sensor state.
def state(self) -> int: """Return sensor state.""" return self._state
[ "def", "state", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_state" ]
[ 243, 4 ]
[ 245, 26 ]
python
en
['en', 'bs', 'en']
True
FirmataAnalogInput.latch_callback
(self, data: list)
Update pin state on callback.
Update pin state on callback.
async def latch_callback(self, data: list) -> None: """Update pin state on callback.""" if data[1] != self._analog_pin: return _LOGGER.debug( "Received latch %d for analog input pin %s on board %s", data[2], self._pin, self.board.name, ...
[ "async", "def", "latch_callback", "(", "self", ",", "data", ":", "list", ")", "->", "None", ":", "if", "data", "[", "1", "]", "!=", "self", ".", "_analog_pin", ":", "return", "_LOGGER", ".", "debug", "(", "\"Received latch %d for analog input pin %s on board %...
[ 247, 4 ]
[ 262, 32 ]
python
en
['en', 'en', 'en']
True
_async_has_devices
(hass)
Return if there are devices that can be discovered.
Return if there are devices that can be discovered.
async def _async_has_devices(hass): """Return if there are devices that can be discovered.""" aehw4a1_ip_addresses = await AehW4a1().discovery() return len(aehw4a1_ip_addresses) > 0
[ "async", "def", "_async_has_devices", "(", "hass", ")", ":", "aehw4a1_ip_addresses", "=", "await", "AehW4a1", "(", ")", ".", "discovery", "(", ")", "return", "len", "(", "aehw4a1_ip_addresses", ")", ">", "0" ]
[ 9, 0 ]
[ 12, 40 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the Graphite feeder.
Set up the Graphite feeder.
def setup(hass, config): """Set up the Graphite feeder.""" conf = config[DOMAIN] host = conf.get(CONF_HOST) prefix = conf.get(CONF_PREFIX) port = conf.get(CONF_PORT) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: sock.connect((host, port)) sock.shutdown(2) ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "host", "=", "conf", ".", "get", "(", "CONF_HOST", ")", "prefix", "=", "conf", ".", "get", "(", "CONF_PREFIX", ")", "port", "=", "conf", ".", "get", ...
[ 41, 0 ]
[ 58, 15 ]
python
en
['en', 'pt', 'en']
True
GraphiteFeeder.__init__
(self, hass, host, port, prefix)
Initialize the feeder.
Initialize the feeder.
def __init__(self, hass, host, port, prefix): """Initialize the feeder.""" super().__init__(daemon=True) self._hass = hass self._host = host self._port = port # rstrip any trailing dots in case they think they need it self._prefix = prefix.rstrip(".") self...
[ "def", "__init__", "(", "self", ",", "hass", ",", "host", ",", "port", ",", "prefix", ")", ":", "super", "(", ")", ".", "__init__", "(", "daemon", "=", "True", ")", "self", ".", "_hass", "=", "hass", "self", ".", "_host", "=", "host", "self", "."...
[ 64, 4 ]
[ 79, 86 ]
python
en
['en', 'en', 'en']
True
GraphiteFeeder.start_listen
(self, event)
Start event-processing thread.
Start event-processing thread.
def start_listen(self, event): """Start event-processing thread.""" _LOGGER.debug("Event processing thread started") self._we_started = True self.start()
[ "def", "start_listen", "(", "self", ",", "event", ")", ":", "_LOGGER", ".", "debug", "(", "\"Event processing thread started\"", ")", "self", ".", "_we_started", "=", "True", "self", ".", "start", "(", ")" ]
[ 81, 4 ]
[ 85, 20 ]
python
en
['en', 'en', 'en']
True
GraphiteFeeder.shutdown
(self, event)
Signal shutdown of processing event.
Signal shutdown of processing event.
def shutdown(self, event): """Signal shutdown of processing event.""" _LOGGER.debug("Event processing signaled exit") self._queue.put(self._quit_object)
[ "def", "shutdown", "(", "self", ",", "event", ")", ":", "_LOGGER", ".", "debug", "(", "\"Event processing signaled exit\"", ")", "self", ".", "_queue", ".", "put", "(", "self", ".", "_quit_object", ")" ]
[ 87, 4 ]
[ 90, 42 ]
python
en
['en', 'en', 'en']
True
GraphiteFeeder.event_listener
(self, event)
Queue an event for processing.
Queue an event for processing.
def event_listener(self, event): """Queue an event for processing.""" if self.is_alive() or not self._we_started: _LOGGER.debug("Received event") self._queue.put(event) else: _LOGGER.error("Graphite feeder thread has died, not queuing event")
[ "def", "event_listener", "(", "self", ",", "event", ")", ":", "if", "self", ".", "is_alive", "(", ")", "or", "not", "self", ".", "_we_started", ":", "_LOGGER", ".", "debug", "(", "\"Received event\"", ")", "self", ".", "_queue", ".", "put", "(", "event...
[ 92, 4 ]
[ 98, 79 ]
python
en
['en', 'en', 'en']
True
GraphiteFeeder._send_to_graphite
(self, data)
Send data to Graphite.
Send data to Graphite.
def _send_to_graphite(self, data): """Send data to Graphite.""" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(10) sock.connect((self._host, self._port)) sock.sendall(data.encode("ascii")) sock.send(b"\n") sock.close()
[ "def", "_send_to_graphite", "(", "self", ",", "data", ")", ":", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "sock", ".", "settimeout", "(", "10", ")", "sock", ".", "connect", "(", "(", ...
[ 100, 4 ]
[ 107, 20 ]
python
en
['en', 'it', 'en']
True
GraphiteFeeder._report_attributes
(self, entity_id, new_state)
Report the attributes.
Report the attributes.
def _report_attributes(self, entity_id, new_state): """Report the attributes.""" now = time.time() things = dict(new_state.attributes) try: things["state"] = state.state_as_number(new_state) except ValueError: pass lines = [ "%s.%s.%s %...
[ "def", "_report_attributes", "(", "self", ",", "entity_id", ",", "new_state", ")", ":", "now", "=", "time", ".", "time", "(", ")", "things", "=", "dict", "(", "new_state", ".", "attributes", ")", "try", ":", "things", "[", "\"state\"", "]", "=", "state...
[ 109, 4 ]
[ 131, 64 ]
python
en
['en', 'en', 'en']
True
GraphiteFeeder.run
(self)
Run the process to export the data.
Run the process to export the data.
def run(self): """Run the process to export the data.""" while True: event = self._queue.get() if event == self._quit_object: _LOGGER.debug("Event processing thread stopped") self._queue.task_done() return if event.event...
[ "def", "run", "(", "self", ")", ":", "while", "True", ":", "event", "=", "self", ".", "_queue", ".", "get", "(", ")", "if", "event", "==", "self", ".", "_quit_object", ":", "_LOGGER", ".", "debug", "(", "\"Event processing thread stopped\"", ")", "self",...
[ 133, 4 ]
[ 165, 35 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Bravia TV platform.
Set up the Bravia TV platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Bravia TV platform.""" host = config[CONF_HOST] bravia_config_file_path = hass.config.path(BRAVIA_CONFIG_FILE) bravia_config = await hass.async_add_executor_job( load_json, bravia_config_file_pa...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "host", "=", "config", "[", "CONF_HOST", "]", "bravia_config_file_path", "=", "hass", ".", "config", ".", "path", "(", ...
[ 65, 0 ]
[ 92, 18 ]
python
en
['en', 'lv', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Add BraviaTV entities from a config_entry.
Add BraviaTV entities from a config_entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Add BraviaTV entities from a config_entry.""" ignored_sources = [] pin = config_entry.data[CONF_PIN] unique_id = config_entry.unique_id device_info = { "identifiers": {(DOMAIN, unique_id)}, "name": DEFAULT_NAME, ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "ignored_sources", "=", "[", "]", "pin", "=", "config_entry", ".", "data", "[", "CONF_PIN", "]", "unique_id", "=", "config_entry", ".", "unique_id", "de...
[ 95, 0 ]
[ 117, 5 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.__init__
(self, client, name, pin, unique_id, device_info, ignored_sources)
Initialize the Bravia TV device.
Initialize the Bravia TV device.
def __init__(self, client, name, pin, unique_id, device_info, ignored_sources): """Initialize the Bravia TV device.""" self._pin = pin self._braviarc = client self._name = name self._state = STATE_OFF self._muted = False self._program_name = None self._ch...
[ "def", "__init__", "(", "self", ",", "client", ",", "name", ",", "pin", ",", "unique_id", ",", "device_info", ",", "ignored_sources", ")", ":", "self", ".", "_pin", "=", "pin", "self", ".", "_braviarc", "=", "client", "self", ".", "_name", "=", "name",...
[ 123, 4 ]
[ 149, 41 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.async_update
(self)
Update TV info.
Update TV info.
async def async_update(self): """Update TV info.""" if self._state_lock.locked(): return power_status = await self.hass.async_add_executor_job( self._braviarc.get_power_status ) if power_status != "off": connected = await self.hass.async_add_...
[ "async", "def", "async_update", "(", "self", ")", ":", "if", "self", ".", "_state_lock", ".", "locked", "(", ")", ":", "return", "power_status", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "_braviarc", ".", "get_powe...
[ 151, 4 ]
[ 182, 31 ]
python
co
['en', 'co', 'it']
False
BraviaTVDevice._get_source
(self)
Return the name of the source.
Return the name of the source.
def _get_source(self): """Return the name of the source.""" for key, value in self._content_mapping.items(): if value == self._content_uri: return key
[ "def", "_get_source", "(", "self", ")", ":", "for", "key", ",", "value", "in", "self", ".", "_content_mapping", ".", "items", "(", ")", ":", "if", "value", "==", "self", ".", "_content_uri", ":", "return", "key" ]
[ 184, 4 ]
[ 188, 26 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice._async_refresh_volume
(self)
Refresh volume information.
Refresh volume information.
async def _async_refresh_volume(self): """Refresh volume information.""" volume_info = await self.hass.async_add_executor_job( self._braviarc.get_volume_info ) if volume_info is not None: self._volume = volume_info.get("volume") self._min_volume = volu...
[ "async", "def", "_async_refresh_volume", "(", "self", ")", ":", "volume_info", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "_braviarc", ".", "get_volume_info", ")", "if", "volume_info", "is", "not", "None", ":", "self", ...
[ 190, 4 ]
[ 201, 20 ]
python
de
['nl', 'de', 'en']
False
BraviaTVDevice._async_refresh_channels
(self)
Refresh source and channels list.
Refresh source and channels list.
async def _async_refresh_channels(self): """Refresh source and channels list.""" if not self._source_list: self._content_mapping = await self.hass.async_add_executor_job( self._braviarc.load_source_list ) self._source_list = [] if not self....
[ "async", "def", "_async_refresh_channels", "(", "self", ")", ":", "if", "not", "self", ".", "_source_list", ":", "self", ".", "_content_mapping", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "_braviarc", ".", "load_source...
[ 203, 4 ]
[ 215, 19 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice._async_refresh_playing_info
(self)
Refresh Playing information.
Refresh Playing information.
async def _async_refresh_playing_info(self): """Refresh Playing information.""" playing_info = await self.hass.async_add_executor_job( self._braviarc.get_playing_info ) self._program_name = playing_info.get("programTitle") self._channel_name = playing_info.get("title"...
[ "async", "def", "_async_refresh_playing_info", "(", "self", ")", ":", "playing_info", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "_braviarc", ".", "get_playing_info", ")", "self", ".", "_program_name", "=", "playing_info", ...
[ 217, 4 ]
[ 231, 38 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 234, 4 ]
[ 236, 25 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.device_class
(self)
Set the device class to TV.
Set the device class to TV.
def device_class(self): """Set the device class to TV.""" return DEVICE_CLASS_TV
[ "def", "device_class", "(", "self", ")", ":", "return", "DEVICE_CLASS_TV" ]
[ 239, 4 ]
[ 241, 30 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.unique_id
(self)
Return a unique_id for this entity.
Return a unique_id for this entity.
def unique_id(self): """Return a unique_id for this entity.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 244, 4 ]
[ 246, 30 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.device_info
(self)
Return the device info.
Return the device info.
def device_info(self): """Return the device info.""" return self._device_info
[ "def", "device_info", "(", "self", ")", ":", "return", "self", ".", "_device_info" ]
[ 249, 4 ]
[ 251, 32 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 254, 4 ]
[ 256, 26 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.source
(self)
Return the current input source.
Return the current input source.
def source(self): """Return the current input source.""" return self._source
[ "def", "source", "(", "self", ")", ":", "return", "self", ".", "_source" ]
[ 259, 4 ]
[ 261, 27 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.source_list
(self)
List of available input sources.
List of available input sources.
def source_list(self): """List of available input sources.""" return self._source_list
[ "def", "source_list", "(", "self", ")", ":", "return", "self", ".", "_source_list" ]
[ 264, 4 ]
[ 266, 32 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.volume_level
(self)
Volume level of the media player (0..1).
Volume level of the media player (0..1).
def volume_level(self): """Volume level of the media player (0..1).""" if self._volume is not None: return self._volume / 100 return None
[ "def", "volume_level", "(", "self", ")", ":", "if", "self", ".", "_volume", "is", "not", "None", ":", "return", "self", ".", "_volume", "/", "100", "return", "None" ]
[ 269, 4 ]
[ 273, 19 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.is_volume_muted
(self)
Boolean if volume is currently muted.
Boolean if volume is currently muted.
def is_volume_muted(self): """Boolean if volume is currently muted.""" return self._muted
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "_muted" ]
[ 276, 4 ]
[ 278, 26 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.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_BRAVIA
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_BRAVIA" ]
[ 281, 4 ]
[ 283, 29 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.media_title
(self)
Title of current playing media.
Title of current playing media.
def media_title(self): """Title of current playing media.""" return_value = None if self._channel_name is not None: return_value = self._channel_name if self._program_name is not None: return_value = f"{return_value}: {self._program_name}" return r...
[ "def", "media_title", "(", "self", ")", ":", "return_value", "=", "None", "if", "self", ".", "_channel_name", "is", "not", "None", ":", "return_value", "=", "self", ".", "_channel_name", "if", "self", ".", "_program_name", "is", "not", "None", ":", "return...
[ 286, 4 ]
[ 293, 27 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.media_content_id
(self)
Content ID of current playing media.
Content ID of current playing media.
def media_content_id(self): """Content ID of current playing media.""" return self._channel_name
[ "def", "media_content_id", "(", "self", ")", ":", "return", "self", ".", "_channel_name" ]
[ 296, 4 ]
[ 298, 33 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.media_duration
(self)
Duration of current playing media in seconds.
Duration of current playing media in seconds.
def media_duration(self): """Duration of current playing media in seconds.""" return self._duration
[ "def", "media_duration", "(", "self", ")", ":", "return", "self", ".", "_duration" ]
[ 301, 4 ]
[ 303, 29 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.set_volume_level
(self, volume)
Set volume level, range 0..1.
Set volume level, range 0..1.
def set_volume_level(self, volume): """Set volume level, range 0..1.""" self._braviarc.set_volume_level(volume)
[ "def", "set_volume_level", "(", "self", ",", "volume", ")", ":", "self", ".", "_braviarc", ".", "set_volume_level", "(", "volume", ")" ]
[ 305, 4 ]
[ 307, 47 ]
python
en
['fr', 'zu', 'en']
False
BraviaTVDevice.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.""" async with self._state_lock: await self.hass.async_add_executor_job(self._braviarc.turn_on)
[ "async", "def", "async_turn_on", "(", "self", ")", ":", "async", "with", "self", ".", "_state_lock", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "_braviarc", ".", "turn_on", ")" ]
[ 309, 4 ]
[ 312, 74 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.async_turn_off
(self)
Turn off media player.
Turn off media player.
async def async_turn_off(self): """Turn off media player.""" async with self._state_lock: await self.hass.async_add_executor_job(self._braviarc.turn_off)
[ "async", "def", "async_turn_off", "(", "self", ")", ":", "async", "with", "self", ".", "_state_lock", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "_braviarc", ".", "turn_off", ")" ]
[ 314, 4 ]
[ 317, 75 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.volume_up
(self)
Volume up the media player.
Volume up the media player.
def volume_up(self): """Volume up the media player.""" self._braviarc.volume_up()
[ "def", "volume_up", "(", "self", ")", ":", "self", ".", "_braviarc", ".", "volume_up", "(", ")" ]
[ 319, 4 ]
[ 321, 34 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.volume_down
(self)
Volume down media player.
Volume down media player.
def volume_down(self): """Volume down media player.""" self._braviarc.volume_down()
[ "def", "volume_down", "(", "self", ")", ":", "self", ".", "_braviarc", ".", "volume_down", "(", ")" ]
[ 323, 4 ]
[ 325, 36 ]
python
en
['en', 'sl', 'en']
True
BraviaTVDevice.mute_volume
(self, mute)
Send mute command.
Send mute command.
def mute_volume(self, mute): """Send mute command.""" self._braviarc.mute_volume(mute)
[ "def", "mute_volume", "(", "self", ",", "mute", ")", ":", "self", ".", "_braviarc", ".", "mute_volume", "(", "mute", ")" ]
[ 327, 4 ]
[ 329, 40 ]
python
en
['en', 'co', 'en']
True
BraviaTVDevice.select_source
(self, source)
Set the input source.
Set the input source.
def select_source(self, source): """Set the input source.""" if source in self._content_mapping: uri = self._content_mapping[source] self._braviarc.play_content(uri)
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "if", "source", "in", "self", ".", "_content_mapping", ":", "uri", "=", "self", ".", "_content_mapping", "[", "source", "]", "self", ".", "_braviarc", ".", "play_content", "(", "uri", ")" ]
[ 331, 4 ]
[ 335, 44 ]
python
en
['en', 'su', 'en']
True
BraviaTVDevice.media_play_pause
(self)
Simulate play pause media player.
Simulate play pause media player.
def media_play_pause(self): """Simulate play pause media player.""" if self._playing: self.media_pause() else: self.media_play()
[ "def", "media_play_pause", "(", "self", ")", ":", "if", "self", ".", "_playing", ":", "self", ".", "media_pause", "(", ")", "else", ":", "self", ".", "media_play", "(", ")" ]
[ 337, 4 ]
[ 342, 29 ]
python
en
['en', 'en', 'it']
True
BraviaTVDevice.media_play
(self)
Send play command.
Send play command.
def media_play(self): """Send play command.""" self._playing = True self._braviarc.media_play()
[ "def", "media_play", "(", "self", ")", ":", "self", ".", "_playing", "=", "True", "self", ".", "_braviarc", ".", "media_play", "(", ")" ]
[ 344, 4 ]
[ 347, 35 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.media_pause
(self)
Send media pause command to media player.
Send media pause command to media player.
def media_pause(self): """Send media pause command to media player.""" self._playing = False self._braviarc.media_pause()
[ "def", "media_pause", "(", "self", ")", ":", "self", ".", "_playing", "=", "False", "self", ".", "_braviarc", ".", "media_pause", "(", ")" ]
[ 349, 4 ]
[ 352, 36 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.media_stop
(self)
Send media stop command to media player.
Send media stop command to media player.
def media_stop(self): """Send media stop command to media player.""" self._playing = False self._braviarc.media_stop()
[ "def", "media_stop", "(", "self", ")", ":", "self", ".", "_playing", "=", "False", "self", ".", "_braviarc", ".", "media_stop", "(", ")" ]
[ 354, 4 ]
[ 357, 35 ]
python
en
['en', 'en', 'en']
True
BraviaTVDevice.media_next_track
(self)
Send next track command.
Send next track command.
def media_next_track(self): """Send next track command.""" self._braviarc.media_next_track()
[ "def", "media_next_track", "(", "self", ")", ":", "self", ".", "_braviarc", ".", "media_next_track", "(", ")" ]
[ 359, 4 ]
[ 361, 41 ]
python
en
['en', 'pt', 'en']
True
BraviaTVDevice.media_previous_track
(self)
Send the previous track command.
Send the previous track command.
def media_previous_track(self): """Send the previous track command.""" self._braviarc.media_previous_track()
[ "def", "media_previous_track", "(", "self", ")", ":", "self", ".", "_braviarc", ".", "media_previous_track", "(", ")" ]
[ 363, 4 ]
[ 365, 45 ]
python
en
['en', 'en', 'en']
True
test_schema
()
Test schema.
Test schema.
def test_schema(): """Test schema.""" assert "nl-NL" in tts.SUPPORT_LANGUAGES processed = tts.PLATFORM_SCHEMA({"platform": "cloud", "language": "nl-NL"}) assert processed["gender"] == "female" # Should not raise processed = tts.PLATFORM_SCHEMA( {"platform": "cloud", "language": "nl-NL"...
[ "def", "test_schema", "(", ")", ":", "assert", "\"nl-NL\"", "in", "tts", ".", "SUPPORT_LANGUAGES", "processed", "=", "tts", ".", "PLATFORM_SCHEMA", "(", "{", "\"platform\"", ":", "\"cloud\"", ",", "\"language\"", ":", "\"nl-NL\"", "}", ")", "assert", "processe...
[ 4, 0 ]
[ 14, 5 ]
python
de
['de', 'de', 'it']
False
get_label_balance
(dataset)
Given a dataset, return the proportion of each target class and the counts of each class type Parameters ---------- dataset Returns ------- sample_weights, counts
Given a dataset, return the proportion of each target class and the counts of each class type
def get_label_balance(dataset): """ Given a dataset, return the proportion of each target class and the counts of each class type Parameters ---------- dataset Returns ------- sample_weights, counts """ assert hasattr(dataset, 'get_targets') labels = dataset.get_targets() ...
[ "def", "get_label_balance", "(", "dataset", ")", ":", "assert", "hasattr", "(", "dataset", ",", "'get_targets'", ")", "labels", "=", "dataset", ".", "get_targets", "(", ")", "counts", "=", "np", ".", "bincount", "(", "labels", ")", "train_weights", "=", "1...
[ 744, 0 ]
[ 766, 33 ]
python
en
['en', 'error', 'th']
False
BaseProcess.__init__
(self, lr=0.001, metrics=None, evaluation_only_metrics=None, l2_weight_decay=0.01, cuda=None, **kwargs)
Initialization of the Base Trainable object. Any learning procedure that leverages DN3atasets should subclass this base class. By default uses the SGD with momentum optimization. Parameters ---------- cuda : bool, string, None If boolean, sets whether to...
Initialization of the Base Trainable object. Any learning procedure that leverages DN3atasets should subclass this base class.
def __init__(self, lr=0.001, metrics=None, evaluation_only_metrics=None, l2_weight_decay=0.01, cuda=None, **kwargs): """ Initialization of the Base Trainable object. Any learning procedure that leverages DN3atasets should subclass this base class. By default uses the SGD with momentum o...
[ "def", "__init__", "(", "self", ",", "lr", "=", "0.001", ",", "metrics", "=", "None", ",", "evaluation_only_metrics", "=", "None", ",", "l2_weight_decay", "=", "0.01", ",", "cuda", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "cuda", "is", "...
[ 31, 4 ]
[ 96, 38 ]
python
en
['en', 'error', 'th']
False
BaseProcess.set_scheduler
(self, scheduler, step_every_batch=False)
This allow the addition of a learning rate schedule to the process. By default, a linear warmup with cosine decay will be used. Any scheduler that is an instance of :any:`Scheduler` (pytorch's schedulers, or extensions thereof) can be set here. Additionally, a string keywords can be used includ...
This allow the addition of a learning rate schedule to the process. By default, a linear warmup with cosine decay will be used. Any scheduler that is an instance of :any:`Scheduler` (pytorch's schedulers, or extensions thereof) can be set here. Additionally, a string keywords can be used includ...
def set_scheduler(self, scheduler, step_every_batch=False): """ This allow the addition of a learning rate schedule to the process. By default, a linear warmup with cosine decay will be used. Any scheduler that is an instance of :any:`Scheduler` (pytorch's schedulers, or extensions there...
[ "def", "set_scheduler", "(", "self", ",", "scheduler", ",", "step_every_batch", "=", "False", ")", ":", "if", "isinstance", "(", "scheduler", ",", "str", ")", ":", "if", "scheduler", ".", "lower", "(", ")", "==", "'constant'", ":", "scheduler", "=", "tor...
[ 104, 4 ]
[ 128, 34 ]
python
en
['en', 'error', 'th']
False
BaseProcess.build_network
(self, **kwargs)
This method is used to add trainable modules to the process. Rather than placing objects for training in the __init__ method, they should be placed here. By default any arguments that propagate unused from __init__ are included here.
This method is used to add trainable modules to the process. Rather than placing objects for training in the __init__ method, they should be placed here.
def build_network(self, **kwargs): """ This method is used to add trainable modules to the process. Rather than placing objects for training in the __init__ method, they should be placed here. By default any arguments that propagate unused from __init__ are included here. """ ...
[ "def", "build_network", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "__dict__", ".", "update", "(", "*", "*", "kwargs", ")" ]
[ 176, 4 ]
[ 183, 38 ]
python
en
['en', 'error', 'th']
False
BaseProcess.parameters
(self)
All the trainable parameters in the Trainable. This includes any architecture parameters and meta-parameters. Returns ------- params : An iterator of parameters
All the trainable parameters in the Trainable. This includes any architecture parameters and meta-parameters.
def parameters(self): """ All the trainable parameters in the Trainable. This includes any architecture parameters and meta-parameters. Returns ------- params : An iterator of parameters """ for member in self._trainables: yield from ...
[ "def", "parameters", "(", "self", ")", ":", "for", "member", "in", "self", ".", "_trainables", ":", "yield", "from", "self", ".", "__dict__", "[", "member", "]", ".", "parameters", "(", ")" ]
[ 185, 4 ]
[ 195, 57 ]
python
en
['en', 'error', 'th']
False
BaseProcess.forward
(self, *inputs)
Given a batch of inputs, return the outputs produced by the trainable module. Parameters ---------- inputs : Tensors needed for underlying module. Returns ------- outputs : Outputs of module
Given a batch of inputs, return the outputs produced by the trainable module.
def forward(self, *inputs): """ Given a batch of inputs, return the outputs produced by the trainable module. Parameters ---------- inputs : Tensors needed for underlying module. Returns ------- outputs : Outputs of module ...
[ "def", "forward", "(", "self", ",", "*", "inputs", ")", ":", "raise", "NotImplementedError" ]
[ 197, 4 ]
[ 212, 33 ]
python
en
['en', 'error', 'th']
False
BaseProcess.calculate_loss
(self, inputs, outputs)
Given the inputs to and outputs from underlying modules, calculate the loss. Returns ------- Loss : Single loss quantity to be minimized.
Given the inputs to and outputs from underlying modules, calculate the loss.
def calculate_loss(self, inputs, outputs): """ Given the inputs to and outputs from underlying modules, calculate the loss. Returns ------- Loss : Single loss quantity to be minimized. """ if isinstance(outputs, (tuple, list)): device = o...
[ "def", "calculate_loss", "(", "self", ",", "inputs", ",", "outputs", ")", ":", "if", "isinstance", "(", "outputs", ",", "(", "tuple", ",", "list", ")", ")", ":", "device", "=", "outputs", "[", "0", "]", ".", "device", "else", ":", "device", "=", "o...
[ 214, 4 ]
[ 230, 43 ]
python
en
['en', 'error', 'th']
False
BaseProcess.calculate_metrics
(self, inputs, outputs)
Given the inputs to and outputs from the underlying module. Return tracked metrics. Parameters ---------- inputs : Input tensors. outputs : Output tensors. Returns ------- metrics : OrderedDict, None Dict...
Given the inputs to and outputs from the underlying module. Return tracked metrics.
def calculate_metrics(self, inputs, outputs): """ Given the inputs to and outputs from the underlying module. Return tracked metrics. Parameters ---------- inputs : Input tensors. outputs : Output tensors. Returns ------- ...
[ "def", "calculate_metrics", "(", "self", ",", "inputs", ",", "outputs", ")", ":", "metrics", "=", "OrderedDict", "(", ")", "for", "met_name", ",", "met_fn", "in", "self", ".", "metrics", ".", "items", "(", ")", ":", "if", "self", ".", "_training", "and...
[ 232, 4 ]
[ 257, 22 ]
python
en
['en', 'error', 'th']
False
BaseProcess.evaluate
(self, dataset, **loader_kwargs)
Calculate and return metrics for a dataset Parameters ---------- dataset: DN3ataset, DataLoader The dataset that will be used for evaluation, if not a DataLoader, one will be constructed loader_kwargs: dict Args that will be passed to the...
Calculate and return metrics for a dataset
def evaluate(self, dataset, **loader_kwargs): """ Calculate and return metrics for a dataset Parameters ---------- dataset: DN3ataset, DataLoader The dataset that will be used for evaluation, if not a DataLoader, one will be constructed loader_kwargs: di...
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "*", "*", "loader_kwargs", ")", ":", "self", ".", "train", "(", "False", ")", "inputs", ",", "outputs", "=", "self", ".", "predict", "(", "dataset", ",", "*", "*", "loader_kwargs", ")", "metrics", ...
[ 283, 4 ]
[ 304, 22 ]
python
en
['en', 'error', 'th']
False
BaseProcess.predict
(self, dataset, **loader_kwargs)
Determine the outputs for all loaded data from the dataset Parameters ---------- dataset: DN3ataset, DataLoader The dataset that will be used for evaluation, if not a DataLoader, one will be constructed loader_kwargs: dict Args that will ...
Determine the outputs for all loaded data from the dataset
def predict(self, dataset, **loader_kwargs): """ Determine the outputs for all loaded data from the dataset Parameters ---------- dataset: DN3ataset, DataLoader The dataset that will be used for evaluation, if not a DataLoader, one will be constructed lo...
[ "def", "predict", "(", "self", ",", "dataset", ",", "*", "*", "loader_kwargs", ")", ":", "self", ".", "train", "(", "False", ")", "loader_kwargs", ".", "setdefault", "(", "'batch_size'", ",", "1", ")", "dataset", "=", "self", ".", "_make_dataloader", "("...
[ 306, 4 ]
[ 352, 82 ]
python
en
['en', 'error', 'th']
False
BaseProcess.save_best
(self)
Create a snapshot of what is being currently trained for re-laoding with the :py:meth:`load_best()` method. Returns ------- best : Any Whatever format is needed for :py:meth:`load_best()`, will be the argument provided to it.
Create a snapshot of what is being currently trained for re-laoding with the :py:meth:`load_best()` method.
def save_best(self): """ Create a snapshot of what is being currently trained for re-laoding with the :py:meth:`load_best()` method. Returns ------- best : Any Whatever format is needed for :py:meth:`load_best()`, will be the argument provided to it. """ ...
[ "def", "save_best", "(", "self", ")", ":", "return", "[", "{", "k", ":", "v", ".", "cpu", "(", ")", "for", "k", ",", "v", "in", "self", ".", "__dict__", "[", "m", "]", ".", "state_dict", "(", ")", ".", "items", "(", ")", "}", "for", "m", "i...
[ 367, 4 ]
[ 376, 105 ]
python
en
['en', 'error', 'th']
False
BaseProcess.load_best
(self, best)
Load the parameters as saved by :py:meth:`save_best()`. Parameters ---------- best: Any
Load the parameters as saved by :py:meth:`save_best()`.
def load_best(self, best): """ Load the parameters as saved by :py:meth:`save_best()`. Parameters ---------- best: Any """ for m, state_dict in zip(self._trainables, best): self.__dict__[m].load_state_dict({k: v.to(self.device) for k, v in state_dict....
[ "def", "load_best", "(", "self", ",", "best", ")", ":", "for", "m", ",", "state_dict", "in", "zip", "(", "self", ".", "_trainables", ",", "best", ")", ":", "self", ".", "__dict__", "[", "m", "]", ".", "load_state_dict", "(", "{", "k", ":", "v", "...
[ 378, 4 ]
[ 387, 99 ]
python
en
['en', 'error', 'th']
False
BaseProcess._make_dataloader
(self, dataset, training=False, **loader_kwargs)
Any args that make more sense as a convenience function to be set
Any args that make more sense as a convenience function to be set
def _make_dataloader(self, dataset, training=False, **loader_kwargs): """Any args that make more sense as a convenience function to be set""" if isinstance(dataset, DataLoader): return dataset return DataLoader(dataset, **self._dataloader_args(dataset, training, **loader_kwargs))
[ "def", "_make_dataloader", "(", "self", ",", "dataset", ",", "training", "=", "False", ",", "*", "*", "loader_kwargs", ")", ":", "if", "isinstance", "(", "dataset", ",", "DataLoader", ")", ":", "return", "dataset", "return", "DataLoader", "(", "dataset", "...
[ 418, 4 ]
[ 423, 95 ]
python
en
['en', 'en', 'en']
True
BaseProcess.fit
(self, training_dataset, epochs=1, validation_dataset=None, step_callback=None, resume_epoch=None, resume_iteration=None, log_callback=None, epoch_callback=None, batch_size=8, warmup_frac=0.2, retain_best='loss', validation_interval=None, train_log_interval=None, **loader_kwargs)
sklearn/keras-like convenience method to simply proceed with training across multiple epochs of the provided dataset Parameters ---------- training_dataset : DN3ataset, DataLoader validation_dataset : DN3ataset, DataLoader epochs : int Total num...
sklearn/keras-like convenience method to simply proceed with training across multiple epochs of the provided dataset
def fit(self, training_dataset, epochs=1, validation_dataset=None, step_callback=None, resume_epoch=None, resume_iteration=None, log_callback=None, epoch_callback=None, batch_size=8, warmup_frac=0.2, retain_best='loss', validation_interval=None, train_log_interval=None, **loader_kwar...
[ "def", "fit", "(", "self", ",", "training_dataset", ",", "epochs", "=", "1", ",", "validation_dataset", "=", "None", ",", "step_callback", "=", "None", ",", "resume_epoch", "=", "None", ",", "resume_iteration", "=", "None", ",", "log_callback", "=", "None", ...
[ 425, 4 ]
[ 605, 62 ]
python
en
['en', 'error', 'th']
False
StandardClassification.fit
(self, training_dataset, epochs=1, validation_dataset=None, step_callback=None, epoch_callback=None, batch_size=8, warmup_frac=0.2, retain_best='loss', balance_method=None, **loader_kwargs)
sklearn/keras-like convenience method to simply proceed with training across multiple epochs of the provided dataset Parameters ---------- training_dataset : DN3ataset, DataLoader validation_dataset : DN3ataset, DataLoader epochs : int step_callback : ca...
sklearn/keras-like convenience method to simply proceed with training across multiple epochs of the provided dataset
def fit(self, training_dataset, epochs=1, validation_dataset=None, step_callback=None, epoch_callback=None, batch_size=8, warmup_frac=0.2, retain_best='loss', balance_method=None, **loader_kwargs): """ sklearn/keras-like convenience method to simply proceed with training across multiple epoc...
[ "def", "fit", "(", "self", ",", "training_dataset", ",", "epochs", "=", "1", ",", "validation_dataset", "=", "None", ",", "step_callback", "=", "None", ",", "epoch_callback", "=", "None", ",", "batch_size", "=", "8", ",", "warmup_frac", "=", "0.2", ",", ...
[ 655, 4 ]
[ 709, 71 ]
python
en
['en', 'error', 'th']
False
_conf_preprocess
(value)
Preprocess alternative configuration formats.
Preprocess alternative configuration formats.
def _conf_preprocess(value): """Preprocess alternative configuration formats.""" if not isinstance(value, dict): value = {CONF_ENTITIES: value} return value
[ "def", "_conf_preprocess", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "value", "=", "{", "CONF_ENTITIES", ":", "value", "}", "return", "value" ]
[ 65, 0 ]
[ 70, 16 ]
python
en
['en', 'it', 'en']
True
is_on
(hass, entity_id)
Test if the group state is in its ON-state.
Test if the group state is in its ON-state.
def is_on(hass, entity_id): """Test if the group state is in its ON-state.""" if REG_KEY not in hass.data: # Integration not setup yet, it cannot be on return False state = hass.states.get(entity_id) if state is not None: return state.state in hass.data[REG_KEY].on_off_mapping ...
[ "def", "is_on", "(", "hass", ",", "entity_id", ")", ":", "if", "REG_KEY", "not", "in", "hass", ".", "data", ":", "# Integration not setup yet, it cannot be on", "return", "False", "state", "=", "hass", ".", "states", ".", "get", "(", "entity_id", ")", "if", ...
[ 115, 0 ]
[ 126, 16 ]
python
en
['en', 'en', 'en']
True
expand_entity_ids
(hass: HomeAssistantType, entity_ids: Iterable[Any])
Return entity_ids with group entity ids replaced by their members. Async friendly.
Return entity_ids with group entity ids replaced by their members.
def expand_entity_ids(hass: HomeAssistantType, entity_ids: Iterable[Any]) -> List[str]: """Return entity_ids with group entity ids replaced by their members. Async friendly. """ found_ids: List[str] = [] for entity_id in entity_ids: if not isinstance(entity_id, str) or entity_id in ( ...
[ "def", "expand_entity_ids", "(", "hass", ":", "HomeAssistantType", ",", "entity_ids", ":", "Iterable", "[", "Any", "]", ")", "->", "List", "[", "str", "]", ":", "found_ids", ":", "List", "[", "str", "]", "=", "[", "]", "for", "entity_id", "in", "entity...
[ 130, 0 ]
[ 168, 20 ]
python
en
['en', 'en', 'en']
True
get_entity_ids
( hass: HomeAssistantType, entity_id: str, domain_filter: Optional[str] = None )
Get members of this group. Async friendly.
Get members of this group.
def get_entity_ids( hass: HomeAssistantType, entity_id: str, domain_filter: Optional[str] = None ) -> List[str]: """Get members of this group. Async friendly. """ group = hass.states.get(entity_id) if not group or ATTR_ENTITY_ID not in group.attributes: return [] entity_ids = grou...
[ "def", "get_entity_ids", "(", "hass", ":", "HomeAssistantType", ",", "entity_id", ":", "str", ",", "domain_filter", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "List", "[", "str", "]", ":", "group", "=", "hass", ".", "states", ".", "get",...
[ 172, 0 ]
[ 190, 80 ]
python
en
['en', 'en', 'en']
True
groups_with_entity
(hass: HomeAssistantType, entity_id: str)
Get all groups that contain this entity. Async friendly.
Get all groups that contain this entity.
def groups_with_entity(hass: HomeAssistantType, entity_id: str) -> List[str]: """Get all groups that contain this entity. Async friendly. """ if DOMAIN not in hass.data: return [] groups = [] for group in hass.data[DOMAIN].entities: if entity_id in group.tracking: ...
[ "def", "groups_with_entity", "(", "hass", ":", "HomeAssistantType", ",", "entity_id", ":", "str", ")", "->", "List", "[", "str", "]", ":", "if", "DOMAIN", "not", "in", "hass", ".", "data", ":", "return", "[", "]", "groups", "=", "[", "]", "for", "gro...
[ 194, 0 ]
[ 208, 17 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up all groups found defined in the configuration.
Set up all groups found defined in the configuration.
async def async_setup(hass, config): """Set up all groups found defined in the configuration.""" component = hass.data.get(DOMAIN) if component is None: component = hass.data[DOMAIN] = EntityComponent(_LOGGER, DOMAIN, hass) hass.data[REG_KEY] = GroupIntegrationRegistry() await async_proce...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "component", "=", "hass", ".", "data", ".", "get", "(", "DOMAIN", ")", "if", "component", "is", "None", ":", "component", "=", "hass", ".", "data", "[", "DOMAIN", "]", "=", "EntityC...
[ 211, 0 ]
[ 342, 15 ]
python
en
['en', 'en', 'en']
True
_process_group_platform
(hass, domain, platform)
Process a group platform.
Process a group platform.
async def _process_group_platform(hass, domain, platform): """Process a group platform.""" current_domain.set(domain) platform.async_describe_on_off_states(hass, hass.data[REG_KEY])
[ "async", "def", "_process_group_platform", "(", "hass", ",", "domain", ",", "platform", ")", ":", "current_domain", ".", "set", "(", "domain", ")", "platform", ".", "async_describe_on_off_states", "(", "hass", ",", "hass", ".", "data", "[", "REG_KEY", "]", "...
[ 345, 0 ]
[ 349, 67 ]
python
en
['en', 'lv', 'en']
True
_async_process_config
(hass, config, component)
Process group configuration.
Process group configuration.
async def _async_process_config(hass, config, component): """Process group configuration.""" hass.data.setdefault(GROUP_ORDER, 0) tasks = [] for object_id, conf in config.get(DOMAIN, {}).items(): name = conf.get(CONF_NAME, object_id) entity_ids = conf.get(CONF_ENTITIES) or [] i...
[ "async", "def", "_async_process_config", "(", "hass", ",", "config", ",", "component", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "GROUP_ORDER", ",", "0", ")", "tasks", "=", "[", "]", "for", "object_id", ",", "conf", "in", "config", ".", "g...
[ 352, 0 ]
[ 385, 32 ]
python
en
['en', 'fr', 'en']
True
GroupIntegrationRegistry.exclude_domain
(self)
Exclude the current domain.
Exclude the current domain.
def exclude_domain(self) -> None: """Exclude the current domain.""" self.exclude_domains.add(current_domain.get())
[ "def", "exclude_domain", "(", "self", ")", "->", "None", ":", "self", ".", "exclude_domains", ".", "add", "(", "current_domain", ".", "get", "(", ")", ")" ]
[ 98, 4 ]
[ 100, 54 ]
python
en
['en', 'en', 'en']
True
GroupIntegrationRegistry.on_off_states
(self, on_states: Set, off_state: str)
Register on and off states for the current domain.
Register on and off states for the current domain.
def on_off_states(self, on_states: Set, off_state: str) -> None: """Register on and off states for the current domain.""" for on_state in on_states: if on_state not in self.on_off_mapping: self.on_off_mapping[on_state] = off_state if len(on_states) == 1 and off_state...
[ "def", "on_off_states", "(", "self", ",", "on_states", ":", "Set", ",", "off_state", ":", "str", ")", "->", "None", ":", "for", "on_state", "in", "on_states", ":", "if", "on_state", "not", "in", "self", ".", "on_off_mapping", ":", "self", ".", "on_off_ma...
[ 102, 4 ]
[ 111, 71 ]
python
en
['en', 'en', 'en']
True
GroupEntity.should_poll
(self)
Disable polling for group.
Disable polling for group.
def should_poll(self) -> bool: """Disable polling for group.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 392, 4 ]
[ 394, 20 ]
python
en
['en', 'en', 'en']
True
GroupEntity.async_added_to_hass
(self)
Register listeners.
Register listeners.
async def async_added_to_hass(self) -> None: """Register listeners.""" assert self.hass is not None async def _update_at_start(_): await self.async_update() self.async_write_ha_state() self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, _update_at_start)
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "assert", "self", ".", "hass", "is", "not", "None", "async", "def", "_update_at_start", "(", "_", ")", ":", "await", "self", ".", "async_update", "(", ")", "self", ".", "async_wr...
[ 396, 4 ]
[ 404, 84 ]
python
en
['fr', 'no', 'en']
False
GroupEntity.async_defer_or_update_ha_state
(self)
Only update once at start.
Only update once at start.
async def async_defer_or_update_ha_state(self) -> None: """Only update once at start.""" assert self.hass is not None if self.hass.state != CoreState.running: return await self.async_update() self.async_write_ha_state()
[ "async", "def", "async_defer_or_update_ha_state", "(", "self", ")", "->", "None", ":", "assert", "self", ".", "hass", "is", "not", "None", "if", "self", ".", "hass", ".", "state", "!=", "CoreState", ".", "running", ":", "return", "await", "self", ".", "a...
[ 406, 4 ]
[ 414, 35 ]
python
en
['en', 'en', 'en']
True
GroupEntity.async_update
(self)
Abstract method to update the entity.
Abstract method to update the entity.
async def async_update(self) -> None: """Abstract method to update the entity."""
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":" ]
[ 417, 4 ]
[ 418, 51 ]
python
en
['en', 'en', 'en']
True
Group.__init__
( self, hass, name, order=None, icon=None, user_defined=True, entity_ids=None, mode=None, )
Initialize a group. This Object has factory function for creation.
Initialize a group.
def __init__( self, hass, name, order=None, icon=None, user_defined=True, entity_ids=None, mode=None, ): """Initialize a group. This Object has factory function for creation. """ self.hass = hass self._name = na...
[ "def", "__init__", "(", "self", ",", "hass", ",", "name", ",", "order", "=", "None", ",", "icon", "=", "None", ",", "user_defined", "=", "True", ",", "entity_ids", "=", "None", ",", "mode", "=", "None", ",", ")", ":", "self", ".", "hass", "=", "h...
[ 424, 4 ]
[ 452, 46 ]
python
en
['en', 'en', 'en']
True
Group.create_group
( hass, name, entity_ids=None, user_defined=True, icon=None, object_id=None, mode=None, order=None, )
Initialize a group.
Initialize a group.
def create_group( hass, name, entity_ids=None, user_defined=True, icon=None, object_id=None, mode=None, order=None, ): """Initialize a group.""" return asyncio.run_coroutine_threadsafe( Group.async_create_group( ...
[ "def", "create_group", "(", "hass", ",", "name", ",", "entity_ids", "=", "None", ",", "user_defined", "=", "True", ",", "icon", "=", "None", ",", "object_id", "=", "None", ",", "mode", "=", "None", ",", "order", "=", "None", ",", ")", ":", "return", ...
[ 455, 4 ]
[ 471, 18 ]
python
en
['en', 'en', 'en']
True
Group.async_create_group
( hass, name, entity_ids=None, user_defined=True, icon=None, object_id=None, mode=None, order=None, )
Initialize a group. This method must be run in the event loop.
Initialize a group.
async def async_create_group( hass, name, entity_ids=None, user_defined=True, icon=None, object_id=None, mode=None, order=None, ): """Initialize a group. This method must be run in the event loop. """ if order is None: ...
[ "async", "def", "async_create_group", "(", "hass", ",", "name", ",", "entity_ids", "=", "None", ",", "user_defined", "=", "True", ",", "icon", "=", "None", ",", "object_id", "=", "None", ",", "mode", "=", "None", ",", "order", "=", "None", ",", ")", ...
[ 474, 4 ]
[ 518, 20 ]
python
en
['en', 'en', 'en']
True
Group.should_poll
(self)
No need to poll because groups will update themselves.
No need to poll because groups will update themselves.
def should_poll(self): """No need to poll because groups will update themselves.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 521, 4 ]
[ 523, 20 ]
python
en
['en', 'en', 'en']
True
Group.name
(self)
Return the name of the group.
Return the name of the group.
def name(self): """Return the name of the group.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 526, 4 ]
[ 528, 25 ]
python
en
['en', 'en', 'en']
True
Group.name
(self, value)
Set Group name.
Set Group name.
def name(self, value): """Set Group name.""" self._name = value
[ "def", "name", "(", "self", ",", "value", ")", ":", "self", ".", "_name", "=", "value" ]
[ 531, 4 ]
[ 533, 26 ]
python
en
['en', 'ceb', 'en']
True
Group.state
(self)
Return the state of the group.
Return the state of the group.
def state(self): """Return the state of the group.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 536, 4 ]
[ 538, 26 ]
python
en
['en', 'en', 'en']
True
Group.icon
(self)
Return the icon of the group.
Return the icon of the group.
def icon(self): """Return the icon of the group.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 541, 4 ]
[ 543, 25 ]
python
en
['en', 'en', 'en']
True
Group.icon
(self, value)
Set Icon for group.
Set Icon for group.
def icon(self, value): """Set Icon for group.""" self._icon = value
[ "def", "icon", "(", "self", ",", "value", ")", ":", "self", ".", "_icon", "=", "value" ]
[ 546, 4 ]
[ 548, 26 ]
python
en
['en', 'en', 'en']
True
Group.state_attributes
(self)
Return the state attributes for the group.
Return the state attributes for the group.
def state_attributes(self): """Return the state attributes for the group.""" data = {ATTR_ENTITY_ID: self.tracking, ATTR_ORDER: self._order} if not self.user_defined: data[ATTR_AUTO] = True return data
[ "def", "state_attributes", "(", "self", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "self", ".", "tracking", ",", "ATTR_ORDER", ":", "self", ".", "_order", "}", "if", "not", "self", ".", "user_defined", ":", "data", "[", "ATTR_AUTO", "]", "=", "...
[ 551, 4 ]
[ 557, 19 ]
python
en
['en', 'en', 'en']
True
Group.assumed_state
(self)
Test if any member has an assumed state.
Test if any member has an assumed state.
def assumed_state(self): """Test if any member has an assumed state.""" return self._assumed_state
[ "def", "assumed_state", "(", "self", ")", ":", "return", "self", ".", "_assumed_state" ]
[ 560, 4 ]
[ 562, 34 ]
python
en
['en', 'en', 'en']
True
Group.update_tracked_entity_ids
(self, entity_ids)
Update the member entity IDs.
Update the member entity IDs.
def update_tracked_entity_ids(self, entity_ids): """Update the member entity IDs.""" asyncio.run_coroutine_threadsafe( self.async_update_tracked_entity_ids(entity_ids), self.hass.loop ).result()
[ "def", "update_tracked_entity_ids", "(", "self", ",", "entity_ids", ")", ":", "asyncio", ".", "run_coroutine_threadsafe", "(", "self", ".", "async_update_tracked_entity_ids", "(", "entity_ids", ")", ",", "self", ".", "hass", ".", "loop", ")", ".", "result", "(",...
[ 564, 4 ]
[ 568, 18 ]
python
en
['en', 'en', 'en']
True
Group.async_update_tracked_entity_ids
(self, entity_ids)
Update the member entity IDs. This method must be run in the event loop.
Update the member entity IDs.
async def async_update_tracked_entity_ids(self, entity_ids): """Update the member entity IDs. This method must be run in the event loop. """ self._async_stop() self._set_tracked(entity_ids) self._reset_tracked_state() self._async_start()
[ "async", "def", "async_update_tracked_entity_ids", "(", "self", ",", "entity_ids", ")", ":", "self", ".", "_async_stop", "(", ")", "self", ".", "_set_tracked", "(", "entity_ids", ")", "self", ".", "_reset_tracked_state", "(", ")", "self", ".", "_async_start", ...
[ 570, 4 ]
[ 578, 27 ]
python
en
['en', 'en', 'en']
True
Group._set_tracked
(self, entity_ids)
Tuple of entities to be tracked.
Tuple of entities to be tracked.
def _set_tracked(self, entity_ids): """Tuple of entities to be tracked.""" # tracking are the entities we want to track # trackable are the entities we actually watch if not entity_ids: self.tracking = () self.trackable = () return excluded_d...
[ "def", "_set_tracked", "(", "self", ",", "entity_ids", ")", ":", "# tracking are the entities we want to track", "# trackable are the entities we actually watch", "if", "not", "entity_ids", ":", "self", ".", "tracking", "=", "(", ")", "self", ".", "trackable", "=", "(...
[ 580, 4 ]
[ 602, 39 ]
python
en
['en', 'en', 'en']
True
Group._async_start
(self, *_)
Start tracking members and write state.
Start tracking members and write state.
def _async_start(self, *_): """Start tracking members and write state.""" self._reset_tracked_state() self._async_start_tracking() self.async_write_ha_state()
[ "def", "_async_start", "(", "self", ",", "*", "_", ")", ":", "self", ".", "_reset_tracked_state", "(", ")", "self", ".", "_async_start_tracking", "(", ")", "self", ".", "async_write_ha_state", "(", ")" ]
[ 605, 4 ]
[ 609, 35 ]
python
en
['en', 'en', 'en']
True
Group._async_start_tracking
(self)
Start tracking members. This method must be run in the event loop.
Start tracking members.
def _async_start_tracking(self): """Start tracking members. This method must be run in the event loop. """ if self.trackable and self._async_unsub_state_changed is None: self._async_unsub_state_changed = async_track_state_change_event( self.hass, self.trackab...
[ "def", "_async_start_tracking", "(", "self", ")", ":", "if", "self", ".", "trackable", "and", "self", ".", "_async_unsub_state_changed", "is", "None", ":", "self", ".", "_async_unsub_state_changed", "=", "async_track_state_change_event", "(", "self", ".", "hass", ...
[ 612, 4 ]
[ 622, 40 ]
python
en
['en', 'sn', 'en']
True
Group._async_stop
(self)
Unregister the group from Home Assistant. This method must be run in the event loop.
Unregister the group from Home Assistant.
def _async_stop(self): """Unregister the group from Home Assistant. This method must be run in the event loop. """ if self._async_unsub_state_changed: self._async_unsub_state_changed() self._async_unsub_state_changed = None
[ "def", "_async_stop", "(", "self", ")", ":", "if", "self", ".", "_async_unsub_state_changed", ":", "self", ".", "_async_unsub_state_changed", "(", ")", "self", ".", "_async_unsub_state_changed", "=", "None" ]
[ 625, 4 ]
[ 632, 50 ]
python
en
['en', 'en', 'en']
True
Group.async_update
(self)
Query all members and determine current group state.
Query all members and determine current group state.
async def async_update(self): """Query all members and determine current group state.""" self._state = None self._async_update_group_state()
[ "async", "def", "async_update", "(", "self", ")", ":", "self", ".", "_state", "=", "None", "self", ".", "_async_update_group_state", "(", ")" ]
[ 634, 4 ]
[ 637, 40 ]
python
en
['en', 'en', 'en']
True
Group.async_added_to_hass
(self)
Handle addition to Home Assistant.
Handle addition to Home Assistant.
async def async_added_to_hass(self): """Handle addition to Home Assistant.""" if self.hass.state != CoreState.running: self.hass.bus.async_listen_once( EVENT_HOMEASSISTANT_START, self._async_start ) return if self.tracking: self._r...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "if", "self", ".", "hass", ".", "state", "!=", "CoreState", ".", "running", ":", "self", ".", "hass", ".", "bus", ".", "async_listen_once", "(", "EVENT_HOMEASSISTANT_START", ",", "self", ".", "_...
[ 639, 4 ]
[ 649, 36 ]
python
en
['en', 'en', 'en']
True
Group.async_will_remove_from_hass
(self)
Handle removal from Home Assistant.
Handle removal from Home Assistant.
async def async_will_remove_from_hass(self): """Handle removal from Home Assistant.""" self._async_stop()
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", ":", "self", ".", "_async_stop", "(", ")" ]
[ 651, 4 ]
[ 653, 26 ]
python
en
['en', 'en', 'en']
True
Group._async_state_changed_listener
(self, event)
Respond to a member state changing. This method must be run in the event loop.
Respond to a member state changing.
async def _async_state_changed_listener(self, event): """Respond to a member state changing. This method must be run in the event loop. """ # removed if self._async_unsub_state_changed is None: return self.async_set_context(event.context) new_state =...
[ "async", "def", "_async_state_changed_listener", "(", "self", ",", "event", ")", ":", "# removed", "if", "self", ".", "_async_unsub_state_changed", "is", "None", ":", "return", "self", ".", "async_set_context", "(", "event", ".", "context", ")", "new_state", "="...
[ 655, 4 ]
[ 672, 35 ]
python
en
['en', 'en', 'en']
True