mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Continue accelerating the 2to3 step (remove fix_funcattrs, fix_itertools, and fix_itertools_imports).
This commit is contained in:
parent
35a62b4e77
commit
1fbdedc7e0
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import random
|
import random
|
||||||
from itertools import imap
|
|
||||||
|
|
||||||
import supybot.utils as utils
|
import supybot.utils as utils
|
||||||
from supybot.commands import *
|
from supybot.commands import *
|
||||||
@ -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) = imap(int, m.groups())
|
(dice, sides) = 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:
|
||||||
|
@ -34,7 +34,7 @@ import imp
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
from itertools import ifilter
|
|
||||||
|
|
||||||
import supybot
|
import supybot
|
||||||
|
|
||||||
@ -52,6 +52,9 @@ from supybot import commands
|
|||||||
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
||||||
_ = PluginInternationalization('Misc')
|
_ = PluginInternationalization('Misc')
|
||||||
|
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
|
from itertools import ifilter as filter
|
||||||
|
|
||||||
def get_suffix(file):
|
def get_suffix(file):
|
||||||
for suffix in imp.get_suffixes():
|
for suffix in imp.get_suffixes():
|
||||||
if file[-len(suffix[0]):] == suffix[0]:
|
if file[-len(suffix[0]):] == suffix[0]:
|
||||||
@ -446,7 +449,7 @@ class Misc(callbacks.Plugin):
|
|||||||
predicates.setdefault('regexp', []).append(f)
|
predicates.setdefault('regexp', []).append(f)
|
||||||
elif option == 'nolimit':
|
elif option == 'nolimit':
|
||||||
nolimit = True
|
nolimit = True
|
||||||
iterable = ifilter(self._validLastMsg, reversed(irc.state.history))
|
iterable = filter(self._validLastMsg, reversed(irc.state.history))
|
||||||
if skipfirst:
|
if skipfirst:
|
||||||
# Drop the first message only if our current channel is the same as
|
# Drop the first message only if our current channel is the same as
|
||||||
# the channel we've been instructed to look at.
|
# the channel we've been instructed to look at.
|
||||||
|
3
setup.py
3
setup.py
@ -150,9 +150,8 @@ try:
|
|||||||
|
|
||||||
fixer_names = ['fix_basestring',
|
fixer_names = ['fix_basestring',
|
||||||
'fix_dict',
|
'fix_dict',
|
||||||
'fix_funcattrs',
|
|
||||||
'fix_imports',
|
'fix_imports',
|
||||||
'fix_itertools', 'fix_itertools_imports', 'fix_long',
|
'fix_long',
|
||||||
'fix_map', 'fix_metaclass', 'fix_methodattrs',
|
'fix_map', 'fix_metaclass', 'fix_methodattrs',
|
||||||
'fix_numliterals',
|
'fix_numliterals',
|
||||||
'fix_types',
|
'fix_types',
|
||||||
|
@ -131,7 +131,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
|||||||
while msgs[-1] is not None:
|
while msgs[-1] is not None:
|
||||||
msgs.append(self.irc.takeMsg())
|
msgs.append(self.irc.takeMsg())
|
||||||
del msgs[-1]
|
del msgs[-1]
|
||||||
self.outbuffer += ''.join(imap(str, msgs))
|
self.outbuffer += ''.join(map(str, msgs))
|
||||||
if self.outbuffer:
|
if self.outbuffer:
|
||||||
try:
|
try:
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
|
@ -150,7 +150,7 @@ class CapabilitySet(set):
|
|||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '%s([%s])' % (self.__class__.__name__,
|
return '%s([%s])' % (self.__class__.__name__,
|
||||||
', '.join(imap(repr, self)))
|
', '.join(map(repr, self)))
|
||||||
|
|
||||||
antiOwner = makeAntiCapability('owner')
|
antiOwner = makeAntiCapability('owner')
|
||||||
class UserCapabilitySet(CapabilitySet):
|
class UserCapabilitySet(CapabilitySet):
|
||||||
|
@ -49,7 +49,7 @@ from cStringIO import StringIO as sio
|
|||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
from . import minisix
|
from . import minisix
|
||||||
from itertools import imap
|
|
||||||
|
|
||||||
def debug(s, *args):
|
def debug(s, *args):
|
||||||
"""Prints a debug string. Most likely replaced by our logging debug."""
|
"""Prints a debug string. Most likely replaced by our logging debug."""
|
||||||
@ -525,7 +525,7 @@ def unDccIP(i):
|
|||||||
L.append(i % 256)
|
L.append(i % 256)
|
||||||
i //= 256
|
i //= 256
|
||||||
L.reverse()
|
L.reverse()
|
||||||
return '.'.join(imap(str, L))
|
return '.'.join(map(str, L))
|
||||||
|
|
||||||
class IrcString(str):
|
class IrcString(str):
|
||||||
"""This class does case-insensitive comparison and hashing of nicks."""
|
"""This class does case-insensitive comparison and hashing of nicks."""
|
||||||
|
@ -105,7 +105,7 @@ def nonCommentLines(fd):
|
|||||||
yield line
|
yield line
|
||||||
|
|
||||||
def nonEmptyLines(fd):
|
def nonEmptyLines(fd):
|
||||||
return ifilter(str.strip, fd)
|
return filter(str.strip, fd)
|
||||||
|
|
||||||
def nonCommentNonEmptyLines(fd):
|
def nonCommentNonEmptyLines(fd):
|
||||||
return nonEmptyLines(nonCommentLines(fd))
|
return nonEmptyLines(nonCommentLines(fd))
|
||||||
|
@ -38,7 +38,7 @@ import types
|
|||||||
import textwrap
|
import textwrap
|
||||||
import traceback
|
import traceback
|
||||||
import collections
|
import collections
|
||||||
from itertools import imap
|
|
||||||
|
|
||||||
from . import crypt
|
from . import crypt
|
||||||
from .str import format
|
from .str import format
|
||||||
@ -302,7 +302,7 @@ class InsensitivePreservingDict(collections.MutableMapping):
|
|||||||
|
|
||||||
class NormalizingSet(set):
|
class NormalizingSet(set):
|
||||||
def __init__(self, iterable=()):
|
def __init__(self, iterable=()):
|
||||||
iterable = imap(self.normalize, iterable)
|
iterable = map(self.normalize, iterable)
|
||||||
super(NormalizingSet, self).__init__(iterable)
|
super(NormalizingSet, self).__init__(iterable)
|
||||||
|
|
||||||
def normalize(self, x):
|
def normalize(self, x):
|
||||||
|
@ -36,8 +36,9 @@ from itertools import *
|
|||||||
|
|
||||||
# For old plugins
|
# For old plugins
|
||||||
ifilter = filter
|
ifilter = filter
|
||||||
def ifilterfalse(p, L):
|
def filterfalse(p, L):
|
||||||
return ifilter(lambda x:not p(x), L)
|
return filter(lambda x:not p(x), L)
|
||||||
|
ifilterfalse = filterfalse
|
||||||
imap = map
|
imap = map
|
||||||
|
|
||||||
def len(iterable):
|
def len(iterable):
|
||||||
@ -70,14 +71,14 @@ def partition(p, iterable):
|
|||||||
|
|
||||||
def any(p, iterable):
|
def any(p, iterable):
|
||||||
"""Returns true if any element in iterable satisfies predicate p."""
|
"""Returns true if any element in iterable satisfies predicate p."""
|
||||||
for elt in ifilter(p, iterable):
|
for elt in filter(p, iterable):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def all(p, iterable):
|
def all(p, iterable):
|
||||||
"""Returns true if all elements in iterable satisfy predicate p."""
|
"""Returns true if all elements in iterable satisfy predicate p."""
|
||||||
for elt in ifilterfalse(p, iterable):
|
for elt in filterfalse(p, iterable):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
@ -34,7 +34,7 @@ Data structures for Python.
|
|||||||
import time
|
import time
|
||||||
import types
|
import types
|
||||||
import collections
|
import collections
|
||||||
from itertools import imap
|
|
||||||
|
|
||||||
class RingBuffer(object):
|
class RingBuffer(object):
|
||||||
"""Class to represent a fixed-size ring buffer."""
|
"""Class to represent a fixed-size ring buffer."""
|
||||||
@ -223,7 +223,7 @@ class queue(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'queue([%s])' % ', '.join(imap(repr, self))
|
return 'queue([%s])' % ', '.join(map(repr, self))
|
||||||
|
|
||||||
def __getitem__(self, oidx):
|
def __getitem__(self, oidx):
|
||||||
if len(self) == 0:
|
if len(self) == 0:
|
||||||
@ -300,7 +300,7 @@ class smallqueue(list):
|
|||||||
return self[0]
|
return self[0]
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'smallqueue([%s])' % ', '.join(imap(repr, self))
|
return 'smallqueue([%s])' % ', '.join(map(repr, self))
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self[:] = []
|
self[:] = []
|
||||||
|
Loading…
Reference in New Issue
Block a user