[Checkins] SVN: BTrees/branches/pure_python/ Unwind I[IFO]BTree modules.
Tres Seaver
cvs-admin at zope.org
Fri Nov 9 06:36:26 UTC 2012
Log message for revision 128206:
Unwind I[IFO]BTree modules.
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
-=-
Modified: BTrees/branches/pure_python/BTrees/IFBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/IFBTree.py 2012-11-09 06:36:24 UTC (rev 128205)
+++ BTrees/branches/pure_python/BTrees/IFBTree.py 2012-11-09 06:36:25 UTC (rev 128206)
@@ -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,15 +12,140 @@
#
##############################################################################
-import zope.interface
-import BTrees.Interfaces
+__all__ = ('Bucket', 'Set', 'BTree', 'TreeSet',
+ 'IFBucket', 'IFSet', 'IFBTree', 'IFTreeSet',
+ 'union', 'intersection', 'difference',
+ 'weightedUnion', 'weightedIntersection', 'multiunion',
+ )
-# hack to overcome dynamic-linking headache.
+from zope.interface import moduleProvides
+
+from BTrees.Interfaces import IIntegerFloatBTreeModule
+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 multiunion as _multiunion
+from BTrees.___BTree import setop as _setop
+from BTrees.___BTree import to_int as _to_key
+from BTrees.___BTree import to_float 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 = 120
+_TREE_SIZE = 500
+using64bits = False
+
+class IFBucketPy(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 _IFBTree import *
+ from _IFBTree import IFBucket
except ImportError:
- import ___BTree
- ___BTree._import(globals(), 'IF', 120, 500)
+ IFBucket = IFBucketPy
+Bucket = IFBucket
-zope.interface.moduleProvides(BTrees.Interfaces.IIntegerFloatBTreeModule)
+class IFSetPy(Set):
+ MAX_SIZE = _BUCKET_SIZE
+ _to_key = _to_key
+ 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):
+ 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 _IFBTree import IFBTree
+except ImportError:
+ IFBTree = IFBTreePy
+BTree = IFBTree
+
+
+class IFTreeSetPy(TreeSet):
+ MAX_SIZE = _TREE_SIZE
+ _to_key = _to_key
+ 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:
+
+IFBucketPy._mapping_type = IFBucketPy._bucket_type = IFBucketPy
+IFBucketPy._set_type = IFSetPy
+
+IFSetPy._mapping_type = IFBucketPy
+IFSetPy._set_type = IFSetPy._bucket_type = IFSetPy
+
+IFBTreePy._mapping_type = IFBTreePy._bucket_type = IFBucketPy
+IFBTreePy._set_type = IFSetPy
+
+IFTreeSetPy._mapping_type = IFBucketPy
+IFTreeSetPy._set_type = IFTreeSetPy._bucket_type = IFSetPy
+
+
+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 union
+except ImportError:
+ weightedUnion = weightedUnionPy
+
+weightedIntersectionPy = _setop(_weightedIntersection, IFSetPy)
+try:
+ from _OIBTree import weightedIntersection
+except ImportError:
+ weightedIntersection = weightedIntersectionPy
+
+
+moduleProvides(IIntegerFloatBTreeModule)
Modified: BTrees/branches/pure_python/BTrees/IIBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/IIBTree.py 2012-11-09 06:36:24 UTC (rev 128205)
+++ BTrees/branches/pure_python/BTrees/IIBTree.py 2012-11-09 06:36:25 UTC (rev 128206)
@@ -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,140 @@
#
##############################################################################
-import zope.interface
-import BTrees.Interfaces
+__all__ = ('Bucket', 'Set', 'BTree', 'TreeSet',
+ 'IIBucket', 'IISet', 'IIBTree', 'IITreeSet',
+ 'union', 'intersection', 'difference',
+ 'weightedUnion', 'weightedIntersection', 'multiunion',
+ )
-# hack to overcome dynamic-linking headache.
+from zope.interface import moduleProvides
+
+from BTrees.Interfaces import IIntegerIntegerBTreeModule
+from BTrees.___BTree import Bucket
+from BTrees.___BTree import MERGE
+from BTrees.___BTree import MERGE_WEIGHT_numeric
+from BTrees.___BTree import MERGE_DEFAULT_int
+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 multiunion as _multiunion
+from BTrees.___BTree import setop as _setop
+from BTrees.___BTree import to_int 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 = 120
+_TREE_SIZE = 500
+using64bits = False
+
+class IIBucketPy(Bucket):
+ MAX_SIZE = _BUCKET_SIZE
+ _to_key = _to_key
+ _to_value = _to_value
+ MERGE = MERGE
+ MERGE_WEIGHT = MERGE_WEIGHT_numeric
+ MERGE_DEFAULT = MERGE_DEFAULT_int
try:
- from _IIBTree import *
+ from _IIBTree import IIBucket
except ImportError:
- import ___BTree
- ___BTree._import(globals(), 'II', 120, 500)
+ IIBucket = IIBucketPy
+Bucket = IIBucket
-zope.interface.moduleProvides(BTrees.Interfaces.IIntegerIntegerBTreeModule)
+
+class IISetPy(Set):
+ MAX_SIZE = _BUCKET_SIZE
+ _to_key = _to_key
+ 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):
+ MAX_SIZE = _TREE_SIZE
+ _to_key = _to_key
+ _to_value = _to_value
+ 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):
+ MAX_SIZE = _TREE_SIZE
+ _to_key = _to_key
+ 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:
+
+IIBucketPy._mapping_type = IIBucketPy._bucket_type = IIBucketPy
+IIBucketPy._set_type = IISetPy
+
+IISetPy._mapping_type = IIBucketPy
+IISetPy._set_type = IISetPy._bucket_type = IISetPy
+
+IIBTreePy._mapping_type = IIBTreePy._bucket_type = IIBucketPy
+IIBTreePy._set_type = IISetPy
+
+IITreeSetPy._mapping_type = IIBucketPy
+IITreeSetPy._set_type = IITreeSetPy._bucket_type = IISetPy
+
+
+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 _OIBTree import union
+except ImportError:
+ weightedUnion = weightedUnionPy
+
+weightedIntersectionPy = _setop(_weightedIntersection, IISetPy)
+try:
+ from _OIBTree import weightedIntersection
+except ImportError:
+ weightedIntersection = weightedIntersectionPy
+
+
+moduleProvides(IIntegerIntegerBTreeModule)
Modified: BTrees/branches/pure_python/BTrees/IOBTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/IOBTree.py 2012-11-09 06:36:24 UTC (rev 128205)
+++ BTrees/branches/pure_python/BTrees/IOBTree.py 2012-11-09 06:36:25 UTC (rev 128206)
@@ -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,114 @@
#
##############################################################################
-import zope.interface
-import BTrees.Interfaces
+__all__ = ('Bucket', 'Set', 'BTree', 'TreeSet',
+ 'IOBucket', 'IOSet', 'IOBTree', 'IOTreeSet',
+ 'union', 'intersection', 'difference', 'multiunion',
+ )
-# hack to overcome dynamic-linking headache.
+from zope.interface import moduleProvides
+
+from BTrees.Interfaces import IIntegerObjectBTreeModule
+from BTrees.___BTree import Bucket
+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 multiunion as _multiunion
+from BTrees.___BTree import setop as _setop
+from BTrees.___BTree import to_int as _to_key
+from BTrees.___BTree import to_ob as _to_value
+from BTrees.___BTree import union as _union
+
+_BUCKET_SIZE = 60
+_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 *
+ from _IOBTree import IOBucket
except ImportError:
- import ___BTree
- ___BTree._import(globals(), 'IO', 60, 500)
+ IOBucket = IOBucketPy
+Bucket = IOBucket
-zope.interface.moduleProvides(BTrees.Interfaces.IIntegerObjectBTreeModule)
+
+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:
+
+IOBucketPy._mapping_type = IOBucketPy._bucket_type = IOBucketPy
+IOBucketPy._set_type = IOSetPy
+
+IOSetPy._mapping_type = IOBucketPy
+IOSetPy._set_type = IOSetPy._bucket_type = IOSetPy
+
+IOBTreePy._mapping_type = IOBTreePy._bucket_type = IOBucketPy
+IOBTreePy._set_type = IOSetPy
+
+IOTreeSetPy._mapping_type = IOBucketPy
+IOTreeSetPy._set_type = IOTreeSetPy._bucket_type = IOSetPy
+
+
+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 multiunion
+except ImportError:
+ multiunion = multiunionPy
+
+
+moduleProvides(IIntegerObjectBTreeModule)
More information about the checkins
mailing list