Continue accelerating the 2to3 step (remove fix_nonzero, fix_operator, and fix_paren).

This commit is contained in:
Valentin Lorentz 2014-01-20 15:19:06 +01:00
parent d1649a44ac
commit 529b8f8d99
4 changed files with 10 additions and 6 deletions

View File

@ -154,8 +154,8 @@ try:
'fix_imports',
'fix_itertools', 'fix_itertools_imports', 'fix_long',
'fix_map', 'fix_metaclass', 'fix_methodattrs',
'fix_nonzero', 'fix_numliterals',
'fix_operator', 'fix_paren', 'fix_print', 'fix_raise',
'fix_numliterals',
'fix_print', 'fix_raise',
'fix_reduce', 'fix_renames', 'fix_repr',
'fix_set_literal', 'fix_standarderror', 'fix_sys_exc',
'fix_throw', 'fix_tuple_params', 'fix_types',

View File

@ -205,8 +205,9 @@ class IrcMsgQueue(object):
msg in self.lowpriority or \
msg in self.highpriority
def __nonzero__(self):
def __bool__(self):
return bool(self.highpriority or self.normal or self.lowpriority)
__nonzero__ = __bool__
def __len__(self):
return len(self.highpriority)+len(self.lowpriority)+len(self.normal)

View File

@ -239,10 +239,11 @@ class IterableMap(object):
ret += 1
return ret
def __nonzero__(self):
def __bool__(self):
for _ in self.iteritems():
return True
return False
__nonzero__ = __bool__
class InsensitivePreservingDict(collections.MutableMapping):

View File

@ -76,8 +76,9 @@ class RingBuffer(object):
return True
return False
def __nonzero__(self):
def __bool__(self):
return len(self) > 0
__nonzero__ = __bool__
def __contains__(self, elt):
return elt in self.L
@ -196,8 +197,9 @@ class queue(object):
def __len__(self):
return len(self.front) + len(self.back)
def __nonzero__(self):
def __bool__(self):
return bool(self.back or self.front)
__nonzero__ = __bool__
def __contains__(self, elt):
return elt in self.front or elt in self.back