[Checkins] SVN: BTrees/branches/pure_python/ Improve legibility by consolidating conditional imports.

Tres Seaver cvs-admin at zope.org
Fri Nov 9 06:36:29 UTC 2012


Log message for revision 128210:
  Improve legibility by consolidating conditional imports.

Changed:
  _U  BTrees/branches/pure_python/
  U   BTrees/branches/pure_python/BTrees/IFBTree.py
  U   BTrees/branches/pure_python/BTrees/IIBTree.py
  U   BTrees/branches/pure_python/BTrees/IOBTree.py
  U   BTrees/branches/pure_python/BTrees/LFBTree.py
  U   BTrees/branches/pure_python/BTrees/LLBTree.py
  U   BTrees/branches/pure_python/BTrees/LOBTree.py
  U   BTrees/branches/pure_python/BTrees/OIBTree.py
  U   BTrees/branches/pure_python/BTrees/OLBTree.py
  U   BTrees/branches/pure_python/BTrees/OOBTree.py
  U   BTrees/branches/pure_python/BTrees/fsBTree.py

-=-
Modified: BTrees/branches/pure_python/BTrees/IFBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/IFBTree.py	2012-11-09 06:36:28 UTC (rev 128209)
+++ BTrees/branches/pure_python/BTrees/IFBTree.py	2012-11-09 06:36:29 UTC (rev 128210)
@@ -49,11 +49,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _IFBTree import IFBucket
-except ImportError:
-    IFBucket = IFBucketPy
-Bucket = IFBucket
 
 
 class IFSetPy(Set):
@@ -62,11 +57,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _IFBTree import IFSet
-except ImportError:
-    IFSet = IFSetPy
-Set = IFSet
 
 
 class IFBTreePy(BTree):
@@ -76,11 +66,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _IFBTree import IFBTree
-except ImportError:
-    IFBTree = IFBTreePy
-BTree = IFBTree
 
 
 class IFTreeSetPy(TreeSet):
@@ -89,11 +74,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _IFBTree import IFTreeSet
-except ImportError:
-    IFTreeSet = IFTreeSetPy
-TreeSet = IFTreeSet
 
 
 # Can't declare forward refs, so fix up afterwards:
@@ -112,40 +92,38 @@
 
 
 differencePy = _setop(_difference, IFSetPy)
-try:
-    from _IFBTree import difference
-except ImportError:
-    difference = differencePy
-
 unionPy = _setop(_union, IFSetPy)
-try:
-    from _IFBTree import union
-except ImportError:
-    union = unionPy
-
 intersectionPy = _setop(_intersection, IFSetPy)
-try:
-    from _IFBTree import intersection
-except ImportError:
-    intersection = intersectionPy
-
 multiunionPy = _setop(_multiunion, IFSetPy)
-try:
-    from _IFBTree import multiunion
-except ImportError:
-    multiunion = multiunionPy
-
 weightedUnionPy = _setop(_weightedUnion, IFSetPy)
-try:
-    from _OIBTree import weightedUnion
-except ImportError:
-    weightedUnion = weightedUnionPy
-
 weightedIntersectionPy = _setop(_weightedIntersection, IFSetPy)
+
 try:
+    from _IFBTree import IFBucket
+    from _IFBTree import IFSet
+    from _IFBTree import IFBTree
+    from _IFBTree import IFTreeSet
+    from _IFBTree import difference
+    from _IFBTree import union
+    from _IFBTree import intersection
+    from _IFBTree import multiunion
+    from _OIBTree import weightedUnion
     from _OIBTree import weightedIntersection
-except ImportError:
+except ImportError: #pragma NO COVER
+    IFBucket = IFBucketPy
+    IFSet = IFSetPy
+    IFBTree = IFBTreePy
+    IFTreeSet = IFTreeSetPy
+    difference = differencePy
+    union = unionPy
+    intersection = intersectionPy
+    multiunion = multiunionPy
+    weightedUnion = weightedUnionPy
     weightedIntersection = weightedIntersectionPy
 
