[Zodb-checkins] SVN: ZODB/trunk/src/BTrees/ re-jigger the family interface:

Fred L. Drake, Jr. fdrake at gmail.com
Thu Apr 26 10:27:57 EDT 2007


Log message for revision 74780:
  re-jigger the family interface:
  - use shorter names for the modules, since they are being used in a
    qualified context
  - add "OO" to both families so that a family is sufficient to get to all
    types of tree
  

Changed:
  U   ZODB/trunk/src/BTrees/Interfaces.py
  U   ZODB/trunk/src/BTrees/__init__.py
  U   ZODB/trunk/src/BTrees/family32.py
  U   ZODB/trunk/src/BTrees/family64.py
  U   ZODB/trunk/src/BTrees/tests/testBTrees.py

-=-
Modified: ZODB/trunk/src/BTrees/Interfaces.py
===================================================================
--- ZODB/trunk/src/BTrees/Interfaces.py	2007-04-26 09:14:47 UTC (rev 74779)
+++ ZODB/trunk/src/BTrees/Interfaces.py	2007-04-26 14:27:56 UTC (rev 74780)
@@ -440,16 +440,13 @@
         linear-time pass.
         """
 
-class IIntegerFamily(Interface):
+class IBTreeFamily(Interface):
     """the 64-bit or 32-bit family"""
-    IOModule = Attribute(
-        'The IIntegerObjectBTreeModule for this family')
-    OIModule = Attribute(
-        'The IObjectIntegerBTreeModule for this family')
-    IIModule = Attribute(
-        'The IIntegerIntegerBTreeModule for this family')
-    IFModule = Attribute(
-        'The IIntegerFloatBTreeModule for this family')
+    IO = Attribute('The IIntegerObjectBTreeModule for this family')
+    OI = Attribute('The IObjectIntegerBTreeModule for this family')
+    II = Attribute('The IIntegerIntegerBTreeModule for this family')
+    IF = Attribute('The IIntegerFloatBTreeModule for this family')
+    OO = Attribute('The IObjectObjectBTreeModule for this family')
     maxint = Attribute('The maximum integer storable in this family')
     minint = Attribute('The minimum integer storable in this family')
 
@@ -459,7 +456,7 @@
     
     describes IOBTree and LOBTree"""
     
-    family = Attribute('The IIntegerFamily of this module')
+    family = Attribute('The IBTreeFamily of this module')
 
 
 class IObjectIntegerBTreeModule(IBTreeModule, IIMerge):
@@ -470,7 +467,7 @@
     
     describes OIBTree and LOBTree"""
     
-    family = Attribute('The IIntegerFamily of this module')
+    family = Attribute('The IBTreeFamily of this module')
 
 
 class IIntegerIntegerBTreeModule(IBTreeModule, IIMerge, IMergeIntegerKey):
@@ -478,7 +475,7 @@
     
     describes IIBTree and LLBTree"""
     
-    family = Attribute('The IIntegerFamily of this module')
+    family = Attribute('The IBTreeFamily of this module')
 
 
 class IObjectObjectBTreeModule(IBTreeModule, IMerge):
