Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BTrees
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
BTrees
Commits
1effacfe
Commit
1effacfe
authored
Nov 09, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unwind L[LFO]BTree modules.
parent
ecf89154
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
376 additions
and
22 deletions
+376
-22
BTrees/LFBTree.py
BTrees/LFBTree.py
+134
-7
BTrees/LLBTree.py
BTrees/LLBTree.py
+134
-7
BTrees/LOBTree.py
BTrees/LOBTree.py
+108
-8
No files found.
BTrees/LFBTree.py
View file @
1effacfe
##############################################################################
#
# Copyright (c) 2001
, 200
2 Zope Foundation and Contributors.
# Copyright (c) 2001
-201
2 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
...
...
@@ -12,13 +12,140 @@
#
##############################################################################
import
zope.interface
import
BTrees.Interfaces
__all__
=
(
'Bucket'
,
'Set'
,
'BTree'
,
'TreeSet'
,
'LFBucket'
,
'LFSet'
,
'LFBTree'
,
'LFTreeSet'
,
'union'
,
'intersection'
,
'difference'
,
'weightedUnion'
,
'weightedIntersection'
,
'multiunion'
,
)
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_long
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
=
True
class
LFBucketPy
(
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
_LFBTree
import
LFBucket
except
ImportError
:
LFBucket
=
LFBucketPy
Bucket
=
LFBucket
class
LFSetPy
(
Set
):
MAX_SIZE
=
_BUCKET_SIZE
_to_key
=
_to_key
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
):
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
_LFBTree
import
*
from
_LFBTree
import
LFBTree
except
ImportError
:
import
___BTree
___BTree
.
_import
(
globals
(),
'LF'
,
120
,
500
)
LFBTree
=
LFBTreePy
BTree
=
LFBTree
class
LFTreeSetPy
(
TreeSet
):
MAX_SIZE
=
_TREE_SIZE
_to_key
=
_to_key
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:
LFBucketPy
.
_mapping_type
=
LFBucketPy
.
_bucket_type
=
LFBucketPy
LFBucketPy
.
_set_type
=
LFSetPy
LFSetPy
.
_mapping_type
=
LFBucketPy
LFSetPy
.
_set_type
=
LFSetPy
.
_bucket_type
=
LFSetPy
LFBTreePy
.
_mapping_type
=
LFBTreePy
.
_bucket_type
=
LFBucketPy
LFBTreePy
.
_set_type
=
LFSetPy
LFTreeSetPy
.
_mapping_type
=
LFBucketPy
LFTreeSetPy
.
_set_type
=
LFTreeSetPy
.
_bucket_type
=
LFSetPy
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
union
except
ImportError
:
weightedUnion
=
weightedUnionPy
weightedIntersectionPy
=
_setop
(
_weightedIntersection
,
LFSetPy
)
try
:
from
_OIBTree
import
weightedIntersection
except
ImportError
:
weightedIntersection
=
weightedIntersectionPy
zope
.
interface
.
moduleProvides
(
BTrees
.
Interfaces
.
IIntegerFloatBTreeModule
)
moduleProvides
(
IIntegerFloatBTreeModule
)
BTrees/LLBTree.py
View file @
1effacfe
##############################################################################
#
# Copyright (c) 2001
, 200
2 Zope Foundation and Contributors.
# Copyright (c) 2001
-201
2 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
...
...
@@ -12,13 +12,140 @@
#
##############################################################################
import
zope.interface
import
BTrees.Interfaces
__all__
=
(
'Bucket'
,
'Set'
,
'BTree'
,
'TreeSet'
,
'LLBucket'
,
'LLSet'
,
'LLBTree'
,
'LLTreeSet'
,
'union'
,
'intersection'
,
'difference'
,
'weightedUnion'
,
'weightedIntersection'
,
'multiunion'
,
)
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_long
as
_to_key
from
BTrees.___BTree
import
to_long
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
=
True
class
LLBucketPy
(
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
_LLBTree
import
LLBucket
except
ImportError
:
LLBucket
=
LLBucketPy
Bucket
=
LLBucket
class
LLSetPy
(
Set
):
MAX_SIZE
=
_BUCKET_SIZE
_to_key
=
_to_key
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
):
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
_LLBTree
import
*
from
_LLBTree
import
LLBTree
except
ImportError
:
import
___BTree
___BTree
.
_import
(
globals
(),
'LL'
,
120
,
500
)
LLBTree
=
LLBTreePy
BTree
=
LLBTree
class
LLTreeSetPy
(
TreeSet
):
MAX_SIZE
=
_TREE_SIZE
_to_key
=
_to_key
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:
LLBucketPy
.
_mapping_type
=
LLBucketPy
.
_bucket_type
=
LLBucketPy
LLBucketPy
.
_set_type
=
LLSetPy
LLSetPy
.
_mapping_type
=
LLBucketPy
LLSetPy
.
_set_type
=
LLSetPy
.
_bucket_type
=
LLSetPy
LLBTreePy
.
_mapping_type
=
LLBTreePy
.
_bucket_type
=
LLBucketPy
LLBTreePy
.
_set_type
=
LLSetPy
LLTreeSetPy
.
_mapping_type
=
LLBucketPy
LLTreeSetPy
.
_set_type
=
LLTreeSetPy
.
_bucket_type
=
LLSetPy
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
_OIBTree
import
union
except
ImportError
:
weightedUnion
=
weightedUnionPy
weightedIntersectionPy
=
_setop
(
_weightedIntersection
,
LLSetPy
)
try
:
from
_OIBTree
import
weightedIntersection
except
ImportError
:
weightedIntersection
=
weightedIntersectionPy
zope
.
interface
.
moduleProvides
(
BTrees
.
Interfaces
.
IIntegerIntegerBTreeModule
)
moduleProvides
(
IIntegerIntegerBTreeModule
)
BTrees/LOBTree.py
View file @
1effacfe
##############################################################################
#
# Copyright (c) 2001
, 200
2 Zope Foundation and Contributors.
# Copyright (c) 2001
-201
2 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'
,
'LOBucket'
,
'LOSet'
,
'LOBTree'
,
'LOTreeSet'
,
'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_long
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
=
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
*
from
_LOBTree
import
LOBTree
except
ImportError
:
import
___BTree
___BTree
.
_import
(
globals
(),
'LO'
,
60
,
500
)
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:
LOBucketPy
.
_mapping_type
=
LOBucketPy
.
_bucket_type
=
LOBucketPy
LOBucketPy
.
_set_type
=
LOSetPy
LOSetPy
.
_mapping_type
=
LOBucketPy
LOSetPy
.
_set_type
=
LOSetPy
.
_bucket_type
=
LOSetPy
LOBTreePy
.
_mapping_type
=
LOBTreePy
.
_bucket_type
=
LOBucketPy
LOBTreePy
.
_set_type
=
LOSetPy
LOTreeSetPy
.
_mapping_type
=
LOBucketPy
LOTreeSetPy
.
_set_type
=
LOTreeSetPy
.
_bucket_type
=
LOSetPy
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
multiunion
except
ImportError
:
multiunion
=
multiunionPy
zope
.
interface
.
moduleProvides
(
BTrees
.
Interfaces
.
IIntegerObjectBTreeModule
)
moduleProvides
(
IIntegerObjectBTreeModule
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment