mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Continue accelerating the 2to3 step (remove fix_map).
This commit is contained in:
parent
1fbdedc7e0
commit
06fdaa792f
@ -351,7 +351,7 @@ class Admin(callbacks.Plugin):
|
|||||||
"""
|
"""
|
||||||
# XXX Add the expirations.
|
# XXX Add the expirations.
|
||||||
if ircdb.ignores.hostmasks:
|
if ircdb.ignores.hostmasks:
|
||||||
irc.reply(format('%L', (map(repr,ircdb.ignores.hostmasks))))
|
irc.reply(format('%L', (list(map(repr,ircdb.ignores.hostmasks)))))
|
||||||
else:
|
else:
|
||||||
irc.reply(_('I\'m not currently globally ignoring anyone.'))
|
irc.reply(_('I\'m not currently globally ignoring anyone.'))
|
||||||
list = wrap(list)
|
list = wrap(list)
|
||||||
|
@ -212,7 +212,7 @@ class RecursiveAlias(AkaError):
|
|||||||
dollarRe = re.compile(r'\$(\d+)')
|
dollarRe = re.compile(r'\$(\d+)')
|
||||||
def findBiggestDollar(alias):
|
def findBiggestDollar(alias):
|
||||||
dollars = dollarRe.findall(alias)
|
dollars = dollarRe.findall(alias)
|
||||||
dollars = map(int, dollars)
|
dollars = list(map(int, dollars))
|
||||||
dollars.sort()
|
dollars.sort()
|
||||||
if dollars:
|
if dollars:
|
||||||
return dollars[-1]
|
return dollars[-1]
|
||||||
@ -222,7 +222,7 @@ def findBiggestDollar(alias):
|
|||||||
atRe = re.compile(r'@(\d+)')
|
atRe = re.compile(r'@(\d+)')
|
||||||
def findBiggestAt(alias):
|
def findBiggestAt(alias):
|
||||||
ats = atRe.findall(alias)
|
ats = atRe.findall(alias)
|
||||||
ats = map(int, ats)
|
ats = list(map(int, ats))
|
||||||
ats.sort()
|
ats.sort()
|
||||||
if ats:
|
if ats:
|
||||||
return ats[-1]
|
return ats[-1]
|
||||||
@ -259,15 +259,15 @@ class Aka(callbacks.Plugin):
|
|||||||
|
|
||||||
def listCommands(self):
|
def listCommands(self):
|
||||||
channel = dynamic.channel or 'global'
|
channel = dynamic.channel or 'global'
|
||||||
return list(set(map(callbacks.formatCommand,
|
return list(set(list(map(callbacks.formatCommand,
|
||||||
self._db.get_aka_list(channel) +
|
self._db.get_aka_list(channel) +
|
||||||
self._db.get_aka_list('global')) +
|
self._db.get_aka_list('global'))) +
|
||||||
['add', 'remove', 'lock', 'unlock', 'importaliasdatabase']))
|
['add', 'remove', 'lock', 'unlock', 'importaliasdatabase']))
|
||||||
|
|
||||||
def getCommand(self, args, check_other_plugins=True):
|
def getCommand(self, args, check_other_plugins=True):
|
||||||
canonicalName = callbacks.canonicalName
|
canonicalName = callbacks.canonicalName
|
||||||
# All the code from here to the 'for' loop is copied from callbacks.py
|
# All the code from here to the 'for' loop is copied from callbacks.py
|
||||||
assert args == map(canonicalName, args)
|
assert args == list(map(canonicalName, args))
|
||||||
first = args[0]
|
first = args[0]
|
||||||
for cb in self.cbs:
|
for cb in self.cbs:
|
||||||
if first == cb.canonicalName():
|
if first == cb.canonicalName():
|
||||||
@ -302,7 +302,7 @@ class Aka(callbacks.Plugin):
|
|||||||
args = getArgs(args, required=biggestDollar, optional=biggestAt,
|
args = getArgs(args, required=biggestDollar, optional=biggestAt,
|
||||||
wildcard=wildcard)
|
wildcard=wildcard)
|
||||||
max_len = conf.supybot.reply.maximumLength()
|
max_len = conf.supybot.reply.maximumLength()
|
||||||
args = list(map(lambda x:x[:max_len], args))
|
args = list([x[:max_len] for x in args])
|
||||||
def regexpReplace(m):
|
def regexpReplace(m):
|
||||||
idx = int(m.group(1))
|
idx = int(m.group(1))
|
||||||
return args[idx-1]
|
return args[idx-1]
|
||||||
@ -512,7 +512,7 @@ class Aka(callbacks.Plugin):
|
|||||||
if errors:
|
if errors:
|
||||||
irc.error(format(_('Error occured when importing the %n: %L'),
|
irc.error(format(_('Error occured when importing the %n: %L'),
|
||||||
(len(errors), 'following', 'command'),
|
(len(errors), 'following', 'command'),
|
||||||
map(lambda x:'%s (%s)' % x, errors.items())))
|
['%s (%s)' % x for x in errors.items()]))
|
||||||
else:
|
else:
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
importaliasdatabase = wrap(importaliasdatabase, ['owner'])
|
importaliasdatabase = wrap(importaliasdatabase, ['owner'])
|
||||||
|
@ -87,7 +87,7 @@ class RecursiveAlias(AliasError):
|
|||||||
dollarRe = re.compile(r'\$(\d+)')
|
dollarRe = re.compile(r'\$(\d+)')
|
||||||
def findBiggestDollar(alias):
|
def findBiggestDollar(alias):
|
||||||
dollars = dollarRe.findall(alias)
|
dollars = dollarRe.findall(alias)
|
||||||
dollars = map(int, dollars)
|
dollars = list(map(int, dollars))
|
||||||
dollars.sort()
|
dollars.sort()
|
||||||
if dollars:
|
if dollars:
|
||||||
return dollars[-1]
|
return dollars[-1]
|
||||||
@ -97,7 +97,7 @@ def findBiggestDollar(alias):
|
|||||||
atRe = re.compile(r'@(\d+)')
|
atRe = re.compile(r'@(\d+)')
|
||||||
def findBiggestAt(alias):
|
def findBiggestAt(alias):
|
||||||
ats = atRe.findall(alias)
|
ats = atRe.findall(alias)
|
||||||
ats = map(int, ats)
|
ats = list(map(int, ats))
|
||||||
ats.sort()
|
ats.sort()
|
||||||
if ats:
|
if ats:
|
||||||
return ats[-1]
|
return ats[-1]
|
||||||
@ -179,7 +179,7 @@ def makeNewAlias(name, alias):
|
|||||||
args = getArgs(args, required=biggestDollar, optional=biggestAt,
|
args = getArgs(args, required=biggestDollar, optional=biggestAt,
|
||||||
wildcard=wildcard)
|
wildcard=wildcard)
|
||||||
max_len = conf.supybot.reply.maximumLength()
|
max_len = conf.supybot.reply.maximumLength()
|
||||||
args = list(map(lambda x:x[:max_len], args))
|
args = list([x[:max_len] for x in args])
|
||||||
def regexpReplace(m):
|
def regexpReplace(m):
|
||||||
idx = int(m.group(1))
|
idx = int(m.group(1))
|
||||||
return args[idx-1]
|
return args[idx-1]
|
||||||
|
@ -667,7 +667,7 @@ class Channel(callbacks.Plugin):
|
|||||||
irc.reply(s)
|
irc.reply(s)
|
||||||
else:
|
else:
|
||||||
L = sorted(c.ignores)
|
L = sorted(c.ignores)
|
||||||
irc.reply(utils.str.commaAndify(map(repr, L)))
|
irc.reply(utils.str.commaAndify(list(map(repr, L))))
|
||||||
list = wrap(list, ['op'])
|
list = wrap(list, ['op'])
|
||||||
|
|
||||||
class capability(callbacks.Commands):
|
class capability(callbacks.Commands):
|
||||||
|
@ -135,7 +135,7 @@ class StatsDB(plugins.ChannelUserDB):
|
|||||||
return v.values()
|
return v.values()
|
||||||
|
|
||||||
def deserialize(self, channel, id, L):
|
def deserialize(self, channel, id, L):
|
||||||
L = map(int, L)
|
L = list(map(int, L))
|
||||||
if id == 'channelStats':
|
if id == 'channelStats':
|
||||||
return ChannelStat(*L)
|
return ChannelStat(*L)
|
||||||
else:
|
else:
|
||||||
|
@ -62,7 +62,7 @@ class Games(callbacks.Plugin):
|
|||||||
For example, 2d6 will roll 2 six-sided dice; 10d10 will roll 10
|
For example, 2d6 will roll 2 six-sided dice; 10d10 will roll 10
|
||||||
ten-sided dice.
|
ten-sided dice.
|
||||||
"""
|
"""
|
||||||
(dice, sides) = map(int, m.groups())
|
(dice, sides) = list(map(int, m.groups()))
|
||||||
if dice > 1000:
|
if dice > 1000:
|
||||||
irc.error(_('You can\'t roll more than 1000 dice.'))
|
irc.error(_('You can\'t roll more than 1000 dice.'))
|
||||||
elif sides > 100:
|
elif sides > 100:
|
||||||
|
@ -143,7 +143,7 @@ class Google(callbacks.PluginRegexp):
|
|||||||
results.append(url)
|
results.append(url)
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
repl = lambda x:x if isinstance(x, unicode) else unicode(x, 'utf8')
|
repl = lambda x:x if isinstance(x, unicode) else unicode(x, 'utf8')
|
||||||
results = map(repl, results)
|
results = list(map(repl, results))
|
||||||
if not results:
|
if not results:
|
||||||
return [_('No matches found.')]
|
return [_('No matches found.')]
|
||||||
elif onetoone:
|
elif onetoone:
|
||||||
|
@ -88,12 +88,12 @@ class SqliteKarmaDB(object):
|
|||||||
if len(results) == 0:
|
if len(results) == 0:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return map(int, results[0])
|
return list(map(int, results[0]))
|
||||||
|
|
||||||
def gets(self, channel, things):
|
def gets(self, channel, things):
|
||||||
db = self._getDb(channel)
|
db = self._getDb(channel)
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
normalizedThings = dict(list(zip(map(lambda s: s.lower(), things), things)))
|
normalizedThings = dict(list(zip([s.lower() for s in things], things)))
|
||||||
criteria = ' OR '.join(['normalized=?'] * len(normalizedThings))
|
criteria = ' OR '.join(['normalized=?'] * len(normalizedThings))
|
||||||
sql = """SELECT name, added-subtracted FROM karma
|
sql = """SELECT name, added-subtracted FROM karma
|
||||||
WHERE %s ORDER BY added-subtracted DESC""" % criteria
|
WHERE %s ORDER BY added-subtracted DESC""" % criteria
|
||||||
|
@ -56,7 +56,7 @@ class Lart(plugins.ChannelIdDatabasePlugin):
|
|||||||
only necessary if the message isn't sent in the channel itself.
|
only necessary if the message isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
if ' for ' in text:
|
if ' for ' in text:
|
||||||
(target, reason) = map(str.strip, text.split(' for ', 1))
|
(target, reason) = list(map(str.strip, text.split(' for ', 1)))
|
||||||
else:
|
else:
|
||||||
(target, reason) = (text, '')
|
(target, reason) = (text, '')
|
||||||
if id is not None:
|
if id is not None:
|
||||||
|
@ -308,7 +308,7 @@ class Math(callbacks.Plugin):
|
|||||||
if len(stack) == 1:
|
if len(stack) == 1:
|
||||||
irc.reply(str(self._complexToString(complex(stack[0]))))
|
irc.reply(str(self._complexToString(complex(stack[0]))))
|
||||||
else:
|
else:
|
||||||
s = ', '.join(map(self._complexToString, map(complex, stack)))
|
s = ', '.join(map(self._complexToString, list(map(complex, stack))))
|
||||||
irc.reply(_('Stack: [%s]') % s)
|
irc.reply(_('Stack: [%s]') % s)
|
||||||
|
|
||||||
@internationalizeDocstring
|
@internationalizeDocstring
|
||||||
|
@ -161,7 +161,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
cursor.execute("SELECT regexp, action FROM triggers")
|
cursor.execute("SELECT regexp, action FROM triggers")
|
||||||
# Fetch results and prepend channel name or 'global'. This
|
# Fetch results and prepend channel name or 'global'. This
|
||||||
# prevents duplicating the following lines.
|
# prevents duplicating the following lines.
|
||||||
results.extend(map(lambda x: (channel,)+x, cursor.fetchall()))
|
results.extend([(channel,)+x for x in cursor.fetchall()])
|
||||||
if len(results) == 0:
|
if len(results) == 0:
|
||||||
return
|
return
|
||||||
max_triggers = self.registryValue('maxTriggers', channel)
|
max_triggers = self.registryValue('maxTriggers', channel)
|
||||||
@ -206,7 +206,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
cursor.execute("SELECT id, usage_count, locked FROM triggers WHERE regexp=?", (regexp,))
|
cursor.execute("SELECT id, usage_count, locked FROM triggers WHERE regexp=?", (regexp,))
|
||||||
results = cursor.fetchall()
|
results = cursor.fetchall()
|
||||||
if len(results) != 0:
|
if len(results) != 0:
|
||||||
(id, usage_count, locked) = map(int, results[0])
|
(id, usage_count, locked) = list(map(int, results[0]))
|
||||||
else:
|
else:
|
||||||
locked = 0
|
locked = 0
|
||||||
usage_count = 0
|
usage_count = 0
|
||||||
@ -252,7 +252,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
cursor.execute(sql, (regexp,))
|
cursor.execute(sql, (regexp,))
|
||||||
results = cursor.fetchall()
|
results = cursor.fetchall()
|
||||||
if len(results) != 0:
|
if len(results) != 0:
|
||||||
(id, locked) = map(int, results[0])
|
(id, locked) = list(map(int, results[0]))
|
||||||
else:
|
else:
|
||||||
irc.error(_('There is no such regexp trigger.'))
|
irc.error(_('There is no such regexp trigger.'))
|
||||||
return
|
return
|
||||||
|
@ -285,7 +285,7 @@ class Misc(callbacks.Plugin):
|
|||||||
You may also want to use the 'list' command to list all available
|
You may also want to use the 'list' command to list all available
|
||||||
plugins and commands.
|
plugins and commands.
|
||||||
"""
|
"""
|
||||||
command = map(callbacks.canonicalName, command)
|
command = list(map(callbacks.canonicalName, command))
|
||||||
(maxL, cbs) = irc.findCallbacksForArgs(command)
|
(maxL, cbs) = irc.findCallbacksForArgs(command)
|
||||||
if maxL == command:
|
if maxL == command:
|
||||||
if len(cbs) > 1:
|
if len(cbs) > 1:
|
||||||
|
@ -54,9 +54,9 @@ class OptionList(object):
|
|||||||
return '(%s' % ''.join(ret) #)
|
return '(%s' % ''.join(ret) #)
|
||||||
elif token == ')':
|
elif token == ')':
|
||||||
if '|' in ret:
|
if '|' in ret:
|
||||||
L = map(''.join,
|
L = list(map(''.join,
|
||||||
utils.iter.split('|'.__eq__, ret,
|
utils.iter.split('|'.__eq__, ret,
|
||||||
yieldEmpty=True))
|
yieldEmpty=True)))
|
||||||
return utils.iter.choice(L)
|
return utils.iter.choice(L)
|
||||||
else:
|
else:
|
||||||
return '(%s)' % ''.join(ret)
|
return '(%s)' % ''.join(ret)
|
||||||
@ -377,7 +377,7 @@ class MoobotFactoids(callbacks.Plugin):
|
|||||||
tokens)
|
tokens)
|
||||||
s = _('Missing an \'is\' or \'_is_\'.')
|
s = _('Missing an \'is\' or \'_is_\'.')
|
||||||
raise ValueError(s)
|
raise ValueError(s)
|
||||||
(key, newfact) = map(' '.join, utils.iter.split(p, tokens, maxsplit=1))
|
(key, newfact) = list(map(' '.join, utils.iter.split(p, tokens, maxsplit=1)))
|
||||||
key = self._sanitizeKey(key)
|
key = self._sanitizeKey(key)
|
||||||
return (key, newfact)
|
return (key, newfact)
|
||||||
|
|
||||||
@ -397,8 +397,8 @@ class MoobotFactoids(callbacks.Plugin):
|
|||||||
|
|
||||||
def changeFactoid(self, irc, msg, tokens):
|
def changeFactoid(self, irc, msg, tokens):
|
||||||
id = self._getUserId(irc, msg.prefix)
|
id = self._getUserId(irc, msg.prefix)
|
||||||
(key, regexp) = map(' '.join,
|
(key, regexp) = list(map(' '.join,
|
||||||
utils.iter.split('=~'.__eq__, tokens, maxsplit=1))
|
utils.iter.split('=~'.__eq__, tokens, maxsplit=1)))
|
||||||
channel = plugins.getChannel(msg.args[0])
|
channel = plugins.getChannel(msg.args[0])
|
||||||
# Check and make sure it's in the DB
|
# Check and make sure it's in the DB
|
||||||
fact = self._getFactoid(irc, channel, key)
|
fact = self._getFactoid(irc, channel, key)
|
||||||
|
@ -98,7 +98,7 @@ class Plugin(callbacks.Plugin):
|
|||||||
plugin = wrap(plugin, [many('something')])
|
plugin = wrap(plugin, [many('something')])
|
||||||
|
|
||||||
def _findCallbacks(self, irc, command):
|
def _findCallbacks(self, irc, command):
|
||||||
command = map(callbacks.canonicalName, command)
|
command = list(map(callbacks.canonicalName, command))
|
||||||
plugin_list = []
|
plugin_list = []
|
||||||
for cb in irc.callbacks:
|
for cb in irc.callbacks:
|
||||||
if not hasattr(cb, 'getCommand'):
|
if not hasattr(cb, 'getCommand'):
|
||||||
|
@ -61,7 +61,7 @@ class Praise(plugins.ChannelIdDatabasePlugin):
|
|||||||
sent in the channel itself.
|
sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
if ' for ' in text:
|
if ' for ' in text:
|
||||||
(target, reason) = map(str.strip, text.split(' for ', 1))
|
(target, reason) = list(map(str.strip, text.split(' for ', 1)))
|
||||||
else:
|
else:
|
||||||
(target, reason) = (text, '')
|
(target, reason) = (text, '')
|
||||||
if ircutils.strEqual(target, irc.nick):
|
if ircutils.strEqual(target, irc.nick):
|
||||||
|
@ -171,8 +171,8 @@ class Relay(callbacks.Plugin):
|
|||||||
utils.sortBy(ircutils.toLower, voices)
|
utils.sortBy(ircutils.toLower, voices)
|
||||||
utils.sortBy(ircutils.toLower, halfops)
|
utils.sortBy(ircutils.toLower, halfops)
|
||||||
utils.sortBy(ircutils.toLower, usersS)
|
utils.sortBy(ircutils.toLower, usersS)
|
||||||
usersS = ', '.join(filter(None, map(', '.join,
|
usersS = ', '.join(filter(None, list(map(', '.join,
|
||||||
(ops,halfops,voices,usersS))))
|
(ops,halfops,voices,usersS)))))
|
||||||
users.append(format('%s (%i): %s',
|
users.append(format('%s (%i): %s',
|
||||||
ircutils.bold(network), numUsers, usersS))
|
ircutils.bold(network), numUsers, usersS))
|
||||||
users.sort()
|
users.sort()
|
||||||
|
@ -369,7 +369,7 @@ class Seen(callbacks.Plugin):
|
|||||||
msgs = [m for m in irc.state.history[i:end]
|
msgs = [m for m in irc.state.history[i:end]
|
||||||
if m.command == 'PRIVMSG' and ircutils.strEqual(m.args[0], channel)]
|
if m.command == 'PRIVMSG' and ircutils.strEqual(m.args[0], channel)]
|
||||||
if msgs:
|
if msgs:
|
||||||
irc.reply(format('%L', map(ircmsgs.prettyPrint, msgs)))
|
irc.reply(format('%L', list(map(ircmsgs.prettyPrint, msgs))))
|
||||||
else:
|
else:
|
||||||
irc.reply(format(_('Either %s didn\'t leave, '
|
irc.reply(format(_('Either %s didn\'t leave, '
|
||||||
'or no messages were sent while %s was gone.'), nick, nick))
|
'or no messages were sent while %s was gone.'), nick, nick))
|
||||||
|
@ -220,7 +220,7 @@ class Unix(callbacks.Plugin):
|
|||||||
(out, err) = inst.communicate()
|
(out, err) = inst.communicate()
|
||||||
inst.wait()
|
inst.wait()
|
||||||
lines = out.splitlines()
|
lines = out.splitlines()
|
||||||
lines = map(str.rstrip, lines)
|
lines = list(map(str.rstrip, lines))
|
||||||
lines = filter(None, lines)
|
lines = filter(None, lines)
|
||||||
irc.replies(lines, joiner=' ')
|
irc.replies(lines, joiner=' ')
|
||||||
else:
|
else:
|
||||||
|
@ -280,7 +280,7 @@ class User(callbacks.Plugin):
|
|||||||
command.
|
command.
|
||||||
"""
|
"""
|
||||||
def getHostmasks(user):
|
def getHostmasks(user):
|
||||||
hostmasks = map(repr, user.hostmasks)
|
hostmasks = list(map(repr, user.hostmasks))
|
||||||
if hostmasks:
|
if hostmasks:
|
||||||
hostmasks.sort()
|
hostmasks.sort()
|
||||||
return format('%L', hostmasks)
|
return format('%L', hostmasks)
|
||||||
@ -507,7 +507,7 @@ class User(callbacks.Plugin):
|
|||||||
prefix, expiry = self._tokens.pop(token)
|
prefix, expiry = self._tokens.pop(token)
|
||||||
found = False
|
found = False
|
||||||
for (id, user) in ircdb.users.items():
|
for (id, user) in ircdb.users.items():
|
||||||
if keyid in map(lambda x:x[-len(keyid):], user.gpgkeys):
|
if keyid in [x[-len(keyid):] for x in user.gpgkeys]:
|
||||||
user.addAuth(msg.prefix)
|
user.addAuth(msg.prefix)
|
||||||
ircdb.users.setUser(user, flush=False)
|
ircdb.users.setUser(user, flush=False)
|
||||||
irc.reply(_('You are now authenticated as %s.') %
|
irc.reply(_('You are now authenticated as %s.') %
|
||||||
|
@ -135,7 +135,7 @@ class Utilities(callbacks.Plugin):
|
|||||||
args = [token and token or '""' for token in rest]
|
args = [token and token or '""' for token in rest]
|
||||||
text = ' '.join(args)
|
text = ' '.join(args)
|
||||||
commands = command.split()
|
commands = command.split()
|
||||||
commands = map(callbacks.canonicalName, commands)
|
commands = list(map(callbacks.canonicalName, commands))
|
||||||
tokens = callbacks.tokenize(text)
|
tokens = callbacks.tokenize(text)
|
||||||
allTokens = commands + tokens
|
allTokens = commands + tokens
|
||||||
self.Proxy(irc, msg, allTokens)
|
self.Proxy(irc, msg, allTokens)
|
||||||
|
2
setup.py
2
setup.py
@ -152,7 +152,7 @@ try:
|
|||||||
'fix_dict',
|
'fix_dict',
|
||||||
'fix_imports',
|
'fix_imports',
|
||||||
'fix_long',
|
'fix_long',
|
||||||
'fix_map', 'fix_metaclass', 'fix_methodattrs',
|
'fix_metaclass', 'fix_methodattrs',
|
||||||
'fix_numliterals',
|
'fix_numliterals',
|
||||||
'fix_types',
|
'fix_types',
|
||||||
'fix_unicode', 'fix_urllib', 'fix_xrange']
|
'fix_unicode', 'fix_urllib', 'fix_xrange']
|
||||||
|
@ -91,7 +91,7 @@ def _addressed(nick, msg, prefixChars=None, nicks=None,
|
|||||||
return payload[1:].strip()
|
return payload[1:].strip()
|
||||||
if nicks is None:
|
if nicks is None:
|
||||||
nicks = get(conf.supybot.reply.whenAddressedBy.nicks)
|
nicks = get(conf.supybot.reply.whenAddressedBy.nicks)
|
||||||
nicks = map(ircutils.toLower, nicks)
|
nicks = list(map(ircutils.toLower, nicks))
|
||||||
else:
|
else:
|
||||||
nicks = list(nicks) # Just in case.
|
nicks = list(nicks) # Just in case.
|
||||||
nicks.insert(0, ircutils.toLower(nick))
|
nicks.insert(0, ircutils.toLower(nick))
|
||||||
@ -738,7 +738,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
|||||||
"""Returns a two-tuple of (command, plugins) that has the command
|
"""Returns a two-tuple of (command, plugins) that has the command
|
||||||
(a list of strings) and the plugins for which it was a command."""
|
(a list of strings) and the plugins for which it was a command."""
|
||||||
assert isinstance(args, list)
|
assert isinstance(args, list)
|
||||||
args = map(canonicalName, args)
|
args = list(map(canonicalName, args))
|
||||||
cbs = []
|
cbs = []
|
||||||
maxL = []
|
maxL = []
|
||||||
for cb in self.irc.callbacks:
|
for cb in self.irc.callbacks:
|
||||||
@ -783,7 +783,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
|||||||
|
|
||||||
# 3. Whether an importantPlugin is one of the responses.
|
# 3. Whether an importantPlugin is one of the responses.
|
||||||
important = defaultPlugins.importantPlugins()
|
important = defaultPlugins.importantPlugins()
|
||||||
important = map(canonicalName, important)
|
important = list(map(canonicalName, important))
|
||||||
importants = []
|
importants = []
|
||||||
for cb in cbs:
|
for cb in cbs:
|
||||||
if cb.canonicalName() in important:
|
if cb.canonicalName() in important:
|
||||||
@ -1188,7 +1188,7 @@ class Commands(BasePlugin):
|
|||||||
return self.getCommand(command) == command
|
return self.getCommand(command) == command
|
||||||
|
|
||||||
def getCommand(self, args, stripOwnName=True):
|
def getCommand(self, args, stripOwnName=True):
|
||||||
assert args == map(canonicalName, args)
|
assert args == list(map(canonicalName, args))
|
||||||
first = args[0]
|
first = args[0]
|
||||||
for cb in self.cbs:
|
for cb in self.cbs:
|
||||||
if first == cb.canonicalName():
|
if first == cb.canonicalName():
|
||||||
@ -1206,7 +1206,7 @@ class Commands(BasePlugin):
|
|||||||
"""Gets the given command from this plugin."""
|
"""Gets the given command from this plugin."""
|
||||||
#print '*** %s.getCommandMethod(%r)' % (self.name(), command)
|
#print '*** %s.getCommandMethod(%r)' % (self.name(), command)
|
||||||
assert not isinstance(command, basestring)
|
assert not isinstance(command, basestring)
|
||||||
assert command == map(canonicalName, command)
|
assert command == list(map(canonicalName, command))
|
||||||
assert self.getCommand(command) == command
|
assert self.getCommand(command) == command
|
||||||
for cb in self.cbs:
|
for cb in self.cbs:
|
||||||
if command[0] == cb.canonicalName():
|
if command[0] == cb.canonicalName():
|
||||||
|
@ -917,7 +917,7 @@ class first(context):
|
|||||||
self.default = kw.pop('default')
|
self.default = kw.pop('default')
|
||||||
assert not kw, 'Bad kwargs for first.__init__'
|
assert not kw, 'Bad kwargs for first.__init__'
|
||||||
self.spec = specs # for __repr__
|
self.spec = specs # for __repr__
|
||||||
self.specs = map(contextify, specs)
|
self.specs = list(map(contextify, specs))
|
||||||
|
|
||||||
def __call__(self, irc, msg, args, state):
|
def __call__(self, irc, msg, args, state):
|
||||||
errored = False
|
errored = False
|
||||||
|
@ -162,7 +162,7 @@ def areReceivers(s, strictRfc=True, nicklen=None, chantypes='#&+!',
|
|||||||
nick = functools.partial(isNick, strictRfc=strictRfc, nicklen=nicklen)
|
nick = functools.partial(isNick, strictRfc=strictRfc, nicklen=nicklen)
|
||||||
chan = functools.partial(isChannel, chantypes=chantypes,
|
chan = functools.partial(isChannel, chantypes=chantypes,
|
||||||
channellen=channellen)
|
channellen=channellen)
|
||||||
return all(map(lambda x:nick(x) or chan(x), s.split(',')))
|
return all([nick(x) or chan(x) for x in s.split(',')])
|
||||||
|
|
||||||
_patternCache = utils.structures.CacheDict(1000)
|
_patternCache = utils.structures.CacheDict(1000)
|
||||||
def _hostmaskPatternEqual(pattern, hostmask):
|
def _hostmaskPatternEqual(pattern, hostmask):
|
||||||
|
@ -169,7 +169,7 @@ def unescape(name):
|
|||||||
|
|
||||||
_splitRe = re.compile(r'(?<!\\)\.')
|
_splitRe = re.compile(r'(?<!\\)\.')
|
||||||
def split(name):
|
def split(name):
|
||||||
return map(unescape, _splitRe.split(name))
|
return list(map(unescape, _splitRe.split(name)))
|
||||||
|
|
||||||
def join(names):
|
def join(names):
|
||||||
return '.'.join(map(escape, names))
|
return '.'.join(map(escape, names))
|
||||||
@ -523,9 +523,9 @@ class OnlySomeStrings(String):
|
|||||||
self.__parent = super(OnlySomeStrings, self)
|
self.__parent = super(OnlySomeStrings, self)
|
||||||
self.__parent.__init__(*args, **kwargs)
|
self.__parent.__init__(*args, **kwargs)
|
||||||
self.__doc__ = format(_('Valid values include %L.'),
|
self.__doc__ = format(_('Valid values include %L.'),
|
||||||
map(repr, self.validStrings))
|
list(map(repr, self.validStrings)))
|
||||||
self.errormsg = format(_('Valid values include %L, not %%r.'),
|
self.errormsg = format(_('Valid values include %L, not %%r.'),
|
||||||
map(repr, self.validStrings))
|
list(map(repr, self.validStrings)))
|
||||||
|
|
||||||
def help(self):
|
def help(self):
|
||||||
strings = [s for s in self.validStrings if s]
|
strings = [s for s in self.validStrings if s]
|
||||||
|
@ -302,7 +302,7 @@ class InsensitivePreservingDict(collections.MutableMapping):
|
|||||||
|
|
||||||
class NormalizingSet(set):
|
class NormalizingSet(set):
|
||||||
def __init__(self, iterable=()):
|
def __init__(self, iterable=()):
|
||||||
iterable = map(self.normalize, iterable)
|
iterable = list(map(self.normalize, iterable))
|
||||||
super(NormalizingSet, self).__init__(iterable)
|
super(NormalizingSet, self).__init__(iterable)
|
||||||
|
|
||||||
def normalize(self, x):
|
def normalize(self, x):
|
||||||
|
@ -138,7 +138,7 @@ class FunctionsTestCase(SupyTestCase):
|
|||||||
':ACTION beats ang senseless with a 50lb Unix manual (#2)',
|
':ACTION beats ang senseless with a 50lb Unix manual (#2)',
|
||||||
':supybot!~supybot@underthemain.net PRIVMSG #sourcereview '
|
':supybot!~supybot@underthemain.net PRIVMSG #sourcereview '
|
||||||
':ACTION resizes angryman\'s terminal to 40x24 (#16)']
|
':ACTION resizes angryman\'s terminal to 40x24 (#16)']
|
||||||
msgs = map(ircmsgs.IrcMsg, L)
|
msgs = list(map(ircmsgs.IrcMsg, L))
|
||||||
for msg in msgs:
|
for msg in msgs:
|
||||||
self.failUnless(ircmsgs.isAction(msg))
|
self.failUnless(ircmsgs.isAction(msg))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user