repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Shizmob/pydle | pydle/features/ircv3/metadata.py | MetadataSupport.on_raw_765 | async def on_raw_765(self, message):
""" Invalid metadata target. """
target, targetmeta = self._parse_user(message.params[0])
if target not in self._pending['metadata']:
return
if target in self.users:
self._sync_user(target, targetmeta)
self._metadata_... | python | async def on_raw_765(self, message):
""" Invalid metadata target. """
target, targetmeta = self._parse_user(message.params[0])
if target not in self._pending['metadata']:
return
if target in self.users:
self._sync_user(target, targetmeta)
self._metadata_... | [
"async",
"def",
"on_raw_765",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"targetmeta",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"params",
"[",
"0",
"]",
")",
"if",
"target",
"not",
"in",
"self",
".",
"_pending",
"[",
"'metadata'... | Invalid metadata target. | [
"Invalid",
"metadata",
"target",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/ircv3/metadata.py#L108-L121 | train |
Shizmob/pydle | pydle/connection.py | Connection.connect | async def connect(self):
""" Connect to target. """
self.tls_context = None
if self.tls:
self.tls_context = self.create_tls_context()
(self.reader, self.writer) = await asyncio.open_connection(
host=self.hostname,
port=self.port,
local_ad... | python | async def connect(self):
""" Connect to target. """
self.tls_context = None
if self.tls:
self.tls_context = self.create_tls_context()
(self.reader, self.writer) = await asyncio.open_connection(
host=self.hostname,
port=self.port,
local_ad... | [
"async",
"def",
"connect",
"(",
"self",
")",
":",
"self",
".",
"tls_context",
"=",
"None",
"if",
"self",
".",
"tls",
":",
"self",
".",
"tls_context",
"=",
"self",
".",
"create_tls_context",
"(",
")",
"(",
"self",
".",
"reader",
",",
"self",
".",
"wri... | Connect to target. | [
"Connect",
"to",
"target",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/connection.py#L41-L54 | train |
Shizmob/pydle | pydle/connection.py | Connection.create_tls_context | def create_tls_context(self):
""" Transform our regular socket into a TLS socket. """
# Create context manually, as we're going to set our own options.
tls_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
# Load client/server certificate.
if self.tls_certificate_file:
t... | python | def create_tls_context(self):
""" Transform our regular socket into a TLS socket. """
# Create context manually, as we're going to set our own options.
tls_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
# Load client/server certificate.
if self.tls_certificate_file:
t... | [
"def",
"create_tls_context",
"(",
"self",
")",
":",
"tls_context",
"=",
"ssl",
".",
"SSLContext",
"(",
"ssl",
".",
"PROTOCOL_SSLv23",
")",
"if",
"self",
".",
"tls_certificate_file",
":",
"tls_context",
".",
"load_cert_chain",
"(",
"self",
".",
"tls_certificate_f... | Transform our regular socket into a TLS socket. | [
"Transform",
"our",
"regular",
"socket",
"into",
"a",
"TLS",
"socket",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/connection.py#L56-L89 | train |
Shizmob/pydle | pydle/connection.py | Connection.disconnect | async def disconnect(self):
""" Disconnect from target. """
if not self.connected:
return
self.writer.close()
self.reader = None
self.writer = None | python | async def disconnect(self):
""" Disconnect from target. """
if not self.connected:
return
self.writer.close()
self.reader = None
self.writer = None | [
"async",
"def",
"disconnect",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"connected",
":",
"return",
"self",
".",
"writer",
".",
"close",
"(",
")",
"self",
".",
"reader",
"=",
"None",
"self",
".",
"writer",
"=",
"None"
] | Disconnect from target. | [
"Disconnect",
"from",
"target",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/connection.py#L107-L114 | train |
Shizmob/pydle | pydle/connection.py | Connection.send | async def send(self, data):
""" Add data to send queue. """
self.writer.write(data)
await self.writer.drain() | python | async def send(self, data):
""" Add data to send queue. """
self.writer.write(data)
await self.writer.drain() | [
"async",
"def",
"send",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"writer",
".",
"write",
"(",
"data",
")",
"await",
"self",
".",
"writer",
".",
"drain",
"(",
")"
] | Add data to send queue. | [
"Add",
"data",
"to",
"send",
"queue",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/connection.py#L125-L128 | train |
Shizmob/pydle | pydle/protocol.py | identifierify | def identifierify(name):
""" Clean up name so it works for a Python identifier. """
name = name.lower()
name = re.sub('[^a-z0-9]', '_', name)
return name | python | def identifierify(name):
""" Clean up name so it works for a Python identifier. """
name = name.lower()
name = re.sub('[^a-z0-9]', '_', name)
return name | [
"def",
"identifierify",
"(",
"name",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"name",
"=",
"re",
".",
"sub",
"(",
"'[^a-z0-9]'",
",",
"'_'",
",",
"name",
")",
"return",
"name"
] | Clean up name so it works for a Python identifier. | [
"Clean",
"up",
"name",
"so",
"it",
"works",
"for",
"a",
"Python",
"identifier",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/protocol.py#L40-L44 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support._register | async def _register(self):
""" Perform IRC connection registration. """
if self.registered:
return
self._registration_attempts += 1
# Don't throttle during registration, most ircds don't care for flooding during registration,
# and it might speed it up significantly.... | python | async def _register(self):
""" Perform IRC connection registration. """
if self.registered:
return
self._registration_attempts += 1
# Don't throttle during registration, most ircds don't care for flooding during registration,
# and it might speed it up significantly.... | [
"async",
"def",
"_register",
"(",
"self",
")",
":",
"if",
"self",
".",
"registered",
":",
"return",
"self",
".",
"_registration_attempts",
"+=",
"1",
"self",
".",
"connection",
".",
"throttle",
"=",
"False",
"if",
"self",
".",
"password",
":",
"await",
"... | Perform IRC connection registration. | [
"Perform",
"IRC",
"connection",
"registration",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L199-L216 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support._registration_completed | async def _registration_completed(self, message):
""" We're connected and registered. Receive proper nickname and emit fake NICK message. """
if not self.registered:
# Re-enable throttling.
self.registered = True
self.connection.throttle = True
target = m... | python | async def _registration_completed(self, message):
""" We're connected and registered. Receive proper nickname and emit fake NICK message. """
if not self.registered:
# Re-enable throttling.
self.registered = True
self.connection.throttle = True
target = m... | [
"async",
"def",
"_registration_completed",
"(",
"self",
",",
"message",
")",
":",
"if",
"not",
"self",
".",
"registered",
":",
"self",
".",
"registered",
"=",
"True",
"self",
".",
"connection",
".",
"throttle",
"=",
"True",
"target",
"=",
"message",
".",
... | We're connected and registered. Receive proper nickname and emit fake NICK message. | [
"We",
"re",
"connected",
"and",
"registered",
".",
"Receive",
"proper",
"nickname",
"and",
"emit",
"fake",
"NICK",
"message",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L218-L227 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support._has_message | def _has_message(self):
""" Whether or not we have messages available for processing. """
sep = protocol.MINIMAL_LINE_SEPARATOR.encode(self.encoding)
return sep in self._receive_buffer | python | def _has_message(self):
""" Whether or not we have messages available for processing. """
sep = protocol.MINIMAL_LINE_SEPARATOR.encode(self.encoding)
return sep in self._receive_buffer | [
"def",
"_has_message",
"(",
"self",
")",
":",
"sep",
"=",
"protocol",
".",
"MINIMAL_LINE_SEPARATOR",
".",
"encode",
"(",
"self",
".",
"encoding",
")",
"return",
"sep",
"in",
"self",
".",
"_receive_buffer"
] | Whether or not we have messages available for processing. | [
"Whether",
"or",
"not",
"we",
"have",
"messages",
"available",
"for",
"processing",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L231-L234 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.join | async def join(self, channel, password=None):
""" Join channel, optionally with password. """
if self.in_channel(channel):
raise AlreadyInChannel(channel)
if password:
await self.rawmsg('JOIN', channel, password)
else:
await self.rawmsg('JOIN', channe... | python | async def join(self, channel, password=None):
""" Join channel, optionally with password. """
if self.in_channel(channel):
raise AlreadyInChannel(channel)
if password:
await self.rawmsg('JOIN', channel, password)
else:
await self.rawmsg('JOIN', channe... | [
"async",
"def",
"join",
"(",
"self",
",",
"channel",
",",
"password",
"=",
"None",
")",
":",
"if",
"self",
".",
"in_channel",
"(",
"channel",
")",
":",
"raise",
"AlreadyInChannel",
"(",
"channel",
")",
"if",
"password",
":",
"await",
"self",
".",
"rawm... | Join channel, optionally with password. | [
"Join",
"channel",
"optionally",
"with",
"password",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L254-L262 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.part | async def part(self, channel, message=None):
""" Leave channel, optionally with message. """
if not self.in_channel(channel):
raise NotInChannel(channel)
# Message seems to be an extension to the spec.
if message:
await self.rawmsg('PART', channel, message)
... | python | async def part(self, channel, message=None):
""" Leave channel, optionally with message. """
if not self.in_channel(channel):
raise NotInChannel(channel)
# Message seems to be an extension to the spec.
if message:
await self.rawmsg('PART', channel, message)
... | [
"async",
"def",
"part",
"(",
"self",
",",
"channel",
",",
"message",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"in_channel",
"(",
"channel",
")",
":",
"raise",
"NotInChannel",
"(",
"channel",
")",
"if",
"message",
":",
"await",
"self",
".",
"r... | Leave channel, optionally with message. | [
"Leave",
"channel",
"optionally",
"with",
"message",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L264-L273 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.kick | async def kick(self, channel, target, reason=None):
""" Kick user from channel. """
if not self.in_channel(channel):
raise NotInChannel(channel)
if reason:
await self.rawmsg('KICK', channel, target, reason)
else:
await self.rawmsg('KICK', channel, tar... | python | async def kick(self, channel, target, reason=None):
""" Kick user from channel. """
if not self.in_channel(channel):
raise NotInChannel(channel)
if reason:
await self.rawmsg('KICK', channel, target, reason)
else:
await self.rawmsg('KICK', channel, tar... | [
"async",
"def",
"kick",
"(",
"self",
",",
"channel",
",",
"target",
",",
"reason",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"in_channel",
"(",
"channel",
")",
":",
"raise",
"NotInChannel",
"(",
"channel",
")",
"if",
"reason",
":",
"await",
"s... | Kick user from channel. | [
"Kick",
"user",
"from",
"channel",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L275-L283 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.unban | async def unban(self, channel, target, range=0):
"""
Unban user from channel. Target can be either a user or a host.
See ban documentation for the range parameter.
"""
if target in self.users:
host = self.users[target]['hostname']
else:
host = targ... | python | async def unban(self, channel, target, range=0):
"""
Unban user from channel. Target can be either a user or a host.
See ban documentation for the range parameter.
"""
if target in self.users:
host = self.users[target]['hostname']
else:
host = targ... | [
"async",
"def",
"unban",
"(",
"self",
",",
"channel",
",",
"target",
",",
"range",
"=",
"0",
")",
":",
"if",
"target",
"in",
"self",
".",
"users",
":",
"host",
"=",
"self",
".",
"users",
"[",
"target",
"]",
"[",
"'hostname'",
"]",
"else",
":",
"h... | Unban user from channel. Target can be either a user or a host.
See ban documentation for the range parameter. | [
"Unban",
"user",
"from",
"channel",
".",
"Target",
"can",
"be",
"either",
"a",
"user",
"or",
"a",
"host",
".",
"See",
"ban",
"documentation",
"for",
"the",
"range",
"parameter",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L301-L313 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.kickban | async def kickban(self, channel, target, reason=None, range=0):
"""
Kick and ban user from channel.
"""
await self.ban(channel, target, range)
await self.kick(channel, target, reason) | python | async def kickban(self, channel, target, reason=None, range=0):
"""
Kick and ban user from channel.
"""
await self.ban(channel, target, range)
await self.kick(channel, target, reason) | [
"async",
"def",
"kickban",
"(",
"self",
",",
"channel",
",",
"target",
",",
"reason",
"=",
"None",
",",
"range",
"=",
"0",
")",
":",
"await",
"self",
".",
"ban",
"(",
"channel",
",",
"target",
",",
"range",
")",
"await",
"self",
".",
"kick",
"(",
... | Kick and ban user from channel. | [
"Kick",
"and",
"ban",
"user",
"from",
"channel",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L315-L320 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.quit | async def quit(self, message=None):
""" Quit network. """
if message is None:
message = self.DEFAULT_QUIT_MESSAGE
await self.rawmsg('QUIT', message)
await self.disconnect(expected=True) | python | async def quit(self, message=None):
""" Quit network. """
if message is None:
message = self.DEFAULT_QUIT_MESSAGE
await self.rawmsg('QUIT', message)
await self.disconnect(expected=True) | [
"async",
"def",
"quit",
"(",
"self",
",",
"message",
"=",
"None",
")",
":",
"if",
"message",
"is",
"None",
":",
"message",
"=",
"self",
".",
"DEFAULT_QUIT_MESSAGE",
"await",
"self",
".",
"rawmsg",
"(",
"'QUIT'",
",",
"message",
")",
"await",
"self",
".... | Quit network. | [
"Quit",
"network",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L322-L328 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.cycle | async def cycle(self, channel):
""" Rejoin channel. """
if not self.in_channel(channel):
raise NotInChannel(channel)
password = self.channels[channel]['password']
await self.part(channel)
await self.join(channel, password) | python | async def cycle(self, channel):
""" Rejoin channel. """
if not self.in_channel(channel):
raise NotInChannel(channel)
password = self.channels[channel]['password']
await self.part(channel)
await self.join(channel, password) | [
"async",
"def",
"cycle",
"(",
"self",
",",
"channel",
")",
":",
"if",
"not",
"self",
".",
"in_channel",
"(",
"channel",
")",
":",
"raise",
"NotInChannel",
"(",
"channel",
")",
"password",
"=",
"self",
".",
"channels",
"[",
"channel",
"]",
"[",
"'passwo... | Rejoin channel. | [
"Rejoin",
"channel",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L330-L337 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.message | async def message(self, target, message):
""" Message channel or user. """
hostmask = self._format_user_mask(self.nickname)
# Leeway.
chunklen = protocol.MESSAGE_LENGTH_LIMIT - len(
'{hostmask} PRIVMSG {target} :'.format(hostmask=hostmask, target=target)) - 25
for li... | python | async def message(self, target, message):
""" Message channel or user. """
hostmask = self._format_user_mask(self.nickname)
# Leeway.
chunklen = protocol.MESSAGE_LENGTH_LIMIT - len(
'{hostmask} PRIVMSG {target} :'.format(hostmask=hostmask, target=target)) - 25
for li... | [
"async",
"def",
"message",
"(",
"self",
",",
"target",
",",
"message",
")",
":",
"hostmask",
"=",
"self",
".",
"_format_user_mask",
"(",
"self",
".",
"nickname",
")",
"chunklen",
"=",
"protocol",
".",
"MESSAGE_LENGTH_LIMIT",
"-",
"len",
"(",
"'{hostmask} PRI... | Message channel or user. | [
"Message",
"channel",
"or",
"user",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L339-L349 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.set_topic | async def set_topic(self, channel, topic):
"""
Set topic on channel.
Users should only rely on the topic actually being changed when receiving an on_topic_change callback.
"""
if not self.is_channel(channel):
raise ValueError('Not a channel: {}'.format(channel))
... | python | async def set_topic(self, channel, topic):
"""
Set topic on channel.
Users should only rely on the topic actually being changed when receiving an on_topic_change callback.
"""
if not self.is_channel(channel):
raise ValueError('Not a channel: {}'.format(channel))
... | [
"async",
"def",
"set_topic",
"(",
"self",
",",
"channel",
",",
"topic",
")",
":",
"if",
"not",
"self",
".",
"is_channel",
"(",
"channel",
")",
":",
"raise",
"ValueError",
"(",
"'Not a channel: {}'",
".",
"format",
"(",
"channel",
")",
")",
"elif",
"not",... | Set topic on channel.
Users should only rely on the topic actually being changed when receiving an on_topic_change callback. | [
"Set",
"topic",
"on",
"channel",
".",
"Users",
"should",
"only",
"rely",
"on",
"the",
"topic",
"actually",
"being",
"changed",
"when",
"receiving",
"an",
"on_topic_change",
"callback",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L372-L382 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_error | async def on_raw_error(self, message):
""" Server encountered an error and will now close the connection. """
error = protocol.ServerError(' '.join(message.params))
await self.on_data_error(error) | python | async def on_raw_error(self, message):
""" Server encountered an error and will now close the connection. """
error = protocol.ServerError(' '.join(message.params))
await self.on_data_error(error) | [
"async",
"def",
"on_raw_error",
"(",
"self",
",",
"message",
")",
":",
"error",
"=",
"protocol",
".",
"ServerError",
"(",
"' '",
".",
"join",
"(",
"message",
".",
"params",
")",
")",
"await",
"self",
".",
"on_data_error",
"(",
"error",
")"
] | Server encountered an error and will now close the connection. | [
"Server",
"encountered",
"an",
"error",
"and",
"will",
"now",
"close",
"the",
"connection",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L539-L542 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_invite | async def on_raw_invite(self, message):
""" INVITE command. """
nick, metadata = self._parse_user(message.source)
self._sync_user(nick, metadata)
target, channel = message.params
target, metadata = self._parse_user(target)
if self.is_same_nick(self.nickname, target):
... | python | async def on_raw_invite(self, message):
""" INVITE command. """
nick, metadata = self._parse_user(message.source)
self._sync_user(nick, metadata)
target, channel = message.params
target, metadata = self._parse_user(target)
if self.is_same_nick(self.nickname, target):
... | [
"async",
"def",
"on_raw_invite",
"(",
"self",
",",
"message",
")",
":",
"nick",
",",
"metadata",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"self",
".",
"_sync_user",
"(",
"nick",
",",
"metadata",
")",
"target",
",",
"channel",
... | INVITE command. | [
"INVITE",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L544-L555 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_join | async def on_raw_join(self, message):
""" JOIN command. """
nick, metadata = self._parse_user(message.source)
self._sync_user(nick, metadata)
channels = message.params[0].split(',')
if self.is_same_nick(self.nickname, nick):
# Add to our channel list, we joined here.... | python | async def on_raw_join(self, message):
""" JOIN command. """
nick, metadata = self._parse_user(message.source)
self._sync_user(nick, metadata)
channels = message.params[0].split(',')
if self.is_same_nick(self.nickname, nick):
# Add to our channel list, we joined here.... | [
"async",
"def",
"on_raw_join",
"(",
"self",
",",
"message",
")",
":",
"nick",
",",
"metadata",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"self",
".",
"_sync_user",
"(",
"nick",
",",
"metadata",
")",
"channels",
"=",
"message",
... | JOIN command. | [
"JOIN",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L557-L578 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_kick | async def on_raw_kick(self, message):
""" KICK command. """
kicker, kickermeta = self._parse_user(message.source)
self._sync_user(kicker, kickermeta)
if len(message.params) > 2:
channels, targets, reason = message.params
else:
channels, targets = message.... | python | async def on_raw_kick(self, message):
""" KICK command. """
kicker, kickermeta = self._parse_user(message.source)
self._sync_user(kicker, kickermeta)
if len(message.params) > 2:
channels, targets, reason = message.params
else:
channels, targets = message.... | [
"async",
"def",
"on_raw_kick",
"(",
"self",
",",
"message",
")",
":",
"kicker",
",",
"kickermeta",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"self",
".",
"_sync_user",
"(",
"kicker",
",",
"kickermeta",
")",
"if",
"len",
"(",
... | KICK command. | [
"KICK",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L580-L605 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_kill | async def on_raw_kill(self, message):
""" KILL command. """
by, bymeta = self._parse_user(message.source)
target, targetmeta = self._parse_user(message.params[0])
reason = message.params[1]
self._sync_user(target, targetmeta)
if by in self.users:
self._sync_u... | python | async def on_raw_kill(self, message):
""" KILL command. """
by, bymeta = self._parse_user(message.source)
target, targetmeta = self._parse_user(message.params[0])
reason = message.params[1]
self._sync_user(target, targetmeta)
if by in self.users:
self._sync_u... | [
"async",
"def",
"on_raw_kill",
"(",
"self",
",",
"message",
")",
":",
"by",
",",
"bymeta",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"target",
",",
"targetmeta",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"params",
... | KILL command. | [
"KILL",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L607-L621 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_mode | async def on_raw_mode(self, message):
""" MODE command. """
nick, metadata = self._parse_user(message.source)
target, modes = message.params[0], message.params[1:]
self._sync_user(nick, metadata)
if self.is_channel(target):
if self.in_channel(target):
... | python | async def on_raw_mode(self, message):
""" MODE command. """
nick, metadata = self._parse_user(message.source)
target, modes = message.params[0], message.params[1:]
self._sync_user(nick, metadata)
if self.is_channel(target):
if self.in_channel(target):
... | [
"async",
"def",
"on_raw_mode",
"(",
"self",
",",
"message",
")",
":",
"nick",
",",
"metadata",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"target",
",",
"modes",
"=",
"message",
".",
"params",
"[",
"0",
"]",
",",
"message",
... | MODE command. | [
"MODE",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L623-L643 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_nick | async def on_raw_nick(self, message):
""" NICK command. """
nick, metadata = self._parse_user(message.source)
new = message.params[0]
self._sync_user(nick, metadata)
# Acknowledgement of nickname change: set it internally, too.
# Alternatively, we were force nick-changed... | python | async def on_raw_nick(self, message):
""" NICK command. """
nick, metadata = self._parse_user(message.source)
new = message.params[0]
self._sync_user(nick, metadata)
# Acknowledgement of nickname change: set it internally, too.
# Alternatively, we were force nick-changed... | [
"async",
"def",
"on_raw_nick",
"(",
"self",
",",
"message",
")",
":",
"nick",
",",
"metadata",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"new",
"=",
"message",
".",
"params",
"[",
"0",
"]",
"self",
".",
"_sync_user",
"(",
"... | NICK command. | [
"NICK",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L645-L660 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_notice | async def on_raw_notice(self, message):
""" NOTICE command. """
nick, metadata = self._parse_user(message.source)
target, message = message.params
self._sync_user(nick, metadata)
await self.on_notice(target, nick, message)
if self.is_channel(target):
await s... | python | async def on_raw_notice(self, message):
""" NOTICE command. """
nick, metadata = self._parse_user(message.source)
target, message = message.params
self._sync_user(nick, metadata)
await self.on_notice(target, nick, message)
if self.is_channel(target):
await s... | [
"async",
"def",
"on_raw_notice",
"(",
"self",
",",
"message",
")",
":",
"nick",
",",
"metadata",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"target",
",",
"message",
"=",
"message",
".",
"params",
"self",
".",
"_sync_user",
"(",... | NOTICE command. | [
"NOTICE",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L662-L673 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_part | async def on_raw_part(self, message):
""" PART command. """
nick, metadata = self._parse_user(message.source)
channels = message.params[0].split(',')
if len(message.params) > 1:
reason = message.params[1]
else:
reason = None
self._sync_user(nick, ... | python | async def on_raw_part(self, message):
""" PART command. """
nick, metadata = self._parse_user(message.source)
channels = message.params[0].split(',')
if len(message.params) > 1:
reason = message.params[1]
else:
reason = None
self._sync_user(nick, ... | [
"async",
"def",
"on_raw_part",
"(",
"self",
",",
"message",
")",
":",
"nick",
",",
"metadata",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"channels",
"=",
"message",
".",
"params",
"[",
"0",
"]",
".",
"split",
"(",
"','",
")... | PART command. | [
"PART",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L675-L695 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_privmsg | async def on_raw_privmsg(self, message):
""" PRIVMSG command. """
nick, metadata = self._parse_user(message.source)
target, message = message.params
self._sync_user(nick, metadata)
await self.on_message(target, nick, message)
if self.is_channel(target):
awai... | python | async def on_raw_privmsg(self, message):
""" PRIVMSG command. """
nick, metadata = self._parse_user(message.source)
target, message = message.params
self._sync_user(nick, metadata)
await self.on_message(target, nick, message)
if self.is_channel(target):
awai... | [
"async",
"def",
"on_raw_privmsg",
"(",
"self",
",",
"message",
")",
":",
"nick",
",",
"metadata",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"target",
",",
"message",
"=",
"message",
".",
"params",
"self",
".",
"_sync_user",
"("... | PRIVMSG command. | [
"PRIVMSG",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L702-L713 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_quit | async def on_raw_quit(self, message):
""" QUIT command. """
nick, metadata = self._parse_user(message.source)
self._sync_user(nick, metadata)
if message.params:
reason = message.params[0]
else:
reason = None
await self.on_quit(nick, reason)
... | python | async def on_raw_quit(self, message):
""" QUIT command. """
nick, metadata = self._parse_user(message.source)
self._sync_user(nick, metadata)
if message.params:
reason = message.params[0]
else:
reason = None
await self.on_quit(nick, reason)
... | [
"async",
"def",
"on_raw_quit",
"(",
"self",
",",
"message",
")",
":",
"nick",
",",
"metadata",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"self",
".",
"_sync_user",
"(",
"nick",
",",
"metadata",
")",
"if",
"message",
".",
"par... | QUIT command. | [
"QUIT",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L715-L731 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_topic | async def on_raw_topic(self, message):
""" TOPIC command. """
setter, settermeta = self._parse_user(message.source)
target, topic = message.params
self._sync_user(setter, settermeta)
# Update topic in our own channel list.
if self.in_channel(target):
self.ch... | python | async def on_raw_topic(self, message):
""" TOPIC command. """
setter, settermeta = self._parse_user(message.source)
target, topic = message.params
self._sync_user(setter, settermeta)
# Update topic in our own channel list.
if self.in_channel(target):
self.ch... | [
"async",
"def",
"on_raw_topic",
"(",
"self",
",",
"message",
")",
":",
"setter",
",",
"settermeta",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"target",
",",
"topic",
"=",
"message",
".",
"params",
"self",
".",
"_sync_user",
"("... | TOPIC command. | [
"TOPIC",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L733-L746 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_004 | async def on_raw_004(self, message):
""" Basic server information. """
target, hostname, ircd, user_modes, channel_modes = message.params[:5]
# Set valid channel and user modes.
self._channel_modes = set(channel_modes)
self._user_modes = set(user_modes) | python | async def on_raw_004(self, message):
""" Basic server information. """
target, hostname, ircd, user_modes, channel_modes = message.params[:5]
# Set valid channel and user modes.
self._channel_modes = set(channel_modes)
self._user_modes = set(user_modes) | [
"async",
"def",
"on_raw_004",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"hostname",
",",
"ircd",
",",
"user_modes",
",",
"channel_modes",
"=",
"message",
".",
"params",
"[",
":",
"5",
"]",
"self",
".",
"_channel_modes",
"=",
"set",
"(",
"ch... | Basic server information. | [
"Basic",
"server",
"information",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L757-L763 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_301 | async def on_raw_301(self, message):
""" User is away. """
target, nickname, message = message.params
info = {
'away': True,
'away_message': message
}
if nickname in self.users:
self._sync_user(nickname, info)
if nickname in self._pend... | python | async def on_raw_301(self, message):
""" User is away. """
target, nickname, message = message.params
info = {
'away': True,
'away_message': message
}
if nickname in self.users:
self._sync_user(nickname, info)
if nickname in self._pend... | [
"async",
"def",
"on_raw_301",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"nickname",
",",
"message",
"=",
"message",
".",
"params",
"info",
"=",
"{",
"'away'",
":",
"True",
",",
"'away_message'",
":",
"message",
"}",
"if",
"nickname",
"in",
... | User is away. | [
"User",
"is",
"away",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L776-L787 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_311 | async def on_raw_311(self, message):
""" WHOIS user info. """
target, nickname, username, hostname, _, realname = message.params
info = {
'username': username,
'hostname': hostname,
'realname': realname
}
self._sync_user(nickname, info)
... | python | async def on_raw_311(self, message):
""" WHOIS user info. """
target, nickname, username, hostname, _, realname = message.params
info = {
'username': username,
'hostname': hostname,
'realname': realname
}
self._sync_user(nickname, info)
... | [
"async",
"def",
"on_raw_311",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"nickname",
",",
"username",
",",
"hostname",
",",
"_",
",",
"realname",
"=",
"message",
".",
"params",
"info",
"=",
"{",
"'username'",
":",
"username",
",",
"'hostname'"... | WHOIS user info. | [
"WHOIS",
"user",
"info",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L789-L800 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_312 | async def on_raw_312(self, message):
""" WHOIS server info. """
target, nickname, server, serverinfo = message.params
info = {
'server': server,
'server_info': serverinfo
}
if nickname in self._pending['whois']:
self._whois_info[nickname].upda... | python | async def on_raw_312(self, message):
""" WHOIS server info. """
target, nickname, server, serverinfo = message.params
info = {
'server': server,
'server_info': serverinfo
}
if nickname in self._pending['whois']:
self._whois_info[nickname].upda... | [
"async",
"def",
"on_raw_312",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"nickname",
",",
"server",
",",
"serverinfo",
"=",
"message",
".",
"params",
"info",
"=",
"{",
"'server'",
":",
"server",
",",
"'server_info'",
":",
"serverinfo",
"}",
"i... | WHOIS server info. | [
"WHOIS",
"server",
"info",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L802-L813 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_313 | async def on_raw_313(self, message):
""" WHOIS operator info. """
target, nickname = message.params[:2]
info = {
'oper': True
}
if nickname in self._pending['whois']:
self._whois_info[nickname].update(info) | python | async def on_raw_313(self, message):
""" WHOIS operator info. """
target, nickname = message.params[:2]
info = {
'oper': True
}
if nickname in self._pending['whois']:
self._whois_info[nickname].update(info) | [
"async",
"def",
"on_raw_313",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"nickname",
"=",
"message",
".",
"params",
"[",
":",
"2",
"]",
"info",
"=",
"{",
"'oper'",
":",
"True",
"}",
"if",
"nickname",
"in",
"self",
".",
"_pending",
"[",
"... | WHOIS operator info. | [
"WHOIS",
"operator",
"info",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L815-L823 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_314 | async def on_raw_314(self, message):
""" WHOWAS user info. """
target, nickname, username, hostname, _, realname = message.params
info = {
'username': username,
'hostname': hostname,
'realname': realname
}
if nickname in self._pending['whowas'... | python | async def on_raw_314(self, message):
""" WHOWAS user info. """
target, nickname, username, hostname, _, realname = message.params
info = {
'username': username,
'hostname': hostname,
'realname': realname
}
if nickname in self._pending['whowas'... | [
"async",
"def",
"on_raw_314",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"nickname",
",",
"username",
",",
"hostname",
",",
"_",
",",
"realname",
"=",
"message",
".",
"params",
"info",
"=",
"{",
"'username'",
":",
"username",
",",
"'hostname'"... | WHOWAS user info. | [
"WHOWAS",
"user",
"info",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L825-L835 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_317 | async def on_raw_317(self, message):
""" WHOIS idle time. """
target, nickname, idle_time = message.params[:3]
info = {
'idle': int(idle_time),
}
if nickname in self._pending['whois']:
self._whois_info[nickname].update(info) | python | async def on_raw_317(self, message):
""" WHOIS idle time. """
target, nickname, idle_time = message.params[:3]
info = {
'idle': int(idle_time),
}
if nickname in self._pending['whois']:
self._whois_info[nickname].update(info) | [
"async",
"def",
"on_raw_317",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"nickname",
",",
"idle_time",
"=",
"message",
".",
"params",
"[",
":",
"3",
"]",
"info",
"=",
"{",
"'idle'",
":",
"int",
"(",
"idle_time",
")",
",",
"}",
"if",
"nic... | WHOIS idle time. | [
"WHOIS",
"idle",
"time",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L839-L847 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_319 | async def on_raw_319(self, message):
""" WHOIS active channels. """
target, nickname, channels = message.params[:3]
channels = {channel.lstrip() for channel in channels.strip().split(' ')}
info = {
'channels': channels
}
if nickname in self._pending['whois']:... | python | async def on_raw_319(self, message):
""" WHOIS active channels. """
target, nickname, channels = message.params[:3]
channels = {channel.lstrip() for channel in channels.strip().split(' ')}
info = {
'channels': channels
}
if nickname in self._pending['whois']:... | [
"async",
"def",
"on_raw_319",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"nickname",
",",
"channels",
"=",
"message",
".",
"params",
"[",
":",
"3",
"]",
"channels",
"=",
"{",
"channel",
".",
"lstrip",
"(",
")",
"for",
"channel",
"in",
"cha... | WHOIS active channels. | [
"WHOIS",
"active",
"channels",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L858-L867 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_324 | async def on_raw_324(self, message):
""" Channel mode. """
target, channel = message.params[:2]
modes = message.params[2:]
if not self.in_channel(channel):
return
self.channels[channel]['modes'] = self._parse_channel_modes(channel, modes) | python | async def on_raw_324(self, message):
""" Channel mode. """
target, channel = message.params[:2]
modes = message.params[2:]
if not self.in_channel(channel):
return
self.channels[channel]['modes'] = self._parse_channel_modes(channel, modes) | [
"async",
"def",
"on_raw_324",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"channel",
"=",
"message",
".",
"params",
"[",
":",
"2",
"]",
"modes",
"=",
"message",
".",
"params",
"[",
"2",
":",
"]",
"if",
"not",
"self",
".",
"in_channel",
"(... | Channel mode. | [
"Channel",
"mode",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L869-L876 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_329 | async def on_raw_329(self, message):
""" Channel creation time. """
target, channel, timestamp = message.params
if not self.in_channel(channel):
return
self.channels[channel]['created'] = datetime.datetime.fromtimestamp(int(timestamp)) | python | async def on_raw_329(self, message):
""" Channel creation time. """
target, channel, timestamp = message.params
if not self.in_channel(channel):
return
self.channels[channel]['created'] = datetime.datetime.fromtimestamp(int(timestamp)) | [
"async",
"def",
"on_raw_329",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"channel",
",",
"timestamp",
"=",
"message",
".",
"params",
"if",
"not",
"self",
".",
"in_channel",
"(",
"channel",
")",
":",
"return",
"self",
".",
"channels",
"[",
"c... | Channel creation time. | [
"Channel",
"creation",
"time",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L878-L884 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_332 | async def on_raw_332(self, message):
""" Current topic on channel join. """
target, channel, topic = message.params
if not self.in_channel(channel):
return
self.channels[channel]['topic'] = topic | python | async def on_raw_332(self, message):
""" Current topic on channel join. """
target, channel, topic = message.params
if not self.in_channel(channel):
return
self.channels[channel]['topic'] = topic | [
"async",
"def",
"on_raw_332",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"channel",
",",
"topic",
"=",
"message",
".",
"params",
"if",
"not",
"self",
".",
"in_channel",
"(",
"channel",
")",
":",
"return",
"self",
".",
"channels",
"[",
"chann... | Current topic on channel join. | [
"Current",
"topic",
"on",
"channel",
"join",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L886-L892 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_333 | async def on_raw_333(self, message):
""" Topic setter and time on channel join. """
target, channel, setter, timestamp = message.params
if not self.in_channel(channel):
return
# No need to sync user since this is most likely outdated info.
self.channels[channel]['top... | python | async def on_raw_333(self, message):
""" Topic setter and time on channel join. """
target, channel, setter, timestamp = message.params
if not self.in_channel(channel):
return
# No need to sync user since this is most likely outdated info.
self.channels[channel]['top... | [
"async",
"def",
"on_raw_333",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"channel",
",",
"setter",
",",
"timestamp",
"=",
"message",
".",
"params",
"if",
"not",
"self",
".",
"in_channel",
"(",
"channel",
")",
":",
"return",
"self",
".",
"cha... | Topic setter and time on channel join. | [
"Topic",
"setter",
"and",
"time",
"on",
"channel",
"join",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L894-L902 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_375 | async def on_raw_375(self, message):
""" Start message of the day. """
await self._registration_completed(message)
self.motd = message.params[1] + '\n' | python | async def on_raw_375(self, message):
""" Start message of the day. """
await self._registration_completed(message)
self.motd = message.params[1] + '\n' | [
"async",
"def",
"on_raw_375",
"(",
"self",
",",
"message",
")",
":",
"await",
"self",
".",
"_registration_completed",
"(",
"message",
")",
"self",
".",
"motd",
"=",
"message",
".",
"params",
"[",
"1",
"]",
"+",
"'\\n'"
] | Start message of the day. | [
"Start",
"message",
"of",
"the",
"day",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L944-L947 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_422 | async def on_raw_422(self, message):
""" MOTD is missing. """
await self._registration_completed(message)
self.motd = None
await self.on_connect() | python | async def on_raw_422(self, message):
""" MOTD is missing. """
await self._registration_completed(message)
self.motd = None
await self.on_connect() | [
"async",
"def",
"on_raw_422",
"(",
"self",
",",
"message",
")",
":",
"await",
"self",
".",
"_registration_completed",
"(",
"message",
")",
"self",
".",
"motd",
"=",
"None",
"await",
"self",
".",
"on_connect",
"(",
")"
] | MOTD is missing. | [
"MOTD",
"is",
"missing",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L974-L978 | train |
Shizmob/pydle | pydle/features/rfc1459/client.py | RFC1459Support.on_raw_433 | async def on_raw_433(self, message):
""" Nickname in use. """
if not self.registered:
self._registration_attempts += 1
# Attempt to set new nickname.
if self._attempt_nicknames:
await self.set_nickname(self._attempt_nicknames.pop(0))
else:
... | python | async def on_raw_433(self, message):
""" Nickname in use. """
if not self.registered:
self._registration_attempts += 1
# Attempt to set new nickname.
if self._attempt_nicknames:
await self.set_nickname(self._attempt_nicknames.pop(0))
else:
... | [
"async",
"def",
"on_raw_433",
"(",
"self",
",",
"message",
")",
":",
"if",
"not",
"self",
".",
"registered",
":",
"self",
".",
"_registration_attempts",
"+=",
"1",
"if",
"self",
".",
"_attempt_nicknames",
":",
"await",
"self",
".",
"set_nickname",
"(",
"se... | Nickname in use. | [
"Nickname",
"in",
"use",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L990-L999 | train |
Shizmob/pydle | pydle/features/tls.py | TLSSupport.connect | async def connect(self, hostname=None, port=None, tls=False, **kwargs):
""" Connect to a server, optionally over TLS. See pydle.features.RFC1459Support.connect for misc parameters. """
if not port:
if tls:
port = DEFAULT_TLS_PORT
else:
port = rfc14... | python | async def connect(self, hostname=None, port=None, tls=False, **kwargs):
""" Connect to a server, optionally over TLS. See pydle.features.RFC1459Support.connect for misc parameters. """
if not port:
if tls:
port = DEFAULT_TLS_PORT
else:
port = rfc14... | [
"async",
"def",
"connect",
"(",
"self",
",",
"hostname",
"=",
"None",
",",
"port",
"=",
"None",
",",
"tls",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"port",
":",
"if",
"tls",
":",
"port",
"=",
"DEFAULT_TLS_PORT",
"else",
":",
"port... | Connect to a server, optionally over TLS. See pydle.features.RFC1459Support.connect for misc parameters. | [
"Connect",
"to",
"a",
"server",
"optionally",
"over",
"TLS",
".",
"See",
"pydle",
".",
"features",
".",
"RFC1459Support",
".",
"connect",
"for",
"misc",
"parameters",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/tls.py#L28-L35 | train |
Shizmob/pydle | pydle/features/tls.py | TLSSupport._connect | async def _connect(self, hostname, port, reconnect=False, password=None, encoding=pydle.protocol.DEFAULT_ENCODING, channels=[], tls=False, tls_verify=False, source_address=None):
""" Connect to IRC server, optionally over TLS. """
self.password = password
# Create connection if we can't reuse i... | python | async def _connect(self, hostname, port, reconnect=False, password=None, encoding=pydle.protocol.DEFAULT_ENCODING, channels=[], tls=False, tls_verify=False, source_address=None):
""" Connect to IRC server, optionally over TLS. """
self.password = password
# Create connection if we can't reuse i... | [
"async",
"def",
"_connect",
"(",
"self",
",",
"hostname",
",",
"port",
",",
"reconnect",
"=",
"False",
",",
"password",
"=",
"None",
",",
"encoding",
"=",
"pydle",
".",
"protocol",
".",
"DEFAULT_ENCODING",
",",
"channels",
"=",
"[",
"]",
",",
"tls",
"=... | Connect to IRC server, optionally over TLS. | [
"Connect",
"to",
"IRC",
"server",
"optionally",
"over",
"TLS",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/tls.py#L37-L54 | train |
Shizmob/pydle | pydle/client.py | BasicClient._reset_attributes | def _reset_attributes(self):
""" Reset attributes. """
# Record-keeping.
self.channels = {}
self.users = {}
# Low-level data stuff.
self._receive_buffer = b''
self._pending = {}
self._handler_top_level = False
self._ping_checker_handle = None
... | python | def _reset_attributes(self):
""" Reset attributes. """
# Record-keeping.
self.channels = {}
self.users = {}
# Low-level data stuff.
self._receive_buffer = b''
self._pending = {}
self._handler_top_level = False
self._ping_checker_handle = None
... | [
"def",
"_reset_attributes",
"(",
"self",
")",
":",
"self",
".",
"channels",
"=",
"{",
"}",
"self",
".",
"users",
"=",
"{",
"}",
"self",
".",
"_receive_buffer",
"=",
"b''",
"self",
".",
"_pending",
"=",
"{",
"}",
"self",
".",
"_handler_top_level",
"=",
... | Reset attributes. | [
"Reset",
"attributes",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L59-L76 | train |
Shizmob/pydle | pydle/client.py | BasicClient._reset_connection_attributes | def _reset_connection_attributes(self):
""" Reset connection attributes. """
self.connection = None
self.encoding = None
self._autojoin_channels = []
self._reconnect_attempts = 0 | python | def _reset_connection_attributes(self):
""" Reset connection attributes. """
self.connection = None
self.encoding = None
self._autojoin_channels = []
self._reconnect_attempts = 0 | [
"def",
"_reset_connection_attributes",
"(",
"self",
")",
":",
"self",
".",
"connection",
"=",
"None",
"self",
".",
"encoding",
"=",
"None",
"self",
".",
"_autojoin_channels",
"=",
"[",
"]",
"self",
".",
"_reconnect_attempts",
"=",
"0"
] | Reset connection attributes. | [
"Reset",
"connection",
"attributes",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L78-L83 | train |
Shizmob/pydle | pydle/client.py | BasicClient.run | def run(self, *args, **kwargs):
""" Connect and run bot in event loop. """
self.eventloop.run_until_complete(self.connect(*args, **kwargs))
try:
self.eventloop.run_forever()
finally:
self.eventloop.stop() | python | def run(self, *args, **kwargs):
""" Connect and run bot in event loop. """
self.eventloop.run_until_complete(self.connect(*args, **kwargs))
try:
self.eventloop.run_forever()
finally:
self.eventloop.stop() | [
"def",
"run",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"eventloop",
".",
"run_until_complete",
"(",
"self",
".",
"connect",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
")",
"try",
":",
"self",
".",
"eventloop",
"."... | Connect and run bot in event loop. | [
"Connect",
"and",
"run",
"bot",
"in",
"event",
"loop",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L87-L93 | train |
Shizmob/pydle | pydle/client.py | BasicClient.connect | async def connect(self, hostname=None, port=None, reconnect=False, **kwargs):
""" Connect to IRC server. """
if (not hostname or not port) and not reconnect:
raise ValueError('Have to specify hostname and port if not reconnecting.')
# Disconnect from current connection.
if s... | python | async def connect(self, hostname=None, port=None, reconnect=False, **kwargs):
""" Connect to IRC server. """
if (not hostname or not port) and not reconnect:
raise ValueError('Have to specify hostname and port if not reconnecting.')
# Disconnect from current connection.
if s... | [
"async",
"def",
"connect",
"(",
"self",
",",
"hostname",
"=",
"None",
",",
"port",
"=",
"None",
",",
"reconnect",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"if",
"(",
"not",
"hostname",
"or",
"not",
"port",
")",
"and",
"not",
"reconnect",
":",
"... | Connect to IRC server. | [
"Connect",
"to",
"IRC",
"server",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L95-L113 | train |
Shizmob/pydle | pydle/client.py | BasicClient._connect | async def _connect(self, hostname, port, reconnect=False, channels=[],
encoding=protocol.DEFAULT_ENCODING, source_address=None):
""" Connect to IRC host. """
# Create connection if we can't reuse it.
if not reconnect or not self.connection:
self._autojoin_chann... | python | async def _connect(self, hostname, port, reconnect=False, channels=[],
encoding=protocol.DEFAULT_ENCODING, source_address=None):
""" Connect to IRC host. """
# Create connection if we can't reuse it.
if not reconnect or not self.connection:
self._autojoin_chann... | [
"async",
"def",
"_connect",
"(",
"self",
",",
"hostname",
",",
"port",
",",
"reconnect",
"=",
"False",
",",
"channels",
"=",
"[",
"]",
",",
"encoding",
"=",
"protocol",
".",
"DEFAULT_ENCODING",
",",
"source_address",
"=",
"None",
")",
":",
"if",
"not",
... | Connect to IRC host. | [
"Connect",
"to",
"IRC",
"host",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L139-L150 | train |
Shizmob/pydle | pydle/client.py | BasicClient._reconnect_delay | def _reconnect_delay(self):
""" Calculate reconnection delay. """
if self.RECONNECT_ON_ERROR and self.RECONNECT_DELAYED:
if self._reconnect_attempts >= len(self.RECONNECT_DELAYS):
return self.RECONNECT_DELAYS[-1]
else:
return self.RECONNECT_DELAYS[... | python | def _reconnect_delay(self):
""" Calculate reconnection delay. """
if self.RECONNECT_ON_ERROR and self.RECONNECT_DELAYED:
if self._reconnect_attempts >= len(self.RECONNECT_DELAYS):
return self.RECONNECT_DELAYS[-1]
else:
return self.RECONNECT_DELAYS[... | [
"def",
"_reconnect_delay",
"(",
"self",
")",
":",
"if",
"self",
".",
"RECONNECT_ON_ERROR",
"and",
"self",
".",
"RECONNECT_DELAYED",
":",
"if",
"self",
".",
"_reconnect_attempts",
">=",
"len",
"(",
"self",
".",
"RECONNECT_DELAYS",
")",
":",
"return",
"self",
... | Calculate reconnection delay. | [
"Calculate",
"reconnection",
"delay",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L152-L160 | train |
Shizmob/pydle | pydle/client.py | BasicClient._perform_ping_timeout | async def _perform_ping_timeout(self, delay: int):
""" Handle timeout gracefully.
Args:
delay (int): delay before raising the timeout (in seconds)
"""
# pause for delay seconds
await sleep(delay)
# then continue
error = TimeoutError(
'Pin... | python | async def _perform_ping_timeout(self, delay: int):
""" Handle timeout gracefully.
Args:
delay (int): delay before raising the timeout (in seconds)
"""
# pause for delay seconds
await sleep(delay)
# then continue
error = TimeoutError(
'Pin... | [
"async",
"def",
"_perform_ping_timeout",
"(",
"self",
",",
"delay",
":",
"int",
")",
":",
"await",
"sleep",
"(",
"delay",
")",
"error",
"=",
"TimeoutError",
"(",
"'Ping timeout: no data received from server in {timeout} seconds.'",
".",
"format",
"(",
"timeout",
"="... | Handle timeout gracefully.
Args:
delay (int): delay before raising the timeout (in seconds) | [
"Handle",
"timeout",
"gracefully",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L162-L175 | train |
Shizmob/pydle | pydle/client.py | BasicClient.rawmsg | async def rawmsg(self, command, *args, **kwargs):
""" Send raw message. """
message = str(self._create_message(command, *args, **kwargs))
await self._send(message) | python | async def rawmsg(self, command, *args, **kwargs):
""" Send raw message. """
message = str(self._create_message(command, *args, **kwargs))
await self._send(message) | [
"async",
"def",
"rawmsg",
"(",
"self",
",",
"command",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"message",
"=",
"str",
"(",
"self",
".",
"_create_message",
"(",
"command",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
")",
"await",
"self",
".... | Send raw message. | [
"Send",
"raw",
"message",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L311-L314 | train |
Shizmob/pydle | pydle/client.py | BasicClient.handle_forever | async def handle_forever(self):
""" Handle data forever. """
while self.connected:
data = await self.connection.recv()
if not data:
if self.connected:
await self.disconnect(expected=False)
break
await self.on_data(da... | python | async def handle_forever(self):
""" Handle data forever. """
while self.connected:
data = await self.connection.recv()
if not data:
if self.connected:
await self.disconnect(expected=False)
break
await self.on_data(da... | [
"async",
"def",
"handle_forever",
"(",
"self",
")",
":",
"while",
"self",
".",
"connected",
":",
"data",
"=",
"await",
"self",
".",
"connection",
".",
"recv",
"(",
")",
"if",
"not",
"data",
":",
"if",
"self",
".",
"connected",
":",
"await",
"self",
"... | Handle data forever. | [
"Handle",
"data",
"forever",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L365-L373 | train |
Shizmob/pydle | pydle/client.py | BasicClient.on_data_error | async def on_data_error(self, exception):
""" Handle error. """
self.logger.error('Encountered error on socket.',
exc_info=(type(exception), exception, None))
await self.disconnect(expected=False) | python | async def on_data_error(self, exception):
""" Handle error. """
self.logger.error('Encountered error on socket.',
exc_info=(type(exception), exception, None))
await self.disconnect(expected=False) | [
"async",
"def",
"on_data_error",
"(",
"self",
",",
"exception",
")",
":",
"self",
".",
"logger",
".",
"error",
"(",
"'Encountered error on socket.'",
",",
"exc_info",
"=",
"(",
"type",
"(",
"exception",
")",
",",
"exception",
",",
"None",
")",
")",
"await"... | Handle error. | [
"Handle",
"error",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L394-L398 | train |
Shizmob/pydle | pydle/client.py | BasicClient.on_raw | async def on_raw(self, message):
""" Handle a single message. """
self.logger.debug('<< %s', message._raw)
if not message._valid:
self.logger.warning('Encountered strictly invalid IRC message from server: %s',
message._raw)
if isinstance(messa... | python | async def on_raw(self, message):
""" Handle a single message. """
self.logger.debug('<< %s', message._raw)
if not message._valid:
self.logger.warning('Encountered strictly invalid IRC message from server: %s',
message._raw)
if isinstance(messa... | [
"async",
"def",
"on_raw",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'<< %s'",
",",
"message",
".",
"_raw",
")",
"if",
"not",
"message",
".",
"_valid",
":",
"self",
".",
"logger",
".",
"warning",
"(",
"'Encounte... | Handle a single message. | [
"Handle",
"a",
"single",
"message",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L400-L424 | train |
Shizmob/pydle | pydle/client.py | BasicClient.on_unknown | async def on_unknown(self, message):
""" Unknown command. """
self.logger.warning('Unknown command: [%s] %s %s', message.source, message.command,
message.params) | python | async def on_unknown(self, message):
""" Unknown command. """
self.logger.warning('Unknown command: [%s] %s %s', message.source, message.command,
message.params) | [
"async",
"def",
"on_unknown",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"logger",
".",
"warning",
"(",
"'Unknown command: [%s] %s %s'",
",",
"message",
".",
"source",
",",
"message",
".",
"command",
",",
"message",
".",
"params",
")"
] | Unknown command. | [
"Unknown",
"command",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L426-L429 | train |
Shizmob/pydle | pydle/client.py | ClientPool.connect | def connect(self, client: BasicClient, *args, **kwargs):
""" Add client to pool. """
self.clients.add(client)
self.connect_args[client] = (args, kwargs)
# hack the clients event loop to use the pools own event loop
client.eventloop = self.eventloop | python | def connect(self, client: BasicClient, *args, **kwargs):
""" Add client to pool. """
self.clients.add(client)
self.connect_args[client] = (args, kwargs)
# hack the clients event loop to use the pools own event loop
client.eventloop = self.eventloop | [
"def",
"connect",
"(",
"self",
",",
"client",
":",
"BasicClient",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"clients",
".",
"add",
"(",
"client",
")",
"self",
".",
"connect_args",
"[",
"client",
"]",
"=",
"(",
"args",
",",
"kwar... | Add client to pool. | [
"Add",
"client",
"to",
"pool",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L460-L465 | train |
Shizmob/pydle | pydle/client.py | ClientPool.disconnect | def disconnect(self, client):
""" Remove client from pool. """
self.clients.remove(client)
del self.connect_args[client]
client.disconnect() | python | def disconnect(self, client):
""" Remove client from pool. """
self.clients.remove(client)
del self.connect_args[client]
client.disconnect() | [
"def",
"disconnect",
"(",
"self",
",",
"client",
")",
":",
"self",
".",
"clients",
".",
"remove",
"(",
"client",
")",
"del",
"self",
".",
"connect_args",
"[",
"client",
"]",
"client",
".",
"disconnect",
"(",
")"
] | Remove client from pool. | [
"Remove",
"client",
"from",
"pool",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L468-L472 | train |
Shizmob/pydle | pydle/features/rfc1459/parsing.py | normalize | def normalize(input, case_mapping=protocol.DEFAULT_CASE_MAPPING):
""" Normalize input according to case mapping. """
if case_mapping not in protocol.CASE_MAPPINGS:
raise pydle.protocol.ProtocolViolation('Unknown case mapping ({})'.format(case_mapping))
input = input.lower()
if case_mapping in ... | python | def normalize(input, case_mapping=protocol.DEFAULT_CASE_MAPPING):
""" Normalize input according to case mapping. """
if case_mapping not in protocol.CASE_MAPPINGS:
raise pydle.protocol.ProtocolViolation('Unknown case mapping ({})'.format(case_mapping))
input = input.lower()
if case_mapping in ... | [
"def",
"normalize",
"(",
"input",
",",
"case_mapping",
"=",
"protocol",
".",
"DEFAULT_CASE_MAPPING",
")",
":",
"if",
"case_mapping",
"not",
"in",
"protocol",
".",
"CASE_MAPPINGS",
":",
"raise",
"pydle",
".",
"protocol",
".",
"ProtocolViolation",
"(",
"'Unknown c... | Normalize input according to case mapping. | [
"Normalize",
"input",
"according",
"to",
"case",
"mapping",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/parsing.py#L134-L146 | train |
Shizmob/pydle | pydle/features/rfc1459/parsing.py | parse_user | def parse_user(raw):
""" Parse nick(!user(@host)?)? structure. """
nick = raw
user = None
host = None
# Attempt to extract host.
if protocol.HOST_SEPARATOR in raw:
raw, host = raw.split(protocol.HOST_SEPARATOR)
# Attempt to extract user.
if protocol.USER_SEPARATOR in raw:
... | python | def parse_user(raw):
""" Parse nick(!user(@host)?)? structure. """
nick = raw
user = None
host = None
# Attempt to extract host.
if protocol.HOST_SEPARATOR in raw:
raw, host = raw.split(protocol.HOST_SEPARATOR)
# Attempt to extract user.
if protocol.USER_SEPARATOR in raw:
... | [
"def",
"parse_user",
"(",
"raw",
")",
":",
"nick",
"=",
"raw",
"user",
"=",
"None",
"host",
"=",
"None",
"if",
"protocol",
".",
"HOST_SEPARATOR",
"in",
"raw",
":",
"raw",
",",
"host",
"=",
"raw",
".",
"split",
"(",
"protocol",
".",
"HOST_SEPARATOR",
... | Parse nick(!user(@host)?)? structure. | [
"Parse",
"nick",
"(",
"!user",
"("
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/parsing.py#L184-L197 | train |
Shizmob/pydle | pydle/features/rfc1459/parsing.py | RFC1459Message.parse | def parse(cls, line, encoding=pydle.protocol.DEFAULT_ENCODING):
"""
Parse given line into IRC message structure.
Returns a Message.
"""
valid = True
# Decode message.
try:
message = line.decode(encoding)
except UnicodeDecodeError:
... | python | def parse(cls, line, encoding=pydle.protocol.DEFAULT_ENCODING):
"""
Parse given line into IRC message structure.
Returns a Message.
"""
valid = True
# Decode message.
try:
message = line.decode(encoding)
except UnicodeDecodeError:
... | [
"def",
"parse",
"(",
"cls",
",",
"line",
",",
"encoding",
"=",
"pydle",
".",
"protocol",
".",
"DEFAULT_ENCODING",
")",
":",
"valid",
"=",
"True",
"try",
":",
"message",
"=",
"line",
".",
"decode",
"(",
"encoding",
")",
"except",
"UnicodeDecodeError",
":"... | Parse given line into IRC message structure.
Returns a Message. | [
"Parse",
"given",
"line",
"into",
"IRC",
"message",
"structure",
".",
"Returns",
"a",
"Message",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/parsing.py#L18-L95 | train |
Shizmob/pydle | pydle/features/rfc1459/parsing.py | RFC1459Message.construct | def construct(self, force=False):
""" Construct a raw IRC message. """
# Sanity check for command.
command = str(self.command)
if not protocol.COMMAND_PATTERN.match(command) and not force:
raise pydle.protocol.ProtocolViolation('The constructed command does not follow the com... | python | def construct(self, force=False):
""" Construct a raw IRC message. """
# Sanity check for command.
command = str(self.command)
if not protocol.COMMAND_PATTERN.match(command) and not force:
raise pydle.protocol.ProtocolViolation('The constructed command does not follow the com... | [
"def",
"construct",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"command",
"=",
"str",
"(",
"self",
".",
"command",
")",
"if",
"not",
"protocol",
".",
"COMMAND_PATTERN",
".",
"match",
"(",
"command",
")",
"and",
"not",
"force",
":",
"raise",
"... | Construct a raw IRC message. | [
"Construct",
"a",
"raw",
"IRC",
"message",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/parsing.py#L97-L131 | train |
Shizmob/pydle | pydle/__init__.py | featurize | def featurize(*features):
""" Put features into proper MRO order. """
from functools import cmp_to_key
def compare_subclass(left, right):
if issubclass(left, right):
return -1
elif issubclass(right, left):
return 1
return 0
sorted_features = sorted(featu... | python | def featurize(*features):
""" Put features into proper MRO order. """
from functools import cmp_to_key
def compare_subclass(left, right):
if issubclass(left, right):
return -1
elif issubclass(right, left):
return 1
return 0
sorted_features = sorted(featu... | [
"def",
"featurize",
"(",
"*",
"features",
")",
":",
"from",
"functools",
"import",
"cmp_to_key",
"def",
"compare_subclass",
"(",
"left",
",",
"right",
")",
":",
"if",
"issubclass",
"(",
"left",
",",
"right",
")",
":",
"return",
"-",
"1",
"elif",
"issubcl... | Put features into proper MRO order. | [
"Put",
"features",
"into",
"proper",
"MRO",
"order",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/__init__.py#L16-L30 | train |
Shizmob/pydle | pydle/features/whox.py | WHOXSupport.on_raw_join | async def on_raw_join(self, message):
""" Override JOIN to send WHOX. """
await super().on_raw_join(message)
nick, metadata = self._parse_user(message.source)
channels = message.params[0].split(',')
if self.is_same_nick(self.nickname, nick):
# We joined.
... | python | async def on_raw_join(self, message):
""" Override JOIN to send WHOX. """
await super().on_raw_join(message)
nick, metadata = self._parse_user(message.source)
channels = message.params[0].split(',')
if self.is_same_nick(self.nickname, nick):
# We joined.
... | [
"async",
"def",
"on_raw_join",
"(",
"self",
",",
"message",
")",
":",
"await",
"super",
"(",
")",
".",
"on_raw_join",
"(",
"message",
")",
"nick",
",",
"metadata",
"=",
"self",
".",
"_parse_user",
"(",
"message",
".",
"source",
")",
"channels",
"=",
"m... | Override JOIN to send WHOX. | [
"Override",
"JOIN",
"to",
"send",
"WHOX",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/whox.py#L13-L26 | train |
Shizmob/pydle | pydle/features/whox.py | WHOXSupport.on_raw_354 | async def on_raw_354(self, message):
""" WHOX results have arrived. """
# Is the message for us?
target, identifier = message.params[:2]
if identifier != WHOX_IDENTIFIER:
return
# Great. Extract relevant information.
metadata = {
'nickname': messa... | python | async def on_raw_354(self, message):
""" WHOX results have arrived. """
# Is the message for us?
target, identifier = message.params[:2]
if identifier != WHOX_IDENTIFIER:
return
# Great. Extract relevant information.
metadata = {
'nickname': messa... | [
"async",
"def",
"on_raw_354",
"(",
"self",
",",
"message",
")",
":",
"target",
",",
"identifier",
"=",
"message",
".",
"params",
"[",
":",
"2",
"]",
"if",
"identifier",
"!=",
"WHOX_IDENTIFIER",
":",
"return",
"metadata",
"=",
"{",
"'nickname'",
":",
"mes... | WHOX results have arrived. | [
"WHOX",
"results",
"have",
"arrived",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/whox.py#L33-L51 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport._create_channel | def _create_channel(self, channel):
""" Create channel with optional ban and invite exception lists. """
super()._create_channel(channel)
if 'EXCEPTS' in self._isupport:
self.channels[channel]['exceptlist'] = None
if 'INVEX' in self._isupport:
self.channels[channe... | python | def _create_channel(self, channel):
""" Create channel with optional ban and invite exception lists. """
super()._create_channel(channel)
if 'EXCEPTS' in self._isupport:
self.channels[channel]['exceptlist'] = None
if 'INVEX' in self._isupport:
self.channels[channe... | [
"def",
"_create_channel",
"(",
"self",
",",
"channel",
")",
":",
"super",
"(",
")",
".",
"_create_channel",
"(",
"channel",
")",
"if",
"'EXCEPTS'",
"in",
"self",
".",
"_isupport",
":",
"self",
".",
"channels",
"[",
"channel",
"]",
"[",
"'exceptlist'",
"]... | Create channel with optional ban and invite exception lists. | [
"Create",
"channel",
"with",
"optional",
"ban",
"and",
"invite",
"exception",
"lists",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L27-L33 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_raw_005 | async def on_raw_005(self, message):
""" ISUPPORT indication. """
isupport = {}
# Parse response.
# Strip target (first argument) and 'are supported by this server' (last argument).
for feature in message.params[1:-1]:
if feature.startswith(FEATURE_DISABLED_PREFIX):
... | python | async def on_raw_005(self, message):
""" ISUPPORT indication. """
isupport = {}
# Parse response.
# Strip target (first argument) and 'are supported by this server' (last argument).
for feature in message.params[1:-1]:
if feature.startswith(FEATURE_DISABLED_PREFIX):
... | [
"async",
"def",
"on_raw_005",
"(",
"self",
",",
"message",
")",
":",
"isupport",
"=",
"{",
"}",
"for",
"feature",
"in",
"message",
".",
"params",
"[",
"1",
":",
"-",
"1",
"]",
":",
"if",
"feature",
".",
"startswith",
"(",
"FEATURE_DISABLED_PREFIX",
")"... | ISUPPORT indication. | [
"ISUPPORT",
"indication",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L38-L65 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_casemapping | async def on_isupport_casemapping(self, value):
""" IRC case mapping for nickname and channel name comparisons. """
if value in rfc1459.protocol.CASE_MAPPINGS:
self._case_mapping = value
self.channels = rfc1459.parsing.NormalizingDict(self.channels, case_mapping=value)
... | python | async def on_isupport_casemapping(self, value):
""" IRC case mapping for nickname and channel name comparisons. """
if value in rfc1459.protocol.CASE_MAPPINGS:
self._case_mapping = value
self.channels = rfc1459.parsing.NormalizingDict(self.channels, case_mapping=value)
... | [
"async",
"def",
"on_isupport_casemapping",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"in",
"rfc1459",
".",
"protocol",
".",
"CASE_MAPPINGS",
":",
"self",
".",
"_case_mapping",
"=",
"value",
"self",
".",
"channels",
"=",
"rfc1459",
".",
"parsing",
... | IRC case mapping for nickname and channel name comparisons. | [
"IRC",
"case",
"mapping",
"for",
"nickname",
"and",
"channel",
"name",
"comparisons",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L74-L79 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_chanlimit | async def on_isupport_chanlimit(self, value):
""" Simultaneous channel limits for user. """
self._channel_limits = {}
for entry in value.split(','):
types, limit = entry.split(':')
# Assign limit to channel type group and add lookup entry for type.
self._cha... | python | async def on_isupport_chanlimit(self, value):
""" Simultaneous channel limits for user. """
self._channel_limits = {}
for entry in value.split(','):
types, limit = entry.split(':')
# Assign limit to channel type group and add lookup entry for type.
self._cha... | [
"async",
"def",
"on_isupport_chanlimit",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_channel_limits",
"=",
"{",
"}",
"for",
"entry",
"in",
"value",
".",
"split",
"(",
"','",
")",
":",
"types",
",",
"limit",
"=",
"entry",
".",
"split",
"(",
"'... | Simultaneous channel limits for user. | [
"Simultaneous",
"channel",
"limits",
"for",
"user",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L85-L95 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_chanmodes | async def on_isupport_chanmodes(self, value):
""" Valid channel modes and their behaviour. """
list, param, param_set, noparams = [ set(modes) for modes in value.split(',')[:4] ]
self._channel_modes.update(set(value.replace(',', '')))
# The reason we have to do it like this is because o... | python | async def on_isupport_chanmodes(self, value):
""" Valid channel modes and their behaviour. """
list, param, param_set, noparams = [ set(modes) for modes in value.split(',')[:4] ]
self._channel_modes.update(set(value.replace(',', '')))
# The reason we have to do it like this is because o... | [
"async",
"def",
"on_isupport_chanmodes",
"(",
"self",
",",
"value",
")",
":",
"list",
",",
"param",
",",
"param_set",
",",
"noparams",
"=",
"[",
"set",
"(",
"modes",
")",
"for",
"modes",
"in",
"value",
".",
"split",
"(",
"','",
")",
"[",
":",
"4",
... | Valid channel modes and their behaviour. | [
"Valid",
"channel",
"modes",
"and",
"their",
"behaviour",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L97-L117 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_excepts | async def on_isupport_excepts(self, value):
""" Server allows ban exceptions. """
if not value:
value = BAN_EXCEPT_MODE
self._channel_modes.add(value)
self._channel_modes_behaviour[rfc1459.protocol.BEHAVIOUR_LIST].add(value) | python | async def on_isupport_excepts(self, value):
""" Server allows ban exceptions. """
if not value:
value = BAN_EXCEPT_MODE
self._channel_modes.add(value)
self._channel_modes_behaviour[rfc1459.protocol.BEHAVIOUR_LIST].add(value) | [
"async",
"def",
"on_isupport_excepts",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"value",
":",
"value",
"=",
"BAN_EXCEPT_MODE",
"self",
".",
"_channel_modes",
".",
"add",
"(",
"value",
")",
"self",
".",
"_channel_modes_behaviour",
"[",
"rfc1459",
"."... | Server allows ban exceptions. | [
"Server",
"allows",
"ban",
"exceptions",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L125-L130 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_extban | async def on_isupport_extban(self, value):
""" Extended ban prefixes. """
self._extban_prefix, types = value.split(',')
self._extban_types = set(types) | python | async def on_isupport_extban(self, value):
""" Extended ban prefixes. """
self._extban_prefix, types = value.split(',')
self._extban_types = set(types) | [
"async",
"def",
"on_isupport_extban",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_extban_prefix",
",",
"types",
"=",
"value",
".",
"split",
"(",
"','",
")",
"self",
".",
"_extban_types",
"=",
"set",
"(",
"types",
")"
] | Extended ban prefixes. | [
"Extended",
"ban",
"prefixes",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L132-L135 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_invex | async def on_isupport_invex(self, value):
""" Server allows invite exceptions. """
if not value:
value = INVITE_EXCEPT_MODE
self._channel_modes.add(value)
self._channel_modes_behaviour[rfc1459.protocol.BEHAVIOUR_LIST].add(value) | python | async def on_isupport_invex(self, value):
""" Server allows invite exceptions. """
if not value:
value = INVITE_EXCEPT_MODE
self._channel_modes.add(value)
self._channel_modes_behaviour[rfc1459.protocol.BEHAVIOUR_LIST].add(value) | [
"async",
"def",
"on_isupport_invex",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"value",
":",
"value",
"=",
"INVITE_EXCEPT_MODE",
"self",
".",
"_channel_modes",
".",
"add",
"(",
"value",
")",
"self",
".",
"_channel_modes_behaviour",
"[",
"rfc1459",
".... | Server allows invite exceptions. | [
"Server",
"allows",
"invite",
"exceptions",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L137-L142 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_maxbans | async def on_isupport_maxbans(self, value):
""" Maximum entries in ban list. Replaced by MAXLIST. """
if 'MAXLIST' not in self._isupport:
if not self._list_limits:
self._list_limits = {}
self._list_limits['b'] = int(value) | python | async def on_isupport_maxbans(self, value):
""" Maximum entries in ban list. Replaced by MAXLIST. """
if 'MAXLIST' not in self._isupport:
if not self._list_limits:
self._list_limits = {}
self._list_limits['b'] = int(value) | [
"async",
"def",
"on_isupport_maxbans",
"(",
"self",
",",
"value",
")",
":",
"if",
"'MAXLIST'",
"not",
"in",
"self",
".",
"_isupport",
":",
"if",
"not",
"self",
".",
"_list_limits",
":",
"self",
".",
"_list_limits",
"=",
"{",
"}",
"self",
".",
"_list_limi... | Maximum entries in ban list. Replaced by MAXLIST. | [
"Maximum",
"entries",
"in",
"ban",
"list",
".",
"Replaced",
"by",
"MAXLIST",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L144-L149 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_maxchannels | async def on_isupport_maxchannels(self, value):
""" Old version of CHANLIMIT. """
if 'CHANTYPES' in self._isupport and 'CHANLIMIT' not in self._isupport:
self._channel_limits = {}
prefixes = self._isupport['CHANTYPES']
# Assume the limit is for all types of channels.... | python | async def on_isupport_maxchannels(self, value):
""" Old version of CHANLIMIT. """
if 'CHANTYPES' in self._isupport and 'CHANLIMIT' not in self._isupport:
self._channel_limits = {}
prefixes = self._isupport['CHANTYPES']
# Assume the limit is for all types of channels.... | [
"async",
"def",
"on_isupport_maxchannels",
"(",
"self",
",",
"value",
")",
":",
"if",
"'CHANTYPES'",
"in",
"self",
".",
"_isupport",
"and",
"'CHANLIMIT'",
"not",
"in",
"self",
".",
"_isupport",
":",
"self",
".",
"_channel_limits",
"=",
"{",
"}",
"prefixes",
... | Old version of CHANLIMIT. | [
"Old",
"version",
"of",
"CHANLIMIT",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L151-L160 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_maxlist | async def on_isupport_maxlist(self, value):
""" Limits on channel modes involving lists. """
self._list_limits = {}
for entry in value.split(','):
modes, limit = entry.split(':')
# Assign limit to mode group and add lookup entry for mode.
self._list_limits[f... | python | async def on_isupport_maxlist(self, value):
""" Limits on channel modes involving lists. """
self._list_limits = {}
for entry in value.split(','):
modes, limit = entry.split(':')
# Assign limit to mode group and add lookup entry for mode.
self._list_limits[f... | [
"async",
"def",
"on_isupport_maxlist",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_list_limits",
"=",
"{",
"}",
"for",
"entry",
"in",
"value",
".",
"split",
"(",
"','",
")",
":",
"modes",
",",
"limit",
"=",
"entry",
".",
"split",
"(",
"':'",
... | Limits on channel modes involving lists. | [
"Limits",
"on",
"channel",
"modes",
"involving",
"lists",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L162-L172 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_prefix | async def on_isupport_prefix(self, value):
""" Nickname prefixes on channels and their associated modes. """
if not value:
# No prefixes support.
self._nickname_prefixes = collections.OrderedDict()
return
modes, prefixes = value.lstrip('(').split(')', 1)
... | python | async def on_isupport_prefix(self, value):
""" Nickname prefixes on channels and their associated modes. """
if not value:
# No prefixes support.
self._nickname_prefixes = collections.OrderedDict()
return
modes, prefixes = value.lstrip('(').split(')', 1)
... | [
"async",
"def",
"on_isupport_prefix",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"value",
":",
"self",
".",
"_nickname_prefixes",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"return",
"modes",
",",
"prefixes",
"=",
"value",
".",
"lstrip",
"(",... | Nickname prefixes on channels and their associated modes. | [
"Nickname",
"prefixes",
"on",
"channels",
"and",
"their",
"associated",
"modes",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L194-L211 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_targmax | async def on_isupport_targmax(self, value):
""" The maximum number of targets certain types of commands can affect. """
if not value:
return
for entry in value.split(','):
command, limit = entry.split(':', 1)
if not limit:
continue
... | python | async def on_isupport_targmax(self, value):
""" The maximum number of targets certain types of commands can affect. """
if not value:
return
for entry in value.split(','):
command, limit = entry.split(':', 1)
if not limit:
continue
... | [
"async",
"def",
"on_isupport_targmax",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"value",
":",
"return",
"for",
"entry",
"in",
"value",
".",
"split",
"(",
"','",
")",
":",
"command",
",",
"limit",
"=",
"entry",
".",
"split",
"(",
"':'",
",",
... | The maximum number of targets certain types of commands can affect. | [
"The",
"maximum",
"number",
"of",
"targets",
"certain",
"types",
"of",
"commands",
"can",
"affect",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L217-L226 | train |
Shizmob/pydle | pydle/features/isupport.py | ISUPPORTSupport.on_isupport_wallchops | async def on_isupport_wallchops(self, value):
""" Support for messaging every opped member or higher on a channel. Replaced by STATUSMSG. """
for prefix, mode in self._nickname_prefixes.items():
if mode == 'o':
break
else:
prefix = '@'
self._status... | python | async def on_isupport_wallchops(self, value):
""" Support for messaging every opped member or higher on a channel. Replaced by STATUSMSG. """
for prefix, mode in self._nickname_prefixes.items():
if mode == 'o':
break
else:
prefix = '@'
self._status... | [
"async",
"def",
"on_isupport_wallchops",
"(",
"self",
",",
"value",
")",
":",
"for",
"prefix",
",",
"mode",
"in",
"self",
".",
"_nickname_prefixes",
".",
"items",
"(",
")",
":",
"if",
"mode",
"==",
"'o'",
":",
"break",
"else",
":",
"prefix",
"=",
"'@'"... | Support for messaging every opped member or higher on a channel. Replaced by STATUSMSG. | [
"Support",
"for",
"messaging",
"every",
"opped",
"member",
"or",
"higher",
"on",
"a",
"channel",
".",
"Replaced",
"by",
"STATUSMSG",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/isupport.py#L232-L239 | train |
Shizmob/pydle | pydle/features/ircv3/tags.py | TaggedMessage.parse | def parse(cls, line, encoding=pydle.protocol.DEFAULT_ENCODING):
"""
Parse given line into IRC message structure.
Returns a TaggedMessage.
"""
valid = True
# Decode message.
try:
message = line.decode(encoding)
except UnicodeDecodeError:
... | python | def parse(cls, line, encoding=pydle.protocol.DEFAULT_ENCODING):
"""
Parse given line into IRC message structure.
Returns a TaggedMessage.
"""
valid = True
# Decode message.
try:
message = line.decode(encoding)
except UnicodeDecodeError:
... | [
"def",
"parse",
"(",
"cls",
",",
"line",
",",
"encoding",
"=",
"pydle",
".",
"protocol",
".",
"DEFAULT_ENCODING",
")",
":",
"valid",
"=",
"True",
"try",
":",
"message",
"=",
"line",
".",
"decode",
"(",
"encoding",
")",
"except",
"UnicodeDecodeError",
":"... | Parse given line into IRC message structure.
Returns a TaggedMessage. | [
"Parse",
"given",
"line",
"into",
"IRC",
"message",
"structure",
".",
"Returns",
"a",
"TaggedMessage",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/ircv3/tags.py#L20-L60 | train |
Shizmob/pydle | pydle/features/ircv3/tags.py | TaggedMessage.construct | def construct(self, force=False):
"""
Construct raw IRC message and return it.
"""
message = super().construct(force=force)
# Add tags.
if self.tags:
raw_tags = []
for tag, value in self.tags.items():
if value == True:
... | python | def construct(self, force=False):
"""
Construct raw IRC message and return it.
"""
message = super().construct(force=force)
# Add tags.
if self.tags:
raw_tags = []
for tag, value in self.tags.items():
if value == True:
... | [
"def",
"construct",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"message",
"=",
"super",
"(",
")",
".",
"construct",
"(",
"force",
"=",
"force",
")",
"if",
"self",
".",
"tags",
":",
"raw_tags",
"=",
"[",
"]",
"for",
"tag",
",",
"value",
"i... | Construct raw IRC message and return it. | [
"Construct",
"raw",
"IRC",
"message",
"and",
"return",
"it",
"."
] | 7ec7d65d097318ed0bcdc5d8401470287d8c7cf7 | https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/ircv3/tags.py#L62-L81 | train |
rbaier/python-urltools | urltools/urltools.py | _get_public_suffix_list | def _get_public_suffix_list():
"""Return a set containing all Public Suffixes.
If the env variable PUBLIC_SUFFIX_LIST does not point to a local copy of the
public suffix list it is downloaded into memory each time urltools is
imported.
"""
local_psl = os.environ.get('PUBLIC_SUFFIX_LIST')
if... | python | def _get_public_suffix_list():
"""Return a set containing all Public Suffixes.
If the env variable PUBLIC_SUFFIX_LIST does not point to a local copy of the
public suffix list it is downloaded into memory each time urltools is
imported.
"""
local_psl = os.environ.get('PUBLIC_SUFFIX_LIST')
if... | [
"def",
"_get_public_suffix_list",
"(",
")",
":",
"local_psl",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'PUBLIC_SUFFIX_LIST'",
")",
"if",
"local_psl",
":",
"with",
"codecs",
".",
"open",
"(",
"local_psl",
",",
"'r'",
",",
"'utf-8'",
")",
"as",
"f",
":... | Return a set containing all Public Suffixes.
If the env variable PUBLIC_SUFFIX_LIST does not point to a local copy of the
public suffix list it is downloaded into memory each time urltools is
imported. | [
"Return",
"a",
"set",
"containing",
"all",
"Public",
"Suffixes",
"."
] | 76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1 | https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L26-L44 | train |
rbaier/python-urltools | urltools/urltools.py | normalize | def normalize(url):
"""Normalize a URL.
>>> normalize('hTtp://ExAMPLe.COM:80')
'http://example.com/'
"""
url = url.strip()
if url == '':
return ''
parts = split(url)
if parts.scheme:
netloc = parts.netloc
if parts.scheme in SCHEMES:
path = normalize_p... | python | def normalize(url):
"""Normalize a URL.
>>> normalize('hTtp://ExAMPLe.COM:80')
'http://example.com/'
"""
url = url.strip()
if url == '':
return ''
parts = split(url)
if parts.scheme:
netloc = parts.netloc
if parts.scheme in SCHEMES:
path = normalize_p... | [
"def",
"normalize",
"(",
"url",
")",
":",
"url",
"=",
"url",
".",
"strip",
"(",
")",
"if",
"url",
"==",
"''",
":",
"return",
"''",
"parts",
"=",
"split",
"(",
"url",
")",
"if",
"parts",
".",
"scheme",
":",
"netloc",
"=",
"parts",
".",
"netloc",
... | Normalize a URL.
>>> normalize('hTtp://ExAMPLe.COM:80')
'http://example.com/' | [
"Normalize",
"a",
"URL",
"."
] | 76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1 | https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L78-L107 | train |
rbaier/python-urltools | urltools/urltools.py | _encode_query | def _encode_query(query):
"""Quote all values of a query string."""
if query == '':
return query
query_args = []
for query_kv in query.split('&'):
k, v = query_kv.split('=')
query_args.append(k + "=" + quote(v.encode('utf-8')))
return '&'.join(query_args) | python | def _encode_query(query):
"""Quote all values of a query string."""
if query == '':
return query
query_args = []
for query_kv in query.split('&'):
k, v = query_kv.split('=')
query_args.append(k + "=" + quote(v.encode('utf-8')))
return '&'.join(query_args) | [
"def",
"_encode_query",
"(",
"query",
")",
":",
"if",
"query",
"==",
"''",
":",
"return",
"query",
"query_args",
"=",
"[",
"]",
"for",
"query_kv",
"in",
"query",
".",
"split",
"(",
"'&'",
")",
":",
"k",
",",
"v",
"=",
"query_kv",
".",
"split",
"(",... | Quote all values of a query string. | [
"Quote",
"all",
"values",
"of",
"a",
"query",
"string",
"."
] | 76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1 | https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L123-L131 | train |
rbaier/python-urltools | urltools/urltools.py | encode | def encode(url):
"""Encode URL."""
parts = extract(url)
return construct(URL(parts.scheme,
parts.username,
parts.password,
_idna_encode(parts.subdomain),
_idna_encode(parts.domain),
_... | python | def encode(url):
"""Encode URL."""
parts = extract(url)
return construct(URL(parts.scheme,
parts.username,
parts.password,
_idna_encode(parts.subdomain),
_idna_encode(parts.domain),
_... | [
"def",
"encode",
"(",
"url",
")",
":",
"parts",
"=",
"extract",
"(",
"url",
")",
"return",
"construct",
"(",
"URL",
"(",
"parts",
".",
"scheme",
",",
"parts",
".",
"username",
",",
"parts",
".",
"password",
",",
"_idna_encode",
"(",
"parts",
".",
"su... | Encode URL. | [
"Encode",
"URL",
"."
] | 76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1 | https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L134-L147 | train |
rbaier/python-urltools | urltools/urltools.py | construct | def construct(parts):
"""Construct a new URL from parts."""
url = ''
if parts.scheme:
if parts.scheme in SCHEMES:
url += parts.scheme + '://'
else:
url += parts.scheme + ':'
if parts.username and parts.password:
url += parts.username + ':' + parts.password... | python | def construct(parts):
"""Construct a new URL from parts."""
url = ''
if parts.scheme:
if parts.scheme in SCHEMES:
url += parts.scheme + '://'
else:
url += parts.scheme + ':'
if parts.username and parts.password:
url += parts.username + ':' + parts.password... | [
"def",
"construct",
"(",
"parts",
")",
":",
"url",
"=",
"''",
"if",
"parts",
".",
"scheme",
":",
"if",
"parts",
".",
"scheme",
"in",
"SCHEMES",
":",
"url",
"+=",
"parts",
".",
"scheme",
"+",
"'://'",
"else",
":",
"url",
"+=",
"parts",
".",
"scheme"... | Construct a new URL from parts. | [
"Construct",
"a",
"new",
"URL",
"from",
"parts",
"."
] | 76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1 | https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L150-L175 | train |
rbaier/python-urltools | urltools/urltools.py | _normalize_port | def _normalize_port(scheme, port):
"""Return port if it is not default port, else None.
>>> _normalize_port('http', '80')
>>> _normalize_port('http', '8080')
'8080'
"""
if not scheme:
return port
if port and port != DEFAULT_PORT[scheme]:
return port | python | def _normalize_port(scheme, port):
"""Return port if it is not default port, else None.
>>> _normalize_port('http', '80')
>>> _normalize_port('http', '8080')
'8080'
"""
if not scheme:
return port
if port and port != DEFAULT_PORT[scheme]:
return port | [
"def",
"_normalize_port",
"(",
"scheme",
",",
"port",
")",
":",
"if",
"not",
"scheme",
":",
"return",
"port",
"if",
"port",
"and",
"port",
"!=",
"DEFAULT_PORT",
"[",
"scheme",
"]",
":",
"return",
"port"
] | Return port if it is not default port, else None.
>>> _normalize_port('http', '80')
>>> _normalize_port('http', '8080')
'8080' | [
"Return",
"port",
"if",
"it",
"is",
"not",
"default",
"port",
"else",
"None",
"."
] | 76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1 | https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L189-L200 | train |
rbaier/python-urltools | urltools/urltools.py | unquote | def unquote(text, exceptions=[]):
"""Unquote a text but ignore the exceptions.
>>> unquote('foo%23bar')
'foo#bar'
>>> unquote('foo%23bar', ['#'])
'foo%23bar'
"""
if not text:
if text is None:
raise TypeError('None object cannot be unquoted')
else:
ret... | python | def unquote(text, exceptions=[]):
"""Unquote a text but ignore the exceptions.
>>> unquote('foo%23bar')
'foo#bar'
>>> unquote('foo%23bar', ['#'])
'foo%23bar'
"""
if not text:
if text is None:
raise TypeError('None object cannot be unquoted')
else:
ret... | [
"def",
"unquote",
"(",
"text",
",",
"exceptions",
"=",
"[",
"]",
")",
":",
"if",
"not",
"text",
":",
"if",
"text",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'None object cannot be unquoted'",
")",
"else",
":",
"return",
"text",
"if",
"'%'",
"not",
... | Unquote a text but ignore the exceptions.
>>> unquote('foo%23bar')
'foo#bar'
>>> unquote('foo%23bar', ['#'])
'foo%23bar' | [
"Unquote",
"a",
"text",
"but",
"ignore",
"the",
"exceptions",
"."
] | 76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1 | https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L246-L272 | train |
rbaier/python-urltools | urltools/urltools.py | split | def split(url):
"""Split URL into scheme, netloc, path, query and fragment.
>>> split('http://www.example.com/abc?x=1&y=2#foo')
SplitResult(scheme='http', netloc='www.example.com', path='/abc', query='x=1&y=2', fragment='foo')
"""
scheme = netloc = path = query = fragment = ''
ip6_start = url.f... | python | def split(url):
"""Split URL into scheme, netloc, path, query and fragment.
>>> split('http://www.example.com/abc?x=1&y=2#foo')
SplitResult(scheme='http', netloc='www.example.com', path='/abc', query='x=1&y=2', fragment='foo')
"""
scheme = netloc = path = query = fragment = ''
ip6_start = url.f... | [
"def",
"split",
"(",
"url",
")",
":",
"scheme",
"=",
"netloc",
"=",
"path",
"=",
"query",
"=",
"fragment",
"=",
"''",
"ip6_start",
"=",
"url",
".",
"find",
"(",
"'['",
")",
"scheme_end",
"=",
"url",
".",
"find",
"(",
"':'",
")",
"if",
"ip6_start",
... | Split URL into scheme, netloc, path, query and fragment.
>>> split('http://www.example.com/abc?x=1&y=2#foo')
SplitResult(scheme='http', netloc='www.example.com', path='/abc', query='x=1&y=2', fragment='foo') | [
"Split",
"URL",
"into",
"scheme",
"netloc",
"path",
"query",
"and",
"fragment",
"."
] | 76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1 | https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L313-L370 | train |
rbaier/python-urltools | urltools/urltools.py | split_netloc | def split_netloc(netloc):
"""Split netloc into username, password, host and port.
>>> split_netloc('foo:bar@www.example.com:8080')
('foo', 'bar', 'www.example.com', '8080')
"""
username = password = host = port = ''
if '@' in netloc:
user_pw, netloc = netloc.split('@', 1)
if ':'... | python | def split_netloc(netloc):
"""Split netloc into username, password, host and port.
>>> split_netloc('foo:bar@www.example.com:8080')
('foo', 'bar', 'www.example.com', '8080')
"""
username = password = host = port = ''
if '@' in netloc:
user_pw, netloc = netloc.split('@', 1)
if ':'... | [
"def",
"split_netloc",
"(",
"netloc",
")",
":",
"username",
"=",
"password",
"=",
"host",
"=",
"port",
"=",
"''",
"if",
"'@'",
"in",
"netloc",
":",
"user_pw",
",",
"netloc",
"=",
"netloc",
".",
"split",
"(",
"'@'",
",",
"1",
")",
"if",
"':'",
"in",... | Split netloc into username, password, host and port.
>>> split_netloc('foo:bar@www.example.com:8080')
('foo', 'bar', 'www.example.com', '8080') | [
"Split",
"netloc",
"into",
"username",
"password",
"host",
"and",
"port",
"."
] | 76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1 | https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L385-L403 | train |
rbaier/python-urltools | urltools/urltools.py | split_host | def split_host(host):
"""Use the Public Suffix List to split host into subdomain, domain and tld.
>>> split_host('foo.bar.co.uk')
('foo', 'bar', 'co.uk')
"""
# host is IPv6?
if '[' in host:
return '', host, ''
# host is IPv4?
for c in host:
if c not in IP_CHARS:
... | python | def split_host(host):
"""Use the Public Suffix List to split host into subdomain, domain and tld.
>>> split_host('foo.bar.co.uk')
('foo', 'bar', 'co.uk')
"""
# host is IPv6?
if '[' in host:
return '', host, ''
# host is IPv4?
for c in host:
if c not in IP_CHARS:
... | [
"def",
"split_host",
"(",
"host",
")",
":",
"if",
"'['",
"in",
"host",
":",
"return",
"''",
",",
"host",
",",
"''",
"for",
"c",
"in",
"host",
":",
"if",
"c",
"not",
"in",
"IP_CHARS",
":",
"break",
"else",
":",
"return",
"''",
",",
"host",
",",
... | Use the Public Suffix List to split host into subdomain, domain and tld.
>>> split_host('foo.bar.co.uk')
('foo', 'bar', 'co.uk') | [
"Use",
"the",
"Public",
"Suffix",
"List",
"to",
"split",
"host",
"into",
"subdomain",
"domain",
"and",
"tld",
"."
] | 76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1 | https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L406-L441 | train |
mvn23/pyotgw | pyotgw/protocol.py | protocol.connection_made | def connection_made(self, transport):
"""
Gets called when a connection to the gateway is established.
Initialise the protocol object.
"""
self.transport = transport
self.loop = transport.loop
self._cmd_lock = asyncio.Lock(loop=self.loop)
self._wd_lock = a... | python | def connection_made(self, transport):
"""
Gets called when a connection to the gateway is established.
Initialise the protocol object.
"""
self.transport = transport
self.loop = transport.loop
self._cmd_lock = asyncio.Lock(loop=self.loop)
self._wd_lock = a... | [
"def",
"connection_made",
"(",
"self",
",",
"transport",
")",
":",
"self",
".",
"transport",
"=",
"transport",
"self",
".",
"loop",
"=",
"transport",
".",
"loop",
"self",
".",
"_cmd_lock",
"=",
"asyncio",
".",
"Lock",
"(",
"loop",
"=",
"self",
".",
"lo... | Gets called when a connection to the gateway is established.
Initialise the protocol object. | [
"Gets",
"called",
"when",
"a",
"connection",
"to",
"the",
"gateway",
"is",
"established",
".",
"Initialise",
"the",
"protocol",
"object",
"."
] | 7612378ef4332b250176505af33e7536d6c9da78 | https://github.com/mvn23/pyotgw/blob/7612378ef4332b250176505af33e7536d6c9da78/pyotgw/protocol.py#L36-L55 | train |
mvn23/pyotgw | pyotgw/protocol.py | protocol.connection_lost | def connection_lost(self, exc):
"""
Gets called when the connection to the gateway is lost.
Tear down and clean up the protocol object.
"""
_LOGGER.error("Disconnected: %s", exc)
self.connected = False
self.transport.close()
if self._report_task is not Non... | python | def connection_lost(self, exc):
"""
Gets called when the connection to the gateway is lost.
Tear down and clean up the protocol object.
"""
_LOGGER.error("Disconnected: %s", exc)
self.connected = False
self.transport.close()
if self._report_task is not Non... | [
"def",
"connection_lost",
"(",
"self",
",",
"exc",
")",
":",
"_LOGGER",
".",
"error",
"(",
"\"Disconnected: %s\"",
",",
"exc",
")",
"self",
".",
"connected",
"=",
"False",
"self",
".",
"transport",
".",
"close",
"(",
")",
"if",
"self",
".",
"_report_task... | Gets called when the connection to the gateway is lost.
Tear down and clean up the protocol object. | [
"Gets",
"called",
"when",
"the",
"connection",
"to",
"the",
"gateway",
"is",
"lost",
".",
"Tear",
"down",
"and",
"clean",
"up",
"the",
"protocol",
"object",
"."
] | 7612378ef4332b250176505af33e7536d6c9da78 | https://github.com/mvn23/pyotgw/blob/7612378ef4332b250176505af33e7536d6c9da78/pyotgw/protocol.py#L57-L71 | train |
mvn23/pyotgw | pyotgw/protocol.py | protocol.setup_watchdog | async def setup_watchdog(self, cb, timeout):
"""Trigger a reconnect after @timeout seconds of inactivity."""
self._watchdog_timeout = timeout
self._watchdog_cb = cb
self._watchdog_task = self.loop.create_task(self._watchdog(timeout)) | python | async def setup_watchdog(self, cb, timeout):
"""Trigger a reconnect after @timeout seconds of inactivity."""
self._watchdog_timeout = timeout
self._watchdog_cb = cb
self._watchdog_task = self.loop.create_task(self._watchdog(timeout)) | [
"async",
"def",
"setup_watchdog",
"(",
"self",
",",
"cb",
",",
"timeout",
")",
":",
"self",
".",
"_watchdog_timeout",
"=",
"timeout",
"self",
".",
"_watchdog_cb",
"=",
"cb",
"self",
".",
"_watchdog_task",
"=",
"self",
".",
"loop",
".",
"create_task",
"(",
... | Trigger a reconnect after @timeout seconds of inactivity. | [
"Trigger",
"a",
"reconnect",
"after"
] | 7612378ef4332b250176505af33e7536d6c9da78 | https://github.com/mvn23/pyotgw/blob/7612378ef4332b250176505af33e7536d6c9da78/pyotgw/protocol.py#L96-L100 | train |
mvn23/pyotgw | pyotgw/protocol.py | protocol.cancel_watchdog | async def cancel_watchdog(self):
"""Cancel the watchdog task and related variables."""
if self._watchdog_task is not None:
_LOGGER.debug("Canceling Watchdog task.")
self._watchdog_task.cancel()
try:
await self._watchdog_task
except asyncio.... | python | async def cancel_watchdog(self):
"""Cancel the watchdog task and related variables."""
if self._watchdog_task is not None:
_LOGGER.debug("Canceling Watchdog task.")
self._watchdog_task.cancel()
try:
await self._watchdog_task
except asyncio.... | [
"async",
"def",
"cancel_watchdog",
"(",
"self",
")",
":",
"if",
"self",
".",
"_watchdog_task",
"is",
"not",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Canceling Watchdog task.\"",
")",
"self",
".",
"_watchdog_task",
".",
"cancel",
"(",
")",
"try",
":",
... | Cancel the watchdog task and related variables. | [
"Cancel",
"the",
"watchdog",
"task",
"and",
"related",
"variables",
"."
] | 7612378ef4332b250176505af33e7536d6c9da78 | https://github.com/mvn23/pyotgw/blob/7612378ef4332b250176505af33e7536d6c9da78/pyotgw/protocol.py#L102-L110 | train |
mvn23/pyotgw | pyotgw/protocol.py | protocol._inform_watchdog | async def _inform_watchdog(self):
"""Inform the watchdog of activity."""
async with self._wd_lock:
if self._watchdog_task is None:
# Check within the Lock to deal with external cancel_watchdog
# calls with queued _inform_watchdog tasks.
return
... | python | async def _inform_watchdog(self):
"""Inform the watchdog of activity."""
async with self._wd_lock:
if self._watchdog_task is None:
# Check within the Lock to deal with external cancel_watchdog
# calls with queued _inform_watchdog tasks.
return
... | [
"async",
"def",
"_inform_watchdog",
"(",
"self",
")",
":",
"async",
"with",
"self",
".",
"_wd_lock",
":",
"if",
"self",
".",
"_watchdog_task",
"is",
"None",
":",
"return",
"self",
".",
"_watchdog_task",
".",
"cancel",
"(",
")",
"try",
":",
"await",
"self... | Inform the watchdog of activity. | [
"Inform",
"the",
"watchdog",
"of",
"activity",
"."
] | 7612378ef4332b250176505af33e7536d6c9da78 | https://github.com/mvn23/pyotgw/blob/7612378ef4332b250176505af33e7536d6c9da78/pyotgw/protocol.py#L112-L124 | train |
mvn23/pyotgw | pyotgw/protocol.py | protocol._watchdog | async def _watchdog(self, timeout):
"""Trigger and cancel the watchdog after timeout. Call callback."""
await asyncio.sleep(timeout, loop=self.loop)
_LOGGER.debug("Watchdog triggered!")
await self.cancel_watchdog()
await self._watchdog_cb() | python | async def _watchdog(self, timeout):
"""Trigger and cancel the watchdog after timeout. Call callback."""
await asyncio.sleep(timeout, loop=self.loop)
_LOGGER.debug("Watchdog triggered!")
await self.cancel_watchdog()
await self._watchdog_cb() | [
"async",
"def",
"_watchdog",
"(",
"self",
",",
"timeout",
")",
":",
"await",
"asyncio",
".",
"sleep",
"(",
"timeout",
",",
"loop",
"=",
"self",
".",
"loop",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Watchdog triggered!\"",
")",
"await",
"self",
".",
"cancel_... | Trigger and cancel the watchdog after timeout. Call callback. | [
"Trigger",
"and",
"cancel",
"the",
"watchdog",
"after",
"timeout",
".",
"Call",
"callback",
"."
] | 7612378ef4332b250176505af33e7536d6c9da78 | https://github.com/mvn23/pyotgw/blob/7612378ef4332b250176505af33e7536d6c9da78/pyotgw/protocol.py#L126-L131 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.