+Bucket = IFBucket
+Set = IFSet
+BTree = IFBTree
+TreeSet = IFTreeSet
 
 moduleProvides(IIntegerFloatBTreeModule)

Modified: BTrees/branches/pure_python/BTrees/IIBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/IIBTree.py	2012-11-09 06:36:28 UTC (rev 128209)
+++ BTrees/branches/pure_python/BTrees/IIBTree.py	2012-11-09 06:36:29 UTC (rev 128210)
@@ -42,6 +42,7 @@
 _TREE_SIZE = 500
 using64bits = False
 
+
 class IIBucketPy(Bucket):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
@@ -49,11 +50,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _IIBTree import IIBucket
-except ImportError:
-    IIBucket = IIBucketPy
-Bucket = IIBucket
 
 
 class IISetPy(Set):
@@ -62,11 +58,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _IIBTree import IISet
-except ImportError:
-    IISet = IISetPy
-Set = IISet
 
 
 class IIBTreePy(BTree):
@@ -76,11 +67,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _IIBTree import IIBTree
-except ImportError:
-    IIBTree = IIBTreePy
-BTree = IIBTree
 
 
 class IITreeSetPy(TreeSet):
@@ -89,11 +75,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _IIBTree import IITreeSet
-except ImportError:
-    IITreeSet = IITreeSetPy
-TreeSet = IITreeSet
 
 
 # Can't declare forward refs, so fix up afterwards:
@@ -112,40 +93,38 @@
 
 
 differencePy = _setop(_difference, IISetPy)
-try:
-    from _IIBTree import difference
-except ImportError:
-    difference = differencePy
-
 unionPy = _setop(_union, IISetPy)
-try:
-    from _IIBTree import union
-except ImportError:
-    union = unionPy
-
 intersectionPy = _setop(_intersection, IISetPy)
-try:
-    from _IIBTree import intersection
-except ImportError:
-    intersection = intersectionPy
-
 multiunionPy = _setop(_multiunion, IISetPy)
-try:
-    from _IIBTree import multiunion
-except ImportError:
-    multiunion = multiunionPy
-
 weightedUnionPy = _setop(_weightedUnion, IISetPy)
-try:
-    from _IIBTree import weightedUnion
-except ImportError:
-    weightedUnion = weightedUnionPy
 
 weightedIntersectionPy = _setop(_weightedIntersection, IISetPy)
 try:
+    from _IIBTree import IIBucket
+    from _IIBTree import IISet
+    from _IIBTree import IIBTree
+    from _IIBTree import IITreeSet
+    from _IIBTree import difference
+    from _IIBTree import union
+    from _IIBTree import intersection
+    from _IIBTree import multiunion
+    from _IIBTree import weightedUnion
     from _IIBTree import weightedIntersection
-except ImportError:
+except ImportError: #pragma NO COVER
+    IIBucket = IIBucketPy
+    IISet = IISetPy
+    IIBTree = IIBTreePy
+    IITreeSet = IITreeSetPy
+    difference = differencePy
+    union = unionPy
+    intersection = intersectionPy
+    multiunion = multiunionPy
+    weightedUnion = weightedUnionPy
     weightedIntersection = weightedIntersectionPy
 
+Bucket = IIBucket
+Set = IISet
+BTree = IIBTree
+TreeSet = IITreeSet
 
 moduleProvides(IIntegerIntegerBTreeModule)

Modified: BTrees/branches/pure_python/BTrees/IOBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/IOBTree.py	2012-11-09 06:36:28 UTC (rev 128209)
+++ BTrees/branches/pure_python/BTrees/IOBTree.py	2012-11-09 06:36:29 UTC (rev 128210)
@@ -36,50 +36,33 @@
 _TREE_SIZE = 500
 using64bits = False
 
+
 class IOBucketPy(Bucket):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
     _to_value = _to_value
+
     def MERGE_WEIGHT(self, value, weight):
         return value
