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