mirror of https://github.com/python/cpython
Merged revisions 77310-77311 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77310 | antoine.pitrou | 2010-01-05 01:22:44 +0200 (Tue, 05 Jan 2010) | 4 lines Issue #7092: Fix the DeprecationWarnings emitted by the standard library when using the -3 flag. Patch by Florent Xicluna. ........ r77311 | antoine.pitrou | 2010-01-05 01:28:16 +0200 (Tue, 05 Jan 2010) | 3 lines Kill a couple of "<>" ........
This commit is contained in:
parent
8c7fe2d6f9
commit
8dc04a4dd1
|
@ -170,7 +170,8 @@ class _Rlecoderengine:
|
||||||
del self.ofp
|
del self.ofp
|
||||||
|
|
||||||
class BinHex:
|
class BinHex:
|
||||||
def __init__(self, (name, finfo, dlen, rlen), ofp):
|
def __init__(self, name_finfo_dlen_rlen, ofp):
|
||||||
|
name, finfo, dlen, rlen = name_finfo_dlen_rlen
|
||||||
if type(ofp) == type(''):
|
if type(ofp) == type(''):
|
||||||
ofname = ofp
|
ofname = ofp
|
||||||
ofp = open(ofname, 'w')
|
ofp = open(ofname, 'w')
|
||||||
|
|
|
@ -44,7 +44,7 @@ absolute_import = (sys.version_info[0] >= 3)
|
||||||
|
|
||||||
if sys.py3kwarning:
|
if sys.py3kwarning:
|
||||||
import warnings
|
import warnings
|
||||||
warnings.warnpy3k("in 3.x, bsddb has been removed; "
|
warnings.warnpy3k("in 3.x, the bsddb module has been removed; "
|
||||||
"please use the pybsddb project instead",
|
"please use the pybsddb project instead",
|
||||||
DeprecationWarning, 2)
|
DeprecationWarning, 2)
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,9 @@ class Expression(Node):
|
||||||
return "Expression(%s)" % (repr(self.node))
|
return "Expression(%s)" % (repr(self.node))
|
||||||
|
|
||||||
class Add(Node):
|
class Add(Node):
|
||||||
def __init__(self, (left, right), lineno=None):
|
def __init__(self, leftright, lineno=None):
|
||||||
self.left = left
|
self.left = leftright[0]
|
||||||
self.right = right
|
self.right = leftright[1]
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
|
@ -431,9 +431,9 @@ class Discard(Node):
|
||||||
return "Discard(%s)" % (repr(self.expr),)
|
return "Discard(%s)" % (repr(self.expr),)
|
||||||
|
|
||||||
class Div(Node):
|
class Div(Node):
|
||||||
def __init__(self, (left, right), lineno=None):
|
def __init__(self, leftright, lineno=None):
|
||||||
self.left = left
|
self.left = leftright[0]
|
||||||
self.right = right
|
self.right = leftright[1]
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
|
@ -485,9 +485,9 @@ class Exec(Node):
|
||||||
return "Exec(%s, %s, %s)" % (repr(self.expr), repr(self.locals), repr(self.globals))
|
return "Exec(%s, %s, %s)" % (repr(self.expr), repr(self.locals), repr(self.globals))
|
||||||
|
|
||||||
class FloorDiv(Node):
|
class FloorDiv(Node):
|
||||||
def __init__(self, (left, right), lineno=None):
|
def __init__(self, leftright, lineno=None):
|
||||||
self.left = left
|
self.left = leftright[0]
|
||||||
self.right = right
|
self.right = leftright[1]
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
|
@ -560,7 +560,6 @@ class Function(Node):
|
||||||
self.kwargs = 1
|
self.kwargs = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
children = []
|
children = []
|
||||||
children.append(self.decorators)
|
children.append(self.decorators)
|
||||||
|
@ -590,6 +589,7 @@ class GenExpr(Node):
|
||||||
self.argnames = ['.0']
|
self.argnames = ['.0']
|
||||||
self.varargs = self.kwargs = None
|
self.varargs = self.kwargs = None
|
||||||
|
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
return self.code,
|
return self.code,
|
||||||
|
|
||||||
|
@ -607,7 +607,6 @@ class GenExprFor(Node):
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
self.is_outmost = False
|
self.is_outmost = False
|
||||||
|
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
children = []
|
children = []
|
||||||
children.append(self.assign)
|
children.append(self.assign)
|
||||||
|
@ -784,7 +783,6 @@ class Lambda(Node):
|
||||||
self.kwargs = 1
|
self.kwargs = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
children = []
|
children = []
|
||||||
children.append(self.argnames)
|
children.append(self.argnames)
|
||||||
|
@ -803,9 +801,9 @@ class Lambda(Node):
|
||||||
return "Lambda(%s, %s, %s, %s)" % (repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.code))
|
return "Lambda(%s, %s, %s, %s)" % (repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.code))
|
||||||
|
|
||||||
class LeftShift(Node):
|
class LeftShift(Node):
|
||||||
def __init__(self, (left, right), lineno=None):
|
def __init__(self, leftright, lineno=None):
|
||||||
self.left = left
|
self.left = leftright[0]
|
||||||
self.right = right
|
self.right = leftright[1]
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
|
@ -893,9 +891,9 @@ class ListCompIf(Node):
|
||||||
return "ListCompIf(%s)" % (repr(self.test),)
|
return "ListCompIf(%s)" % (repr(self.test),)
|
||||||
|
|
||||||
class Mod(Node):
|
class Mod(Node):
|
||||||
def __init__(self, (left, right), lineno=None):
|
def __init__(self, leftright, lineno=None):
|
||||||
self.left = left
|
self.left = leftright[0]
|
||||||
self.right = right
|
self.right = leftright[1]
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
|
@ -923,9 +921,9 @@ class Module(Node):
|
||||||
return "Module(%s, %s)" % (repr(self.doc), repr(self.node))
|
return "Module(%s, %s)" % (repr(self.doc), repr(self.node))
|
||||||
|
|
||||||
class Mul(Node):
|
class Mul(Node):
|
||||||
def __init__(self, (left, right), lineno=None):
|
def __init__(self, leftright, lineno=None):
|
||||||
self.left = left
|
self.left = leftright[0]
|
||||||
self.right = right
|
self.right = leftright[1]
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
|
@ -995,9 +993,9 @@ class Pass(Node):
|
||||||
return "Pass()"
|
return "Pass()"
|
||||||
|
|
||||||
class Power(Node):
|
class Power(Node):
|
||||||
def __init__(self, (left, right), lineno=None):
|
def __init__(self, leftright, lineno=None):
|
||||||
self.left = left
|
self.left = leftright[0]
|
||||||
self.right = right
|
self.right = leftright[1]
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
|
@ -1095,9 +1093,9 @@ class Return(Node):
|
||||||
return "Return(%s)" % (repr(self.value),)
|
return "Return(%s)" % (repr(self.value),)
|
||||||
|
|
||||||
class RightShift(Node):
|
class RightShift(Node):
|
||||||
def __init__(self, (left, right), lineno=None):
|
def __init__(self, leftright, lineno=None):
|
||||||
self.left = left
|
self.left = leftright[0]
|
||||||
self.right = right
|
self.right = leftright[1]
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
|
@ -1170,9 +1168,9 @@ class Stmt(Node):
|
||||||
return "Stmt(%s)" % (repr(self.nodes),)
|
return "Stmt(%s)" % (repr(self.nodes),)
|
||||||
|
|
||||||
class Sub(Node):
|
class Sub(Node):
|
||||||
def __init__(self, (left, right), lineno=None):
|
def __init__(self, leftright, lineno=None):
|
||||||
self.left = left
|
self.left = leftright[0]
|
||||||
self.right = right
|
self.right = leftright[1]
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
|
|
|
@ -900,10 +900,10 @@ class CodeGenerator:
|
||||||
level = node.level
|
level = node.level
|
||||||
if level == 0 and not self.graph.checkFlag(CO_FUTURE_ABSIMPORT):
|
if level == 0 and not self.graph.checkFlag(CO_FUTURE_ABSIMPORT):
|
||||||
level = -1
|
level = -1
|
||||||
fromlist = map(lambda (name, alias): name, node.names)
|
fromlist = tuple(name for (name, alias) in node.names)
|
||||||
if VERSION > 1:
|
if VERSION > 1:
|
||||||
self.emit('LOAD_CONST', level)
|
self.emit('LOAD_CONST', level)
|
||||||
self.emit('LOAD_CONST', tuple(fromlist))
|
self.emit('LOAD_CONST', fromlist)
|
||||||
self.emit('IMPORT_NAME', node.modname)
|
self.emit('IMPORT_NAME', node.modname)
|
||||||
for name, alias in node.names:
|
for name, alias in node.names:
|
||||||
if VERSION > 1:
|
if VERSION > 1:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import sys
|
import sys
|
||||||
if sys.py3kwarning:
|
if sys.py3kwarning:
|
||||||
import warnings
|
import warnings
|
||||||
warnings.warnpy3k("in 3.x, dbhash has been removed", DeprecationWarning, 2)
|
warnings.warnpy3k("in 3.x, the dbhash module has been removed", DeprecationWarning, 2)
|
||||||
try:
|
try:
|
||||||
import bsddb
|
import bsddb
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -51,7 +51,7 @@ def openfile(filename, mode='r'):
|
||||||
class TestEmailBase(unittest.TestCase):
|
class TestEmailBase(unittest.TestCase):
|
||||||
def ndiffAssertEqual(self, first, second):
|
def ndiffAssertEqual(self, first, second):
|
||||||
"""Like failUnlessEqual except use ndiff for readable output."""
|
"""Like failUnlessEqual except use ndiff for readable output."""
|
||||||
if first <> second:
|
if first != second:
|
||||||
sfirst = str(first)
|
sfirst = str(first)
|
||||||
ssecond = str(second)
|
ssecond = str(second)
|
||||||
diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines())
|
diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines())
|
||||||
|
@ -2857,7 +2857,7 @@ class TestCharset(unittest.TestCase):
|
||||||
# Try a charset with None body encoding
|
# Try a charset with None body encoding
|
||||||
c = Charset('us-ascii')
|
c = Charset('us-ascii')
|
||||||
eq('hello world', c.body_encode('hello world'))
|
eq('hello world', c.body_encode('hello world'))
|
||||||
# Try the convert argument, where input codec <> output codec
|
# Try the convert argument, where input codec != output codec
|
||||||
c = Charset('euc-jp')
|
c = Charset('euc-jp')
|
||||||
# With apologies to Tokio Kikuchi ;)
|
# With apologies to Tokio Kikuchi ;)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -52,7 +52,7 @@ def openfile(filename, mode='r'):
|
||||||
class TestEmailBase(unittest.TestCase):
|
class TestEmailBase(unittest.TestCase):
|
||||||
def ndiffAssertEqual(self, first, second):
|
def ndiffAssertEqual(self, first, second):
|
||||||
"""Like failUnlessEqual except use ndiff for readable output."""
|
"""Like failUnlessEqual except use ndiff for readable output."""
|
||||||
if first <> second:
|
if first != second:
|
||||||
sfirst = str(first)
|
sfirst = str(first)
|
||||||
ssecond = str(second)
|
ssecond = str(second)
|
||||||
diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines())
|
diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines())
|
||||||
|
@ -2761,7 +2761,7 @@ class TestCharset(unittest.TestCase):
|
||||||
# Try a charset with None body encoding
|
# Try a charset with None body encoding
|
||||||
c = Charset('us-ascii')
|
c = Charset('us-ascii')
|
||||||
eq('hello world', c.body_encode('hello world'))
|
eq('hello world', c.body_encode('hello world'))
|
||||||
# Try the convert argument, where input codec <> output codec
|
# Try the convert argument, where input codec != output codec
|
||||||
c = Charset('euc-jp')
|
c = Charset('euc-jp')
|
||||||
# With apologies to Tokio Kikuchi ;)
|
# With apologies to Tokio Kikuchi ;)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -228,7 +228,8 @@ class AbstractFormatter:
|
||||||
self.align = None
|
self.align = None
|
||||||
self.writer.new_alignment(None)
|
self.writer.new_alignment(None)
|
||||||
|
|
||||||
def push_font(self, (size, i, b, tt)):
|
def push_font(self, font):
|
||||||
|
size, i, b, tt = font
|
||||||
if self.softspace:
|
if self.softspace:
|
||||||
self.hard_break = self.para_end = self.softspace = 0
|
self.hard_break = self.para_end = self.softspace = 0
|
||||||
self.nospace = 1
|
self.nospace = 1
|
||||||
|
|
|
@ -281,7 +281,8 @@ class Importer:
|
||||||
setattr(parent, modname, module)
|
setattr(parent, modname, module)
|
||||||
return module
|
return module
|
||||||
|
|
||||||
def _process_result(self, (ispkg, code, values), fqname):
|
def _process_result(self, result, fqname):
|
||||||
|
ispkg, code, values = result
|
||||||
# did get_code() return an actual module? (rather than a code object)
|
# did get_code() return an actual module? (rather than a code object)
|
||||||
is_module = isinstance(code, _ModuleType)
|
is_module = isinstance(code, _ModuleType)
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import copy
|
||||||
import email
|
import email
|
||||||
import email.message
|
import email.message
|
||||||
import email.generator
|
import email.generator
|
||||||
import rfc822
|
|
||||||
import StringIO
|
import StringIO
|
||||||
try:
|
try:
|
||||||
if sys.platform == 'os2emx':
|
if sys.platform == 'os2emx':
|
||||||
|
@ -28,6 +27,13 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
fcntl = None
|
fcntl = None
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
if sys.py3kwarning:
|
||||||
|
warnings.filterwarnings("ignore", ".*rfc822 has been removed",
|
||||||
|
DeprecationWarning)
|
||||||
|
import rfc822
|
||||||
|
|
||||||
__all__ = [ 'Mailbox', 'Maildir', 'mbox', 'MH', 'Babyl', 'MMDF',
|
__all__ = [ 'Mailbox', 'Maildir', 'mbox', 'MH', 'Babyl', 'MMDF',
|
||||||
'Message', 'MaildirMessage', 'mboxMessage', 'MHMessage',
|
'Message', 'MaildirMessage', 'mboxMessage', 'MHMessage',
|
||||||
'BabylMessage', 'MMDFMessage', 'UnixMailbox',
|
'BabylMessage', 'MMDFMessage', 'UnixMailbox',
|
||||||
|
|
|
@ -35,6 +35,7 @@ saferepr()
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys as _sys
|
import sys as _sys
|
||||||
|
import warnings
|
||||||
|
|
||||||
from cStringIO import StringIO as _StringIO
|
from cStringIO import StringIO as _StringIO
|
||||||
|
|
||||||
|
@ -70,6 +71,13 @@ def isrecursive(object):
|
||||||
"""Determine if object requires a recursive representation."""
|
"""Determine if object requires a recursive representation."""
|
||||||
return _safe_repr(object, {}, None, 0)[2]
|
return _safe_repr(object, {}, None, 0)[2]
|
||||||
|
|
||||||
|
def _sorted(iterable):
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
if _sys.py3kwarning:
|
||||||
|
warnings.filterwarnings("ignore", "comparing unequal types "
|
||||||
|
"not supported", DeprecationWarning)
|
||||||
|
return sorted(iterable)
|
||||||
|
|
||||||
class PrettyPrinter:
|
class PrettyPrinter:
|
||||||
def __init__(self, indent=1, width=80, depth=None, stream=None):
|
def __init__(self, indent=1, width=80, depth=None, stream=None):
|
||||||
"""Handle pretty printing operations onto a stream using a set of
|
"""Handle pretty printing operations onto a stream using a set of
|
||||||
|
@ -144,8 +152,7 @@ class PrettyPrinter:
|
||||||
if length:
|
if length:
|
||||||
context[objid] = 1
|
context[objid] = 1
|
||||||
indent = indent + self._indent_per_level
|
indent = indent + self._indent_per_level
|
||||||
items = object.items()
|
items = _sorted(object.items())
|
||||||
items.sort()
|
|
||||||
key, ent = items[0]
|
key, ent = items[0]
|
||||||
rep = self._repr(key, context, level)
|
rep = self._repr(key, context, level)
|
||||||
write(rep)
|
write(rep)
|
||||||
|
@ -181,7 +188,7 @@ class PrettyPrinter:
|
||||||
return
|
return
|
||||||
write('set([')
|
write('set([')
|
||||||
endchar = '])'
|
endchar = '])'
|
||||||
object = sorted(object)
|
object = _sorted(object)
|
||||||
indent += 4
|
indent += 4
|
||||||
elif issubclass(typ, frozenset):
|
elif issubclass(typ, frozenset):
|
||||||
if not length:
|
if not length:
|
||||||
|
@ -189,7 +196,7 @@ class PrettyPrinter:
|
||||||
return
|
return
|
||||||
write('frozenset([')
|
write('frozenset([')
|
||||||
endchar = '])'
|
endchar = '])'
|
||||||
object = sorted(object)
|
object = _sorted(object)
|
||||||
indent += 10
|
indent += 10
|
||||||
else:
|
else:
|
||||||
write('(')
|
write('(')
|
||||||
|
@ -274,7 +281,7 @@ def _safe_repr(object, context, maxlevels, level):
|
||||||
append = components.append
|
append = components.append
|
||||||
level += 1
|
level += 1
|
||||||
saferepr = _safe_repr
|
saferepr = _safe_repr
|
||||||
for k, v in sorted(object.items()):
|
for k, v in _sorted(object.items()):
|
||||||
krepr, kreadable, krecur = saferepr(k, context, maxlevels, level)
|
krepr, kreadable, krecur = saferepr(k, context, maxlevels, level)
|
||||||
vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level)
|
vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level)
|
||||||
append("%s: %s" % (krepr, vrepr))
|
append("%s: %s" % (krepr, vrepr))
|
||||||
|
|
|
@ -442,12 +442,12 @@ class Stats:
|
||||||
if nc == 0:
|
if nc == 0:
|
||||||
print >> self.stream, ' '*8,
|
print >> self.stream, ' '*8,
|
||||||
else:
|
else:
|
||||||
print >> self.stream, f8(tt/nc),
|
print >> self.stream, f8(float(tt)/nc),
|
||||||
print >> self.stream, f8(ct),
|
print >> self.stream, f8(ct),
|
||||||
if cc == 0:
|
if cc == 0:
|
||||||
print >> self.stream, ' '*8,
|
print >> self.stream, ' '*8,
|
||||||
else:
|
else:
|
||||||
print >> self.stream, f8(ct/cc),
|
print >> self.stream, f8(float(ct)/cc),
|
||||||
print >> self.stream, func_std_string(func)
|
print >> self.stream, func_std_string(func)
|
||||||
|
|
||||||
class TupleComp:
|
class TupleComp:
|
||||||
|
|
44
Lib/sets.py
44
Lib/sets.py
|
@ -54,29 +54,7 @@ what's tested is actually `z in y'.
|
||||||
# - Raymond Hettinger added a number of speedups and other
|
# - Raymond Hettinger added a number of speedups and other
|
||||||
# improvements.
|
# improvements.
|
||||||
|
|
||||||
from __future__ import generators
|
from itertools import ifilter, ifilterfalse
|
||||||
try:
|
|
||||||
from itertools import ifilter, ifilterfalse
|
|
||||||
except ImportError:
|
|
||||||
# Code to make the module run under Py2.2
|
|
||||||
def ifilter(predicate, iterable):
|
|
||||||
if predicate is None:
|
|
||||||
def predicate(x):
|
|
||||||
return x
|
|
||||||
for x in iterable:
|
|
||||||
if predicate(x):
|
|
||||||
yield x
|
|
||||||
def ifilterfalse(predicate, iterable):
|
|
||||||
if predicate is None:
|
|
||||||
def predicate(x):
|
|
||||||
return x
|
|
||||||
for x in iterable:
|
|
||||||
if not predicate(x):
|
|
||||||
yield x
|
|
||||||
try:
|
|
||||||
True, False
|
|
||||||
except NameError:
|
|
||||||
True, False = (0==0, 0!=0)
|
|
||||||
|
|
||||||
__all__ = ['BaseSet', 'Set', 'ImmutableSet']
|
__all__ = ['BaseSet', 'Set', 'ImmutableSet']
|
||||||
|
|
||||||
|
@ -235,7 +213,7 @@ class BaseSet(object):
|
||||||
little, big = self, other
|
little, big = self, other
|
||||||
else:
|
else:
|
||||||
little, big = other, self
|
little, big = other, self
|
||||||
common = ifilter(big._data.has_key, little)
|
common = ifilter(big._data.__contains__, little)
|
||||||
return self.__class__(common)
|
return self.__class__(common)
|
||||||
|
|
||||||
def __xor__(self, other):
|
def __xor__(self, other):
|
||||||
|
@ -260,9 +238,9 @@ class BaseSet(object):
|
||||||
otherdata = other._data
|
otherdata = other._data
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
otherdata = Set(other)._data
|
otherdata = Set(other)._data
|
||||||
for elt in ifilterfalse(otherdata.has_key, selfdata):
|
for elt in ifilterfalse(otherdata.__contains__, selfdata):
|
||||||
data[elt] = value
|
data[elt] = value
|
||||||
for elt in ifilterfalse(selfdata.has_key, otherdata):
|
for elt in ifilterfalse(selfdata.__contains__, otherdata):
|
||||||
data[elt] = value
|
data[elt] = value
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -287,7 +265,7 @@ class BaseSet(object):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
otherdata = Set(other)._data
|
otherdata = Set(other)._data
|
||||||
value = True
|
value = True
|
||||||
for elt in ifilterfalse(otherdata.has_key, self):
|
for elt in ifilterfalse(otherdata.__contains__, self):
|
||||||
data[elt] = value
|
data[elt] = value
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -313,7 +291,7 @@ class BaseSet(object):
|
||||||
self._binary_sanity_check(other)
|
self._binary_sanity_check(other)
|
||||||
if len(self) > len(other): # Fast check for obvious cases
|
if len(self) > len(other): # Fast check for obvious cases
|
||||||
return False
|
return False
|
||||||
for elt in ifilterfalse(other._data.has_key, self):
|
for elt in ifilterfalse(other._data.__contains__, self):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -322,7 +300,7 @@ class BaseSet(object):
|
||||||
self._binary_sanity_check(other)
|
self._binary_sanity_check(other)
|
||||||
if len(self) < len(other): # Fast check for obvious cases
|
if len(self) < len(other): # Fast check for obvious cases
|
||||||
return False
|
return False
|
||||||
for elt in ifilterfalse(self._data.has_key, other):
|
for elt in ifilterfalse(self._data.__contains__, other):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -338,6 +316,9 @@ class BaseSet(object):
|
||||||
self._binary_sanity_check(other)
|
self._binary_sanity_check(other)
|
||||||
return len(self) > len(other) and self.issuperset(other)
|
return len(self) > len(other) and self.issuperset(other)
|
||||||
|
|
||||||
|
# We inherit object.__hash__, so we must deny this explicitly
|
||||||
|
__hash__ = None
|
||||||
|
|
||||||
# Assorted helpers
|
# Assorted helpers
|
||||||
|
|
||||||
def _binary_sanity_check(self, other):
|
def _binary_sanity_check(self, other):
|
||||||
|
@ -439,9 +420,6 @@ class Set(BaseSet):
|
||||||
def __setstate__(self, data):
|
def __setstate__(self, data):
|
||||||
self._data, = data
|
self._data, = data
|
||||||
|
|
||||||
# We inherit object.__hash__, so we must deny this explicitly
|
|
||||||
__hash__ = None
|
|
||||||
|
|
||||||
# In-place union, intersection, differences.
|
# In-place union, intersection, differences.
|
||||||
# Subtle: The xyz_update() functions deliberately return None,
|
# Subtle: The xyz_update() functions deliberately return None,
|
||||||
# as do all mutating operations on built-in container types.
|
# as do all mutating operations on built-in container types.
|
||||||
|
@ -503,7 +481,7 @@ class Set(BaseSet):
|
||||||
other = Set(other)
|
other = Set(other)
|
||||||
if self is other:
|
if self is other:
|
||||||
self.clear()
|
self.clear()
|
||||||
for elt in ifilter(data.has_key, other):
|
for elt in ifilter(data.__contains__, other):
|
||||||
del data[elt]
|
del data[elt]
|
||||||
|
|
||||||
# Python dict-like mass mutations: update, clear
|
# Python dict-like mass mutations: update, clear
|
||||||
|
|
|
@ -364,7 +364,8 @@ class Au_write:
|
||||||
else:
|
else:
|
||||||
return 'not compressed'
|
return 'not compressed'
|
||||||
|
|
||||||
def setparams(self, (nchannels, sampwidth, framerate, nframes, comptype, compname)):
|
def setparams(self, params):
|
||||||
|
nchannels, sampwidth, framerate, nframes, comptype, compname = params
|
||||||
self.setnchannels(nchannels)
|
self.setnchannels(nchannels)
|
||||||
self.setsampwidth(sampwidth)
|
self.setsampwidth(sampwidth)
|
||||||
self.setframerate(framerate)
|
self.setframerate(framerate)
|
||||||
|
|
|
@ -523,7 +523,8 @@ class HandlerTests(TestCase):
|
||||||
"Content-Length: %d\r\n"
|
"Content-Length: %d\r\n"
|
||||||
"\r\n%s" % (h.error_status,len(h.error_body),h.error_body))
|
"\r\n%s" % (h.error_status,len(h.error_body),h.error_body))
|
||||||
|
|
||||||
self.failUnless(h.stderr.getvalue().find("AssertionError")<>-1)
|
self.assertTrue("AssertionError" in h.stderr.getvalue(),
|
||||||
|
"AssertionError not in stderr")
|
||||||
|
|
||||||
def testErrorAfterOutput(self):
|
def testErrorAfterOutput(self):
|
||||||
MSG = "Some output has been sent"
|
MSG = "Some output has been sent"
|
||||||
|
@ -536,7 +537,8 @@ class HandlerTests(TestCase):
|
||||||
self.assertEqual(h.stdout.getvalue(),
|
self.assertEqual(h.stdout.getvalue(),
|
||||||
"Status: 200 OK\r\n"
|
"Status: 200 OK\r\n"
|
||||||
"\r\n"+MSG)
|
"\r\n"+MSG)
|
||||||
self.failUnless(h.stderr.getvalue().find("AssertionError")<>-1)
|
self.assertTrue("AssertionError" in h.stderr.getvalue(),
|
||||||
|
"AssertionError not in stderr")
|
||||||
|
|
||||||
|
|
||||||
def testHeaderFormats(self):
|
def testHeaderFormats(self):
|
||||||
|
|
|
@ -384,7 +384,8 @@ class Wave_write:
|
||||||
def getcompname(self):
|
def getcompname(self):
|
||||||
return self._compname
|
return self._compname
|
||||||
|
|
||||||
def setparams(self, (nchannels, sampwidth, framerate, nframes, comptype, compname)):
|
def setparams(self, params):
|
||||||
|
nchannels, sampwidth, framerate, nframes, comptype, compname = params
|
||||||
if self._datawritten:
|
if self._datawritten:
|
||||||
raise Error, 'cannot change parameters after starting to write'
|
raise Error, 'cannot change parameters after starting to write'
|
||||||
self.setnchannels(nchannels)
|
self.setnchannels(nchannels)
|
||||||
|
|
|
@ -650,7 +650,7 @@ def main():
|
||||||
for o, a in opts:
|
for o, a in opts:
|
||||||
if o == '-n': new_win = 1
|
if o == '-n': new_win = 1
|
||||||
elif o == '-t': new_win = 2
|
elif o == '-t': new_win = 2
|
||||||
if len(args) <> 1:
|
if len(args) != 1:
|
||||||
print >>sys.stderr, usage
|
print >>sys.stderr, usage
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,9 @@ C-API
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #7092: Fix the DeprecationWarnings emitted by the standard library
|
||||||
|
when using the -3 flag. Patch by Florent Xicluna.
|
||||||
|
|
||||||
- Issue #7395: Fix tracebacks in pstats interactive browser.
|
- Issue #7395: Fix tracebacks in pstats interactive browser.
|
||||||
|
|
||||||
- Issue #1713: Fix os.path.ismount(), which returned true for symbolic links
|
- Issue #1713: Fix os.path.ismount(), which returned true for symbolic links
|
||||||
|
|
|
@ -105,12 +105,18 @@ class NodeInfo:
|
||||||
|
|
||||||
def _gen_init(self, buf):
|
def _gen_init(self, buf):
|
||||||
if self.args:
|
if self.args:
|
||||||
print >> buf, " def __init__(self, %s, lineno=None):" % self.args
|
argtuple = '(' in self.args
|
||||||
|
args = self.args if not argtuple else ''.join(self.argnames)
|
||||||
|
print >> buf, " def __init__(self, %s, lineno=None):" % args
|
||||||
else:
|
else:
|
||||||
print >> buf, " def __init__(self, lineno=None):"
|
print >> buf, " def __init__(self, lineno=None):"
|
||||||
if self.argnames:
|
if self.argnames:
|
||||||
for name in self.argnames:
|
if argtuple:
|
||||||
print >> buf, " self.%s = %s" % (name, name)
|
for idx, name in enumerate(self.argnames):
|
||||||
|
print >> buf, " self.%s = %s[%s]" % (name, args, idx)
|
||||||
|
else:
|
||||||
|
for name in self.argnames:
|
||||||
|
print >> buf, " self.%s = %s" % (name, name)
|
||||||
print >> buf, " self.lineno = lineno"
|
print >> buf, " self.lineno = lineno"
|
||||||
# Copy the lines in self.init, indented four spaces. The rstrip()
|
# Copy the lines in self.init, indented four spaces. The rstrip()
|
||||||
# business is to get rid of the four spaces if line happens to be
|
# business is to get rid of the four spaces if line happens to be
|
||||||
|
|
Loading…
Reference in New Issue