-try:
-    from _IOBTree import IOBucket
-except ImportError:
-    IOBucket = IOBucketPy
-Bucket = IOBucket
 
 
 class IOSetPy(Set):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
-try:
-    from _IOBTree import IOSet
-except ImportError:
-    IOSet = IOSetPy
-Set = IOSet
 
 
 class IOBTreePy(BTree):
     MAX_SIZE = _TREE_SIZE
     _to_key = _to_key
     _to_value = _to_value
+
     def MERGE_WEIGHT(self, value, weight):
         return value
-try:
-    from _IOBTree import IOBTree
-except ImportError:
-    IOBTree = IOBTreePy
-BTree = IOBTree
 
 
 class IOTreeSetPy(TreeSet):
     MAX_SIZE = _TREE_SIZE
     _to_key = _to_key
-try:
-    from _IOBTree import IOTreeSet
-except ImportError:
-    IOTreeSet = IOTreeSetPy
-TreeSet = IOTreeSet
 
 
 # Can't declare forward refs, so fix up afterwards:
@@ -98,28 +81,32 @@
 
 
 differencePy = _setop(_difference, IOSetPy)
-try:
-    from _IOBTree import difference
-except ImportError:
-    difference = differencePy
-
 unionPy = _setop(_union, IOSetPy)
-try:
-    from _IOBTree import union
-except ImportError:
-    union = unionPy
-
 intersectionPy = _setop(_intersection, IOSetPy)
-try:
-    from _IOBTree import intersection
-except ImportError:
-    intersection = intersectionPy
-
 multiunionPy = _setop(_multiunion, IOSetPy)
+
 try:
+    from _IOBTree import IOBucket
+    from _IOBTree import IOSet
+    from _IOBTree import IOBTree
+    from _IOBTree import IOTreeSet
+    from _IOBTree import difference
+    from _IOBTree import union
+    from _IOBTree import intersection
     from _IOBTree import multiunion
-except ImportError:
+except ImportError: #pragma NO COVER
+    IOBucket = IOBucketPy
+    IOSet = IOSetPy
+    IOBTree = IOBTreePy
+    IOTreeSet = IOTreeSetPy
+    difference = differencePy
+    union = unionPy
+    intersection = intersectionPy
     multiunion = multiunionPy
 
+Bucket = IOBucket
+Set = IOSet
+BTree = IOBTree
+TreeSet = IOTreeSet
 
 moduleProvides(IIntegerObjectBTreeModule)

Modified: BTrees/branches/pure_python/BTrees/LFBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/LFBTree.py	2012-11-09 06:36:28 UTC (rev 128209)
+++ BTrees/branches/pure_python/BTrees/LFBTree.py	2012-11-09 06:36:29 UTC (rev 128210)
@@ -42,6 +42,7 @@
 _TREE_SIZE = 500
 using64bits = True
 
+
 class LFBucketPy(Bucket):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
@@ -49,11 +50,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _LFBTree import LFBucket
-except ImportError:
-    LFBucket = LFBucketPy
-Bucket = LFBucket
 
 
 class LFSetPy(Set):
@@ -62,11 +58,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _LFBTree import LFSet
-except ImportError:
-    LFSet = LFSetPy
-Set = LFSet
 
 
 class LFBTreePy(BTree):
@@ -76,11 +67,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _LFBTree import LFBTree
-except ImportError:
-    LFBTree = LFBTreePy
-BTree = LFBTree
 
 
 class LFTreeSetPy(TreeSet):
@@ -89,11 +75,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _LFBTree import LFTreeSet
-except ImportError:
-    LFTreeSet = LFTreeSetPy
-TreeSet = LFTreeSet
 
 
 # Can't declare forward refs, so fix up afterwards:
@@ -112,40 +93,38 @@
 
 
 differencePy = _setop(_difference, LFSetPy)
-try:
-    from _LFBTree import difference
-except ImportError:
-    difference = differencePy
-
 unionPy = _setop(_union, LFSetPy)
-try:
-    from _LFBTree import union
-except ImportError:
-    union = unionPy
-
 intersectionPy = _setop(_intersection, LFSetPy)