@@ -489,13 +486,16 @@
     
     describes OOBTree"""
 
+    # Note that there's no ``family`` attribute; all families include
+    # the OO flavor of BTrees.
 
+
 class IIntegerFloatBTreeModule(IBTreeModule, IMerge):
     """keys, or set values, are integers; values are floats.
     
     describes IFBTree and LFBTree"""
     
-    family = Attribute('The IIntegerFamily of this module')
+    family = Attribute('The IBTreeFamily of this module')
 
 
 ###############################################################

Modified: ZODB/trunk/src/BTrees/__init__.py
===================================================================
--- ZODB/trunk/src/BTrees/__init__.py	2007-04-26 09:14:47 UTC (rev 74779)
+++ ZODB/trunk/src/BTrees/__init__.py	2007-04-26 14:27:56 UTC (rev 74780)
@@ -1,12 +1,12 @@
 import BTrees.family64
 import BTrees.family32
 
-BTrees.family64.IOModule.family = BTrees.family64
-BTrees.family64.OIModule.family = BTrees.family64
-BTrees.family64.IFModule.family = BTrees.family64
-BTrees.family64.IIModule.family = BTrees.family64
+BTrees.family64.IO.family = BTrees.family64
+BTrees.family64.OI.family = BTrees.family64
+BTrees.family64.IF.family = BTrees.family64
+BTrees.family64.II.family = BTrees.family64
 
-BTrees.family32.IOModule.family = BTrees.family32
-BTrees.family32.OIModule.family = BTrees.family32
-BTrees.family32.IFModule.family = BTrees.family32
-BTrees.family32.IIModule.family = BTrees.family32
+BTrees.family32.IO.family = BTrees.family32
+BTrees.family32.OI.family = BTrees.family32
+BTrees.family32.IF.family = BTrees.family32
+BTrees.family32.II.family = BTrees.family32

Modified: ZODB/trunk/src/BTrees/family32.py
===================================================================
--- ZODB/trunk/src/BTrees/family32.py	2007-04-26 09:14:47 UTC (rev 74779)
+++ ZODB/trunk/src/BTrees/family32.py	2007-04-26 14:27:56 UTC (rev 74780)
@@ -1,13 +1,27 @@
-import sys
+#############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+#############################################################################
+
 import zope.interface
 import BTrees.Interfaces
 
-from BTrees import IOBTree as IOModule
-from BTrees import OIBTree as OIModule
-from BTrees import IFBTree as IFModule
-from BTrees import IIBTree as IIModule
+from BTrees import IOBTree as IO
+from BTrees import OIBTree as OI
+from BTrees import IFBTree as IF
+from BTrees import IIBTree as II
+from BTrees import OOBTree as OO
 
 maxint = int(2**31-1)
 minint = -maxint - 1
 
-zope.interface.moduleProvides(BTrees.Interfaces.IIntegerFamily)
+zope.interface.moduleProvides(BTrees.Interfaces.IBTreeFamily)

Modified: ZODB/trunk/src/BTrees/family64.py
===================================================================
--- ZODB/trunk/src/BTrees/family64.py	2007-04-26 09:14:47 UTC (rev 74779)
+++ ZODB/trunk/src/BTrees/family64.py	2007-04-26 14:27:56 UTC (rev 74780)
@@ -1,13 +1,27 @@
-import sys
+#############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+#############################################################################
+
 import zope.interface
 import BTrees.Interfaces
 
-from BTrees import LOBTree as IOModule
-from BTrees import OLBTree as OIModule
-from BTrees import LFBTree as IFModule
-from BTrees import LLBTree as IIModule
+from BTrees import LOBTree as IO
+from BTrees import OLBTree as OI
+from BTrees import LFBTree as IF
+from BTrees import LLBTree as II
+from BTrees import OOBTree as OO
 
 maxint = 2**63-1
 minint = -maxint - 1
 
-zope.interface.moduleProvides(BTrees.Interfaces.IIntegerFamily)
+zope.interface.moduleProvides(BTrees.Interfaces.IBTreeFamily)

Modified: ZODB/trunk/src/BTrees/tests/testBTrees.py
===================================================================
--- ZODB/trunk/src/BTrees/tests/testBTrees.py	2007-04-26 09:14:47 UTC (rev 74779)
+++ ZODB/trunk/src/BTrees/tests/testBTrees.py	2007-04-26 14:27:56 UTC (rev 74780)
@@ -26,18 +26,7 @@
 from BTrees.LFBTree import LFBTree, LFBucket, LFSet, LFTreeSet
 from BTrees.OLBTree import OLBTree, OLBucket, OLSet, OLTreeSet
 
-import BTrees.family32
-import BTrees.family64
-import BTrees.OOBTree
-import BTrees.IOBTree
-import BTrees.IIBTree
-import BTrees.IFBTree
-import BTrees.OIBTree
-import BTrees.LOBTree
-import BTrees.LLBTree
-import BTrees.LFBTree
-import BTrees.OLBTree
-import BTrees.Interfaces
+import BTrees
 
 from BTrees.IIBTree import using64bits
 from BTrees.check import check
@@ -1691,15 +1680,17 @@
     def test32(self):
         self.assert_(
             zope.interface.verify.verifyObject(
-                BTrees.Interfaces.IIntegerFamily, BTrees.family32))
+                BTrees.Interfaces.IBTreeFamily, BTrees.family32))
         self.assertEquals(
-            BTrees.family32.IOModule, BTrees.IOBTree)
+            BTrees.family32.IO, BTrees.IOBTree)
         self.assertEquals(
-            BTrees.family32.OIModule, BTrees.OIBTree)
+            BTrees.family32.OI, BTrees.OIBTree)
         self.assertEquals(
-            BTrees.family32.IIModule, BTrees.IIBTree)
+            BTrees.family32.II, BTrees.IIBTree)
         self.assertEquals(
-            BTrees.family32.IFModule, BTrees.IFBTree)
+            BTrees.family32.IF, BTrees.IFBTree)
+        self.assertEquals(
+            BTrees.family32.OO, BTrees.OOBTree)
         s = IOTreeSet()
         s.insert(BTrees.family32.maxint)
         self.assert_(BTrees.family32.maxint in s)
@@ -1725,15 +1716,17 @@
     def test64(self):
         self.assert_(
             zope.interface.verify.verifyObject(
-                BTrees.Interfaces.IIntegerFamily, BTrees.family64))
+                BTrees.Interfaces.IBTreeFamily, BTrees.family64))
         self.assertEquals(
-            BTrees.family64.IOModule, BTrees.LOBTree)
+            BTrees.family64.IO, BTrees.LOBTree)
         self.assertEquals(
-            BTrees.family64.OIModule, BTrees.OLBTree)
+            BTrees.family64.OI, BTrees.OLBTree)
         self.assertEquals(
-            BTrees.family64.IIModule, BTrees.LLBTree)
+            BTrees.family64.II, BTrees.LLBTree)
         self.assertEquals(
-            BTrees.family64.IFModule, BTrees.LFBTree)
+            BTrees.family64.IF, BTrees.LFBTree)
+        self.assertEquals(
+            BTrees.family64.OO, BTrees.OOBTree)
         s = LOTreeSet()
         s.insert(BTrees.family64.maxint)
         self.assert_(BTrees.family64.maxint in s)



More information about the Zodb-checkins mailing list