[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/ - style cleanups

Christian Theune ct at gocept.com
Wed Jun 6 10:22:07 EDT 2007


Log message for revision 76423:
   - style cleanups
  

Changed:
  U   ZODB/trunk/src/ZODB/FileStorage/FileStorage.py
  U   ZODB/trunk/src/ZODB/FileStorage/__init__.py
  U   ZODB/trunk/src/ZODB/FileStorage/fspack.py
  U   ZODB/trunk/src/ZODB/fstools.py
  U   ZODB/trunk/src/ZODB/interfaces.py
  U   ZODB/trunk/src/ZODB/scripts/migrate.py
  U   ZODB/trunk/src/ZODB/serialize.py
  U   ZODB/trunk/src/ZODB/tests/BasicStorage.py
  U   ZODB/trunk/src/ZODB/tests/MTStorage.py
  U   ZODB/trunk/src/ZODB/tests/RevisionStorage.py
  U   ZODB/trunk/src/ZODB/tests/testBroken.py
  U   ZODB/trunk/src/ZODB/tests/testConnection.py
  U   ZODB/trunk/src/ZODB/tests/testDB.py
  U   ZODB/trunk/src/ZODB/tests/testFileStorage.py
  U   ZODB/trunk/src/ZODB/tests/testMappingStorage.py
  U   ZODB/trunk/src/ZODB/tests/test_storage.py

-=-
Modified: ZODB/trunk/src/ZODB/FileStorage/FileStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/FileStorage/FileStorage.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/FileStorage/FileStorage.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -30,15 +30,16 @@
 fsync = getattr(os, "fsync", None)
 
 from ZODB import BaseStorage, ConflictResolution, POSException
-from ZODB.POSException \
-     import UndoError, POSKeyError, MultipleUndoErrors, VersionLockError
+from ZODB.POSException import UndoError, POSKeyError, MultipleUndoErrors
+from ZODB.POSException import VersionLockError
 from persistent.TimeStamp import TimeStamp
 from ZODB.lock_file import LockFile
 from ZODB.utils import p64, u64, cp, z64
 from ZODB.FileStorage.fspack import FileStoragePacker
-from ZODB.FileStorage.format \
-     import FileStorageFormatter, DataHeader, TxnHeader, DATA_HDR, \
-     DATA_HDR_LEN, TRANS_HDR, TRANS_HDR_LEN, CorruptedDataError
+from ZODB.FileStorage.format import FileStorageFormatter, DataHeader
+from ZODB.FileStorage.format import TxnHeader, DATA_HDR, DATA_HDR_LEN
+from ZODB.FileStorage.format import TRANS_HDR, TRANS_HDR_LEN
+from ZODB.FileStorage.format import CorruptedDataError
 from ZODB.loglevels import BLATHER
 from ZODB.fsIndex import fsIndex
 

Modified: ZODB/trunk/src/ZODB/FileStorage/__init__.py
===================================================================
--- ZODB/trunk/src/ZODB/FileStorage/__init__.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/FileStorage/__init__.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -1,4 +1,4 @@
 # this is a package
 
-from ZODB.FileStorage.FileStorage \
-     import FileStorage, RecordIterator, FileIterator, Record, packed_version
+from ZODB.FileStorage.FileStorage import FileStorage, RecordIterator
+from ZODB.FileStorage.FileStorage import FileIterator, Record, packed_version

Modified: ZODB/trunk/src/ZODB/FileStorage/fspack.py
===================================================================
--- ZODB/trunk/src/ZODB/FileStorage/fspack.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/FileStorage/fspack.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -30,9 +30,8 @@
 from ZODB.utils import p64, u64, z64
 
 from ZODB.fsIndex import fsIndex
-from ZODB.FileStorage.format \
-     import FileStorageFormatter, CorruptedDataError, DataHeader, \
-     TRANS_HDR_LEN
+from ZODB.FileStorage.format import FileStorageFormatter, CorruptedDataError
+from ZODB.FileStorage.format import DataHeader, TRANS_HDR_LEN
 
 class DataCopier(FileStorageFormatter):
     """Mixin class for copying transactions into a storage.

Modified: ZODB/trunk/src/ZODB/fstools.py
===================================================================
--- ZODB/trunk/src/ZODB/fstools.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/fstools.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -21,8 +21,8 @@
 import cPickle
 import struct
 
-from ZODB.FileStorage.format import TRANS_HDR, DATA_HDR, TRANS_HDR_LEN, \
-     DATA_HDR_LEN, DATA_VERSION_HDR_LEN
+from ZODB.FileStorage.format import TRANS_HDR, DATA_HDR, TRANS_HDR_LEN
+from ZODB.FileStorage.format import DATA_HDR_LEN, DATA_VERSION_HDR_LEN
 from ZODB.utils import u64
 from persistent.TimeStamp import TimeStamp
 

Modified: ZODB/trunk/src/ZODB/interfaces.py
===================================================================
--- ZODB/trunk/src/ZODB/interfaces.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/interfaces.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -230,8 +230,8 @@
 
     # Multi-database support.
 
-    connections = Attribute("""\
-        A mapping from database name to a Connection to that database.
+    connections = Attribute(
+        """A mapping from database name to a Connection to that database.
 
         In multi-database use, the Connections of all members of a database
         collection share the same .connections object.
@@ -345,8 +345,8 @@
     TODO: This interface is incomplete.
     """
 
-    databases = Attribute("""\
-        A mapping from database name to DB (database) object.
+    databases = Attribute(
+        """A mapping from database name to DB (database) object.
 
         In multi-database use, all DB members of a database collection share
         the same .databases object.

Modified: ZODB/trunk/src/ZODB/scripts/migrate.py
===================================================================
--- ZODB/trunk/src/ZODB/scripts/migrate.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/scripts/migrate.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -258,16 +258,16 @@
             t = TimeStamp(tid)
             if t <= ts:
                 if ok:
-                    print >> sys.stderr, \
-                          'Time stamps are out of order %s, %s' % (ts, t)
+                    print >> sys.stderr, (
+                        'Time stamps are out of order %s, %s' % (ts, t))
                     ok = False
                     ts = t.laterThan(ts)
                     tid = `ts`
                 else:
                     ts = t
                     if not ok:
-                        print >> sys.stderr, \
-                              'Time stamps are back in order %s' % t
+                        print >> sys.stderr, (
+                            'Time stamps are back in order %s' % t)
                         ok = True
         if verbose > 1:
             print ts

Modified: ZODB/trunk/src/ZODB/serialize.py
===================================================================
--- ZODB/trunk/src/ZODB/serialize.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/serialize.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -229,11 +229,11 @@
         If the jar doesn't match that of the writer, an error is raised:
 
         >>> bob._p_jar = DummyJar()
-        >>> writer.persistent_id(bob)
+        >>> writer.persistent_id(bob)   # doctest: +NORMALIZE_WHITESPACE
         Traceback (most recent call last):
           ...
-        InvalidObjectReference: Attempt to store an object from a """ \
-               """foreign database connection
+        InvalidObjectReference: Attempt to store an object from a
+            foreign database connection
 
         Constructor arguments used by __new__(), as returned by
         __getnewargs__(), can affect memory allocation, but may also

Modified: ZODB/trunk/src/ZODB/tests/BasicStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/BasicStorage.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/tests/BasicStorage.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -21,8 +21,8 @@
 
 from ZODB import POSException
 from ZODB.tests.MinPO import MinPO
-from ZODB.tests.StorageTestBase \
-     import zodb_unpickle, zodb_pickle, handle_serials
+from ZODB.tests.StorageTestBase import zodb_unpickle, zodb_pickle
+from ZODB.tests.StorageTestBase import handle_serials
 
 import transaction
 

Modified: ZODB/trunk/src/ZODB/tests/MTStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/MTStorage.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/tests/MTStorage.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -7,8 +7,8 @@
 import transaction
 
 import ZODB
-from ZODB.tests.StorageTestBase \
-     import zodb_pickle, zodb_unpickle, handle_serials
+from ZODB.tests.StorageTestBase import zodb_pickle, zodb_unpickle
+from ZODB.tests.StorageTestBase import handle_serials
 from ZODB.tests.MinPO import MinPO
 from ZODB.POSException import ConflictError
 

Modified: ZODB/trunk/src/ZODB/tests/RevisionStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/RevisionStorage.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/tests/RevisionStorage.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -14,8 +14,8 @@
 """Check loadSerial() on storages that support historical revisions."""
 
 from ZODB.tests.MinPO import MinPO
-from ZODB.tests.StorageTestBase import \
-     zodb_unpickle, zodb_pickle, snooze, handle_serials
+from ZODB.tests.StorageTestBase import zodb_unpickle, zodb_pickle, snooze
+from ZODB.tests.StorageTestBase import handle_serials
 from ZODB.utils import p64, u64
 
 import transaction

Modified: ZODB/trunk/src/ZODB/tests/testBroken.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testBroken.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/tests/testBroken.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -24,7 +24,7 @@
 from ZODB.tests.util import DB
 
 def test_integration():
-    """Test the integration of broken object support with the databse:
+    r"""Test the integration of broken object support with the databse:
 
     >>> db = DB()
 
@@ -64,9 +64,9 @@
 
     >>> conn3 = db.open()
     >>> a3 = conn3.root()['a']
-    >>> a3
-    <persistent broken ZODB.not.there.Atall instance """ \
-       r"""'\x00\x00\x00\x00\x00\x00\x00\x01'>
+    >>> a3  # doctest: +NORMALIZE_WHITESPACE
+    <persistent broken ZODB.not.there.Atall instance 
+        '\x00\x00\x00\x00\x00\x00\x00\x01'>
 
     >>> a3.__Broken_state__
     {'x': 1}

Modified: ZODB/trunk/src/ZODB/tests/testConnection.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testConnection.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/tests/testConnection.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -444,77 +444,75 @@
         """
 
 def test_invalidateCache():
-    """\
+    """The invalidateCache method invalidates a connection's cache.  It also
+    prevents reads until the end of a transaction::
 
-The invalidateCache method invalidates a connection's cache.  It also
-prevents reads until the end of a transaction.
+        >>> from ZODB.tests.util import DB
+        >>> import transaction
+        >>> db = DB()
+        >>> tm = transaction.TransactionManager()
+        >>> connection = db.open(transaction_manager=tm)
+        >>> connection.root()['a'] = StubObject()
+        >>> connection.root()['a'].x = 1
+        >>> connection.root()['b'] = StubObject()
+        >>> connection.root()['b'].x = 1
+        >>> connection.root()['c'] = StubObject()
+        >>> connection.root()['c'].x = 1
+        >>> tm.commit()
+        >>> connection.root()['b']._p_deactivate()
+        >>> connection.root()['c'].x = 2
 
-    >>> from ZODB.tests.util import DB
-    >>> import transaction
-    >>> db = DB()
-    >>> tm = transaction.TransactionManager()
-    >>> connection = db.open(transaction_manager=tm)
-    >>> connection.root()['a'] = StubObject()
-    >>> connection.root()['a'].x = 1
-    >>> connection.root()['b'] = StubObject()
-    >>> connection.root()['b'].x = 1
-    >>> connection.root()['c'] = StubObject()
-    >>> connection.root()['c'].x = 1
-    >>> tm.commit()
-    >>> connection.root()['b']._p_deactivate()
-    >>> connection.root()['c'].x = 2
+    So we have a connection and an active transaction with some modifications.
+    Lets call invalidateCache:
 
-So we have a connection and an active transaction with some
-modifications. Lets call invalidateCache:
+        >>> connection.invalidateCache()
 
-    >>> connection.invalidateCache()
+    Now, if we try to load an object, we'll get a read conflict:
 
-Now, if we try to load an object, we'll get a read conflict:
+        >>> connection.root()['b'].x
+        Traceback (most recent call last):
+        ...
+        ReadConflictError: database read conflict error
 
-    >>> connection.root()['b'].x
-    Traceback (most recent call last):
-    ...
-    ReadConflictError: database read conflict error
+    If we try to commit the transaction, we'll get a conflict error:
 
-If we try to commit the transaction, we'll get a conflict error:
+        >>> tm.commit()
+        Traceback (most recent call last):
+        ...
+        ConflictError: database conflict error
 
-    >>> tm.commit()
-    Traceback (most recent call last):
-    ...
-    ConflictError: database conflict error
+    and the cache will have been cleared:
 
-and the cache will have been cleared:
+        >>> print connection.root()['a']._p_changed
+        None
+        >>> print connection.root()['b']._p_changed
+        None
+        >>> print connection.root()['c']._p_changed
+        None
 
-    >>> print connection.root()['a']._p_changed
-    None
-    >>> print connection.root()['b']._p_changed
-    None
-    >>> print connection.root()['c']._p_changed
-    None
+    But we'll be able to access data again:
 
-But we'll be able to access data again:
+        >>> connection.root()['b'].x
+        1
 
-    >>> connection.root()['b'].x
-    1
+    Aborting a transaction after a read conflict also lets us read data and go
+    on about our business:
 
-Aborting a transaction after a read conflict also lets us read data
-and go on about our business:
-    
-    >>> connection.invalidateCache()
+        >>> connection.invalidateCache()
 
-    >>> connection.root()['c'].x
-    Traceback (most recent call last):
-    ...
-    ReadConflictError: database read conflict error
+        >>> connection.root()['c'].x
+        Traceback (most recent call last):
+        ...
+        ReadConflictError: database read conflict error
 
-    >>> tm.abort()
-    >>> connection.root()['c'].x
-    1
+        >>> tm.abort()
+        >>> connection.root()['c'].x
+        1
 
-    >>> connection.root()['c'].x = 2
-    >>> tm.commit()
+        >>> connection.root()['c'].x = 2
+        >>> tm.commit()
 
-    >>> db.close()
+        >>> db.close()
     """
 
 # ---- stubs

Modified: ZODB/trunk/src/ZODB/tests/testDB.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testDB.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/tests/testDB.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -143,47 +143,45 @@
 
 
 def test_invalidateCache():
-    """\
+    """The invalidateCache method invalidates a connection caches for all of
+    the connections attached to a database::
 
-The invalidateCache method invalidates a connection caches for all of the connections attached to a database.
+        >>> from ZODB.tests.util import DB
+        >>> import transaction
+        >>> db = DB()
+        >>> tm1 = transaction.TransactionManager()
+        >>> c1 = db.open(transaction_manager=tm1)
+        >>> c1.root()['a'] = MinPO(1)
+        >>> tm1.commit()
+        >>> tm2 = transaction.TransactionManager()
+        >>> c2 = db.open(transaction_manager=tm2)
+        >>> c1.root()['a']._p_deactivate()
+        >>> tm3 = transaction.TransactionManager()
+        >>> c3 = db.open(transaction_manager=tm3)
+        >>> c3.root()['a'].value
+        1
+        >>> c3.close()
+        >>> db.invalidateCache()
 
-    >>> from ZODB.tests.util import DB
-    >>> import transaction
-    >>> db = DB()
-    >>> tm1 = transaction.TransactionManager()
-    >>> c1 = db.open(transaction_manager=tm1)
-    >>> c1.root()['a'] = MinPO(1)
-    >>> tm1.commit()
-    >>> tm2 = transaction.TransactionManager()
-    >>> c2 = db.open(transaction_manager=tm2)
-    >>> c1.root()['a']._p_deactivate()
-    >>> tm3 = transaction.TransactionManager()
-    >>> c3 = db.open(transaction_manager=tm3)
-    >>> c3.root()['a'].value
-    1
-    >>> c3.close()
-    >>> db.invalidateCache()
-    
-    >>> c1.root()['a'].value
-    Traceback (most recent call last):
-    ...
-    ReadConflictError: database read conflict error
-    
-    >>> c2.root()['a'].value
-    Traceback (most recent call last):
-    ...
-    ReadConflictError: database read conflict error
+        >>> c1.root()['a'].value
+        Traceback (most recent call last):
+        ...
+        ReadConflictError: database read conflict error
 
-    >>> c3 is db.open(transaction_manager=tm3)
-    True
-    >>> print c3.root()['a']._p_changed
-    None
+        >>> c2.root()['a'].value
+        Traceback (most recent call last):
+        ...
+        ReadConflictError: database read conflict error
 
-    >>> db.close()
+        >>> c3 is db.open(transaction_manager=tm3)
+        True
+        >>> print c3.root()['a']._p_changed
+        None
+
+        >>> db.close()
     """
 
 
-
 def test_suite():
     s = unittest.makeSuite(DBTests)
     s.addTest(doctest.DocTestSuite())

Modified: ZODB/trunk/src/ZODB/tests/testFileStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testFileStorage.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/tests/testFileStorage.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -18,12 +18,12 @@
 from ZODB import POSException
 from ZODB import DB
 
-from ZODB.tests import StorageTestBase, BasicStorage, \
-     TransactionalUndoStorage, VersionStorage, \
-     TransactionalUndoVersionStorage, PackableStorage, \
-     Synchronization, ConflictResolution, HistoryStorage, \
-     IteratorStorage, Corruption, RevisionStorage, PersistentStorage, \
-     MTStorage, ReadOnlyStorage, RecoveryStorage
+from ZODB.tests import StorageTestBase, BasicStorage, TransactionalUndoStorage
+from ZODB.tests import VersionStorage, TransactionalUndoVersionStorage
+from ZODB.tests import PackableStorage, Synchronization, ConflictResolution
+from ZODB.tests import HistoryStorage, IteratorStorage, Corruption
+from ZODB.tests import RevisionStorage, PersistentStorage, MTStorage
+from ZODB.tests import ReadOnlyStorage, RecoveryStorage
 from ZODB.tests.StorageTestBase import MinPO, zodb_pickle
 
 class BaseFileStorageTests(StorageTestBase.StorageTestBase):

Modified: ZODB/trunk/src/ZODB/tests/testMappingStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testMappingStorage.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/tests/testMappingStorage.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -15,8 +15,8 @@
 import unittest
 
 from ZODB.tests import StorageTestBase
-from ZODB.tests \
-     import BasicStorage, MTStorage, Synchronization, PackableStorage
+from ZODB.tests import BasicStorage, MTStorage, Synchronization
+from ZODB.tests import PackableStorage
 
 class MappingStorageTests(StorageTestBase.StorageTestBase,
                           BasicStorage.BasicStorage,

Modified: ZODB/trunk/src/ZODB/tests/test_storage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/test_storage.py	2007-06-06 14:13:36 UTC (rev 76422)
+++ ZODB/trunk/src/ZODB/tests/test_storage.py	2007-06-06 14:22:06 UTC (rev 76423)
@@ -28,9 +28,8 @@
 from ZODB.utils import z64
 
 from ZODB.tests import StorageTestBase
-from ZODB.tests \
-     import BasicStorage, MTStorage, Synchronization, PackableStorage, \
-     RevisionStorage
+from ZODB.tests import BasicStorage, MTStorage, Synchronization
+from ZODB.tests import PackableStorage, RevisionStorage
 
 class Transaction(object):
     """Hold data for current transaction for MinimalMemoryStorage."""



More information about the Zodb-checkins mailing list