-try:
-    from _LFBTree import intersection
-except ImportError:
-    intersection = intersectionPy
-
 multiunionPy = _setop(_multiunion, LFSetPy)
-try:
-    from _LFBTree import multiunion
-except ImportError:
-    multiunion = multiunionPy
-
 weightedUnionPy = _setop(_weightedUnion, LFSetPy)
-try:
-    from _OIBTree import weightedUnion
-except ImportError:
-    weightedUnion = weightedUnionPy
-
 weightedIntersectionPy = _setop(_weightedIntersection, LFSetPy)
+
 try:
+    from _LFBTree import LFBucket
+    from _LFBTree import LFSet
+    from _LFBTree import LFBTree
+    from _LFBTree import LFTreeSet
+    from _LFBTree import difference
+    from _LFBTree import union
+    from _LFBTree import intersection
+    from _LFBTree import multiunion
+    from _OIBTree import weightedUnion
     from _OIBTree import weightedIntersection
-except ImportError:
+except ImportError: #pragma NO COVER
+    LFBucket = LFBucketPy
+    LFSet = LFSetPy
+    LFBTree = LFBTreePy
+    LFTreeSet = LFTreeSetPy
+    difference = differencePy
+    union = unionPy
+    intersection = intersectionPy
+    multiunion = multiunionPy
+    weightedUnion = weightedUnionPy
     weightedIntersection = weightedIntersectionPy
 
+Bucket = LFBucket
+Set = LFSet
+BTree = LFBTree
+TreeSet = LFTreeSet
 
 moduleProvides(IIntegerFloatBTreeModule)

Modified: BTrees/branches/pure_python/BTrees/LLBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/LLBTree.py	2012-11-09 06:36:28 UTC (rev 128209)
+++ BTrees/branches/pure_python/BTrees/LLBTree.py	2012-11-09 06:36:29 UTC (rev 128210)
@@ -42,6 +42,7 @@
 _TREE_SIZE = 500
 using64bits = True
 
+
 class LLBucketPy(Bucket):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
@@ -49,11 +50,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _LLBTree import LLBucket
-except ImportError:
-    LLBucket = LLBucketPy
-Bucket = LLBucket
 
 
 class LLSetPy(Set):
@@ -62,11 +58,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _LLBTree import LLSet
-except ImportError:
-    LLSet = LLSetPy
-Set = LLSet
 
 
 class LLBTreePy(BTree):
@@ -76,11 +67,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _LLBTree import LLBTree
-except ImportError:
-    LLBTree = LLBTreePy
-BTree = LLBTree
 
 
 class LLTreeSetPy(TreeSet):
@@ -89,11 +75,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _LLBTree import LLTreeSet
-except ImportError:
-    LLTreeSet = LLTreeSetPy
-TreeSet = LLTreeSet
 
 
 # Can't declare forward refs, so fix up afterwards:
@@ -112,40 +93,38 @@
 
 
 differencePy = _setop(_difference, LLSetPy)
-try:
-    from _LLBTree import difference
-except ImportError:
-    difference = differencePy
-
 unionPy = _setop(_union, LLSetPy)
-try:
-    from _LLBTree import union
-except ImportError:
-    union = unionPy
-
 intersectionPy = _setop(_intersection, LLSetPy)
-try:
-    from _LLBTree import intersection
-except ImportError:
-    intersection = intersectionPy
-
 multiunionPy = _setop(_multiunion, LLSetPy)
-try:
-    from _LLBTree import multiunion
-except ImportError:
-    multiunion = multiunionPy
-
 weightedUnionPy = _setop(_weightedUnion, LLSetPy)
-try:
-    from _LLBTree import weightedUnion
-except ImportError:
-    weightedUnion = weightedUnionPy
-
 weightedIntersectionPy = _setop(_weightedIntersection, LLSetPy)
+
 try:
