[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/ - some coding-style updates

Christian Theune ct at gocept.com
Wed Apr 25 04:48:20 EDT 2007


Log message for revision 74736:
   - some coding-style updates
  

Changed:
  U   ZODB/trunk/src/ZODB/Blobs/Blob.py
  U   ZODB/trunk/src/ZODB/Blobs/__init__.py
  U   ZODB/trunk/src/ZODB/Connection.py
  U   ZODB/trunk/src/ZODB/FileStorage/fsdump.py
  U   ZODB/trunk/src/ZODB/broken.py

-=-
Modified: ZODB/trunk/src/ZODB/Blobs/Blob.py
===================================================================
--- ZODB/trunk/src/ZODB/Blobs/Blob.py	2007-04-25 08:44:04 UTC (rev 74735)
+++ ZODB/trunk/src/ZODB/Blobs/Blob.py	2007-04-25 08:48:19 UTC (rev 74736)
@@ -38,12 +38,14 @@
 
 
 class Blob(Persistent):
+    """A BLOB supports efficient handling of large data within ZODB."""
 
     zope.interface.implements(IBlob)
 
     # Binding this to an attribute allows overriding it in the unit tests
     if sys.platform == 'win32':
-        _os_link = lambda self, src, dst: win32file.CreateHardLink(dst, src, None)
+        _os_link = lambda self, src, dst: win32file.CreateHardLink(dst, src,
+                                                                   None)
     else:
         _os_link = os.link
 
@@ -92,7 +94,8 @@
 
             if self._p_blob_uncommitted is None:
                 # Create a new working copy
-                uncommitted = BlobFile(self._create_uncommitted_file(), mode, self)
+                uncommitted = BlobFile(self._create_uncommitted_file(),
+                                       mode, self)
                 # NOTE: _p_blob data appears by virtue of Connection._setstate
                 utils.cp(file(self._p_blob_data), uncommitted)
                 uncommitted.seek(0)
@@ -153,8 +156,8 @@
             if os.path.exists(target):
                 os.unlink(target)
 
-            # If there was a file moved aside, bring it back including the pointer to
-            # the uncommitted file.
+            # If there was a file moved aside, bring it back including the
+            # pointer to the uncommitted file.
             if previous_uncommitted:
                 os.rename(target_aside, target)
                 self._p_blob_uncommitted = target
@@ -179,7 +182,8 @@
         return self._p_blob_uncommitted or self._p_blob_data
 
     def _create_uncommitted_file(self):
-        assert self._p_blob_uncommitted is None, "Uncommitted file already exists."
+        assert self._p_blob_uncommitted is None, (
+            "Uncommitted file already exists.")
         tempdir = os.environ.get('ZODB_BLOB_TEMPDIR', tempfile.gettempdir())
         self._p_blob_uncommitted = utils.mktemp(dir=tempdir)
         return self._p_blob_uncommitted
@@ -276,8 +280,8 @@
     def _remove_uncommitted_data(self):
         self.blob._p_blob_clear()
         self.fhrefs.map(lambda fhref: fhref.close())
-        if self.blob._p_blob_uncommitted is not None and \
-           os.path.exists(self.blob._p_blob_uncommitted):
+        if (self.blob._p_blob_uncommitted is not None and
+            os.path.exists(self.blob._p_blob_uncommitted)):
             os.unlink(self.blob._p_blob_uncommitted)
             self.blob._p_blob_uncommitted = None
 

Modified: ZODB/trunk/src/ZODB/Blobs/__init__.py
===================================================================
--- ZODB/trunk/src/ZODB/Blobs/__init__.py	2007-04-25 08:44:04 UTC (rev 74735)
+++ ZODB/trunk/src/ZODB/Blobs/__init__.py	2007-04-25 08:48:19 UTC (rev 74736)
@@ -1 +1 @@
-# python package
+"""The ZODB Blob package."""

Modified: ZODB/trunk/src/ZODB/Connection.py
===================================================================
--- ZODB/trunk/src/ZODB/Connection.py	2007-04-25 08:44:04 UTC (rev 74735)
+++ ZODB/trunk/src/ZODB/Connection.py	2007-04-25 08:48:19 UTC (rev 74736)
@@ -863,8 +863,8 @@
         providedBy = getattr(obj, '__providedBy__', None)
         if providedBy is not None and IBlob in providedBy:
             obj._p_blob_uncommitted = None
-            obj._p_blob_data = \
-                    self._storage.loadBlob(obj._p_oid, serial, self._version)
+            obj._p_blob_data = self._storage.loadBlob(
+                obj._p_oid, serial, self._version)
 
     def _load_before_or_conflict(self, obj):
         """Load non-current state for obj or raise ReadConflictError."""

Modified: ZODB/trunk/src/ZODB/FileStorage/fsdump.py
===================================================================
--- ZODB/trunk/src/ZODB/FileStorage/fsdump.py	2007-04-25 08:44:04 UTC (rev 74735)
+++ ZODB/trunk/src/ZODB/FileStorage/fsdump.py	2007-04-25 08:48:19 UTC (rev 74736)
@@ -14,8 +14,8 @@
 import struct
 
 from ZODB.FileStorage import FileIterator
-from ZODB.FileStorage.format \
-     import TRANS_HDR, TRANS_HDR_LEN, DATA_HDR, DATA_HDR_LEN
+from ZODB.FileStorage.format import TRANS_HDR, TRANS_HDR_LEN, DATA_HDR, DATA_HDR_LEN
+from ZODB.FileStorage.format import DATA_HDR_LEN
 from ZODB.TimeStamp import TimeStamp
 from ZODB.utils import u64, get_pickle_metadata
 from ZODB.tests.StorageTestBase import zodb_unpickle
@@ -24,13 +24,13 @@
     iter = FileIterator(path)
     for i, trans in enumerate(iter):
         if with_offset:
-            print >> file, "Trans #%05d tid=%016x time=%s offset=%d" % \
-                  (i, u64(trans.tid), TimeStamp(trans.tid), trans._pos)
+            print >> file, ("Trans #%05d tid=%016x time=%s offset=%d" %
+                  (i, u64(trans.tid), TimeStamp(trans.tid), trans._pos))
         else:
-            print >> file, "Trans #%05d tid=%016x time=%s" % \
-                  (i, u64(trans.tid), TimeStamp(trans.tid))
-        print >> file, "    status=%r user=%r description=%r" % \
-              (trans.status, trans.user, trans.description)
+            print >> file, ("Trans #%05d tid=%016x time=%s" %
+                  (i, u64(trans.tid), TimeStamp(trans.tid)))
+        print >> file, ("    status=%r user=%r description=%r" %
+              (trans.status, trans.user, trans.description))
 
         for j, rec in enumerate(trans):
             if rec.data is None:
@@ -53,8 +53,8 @@
             else:
                 bp = ""
 
-            print >> file, "  data #%05d oid=%016x%s%s class=%s%s" % \
-                  (j, u64(rec.oid), version, size, fullclass, bp)
+            print >> file, ("  data #%05d oid=%016x%s%s class=%s%s" %
+                  (j, u64(rec.oid), version, size, fullclass, bp))
     iter.close()
 
 def fmt(p64):
@@ -123,8 +123,8 @@
             version = self.file.read(vlen)
             print >> self.dest, "version: %r" % version
             print >> self.dest, "non-version data offset: %d" % u64(pnv)
-            print >> self.dest, \
-                  "previous version data offset: %d" % u64(sprevdata)
+            print >> self.dest, ("previous version data offset: %d" %
+                                 u64(sprevdata))
         print >> self.dest, "len(data): %d" % dlen
         self.file.read(dlen)
         if not dlen:

Modified: ZODB/trunk/src/ZODB/broken.py
===================================================================
--- ZODB/trunk/src/ZODB/broken.py	2007-04-25 08:44:04 UTC (rev 74735)
+++ ZODB/trunk/src/ZODB/broken.py	2007-04-25 08:48:19 UTC (rev 74736)
@@ -281,11 +281,11 @@
 
         and persistent broken objects aren't directly picklable:
 
-          >>> a.__reduce__()
+          >>> a.__reduce__()    # doctest: +NORMALIZE_WHITESPACE
           Traceback (most recent call last):
           ...
-          BrokenModified: """ \
-        r"""<persistent broken not.there.Atall instance '\x00\x00\x00\x00****'>
+          BrokenModified: 
+          <persistent broken not.there.Atall instance '\x00\x00\x00\x00****'>
 
         but you can get their state:
 



More information about the Zodb-checkins mailing list