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
_async_setup_entity
( hass, async_add_entities, config, config_entry=None, discovery_data=None )
Set up the MQTT Cover.
Set up the MQTT Cover.
async def _async_setup_entity( hass, async_add_entities, config, config_entry=None, discovery_data=None ): """Set up the MQTT Cover.""" async_add_entities([MqttCover(hass, config, config_entry, discovery_data)])
[ "async", "def", "_async_setup_entity", "(", "hass", ",", "async_add_entities", ",", "config", ",", "config_entry", "=", "None", ",", "discovery_data", "=", "None", ")", ":", "async_add_entities", "(", "[", "MqttCover", "(", "hass", ",", "config", ",", "config_...
[ 218, 0 ]
[ 222, 79 ]
python
en
['en', 'en', 'en']
True
MqttCover.__init__
(self, hass, config, config_entry, discovery_data)
Initialize the cover.
Initialize the cover.
def __init__(self, hass, config, config_entry, discovery_data): """Initialize the cover.""" self._position = None self._state = None self._optimistic = None self._tilt_value = None self._tilt_optimistic = None MqttEntity.__init__(self, hass, config, config_entry...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config", ",", "config_entry", ",", "discovery_data", ")", ":", "self", ".", "_position", "=", "None", "self", ".", "_state", "=", "None", "self", ".", "_optimistic", "=", "None", "self", ".", "_tilt_valu...
[ 230, 4 ]
[ 239, 77 ]
python
en
['en', 'en', 'en']
True
MqttCover.config_schema
()
Return the config schema.
Return the config schema.
def config_schema(): """Return the config schema.""" return PLATFORM_SCHEMA
[ "def", "config_schema", "(", ")", ":", "return", "PLATFORM_SCHEMA" ]
[ 242, 4 ]
[ 244, 30 ]
python
en
['en', 'de', 'en']
True
MqttCover._subscribe_topics
(self)
(Re)Subscribe to topics.
(Re)Subscribe to topics.
async def _subscribe_topics(self): # noqa: C901 """(Re)Subscribe to topics.""" topics = {} @callback @log_messages(self.hass, self.entity_id) def tilt_message_received(msg): """Handle tilt updates.""" payload = msg.payload template = self._co...
[ "async", "def", "_subscribe_topics", "(", "self", ")", ":", "# noqa: C901", "topics", "=", "{", "}", "@", "callback", "@", "log_messages", "(", "self", ".", "hass", ",", "self", ".", "entity_id", ")", "def", "tilt_message_received", "(", "msg", ")", ":", ...
[ 307, 4 ]
[ 464, 9 ]
python
en
['en', 'en', 'en']
True
MqttCover.assumed_state
(self)
Return true if we do optimistic updates.
Return true if we do optimistic updates.
def assumed_state(self): """Return true if we do optimistic updates.""" return self._optimistic
[ "def", "assumed_state", "(", "self", ")", ":", "return", "self", ".", "_optimistic" ]
[ 467, 4 ]
[ 469, 31 ]
python
en
['pt', 'la', 'en']
False
MqttCover.is_closed
(self)
Return true if the cover is closed or None if the status is unknown.
Return true if the cover is closed or None if the status is unknown.
def is_closed(self): """Return true if the cover is closed or None if the status is unknown.""" if self._state is None: return None return self._state == STATE_CLOSED
[ "def", "is_closed", "(", "self", ")", ":", "if", "self", ".", "_state", "is", "None", ":", "return", "None", "return", "self", ".", "_state", "==", "STATE_CLOSED" ]
[ 472, 4 ]
[ 477, 42 ]
python
en
['en', 'en', 'en']
True
MqttCover.is_opening
(self)
Return true if the cover is actively opening.
Return true if the cover is actively opening.
def is_opening(self): """Return true if the cover is actively opening.""" return self._state == STATE_OPENING
[ "def", "is_opening", "(", "self", ")", ":", "return", "self", ".", "_state", "==", "STATE_OPENING" ]
[ 480, 4 ]
[ 482, 43 ]
python
en
['en', 'en', 'en']
True
MqttCover.is_closing
(self)
Return true if the cover is actively closing.
Return true if the cover is actively closing.
def is_closing(self): """Return true if the cover is actively closing.""" return self._state == STATE_CLOSING
[ "def", "is_closing", "(", "self", ")", ":", "return", "self", ".", "_state", "==", "STATE_CLOSING" ]
[ 485, 4 ]
[ 487, 43 ]
python
en
['en', 'en', 'en']
True
MqttCover.current_cover_position
(self)
Return current position of cover. None is unknown, 0 is closed, 100 is fully open.
Return current position of cover.
def current_cover_position(self): """Return current position of cover. None is unknown, 0 is closed, 100 is fully open. """ return self._position
[ "def", "current_cover_position", "(", "self", ")", ":", "return", "self", ".", "_position" ]
[ 490, 4 ]
[ 495, 29 ]
python
en
['en', 'en', 'en']
True
MqttCover.current_cover_tilt_position
(self)
Return current position of cover tilt.
Return current position of cover tilt.
def current_cover_tilt_position(self): """Return current position of cover tilt.""" return self._tilt_value
[ "def", "current_cover_tilt_position", "(", "self", ")", ":", "return", "self", ".", "_tilt_value" ]
[ 498, 4 ]
[ 500, 31 ]
python
en
['en', 'da', 'en']
True
MqttCover.device_class
(self)
Return the class of this sensor.
Return the class of this sensor.
def device_class(self): """Return the class of this sensor.""" return self._config.get(CONF_DEVICE_CLASS)
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_config", ".", "get", "(", "CONF_DEVICE_CLASS", ")" ]
[ 503, 4 ]
[ 505, 50 ]
python
en
['en', 'en', 'en']
True
MqttCover.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" supported_features = 0 if self._config.get(CONF_COMMAND_TOPIC) is not None: if self._config.get(CONF_PAYLOAD_OPEN) is not None: supported_features |= SUPPORT_OPEN if self._config.get(CONF_PAYLOAD...
[ "def", "supported_features", "(", "self", ")", ":", "supported_features", "=", "0", "if", "self", ".", "_config", ".", "get", "(", "CONF_COMMAND_TOPIC", ")", "is", "not", "None", ":", "if", "self", ".", "_config", ".", "get", "(", "CONF_PAYLOAD_OPEN", ")",...
[ 508, 4 ]
[ 525, 33 ]
python
en
['da', 'en', 'en']
True
MqttCover.async_open_cover
(self, **kwargs)
Move the cover up. This method is a coroutine.
Move the cover up.
async def async_open_cover(self, **kwargs): """Move the cover up. This method is a coroutine. """ mqtt.async_publish( self.hass, self._config.get(CONF_COMMAND_TOPIC), self._config[CONF_PAYLOAD_OPEN], self._config[CONF_QOS], sel...
[ "async", "def", "async_open_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "mqtt", ".", "async_publish", "(", "self", ".", "hass", ",", "self", ".", "_config", ".", "get", "(", "CONF_COMMAND_TOPIC", ")", ",", "self", ".", "_config", "[", "CONF...
[ 527, 4 ]
[ 546, 39 ]
python
en
['en', 'en', 'en']
True
MqttCover.async_close_cover
(self, **kwargs)
Move the cover down. This method is a coroutine.
Move the cover down.
async def async_close_cover(self, **kwargs): """Move the cover down. This method is a coroutine. """ mqtt.async_publish( self.hass, self._config.get(CONF_COMMAND_TOPIC), self._config[CONF_PAYLOAD_CLOSE], self._config[CONF_QOS], ...
[ "async", "def", "async_close_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "mqtt", ".", "async_publish", "(", "self", ".", "hass", ",", "self", ".", "_config", ".", "get", "(", "CONF_COMMAND_TOPIC", ")", ",", "self", ".", "_config", "[", "CON...
[ 548, 4 ]
[ 567, 39 ]
python
en
['en', 'en', 'en']
True
MqttCover.async_stop_cover
(self, **kwargs)
Stop the device. This method is a coroutine.
Stop the device.
async def async_stop_cover(self, **kwargs): """Stop the device. This method is a coroutine. """ mqtt.async_publish( self.hass, self._config.get(CONF_COMMAND_TOPIC), self._config[CONF_PAYLOAD_STOP], self._config[CONF_QOS], self....
[ "async", "def", "async_stop_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "mqtt", ".", "async_publish", "(", "self", ".", "hass", ",", "self", ".", "_config", ".", "get", "(", "CONF_COMMAND_TOPIC", ")", ",", "self", ".", "_config", "[", "CONF...
[ 569, 4 ]
[ 580, 9 ]
python
en
['en', 'en', 'en']
True
MqttCover.async_open_cover_tilt
(self, **kwargs)
Tilt the cover open.
Tilt the cover open.
async def async_open_cover_tilt(self, **kwargs): """Tilt the cover open.""" mqtt.async_publish( self.hass, self._config.get(CONF_TILT_COMMAND_TOPIC), self._config[CONF_TILT_OPEN_POSITION], self._config[CONF_QOS], self._config[CONF_RETAIN], ...
[ "async", "def", "async_open_cover_tilt", "(", "self", ",", "*", "*", "kwargs", ")", ":", "mqtt", ".", "async_publish", "(", "self", ".", "hass", ",", "self", ".", "_config", ".", "get", "(", "CONF_TILT_COMMAND_TOPIC", ")", ",", "self", ".", "_config", "[...
[ 582, 4 ]
[ 595, 39 ]
python
en
['en', 'no', 'en']
True
MqttCover.async_close_cover_tilt
(self, **kwargs)
Tilt the cover closed.
Tilt the cover closed.
async def async_close_cover_tilt(self, **kwargs): """Tilt the cover closed.""" mqtt.async_publish( self.hass, self._config.get(CONF_TILT_COMMAND_TOPIC), self._config[CONF_TILT_CLOSED_POSITION], self._config[CONF_QOS], self._config[CONF_RETAIN],...
[ "async", "def", "async_close_cover_tilt", "(", "self", ",", "*", "*", "kwargs", ")", ":", "mqtt", ".", "async_publish", "(", "self", ".", "hass", ",", "self", ".", "_config", ".", "get", "(", "CONF_TILT_COMMAND_TOPIC", ")", ",", "self", ".", "_config", "...
[ 597, 4 ]
[ 610, 39 ]
python
en
['en', 'en', 'en']
True
MqttCover.async_set_cover_tilt_position
(self, **kwargs)
Move the cover tilt to a specific position.
Move the cover tilt to a specific position.
async def async_set_cover_tilt_position(self, **kwargs): """Move the cover tilt to a specific position.""" template = self._config.get(CONF_TILT_COMMAND_TEMPLATE) tilt = kwargs[ATTR_TILT_POSITION] percentage_tilt = tilt tilt = self.find_in_range_from_percent(tilt) # Hando...
[ "async", "def", "async_set_cover_tilt_position", "(", "self", ",", "*", "*", "kwargs", ")", ":", "template", "=", "self", ".", "_config", ".", "get", "(", "CONF_TILT_COMMAND_TEMPLATE", ")", "tilt", "=", "kwargs", "[", "ATTR_TILT_POSITION", "]", "percentage_tilt"...
[ 612, 4 ]
[ 640, 39 ]
python
en
['en', 'en', 'en']
True
MqttCover.async_set_cover_position
(self, **kwargs)
Move the cover to a specific position.
Move the cover to a specific position.
async def async_set_cover_position(self, **kwargs): """Move the cover to a specific position.""" template = self._config.get(CONF_SET_POSITION_TEMPLATE) position = kwargs[ATTR_POSITION] percentage_position = position position = self.find_in_range_from_percent(position, COVER_PAYL...
[ "async", "def", "async_set_cover_position", "(", "self", ",", "*", "*", "kwargs", ")", ":", "template", "=", "self", ".", "_config", ".", "get", "(", "CONF_SET_POSITION_TEMPLATE", ")", "position", "=", "kwargs", "[", "ATTR_POSITION", "]", "percentage_position", ...
[ 642, 4 ]
[ 673, 39 ]
python
en
['en', 'en', 'en']
True
MqttCover.async_toggle_tilt
(self, **kwargs)
Toggle the entity.
Toggle the entity.
async def async_toggle_tilt(self, **kwargs): """Toggle the entity.""" if self.is_tilt_closed(): await self.async_open_cover_tilt(**kwargs) else: await self.async_close_cover_tilt(**kwargs)
[ "async", "def", "async_toggle_tilt", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "is_tilt_closed", "(", ")", ":", "await", "self", ".", "async_open_cover_tilt", "(", "*", "*", "kwargs", ")", "else", ":", "await", "self", ".", "as...
[ 675, 4 ]
[ 680, 55 ]
python
en
['en', 'sm', 'en']
True
MqttCover.is_tilt_closed
(self)
Return if the cover is tilted closed.
Return if the cover is tilted closed.
def is_tilt_closed(self): """Return if the cover is tilted closed.""" return self._tilt_value == self.find_percentage_in_range( float(self._config[CONF_TILT_CLOSED_POSITION]) )
[ "def", "is_tilt_closed", "(", "self", ")", ":", "return", "self", ".", "_tilt_value", "==", "self", ".", "find_percentage_in_range", "(", "float", "(", "self", ".", "_config", "[", "CONF_TILT_CLOSED_POSITION", "]", ")", ")" ]
[ 682, 4 ]
[ 686, 9 ]
python
en
['en', 'en', 'en']
True
MqttCover.find_percentage_in_range
(self, position, range_type=TILT_PAYLOAD)
Find the 0-100% value within the specified range.
Find the 0-100% value within the specified range.
def find_percentage_in_range(self, position, range_type=TILT_PAYLOAD): """Find the 0-100% value within the specified range.""" # the range of motion as defined by the min max values if range_type == COVER_PAYLOAD: max_range = self._config[CONF_POSITION_OPEN] min_range = s...
[ "def", "find_percentage_in_range", "(", "self", ",", "position", ",", "range_type", "=", "TILT_PAYLOAD", ")", ":", "# the range of motion as defined by the min max values", "if", "range_type", "==", "COVER_PAYLOAD", ":", "max_range", "=", "self", ".", "_config", "[", ...
[ 688, 4 ]
[ 706, 34 ]
python
en
['en', 'en', 'en']
True
MqttCover.find_in_range_from_percent
(self, percentage, range_type=TILT_PAYLOAD)
Find the adjusted value for 0-100% within the specified range. if the range is 80-180 and the percentage is 90 this method would determine the value to send on the topic by offsetting the max and min, getting the percentage value and returning the offset
Find the adjusted value for 0-100% within the specified range.
def find_in_range_from_percent(self, percentage, range_type=TILT_PAYLOAD): """ Find the adjusted value for 0-100% within the specified range. if the range is 80-180 and the percentage is 90 this method would determine the value to send on the topic by offsetting the max and min,...
[ "def", "find_in_range_from_percent", "(", "self", ",", "percentage", ",", "range_type", "=", "TILT_PAYLOAD", ")", ":", "if", "range_type", "==", "COVER_PAYLOAD", ":", "max_range", "=", "self", ".", "_config", "[", "CONF_POSITION_OPEN", "]", "min_range", "=", "se...
[ 708, 4 ]
[ 728, 23 ]
python
en
['en', 'error', 'th']
False
MqttCover.tilt_payload_received
(self, _payload)
Set the tilt value.
Set the tilt value.
def tilt_payload_received(self, _payload): """Set the tilt value.""" try: payload = int(round(float(_payload))) except ValueError: _LOGGER.warning("Payload '%s' is not numeric", _payload) return if ( self._config[CONF_TILT_MIN] <= int(pay...
[ "def", "tilt_payload_received", "(", "self", ",", "_payload", ")", ":", "try", ":", "payload", "=", "int", "(", "round", "(", "float", "(", "_payload", ")", ")", ")", "except", "ValueError", ":", "_LOGGER", ".", "warning", "(", "\"Payload '%s' is not numeric...
[ 730, 4 ]
[ 754, 13 ]
python
en
['en', 'no', 'en']
True
p10b64encode
(num, length=2)
Encodes a given numeric using P10 Base64 numeric nicks, as documented at https://github.com/evilnet/nefarious2/blob/a29b63144/doc/p10.txt#L69-L92
Encodes a given numeric using P10 Base64 numeric nicks, as documented at https://github.com/evilnet/nefarious2/blob/a29b63144/doc/p10.txt#L69-L92
def p10b64encode(num, length=2): """ Encodes a given numeric using P10 Base64 numeric nicks, as documented at https://github.com/evilnet/nefarious2/blob/a29b63144/doc/p10.txt#L69-L92 """ # Pack the given number as an unsigned int. sidbytes = struct.pack('>I', num)[1:] sid = base64.b64encode(...
[ "def", "p10b64encode", "(", "num", ",", "length", "=", "2", ")", ":", "# Pack the given number as an unsigned int.", "sidbytes", "=", "struct", ".", "pack", "(", "'>I'", ",", "num", ")", "[", "1", ":", "]", "sid", "=", "base64", ".", "b64encode", "(", "s...
[ 26, 0 ]
[ 34, 23 ]
python
en
['en', 'error', 'th']
False
P10SIDGenerator.next_sid
(self)
Returns the next available SID.
Returns the next available SID.
def next_sid(self): """ Returns the next available SID. """ if self.currentnum > self.maxnum: raise ProtocolError("Ran out of valid SIDs! Check your 'sidrange' setting and try again.") sid = p10b64encode(self.currentnum) self.currentnum += 1 return si...
[ "def", "next_sid", "(", "self", ")", ":", "if", "self", ".", "currentnum", ">", "self", ".", "maxnum", ":", "raise", "ProtocolError", "(", "\"Ran out of valid SIDs! Check your 'sidrange' setting and try again.\"", ")", "sid", "=", "p10b64encode", "(", "self", ".", ...
[ 55, 4 ]
[ 64, 18 ]
python
en
['en', 'error', 'th']
False
P10Protocol.access_sort
(key)
Sorts (prefixmode, UID) keys based on the prefix modes given.
Sorts (prefixmode, UID) keys based on the prefix modes given.
def access_sort(key): """ Sorts (prefixmode, UID) keys based on the prefix modes given. """ prefixes, user = key # Add the prefixes given for each userpair, giving each one a set value. This ensures # that 'ohv' > 'oh' > 'ov' > 'o' > 'hv' > 'h' > 'v' > '' accesses...
[ "def", "access_sort", "(", "key", ")", ":", "prefixes", ",", "user", "=", "key", "# Add the prefixes given for each userpair, giving each one a set value. This ensures", "# that 'ohv' > 'oh' > 'ov' > 'o' > 'hv' > 'h' > 'v' > ''", "accesses", "=", "{", "'o'", ":", "100", ",", ...
[ 182, 4 ]
[ 195, 18 ]
python
en
['en', 'error', 'th']
False
P10Protocol.decode_p10_ip
(ip)
Decodes a P10 IP.
Decodes a P10 IP.
def decode_p10_ip(ip): """Decodes a P10 IP.""" # Many thanks to Jobe @ evilnet for the code on what to do here. :) -GL if len(ip) == 6: # IPv4 # Pad the characters with two \x00's (represented in P10 B64 as AA) ip = 'AA' + ip # Decode it via Base64, droppin...
[ "def", "decode_p10_ip", "(", "ip", ")", ":", "# Many thanks to Jobe @ evilnet for the code on what to do here. :) -GL", "if", "len", "(", "ip", ")", "==", "6", ":", "# IPv4", "# Pad the characters with two \\x00's (represented in P10 B64 as AA)", "ip", "=", "'AA'", "+", "ip...
[ 198, 4 ]
[ 250, 21 ]
python
de
['en', 'de', 'pt']
False
P10Protocol.encode_p10_ipv6
(ip)
Encodes a P10 IPv6 address.
Encodes a P10 IPv6 address.
def encode_p10_ipv6(ip): """Encodes a P10 IPv6 address.""" # This method is documented briefly at https://github.com/evilnet/nefarious2/blob/47c8bea/doc/p10.txt#L723 # Basically, each address chunk is encoded into a 3-length word, with :: replaced by _ # e.g. '1:2::3' -> AABAAC_AAD ...
[ "def", "encode_p10_ipv6", "(", "ip", ")", ":", "# This method is documented briefly at https://github.com/evilnet/nefarious2/blob/47c8bea/doc/p10.txt#L723", "# Basically, each address chunk is encoded into a 3-length word, with :: replaced by _", "# e.g. '1:2::3' -> AABAAC_AAD", "# '::1' -> A...
[ 253, 4 ]
[ 272, 25 ]
python
en
['en', 'hmn', 'en']
True
P10Protocol.spawn_client
(self, nick, ident='null', host='null', realhost=None, modes=set(), server=None, ip='0.0.0.0', realname=None, ts=None, opertype='IRC Operator', manipulatable=False)
Spawns a new client with the given options. Note: No nick collision / valid nickname checks are done here; it is up to plugins to make sure they don't introduce anything invalid.
Spawns a new client with the given options.
def spawn_client(self, nick, ident='null', host='null', realhost=None, modes=set(), server=None, ip='0.0.0.0', realname=None, ts=None, opertype='IRC Operator', manipulatable=False): """ Spawns a new client with the given options. Note: No nick collision / valid nickname ...
[ "def", "spawn_client", "(", "self", ",", "nick", ",", "ident", "=", "'null'", ",", "host", "=", "'null'", ",", "realhost", "=", "None", ",", "modes", "=", "set", "(", ")", ",", "server", "=", "None", ",", "ip", "=", "'0.0.0.0'", ",", "realname", "=...
[ 276, 4 ]
[ 334, 16 ]
python
en
['en', 'error', 'th']
False
P10Protocol.away
(self, source, text)
Sends an AWAY message from a PyLink client. <text> can be an empty string to unset AWAY status.
Sends an AWAY message from a PyLink client. <text> can be an empty string to unset AWAY status.
def away(self, source, text): """Sends an AWAY message from a PyLink client. <text> can be an empty string to unset AWAY status.""" if not self.is_internal_client(source): raise LookupError('No such PyLink client exists.') if text: self._send_with_prefix(source, ...
[ "def", "away", "(", "self", ",", "source", ",", "text", ")", ":", "if", "not", "self", ".", "is_internal_client", "(", "source", ")", ":", "raise", "LookupError", "(", "'No such PyLink client exists.'", ")", "if", "text", ":", "self", ".", "_send_with_prefix...
[ 336, 4 ]
[ 346, 38 ]
python
en
['en', 'en', 'en']
True
P10Protocol.invite
(self, numeric, target, channel)
Sends INVITEs from a PyLink client.
Sends INVITEs from a PyLink client.
def invite(self, numeric, target, channel): """Sends INVITEs from a PyLink client.""" # Note: we have to send a nick as the target, not a UID. # <- ABAAA I PyLink-devel #services 1460948992 if not self.is_internal_client(numeric): raise LookupError('No such PyLink client exi...
[ "def", "invite", "(", "self", ",", "numeric", ",", "target", ",", "channel", ")", ":", "# Note: we have to send a nick as the target, not a UID.", "# <- ABAAA I PyLink-devel #services 1460948992", "if", "not", "self", ".", "is_internal_client", "(", "numeric", ")", ":", ...
[ 348, 4 ]
[ 358, 99 ]
python
en
['en', 'en', 'en']
True
P10Protocol.join
(self, client, channel)
Joins a PyLink client to a channel.
Joins a PyLink client to a channel.
def join(self, client, channel): """Joins a PyLink client to a channel.""" # <- ABAAB J #test3 1460744371 ts = self._channels[channel].ts if not self.is_internal_client(client): raise LookupError('No such PyLink client exists.') if not self._channels[channel].users:...
[ "def", "join", "(", "self", ",", "client", ",", "channel", ")", ":", "# <- ABAAB J #test3 1460744371", "ts", "=", "self", ".", "_channels", "[", "channel", "]", ".", "ts", "if", "not", "self", ".", "is_internal_client", "(", "client", ")", ":", "raise", ...
[ 360, 4 ]
[ 375, 48 ]
python
en
['en', 'en', 'en']
True
P10Protocol.kick
(self, numeric, channel, target, reason=None)
Sends kicks from a PyLink client/server.
Sends kicks from a PyLink client/server.
def kick(self, numeric, channel, target, reason=None): """Sends kicks from a PyLink client/server.""" if (not self.is_internal_client(numeric)) and \ (not self.is_internal_server(numeric)): raise LookupError('No such PyLink client/server exists.') if not reason: ...
[ "def", "kick", "(", "self", ",", "numeric", ",", "channel", ",", "target", ",", "reason", "=", "None", ")", ":", "if", "(", "not", "self", ".", "is_internal_client", "(", "numeric", ")", ")", "and", "(", "not", "self", ".", "is_internal_server", "(", ...
[ 377, 4 ]
[ 404, 74 ]
python
en
['en', 'lb', 'en']
True
P10Protocol.kill
(self, numeric, target, reason)
Sends a kill from a PyLink client/server.
Sends a kill from a PyLink client/server.
def kill(self, numeric, target, reason): """Sends a kill from a PyLink client/server.""" # <- ABAAA D AyAAA :nefarious.midnight.vpn!GL (test) if (not self.is_internal_client(numeric)) and \ (not self.is_internal_server(numeric)): raise LookupError('No such PyLink cli...
[ "def", "kill", "(", "self", ",", "numeric", ",", "target", ",", "reason", ")", ":", "# <- ABAAA D AyAAA :nefarious.midnight.vpn!GL (test)", "if", "(", "not", "self", ".", "is_internal_client", "(", "numeric", ")", ")", "and", "(", "not", "self", ".", "is_inter...
[ 406, 4 ]
[ 415, 35 ]
python
en
['en', 'en', 'en']
True
P10Protocol.knock
(self, source, target, text)
KNOCK wrapper for P10: notifies chanops that someone wants to join the channel.
KNOCK wrapper for P10: notifies chanops that someone wants to join the channel.
def knock(self, source, target, text): """KNOCK wrapper for P10: notifies chanops that someone wants to join the channel.""" prefix = '%' if 'h' in self.prefixmodes else '@' self.notice(self.pseudoclient.uid, prefix + target, "Knock from %s: %s" % (self.get_friendly_n...
[ "def", "knock", "(", "self", ",", "source", ",", "target", ",", "text", ")", ":", "prefix", "=", "'%'", "if", "'h'", "in", "self", ".", "prefixmodes", "else", "'@'", "self", ".", "notice", "(", "self", ".", "pseudoclient", ".", "uid", ",", "prefix", ...
[ 417, 4 ]
[ 422, 81 ]
python
en
['en', 'en', 'en']
True
P10Protocol.message
(self, source, target, text, _notice=False)
Sends a PRIVMSG from a PyLink client or server.
Sends a PRIVMSG from a PyLink client or server.
def message(self, source, target, text, _notice=False): """Sends a PRIVMSG from a PyLink client or server.""" if (not self.is_internal_client(source)) and \ (not self.is_internal_server(source)): raise LookupError('No such PyLink client/server exists.') token = 'O' i...
[ "def", "message", "(", "self", ",", "source", ",", "target", ",", "text", ",", "_notice", "=", "False", ")", ":", "if", "(", "not", "self", ".", "is_internal_client", "(", "source", ")", ")", "and", "(", "not", "self", ".", "is_internal_server", "(", ...
[ 424, 4 ]
[ 457, 75 ]
python
en
['en', 'en', 'en']
True
P10Protocol.notice
(self, source, target, text)
Sends a NOTICE from a PyLink client or server.
Sends a NOTICE from a PyLink client or server.
def notice(self, source, target, text): """Sends a NOTICE from a PyLink client or server.""" self.message(source, target, text, _notice=True)
[ "def", "notice", "(", "self", ",", "source", ",", "target", ",", "text", ")", ":", "self", ".", "message", "(", "source", ",", "target", ",", "text", ",", "_notice", "=", "True", ")" ]
[ 459, 4 ]
[ 461, 56 ]
python
en
['en', 'en', 'en']
True
P10Protocol.mode
(self, numeric, target, modes, ts=None)
Sends mode changes from a PyLink client/server.
Sends mode changes from a PyLink client/server.
def mode(self, numeric, target, modes, ts=None): """Sends mode changes from a PyLink client/server.""" # <- ABAAA M GL -w # <- ABAAA M #test +v ABAAB 1460747615 if (not self.is_internal_client(numeric)) and \ (not self.is_internal_server(numeric)): raise Look...
[ "def", "mode", "(", "self", ",", "numeric", ",", "target", ",", "modes", ",", "ts", "=", "None", ")", ":", "# <- ABAAA M GL -w", "# <- ABAAA M #test +v ABAAB 1460747615", "if", "(", "not", "self", ".", "is_internal_client", "(", "numeric", ")", ")", "and", "...
[ 463, 4 ]
[ 508, 30 ]
python
en
['en', 'en', 'en']
True
P10Protocol.nick
(self, numeric, newnick)
Changes the nick of a PyLink client.
Changes the nick of a PyLink client.
def nick(self, numeric, newnick): """Changes the nick of a PyLink client.""" # <- ABAAA N GL_ 1460753763 if not self.is_internal_client(numeric): raise LookupError('No such PyLink client exists.') self._send_with_prefix(numeric, 'N %s %s' % (newnick, int(time.time()))) ...
[ "def", "nick", "(", "self", ",", "numeric", ",", "newnick", ")", ":", "# <- ABAAA N GL_ 1460753763", "if", "not", "self", ".", "is_internal_client", "(", "numeric", ")", ":", "raise", "LookupError", "(", "'No such PyLink client exists.'", ")", "self", ".", "_sen...
[ 510, 4 ]
[ 520, 49 ]
python
en
['en', 'en', 'en']
True
P10Protocol.numeric
(self, source, numeric, target, text)
Sends raw numerics from a server to a remote client. This is used for WHOIS replies.
Sends raw numerics from a server to a remote client. This is used for WHOIS replies.
def numeric(self, source, numeric, target, text): """Sends raw numerics from a server to a remote client. This is used for WHOIS replies.""" # <- AB 311 AyAAA GL ~gl nefarious.midnight.vpn * :realname self._send_with_prefix(source, '%s %s %s' % (numeric, target, text))
[ "def", "numeric", "(", "self", ",", "source", ",", "numeric", ",", "target", ",", "text", ")", ":", "# <- AB 311 AyAAA GL ~gl nefarious.midnight.vpn * :realname", "self", ".", "_send_with_prefix", "(", "source", ",", "'%s %s %s'", "%", "(", "numeric", ",", "target...
[ 522, 4 ]
[ 526, 76 ]
python
en
['en', 'en', 'en']
True
P10Protocol.part
(self, client, channel, reason=None)
Sends a part from a PyLink client.
Sends a part from a PyLink client.
def part(self, client, channel, reason=None): """Sends a part from a PyLink client.""" if not self.is_internal_client(client): raise LookupError('No such PyLink client exists.') msg = "L %s" % channel if reason: msg += " :%s" % reason self._send_with_pre...
[ "def", "part", "(", "self", ",", "client", ",", "channel", ",", "reason", "=", "None", ")", ":", "if", "not", "self", ".", "is_internal_client", "(", "client", ")", ":", "raise", "LookupError", "(", "'No such PyLink client exists.'", ")", "msg", "=", "\"L ...
[ 528, 4 ]
[ 538, 51 ]
python
en
['en', 'en', 'en']
True
P10Protocol._ping_uplink
(self)
Sends a PING to the uplink.
Sends a PING to the uplink.
def _ping_uplink(self): """Sends a PING to the uplink.""" if self.sid: self._send_with_prefix(self.sid, 'G %s' % self.sid)
[ "def", "_ping_uplink", "(", "self", ")", ":", "if", "self", ".", "sid", ":", "self", ".", "_send_with_prefix", "(", "self", ".", "sid", ",", "'G %s'", "%", "self", ".", "sid", ")" ]
[ 540, 4 ]
[ 543, 63 ]
python
en
['en', 'en', 'en']
True
P10Protocol.quit
(self, numeric, reason)
Quits a PyLink client.
Quits a PyLink client.
def quit(self, numeric, reason): """Quits a PyLink client.""" if self.is_internal_client(numeric): self._send_with_prefix(numeric, "Q :%s" % reason) self._remove_client(numeric) else: raise LookupError("No such PyLink client exists.")
[ "def", "quit", "(", "self", ",", "numeric", ",", "reason", ")", ":", "if", "self", ".", "is_internal_client", "(", "numeric", ")", ":", "self", ".", "_send_with_prefix", "(", "numeric", ",", "\"Q :%s\"", "%", "reason", ")", "self", ".", "_remove_client", ...
[ 545, 4 ]
[ 551, 62 ]
python
en
['en', 'fr', 'en']
True
P10Protocol.set_server_ban
(self, source, duration, user='*', host='*', reason='User banned')
Sets a server ban.
Sets a server ban.
def set_server_ban(self, source, duration, user='*', host='*', reason='User banned'): """ Sets a server ban. """ assert not (user == host == '*'), "Refusing to set ridiculous ban on *@*" # https://github.com/evilnet/nefarious2/blob/master/doc/p10.txt#L535 # <- ABAAA GL *...
[ "def", "set_server_ban", "(", "self", ",", "source", ",", "duration", ",", "user", "=", "'*'", ",", "host", "=", "'*'", ",", "reason", "=", "'User banned'", ")", ":", "assert", "not", "(", "user", "==", "host", "==", "'*'", ")", ",", "\"Refusing to set...
[ 553, 4 ]
[ 569, 128 ]
python
en
['en', 'error', 'th']
False
P10Protocol.sjoin
(self, server, channel, users, ts=None, modes=set())
Sends an SJOIN for a group of users to a channel. The sender should always be a Server ID (SID). TS is optional, and defaults to the one we've stored in the channel state if not given. <users> is a list of (prefix mode, UID) pairs: Example uses: sjoin('100', '#test', [('', ...
Sends an SJOIN for a group of users to a channel.
def sjoin(self, server, channel, users, ts=None, modes=set()): """Sends an SJOIN for a group of users to a channel. The sender should always be a Server ID (SID). TS is optional, and defaults to the one we've stored in the channel state if not given. <users> is a list of (prefix mode, U...
[ "def", "sjoin", "(", "self", ",", "server", ",", "channel", ",", "users", ",", "ts", "=", "None", ",", "modes", "=", "set", "(", ")", ")", ":", "# <- AB B #test 1460742014 +tnl 10 ABAAB,ABAAA:o :%*!*@other.bad.host ~ *!*@bad.host", "server", "=", "server", "or", ...
[ 571, 4 ]
[ 702, 56 ]
python
en
['en', 'en', 'en']
True
P10Protocol.spawn_server
(self, name, sid=None, uplink=None, desc=None)
Spawns a server off a PyLink server. desc (server description) defaults to the one in the config. uplink defaults to the main PyLink server, and sid (the server ID) is automatically generated if not given.
Spawns a server off a PyLink server. desc (server description) defaults to the one in the config. uplink defaults to the main PyLink server, and sid (the server ID) is automatically generated if not given.
def spawn_server(self, name, sid=None, uplink=None, desc=None): """ Spawns a server off a PyLink server. desc (server description) defaults to the one in the config. uplink defaults to the main PyLink server, and sid (the server ID) is automatically generated if not given. ...
[ "def", "spawn_server", "(", "self", ",", "name", ",", "sid", "=", "None", ",", "uplink", "=", "None", ",", "desc", "=", "None", ")", ":", "# <- SERVER nefarious.midnight.vpn 1 1460673022 1460673239 J10 ABP]] +h6 :Nefarious2 test server", "uplink", "=", "uplink", "or",...
[ 704, 4 ]
[ 736, 18 ]
python
en
['en', 'error', 'th']
False
P10Protocol.squit
(self, source, target, text='No reason given')
SQUITs a PyLink server.
SQUITs a PyLink server.
def squit(self, source, target, text='No reason given'): """SQUITs a PyLink server.""" # <- ABAAE SQ nefarious.midnight.vpn 0 :test targetname = self.servers[target].name self._send_with_prefix(source, 'SQ %s 0 :%s' % (targetname, text)) self.handle_squit(source, 'SQUIT', [targ...
[ "def", "squit", "(", "self", ",", "source", ",", "target", ",", "text", "=", "'No reason given'", ")", ":", "# <- ABAAE SQ nefarious.midnight.vpn 0 :test", "targetname", "=", "self", ".", "servers", "[", "target", "]", ".", "name", "self", ".", "_send_with_prefi...
[ 738, 4 ]
[ 745, 58 ]
python
en
['en', 'en', 'en']
True
P10Protocol.topic
(self, source, target, text)
Sends a TOPIC change from a PyLink client or server.
Sends a TOPIC change from a PyLink client or server.
def topic(self, source, target, text): """Sends a TOPIC change from a PyLink client or server.""" # <- ABAAA T #test GL!~gl@nefarious.midnight.vpn 1460852591 1460855795 :blah # First timestamp is channel creation time, second is current time, if (not self.is_internal_client(source)) and ...
[ "def", "topic", "(", "self", ",", "source", ",", "target", ",", "text", ")", ":", "# <- ABAAA T #test GL!~gl@nefarious.midnight.vpn 1460852591 1460855795 :blah", "# First timestamp is channel creation time, second is current time,", "if", "(", "not", "self", ".", "is_internal_c...
[ 747, 4 ]
[ 765, 46 ]
python
en
['en', 'en', 'en']
True
P10Protocol.update_client
(self, target, field, text)
Updates the ident or host of any connected client.
Updates the ident or host of any connected client.
def update_client(self, target, field, text): """Updates the ident or host of any connected client.""" uobj = self.users[target] ircd = self.serverdata.get('ircd', self.serverdata.get('p10_ircd', 'nefarious')).lower() if self.is_internal_client(target): # Host changing via ...
[ "def", "update_client", "(", "self", ",", "target", ",", "field", ",", "text", ")", ":", "uobj", "=", "self", ".", "users", "[", "target", "]", "ircd", "=", "self", ".", "serverdata", ".", "get", "(", "'ircd'", ",", "self", ".", "serverdata", ".", ...
[ 768, 4 ]
[ 813, 40 ]
python
en
['en', 'en', 'en']
True
P10Protocol.post_connect
(self)
Initializes a connection to a server.
Initializes a connection to a server.
def post_connect(self): """Initializes a connection to a server.""" ts = self.start_ts self.send("PASS :%s" % self.serverdata["sendpass"]) # {7S} *** SERVER # 1 <name of new server> # 2 <hops> # 3 <boot TS> # 4 <link TS> # 5 <protocol> #...
[ "def", "post_connect", "(", "self", ")", ":", "ts", "=", "self", ".", "start_ts", "self", ".", "send", "(", "\"PASS :%s\"", "%", "self", ".", "serverdata", "[", "\"sendpass\"", "]", ")", "# {7S} *** SERVER", "# 1 <name of new server>", "# 2 <hops>", "# 3 <boot T...
[ 817, 4 ]
[ 900, 41 ]
python
en
['en', 'en', 'en']
True
P10Protocol.handle_server
(self, source, command, args)
Handles incoming server introductions.
Handles incoming server introductions.
def handle_server(self, source, command, args): """Handles incoming server introductions.""" # <- SERVER nefarious.midnight.vpn 1 1460673022 1460673239 J10 ABP]] +h6 :Nefarious2 test server servername = args[0].lower() sid = args[5][:2] sdesc = args[-1] self.servers[sid] ...
[ "def", "handle_server", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "# <- SERVER nefarious.midnight.vpn 1 1460673022 1460673239 J10 ABP]] +h6 :Nefarious2 test server", "servername", "=", "args", "[", "0", "]", ".", "lower", "(", ")", "sid", "=",...
[ 902, 4 ]
[ 915, 62 ]
python
en
['en', 'en', 'en']
True
P10Protocol.handle_nick
(self, source, command, args)
Handles the NICK command, used for user introductions and nick changes.
Handles the NICK command, used for user introductions and nick changes.
def handle_nick(self, source, command, args): """Handles the NICK command, used for user introductions and nick changes.""" if len(args) > 2: # <- AB N GL 1 1460673049 ~gl nefarious.midnight.vpn +iw B]AAAB ABAAA :realname nick = args[0] self._check_nick_collision(nic...
[ "def", "handle_nick", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "if", "len", "(", "args", ")", ">", "2", ":", "# <- AB N GL 1 1460673049 ~gl nefarious.midnight.vpn +iw B]AAAB ABAAA :realname", "nick", "=", "args", "[", "0", "]", "self", ...
[ 917, 4 ]
[ 969, 69 ]
python
en
['en', 'en', 'en']
True
P10Protocol._check_cloak_change
(self, uid)
Checks for cloak changes (ident and host) on the given UID.
Checks for cloak changes (ident and host) on the given UID.
def _check_cloak_change(self, uid): """Checks for cloak changes (ident and host) on the given UID.""" uobj = self.users[uid] ident = uobj.ident modes = dict(uobj.modes) log.debug('(%s) _check_cloak_change: modes of %s are %s', self.name, uid, modes) if 'x' not in modes:...
[ "def", "_check_cloak_change", "(", "self", ",", "uid", ")", ":", "uobj", "=", "self", ".", "users", "[", "uid", "]", "ident", "=", "uobj", ".", "ident", "modes", "=", "dict", "(", "uobj", ".", "modes", ")", "log", ".", "debug", "(", "'(%s) _check_clo...
[ 971, 4 ]
[ 1032, 22 ]
python
en
['en', 'en', 'en']
True
P10Protocol.handle_ping
(self, source, command, args)
Handles incoming PING requests.
Handles incoming PING requests.
def handle_ping(self, source, command, args): """Handles incoming PING requests.""" # Snippet from Jobe @ evilnet, thanks! AFAIK, the P10 docs are out of date and don't # show the right PING/PONG syntax used by nefarious. # <- IA G !1460745823.89510 Channels.CollectiveIRC.Net 1460745823....
[ "def", "handle_ping", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "# Snippet from Jobe @ evilnet, thanks! AFAIK, the P10 docs are out of date and don't", "# show the right PING/PONG syntax used by nefarious.", "# <- IA G !1460745823.89510 Channels.CollectiveIRC.Net...
[ 1034, 4 ]
[ 1054, 120 ]
python
en
['fr', 'en', 'en']
True
P10Protocol.handle_pass
(self, source, command, args)
Handles authentication with our uplink.
Handles authentication with our uplink.
def handle_pass(self, source, command, args): """Handles authentication with our uplink.""" # <- PASS :testpass if args[0] != self.serverdata['recvpass']: raise ProtocolError("RECVPASS from uplink does not match configuration!")
[ "def", "handle_pass", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "# <- PASS :testpass", "if", "args", "[", "0", "]", "!=", "self", ".", "serverdata", "[", "'recvpass'", "]", ":", "raise", "ProtocolError", "(", "\"RECVPASS from uplink ...
[ 1056, 4 ]
[ 1060, 85 ]
python
en
['en', 'en', 'en']
True
P10Protocol.handle_burst
(self, source, command, args)
Handles the BURST command, used for bursting channels on link. This is equivalent to SJOIN on most IRCds.
Handles the BURST command, used for bursting channels on link.
def handle_burst(self, source, command, args): """Handles the BURST command, used for bursting channels on link. This is equivalent to SJOIN on most IRCds.""" # Oh no, we have to figure out which parameter is which... # <- AB B #test 1460742014 ABAAB,ABAAA:o # <- AB B #services ...
[ "def", "handle_burst", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "# Oh no, we have to figure out which parameter is which...", "# <- AB B #test 1460742014 ABAAB,ABAAA:o", "# <- AB B #services 1460742014 ABAAA:o", "# <- AB B #test 1460742014 +tnlk 10 testkey ABA...
[ 1062, 4 ]
[ 1154, 40 ]
python
en
['en', 'en', 'en']
True
P10Protocol.handle_join
(self, source, command, args)
Handles incoming JOINs and channel creations.
Handles incoming JOINs and channel creations.
def handle_join(self, source, command, args): """Handles incoming JOINs and channel creations.""" # <- ABAAA C #test3 1460744371 # <- ABAAB J #test3 1460744371 # <- ABAAB J #test3 try: # TS is optional ts = int(args[1]) except IndexError: ...
[ "def", "handle_join", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "# <- ABAAA C #test3 1460744371", "# <- ABAAB J #test3 1460744371", "# <- ABAAB J #test3", "try", ":", "# TS is optional", "ts", "=", "int", "(", "args", "[", "1", "]", ")", ...
[ 1156, 4 ]
[ 1187, 76 ]
python
en
['en', 'en', 'en']
True
P10Protocol.handle_end_of_burst
(self, source, command, args)
Handles end of burst from servers.
Handles end of burst from servers.
def handle_end_of_burst(self, source, command, args): """Handles end of burst from servers.""" # Send EOB acknowledgement; this is required by the P10 specification, # and needed if we want to be able to receive channel messages, etc. if source == self.uplink: self._send_wit...
[ "def", "handle_end_of_burst", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "# Send EOB acknowledgement; this is required by the P10 specification,", "# and needed if we want to be able to receive channel messages, etc.", "if", "source", "==", "self", ".", ...
[ 1190, 4 ]
[ 1200, 17 ]
python
en
['en', 'en', 'en']
True
P10Protocol.handle_kick
(self, source, command, args)
Handles incoming KICKs.
Handles incoming KICKs.
def handle_kick(self, source, command, args): """Handles incoming KICKs.""" # <- ABAAA K #TEST AyAAA :PyLink-devel channel = args[0] kicked = args[1] self.handle_part(kicked, 'KICK', [channel, args[2]]) # Send PART in response to acknowledge the KICK, per # http...
[ "def", "handle_kick", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "# <- ABAAA K #TEST AyAAA :PyLink-devel", "channel", "=", "args", "[", "0", "]", "kicked", "=", "args", "[", "1", "]", "self", ".", "handle_part", "(", "kicked", ",", ...
[ 1202, 4 ]
[ 1214, 70 ]
python
ceb
['fr', 'ceb', 'en']
False
P10Protocol.handle_topic
(self, source, command, args)
Handles TOPIC changes.
Handles TOPIC changes.
def handle_topic(self, source, command, args): """Handles TOPIC changes.""" # <- ABAAA T #test GL!~gl@nefarious.midnight.vpn 1460852591 1460855795 :blah channel = args[0] topic = args[-1] oldtopic = self._channels[channel].topic self._channels[channel].topic = topic ...
[ "def", "handle_topic", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "# <- ABAAA T #test GL!~gl@nefarious.midnight.vpn 1460852591 1460855795 :blah", "channel", "=", "args", "[", "0", "]", "topic", "=", "args", "[", "-", "1", "]", "oldtopic", ...
[ 1216, 4 ]
[ 1227, 37 ]
python
en
['fr', 'en', 'en']
True
P10Protocol.handle_clearmode
(self, numeric, command, args)
Handles CLEARMODE, which is used to clear a channel's modes.
Handles CLEARMODE, which is used to clear a channel's modes.
def handle_clearmode(self, numeric, command, args): """Handles CLEARMODE, which is used to clear a channel's modes.""" # <- ABAAA CM #test ovpsmikbl channel = args[0] modes = args[1] # Enumerate a list of our existing modes, including prefix modes. existing = list(self._...
[ "def", "handle_clearmode", "(", "self", ",", "numeric", ",", "command", ",", "args", ")", ":", "# <- ABAAA CM #test ovpsmikbl", "channel", "=", "args", "[", "0", "]", "modes", "=", "args", "[", "1", "]", "# Enumerate a list of our existing modes, including prefix mo...
[ 1229, 4 ]
[ 1261, 80 ]
python
en
['en', 'en', 'en']
True
P10Protocol.handle_account
(self, numeric, command, args)
Handles services account changes.
Handles services account changes.
def handle_account(self, numeric, command, args): """Handles services account changes.""" # ACCOUNT has two possible syntaxes in P10, one with extended accounts # and one without. target = args[0] if self.serverdata.get('use_extended_accounts'): # Registration: <- A...
[ "def", "handle_account", "(", "self", ",", "numeric", ",", "command", ",", "args", ")", ":", "# ACCOUNT has two possible syntaxes in P10, one with extended accounts", "# and one without.", "target", "=", "args", "[", "0", "]", "if", "self", ".", "serverdata", ".", "...
[ 1263, 4 ]
[ 1302, 40 ]
python
en
['fr', 'en', 'en']
True
P10Protocol.handle_fake
(self, numeric, command, args)
Handles incoming FAKE hostmask changes.
Handles incoming FAKE hostmask changes.
def handle_fake(self, numeric, command, args): """Handles incoming FAKE hostmask changes.""" target = args[0] text = args[1] # Assume a usermode +f change, and then update the cloak checking. self.apply_modes(target, [('+f', text)]) self._check_cloak_change(target)
[ "def", "handle_fake", "(", "self", ",", "numeric", ",", "command", ",", "args", ")", ":", "target", "=", "args", "[", "0", "]", "text", "=", "args", "[", "1", "]", "# Assume a usermode +f change, and then update the cloak checking.", "self", ".", "apply_modes", ...
[ 1304, 4 ]
[ 1312, 40 ]
python
en
['en', 'en', 'en']
True
P10Protocol.handle_svsnick
(self, source, command, args)
Handles SVSNICK (forced nickname change attempts).
Handles SVSNICK (forced nickname change attempts).
def handle_svsnick(self, source, command, args): """Handles SVSNICK (forced nickname change attempts).""" # From Nefarious docs at https://github.com/evilnet/nefarious2/blob/7bd3ac4/doc/p10.txt#L1057 # {7SN} *** SVSNICK (non undernet) # 1 <target numeric> # 2 <new nick> ...
[ "def", "handle_svsnick", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "# From Nefarious docs at https://github.com/evilnet/nefarious2/blob/7bd3ac4/doc/p10.txt#L1057", "# {7SN} *** SVSNICK (non undernet)", "# 1 <target numeric>", "# 2 <new nick>", "return", "{"...
[ 1315, 4 ]
[ 1322, 54 ]
python
en
['en', 'en', 'en']
True
P10Protocol.handle_wallchops
(self, source, command, args)
Handles WALLCHOPS/WALLHOPS/WALLVOICES, the equivalent of @#channel messages and the like on P10.
Handles WALLCHOPS/WALLHOPS/WALLVOICES, the equivalent of
def handle_wallchops(self, source, command, args): """Handles WALLCHOPS/WALLHOPS/WALLVOICES, the equivalent of @#channel messages and the like on P10.""" # <- ABAAA WC #magichouse :@ test # <- ABAAA WH #magichouse :% test # <- ABAAA WV #magichouse :+ test prefix, text = a...
[ "def", "handle_wallchops", "(", "self", ",", "source", ",", "command", ",", "args", ")", ":", "# <- ABAAA WC #magichouse :@ test", "# <- ABAAA WH #magichouse :% test", "# <- ABAAA WV #magichouse :+ test", "prefix", ",", "text", "=", "args", "[", "-", "1", "]", ".", ...
[ 1324, 4 ]
[ 1331, 55 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up the AVM FRITZ!SmartHome platforms.
Set up the AVM FRITZ!SmartHome platforms.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up the AVM FRITZ!SmartHome platforms.""" fritz = Fritzhome( host=entry.data[CONF_HOST], user=entry.data[CONF_USERNAME], password=entry.data[CONF_PASSWORD], ) try: await hass.async_add_ex...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "fritz", "=", "Fritzhome", "(", "host", "=", "entry", ".", "data", "[", "CONF_HOST", "]", ",", "user", "=", "entry", ".", ...
[ 37, 0 ]
[ 114, 15 ]
python
en
['en', 'da', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unloading the AVM FRITZ!SmartHome platforms.
Unloading the AVM FRITZ!SmartHome platforms.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unloading the AVM FRITZ!SmartHome platforms.""" fritz = hass.data[DOMAIN][entry.entry_id][CONF_CONNECTIONS] await hass.async_add_executor_job(fritz.logout) unload_ok = await hass.config_entries.async_unload_platforms(entr...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "fritz", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", "]", "[", "CONF_CONNECTIONS", "]", "a...
[ 117, 0 ]
[ 126, 20 ]
python
en
['en', 'no', 'en']
True
FritzBoxEntity.__init__
( self, coordinator: DataUpdateCoordinator[dict[str, FritzhomeDevice]], ain: str, entity_description: EntityDescription | None = None, )
Initialize the FritzBox entity.
Initialize the FritzBox entity.
def __init__( self, coordinator: DataUpdateCoordinator[dict[str, FritzhomeDevice]], ain: str, entity_description: EntityDescription | None = None, ) -> None: """Initialize the FritzBox entity.""" super().__init__(coordinator) self.ain = ain if entity_...
[ "def", "__init__", "(", "self", ",", "coordinator", ":", "DataUpdateCoordinator", "[", "dict", "[", "str", ",", "FritzhomeDevice", "]", "]", ",", "ain", ":", "str", ",", "entity_description", ":", "EntityDescription", "|", "None", "=", "None", ",", ")", "-...
[ 132, 4 ]
[ 148, 38 ]
python
en
['en', 'en', 'en']
True
FritzBoxEntity.available
(self)
Return if entity is available.
Return if entity is available.
def available(self) -> bool: """Return if entity is available.""" return super().available and self.device.present
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "super", "(", ")", ".", "available", "and", "self", ".", "device", ".", "present" ]
[ 151, 4 ]
[ 153, 56 ]
python
en
['en', 'en', 'en']
True
FritzBoxEntity.device
(self)
Return device object from coordinator.
Return device object from coordinator.
def device(self) -> FritzhomeDevice: """Return device object from coordinator.""" return self.coordinator.data[self.ain]
[ "def", "device", "(", "self", ")", "->", "FritzhomeDevice", ":", "return", "self", ".", "coordinator", ".", "data", "[", "self", ".", "ain", "]" ]
[ 156, 4 ]
[ 158, 46 ]
python
en
['en', 'en', 'en']
True
FritzBoxEntity.device_info
(self)
Return device specific attributes.
Return device specific attributes.
def device_info(self) -> DeviceInfo: """Return device specific attributes.""" return { "name": self.device.name, "identifiers": {(DOMAIN, self.ain)}, "manufacturer": self.device.manufacturer, "model": self.device.productname, "sw_version": self...
[ "def", "device_info", "(", "self", ")", "->", "DeviceInfo", ":", "return", "{", "\"name\"", ":", "self", ".", "device", ".", "name", ",", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "ain", ")", "}", ",", "\"manufacturer\"", ":", "self...
[ 161, 4 ]
[ 169, 9 ]
python
en
['fr', 'it', 'en']
False
FritzBoxEntity.extra_state_attributes
(self)
Return the state attributes of the device.
Return the state attributes of the device.
def extra_state_attributes(self) -> FritzExtraAttributes: """Return the state attributes of the device.""" return { ATTR_STATE_DEVICE_LOCKED: self.device.device_lock, ATTR_STATE_LOCKED: self.device.lock, }
[ "def", "extra_state_attributes", "(", "self", ")", "->", "FritzExtraAttributes", ":", "return", "{", "ATTR_STATE_DEVICE_LOCKED", ":", "self", ".", "device", ".", "device_lock", ",", "ATTR_STATE_LOCKED", ":", "self", ".", "device", ".", "lock", ",", "}" ]
[ 172, 4 ]
[ 177, 9 ]
python
en
['en', 'en', 'en']
True
random_uuid_hex
()
Generate a random UUID hex. This uuid should not be used for cryptographically secure operations.
Generate a random UUID hex.
def random_uuid_hex() -> str: """Generate a random UUID hex. This uuid should not be used for cryptographically secure operations. """ return "%032x" % getrandbits(32 * 4)
[ "def", "random_uuid_hex", "(", ")", "->", "str", ":", "return", "\"%032x\"", "%", "getrandbits", "(", "32", "*", "4", ")" ]
[ 5, 0 ]
[ 11, 40 ]
python
en
['en', 'co', 'en']
True
test_convert_same_unit
()
Test conversion from any unit to same unit.
Test conversion from any unit to same unit.
def test_convert_same_unit(): """Test conversion from any unit to same unit.""" assert pressure_util.convert(2, PRESSURE_PA, PRESSURE_PA) == 2 assert pressure_util.convert(3, PRESSURE_HPA, PRESSURE_HPA) == 3 assert pressure_util.convert(4, PRESSURE_MBAR, PRESSURE_MBAR) == 4 assert pressure_util.conv...
[ "def", "test_convert_same_unit", "(", ")", ":", "assert", "pressure_util", ".", "convert", "(", "2", ",", "PRESSURE_PA", ",", "PRESSURE_PA", ")", "==", "2", "assert", "pressure_util", ".", "convert", "(", "3", ",", "PRESSURE_HPA", ",", "PRESSURE_HPA", ")", "...
[ 16, 0 ]
[ 21, 70 ]
python
en
['en', 'en', 'en']
True
test_convert_invalid_unit
()
Test exception is thrown for invalid units.
Test exception is thrown for invalid units.
def test_convert_invalid_unit(): """Test exception is thrown for invalid units.""" with pytest.raises(ValueError): pressure_util.convert(5, INVALID_SYMBOL, VALID_SYMBOL) with pytest.raises(ValueError): pressure_util.convert(5, VALID_SYMBOL, INVALID_SYMBOL)
[ "def", "test_convert_invalid_unit", "(", ")", ":", "with", "pytest", ".", "raises", "(", "ValueError", ")", ":", "pressure_util", ".", "convert", "(", "5", ",", "INVALID_SYMBOL", ",", "VALID_SYMBOL", ")", "with", "pytest", ".", "raises", "(", "ValueError", "...
[ 24, 0 ]
[ 30, 62 ]
python
en
['en', 'en', 'en']
True
test_convert_nonnumeric_value
()
Test exception is thrown for nonnumeric type.
Test exception is thrown for nonnumeric type.
def test_convert_nonnumeric_value(): """Test exception is thrown for nonnumeric type.""" with pytest.raises(TypeError): pressure_util.convert("a", PRESSURE_HPA, PRESSURE_INHG)
[ "def", "test_convert_nonnumeric_value", "(", ")", ":", "with", "pytest", ".", "raises", "(", "TypeError", ")", ":", "pressure_util", ".", "convert", "(", "\"a\"", ",", "PRESSURE_HPA", ",", "PRESSURE_INHG", ")" ]
[ 33, 0 ]
[ 36, 63 ]
python
en
['en', 'en', 'en']
True
test_convert_from_hpascals
()
Test conversion from hPA to other units.
Test conversion from hPA to other units.
def test_convert_from_hpascals(): """Test conversion from hPA to other units.""" hpascals = 1000 assert pressure_util.convert(hpascals, PRESSURE_HPA, PRESSURE_PSI) == pytest.approx( 14.5037743897 ) assert pressure_util.convert( hpascals, PRESSURE_HPA, PRESSURE_INHG ) == pytest.ap...
[ "def", "test_convert_from_hpascals", "(", ")", ":", "hpascals", "=", "1000", "assert", "pressure_util", ".", "convert", "(", "hpascals", ",", "PRESSURE_HPA", ",", "PRESSURE_PSI", ")", "==", "pytest", ".", "approx", "(", "14.5037743897", ")", "assert", "pressure_...
[ 39, 0 ]
[ 53, 28 ]
python
en
['en', 'en', 'en']
True
test_convert_from_inhg
()
Test conversion from inHg to other units.
Test conversion from inHg to other units.
def test_convert_from_inhg(): """Test conversion from inHg to other units.""" inhg = 30 assert pressure_util.convert(inhg, PRESSURE_INHG, PRESSURE_PSI) == pytest.approx( 14.7346266155 ) assert pressure_util.convert(inhg, PRESSURE_INHG, PRESSURE_HPA) == pytest.approx( 1015.9167 ) ...
[ "def", "test_convert_from_inhg", "(", ")", ":", "inhg", "=", "30", "assert", "pressure_util", ".", "convert", "(", "inhg", ",", "PRESSURE_INHG", ",", "PRESSURE_PSI", ")", "==", "pytest", ".", "approx", "(", "14.7346266155", ")", "assert", "pressure_util", ".",...
[ 56, 0 ]
[ 70, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Ness Alarm alarm control panel devices.
Set up the Ness Alarm alarm control panel devices.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Ness Alarm alarm control panel devices.""" if discovery_info is None: return device = NessAlarmPanel(hass.data[DATA_NESS], "Alarm Panel") async_add_entities([device])
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "device", "=", "NessAlarmPanel", "(", "hass", ".", "data", "[", ...
[ 27, 0 ]
[ 33, 32 ]
python
en
['en', 'en', 'en']
True
NessAlarmPanel.__init__
(self, client, name)
Initialize the alarm panel.
Initialize the alarm panel.
def __init__(self, client, name): """Initialize the alarm panel.""" self._client = client self._name = name self._state = None
[ "def", "__init__", "(", "self", ",", "client", ",", "name", ")", ":", "self", ".", "_client", "=", "client", "self", ".", "_name", "=", "name", "self", ".", "_state", "=", "None" ]
[ 39, 4 ]
[ 43, 26 ]
python
en
['en', 'en', 'en']
True
NessAlarmPanel.async_added_to_hass
(self)
Register callbacks.
Register callbacks.
async def async_added_to_hass(self): """Register callbacks.""" self.async_on_remove( async_dispatcher_connect( self.hass, SIGNAL_ARMING_STATE_CHANGED, self._handle_arming_state_change ) )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "SIGNAL_ARMING_STATE_CHANGED", ",", "self", ".", "_handle_arming_state_change", ")", ")" ]
[ 45, 4 ]
[ 51, 9 ]
python
en
['en', 'no', 'en']
False
NessAlarmPanel.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" ]
[ 54, 4 ]
[ 56, 25 ]
python
en
['en', 'en', 'en']
True
NessAlarmPanel.should_poll
(self)
Return the polling state.
Return the polling state.
def should_poll(self): """Return the polling state.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 59, 4 ]
[ 61, 20 ]
python
en
['en', 'en', 'en']
True
NessAlarmPanel.code_format
(self)
Return the regex for code format or None if no code is required.
Return the regex for code format or None if no code is required.
def code_format(self): """Return the regex for code format or None if no code is required.""" return alarm.FORMAT_NUMBER
[ "def", "code_format", "(", "self", ")", ":", "return", "alarm", ".", "FORMAT_NUMBER" ]
[ 64, 4 ]
[ 66, 34 ]
python
en
['en', 'en', 'en']
True
NessAlarmPanel.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" ]
[ 69, 4 ]
[ 71, 26 ]
python
en
['en', 'en', 'en']
True
NessAlarmPanel.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self) -> int: """Return the list of supported features.""" return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_TRIGGER
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_ALARM_ARM_HOME", "|", "SUPPORT_ALARM_ARM_AWAY", "|", "SUPPORT_ALARM_TRIGGER" ]
[ 74, 4 ]
[ 76, 86 ]
python
en
['en', 'en', 'en']
True
NessAlarmPanel.async_alarm_disarm
(self, code=None)
Send disarm command.
Send disarm command.
async def async_alarm_disarm(self, code=None): """Send disarm command.""" await self._client.disarm(code)
[ "async", "def", "async_alarm_disarm", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "_client", ".", "disarm", "(", "code", ")" ]
[ 78, 4 ]
[ 80, 39 ]
python
en
['en', 'pt', 'en']
True
NessAlarmPanel.async_alarm_arm_away
(self, code=None)
Send arm away command.
Send arm away command.
async def async_alarm_arm_away(self, code=None): """Send arm away command.""" await self._client.arm_away(code)
[ "async", "def", "async_alarm_arm_away", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "_client", ".", "arm_away", "(", "code", ")" ]
[ 82, 4 ]
[ 84, 41 ]
python
en
['en', 'en', 'en']
True
NessAlarmPanel.async_alarm_arm_home
(self, code=None)
Send arm home command.
Send arm home command.
async def async_alarm_arm_home(self, code=None): """Send arm home command.""" await self._client.arm_home(code)
[ "async", "def", "async_alarm_arm_home", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "_client", ".", "arm_home", "(", "code", ")" ]
[ 86, 4 ]
[ 88, 41 ]
python
en
['en', 'pt', 'en']
True
NessAlarmPanel.async_alarm_trigger
(self, code=None)
Send trigger/panic command.
Send trigger/panic command.
async def async_alarm_trigger(self, code=None): """Send trigger/panic command.""" await self._client.panic(code)
[ "async", "def", "async_alarm_trigger", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "_client", ".", "panic", "(", "code", ")" ]
[ 90, 4 ]
[ 92, 38 ]
python
en
['en', 'zh', 'en']
True
NessAlarmPanel._handle_arming_state_change
(self, arming_state)
Handle arming state update.
Handle arming state update.
def _handle_arming_state_change(self, arming_state): """Handle arming state update.""" if arming_state == ArmingState.UNKNOWN: self._state = None elif arming_state == ArmingState.DISARMED: self._state = STATE_ALARM_DISARMED elif arming_state == ArmingState.ARMING...
[ "def", "_handle_arming_state_change", "(", "self", ",", "arming_state", ")", ":", "if", "arming_state", "==", "ArmingState", ".", "UNKNOWN", ":", "self", ".", "_state", "=", "None", "elif", "arming_state", "==", "ArmingState", ".", "DISARMED", ":", "self", "."...
[ 95, 4 ]
[ 115, 35 ]
python
en
['en', 'en', 'en']
True
setup_cors
(app: Application, origins: list[str])
Set up CORS.
Set up CORS.
def setup_cors(app: Application, origins: list[str]) -> None: """Set up CORS.""" # This import should remain here. That way the HTTP integration can always # be imported by other integrations without it's requirements being installed. # pylint: disable=import-outside-toplevel import aiohttp_cors ...
[ "def", "setup_cors", "(", "app", ":", "Application", ",", "origins", ":", "list", "[", "str", "]", ")", "->", "None", ":", "# This import should remain here. That way the HTTP integration can always", "# be imported by other integrations without it's requirements being installed....
[ 29, 0 ]
[ 89, 39 ]
python
en
['en', 'bg', 'en']
True
AmbientStationFlowHandler.__init__
(self)
Initialize the config flow.
Initialize the config flow.
def __init__(self) -> None: """Initialize the config flow.""" self.data_schema = vol.Schema( {vol.Required(CONF_API_KEY): str, vol.Required(CONF_APP_KEY): str} )
[ "def", "__init__", "(", "self", ")", "->", "None", ":", "self", ".", "data_schema", "=", "vol", ".", "Schema", "(", "{", "vol", ".", "Required", "(", "CONF_API_KEY", ")", ":", "str", ",", "vol", ".", "Required", "(", "CONF_APP_KEY", ")", ":", "str", ...
[ 20, 4 ]
[ 24, 9 ]
python
en
['en', 'en', 'en']
True
AmbientStationFlowHandler._show_form
(self, errors: dict | None = None)
Show the form to the user.
Show the form to the user.
async def _show_form(self, errors: dict | None = None) -> FlowResult: """Show the form to the user.""" return self.async_show_form( step_id="user", data_schema=self.data_schema, errors=errors if errors else {}, )
[ "async", "def", "_show_form", "(", "self", ",", "errors", ":", "dict", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"user\"", ",", "data_schema", "=", "self", ".", "data_schema", ...
[ 26, 4 ]
[ 32, 9 ]
python
en
['en', 'en', 'en']
True
AmbientStationFlowHandler.async_step_user
(self, user_input: dict | None = None)
Handle the start of the config flow.
Handle the start of the config flow.
async def async_step_user(self, user_input: dict | None = None) -> FlowResult: """Handle the start of the config flow.""" if not user_input: return await self._show_form() await self.async_set_unique_id(user_input[CONF_APP_KEY]) self._abort_if_unique_id_configured() ...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", ":", "dict", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "if", "not", "user_input", ":", "return", "await", "self", ".", "_show_form", "(", ")", "await", "self", ".", "async_s...
[ 34, 4 ]
[ 60, 9 ]
python
en
['en', 'en', 'en']
True
test_setup
(hass, legacy_patchable_time)
Test the general setup of the integration.
Test the general setup of the integration.
async def test_setup(hass, legacy_patchable_time): """Test the general setup of the integration.""" # Set up some mock feed entries for this test. mock_entry_1 = _generate_mock_feed_entry( "1234", "Description 1", 15.5, (38.0, -3.0), event_name="Name 1", event...
[ "async", "def", "test_setup", "(", "hass", ",", "legacy_patchable_time", ")", ":", "# Set up some mock feed entries for this test.", "mock_entry_1", "=", "_generate_mock_feed_entry", "(", "\"1234\"", ",", "\"Description 1\"", ",", "15.5", ",", "(", "38.0", ",", "-", "...
[ 42, 0 ]
[ 190, 49 ]
python
en
['en', 'en', 'en']
True
test_setup_imperial
(hass, legacy_patchable_time)
Test the setup of the integration using imperial unit system.
Test the setup of the integration using imperial unit system.
async def test_setup_imperial(hass, legacy_patchable_time): """Test the setup of the integration using imperial unit system.""" hass.config.units = IMPERIAL_SYSTEM # Set up some mock feed entries for this test. mock_entry_1 = _generate_mock_feed_entry( "1234", "Description 1", 15...
[ "async", "def", "test_setup_imperial", "(", "hass", ",", "legacy_patchable_time", ")", ":", "hass", ".", "config", ".", "units", "=", "IMPERIAL_SYSTEM", "# Set up some mock feed entries for this test.", "mock_entry_1", "=", "_generate_mock_feed_entry", "(", "\"1234\"", ",...
[ 193, 0 ]
[ 247, 40 ]
python
en
['en', 'en', 'en']
True
TestAnotherFakeApi.test_call_123_test_special_tags
(self)
Test case for call_123_test_special_tags To test special tags # noqa: E501
Test case for call_123_test_special_tags
def test_call_123_test_special_tags(self): """Test case for call_123_test_special_tags To test special tags # noqa: E501 """ pass
[ "def", "test_call_123_test_special_tags", "(", "self", ")", ":", "pass" ]
[ 30, 4 ]
[ 35, 12 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the ecoal sensors.
Set up the ecoal sensors.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the ecoal sensors.""" if discovery_info is None: return devices = [] ecoal_contr = hass.data[DATA_ECOAL_BOILER] for sensor_id in discovery_info: name = AVAILABLE_SENSORS[sensor_id] devices.append(E...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "devices", "=", "[", "]", "ecoal_contr", "=", "hass", ".", "data", "[", "DATA_ECOAL...
[ 7, 0 ]
[ 16, 31 ]
python
en
['en', 'bg', 'en']
True