+    from _LLBTree import LLBucket
+    from _LLBTree import LLSet
+    from _LLBTree import LLBTree
+    from _LLBTree import LLTreeSet
+    from _LLBTree import difference
+    from _LLBTree import union
+    from _LLBTree import intersection
+    from _LLBTree import multiunion
+    from _LLBTree import weightedUnion
     from _LLBTree import weightedIntersection
-except ImportError:
+except ImportError: #pragma NO COVER
+    LLBucket = LLBucketPy
+    LLSet = LLSetPy
+    LLBTree = LLBTreePy
+    LLTreeSet = LLTreeSetPy
+    difference = differencePy
+    union = unionPy
+    intersection = intersectionPy
+    multiunion = multiunionPy
+    weightedUnion = weightedUnionPy
     weightedIntersection = weightedIntersectionPy
 
+Bucket = LLBucket
+Set = LLSet
+BTree = LLBTree
+TreeSet = LLTreeSet
 
 moduleProvides(IIntegerIntegerBTreeModule)

Modified: BTrees/branches/pure_python/BTrees/LOBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/LOBTree.py	2012-11-09 06:36:28 UTC (rev 128209)
+++ BTrees/branches/pure_python/BTrees/LOBTree.py	2012-11-09 06:36:29 UTC (rev 128210)
@@ -36,50 +36,33 @@
 _TREE_SIZE = 500
 using64bits = True
 
+
 class LOBucketPy(Bucket):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
     _to_value = _to_value
+
     def MERGE_WEIGHT(self, value, weight):
         return value
-try:
-    from _LOBTree import LOBucket
-except ImportError:
-    LOBucket = LOBucketPy
-Bucket = LOBucket
 
 
 class LOSetPy(Set):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
-try:
-    from _LOBTree import LOSet
-except ImportError:
-    LOSet = LOSetPy
-Set = LOSet
 
 
 class LOBTreePy(BTree):
     MAX_SIZE = _TREE_SIZE
     _to_key = _to_key
     _to_value = _to_value
+
     def MERGE_WEIGHT(self, value, weight):
         return value
-try:
-    from _LOBTree import LOBTree
-except ImportError:
-    LOBTree = LOBTreePy
-BTree = LOBTree
 
 
 class LOTreeSetPy(TreeSet):
     MAX_SIZE = _TREE_SIZE
     _to_key = _to_key
-try:
-    from _LOBTree import LOTreeSet
-except ImportError:
-    LOTreeSet = LOTreeSetPy
-TreeSet = LOTreeSet
 
 
 # Can't declare forward refs, so fix up afterwards:
@@ -98,28 +81,32 @@
 
 
 differencePy = _setop(_difference, LOSetPy)
-try:
-    from _LOBTree import difference
-except ImportError:
-    difference = differencePy
-
 unionPy = _setop(_union, LOSetPy)
-try:
-    from _LOBTree import union
-except ImportError:
-    union = unionPy
-
 intersectionPy = _setop(_intersection, LOSetPy)
-try:
-    from _LOBTree import intersection
-except ImportError:
-    intersection = intersectionPy
-
 multiunionPy = _setop(_multiunion, LOSetPy)
+
 try:
+    from _LOBTree import LOBucket
+    from _LOBTree import LOSet
+    from _LOBTree import LOBTree
+    from _LOBTree import LOTreeSet
+    from _LOBTree import difference
+    from _LOBTree import union
+    from _LOBTree import intersection
     from _LOBTree import multiunion
-except ImportError:
+except ImportError: #pragma NO COVER
+    LOBucket = LOBucketPy
+    LOSet = LOSetPy
+    LOBTree = LOBTreePy
+    LOTreeSet = LOTreeSetPy
+    difference = differencePy
+    union = unionPy
+    intersection = intersectionPy
     multiunion = multiunionPy
 
+Bucket = LOBucket
+Set = LOSet
+BTree = LOBTree
+TreeSet = LOTreeSet
 
 moduleProvides(IIntegerObjectBTreeModule)

Modified: BTrees/branches/pure_python/BTrees/OIBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/OIBTree.py	2012-11-09 06:36:28 UTC (rev 128209)
+++ BTrees/branches/pure_python/BTrees/OIBTree.py	2012-11-09 06:36:29 UTC (rev 128210)
@@ -48,11 +48,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _OIBTree import OIBucket
-except ImportError:
-    OIBucket = OIBucketPy
-Bucket = OIBucket
 
 
 class OISetPy(Set):
@@ -61,11 +56,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _OIBTree import OISet
-except ImportError:
-    OISet = OISetPy
-Set = OISet
 
 
 class OIBTreePy(BTree):
@@ -75,11 +65,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _OIBTree import OIBTree
-except ImportError:
-    OIBTree = OIBTreePy
-BTree = OIBTree
 
 
 class OITreeSetPy(TreeSet):
@@ -88,11 +73,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_float
-try:
-    from _OIBTree import OITreeSet
-except ImportError:
-    OITreeSet = OITreeSetPy
-TreeSet = OITreeSet
 
 
 # Can't declare forward refs, so fix up afterwards:
@@ -111,34 +91,36 @@
 
 
 differencePy = _setop(_difference, OISetPy)
-try:
-    from _OIBTree import difference
-except ImportError:
-    difference = differencePy
-
 unionPy = _setop(_union, OISetPy)
-try:
-    from _OIBTree import union
-except ImportError:
-    union = unionPy
-
 intersectionPy = _setop(_intersection, OISetPy)
-try:
-    from _OIBTree import intersection
-except ImportError:
-    intersection = intersectionPy
-
 weightedUnionPy = _setop(_weightedUnion, OISetPy)
-try:
-    from _OIBTree import union
-except ImportError:
-    weightedUnion = weightedUnionPy
-
 weightedIntersectionPy = _setop(_weightedIntersection, OISetPy)
+
 try:
+    from _OIBTree import OIBucket
+    from _OIBTree import OISet
+    from _OIBTree import OIBTree
+    from _OIBTree import OITreeSet
+    from _OIBTree import difference
+    from _OIBTree import union
+    from _OIBTree import intersection
+    from _OIBTree import weightedUnion
     from _OIBTree import weightedIntersection
-except ImportError:
+except ImportError: #pragma NO COVER
+    OIBucket = OIBucketPy
+    OISet = OISetPy
+    OIBTree = OIBTreePy
+    OITreeSet = OITreeSetPy
+    difference = differencePy
+    union = unionPy
+    intersection = intersectionPy
+    weightedUnion = weightedUnionPy
     weightedIntersection = weightedIntersectionPy
 
 
+Bucket = OIBucket
+Set = OISet
+BTree = OIBTree
+TreeSet = OITreeSet
+
 moduleProvides(IObjectIntegerBTreeModule)

Modified: BTrees/branches/pure_python/BTrees/OLBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/OLBTree.py	2012-11-09 06:36:28 UTC (rev 128209)
+++ BTrees/branches/pure_python/BTrees/OLBTree.py	2012-11-09 06:36:29 UTC (rev 128210)
@@ -41,6 +41,7 @@
 _TREE_SIZE = 250
 using64bits = True
 
+
 class OLBucketPy(Bucket):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
@@ -48,11 +49,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _OLBTree import OLBucket
-except ImportError:
-    OLBucket = OLBucketPy
-Bucket = OLBucket
 
 
 class OLSetPy(Set):
@@ -61,11 +57,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _OLBTree import OLSet
-except ImportError:
-    OLSet = OLSetPy
-Set = OLSet
 
 
 class OLBTreePy(BTree):
@@ -75,11 +66,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _OLBTree import OLBTree
-except ImportError:
-    OLBTree = OLBTreePy
-BTree = OLBTree
 
 
 class OLTreeSetPy(TreeSet):
@@ -88,11 +74,6 @@
     MERGE = MERGE
     MERGE_WEIGHT = MERGE_WEIGHT_numeric
     MERGE_DEFAULT = MERGE_DEFAULT_int
