Commits

Antonio Cuni  committed a9a6d0d

(antocuni, berdario) merge the 2.7.1 version of the stdlib

At the moment, the directory is still named 2.7.0, we will rename it in a
later checkin.

The changes in modified-2.7.0 have been merged using the following 3-way-merge
command for each file under the modified-2.7.0 directory:

merge -A UserDict.py ../2.7.0/UserDict.py ../../../cpython/Lib/UserDict.py

  • Participants
  • Parent commits 3350fb0
  • Branches merge-stdlib-2.7.1

Comments (0)

Files changed (425)

File lib-python/2.7.0/bsddb/dbtables.py

 # This provides a simple database table interface built on top of
 # the Python Berkeley DB 3 interface.
 #
-_cvsid = '$Id: dbtables.py 79285 2010-03-22 14:22:26Z jesus.cea $'
+_cvsid = '$Id$'
 
 import re
 import sys

File lib-python/2.7.0/bsddb/test/test_associate.py

         self.assertEqual(vals, None, vals)
 
         vals = secDB.pget('Unknown', txn=txn)
-        self.assert_(vals[0] == 99 or vals[0] == '99', vals)
+        self.assertTrue(vals[0] == 99 or vals[0] == '99', vals)
         vals[1].index('Unknown')
         vals[1].index('Unnamed')
         vals[1].index('unknown')
         rec = self.cur.first()
         while rec is not None:
             if type(self.keytype) == type(''):
-                self.assert_(int(rec[0]))  # for primary db, key is a number
+                self.assertTrue(int(rec[0]))  # for primary db, key is a number
             else:
-                self.assert_(rec[0] and type(rec[0]) == type(0))
+                self.assertTrue(rec[0] and type(rec[0]) == type(0))
             count = count + 1
             if verbose:
                 print rec
 
         # test cursor pget
         vals = self.cur.pget('Unknown', flags=db.DB_LAST)
-        self.assert_(vals[1] == 99 or vals[1] == '99', vals)
+        self.assertTrue(vals[1] == 99 or vals[1] == '99', vals)
         self.assertEqual(vals[0], 'Unknown')
         vals[2].index('Unknown')
         vals[2].index('Unnamed')

File lib-python/2.7.0/bsddb/test/test_basics.py

 
         d.put("abcde", "ABCDE");
         num = d.truncate()
-        self.assert_(num >= 1, "truncate returned <= 0 on non-empty database")
+        self.assertTrue(num >= 1, "truncate returned <= 0 on non-empty database")
         num = d.truncate()
         self.assertEqual(num, 0,
                 "truncate on empty DB returned nonzero (%r)" % (num,))
     if db.version() >= (4, 6):
         def test08_exists(self) :
             self.d.put("abcde", "ABCDE")
