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
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Horizon platform.
Set up the Horizon platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Horizon platform.""" host = config[CONF_HOST] name = config[CONF_NAME] port = config[CONF_PORT] try: client = Client(host, port=port) except AuthenticationError as msg: _LOGGER.error("Authenticat...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "host", "=", "config", "[", "CONF_HOST", "]", "name", "=", "config", "[", "CONF_NAME", "]", "port", "=", "config", "[", "CONF_PORT", "...
[ 58, 0 ]
[ 77, 59 ]
python
en
['en', 'su', 'en']
True
HorizonDevice.__init__
(self, client, name, remote_keys)
Initialize the remote.
Initialize the remote.
def __init__(self, client, name, remote_keys): """Initialize the remote.""" self._client = client self._name = name self._state = None self._keys = remote_keys
[ "def", "__init__", "(", "self", ",", "client", ",", "name", ",", "remote_keys", ")", ":", "self", ".", "_client", "=", "client", "self", ".", "_name", "=", "name", "self", ".", "_state", "=", "None", "self", ".", "_keys", "=", "remote_keys" ]
[ 83, 4 ]
[ 88, 32 ]
python
en
['en', 'en', 'en']
True
HorizonDevice.name
(self)
Return the name of the remote.
Return the name of the remote.
def name(self): """Return the name of the remote.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 91, 4 ]
[ 93, 25 ]
python
en
['en', 'en', 'en']
True
HorizonDevice.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" ]
[ 96, 4 ]
[ 98, 26 ]
python
en
['en', 'en', 'en']
True
HorizonDevice.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_HORIZON
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_HORIZON" ]
[ 101, 4 ]
[ 103, 30 ]
python
en
['en', 'en', 'en']
True
HorizonDevice.update
(self)
Update State using the media server running on the Horizon.
Update State using the media server running on the Horizon.
def update(self): """Update State using the media server running on the Horizon.""" try: if self._client.is_powered_on(): self._state = STATE_PLAYING else: self._state = STATE_OFF except OSError: self._state = STATE_OFF
[ "def", "update", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_client", ".", "is_powered_on", "(", ")", ":", "self", ".", "_state", "=", "STATE_PLAYING", "else", ":", "self", ".", "_state", "=", "STATE_OFF", "except", "OSError", ":", "self", ...
[ 106, 4 ]
[ 114, 35 ]
python
en
['en', 'sn', 'en']
True
HorizonDevice.turn_on
(self)
Turn the device on.
Turn the device on.
def turn_on(self): """Turn the device on.""" if self._state == STATE_OFF: self._send_key(self._keys.POWER)
[ "def", "turn_on", "(", "self", ")", ":", "if", "self", ".", "_state", "==", "STATE_OFF", ":", "self", ".", "_send_key", "(", "self", ".", "_keys", ".", "POWER", ")" ]
[ 116, 4 ]
[ 119, 44 ]
python
en
['en', 'en', 'en']
True
HorizonDevice.turn_off
(self)
Turn the device off.
Turn the device off.
def turn_off(self): """Turn the device off.""" if self._state != STATE_OFF: self._send_key(self._keys.POWER)
[ "def", "turn_off", "(", "self", ")", ":", "if", "self", ".", "_state", "!=", "STATE_OFF", ":", "self", ".", "_send_key", "(", "self", ".", "_keys", ".", "POWER", ")" ]
[ 121, 4 ]
[ 124, 44 ]
python
en
['en', 'en', 'en']
True
HorizonDevice.media_previous_track
(self)
Channel down.
Channel down.
def media_previous_track(self): """Channel down.""" self._send_key(self._keys.CHAN_DOWN) self._state = STATE_PLAYING
[ "def", "media_previous_track", "(", "self", ")", ":", "self", ".", "_send_key", "(", "self", ".", "_keys", ".", "CHAN_DOWN", ")", "self", ".", "_state", "=", "STATE_PLAYING" ]
[ 126, 4 ]
[ 129, 35 ]
python
en
['it', 'en', 'en']
False
HorizonDevice.media_next_track
(self)
Channel up.
Channel up.
def media_next_track(self): """Channel up.""" self._send_key(self._keys.CHAN_UP) self._state = STATE_PLAYING
[ "def", "media_next_track", "(", "self", ")", ":", "self", ".", "_send_key", "(", "self", ".", "_keys", ".", "CHAN_UP", ")", "self", ".", "_state", "=", "STATE_PLAYING" ]
[ 131, 4 ]
[ 134, 35 ]
python
en
['it', 'en', 'en']
False
HorizonDevice.media_play
(self)
Send play command.
Send play command.
def media_play(self): """Send play command.""" self._send_key(self._keys.PAUSE) self._state = STATE_PLAYING
[ "def", "media_play", "(", "self", ")", ":", "self", ".", "_send_key", "(", "self", ".", "_keys", ".", "PAUSE", ")", "self", ".", "_state", "=", "STATE_PLAYING" ]
[ 136, 4 ]
[ 139, 35 ]
python
en
['en', 'en', 'en']
True
HorizonDevice.media_pause
(self)
Send pause command.
Send pause command.
def media_pause(self): """Send pause command.""" self._send_key(self._keys.PAUSE) self._state = STATE_PAUSED
[ "def", "media_pause", "(", "self", ")", ":", "self", ".", "_send_key", "(", "self", ".", "_keys", ".", "PAUSE", ")", "self", ".", "_state", "=", "STATE_PAUSED" ]
[ 141, 4 ]
[ 144, 34 ]
python
en
['en', 'en', 'en']
True
HorizonDevice.media_play_pause
(self)
Send play/pause command.
Send play/pause command.
def media_play_pause(self): """Send play/pause command.""" self._send_key(self._keys.PAUSE) if self._state == STATE_PAUSED: self._state = STATE_PLAYING else: self._state = STATE_PAUSED
[ "def", "media_play_pause", "(", "self", ")", ":", "self", ".", "_send_key", "(", "self", ".", "_keys", ".", "PAUSE", ")", "if", "self", ".", "_state", "==", "STATE_PAUSED", ":", "self", ".", "_state", "=", "STATE_PLAYING", "else", ":", "self", ".", "_s...
[ 146, 4 ]
[ 152, 38 ]
python
en
['en', 'en', 'en']
True
HorizonDevice.play_media
(self, media_type, media_id, **kwargs)
Play media / switch to channel.
Play media / switch to channel.
def play_media(self, media_type, media_id, **kwargs): """Play media / switch to channel.""" if MEDIA_TYPE_CHANNEL == media_type: try: self._select_channel(int(media_id)) self._state = STATE_PLAYING except ValueError: _LOGGER.error("...
[ "def", "play_media", "(", "self", ",", "media_type", ",", "media_id", ",", "*", "*", "kwargs", ")", ":", "if", "MEDIA_TYPE_CHANNEL", "==", "media_type", ":", "try", ":", "self", ".", "_select_channel", "(", "int", "(", "media_id", ")", ")", "self", ".", ...
[ 154, 4 ]
[ 167, 13 ]
python
en
['en', 'en', 'en']
True
HorizonDevice._select_channel
(self, channel)
Select a channel (taken from einder library, thx).
Select a channel (taken from einder library, thx).
def _select_channel(self, channel): """Select a channel (taken from einder library, thx).""" self._send(channel=channel)
[ "def", "_select_channel", "(", "self", ",", "channel", ")", ":", "self", ".", "_send", "(", "channel", "=", "channel", ")" ]
[ 169, 4 ]
[ 171, 35 ]
python
en
['en', 'en', 'en']
True
HorizonDevice._send_key
(self, key)
Send a key to the Horizon device.
Send a key to the Horizon device.
def _send_key(self, key): """Send a key to the Horizon device.""" self._send(key=key)
[ "def", "_send_key", "(", "self", ",", "key", ")", ":", "self", ".", "_send", "(", "key", "=", "key", ")" ]
[ 173, 4 ]
[ 175, 27 ]
python
en
['en', 'mk', 'en']
True
HorizonDevice._send
(self, key=None, channel=None)
Send a key to the Horizon device.
Send a key to the Horizon device.
def _send(self, key=None, channel=None): """Send a key to the Horizon device.""" try: if key: self._client.send_key(key) elif channel: self._client.select_channel(channel) except OSError as msg: _LOGGER.error( "...
[ "def", "_send", "(", "self", ",", "key", "=", "None", ",", "channel", "=", "None", ")", ":", "try", ":", "if", "key", ":", "self", ".", "_client", ".", "send_key", "(", "key", ")", "elif", "channel", ":", "self", ".", "_client", ".", "select_channe...
[ 177, 4 ]
[ 204, 48 ]
python
en
['en', 'mk', 'en']
True
async_setup_entry_gw
(hass: HomeAssistant, entry: ConfigEntry)
Set up Plugwise Smiles from a config entry.
Set up Plugwise Smiles from a config entry.
async def async_setup_entry_gw(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Plugwise Smiles from a config entry.""" websession = async_get_clientsession(hass, verify_ssl=False) api = Smile( host=entry.data[CONF_HOST], username=entry.data.get(CONF_USERNAME, DEFAULT_USERNAME), ...
[ "async", "def", "async_setup_entry_gw", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "websession", "=", "async_get_clientsession", "(", "hass", ",", "verify_ssl", "=", "False", ")", "api", "=", "Smile", "(", "h...
[ 46, 0 ]
[ 141, 15 ]
python
en
['en', 'en', 'en']
True
_update_listener
(hass: HomeAssistant, entry: ConfigEntry)
Handle options update.
Handle options update.
async def _update_listener(hass: HomeAssistant, entry: ConfigEntry): """Handle options update.""" coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR] coordinator.update_interval = timedelta( seconds=entry.options.get(CONF_SCAN_INTERVAL) )
[ "async", "def", "_update_listener", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "coordinator", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", "]", "[", "COORDINATOR", "]", "coordinator", ".",...
[ 144, 0 ]
[ 149, 5 ]
python
en
['en', 'nl', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in ALL_PLATFORMS ] ...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload...
[ 152, 0 ]
[ 168, 20 ]
python
en
['en', 'es', 'en']
True
SmileGateway.__init__
(self, api, coordinator, name, dev_id)
Initialise the gateway.
Initialise the gateway.
def __init__(self, api, coordinator, name, dev_id): """Initialise the gateway.""" super().__init__(coordinator) self._api = api self._name = name self._dev_id = dev_id self._unique_id = None self._model = None self._entity_name = self._name
[ "def", "__init__", "(", "self", ",", "api", ",", "coordinator", ",", "name", ",", "dev_id", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_api", "=", "api", "self", ".", "_name", "=", "name", "self", ".", "_de...
[ 174, 4 ]
[ 185, 38 ]
python
en
['en', 'en', 'en']
True
SmileGateway.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self): """Return a unique ID.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 188, 4 ]
[ 190, 30 ]
python
ca
['fr', 'ca', 'en']
False
SmileGateway.name
(self)
Return the name of the entity, if any.
Return the name of the entity, if any.
def name(self): """Return the name of the entity, if any.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 193, 4 ]
[ 195, 25 ]
python
en
['en', 'en', 'en']
True
SmileGateway.device_info
(self)
Return the device information.
Return the device information.
def device_info(self) -> Dict[str, any]: """Return the device information.""" device_information = { "identifiers": {(DOMAIN, self._dev_id)}, "name": self._entity_name, "manufacturer": "Plugwise", } if self._model is not None: device_info...
[ "def", "device_info", "(", "self", ")", "->", "Dict", "[", "str", ",", "any", "]", ":", "device_information", "=", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_dev_id", ")", "}", ",", "\"name\"", ":", "self", ".", "_entity_name"...
[ 198, 4 ]
[ 213, 33 ]
python
en
['en', 'en', 'en']
True
SmileGateway.async_added_to_hass
(self)
Subscribe to updates.
Subscribe to updates.
async def async_added_to_hass(self): """Subscribe to updates.""" self._async_process_data() self.async_on_remove( self.coordinator.async_add_listener(self._async_process_data) )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_async_process_data", "(", ")", "self", ".", "async_on_remove", "(", "self", ".", "coordinator", ".", "async_add_listener", "(", "self", ".", "_async_process_data", ")", ")" ]
[ 215, 4 ]
[ 220, 9 ]
python
en
['en', 'en', 'en']
True
SmileGateway._async_process_data
(self)
Interpret and process API data.
Interpret and process API data.
def _async_process_data(self): """Interpret and process API data.""" raise NotImplementedError
[ "def", "_async_process_data", "(", "self", ")", ":", "raise", "NotImplementedError" ]
[ 223, 4 ]
[ 225, 33 ]
python
en
['en', 'su', 'en']
True
test_bad_config
(hass)
Test set up the platform with bad/missing config.
Test set up the platform with bad/missing config.
async def test_bad_config(hass): """Test set up the platform with bad/missing config.""" config = {notify.DOMAIN: {"name": "test", "platform": "file"}} with assert_setup_component(0) as handle_config: assert await async_setup_component(hass, notify.DOMAIN, config) assert not handle_config[notify...
[ "async", "def", "test_bad_config", "(", "hass", ")", ":", "config", "=", "{", "notify", ".", "DOMAIN", ":", "{", "\"name\"", ":", "\"test\"", ",", "\"platform\"", ":", "\"file\"", "}", "}", "with", "assert_setup_component", "(", "0", ")", "as", "handle_con...
[ 14, 0 ]
[ 19, 43 ]
python
en
['en', 'da', 'en']
True
test_notify_file
(hass, timestamp)
Test the notify file output.
Test the notify file output.
async def test_notify_file(hass, timestamp): """Test the notify file output.""" filename = "mock_file" message = "one, two, testing, testing" with assert_setup_component(1) as handle_config: assert await async_setup_component( hass, notify.DOMAIN, { ...
[ "async", "def", "test_notify_file", "(", "hass", ",", "timestamp", ")", ":", "filename", "=", "\"mock_file\"", "message", "=", "\"one, two, testing, testing\"", "with", "assert_setup_component", "(", "1", ")", "as", "handle_config", ":", "assert", "await", "async_se...
[ 29, 0 ]
[ 77, 13 ]
python
en
['en', 'en', 'en']
True
test_no_filters_case_1
()
If include and exclude not included, pass everything.
If include and exclude not included, pass everything.
def test_no_filters_case_1(): """If include and exclude not included, pass everything.""" incl_dom = {} incl_ent = {} excl_dom = {} excl_ent = {} testfilter = generate_filter(incl_dom, incl_ent, excl_dom, excl_ent) for value in ("sensor.test", "sun.sun", "light.test"): assert testfi...
[ "def", "test_no_filters_case_1", "(", ")", ":", "incl_dom", "=", "{", "}", "incl_ent", "=", "{", "}", "excl_dom", "=", "{", "}", "excl_ent", "=", "{", "}", "testfilter", "=", "generate_filter", "(", "incl_dom", ",", "incl_ent", ",", "excl_dom", ",", "exc...
[ 8, 0 ]
[ 17, 32 ]
python
en
['en', 'en', 'en']
True
test_includes_only_case_2
()
If include specified, only pass if specified (Case 2).
If include specified, only pass if specified (Case 2).
def test_includes_only_case_2(): """If include specified, only pass if specified (Case 2).""" incl_dom = {"light", "sensor"} incl_ent = {"binary_sensor.working"} excl_dom = {} excl_ent = {} testfilter = generate_filter(incl_dom, incl_ent, excl_dom, excl_ent) assert testfilter("sensor.test")...
[ "def", "test_includes_only_case_2", "(", ")", ":", "incl_dom", "=", "{", "\"light\"", ",", "\"sensor\"", "}", "incl_ent", "=", "{", "\"binary_sensor.working\"", "}", "excl_dom", "=", "{", "}", "excl_ent", "=", "{", "}", "testfilter", "=", "generate_filter", "(...
[ 20, 0 ]
[ 32, 41 ]
python
en
['en', 'en', 'en']
True
test_includes_only_with_glob_case_2
()
If include specified, only pass if specified (Case 2).
If include specified, only pass if specified (Case 2).
def test_includes_only_with_glob_case_2(): """If include specified, only pass if specified (Case 2).""" incl_dom = {"light", "sensor"} incl_glob = {"cover.*_window"} incl_ent = {"binary_sensor.working"} excl_dom = {} excl_glob = {} excl_ent = {} testfilter = generate_filter( incl...
[ "def", "test_includes_only_with_glob_case_2", "(", ")", ":", "incl_dom", "=", "{", "\"light\"", ",", "\"sensor\"", "}", "incl_glob", "=", "{", "\"cover.*_window\"", "}", "incl_ent", "=", "{", "\"binary_sensor.working\"", "}", "excl_dom", "=", "{", "}", "excl_glob"...
[ 35, 0 ]
[ 53, 51 ]
python
en
['en', 'en', 'en']
True
test_excludes_only_case_3
()
If exclude specified, pass all but specified (Case 3).
If exclude specified, pass all but specified (Case 3).
def test_excludes_only_case_3(): """If exclude specified, pass all but specified (Case 3).""" incl_dom = {} incl_ent = {} excl_dom = {"light", "sensor"} excl_ent = {"binary_sensor.working"} testfilter = generate_filter(incl_dom, incl_ent, excl_dom, excl_ent) assert testfilter("sensor.test")...
[ "def", "test_excludes_only_case_3", "(", ")", ":", "incl_dom", "=", "{", "}", "incl_ent", "=", "{", "}", "excl_dom", "=", "{", "\"light\"", ",", "\"sensor\"", "}", "excl_ent", "=", "{", "\"binary_sensor.working\"", "}", "testfilter", "=", "generate_filter", "(...
[ 56, 0 ]
[ 68, 40 ]
python
en
['en', 'en', 'en']
True
test_excludes_only_with_glob_case_3
()
If exclude specified, pass all but specified (Case 3).
If exclude specified, pass all but specified (Case 3).
def test_excludes_only_with_glob_case_3(): """If exclude specified, pass all but specified (Case 3).""" incl_dom = {} incl_glob = {} incl_ent = {} excl_dom = {"light", "sensor"} excl_glob = {"cover.*_window"} excl_ent = {"binary_sensor.working"} testfilter = generate_filter( incl...
[ "def", "test_excludes_only_with_glob_case_3", "(", ")", ":", "incl_dom", "=", "{", "}", "incl_glob", "=", "{", "}", "incl_ent", "=", "{", "}", "excl_dom", "=", "{", "\"light\"", ",", "\"sensor\"", "}", "excl_glob", "=", "{", "\"cover.*_window\"", "}", "excl_...
[ 71, 0 ]
[ 89, 42 ]
python
en
['en', 'en', 'en']
True
test_with_include_domain_case4a
()
Test case 4a - include and exclude specified, with included domain.
Test case 4a - include and exclude specified, with included domain.
def test_with_include_domain_case4a(): """Test case 4a - include and exclude specified, with included domain.""" incl_dom = {"light", "sensor"} incl_ent = {"binary_sensor.working"} excl_dom = {} excl_ent = {"light.ignoreme", "sensor.notworking"} testfilter = generate_filter(incl_dom, incl_ent, e...
[ "def", "test_with_include_domain_case4a", "(", ")", ":", "incl_dom", "=", "{", "\"light\"", ",", "\"sensor\"", "}", "incl_ent", "=", "{", "\"binary_sensor.working\"", "}", "excl_dom", "=", "{", "}", "excl_ent", "=", "{", "\"light.ignoreme\"", ",", "\"sensor.notwor...
[ 92, 0 ]
[ 106, 41 ]
python
en
['en', 'en', 'en']
True
test_with_include_glob_case4a
()
Test case 4a - include and exclude specified, with included glob.
Test case 4a - include and exclude specified, with included glob.
def test_with_include_glob_case4a(): """Test case 4a - include and exclude specified, with included glob.""" incl_dom = {} incl_glob = {"light.*", "sensor.*"} incl_ent = {"binary_sensor.working"} excl_dom = {} excl_glob = {} excl_ent = {"light.ignoreme", "sensor.notworking"} testfilter =...
[ "def", "test_with_include_glob_case4a", "(", ")", ":", "incl_dom", "=", "{", "}", "incl_glob", "=", "{", "\"light.*\"", ",", "\"sensor.*\"", "}", "incl_ent", "=", "{", "\"binary_sensor.working\"", "}", "excl_dom", "=", "{", "}", "excl_glob", "=", "{", "}", "...
[ 109, 0 ]
[ 127, 41 ]
python
en
['en', 'en', 'en']
True
test_with_include_domain_glob_filtering_case4a
()
Test case 4a - include and exclude specified, both have domains and globs.
Test case 4a - include and exclude specified, both have domains and globs.
def test_with_include_domain_glob_filtering_case4a(): """Test case 4a - include and exclude specified, both have domains and globs.""" incl_dom = {"light"} incl_glob = {"*working"} incl_ent = {} excl_dom = {"binary_sensor"} excl_glob = {"*notworking"} excl_ent = {"light.ignoreme"} testfi...
[ "def", "test_with_include_domain_glob_filtering_case4a", "(", ")", ":", "incl_dom", "=", "{", "\"light\"", "}", "incl_glob", "=", "{", "\"*working\"", "}", "incl_ent", "=", "{", "}", "excl_dom", "=", "{", "\"binary_sensor\"", "}", "excl_glob", "=", "{", "\"*notw...
[ 130, 0 ]
[ 149, 41 ]
python
en
['en', 'en', 'en']
True
test_exclude_domain_case4b
()
Test case 4b - include and exclude specified, with excluded domain.
Test case 4b - include and exclude specified, with excluded domain.
def test_exclude_domain_case4b(): """Test case 4b - include and exclude specified, with excluded domain.""" incl_dom = {} incl_ent = {"binary_sensor.working"} excl_dom = {"binary_sensor"} excl_ent = {"light.ignoreme", "sensor.notworking"} testfilter = generate_filter(incl_dom, incl_ent, excl_dom...
[ "def", "test_exclude_domain_case4b", "(", ")", ":", "incl_dom", "=", "{", "}", "incl_ent", "=", "{", "\"binary_sensor.working\"", "}", "excl_dom", "=", "{", "\"binary_sensor\"", "}", "excl_ent", "=", "{", "\"light.ignoreme\"", ",", "\"sensor.notworking\"", "}", "t...
[ 152, 0 ]
[ 166, 40 ]
python
en
['en', 'en', 'en']
True
test_exclude_glob_case4b
()
Test case 4b - include and exclude specified, with excluded glob.
Test case 4b - include and exclude specified, with excluded glob.
def test_exclude_glob_case4b(): """Test case 4b - include and exclude specified, with excluded glob.""" incl_dom = {} incl_glob = {} incl_ent = {"binary_sensor.working"} excl_dom = {} excl_glob = {"binary_sensor.*"} excl_ent = {"light.ignoreme", "sensor.notworking"} testfilter = generate...
[ "def", "test_exclude_glob_case4b", "(", ")", ":", "incl_dom", "=", "{", "}", "incl_glob", "=", "{", "}", "incl_ent", "=", "{", "\"binary_sensor.working\"", "}", "excl_dom", "=", "{", "}", "excl_glob", "=", "{", "\"binary_sensor.*\"", "}", "excl_ent", "=", "{...
[ 169, 0 ]
[ 187, 40 ]
python
en
['en', 'en', 'en']
True
test_no_domain_case4c
()
Test case 4c - include and exclude specified, with no domains.
Test case 4c - include and exclude specified, with no domains.
def test_no_domain_case4c(): """Test case 4c - include and exclude specified, with no domains.""" incl_dom = {} incl_ent = {"binary_sensor.working"} excl_dom = {} excl_ent = {"light.ignoreme", "sensor.notworking"} testfilter = generate_filter(incl_dom, incl_ent, excl_dom, excl_ent) assert t...
[ "def", "test_no_domain_case4c", "(", ")", ":", "incl_dom", "=", "{", "}", "incl_ent", "=", "{", "\"binary_sensor.working\"", "}", "excl_dom", "=", "{", "}", "excl_ent", "=", "{", "\"light.ignoreme\"", ",", "\"sensor.notworking\"", "}", "testfilter", "=", "genera...
[ 190, 0 ]
[ 204, 41 ]
python
en
['en', 'en', 'en']
True
test_filter_schema
()
Test filter schema.
Test filter schema.
def test_filter_schema(): """Test filter schema.""" conf = { "include_domains": ["light"], "include_entities": ["switch.kitchen"], "exclude_domains": ["cover"], "exclude_entities": ["light.kitchen"], } filt = FILTER_SCHEMA(conf) conf.update({"include_entity_globs": []...
[ "def", "test_filter_schema", "(", ")", ":", "conf", "=", "{", "\"include_domains\"", ":", "[", "\"light\"", "]", ",", "\"include_entities\"", ":", "[", "\"switch.kitchen\"", "]", ",", "\"exclude_domains\"", ":", "[", "\"cover\"", "]", ",", "\"exclude_entities\"", ...
[ 207, 0 ]
[ 217, 30 ]
python
de
['de', 'de', 'en']
True
test_filter_schema_with_globs
()
Test filter schema with glob options.
Test filter schema with glob options.
def test_filter_schema_with_globs(): """Test filter schema with glob options.""" conf = { "include_domains": ["light"], "include_entity_globs": ["sensor.kitchen_*"], "include_entities": ["switch.kitchen"], "exclude_domains": ["cover"], "exclude_entity_globs": ["sensor.wea...
[ "def", "test_filter_schema_with_globs", "(", ")", ":", "conf", "=", "{", "\"include_domains\"", ":", "[", "\"light\"", "]", ",", "\"include_entity_globs\"", ":", "[", "\"sensor.kitchen_*\"", "]", ",", "\"include_entities\"", ":", "[", "\"switch.kitchen\"", "]", ",",...
[ 220, 0 ]
[ 231, 30 ]
python
en
['en', 'en', 'en']
True
test_filter_schema_include_exclude
()
Test the include exclude filter schema.
Test the include exclude filter schema.
def test_filter_schema_include_exclude(): """Test the include exclude filter schema.""" conf = { "include": { "domains": ["light"], "entity_globs": ["sensor.kitchen_*"], "entities": ["switch.kitchen"], }, "exclude": { "domains": ["cover"], ...
[ "def", "test_filter_schema_include_exclude", "(", ")", ":", "conf", "=", "{", "\"include\"", ":", "{", "\"domains\"", ":", "[", "\"light\"", "]", ",", "\"entity_globs\"", ":", "[", "\"sensor.kitchen_*\"", "]", ",", "\"entities\"", ":", "[", "\"switch.kitchen\"", ...
[ 234, 0 ]
[ 249, 30 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Z-Wave sensor from config entry.
Set up Z-Wave sensor from config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Z-Wave sensor from config entry.""" @callback def async_add_sensor(value): """Add Z-Wave Sensor.""" # Basic Sensor types if value.primary.type in ( ValueType.BYTE, ValueType.INT, ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "@", "callback", "def", "async_add_sensor", "(", "value", ")", ":", "\"\"\"Add Z-Wave Sensor.\"\"\"", "# Basic Sensor types", "if", "value", ".", "primary", "...
[ 25, 0 ]
[ 56, 5 ]
python
en
['en', 'da', 'en']
True
ZwaveSensorBase.device_class
(self)
Return the device class of the sensor.
Return the device class of the sensor.
def device_class(self): """Return the device class of the sensor.""" if self.values.primary.command_class == CommandClass.BATTERY: return DEVICE_CLASS_BATTERY if self.values.primary.command_class == CommandClass.METER: return DEVICE_CLASS_POWER if "Temperature" in...
[ "def", "device_class", "(", "self", ")", ":", "if", "self", ".", "values", ".", "primary", ".", "command_class", "==", "CommandClass", ".", "BATTERY", ":", "return", "DEVICE_CLASS_BATTERY", "if", "self", ".", "values", ".", "primary", ".", "command_class", "...
[ 63, 4 ]
[ 83, 19 ]
python
en
['en', 'en', 'en']
True
ZwaveSensorBase.entity_registry_enabled_default
(self)
Return if the entity should be enabled when first added to the entity registry.
Return if the entity should be enabled when first added to the entity registry.
def entity_registry_enabled_default(self) -> bool: """Return if the entity should be enabled when first added to the entity registry.""" # We hide some of the more advanced sensors by default to not overwhelm users if self.values.primary.command_class in [ CommandClass.BASIC, ...
[ "def", "entity_registry_enabled_default", "(", "self", ")", "->", "bool", ":", "# We hide some of the more advanced sensors by default to not overwhelm users", "if", "self", ".", "values", ".", "primary", ".", "command_class", "in", "[", "CommandClass", ".", "BASIC", ",",...
[ 86, 4 ]
[ 95, 19 ]
python
en
['en', 'en', 'en']
True
ZwaveSensorBase.force_update
(self)
Force updates.
Force updates.
def force_update(self) -> bool: """Force updates.""" return True
[ "def", "force_update", "(", "self", ")", "->", "bool", ":", "return", "True" ]
[ 98, 4 ]
[ 100, 19 ]
python
en
['en', 'en', 'en']
False
ZWaveStringSensor.state
(self)
Return state of the sensor.
Return state of the sensor.
def state(self): """Return state of the sensor.""" return self.values.primary.value
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "values", ".", "primary", ".", "value" ]
[ 107, 4 ]
[ 109, 40 ]
python
en
['en', 'no', 'en']
True
ZWaveStringSensor.unit_of_measurement
(self)
Return unit of measurement the value is expressed in.
Return unit of measurement the value is expressed in.
def unit_of_measurement(self): """Return unit of measurement the value is expressed in.""" return self.values.primary.units
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "values", ".", "primary", ".", "units" ]
[ 112, 4 ]
[ 114, 40 ]
python
en
['en', 'en', 'en']
True
ZWaveStringSensor.entity_registry_enabled_default
(self)
Return if the entity should be enabled when first added to the entity registry.
Return if the entity should be enabled when first added to the entity registry.
def entity_registry_enabled_default(self): """Return if the entity should be enabled when first added to the entity registry.""" return False
[ "def", "entity_registry_enabled_default", "(", "self", ")", ":", "return", "False" ]
[ 117, 4 ]
[ 119, 20 ]
python
en
['en', 'en', 'en']
True
ZWaveNumericSensor.state
(self)
Return state of the sensor.
Return state of the sensor.
def state(self): """Return state of the sensor.""" return round(self.values.primary.value, 2)
[ "def", "state", "(", "self", ")", ":", "return", "round", "(", "self", ".", "values", ".", "primary", ".", "value", ",", "2", ")" ]
[ 126, 4 ]
[ 128, 50 ]
python
en
['en', 'no', 'en']
True
ZWaveNumericSensor.unit_of_measurement
(self)
Return unit of measurement the value is expressed in.
Return unit of measurement the value is expressed in.
def unit_of_measurement(self): """Return unit of measurement the value is expressed in.""" if self.values.primary.units == "C": return TEMP_CELSIUS if self.values.primary.units == "F": return TEMP_FAHRENHEIT return self.values.primary.units
[ "def", "unit_of_measurement", "(", "self", ")", ":", "if", "self", ".", "values", ".", "primary", ".", "units", "==", "\"C\"", ":", "return", "TEMP_CELSIUS", "if", "self", ".", "values", ".", "primary", ".", "units", "==", "\"F\"", ":", "return", "TEMP_F...
[ 131, 4 ]
[ 138, 40 ]
python
en
['en', 'en', 'en']
True
ZWaveListSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" # We use the id as value for backwards compatibility return self.values.primary.value["Selected_id"]
[ "def", "state", "(", "self", ")", ":", "# We use the id as value for backwards compatibility", "return", "self", ".", "values", ".", "primary", ".", "value", "[", "\"Selected_id\"", "]" ]
[ 145, 4 ]
[ 148, 55 ]
python
en
['en', 'en', 'en']
True
ZWaveListSensor.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 = super().device_state_attributes # add the value's label as property attributes["label"] = self.values.primary.value["Selected"] return attributes
[ "def", "device_state_attributes", "(", "self", ")", ":", "attributes", "=", "super", "(", ")", ".", "device_state_attributes", "# add the value's label as property", "attributes", "[", "\"label\"", "]", "=", "self", ".", "values", ".", "primary", ".", "value", "["...
[ 151, 4 ]
[ 156, 25 ]
python
en
['en', 'en', 'en']
True
ZWaveListSensor.entity_registry_enabled_default
(self)
Return if the entity should be enabled when first added to the entity registry.
Return if the entity should be enabled when first added to the entity registry.
def entity_registry_enabled_default(self) -> bool: """Return if the entity should be enabled when first added to the entity registry.""" # these sensors are only here for backwards compatibility, disable them by default return False
[ "def", "entity_registry_enabled_default", "(", "self", ")", "->", "bool", ":", "# these sensors are only here for backwards compatibility, disable them by default", "return", "False" ]
[ 159, 4 ]
[ 162, 20 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Activate the Apache Kafka integration.
Activate the Apache Kafka integration.
async def async_setup(hass, config): """Activate the Apache Kafka integration.""" conf = config[DOMAIN] kafka = hass.data[DOMAIN] = KafkaManager( hass, conf[CONF_IP_ADDRESS], conf[CONF_PORT], conf[CONF_TOPIC], conf[CONF_FILTER], conf[CONF_SECURITY_PROTOCOL], ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "kafka", "=", "hass", ".", "data", "[", "DOMAIN", "]", "=", "KafkaManager", "(", "hass", ",", "conf", "[", "CONF_IP_ADDRESS", "]", ",", "c...
[ 47, 0 ]
[ 66, 15 ]
python
en
['en', 'en', 'en']
True
DateTimeJSONEncoder.default
(self, o)
Implement encoding logic.
Implement encoding logic.
def default(self, o): """Implement encoding logic.""" if isinstance(o, datetime): return o.isoformat() return super().default(o)
[ "def", "default", "(", "self", ",", "o", ")", ":", "if", "isinstance", "(", "o", ",", "datetime", ")", ":", "return", "o", ".", "isoformat", "(", ")", "return", "super", "(", ")", ".", "default", "(", "o", ")" ]
[ 75, 4 ]
[ 79, 33 ]
python
en
['fr', 'zu', 'en']
False
KafkaManager.__init__
( self, hass, ip_address, port, topic, entities_filter, security_protocol, username, password, )
Initialize.
Initialize.
def __init__( self, hass, ip_address, port, topic, entities_filter, security_protocol, username, password, ): """Initialize.""" self._encoder = DateTimeJSONEncoder() self._entities_filter = entities_filter self._...
[ "def", "__init__", "(", "self", ",", "hass", ",", "ip_address", ",", "port", ",", "topic", ",", "entities_filter", ",", "security_protocol", ",", "username", ",", "password", ",", ")", ":", "self", ".", "_encoder", "=", "DateTimeJSONEncoder", "(", ")", "se...
[ 85, 4 ]
[ 111, 27 ]
python
en
['en', 'en', 'it']
False
KafkaManager._encode_event
(self, event)
Translate events into a binary JSON payload.
Translate events into a binary JSON payload.
def _encode_event(self, event): """Translate events into a binary JSON payload.""" state = event.data.get("new_state") if ( state is None or state.state in (STATE_UNKNOWN, "", STATE_UNAVAILABLE) or not self._entities_filter(state.entity_id) ): ...
[ "def", "_encode_event", "(", "self", ",", "event", ")", ":", "state", "=", "event", ".", "data", ".", "get", "(", "\"new_state\"", ")", "if", "(", "state", "is", "None", "or", "state", ".", "state", "in", "(", "STATE_UNKNOWN", ",", "\"\"", ",", "STAT...
[ 113, 4 ]
[ 125, 9 ]
python
en
['en', 'cs', 'en']
True
KafkaManager.start
(self)
Start the Kafka manager.
Start the Kafka manager.
async def start(self): """Start the Kafka manager.""" self._hass.bus.async_listen(EVENT_STATE_CHANGED, self.write) await self._producer.start()
[ "async", "def", "start", "(", "self", ")", ":", "self", ".", "_hass", ".", "bus", ".", "async_listen", "(", "EVENT_STATE_CHANGED", ",", "self", ".", "write", ")", "await", "self", ".", "_producer", ".", "start", "(", ")" ]
[ 127, 4 ]
[ 130, 36 ]
python
en
['en', 'lb', 'en']
True
KafkaManager.shutdown
(self, _)
Shut the manager down.
Shut the manager down.
async def shutdown(self, _): """Shut the manager down.""" await self._producer.stop()
[ "async", "def", "shutdown", "(", "self", ",", "_", ")", ":", "await", "self", ".", "_producer", ".", "stop", "(", ")" ]
[ 132, 4 ]
[ 134, 35 ]
python
en
['en', 'en', 'en']
True
KafkaManager.write
(self, event)
Write a binary payload to Kafka.
Write a binary payload to Kafka.
async def write(self, event): """Write a binary payload to Kafka.""" payload = self._encode_event(event) if payload: await self._producer.send_and_wait(self._topic, payload)
[ "async", "def", "write", "(", "self", ",", "event", ")", ":", "payload", "=", "self", ".", "_encode_event", "(", "event", ")", "if", "payload", ":", "await", "self", ".", "_producer", ".", "send_and_wait", "(", "self", ".", "_topic", ",", "payload", ")...
[ 136, 4 ]
[ 141, 68 ]
python
en
['en', 'haw', 'en']
True
DynaliteBridge.__init__
(self, hass: HomeAssistant, config: Dict[str, Any])
Initialize the system based on host parameter.
Initialize the system based on host parameter.
def __init__(self, hass: HomeAssistant, config: Dict[str, Any]) -> None: """Initialize the system based on host parameter.""" self.hass = hass self.area = {} self.async_add_devices = {} self.waiting_devices = {} self.host = config[CONF_HOST] # Configure the dynali...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "config", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "self", ".", "hass", "=", "hass", "self", ".", "area", "=", "{", "}", "self", ".", "async_add_device...
[ 32, 4 ]
[ 45, 63 ]
python
en
['en', 'en', 'en']
True
DynaliteBridge.async_setup
(self)
Set up a Dynalite bridge.
Set up a Dynalite bridge.
async def async_setup(self) -> bool: """Set up a Dynalite bridge.""" # Configure the dynalite devices LOGGER.debug("Setting up bridge - host %s", self.host) return await self.dynalite_devices.async_setup()
[ "async", "def", "async_setup", "(", "self", ")", "->", "bool", ":", "# Configure the dynalite devices", "LOGGER", ".", "debug", "(", "\"Setting up bridge - host %s\"", ",", "self", ".", "host", ")", "return", "await", "self", ".", "dynalite_devices", ".", "async_s...
[ 47, 4 ]
[ 51, 56 ]
python
en
['en', 'ht', 'en']
True
DynaliteBridge.reload_config
(self, config: Dict[str, Any])
Reconfigure a bridge when config changes.
Reconfigure a bridge when config changes.
def reload_config(self, config: Dict[str, Any]) -> None: """Reconfigure a bridge when config changes.""" LOGGER.debug("Reloading bridge - host %s, config %s", self.host, config) self.dynalite_devices.configure(convert_config(config))
[ "def", "reload_config", "(", "self", ",", "config", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "LOGGER", ".", "debug", "(", "\"Reloading bridge - host %s, config %s\"", ",", "self", ".", "host", ",", "config", ")", "self", ".", "dy...
[ 53, 4 ]
[ 56, 63 ]
python
en
['en', 'fr', 'en']
True
DynaliteBridge.update_signal
(self, device: Optional[DynaliteBaseDevice] = None)
Create signal to use to trigger entity update.
Create signal to use to trigger entity update.
def update_signal(self, device: Optional[DynaliteBaseDevice] = None) -> str: """Create signal to use to trigger entity update.""" if device: signal = f"dynalite-update-{self.host}-{device.unique_id}" else: signal = f"dynalite-update-{self.host}" return signal
[ "def", "update_signal", "(", "self", ",", "device", ":", "Optional", "[", "DynaliteBaseDevice", "]", "=", "None", ")", "->", "str", ":", "if", "device", ":", "signal", "=", "f\"dynalite-update-{self.host}-{device.unique_id}\"", "else", ":", "signal", "=", "f\"dy...
[ 58, 4 ]
[ 64, 21 ]
python
en
['en', 'en', 'en']
True
DynaliteBridge.update_device
(self, device: Optional[DynaliteBaseDevice] = None)
Call when a device or all devices should be updated.
Call when a device or all devices should be updated.
def update_device(self, device: Optional[DynaliteBaseDevice] = None) -> None: """Call when a device or all devices should be updated.""" if not device: # This is used to signal connection or disconnection, so all devices may become available or not. log_string = ( ...
[ "def", "update_device", "(", "self", ",", "device", ":", "Optional", "[", "DynaliteBaseDevice", "]", "=", "None", ")", "->", "None", ":", "if", "not", "device", ":", "# This is used to signal connection or disconnection, so all devices may become available or not.", "log_...
[ 67, 4 ]
[ 77, 72 ]
python
en
['en', 'en', 'en']
True
DynaliteBridge.handle_notification
(self, notification: DynaliteNotification)
Handle a notification from the platform and issue events.
Handle a notification from the platform and issue events.
def handle_notification(self, notification: DynaliteNotification) -> None: """Handle a notification from the platform and issue events.""" if notification.notification == NOTIFICATION_PACKET: self.hass.bus.async_fire( "dynalite_packet", { A...
[ "def", "handle_notification", "(", "self", ",", "notification", ":", "DynaliteNotification", ")", "->", "None", ":", "if", "notification", ".", "notification", "==", "NOTIFICATION_PACKET", ":", "self", ".", "hass", ".", "bus", ".", "async_fire", "(", "\"dynalite...
[ 80, 4 ]
[ 98, 13 ]
python
en
['en', 'en', 'en']
True
DynaliteBridge.register_add_devices
(self, platform: str, async_add_devices: Callable)
Add an async_add_entities for a category.
Add an async_add_entities for a category.
def register_add_devices(self, platform: str, async_add_devices: Callable) -> None: """Add an async_add_entities for a category.""" self.async_add_devices[platform] = async_add_devices if platform in self.waiting_devices: self.async_add_devices[platform](self.waiting_devices[platform...
[ "def", "register_add_devices", "(", "self", ",", "platform", ":", "str", ",", "async_add_devices", ":", "Callable", ")", "->", "None", ":", "self", ".", "async_add_devices", "[", "platform", "]", "=", "async_add_devices", "if", "platform", "in", "self", ".", ...
[ 101, 4 ]
[ 105, 76 ]
python
en
['en', 'en', 'en']
True
DynaliteBridge.add_devices_when_registered
(self, devices: List[DynaliteBaseDevice])
Add the devices to HA if the add devices callback was registered, otherwise queue until it is.
Add the devices to HA if the add devices callback was registered, otherwise queue until it is.
def add_devices_when_registered(self, devices: List[DynaliteBaseDevice]) -> None: """Add the devices to HA if the add devices callback was registered, otherwise queue until it is.""" for platform in ENTITY_PLATFORMS: platform_devices = [ device for device in devices if device...
[ "def", "add_devices_when_registered", "(", "self", ",", "devices", ":", "List", "[", "DynaliteBaseDevice", "]", ")", "->", "None", ":", "for", "platform", "in", "ENTITY_PLATFORMS", ":", "platform_devices", "=", "[", "device", "for", "device", "in", "devices", ...
[ 107, 4 ]
[ 118, 71 ]
python
en
['en', 'en', 'en']
True
validate_selector
(config: Any)
Validate a selector.
Validate a selector.
def validate_selector(config: Any) -> Dict: """Validate a selector.""" if not isinstance(config, dict): raise vol.Invalid("Expected a dictionary") if len(config) != 1: raise vol.Invalid(f"Only one type can be specified. Found {', '.join(config)}") selector_type = list(config)[0] s...
[ "def", "validate_selector", "(", "config", ":", "Any", ")", "->", "Dict", ":", "if", "not", "isinstance", "(", "config", ",", "dict", ")", ":", "raise", "vol", ".", "Invalid", "(", "\"Expected a dictionary\"", ")", "if", "len", "(", "config", ")", "!=", ...
[ 10, 0 ]
[ 27, 5 ]
python
en
['en', 'en', 'pt']
True
_async_create_entities
(hass, config)
Create the Template Vacuums.
Create the Template Vacuums.
async def _async_create_entities(hass, config): """Create the Template Vacuums.""" vacuums = [] for device, device_config in config[CONF_VACUUMS].items(): friendly_name = device_config.get(CONF_FRIENDLY_NAME, device) state_template = device_config.get(CONF_VALUE_TEMPLATE) battery_l...
[ "async", "def", "_async_create_entities", "(", "hass", ",", "config", ")", ":", "vacuums", "=", "[", "]", "for", "device", ",", "device_config", "in", "config", "[", "CONF_VACUUMS", "]", ".", "items", "(", ")", ":", "friendly_name", "=", "device_config", "...
[ 98, 0 ]
[ 144, 18 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the template vacuums.
Set up the template vacuums.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the template vacuums.""" await async_setup_reload_service(hass, DOMAIN, PLATFORMS) async_add_entities(await _async_create_entities(hass, config))
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "await", "async_setup_reload_service", "(", "hass", ",", "DOMAIN", ",", "PLATFORMS", ")", "async_add_entities", "(", "await...
[ 147, 0 ]
[ 151, 66 ]
python
en
['en', 'en', 'en']
True
TemplateVacuum.__init__
( self, hass, device_id, friendly_name, state_template, battery_level_template, fan_speed_template, availability_template, start_action, pause_action, stop_action, return_to_base_action, clean_spot_action, lo...
Initialize the vacuum.
Initialize the vacuum.
def __init__( self, hass, device_id, friendly_name, state_template, battery_level_template, fan_speed_template, availability_template, start_action, pause_action, stop_action, return_to_base_action, clean_spot_action...
[ "def", "__init__", "(", "self", ",", "hass", ",", "device_id", ",", "friendly_name", ",", "state_template", ",", "battery_level_template", ",", "fan_speed_template", ",", "availability_template", ",", "start_action", ",", "pause_action", ",", "stop_action", ",", "re...
[ 157, 4 ]
[ 244, 45 ]
python
en
['en', 'la', 'en']
True
TemplateVacuum.name
(self)
Return the display name of this vacuum.
Return the display name of this vacuum.
def name(self): """Return the display name of this vacuum.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 247, 4 ]
[ 249, 25 ]
python
en
['en', 'id', 'en']
True
TemplateVacuum.unique_id
(self)
Return the unique id of this vacuum.
Return the unique id of this vacuum.
def unique_id(self): """Return the unique id of this vacuum.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 252, 4 ]
[ 254, 30 ]
python
en
['en', 'la', 'en']
True
TemplateVacuum.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self) -> int: """Flag supported features.""" return self._supported_features
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_supported_features" ]
[ 257, 4 ]
[ 259, 39 ]
python
en
['da', 'en', 'en']
True
TemplateVacuum.state
(self)
Return the status of the vacuum cleaner.
Return the status of the vacuum cleaner.
def state(self): """Return the status of the vacuum cleaner.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 262, 4 ]
[ 264, 26 ]
python
en
['en', 'la', 'en']
True
TemplateVacuum.battery_level
(self)
Return the battery level of the vacuum cleaner.
Return the battery level of the vacuum cleaner.
def battery_level(self): """Return the battery level of the vacuum cleaner.""" return self._battery_level
[ "def", "battery_level", "(", "self", ")", ":", "return", "self", ".", "_battery_level" ]
[ 267, 4 ]
[ 269, 34 ]
python
en
['en', 'en', 'en']
True
TemplateVacuum.fan_speed
(self)
Return the fan speed of the vacuum cleaner.
Return the fan speed of the vacuum cleaner.
def fan_speed(self): """Return the fan speed of the vacuum cleaner.""" return self._fan_speed
[ "def", "fan_speed", "(", "self", ")", ":", "return", "self", ".", "_fan_speed" ]
[ 272, 4 ]
[ 274, 30 ]
python
en
['en', 'en', 'en']
True
TemplateVacuum.fan_speed_list
(self)
Get the list of available fan speeds.
Get the list of available fan speeds.
def fan_speed_list(self) -> list: """Get the list of available fan speeds.""" return self._fan_speed_list
[ "def", "fan_speed_list", "(", "self", ")", "->", "list", ":", "return", "self", ".", "_fan_speed_list" ]
[ 277, 4 ]
[ 279, 35 ]
python
en
['en', 'en', 'en']
True
TemplateVacuum.async_start
(self)
Start or resume the cleaning task.
Start or resume the cleaning task.
async def async_start(self): """Start or resume the cleaning task.""" await self._start_script.async_run(context=self._context)
[ "async", "def", "async_start", "(", "self", ")", ":", "await", "self", ".", "_start_script", ".", "async_run", "(", "context", "=", "self", ".", "_context", ")" ]
[ 281, 4 ]
[ 283, 65 ]
python
en
['en', 'en', 'en']
True
TemplateVacuum.async_pause
(self)
Pause the cleaning task.
Pause the cleaning task.
async def async_pause(self): """Pause the cleaning task.""" if self._pause_script is None: return await self._pause_script.async_run(context=self._context)
[ "async", "def", "async_pause", "(", "self", ")", ":", "if", "self", ".", "_pause_script", "is", "None", ":", "return", "await", "self", ".", "_pause_script", ".", "async_run", "(", "context", "=", "self", ".", "_context", ")" ]
[ 285, 4 ]
[ 290, 65 ]
python
en
['en', 'en', 'en']
True
TemplateVacuum.async_stop
(self, **kwargs)
Stop the cleaning task.
Stop the cleaning task.
async def async_stop(self, **kwargs): """Stop the cleaning task.""" if self._stop_script is None: return await self._stop_script.async_run(context=self._context)
[ "async", "def", "async_stop", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_stop_script", "is", "None", ":", "return", "await", "self", ".", "_stop_script", ".", "async_run", "(", "context", "=", "self", ".", "_context", ")" ]
[ 292, 4 ]
[ 297, 64 ]
python
en
['en', 'en', 'en']
True
TemplateVacuum.async_return_to_base
(self, **kwargs)
Set the vacuum cleaner to return to the dock.
Set the vacuum cleaner to return to the dock.
async def async_return_to_base(self, **kwargs): """Set the vacuum cleaner to return to the dock.""" if self._return_to_base_script is None: return await self._return_to_base_script.async_run(context=self._context)
[ "async", "def", "async_return_to_base", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_return_to_base_script", "is", "None", ":", "return", "await", "self", ".", "_return_to_base_script", ".", "async_run", "(", "context", "=", "self", "...
[ 299, 4 ]
[ 304, 74 ]
python
en
['en', 'en', 'en']
True
TemplateVacuum.async_clean_spot
(self, **kwargs)
Perform a spot clean-up.
Perform a spot clean-up.
async def async_clean_spot(self, **kwargs): """Perform a spot clean-up.""" if self._clean_spot_script is None: return await self._clean_spot_script.async_run(context=self._context)
[ "async", "def", "async_clean_spot", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_clean_spot_script", "is", "None", ":", "return", "await", "self", ".", "_clean_spot_script", ".", "async_run", "(", "context", "=", "self", ".", "_cont...
[ 306, 4 ]
[ 311, 70 ]
python
en
['pt', 'en', 'en']
True
TemplateVacuum.async_locate
(self, **kwargs)
Locate the vacuum cleaner.
Locate the vacuum cleaner.
async def async_locate(self, **kwargs): """Locate the vacuum cleaner.""" if self._locate_script is None: return await self._locate_script.async_run(context=self._context)
[ "async", "def", "async_locate", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_locate_script", "is", "None", ":", "return", "await", "self", ".", "_locate_script", ".", "async_run", "(", "context", "=", "self", ".", "_context", ")" ...
[ 313, 4 ]
[ 318, 66 ]
python
en
['en', 'la', 'en']
True
TemplateVacuum.async_set_fan_speed
(self, fan_speed, **kwargs)
Set fan speed.
Set fan speed.
async def async_set_fan_speed(self, fan_speed, **kwargs): """Set fan speed.""" if self._set_fan_speed_script is None: return if fan_speed in self._fan_speed_list: self._fan_speed = fan_speed await self._set_fan_speed_script.async_run( {ATTR_FA...
[ "async", "def", "async_set_fan_speed", "(", "self", ",", "fan_speed", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_set_fan_speed_script", "is", "None", ":", "return", "if", "fan_speed", "in", "self", ".", "_fan_speed_list", ":", "self", ".", "_f...
[ 320, 4 ]
[ 335, 13 ]
python
fy
['sv', 'fy', 'ur']
False
TemplateVacuum.async_added_to_hass
(self)
Register callbacks.
Register callbacks.
async def async_added_to_hass(self): """Register callbacks.""" if self._template is not None: self.add_template_attribute( "_state", self._template, None, self._update_state ) if self._fan_speed_template is not None: self.add_template_attribut...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "if", "self", ".", "_template", "is", "not", "None", ":", "self", ".", "add_template_attribute", "(", "\"_state\"", ",", "self", ".", "_template", ",", "None", ",", "self", ".", "_update_state", ...
[ 337, 4 ]
[ 359, 43 ]
python
en
['en', 'no', 'en']
False
AlexaCapabilityResource.__init__
(self, labels)
Initialize an Alexa resource.
Initialize an Alexa resource.
def __init__(self, labels): """Initialize an Alexa resource.""" self._resource_labels = [] for label in labels: self._resource_labels.append(label)
[ "def", "__init__", "(", "self", ",", "labels", ")", ":", "self", ".", "_resource_labels", "=", "[", "]", "for", "label", "in", "labels", ":", "self", ".", "_resource_labels", ".", "append", "(", "label", ")" ]
[ 202, 4 ]
[ 206, 47 ]
python
en
['en', 'lb', 'en']
True
AlexaCapabilityResource.serialize_capability_resources
(self)
Return capabilityResources object serialized for an API response.
Return capabilityResources object serialized for an API response.
def serialize_capability_resources(self): """Return capabilityResources object serialized for an API response.""" return self.serialize_labels(self._resource_labels)
[ "def", "serialize_capability_resources", "(", "self", ")", ":", "return", "self", ".", "serialize_labels", "(", "self", ".", "_resource_labels", ")" ]
[ 208, 4 ]
[ 210, 59 ]
python
en
['en', 'en', 'en']
True
AlexaCapabilityResource.serialize_configuration
()
Return ModeResources, PresetResources friendlyNames serialized for an API response.
Return ModeResources, PresetResources friendlyNames serialized for an API response.
def serialize_configuration(): """Return ModeResources, PresetResources friendlyNames serialized for an API response.""" return []
[ "def", "serialize_configuration", "(", ")", ":", "return", "[", "]" ]
[ 213, 4 ]
[ 215, 17 ]
python
en
['en', 'el-Latn', 'en']
True
AlexaCapabilityResource.serialize_labels
(resources)
Return resource label objects for friendlyNames serialized for an API response.
Return resource label objects for friendlyNames serialized for an API response.
def serialize_labels(resources): """Return resource label objects for friendlyNames serialized for an API response.""" labels = [] for label in resources: if label in AlexaGlobalCatalog.__dict__.values(): label = {"@type": "asset", "value": {"assetId": label}} ...
[ "def", "serialize_labels", "(", "resources", ")", ":", "labels", "=", "[", "]", "for", "label", "in", "resources", ":", "if", "label", "in", "AlexaGlobalCatalog", ".", "__dict__", ".", "values", "(", ")", ":", "label", "=", "{", "\"@type\"", ":", "\"asse...
[ 218, 4 ]
[ 229, 40 ]
python
en
['en', 'en', 'en']
True
AlexaModeResource.__init__
(self, labels, ordered=False)
Initialize an Alexa modeResource.
Initialize an Alexa modeResource.
def __init__(self, labels, ordered=False): """Initialize an Alexa modeResource.""" super().__init__(labels) self._supported_modes = [] self._mode_ordered = ordered
[ "def", "__init__", "(", "self", ",", "labels", ",", "ordered", "=", "False", ")", ":", "super", "(", ")", ".", "__init__", "(", "labels", ")", "self", ".", "_supported_modes", "=", "[", "]", "self", ".", "_mode_ordered", "=", "ordered" ]
[ 238, 4 ]
[ 242, 36 ]
python
en
['en', 'lb', 'nl']
False
AlexaModeResource.add_mode
(self, value, labels)
Add mode to the supportedModes object.
Add mode to the supportedModes object.
def add_mode(self, value, labels): """Add mode to the supportedModes object.""" self._supported_modes.append({"value": value, "labels": labels})
[ "def", "add_mode", "(", "self", ",", "value", ",", "labels", ")", ":", "self", ".", "_supported_modes", ".", "append", "(", "{", "\"value\"", ":", "value", ",", "\"labels\"", ":", "labels", "}", ")" ]
[ 244, 4 ]
[ 246, 72 ]
python
en
['en', 'en', 'en']
True
AlexaModeResource.serialize_configuration
(self)
Return configuration for ModeResources friendlyNames serialized for an API response.
Return configuration for ModeResources friendlyNames serialized for an API response.
def serialize_configuration(self): """Return configuration for ModeResources friendlyNames serialized for an API response.""" mode_resources = [] for mode in self._supported_modes: result = { "value": mode["value"], "modeResources": self.serialize_labe...
[ "def", "serialize_configuration", "(", "self", ")", ":", "mode_resources", "=", "[", "]", "for", "mode", "in", "self", ".", "_supported_modes", ":", "result", "=", "{", "\"value\"", ":", "mode", "[", "\"value\"", "]", ",", "\"modeResources\"", ":", "self", ...
[ 248, 4 ]
[ 258, 80 ]
python
en
['en', 'en', 'en']
True
AlexaPresetResource.__init__
(self, labels, min_value, max_value, precision, unit=None)
Initialize an Alexa presetResource.
Initialize an Alexa presetResource.
def __init__(self, labels, min_value, max_value, precision, unit=None): """Initialize an Alexa presetResource.""" super().__init__(labels) self._presets = [] self._minimum_value = min_value self._maximum_value = max_value self._precision = precision self._unit_of_...
[ "def", "__init__", "(", "self", ",", "labels", ",", "min_value", ",", "max_value", ",", "precision", ",", "unit", "=", "None", ")", ":", "super", "(", ")", ".", "__init__", "(", "labels", ")", "self", ".", "_presets", "=", "[", "]", "self", ".", "_...
[ 269, 4 ]
[ 278, 40 ]
python
en
['en', 'eu', 'it']
False
AlexaPresetResource.add_preset
(self, value, labels)
Add preset to configuration presets array.
Add preset to configuration presets array.
def add_preset(self, value, labels): """Add preset to configuration presets array.""" self._presets.append({"value": value, "labels": labels})
[ "def", "add_preset", "(", "self", ",", "value", ",", "labels", ")", ":", "self", ".", "_presets", ".", "append", "(", "{", "\"value\"", ":", "value", ",", "\"labels\"", ":", "labels", "}", ")" ]
[ 280, 4 ]
[ 282, 64 ]
python
en
['en', 'en', 'en']
True
AlexaPresetResource.serialize_configuration
(self)
Return configuration for PresetResources friendlyNames serialized for an API response.
Return configuration for PresetResources friendlyNames serialized for an API response.
def serialize_configuration(self): """Return configuration for PresetResources friendlyNames serialized for an API response.""" configuration = { "supportedRange": { "minimumValue": self._minimum_value, "maximumValue": self._maximum_value, "pre...
[ "def", "serialize_configuration", "(", "self", ")", ":", "configuration", "=", "{", "\"supportedRange\"", ":", "{", "\"minimumValue\"", ":", "self", ".", "_minimum_value", ",", "\"maximumValue\"", ":", "self", ".", "_maximum_value", ",", "\"precision\"", ":", "sel...
[ 284, 4 ]
[ 307, 28 ]
python
en
['en', 'en', 'en']
True
AlexaSemantics.__init__
(self)
Initialize an Alexa modeResource.
Initialize an Alexa modeResource.
def __init__(self): """Initialize an Alexa modeResource.""" self._action_mappings = [] self._state_mappings = []
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_action_mappings", "=", "[", "]", "self", ".", "_state_mappings", "=", "[", "]" ]
[ 351, 4 ]
[ 354, 33 ]
python
en
['en', 'lb', 'nl']
False
AlexaSemantics._add_action_mapping
(self, semantics)
Add action mapping between actions and interface directives.
Add action mapping between actions and interface directives.
def _add_action_mapping(self, semantics): """Add action mapping between actions and interface directives.""" self._action_mappings.append(semantics)
[ "def", "_add_action_mapping", "(", "self", ",", "semantics", ")", ":", "self", ".", "_action_mappings", ".", "append", "(", "semantics", ")" ]
[ 356, 4 ]
[ 358, 47 ]
python
en
['en', 'en', 'en']
True