-try:
-    from _OLBTree import OLTreeSet
-except ImportError:
-    OLTreeSet = OLTreeSetPy
-TreeSet = OLTreeSet
 
 
 # Can't declare forward refs, so fix up afterwards:
@@ -111,34 +92,35 @@
 
 
 differencePy = _setop(_difference, OLSetPy)
-try:
-    from _OLBTree import difference
-except ImportError:
-    difference = differencePy
-
 unionPy = _setop(_union, OLSetPy)
-try:
-    from _OLBTree import union
-except ImportError:
-    union = unionPy
-
 intersectionPy = _setop(_intersection, OLSetPy)
-try:
-    from _OLBTree import intersection
-except ImportError:
-    intersection = intersectionPy
-
 weightedUnionPy = _setop(_weightedUnion, OLSetPy)
-try:
-    from _OLBTree import weightedUnion
-except ImportError:
-    weightedUnion = weightedUnionPy
-
 weightedIntersectionPy = _setop(_weightedIntersection, OLSetPy)
+
 try:
+    from _OLBTree import OLBucket
+    from _OLBTree import OLSet
+    from _OLBTree import OLBTree
+    from _OLBTree import OLTreeSet
+    from _OLBTree import difference
+    from _OLBTree import union
+    from _OLBTree import intersection
+    from _OLBTree import weightedUnion
     from _OLBTree import weightedIntersection
-except ImportError:
+except ImportError: #pragma NO COVER
+    OLBucket = OLBucketPy
+    OLSet = OLSetPy
+    OLBTree = OLBTreePy
+    OLTreeSet = OLTreeSetPy
+    difference = differencePy
+    union = unionPy
+    intersection = intersectionPy
+    weightedUnion = weightedUnionPy
     weightedIntersection = weightedIntersectionPy
 
+Bucket = OLBucket
+Set = OLSet
+BTree = OLBTree
+TreeSet = OLTreeSet
 
 moduleProvides(IObjectIntegerBTreeModule)

Modified: BTrees/branches/pure_python/BTrees/OOBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/OOBTree.py	2012-11-09 06:36:28 UTC (rev 128209)
+++ BTrees/branches/pure_python/BTrees/OOBTree.py	2012-11-09 06:36:29 UTC (rev 128210)
@@ -35,50 +35,32 @@
 _TREE_SIZE = 250
 using64bits = False
 
+
 class OOBucketPy(Bucket):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
     _to_value = _to_value
+
     def MERGE_WEIGHT(self, value, weight):
         return value
-try:
-    from _OOBTree import OOBucket
-except ImportError:
-    OOBucket = OOBucketPy
-Bucket = OOBucket
 
-
 class OOSetPy(Set):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
-try:
-    from _OOBTree import OOSet
-except ImportError:
-    OOSet = OOSetPy
-Set = OOSet
 
 
 class OOBTreePy(BTree):
     MAX_SIZE = _TREE_SIZE
     _to_key = _to_key
     _to_value = _to_value
+
     def MERGE_WEIGHT(self, value, weight):
         return value
-try:
-    from _OOBTree import OOBTree
-except ImportError:
-    OOBTree = OOBTreePy
-BTree = OOBTree
 
 
 class OOTreeSetPy(TreeSet):
     MAX_SIZE = _TREE_SIZE
     _to_key = _to_key
-try:
-    from _OOBTree import OOTreeSet
-except ImportError:
-    OOTreeSet = OOTreeSetPy
-TreeSet = OOTreeSet
 
 
 # Can't declare forward refs, so fix up afterwards:
@@ -97,22 +79,29 @@
 
 
 differencePy = _setop(_difference, OOSetPy)
-try:
-    from _OOBTree import difference
-except ImportError:
-    difference = differencePy
-
 unionPy = _setop(_union, OOSetPy)
-try:
-    from _OOBTree import union
-except ImportError:
-    union = unionPy
-
 intersectionPy = _setop(_intersection, OOSetPy)
+
 try:
