Commit ecf89154 authored by Tres Seaver's avatar Tres Seaver

Unwind I[IFO]BTree modules.

parent 072a4d23
##############################################################################
#
# 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 IFBucket
except ImportError:
IFBucket = IFBucketPy
Bucket = IFBucket
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 _IFBTree import *
from _OIBTree import weightedIntersection
except ImportError:
import ___BTree
___BTree._import(globals(), 'IF', 120, 500)
weightedIntersection = weightedIntersectionPy
zope.interface.moduleProvides(BTrees.Interfaces.IIntegerFloatBTreeModule)
moduleProvides(IIntegerFloatBTreeModule)
##############################################################################
#
# 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 IIBucket
except ImportError:
IIBucket = IIBucketPy
Bucket = IIBucket
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 *
from _IIBTree import IIBTree
except ImportError:
import ___BTree
___BTree._import(globals(), 'II', 120, 500)
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
zope.interface.moduleProvides(BTrees.Interfaces.IIntegerIntegerBTreeModule)
moduleProvides(IIntegerIntegerBTreeModule)
##############################################################################
#
# 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 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 *
from _IOBTree import IOBTree
except ImportError:
import ___BTree
___BTree._import(globals(), 'IO', 60, 500)
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
zope.interface.moduleProvides(BTrees.Interfaces.IIntegerObjectBTreeModule)
moduleProvides(IIntegerObjectBTreeModule)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment