[Checkins] SVN: BTrees/branches/pure_python/ Unwind OI and OL modules.
Tres Seaver
cvs-admin at zope.org
Fri Nov 9 06:36:23 UTC 2012
Log message for revision 128203:
Unwind OI and OL modules.
Changed:
_U BTrees/branches/pure_python/
U BTrees/branches/pure_python/BTrees/OIBTree.py
U BTrees/branches/pure_python/BTrees/OLBTree.py
U BTrees/branches/pure_python/BTrees/OOBTree.py
-=-
Modified: BTrees/branches/pure_python/BTrees/OIBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/OIBTree.py 2012-11-09 00:56:34 UTC (rev 128202)
+++ BTrees/branches/pure_python/BTrees/OIBTree.py 2012-11-09 06:36:22 UTC (rev 128203)
@@ -1,6 +1,6 @@
##############################################################################
#
-# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
+# Copyright (c) 2001-2012 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
@@ -12,14 +12,127 @@
#
##############################################################################
-import zope.interface
-import BTrees.Interfaces
+from zope.interface import moduleProvides
-# hack to overcome dynamic-linking headache.
+from BTrees.Interfaces import IObjectIntegerBTreeModule
+from BTrees.___BTree import Bucket
+from BTrees.___BTree import MERGE
+from BTrees.___BTree import MERGE_WEIGHT_numeric
+from BTrees.___BTree import MERGE_DEFAULT_float
+from BTrees.___BTree import Set
+from BTrees.___BTree import Tree as BTree
+from BTrees.___BTree import TreeSet
+from BTrees.___BTree import difference as _difference
+from BTrees.___BTree import intersection as _intersection
+from BTrees.___BTree import setop as _setop
+from BTrees.___BTree import to_ob as _to_key
+from BTrees.___BTree import to_int as _to_value
+from BTrees.___BTree import union as _union
+from BTrees.___BTree import weightedIntersection as _weightedIntersection
+from BTrees.___BTree import weightedUnion as _weightedUnion
+
+_BUCKET_SIZE = 60
+_TREE_SIZE = 250
+using64bits = True
+
+class OIBucketPy(Bucket):
+ MAX_SIZE = _BUCKET_SIZE
+ _to_key = _to_key
+ _to_value = _to_value
+ MERGE = MERGE
+ MERGE_WEIGHT = MERGE_WEIGHT_numeric
+ MERGE_DEFAULT = MERGE_DEFAULT_float
try:
- from _OIBTree import *
+ from _OIBTree import OIBucket
except ImportError:
- import ___BTree
- ___BTree._import(globals(), 'OI', 60, 250)
+ OIBucket = OIBucketPy
+Bucket = OIBucket
-zope.interface.moduleProvides(BTrees.Interfaces.IObjectIntegerBTreeModule)
+
+class OISetPy(Set):
+ MAX_SIZE = _BUCKET_SIZE
+ _to_key = _to_key
+ 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):
+ MAX_SIZE = _TREE_SIZE
+ _to_key = _to_key
+ _to_value = _to_value
+ 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):
+ MAX_SIZE = _TREE_SIZE
+ _to_key = _to_key
+ 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:
+
+OIBucketPy._mapping_type = OIBucketPy._bucket_type = OIBucketPy
+OIBucketPy._set_type = OISetPy
+
+OISetPy._mapping_type = OIBucketPy
+OISetPy._set_type = OISetPy._bucket_type = OISetPy
+
+OIBTreePy._mapping_type = OIBTreePy._bucket_type = OIBucketPy
+OIBTreePy._set_type = OISetPy
+
+OITreeSetPy._mapping_type = OIBucketPy
+OITreeSetPy._set_type = OITreeSetPy._bucket_type = OISetPy
+
+
+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 weightedIntersection
+except ImportError:
+ weightedIntersection = weightedIntersectionPy
+
+
+moduleProvides(IObjectIntegerBTreeModule)
Modified: BTrees/branches/pure_python/BTrees/OLBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/OLBTree.py 2012-11-09 00:56:34 UTC (rev 128202)
+++ BTrees/branches/pure_python/BTrees/OLBTree.py 2012-11-09 06:36:22 UTC (rev 128203)
@@ -1,6 +1,6 @@
##############################################################################
#
-# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
+# Copyright (c) 2001-2012 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
@@ -12,14 +12,127 @@
#
##############################################################################
-import zope.interface
-import BTrees.Interfaces
+from zope.interface import moduleProvides
-# hack to overcome dynamic-linking headache.
+from BTrees.Interfaces import IObjectIntegerBTreeModule
+from BTrees.___BTree import Bucket
+from BTrees.___BTree import MERGE
+from BTrees.___BTree import MERGE_WEIGHT_numeric
+from BTrees.___BTree import MERGE_DEFAULT_float
+from BTrees.___BTree import Set
+from BTrees.___BTree import Tree as BTree
+from BTrees.___BTree import TreeSet
+from BTrees.___BTree import difference as _difference
+from BTrees.___BTree import intersection as _intersection
+from BTrees.___BTree import setop as _setop
+from BTrees.___BTree import to_ob as _to_key
+from BTrees.___BTree import to_int as _to_value
+from BTrees.___BTree import union as _union
+from BTrees.___BTree import weightedIntersection as _weightedIntersection
+from BTrees.___BTree import weightedUnion as _weightedUnion
+
+_BUCKET_SIZE = 60
+_TREE_SIZE = 250
+using64bits = True
+
+class OLBucketPy(Bucket):
+ MAX_SIZE = _BUCKET_SIZE
+ _to_key = _to_key
+ _to_value = _to_value
+ MERGE = MERGE
+ MERGE_WEIGHT = MERGE_WEIGHT_numeric
+ MERGE_DEFAULT = MERGE_DEFAULT_float
try:
- from _OLBTree import *
+ from _OLBTree import OLBucket
except ImportError:
- import ___BTree
- ___BTree._import(globals(), 'OL', 60, 250)
+ OLBucket = OLBucketPy
+Bucket = OLBucket
-zope.interface.moduleProvides(BTrees.Interfaces.IObjectIntegerBTreeModule)
+
+class OLSetPy(Set):
+ MAX_SIZE = _BUCKET_SIZE
+ _to_key = _to_key
+ MERGE = MERGE
+ MERGE_WEIGHT = MERGE_WEIGHT_numeric
+ MERGE_DEFAULT = MERGE_DEFAULT_float
+try:
+ from _OLBTree import OLSet
+except ImportError:
+ OLSet = OLSetPy
+Set = OLSet
+
+
+class OLBTreePy(BTree):
+ MAX_SIZE = _TREE_SIZE
+ _to_key = _to_key
+ _to_value = _to_value
+ MERGE = MERGE
+ MERGE_WEIGHT = MERGE_WEIGHT_numeric
+ MERGE_DEFAULT = MERGE_DEFAULT_float
+try:
+ from _OLBTree import OLBTree
+except ImportError:
+ OLBTree = OLBTreePy
+BTree = OLBTree
+
+
+class OLTreeSetPy(TreeSet):
+ MAX_SIZE = _TREE_SIZE
+ _to_key = _to_key
+ MERGE = MERGE
+ MERGE_WEIGHT = MERGE_WEIGHT_numeric
+ MERGE_DEFAULT = MERGE_DEFAULT_float
+try:
+ from _OLBTree import OLTreeSet
+except ImportError:
+ OLTreeSet = OLTreeSetPy
+TreeSet = OLTreeSet
+
+
+# Can't declare forward refs, so fix up afterwards:
+
+OLBucketPy._mapping_type = OLBucketPy._bucket_type = OLBucketPy
+OLBucketPy._set_type = OLSetPy
+
+OLSetPy._mapping_type = OLBucketPy
+OLSetPy._set_type = OLSetPy._bucket_type = OLSetPy
+
+OLBTreePy._mapping_type = OLBTreePy._bucket_type = OLBucketPy
+OLBTreePy._set_type = OLSetPy
+
+OLTreeSetPy._mapping_type = OLBucketPy
+OLTreeSetPy._set_type = OLTreeSetPy._bucket_type = OLSetPy
+
+
+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 union
+except ImportError:
+ weightedUnion = weightedUnionPy
+
+weightedIntersectionPy = _setop(_weightedIntersection, OLSetPy)
+try:
+ from _OLBTree import weightedIntersection
+except ImportError:
+ weightedIntersection = weightedIntersectionPy
+
+
+moduleProvides(IObjectIntegerBTreeModule)
Modified: BTrees/branches/pure_python/BTrees/OOBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/OOBTree.py 2012-11-09 00:56:34 UTC (rev 128202)
+++ BTrees/branches/pure_python/BTrees/OOBTree.py 2012-11-09 06:36:22 UTC (rev 128203)
@@ -1,6 +1,6 @@
##############################################################################
#
-# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
+# Copyright (c) 2001-2012 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
@@ -22,9 +22,9 @@
from BTrees.___BTree import difference as _difference
from BTrees.___BTree import intersection as _intersection
from BTrees.___BTree import setop as _setop
-from BTrees.___BTree import union as _union
from BTrees.___BTree import to_ob as _to_key
from BTrees.___BTree import to_ob as _to_value
+from BTrees.___BTree import union as _union
_BUCKET_SIZE = 30
_TREE_SIZE = 250
@@ -81,13 +81,13 @@
OOBucketPy._mapping_type = OOBucketPy._bucket_type = OOBucketPy
OOBucketPy._set_type = OOSetPy
-OOSetPy._mapping_type = OOSetPy
+OOSetPy._mapping_type = OOBucketPy
OOSetPy._set_type = OOSetPy._bucket_type = OOSetPy
OOBTreePy._mapping_type = OOBTreePy._bucket_type = OOBucketPy
OOBTreePy._set_type = OOSetPy
-OOTreeSetPy._mapping_type = OOSetPy
+OOTreeSetPy._mapping_type = OOBucketPy
OOTreeSetPy._set_type = OOTreeSetPy._bucket_type = OOSetPy
More information about the checkins
mailing list