-            self.assert_(self.d.exists("abcde") == True,
+            self.assertTrue(self.d.exists("abcde") == True,
                     "DB->exists() returns wrong value")
-            self.assert_(self.d.exists("x") == False,
+            self.assertTrue(self.d.exists("x") == False,
                     "DB->exists() returns wrong value")
 
     #----------------------------------------
             self.d.put("abcde", "ABCDE", txn=txn)
             txn.commit()
             txn = self.env.txn_begin()
-            self.assert_(self.d.exists("abcde", txn=txn) == True,
+            self.assertTrue(self.d.exists("abcde", txn=txn) == True,
                     "DB->exists() returns wrong value")
-            self.assert_(self.d.exists("x", txn=txn) == False,
+            self.assertTrue(self.d.exists("x", txn=txn) == False,
                     "DB->exists() returns wrong value")
             txn.abort()
 
         d.put("abcde", "ABCDE");
         txn = self.env.txn_begin()
         num = d.truncate(txn)
-        self.assert_(num >= 1, "truncate returned <= 0 on non-empty database")
+        self.assertTrue(num >= 1, "truncate returned <= 0 on non-empty database")
         num = d.truncate(txn)
         self.assertEqual(num, 0,
                 "truncate on empty DB returned nonzero (%r)" % (num,))

File lib-python/2.7.0/bsddb/test/test_compat.py

             if verbose:
                 print rec
 
-        self.assert_(f.has_key('f'), 'Error, missing key!')
+        self.assertTrue(f.has_key('f'), 'Error, missing key!')
 
         # test that set_location() returns the next nearest key, value
         # on btree databases and raises KeyError on others.

File lib-python/2.7.0/bsddb/test/test_cursor_pget_bug.py

     def test_pget(self):
         cursor = self.secondary_db.cursor()
 
-        self.assertEquals(('eggs', 'salad', 'eggs'), cursor.pget(key='eggs', flags=db.DB_SET))
-        self.assertEquals(('eggs', 'omelet', 'eggs'), cursor.pget(db.DB_NEXT_DUP))
-        self.assertEquals(None, cursor.pget(db.DB_NEXT_DUP))
+        self.assertEqual(('eggs', 'salad', 'eggs'), cursor.pget(key='eggs', flags=db.DB_SET))
+        self.assertEqual(('eggs', 'omelet', 'eggs'), cursor.pget(db.DB_NEXT_DUP))
+        self.assertEqual(None, cursor.pget(db.DB_NEXT_DUP))
 
-        self.assertEquals(('ham', 'spam', 'ham'), cursor.pget('ham', 'spam', flags=db.DB_SET))
-        self.assertEquals(None, cursor.pget(db.DB_NEXT_DUP))
+        self.assertEqual(('ham', 'spam', 'ham'), cursor.pget('ham', 'spam', flags=db.DB_SET))
+        self.assertEqual(None, cursor.pget(db.DB_NEXT_DUP))
 
         cursor.close()
 

File lib-python/2.7.0/bsddb/test/test_dbshelve.py

             self.assertEqual(value.L, [x] * 10)
 
         else:
-            self.assert_(0, 'Unknown key type, fix the test')
+            self.assertTrue(0, 'Unknown key type, fix the test')
 
 #----------------------------------------------------------------------
 

File lib-python/2.7.0/bsddb/test/test_dbtables.py

 #
 #   --  Gregory P. Smith <greg@krypto.org>
 #
-# $Id: test_dbtables.py 79285 2010-03-22 14:22:26Z jesus.cea $
+# $Id$
 
 import os, re, sys
 
             colval = pickle.loads(values[0][colname])
         else :
             colval = pickle.loads(bytes(values[0][colname], "iso8859-1"))
-        self.assert_(colval > 3.141)
-        self.assert_(colval < 3.142)
+        self.assertTrue(colval > 3.141)
+        self.assertTrue(colval < 3.142)
 
 
     def test02(self):

File lib-python/2.7.0/bsddb/test/test_distributed_transactions.py

     # Get "to be recovered" transactions but
     # let them be garbage collected.
         recovered_txns=self.dbenv.txn_recover()
-        self.assertEquals(self.num_txns,len(recovered_txns))
+        self.assertEqual(self.num_txns,len(recovered_txns))
         for gid,txn in recovered_txns :
-            self.assert_(gid in txns)
+            self.assertTrue(gid in txns)
         del txn
         del recovered_txns
 
     # Get "to be recovered" transactions. Commit, abort and
     # discard them.
         recovered_txns=self.dbenv.txn_recover()
-        self.assertEquals(self.num_txns,len(recovered_txns))
+        self.assertEqual(self.num_txns,len(recovered_txns))
         discard_txns=set()
         committed_txns=set()
         state=0
     # Verify the discarded transactions are still
     # around, and dispose them.
         recovered_txns=self.dbenv.txn_recover()
-        self.assertEquals(len(discard_txns),len(recovered_txns))
+        self.assertEqual(len(discard_txns),len(recovered_txns))
         for gid,txn in recovered_txns :
             txn.abort()
         del txn
     # Be sure there are not pending transactions.
     # Check also database size.
         recovered_txns=self.dbenv.txn_recover()
-        self.assert_(len(recovered_txns)==0)
-        self.assertEquals(len(committed_txns),self.db.stat()["nkeys"])
+        self.assertTrue(len(recovered_txns)==0)
+        self.assertEqual(len(committed_txns),self.db.stat()["nkeys"])
 
 class DBTxn_distributedSYNC(DBTxn_distributed):
     nosync=False

File lib-python/2.7.0/bsddb/test/test_early_close.py

         txn = dbenv.txn_begin()
         c1 = d.cursor(txn)
         c2 = c1.dup()
-        self.assertEquals(("XXX", "yyy"), c1.first())
+        self.assertEqual(("XXX", "yyy"), c1.first())
 
         # Not interested in warnings about implicit close.
         import warnings

File lib-python/2.7.0/bsddb/test/test_fileid.py

 
         self.db1 = db.DB(self.db_env)
         self.db1.open(self.db_path_1, dbtype=db.DB_HASH, flags=db.DB_RDONLY)
-        self.assertEquals(self.db1.get('spam'), 'eggs')
+        self.assertEqual(self.db1.get('spam'), 'eggs')
 
         self.db2 = db.DB(self.db_env)
         self.db2.open(self.db_path_2, dbtype=db.DB_HASH, flags=db.DB_RDONLY)
-        self.assertEquals(self.db2.get('spam'), 'spam')
+        self.assertEqual(self.db2.get('spam'), 'spam')
 
         self.db1.close()
         self.db2.close()

File lib-python/2.7.0/bsddb/test/test_get_none.py

                 break
 
         self.assertNotEqual(rec, None)
-        self.assert_(exceptionHappened)
+        self.assertTrue(exceptionHappened)
         self.assertEqual(count, len(string.letters))
 
         c.close()

File lib-python/2.7.0/bsddb/test/test_join.py

             # Don't do the .set() in an assert, or you can get a bogus failure
             # when running python -O
             tmp = sCursor.set('red')
-            self.assert_(tmp)
+            self.assertTrue(tmp)
 
             # FIXME: jCursor doesn't properly hold a reference to its
             # cursors, if they are closed before jcursor is used it

File lib-python/2.7.0/bsddb/test/test_misc.py

     def test02_db_home(self):
         env = db.DBEnv()
         # check for crash fixed when db_home is used before open()
-        self.assert_(env.db_home is None)
+        self.assertTrue(env.db_home is None)
         env.open(self.homeDir, db.DB_CREATE)
         if sys.version_info[0] < 3 :
             self.assertEqual(self.homeDir, env.db_home)
         db = hashopen(self.filename)
         db.close()
         rp = repr(db)
-        self.assertEquals(rp, "{}")
+        self.assertEqual(rp, "{}")
 
     def test04_repr_db(self) :
         db = hashopen(self.filename)
         db.close()
         db = hashopen(self.filename)
         rp = repr(db)
-        self.assertEquals(rp, repr(d))
+        self.assertEqual(rp, repr(d))
         db.close()
 
     # http://sourceforge.net/tracker/index.php?func=detail&aid=1708868&group_id=13900&atid=313900

File lib-python/2.7.0/bsddb/test/test_recno.py

         def assertFalse(self, expr, msg=None) :
             return self.failIf(expr,msg=msg)
         def assertTrue(self, expr, msg=None) :
-            return self.assert_(expr, msg=msg)
+            return self.assertTrue(expr, msg=msg)
 
     if (sys.version_info < (2, 7)) or ((sys.version_info >= (3, 0)) and
             (sys.version_info < (3, 2))) :

File lib-python/2.7.0/bsddb/test/test_replication.py

 
         self.dbenvMaster.rep_set_timeout(db.DB_REP_CONNECTION_RETRY,100123)
         self.dbenvClient.rep_set_timeout(db.DB_REP_CONNECTION_RETRY,100321)
-        self.assertEquals(self.dbenvMaster.rep_get_timeout(
+        self.assertEqual(self.dbenvMaster.rep_get_timeout(
             db.DB_REP_CONNECTION_RETRY), 100123)
-        self.assertEquals(self.dbenvClient.rep_get_timeout(
+        self.assertEqual(self.dbenvClient.rep_get_timeout(
             db.DB_REP_CONNECTION_RETRY), 100321)
 
         self.dbenvMaster.rep_set_timeout(db.DB_REP_ELECTION_TIMEOUT, 100234)
         self.dbenvClient.rep_set_timeout(db.DB_REP_ELECTION_TIMEOUT, 100432)
-        self.assertEquals(self.dbenvMaster.rep_get_timeout(
+        self.assertEqual(self.dbenvMaster.rep_get_timeout(
             db.DB_REP_ELECTION_TIMEOUT), 100234)
-        self.assertEquals(self.dbenvClient.rep_get_timeout(
+        self.assertEqual(self.dbenvClient.rep_get_timeout(
             db.DB_REP_ELECTION_TIMEOUT), 100432)
 
         self.dbenvMaster.rep_set_timeout(db.DB_REP_ELECTION_RETRY, 100345)
         self.dbenvClient.rep_set_timeout(db.DB_REP_ELECTION_RETRY, 100543)
-        self.assertEquals(self.dbenvMaster.rep_get_timeout(
+        self.assertEqual(self.dbenvMaster.rep_get_timeout(
             db.DB_REP_ELECTION_RETRY), 100345)
-        self.assertEquals(self.dbenvClient.rep_get_timeout(
+        self.assertEqual(self.dbenvClient.rep_get_timeout(
             db.DB_REP_ELECTION_RETRY), 100543)
 
         self.dbenvMaster.repmgr_set_ack_policy(db.DB_REPMGR_ACKS_ALL)
         self.dbenvMaster.repmgr_start(1, db.DB_REP_MASTER);
         self.dbenvClient.repmgr_start(1, db.DB_REP_CLIENT);
 
-        self.assertEquals(self.dbenvMaster.rep_get_nsites(),2)
-        self.assertEquals(self.dbenvClient.rep_get_nsites(),2)
-        self.assertEquals(self.dbenvMaster.rep_get_priority(),10)
-        self.assertEquals(self.dbenvClient.rep_get_priority(),0)
-        self.assertEquals(self.dbenvMaster.repmgr_get_ack_policy(),
+        self.assertEqual(self.dbenvMaster.rep_get_nsites(),2)
+        self.assertEqual(self.dbenvClient.rep_get_nsites(),2)
+        self.assertEqual(self.dbenvMaster.rep_get_priority(),10)
+        self.assertEqual(self.dbenvClient.rep_get_priority(),0)
+        self.assertEqual(self.dbenvMaster.repmgr_get_ack_policy(),
                 db.DB_REPMGR_ACKS_ALL)
-        self.assertEquals(self.dbenvClient.repmgr_get_ack_policy(),
+        self.assertEqual(self.dbenvClient.repmgr_get_ack_policy(),
                 db.DB_REPMGR_ACKS_ALL)
 
         # The timeout is necessary in BDB 4.5, since DB_EVENT_REP_STARTUPDONE
             startup_timeout = True
 
         d = self.dbenvMaster.repmgr_site_list()
-        self.assertEquals(len(d), 1)
-        self.assertEquals(d[0][0], "127.0.0.1")
-        self.assertEquals(d[0][1], client_port)
+        self.assertEqual(len(d), 1)
+        self.assertEqual(d[0][0], "127.0.0.1")
+        self.assertEqual(d[0][1], client_port)
         self.assertTrue((d[0][2]==db.DB_REPMGR_CONNECTED) or \
                 (d[0][2]==db.DB_REPMGR_DISCONNECTED))
 
         d = self.dbenvClient.repmgr_site_list()
-        self.assertEquals(len(d), 1)
-        self.assertEquals(d[0][0], "127.0.0.1")
-        self.assertEquals(d[0][1], master_port)
+        self.assertEqual(len(d), 1)
+        self.assertEqual(d[0][0], "127.0.0.1")
+        self.assertEqual(d[0][1], master_port)
         self.assertTrue((d[0][2]==db.DB_REPMGR_CONNECTED) or \
                 (d[0][2]==db.DB_REPMGR_DISCONNECTED))
 
             self.skipTest("replication test skipped due to random failure, "
                 "see issue 3892")
         self.assertTrue(time.time()<timeout)
-        self.assertEquals("123", v)
+        self.assertEqual("123", v)
 
         txn=self.dbenvMaster.txn_begin()
         self.dbMaster.delete("ABC", txn=txn)
             if v is None :
                 time.sleep(0.02)
         self.assertTrue(time.time()<timeout)
-        self.assertEquals(None, v)
+        self.assertEqual(None, v)
 
 class DBBaseReplication(DBReplication) :
     def setUp(self) :
         self.dbenvClient.rep_set_transport(3,c2m)
         self.dbenvClient.rep_set_priority(0)
 
-        self.assertEquals(self.dbenvMaster.rep_get_priority(),10)
-        self.assertEquals(self.dbenvClient.rep_get_priority(),0)
+        self.assertEqual(self.dbenvMaster.rep_get_priority(),10)
+        self.assertEqual(self.dbenvClient.rep_get_priority(),0)
 
         #self.dbenvMaster.set_verbose(db.DB_VERB_REPLICATION, True)
         #self.dbenvMaster.set_verbose(db.DB_VERB_FILEOPS_ALL, True)
             if v is None :
                 time.sleep(0.02)
         self.assertTrue(time.time()<timeout)
-        self.assertEquals("123", v)
+        self.assertEqual("123", v)
 
         txn=self.dbenvMaster.txn_begin()
         self.dbMaster.delete("ABC", txn=txn)
             if v is None :
                 time.sleep(0.02)
         self.assertTrue(time.time()<timeout)
-        self.assertEquals(None, v)
+        self.assertEqual(None, v)
 
     if db.version() >= (4,7) :
         def test02_test_request(self) :

File lib-python/2.7.0/bsddb/test/test_sequence.py

         self.seq = db.DBSequence(self.d, flags=0)
         start_value = 10 * self.int_32_max
         self.assertEqual(0xA00000000, start_value)
-        self.assertEquals(None, self.seq.initial_value(start_value))
-        self.assertEquals(None, self.seq.open(key='id', txn=None, flags=db.DB_CREATE))
-        self.assertEquals(start_value, self.seq.get(5))
-        self.assertEquals(start_value + 5, self.seq.get())
+        self.assertEqual(None, self.seq.initial_value(start_value))
+        self.assertEqual(None, self.seq.open(key='id', txn=None, flags=db.DB_CREATE))
+        self.assertEqual(start_value, self.seq.get(5))
+        self.assertEqual(start_value + 5, self.seq.get())
 
     def test_remove(self):
         self.seq = db.DBSequence(self.d, flags=0)
-        self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
-        self.assertEquals(None, self.seq.remove(txn=None, flags=0))
+        self.assertEqual(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
+        self.assertEqual(None, self.seq.remove(txn=None, flags=0))
         del self.seq
 
     def test_get_key(self):
         self.seq = db.DBSequence(self.d, flags=0)
         key = 'foo'
-        self.assertEquals(None, self.seq.open(key=key, txn=None, flags=db.DB_CREATE))
-        self.assertEquals(key, self.seq.get_key())
+        self.assertEqual(None, self.seq.open(key=key, txn=None, flags=db.DB_CREATE))
+        self.assertEqual(key, self.seq.get_key())
 
     def test_get_dbp(self):
         self.seq = db.DBSequence(self.d, flags=0)
-        self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
-        self.assertEquals(self.d, self.seq.get_dbp())
+        self.assertEqual(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
+        self.assertEqual(self.d, self.seq.get_dbp())
 
     def test_cachesize(self):
         self.seq = db.DBSequence(self.d, flags=0)
         cashe_size = 10
-        self.assertEquals(None, self.seq.set_cachesize(cashe_size))
-        self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
-        self.assertEquals(cashe_size, self.seq.get_cachesize())
+        self.assertEqual(None, self.seq.set_cachesize(cashe_size))
+        self.assertEqual(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
+        self.assertEqual(cashe_size, self.seq.get_cachesize())
 
     def test_flags(self):
         self.seq = db.DBSequence(self.d, flags=0)
         flag = db.DB_SEQ_WRAP;
-        self.assertEquals(None, self.seq.set_flags(flag))
-        self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
-        self.assertEquals(flag, self.seq.get_flags() & flag)
+        self.assertEqual(None, self.seq.set_flags(flag))
+        self.assertEqual(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
+        self.assertEqual(flag, self.seq.get_flags() & flag)
 
     def test_range(self):
         self.seq = db.DBSequence(self.d, flags=0)
         seq_range = (10 * self.int_32_max, 11 * self.int_32_max - 1)
-        self.assertEquals(None, self.seq.set_range(seq_range))
+        self.assertEqual(None, self.seq.set_range(seq_range))
         self.seq.initial_value(seq_range[0])
-        self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
-        self.assertEquals(seq_range, self.seq.get_range())
+        self.assertEqual(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
+        self.assertEqual(seq_range, self.seq.get_range())
 
     def test_stat(self):
         self.seq = db.DBSequence(self.d, flags=0)
-        self.assertEquals(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
+        self.assertEqual(None, self.seq.open(key='foo', txn=None, flags=db.DB_CREATE))
         stat = self.seq.stat()
         for param in ('nowait', 'min', 'max', 'value', 'current',
                       'flags', 'cache_size', 'last_value', 'wait'):
     def test_64bits(self) :
         # We don't use both extremes because they are problematic
         value_plus=(1L<<63)-2
-        self.assertEquals(9223372036854775806L,value_plus)
+        self.assertEqual(9223372036854775806L,value_plus)
         value_minus=(-1L<<63)+1  # Two complement
-        self.assertEquals(-9223372036854775807L,value_minus)
+        self.assertEqual(-9223372036854775807L,value_minus)
         self.seq = db.DBSequence(self.d, flags=0)
-        self.assertEquals(None, self.seq.initial_value(value_plus-1))
-        self.assertEquals(None, self.seq.open(key='id', txn=None,
+        self.assertEqual(None, self.seq.initial_value(value_plus-1))
+        self.assertEqual(None, self.seq.open(key='id', txn=None,
             flags=db.DB_CREATE))
-        self.assertEquals(value_plus-1, self.seq.get(1))
-        self.assertEquals(value_plus, self.seq.get(1))
+        self.assertEqual(value_plus-1, self.seq.get(1))
+        self.assertEqual(value_plus, self.seq.get(1))
 
         self.seq.remove(txn=None, flags=0)
 
         self.seq = db.DBSequence(self.d, flags=0)
-        self.assertEquals(None, self.seq.initial_value(value_minus))
-        self.assertEquals(None, self.seq.open(key='id', txn=None,
+        self.assertEqual(None, self.seq.initial_value(value_minus))
+        self.assertEqual(None, self.seq.open(key='id', txn=None,
             flags=db.DB_CREATE))
-        self.assertEquals(value_minus, self.seq.get(1))
-        self.assertEquals(value_minus+1, self.seq.get(1))
+        self.assertEqual(value_minus, self.seq.get(1))
+        self.assertEqual(value_minus+1, self.seq.get(1))
 
     def test_multiple_close(self):
         self.seq = db.DBSequence(self.d)

File lib-python/2.7.0/calendar.py

         self.locale = locale
 
     def __enter__(self):
-        self.oldlocale = _locale.setlocale(_locale.LC_TIME, self.locale)
-        return _locale.getlocale(_locale.LC_TIME)[1]
+        self.oldlocale = _locale.getlocale(_locale.LC_TIME)
+        _locale.setlocale(_locale.LC_TIME, self.locale)
 
     def __exit__(self, *args):
         _locale.setlocale(_locale.LC_TIME, self.oldlocale)

File lib-python/2.7.0/ctypes/test/test_keeprefs.py

 class SimpleTestCase(unittest.TestCase):
     def test_cint(self):
         x = c_int()
-        self.assertEquals(x._objects, None)
+        self.assertEqual(x._objects, None)
         x.value = 42
-        self.assertEquals(x._objects, None)
+        self.assertEqual(x._objects, None)
         x = c_int(99)
-        self.assertEquals(x._objects, None)
+        self.assertEqual(x._objects, None)
 
     def test_ccharp(self):
         x = c_char_p()
-        self.assertEquals(x._objects, None)
+        self.assertEqual(x._objects, None)
         x.value = "abc"
-        self.assertEquals(x._objects, "abc")
+        self.assertEqual(x._objects, "abc")
         x = c_char_p("spam")
-        self.assertEquals(x._objects, "spam")
+        self.assertEqual(x._objects, "spam")
 
 class StructureTestCase(unittest.TestCase):
     def test_cint_struct(self):
                         ("b", c_int)]
 
         x = X()
-        self.assertEquals(x._objects, None)
+        self.assertEqual(x._objects, None)
         x.a = 42
         x.b = 99
-        self.assertEquals(x._objects, None)
+        self.assertEqual(x._objects, None)
 
     def test_ccharp_struct(self):
         class X(Structure):
             _fields_ = [("a", c_char_p),
                         ("b", c_char_p)]
         x = X()
-        self.assertEquals(x._objects, None)
+        self.assertEqual(x._objects, None)
 
         x.a = "spam"
         x.b = "foo"
-        self.assertEquals(x._objects, {"0": "spam", "1": "foo"})
+        self.assertEqual(x._objects, {"0": "spam", "1": "foo"})
 
     def test_struct_struct(self):
         class POINT(Structure):
         r.ul.y = 1
         r.lr.x = 2
         r.lr.y = 3
-        self.assertEquals(r._objects, None)
+        self.assertEqual(r._objects, None)
 
         r = RECT()
         pt = POINT(1, 2)
         r.ul = pt
-        self.assertEquals(r._objects, {'0': {}})
+        self.assertEqual(r._objects, {'0': {}})
         r.ul.x = 22
         r.ul.y = 44
-        self.assertEquals(r._objects, {'0': {}})
+        self.assertEqual(r._objects, {'0': {}})
         r.lr = POINT()
-        self.assertEquals(r._objects, {'0': {}, '1': {}})
+        self.assertEqual(r._objects, {'0': {}, '1': {}})
 
 class ArrayTestCase(unittest.TestCase):
     def test_cint_array(self):
         INTARR = c_int * 3
 
         ia = INTARR()
-        self.assertEquals(ia._objects, None)
+        self.assertEqual(ia._objects, None)
         ia[0] = 1
         ia[1] = 2
         ia[2] = 3
-        self.assertEquals(ia._objects, None)
+        self.assertEqual(ia._objects, None)
 
         class X(Structure):
             _fields_ = [("x", c_int),
         x.x = 1000
         x.a[0] = 42
         x.a[1] = 96
-        self.assertEquals(x._objects, None)
+        self.assertEqual(x._objects, None)
         x.a = ia
-        self.assertEquals(x._objects, {'1': {}})
+        self.assertEqual(x._objects, {'1': {}})
 
 class PointerTestCase(unittest.TestCase):
     def test_p_cint(self):

File lib-python/2.7.0/curses/__init__.py

 
 """
 
-__revision__ = "$Id: __init__.py 61064 2008-02-25 16:29:58Z andrew.kuchling $"
+__revision__ = "$Id$"
 
 from _curses import *
 from curses.wrapper import wrapper

File lib-python/2.7.0/curses/panel.py

 Module for using panels with curses.
 """
 
-__revision__ = "$Id: panel.py 36560 2004-07-18 06:16:08Z tim_one $"
+__revision__ = "$Id$"
 
 from _curses_panel import *

File lib-python/2.7.0/difflib.py

         Return an upper bound on ratio() very quickly.
     """
 
-    def __init__(self, isjunk=None, a='', b=''):
+    def __init__(self, isjunk=None, a='', b='', autojunk=True):
         """Construct a SequenceMatcher.
 
         Optional arg isjunk is None (the default), or a one-argument
         Optional arg b is the second of two sequences to be compared.  By
         default, an empty string.  The elements of b must be hashable. See
         also .set_seqs() and .set_seq2().
+
+        Optional arg autojunk should be set to False to disable the
+        "automatic junk heuristic" that treats popular elements as junk
+        (see module documentation for more information).
         """
 
         # Members:
         #      DOES NOT WORK for x in a!
         # isbpopular
         #      for x in b, isbpopular(x) is true iff b is reasonably long
-        #      (at least 200 elements) and x accounts for more than 1% of
-        #      its elements.  DOES NOT WORK for x in a!
+        #      (at least 200 elements) and x accounts for more than 1 + 1% of
+        #      its elements (when autojunk is enabled).
+        #      DOES NOT WORK for x in a!
 
         self.isjunk = isjunk
         self.a = self.b = None
+        self.autojunk = autojunk
         self.set_seqs(a, b)
 
     def set_seqs(self, a, b):
     # from starting any matching block at a junk element ...
     # also creates the fast isbjunk function ...
     # b2j also does not contain entries for "popular" elements, meaning
-    # elements that account for more than 1% of the total elements, and
+    # elements that account for more than 1 + 1% of the total elements, and
     # when the sequence is reasonably large (>= 200 elements); this can
     # be viewed as an adaptive notion of semi-junk, and yields an enormous
     # speedup when, e.g., comparing program files with hundreds of
         # out the junk later is much cheaper than building b2j "right"
         # from the start.
         b = self.b
+        self.b2j = b2j = {}
+
+        for i, elt in enumerate(b):
+            indices = b2j.setdefault(elt, [])
+            indices.append(i)
+
+        # Purge junk elements
+        junk = set()
+        isjunk = self.isjunk
+        if isjunk:
+            for elt in list(b2j.keys()):  # using list() since b2j is modified
+                if isjunk(elt):
+                    junk.add(elt)
+                    del b2j[elt]
+
+        # Purge popular elements that are not junk
+        popular = set()
         n = len(b)
-        self.b2j = b2j = {}
-        populardict = {}
-        for i, elt in enumerate(b):
-            if elt in b2j:
-                indices = b2j[elt]
-                if n >= 200 and len(indices) * 100 > n:
-                    populardict[elt] = 1
-                    del indices[:]
-                else:
-                    indices.append(i)
-            else:
-                b2j[elt] = [i]
+        if self.autojunk and n >= 200:
+            ntest = n // 100 + 1
+            for elt, idxs in list(b2j.items()):
+                if len(idxs) > ntest:
+                    popular.add(elt)
+                    del b2j[elt]
 
-        # Purge leftover indices for popular elements.
-        for elt in populardict:
-            del b2j[elt]
-
-        # Now b2j.keys() contains elements uniquely, and especially when
-        # the sequence is a string, that's usually a good deal smaller
-        # than len(string).  The difference is the number of isjunk calls
-        # saved.
-        isjunk = self.isjunk
-        junkdict = {}
-        if isjunk:
-            for d in populardict, b2j:
-                for elt in d.keys():
-                    if isjunk(elt):
-                        junkdict[elt] = 1
-                        del d[elt]
-
-        # Now for x in b, isjunk(x) == x in junkdict, but the
-        # latter is much faster.  Note too that while there may be a
-        # lot of junk in the sequence, the number of *unique* junk
-        # elements is probably small.  So the memory burden of keeping
-        # this dict alive is likely trivial compared to the size of b2j.
-        self.isbjunk = junkdict.__contains__
-        self.isbpopular = populardict.__contains__
+        # Now for x in b, isjunk(x) == x in junk, but the latter is much faster.
+        # Sicne the number of *unique* junk elements is probably small, the
+        # memory burden of keeping this set alive is likely trivial compared to
+        # the size of b2j.
+        self.isbjunk = junk.__contains__
+        self.isbpopular = popular.__contains__
 
     def find_longest_match(self, alo, ahi, blo, bhi):
         """Find longest matching block in a[alo:ahi] and b[blo:bhi].

File lib-python/2.7.0/distutils/README

 
 WARNING : Distutils must remain compatible with 2.3
 
-$Id: README 70017 2009-02-27 12:53:34Z tarek.ziade $
+$Id$

File lib-python/2.7.0/distutils/__init__.py

    setup (...)
 """
 
-__revision__ = "$Id: __init__.py 82506 2010-07-03 14:51:25Z benjamin.peterson $"
+__revision__ = "$Id$"
 
 # Distutils version
 #
 # Updated automatically by the Python release process.
 #
 #--start constants--
-__version__ = "2.7.1a0"
+__version__ = "2.7.1"
 #--end constants--

File lib-python/2.7.0/distutils/archive_util.py

 Utility functions for creating archive files (tarballs, zip files,
 that sort of thing)."""
 
-__revision__ = "$Id: archive_util.py 75659 2009-10-24 13:29:44Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 from warnings import warn

File lib-python/2.7.0/distutils/bcppcompiler.py

 # someone should sit down and factor out the common code as
 # WindowsCCompiler!  --GPW
 
-__revision__ = "$Id: bcppcompiler.py 76956 2009-12-21 01:22:46Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 

File lib-python/2.7.0/distutils/ccompiler.py

 Contains CCompiler, an abstract base class that defines the interface
 for the Distutils compiler abstraction model."""
 
-__revision__ = "$Id: ccompiler.py 77704 2010-01-23 09:23:15Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import sys
 import os
             library_dirs = []
         fd, fname = tempfile.mkstemp(".c", funcname, text=True)
         f = os.fdopen(fd, "w")
-        for incl in includes:
-            f.write("""#include "%s"\n""" % incl)
-        f.write("""\
+        try:
+            for incl in includes:
+                f.write("""#include "%s"\n""" % incl)
+            f.write("""\
 main (int argc, char **argv) {
     %s();
 }
 """ % funcname)
-        f.close()
+        finally:
+            f.close()
         try:
             objects = self.compile([fname], include_dirs=include_dirs)
         except CompileError:

File lib-python/2.7.0/distutils/cmd.py

 in the distutils.command package.
 """
 
-__revision__ = "$Id: cmd.py 75192 2009-10-02 23:49:48Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import sys, os, re
 from distutils.errors import DistutilsOptionError

File lib-python/2.7.0/distutils/command/__init__.py

 Package containing implementation of all the standard Distutils
 commands."""
 
-__revision__ = "$Id: __init__.py 71473 2009-04-11 14:55:07Z tarek.ziade $"
+__revision__ = "$Id$"
 
 __all__ = ['build',
            'build_py',

File lib-python/2.7.0/distutils/command/bdist.py

 Implements the Distutils 'bdist' command (create a built [binary]
 distribution)."""
 
-__revision__ = "$Id: bdist.py 77761 2010-01-26 22:46:15Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 

File lib-python/2.7.0/distutils/command/bdist_dumb.py

 distribution -- i.e., just an archive to be unpacked under $prefix or
 $exec_prefix)."""
 
-__revision__ = "$Id: bdist_dumb.py 77761 2010-01-26 22:46:15Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 

File lib-python/2.7.0/distutils/command/bdist_rpm.py

 Implements the Distutils 'bdist_rpm' command (create RPM source and binary
 distributions)."""
 
-__revision__ = "$Id: bdist_rpm.py 76956 2009-12-21 01:22:46Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import sys
 import os
             src_rpm, non_src_rpm, spec_path)
 
         out = os.popen(q_cmd)
-        binary_rpms = []
-        source_rpm = None
-        while 1:
-            line = out.readline()
-            if not line:
-                break
-            l = string.split(string.strip(line))
-            assert(len(l) == 2)
-            binary_rpms.append(l[1])
-            # The source rpm is named after the first entry in the spec file
-            if source_rpm is None:
-                source_rpm = l[0]
+        try:
+            binary_rpms = []
+            source_rpm = None
+            while 1:
+                line = out.readline()
+                if not line:
+                    break
+                l = string.split(string.strip(line))
+                assert(len(l) == 2)
+                binary_rpms.append(l[1])
+                # The source rpm is named after the first entry in the spec file
+                if source_rpm is None:
+                    source_rpm = l[0]
 
-        status = out.close()
-        if status:
-            raise DistutilsExecError("Failed to execute: %s" % repr(q_cmd))
+            status = out.close()
+            if status:
+                raise DistutilsExecError("Failed to execute: %s" % repr(q_cmd))
+
+        finally:
+            out.close()
 
         self.spawn(rpm_cmd)
 

File lib-python/2.7.0/distutils/command/bdist_wininst.py

 Implements the Distutils 'bdist_wininst' command: create a windows installer
 exe-program."""
 
-__revision__ = "$Id: bdist_wininst.py 83593 2010-08-02 21:44:25Z georg.brandl $"
+__revision__ = "$Id$"
 
 import sys
 import os
             sfix = ''
 
         filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix))
-        return open(filename, "rb").read()
+        f = open(filename, "rb")
+        try:
+            return f.read()
+        finally:
+            f.close()
 # class bdist_wininst

File lib-python/2.7.0/distutils/command/build.py

 
 Implements the Distutils 'build' command."""
 
-__revision__ = "$Id: build.py 77761 2010-01-26 22:46:15Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import sys, os
 

File lib-python/2.7.0/distutils/command/build_clib.py

 that is included in the module distribution and needed by an extension
 module."""
 
-__revision__ = "$Id: build_clib.py 84610 2010-09-07 22:18:34Z eric.araujo $"
+__revision__ = "$Id$"
 
 
 # XXX this module has *lots* of code ripped-off quite transparently from

File lib-python/2.7.0/distutils/command/build_ext.py

 
 # This module should be kept compatible with Python 2.1.
 
-__revision__ = "$Id: build_ext.py 84683 2010-09-10 20:03:17Z antoine.pitrou $"
+__revision__ = "$Id$"
 
 import sys, os, string, re
 from types import *

File lib-python/2.7.0/distutils/command/build_py.py

 
 Implements the Distutils 'build_py' command."""
 
-__revision__ = "$Id: build_py.py 76956 2009-12-21 01:22:46Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 import sys

File lib-python/2.7.0/distutils/command/build_scripts.py

 
 Implements the Distutils 'build_scripts' command."""
 
-__revision__ = "$Id: build_scripts.py 77704 2010-01-23 09:23:15Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os, re
 from stat import ST_MODE

File lib-python/2.7.0/distutils/command/check.py

 
 Implements the Distutils 'check' command.
 """
-__revision__ = "$Id: check.py 75266 2009-10-05 22:32:48Z andrew.kuchling $"
+__revision__ = "$Id$"
 
 from distutils.core import Command
 from distutils.errors import DistutilsSetupError

File lib-python/2.7.0/distutils/command/clean.py

 
 # contributed by Bastian Kleineidam <calvin@cs.uni-sb.de>, added 2000-03-18
 
-__revision__ = "$Id: clean.py 70886 2009-03-31 20:50:59Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 from distutils.core import Command

File lib-python/2.7.0/distutils/command/config.py

 this header file lives".
 """
 
-__revision__ = "$Id: config.py 77704 2010-01-23 09:23:15Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 import re

File lib-python/2.7.0/distutils/command/install.py

 
 # This module should be kept compatible with Python 2.1.
 
-__revision__ = "$Id: install.py 80804 2010-05-05 19:09:31Z ronald.oussoren $"
+__revision__ = "$Id$"
 
 import sys, os, string
 from types import *

File lib-python/2.7.0/distutils/command/install_data.py

 
 # contributed by Bastian Kleineidam
 
-__revision__ = "$Id: install_data.py 76849 2009-12-15 06:29:19Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 from distutils.core import Command

File lib-python/2.7.0/distutils/command/install_headers.py

 Implements the Distutils 'install_headers' command, to install C/C++ header
 files to the Python include directory."""
 
-__revision__ = "$Id: install_headers.py 70891 2009-03-31 20:55:21Z tarek.ziade $"
+__revision__ = "$Id$"
 
 from distutils.core import Command
 

File lib-python/2.7.0/distutils/command/install_lib.py

 Implements the Distutils 'install_lib' command
 (install all Python modules)."""
 
-__revision__ = "$Id: install_lib.py 75671 2009-10-24 15:51:30Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 import sys

File lib-python/2.7.0/distutils/command/install_scripts.py

 
 # contributed by Bastian Kleineidam
 
-__revision__ = "$Id: install_scripts.py 68943 2009-01-25 22:09:10Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 from distutils.core import Command

File lib-python/2.7.0/distutils/command/register.py

 
 # created 2002/10/21, Richard Jones
 
-__revision__ = "$Id: register.py 77717 2010-01-24 00:33:32Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import urllib2
 import getpass

File lib-python/2.7.0/distutils/command/sdist.py

 
 Implements the Distutils 'sdist' command (create a source distribution)."""
 
-__revision__ = "$Id: sdist.py 84713 2010-09-11 15:31:13Z eric.araujo $"
+__revision__ = "$Id$"
 
 import os
 import string

File lib-python/2.7.0/distutils/command/upload.py

 
         # Fill in the data - send all the meta-data in case we need to
         # register a new release
-        content = open(filename,'rb').read()
+        f = open(filename,'rb')
+        try:
+            content = f.read()
+        finally:
+            f.close()
         meta = self.distribution.metadata
         data = {
             # action

File lib-python/2.7.0/distutils/core.py

 really defined in distutils.dist and distutils.cmd.
 """
 
-__revision__ = "$Id: core.py 77704 2010-01-23 09:23:15Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import sys
 import os
             sys.argv[0] = script_name
             if script_args is not None:
                 sys.argv[1:] = script_args
-            exec open(script_name, 'r').read() in g, l
+            f = open(script_name)
+            try:
+                exec f.read() in g, l
+            finally:
+                f.close()
         finally:
             sys.argv = save_argv
             _setup_stop_after = None

File lib-python/2.7.0/distutils/cygwinccompiler.py

 
 # This module should be kept compatible with Python 2.1.
 
-__revision__ = "$Id: cygwinccompiler.py 78666 2010-03-05 00:16:02Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os,sys,copy
 from distutils.ccompiler import gen_preprocess_options, gen_lib_options
         # It would probably better to read single lines to search.
         # But we do this only once, and it is fast enough
         f = open(fn)
-        s = f.read()
-        f.close()
+        try:
+            s = f.read()
+        finally:
+            f.close()
 
     except IOError, exc:
         # if we can't read this file, we cannot say it is wrong

File lib-python/2.7.0/distutils/debug.py

 import os
 
-__revision__ = "$Id: debug.py 68943 2009-01-25 22:09:10Z tarek.ziade $"
+__revision__ = "$Id$"
 
 # If DISTUTILS_DEBUG is anything other than the empty string, we run in
 # debug mode.

File lib-python/2.7.0/distutils/dep_util.py

 and groups of files; also, function based entirely on such
 timestamp dependency analysis."""
 
-__revision__ = "$Id: dep_util.py 76746 2009-12-10 15:29:03Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os
 from distutils.errors import DistutilsFileError

File lib-python/2.7.0/distutils/dir_util.py

 
 Utility functions for manipulating directories and directory trees."""
 
-__revision__ = "$Id: dir_util.py 84862 2010-09-17 16:40:01Z senthil.kumaran $"
+__revision__ = "$Id$"
 
 import os
+import errno
 from distutils.errors import DistutilsFileError, DistutilsInternalError
 from distutils import log
 
         if not dry_run:
             try:
                 os.mkdir(head, mode)
-                created_dirs.append(head)
             except OSError, exc:
-                raise DistutilsFileError, \
-                      "could not create '%s': %s" % (head, exc[-1])
+                if not (exc.errno == errno.EEXIST and os.path.isdir(head)):
+                    raise DistutilsFileError(
+                          "could not create '%s': %s" % (head, exc.args[-1]))
+            created_dirs.append(head)
 
         _path_created[abs_head] = 1
     return created_dirs

File lib-python/2.7.0/distutils/dist.py

 being built/installed/distributed.
 """
 
-__revision__ = "$Id: dist.py 77717 2010-01-24 00:33:32Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import sys, os, re
 from email import message_from_file
     def write_pkg_info(self, base_dir):
         """Write the PKG-INFO file into the release tree.
         """
-        pkg_info = open( os.path.join(base_dir, 'PKG-INFO'), 'w')
-        self.write_pkg_file(pkg_info)
-        pkg_info.close()
+        pkg_info = open(os.path.join(base_dir, 'PKG-INFO'), 'w')
+        try:
+            self.write_pkg_file(pkg_info)
+        finally:
+            pkg_info.close()
 
     def write_pkg_file(self, file):
         """Write the PKG-INFO format data to a file object.

File lib-python/2.7.0/distutils/emxccompiler.py

 #
 # * EMX gcc 2.81/EMX 0.9d fix03
 
-__revision__ = "$Id: emxccompiler.py 78666 2010-03-05 00:16:02Z tarek.ziade $"
+__revision__ = "$Id$"
 
 import os,sys,copy
 from distutils.ccompiler import gen_preprocess_options, gen_lib_options
         # It would probably better to read single lines to search.