+    from _OOBTree import OOBucket
+    from _OOBTree import OOSet
+    from _OOBTree import OOBTree
+    from _OOBTree import OOTreeSet
+    from _OOBTree import difference
+    from _OOBTree import union
     from _OOBTree import intersection
-except ImportError:
+except ImportError: #pragma NO COVER
+    OOBucket = OOBucketPy
+    OOSet = OOSetPy
+    OOBTree = OOBTreePy
+    OOTreeSet = OOTreeSetPy
+    difference = differencePy
+    union = unionPy
     intersection = intersectionPy
 
+Bucket = OOBucket
+Set = OOSet
+BTree = OOBTree
+TreeSet = OOTreeSet
 
 moduleProvides(IObjectObjectBTreeModule)

Modified: BTrees/branches/pure_python/BTrees/fsBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/fsBTree.py	2012-11-09 06:36:28 UTC (rev 128209)
+++ BTrees/branches/pure_python/BTrees/fsBTree.py	2012-11-09 06:36:29 UTC (rev 128210)
@@ -41,14 +41,18 @@
 _to_key = _to_str(2)
 _to_value = _to_str(6)
 
+
 class fsBucketPy(Bucket):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
     _to_value = _to_value
+
     def MERGE_WEIGHT(self, value, weight):
         return value
+
     def toString(self):
         return ''.join(self._keys) + ''.join(self._values)
+
     def fromString(self, v):
         length = len(v)
         if length % 8 != 0:
@@ -62,21 +66,11 @@
             self._keys.append(key)
             self._values.append(value)
         return self
-try:
-    from _fsBTree import fsBucket
-except ImportError:
-    fsBucket = fsBucketPy
-Bucket = fsBucket
 
 
 class fsSetPy(Set):
     MAX_SIZE = _BUCKET_SIZE
     _to_key = _to_key
-try:
-    from _fsBTree import fsSet
-except ImportError:
-    fsSet = fsSetPy
-Set = fsSet
 
 
 class fsBTreePy(BTree):
@@ -85,21 +79,11 @@
     _to_value = _to_value
     def MERGE_WEIGHT(self, value, weight):
         return value
-try:
-    from _fsBTree import fsBTree
-except ImportError:
-    fsBTree = fsBTreePy
-BTree = fsBTree
 
 
 class fsTreeSetPy(TreeSet):
     MAX_SIZE = _TREE_SIZE
     _to_key = _to_key
-try:
-    from _fsBTree import fsTreeSet
-except ImportError:
-    fsTreeSet = fsTreeSetPy
-TreeSet = fsTreeSet
 
 
 # Can't declare forward refs, so fix up afterwards:
@@ -118,28 +102,32 @@
 
 
 differencePy = _setop(_difference, fsSetPy)
-try:
-    from _fsBTree import difference
-except ImportError:
-    difference = differencePy
-
 unionPy = _setop(_union, fsSetPy)
-try:
-    from _fsBTree import union
-except ImportError:
-    union = unionPy
-
 intersectionPy = _setop(_intersection, fsSetPy)
-try:
-    from _fsBTree import intersection
-except ImportError:
-    intersection = intersectionPy
-
 multiunionPy = _setop(_multiunion, fsSetPy)
+
 try:
+    from _fsBTree import fsBucket
+    from _fsBTree import fsSet
+    from _fsBTree import fsBTree
+    from _fsBTree import fsTreeSet
+    from _fsBTree import difference
+    from _fsBTree import union
+    from _fsBTree import intersection
     from _fsBTree import multiunion
-except ImportError:
+except ImportError: #pragma NO COVER
+    fsBucket = fsBucketPy
+    fsSet = fsSetPy
+    fsBTree = fsBTreePy
+    fsTreeSet = fsTreeSetPy
+    difference = differencePy
+    union = unionPy
+    intersection = intersectionPy
     multiunion = multiunionPy
 
+Bucket = fsBucket
+Set = fsSet
+BTree = fsBTree
+TreeSet = fsTreeSet
 
 moduleProvides(IIntegerObjectBTreeModule)



More information about the checkins mailing list