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
d861d116
Commit
d861d116
authored
May 25, 2014
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed max_bucket_size and max_btree_size
parent
e779278d
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
84 additions
and
80 deletions
+84
-80
BTrees/BTreeModuleTemplate.c
BTrees/BTreeModuleTemplate.c
+7
-7
BTrees/BTreeTemplate.c
BTrees/BTreeTemplate.c
+13
-13
BTrees/IFBTree.py
BTrees/IFBTree.py
+4
-4
BTrees/IIBTree.py
BTrees/IIBTree.py
+4
-4
BTrees/IOBTree.py
BTrees/IOBTree.py
+4
-4
BTrees/LFBTree.py
BTrees/LFBTree.py
+4
-4
BTrees/LLBTree.py
BTrees/LLBTree.py
+4
-4
BTrees/LOBTree.py
BTrees/LOBTree.py
+4
-4
BTrees/OIBTree.py
BTrees/OIBTree.py
+4
-4
BTrees/OLBTree.py
BTrees/OLBTree.py
+4
-4
BTrees/OOBTree.py
BTrees/OOBTree.py
+4
-4
BTrees/_base.py
BTrees/_base.py
+3
-3
BTrees/fsBTree.py
BTrees/fsBTree.py
+4
-4
BTrees/tests/test__base.py
BTrees/tests/test__base.py
+8
-8
BTrees/tests/test_btreesubclass.py
BTrees/tests/test_btreesubclass.py
+2
-2
CHANGES.rst
CHANGES.rst
+4
-4
docs/index.rst
docs/index.rst
+7
-3
No files found.
BTrees/BTreeModuleTemplate.c
View file @
d861d116
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
#define MODULE_NAME "BTrees." MOD_NAME_PREFIX "BTree."
#define MODULE_NAME "BTrees." MOD_NAME_PREFIX "BTree."
static
PyObject
*
sort_str
,
*
reverse_str
,
*
__setstate___str
;
static
PyObject
*
sort_str
,
*
reverse_str
,
*
__setstate___str
;
static
PyObject
*
_bucket_type_str
,
*
max_
btree_size_str
,
*
max_bucket
_size_str
;
static
PyObject
*
_bucket_type_str
,
*
max_
internal_size_str
,
*
max_leaf
_size_str
;
static
PyObject
*
ConflictError
=
NULL
;
static
PyObject
*
ConflictError
=
NULL
;
static
void
PyVar_Assign
(
PyObject
**
v
,
PyObject
*
e
)
{
Py_XDECREF
(
*
v
);
*
v
=
e
;}
static
void
PyVar_Assign
(
PyObject
**
v
,
PyObject
*
e
)
{
Py_XDECREF
(
*
v
);
*
v
=
e
;}
...
@@ -221,8 +221,8 @@ typedef struct BTree_s {
...
@@ -221,8 +221,8 @@ typedef struct BTree_s {
* data[len].key is positive infinity.
* data[len].key is positive infinity.
*/
*/
BTreeItem
*
data
;
BTreeItem
*
data
;
long
max_
btree
_size
;
long
max_
internal
_size
;
long
max_
bucket
_size
;
long
max_
leaf
_size
;
}
BTree
;
}
BTree
;
static
PyTypeObject
BTreeType
;
static
PyTypeObject
BTreeType
;
...
@@ -542,11 +542,11 @@ module_init(void)
...
@@ -542,11 +542,11 @@ module_init(void)
if
(
!
_bucket_type_str
)
if
(
!
_bucket_type_str
)
return
NULL
;
return
NULL
;
max_
btree_size_str
=
INTERN
(
"max_btree
_size"
);
max_
internal_size_str
=
INTERN
(
"max_internal
_size"
);
if
(
!
max_
btree
_size_str
)
if
(
!
max_
internal
_size_str
)
return
NULL
;
return
NULL
;
max_
bucket_size_str
=
INTERN
(
"max_bucket
_size"
);
max_
leaf_size_str
=
INTERN
(
"max_leaf
_size"
);
if
(
!
max_
bucket
_size_str
)
if
(
!
max_
leaf
_size_str
)
return
NULL
;
return
NULL
;
/* Grab the ConflictError class */
/* Grab the ConflictError class */
...
...
BTrees/BTreeTemplate.c
View file @
d861d116
...
@@ -43,24 +43,24 @@ _get_max_size(BTree *self, PyObject *name, long default_max)
...
@@ -43,24 +43,24 @@ _get_max_size(BTree *self, PyObject *name, long default_max)
}
}
static
int
static
int
_max_
btree
_size
(
BTree
*
self
)
_max_
internal
_size
(
BTree
*
self
)
{
{
long
isize
;
long
isize
;
if
(
self
->
max_
btree_size
>
0
)
return
self
->
max_btree
_size
;
if
(
self
->
max_
internal_size
>
0
)
return
self
->
max_internal
_size
;
isize
=
_get_max_size
(
self
,
max_
btree
_size_str
,
DEFAULT_MAX_BTREE_SIZE
);
isize
=
_get_max_size
(
self
,
max_
internal
_size_str
,
DEFAULT_MAX_BTREE_SIZE
);
self
->
max_
btree
_size
=
isize
;
self
->
max_
internal
_size
=
isize
;
return
isize
;
return
isize
;
}
}
static
int
static
int
_max_
bucket
_size
(
BTree
*
self
)
_max_
leaf
_size
(
BTree
*
self
)
{
{
long
isize
;
long
isize
;
if
(
self
->
max_
bucket_size
>
0
)
return
self
->
max_bucket
_size
;
if
(
self
->
max_
leaf_size
>
0
)
return
self
->
max_leaf
_size
;
isize
=
_get_max_size
(
self
,
max_
bucket
_size_str
,
DEFAULT_MAX_BUCKET_SIZE
);
isize
=
_get_max_size
(
self
,
max_
leaf
_size_str
,
DEFAULT_MAX_BUCKET_SIZE
);
self
->
max_
bucket
_size
=
isize
;
self
->
max_
leaf
_size
=
isize
;
return
isize
;
return
isize
;
}
}
...
@@ -459,7 +459,7 @@ BTree_grow(BTree *self, int index, int noval)
...
@@ -459,7 +459,7 @@ BTree_grow(BTree *self, int index, int noval)
if
(
self
->
len
)
if
(
self
->
len
)
{
{
long
max_size
=
_max_
btree
_size
(
self
);
long
max_size
=
_max_
internal
_size
(
self
);
if
(
max_size
<
0
)
return
-
1
;
if
(
max_size
<
0
)
return
-
1
;
d
=
self
->
data
+
index
;
d
=
self
->
data
+
index
;
...
@@ -780,12 +780,12 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
...
@@ -780,12 +780,12 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
assert
(
status
==
1
);
/* can be 2 only on deletes */
assert
(
status
==
1
);
/* can be 2 only on deletes */
if
(
SameType_Check
(
self
,
d
->
child
))
{
if
(
SameType_Check
(
self
,
d
->
child
))
{
long
max_size
=
_max_
btree
_size
(
self
);
long
max_size
=
_max_
internal
_size
(
self
);
if
(
max_size
<
0
)
return
-
1
;
if
(
max_size
<
0
)
return
-
1
;
toobig
=
childlength
>
max_size
;
toobig
=
childlength
>
max_size
;
}
}
else
{
else
{
long
max_size
=
_max_
bucket
_size
(
self
);
long
max_size
=
_max_
leaf
_size
(
self
);
if
(
max_size
<
0
)
return
-
1
;
if
(
max_size
<
0
)
return
-
1
;
toobig
=
childlength
>
max_size
;
toobig
=
childlength
>
max_size
;
}
}
...
@@ -2235,8 +2235,8 @@ BTree_init(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -2235,8 +2235,8 @@ BTree_init(PyObject *self, PyObject *args, PyObject *kwds)
{
{
PyObject
*
v
=
NULL
;
PyObject
*
v
=
NULL
;
BTREE
(
self
)
->
max_
bucket
_size
=
0
;
BTREE
(
self
)
->
max_
leaf
_size
=
0
;
BTREE
(
self
)
->
max_
btree
_size
=
0
;
BTREE
(
self
)
->
max_
internal
_size
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"|O:"
MOD_NAME_PREFIX
"BTree"
,
&
v
))
if
(
!
PyArg_ParseTuple
(
args
,
"|O:"
MOD_NAME_PREFIX
"BTree"
,
&
v
))
return
-
1
;
return
-
1
;
...
...
BTrees/IFBTree.py
View file @
d861d116
...
@@ -59,8 +59,8 @@ class IFSetPy(Set):
...
@@ -59,8 +59,8 @@ class IFSetPy(Set):
class
IFBTreePy
(
BTree
):
class
IFBTreePy
(
BTree
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
_to_value
=
_to_value
_to_value
=
_to_value
MERGE
=
MERGE
MERGE
=
MERGE
...
@@ -69,8 +69,8 @@ class IFBTreePy(BTree):
...
@@ -69,8 +69,8 @@ class IFBTreePy(BTree):
class
IFTreeSetPy
(
TreeSet
):
class
IFTreeSetPy
(
TreeSet
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
MERGE
=
MERGE
MERGE
=
MERGE
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
...
...
BTrees/IIBTree.py
View file @
d861d116
...
@@ -60,8 +60,8 @@ class IISetPy(Set):
...
@@ -60,8 +60,8 @@ class IISetPy(Set):
class
IIBTreePy
(
BTree
):
class
IIBTreePy
(
BTree
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
_to_value
=
_to_value
_to_value
=
_to_value
MERGE
=
MERGE
MERGE
=
MERGE
...
@@ -70,8 +70,8 @@ class IIBTreePy(BTree):
...
@@ -70,8 +70,8 @@ class IIBTreePy(BTree):
class
IITreeSetPy
(
TreeSet
):
class
IITreeSetPy
(
TreeSet
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
MERGE
=
MERGE
MERGE
=
MERGE
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
...
...
BTrees/IOBTree.py
View file @
d861d116
...
@@ -50,16 +50,16 @@ class IOSetPy(Set):
...
@@ -50,16 +50,16 @@ class IOSetPy(Set):
class
IOBTreePy
(
BTree
):
class
IOBTreePy
(
BTree
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
_to_value
=
_to_value
_to_value
=
_to_value
MERGE_WEIGHT
=
MERGE_WEIGHT_default
MERGE_WEIGHT
=
MERGE_WEIGHT_default
class
IOTreeSetPy
(
TreeSet
):
class
IOTreeSetPy
(
TreeSet
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
class
IOTreeIteratorPy
(
_TreeIterator
):
class
IOTreeIteratorPy
(
_TreeIterator
):
...
...
BTrees/LFBTree.py
View file @
d861d116
...
@@ -60,8 +60,8 @@ class LFSetPy(Set):
...
@@ -60,8 +60,8 @@ class LFSetPy(Set):
class
LFBTreePy
(
BTree
):
class
LFBTreePy
(
BTree
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
_to_value
=
_to_value
_to_value
=
_to_value
MERGE
=
MERGE
MERGE
=
MERGE
...
@@ -70,8 +70,8 @@ class LFBTreePy(BTree):
...
@@ -70,8 +70,8 @@ class LFBTreePy(BTree):
class
LFTreeSetPy
(
TreeSet
):
class
LFTreeSetPy
(
TreeSet
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
MERGE
=
MERGE
MERGE
=
MERGE
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
...
...
BTrees/LLBTree.py
View file @
d861d116
...
@@ -60,8 +60,8 @@ class LLSetPy(Set):
...
@@ -60,8 +60,8 @@ class LLSetPy(Set):
class
LLBTreePy
(
BTree
):
class
LLBTreePy
(
BTree
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
_to_value
=
_to_value
_to_value
=
_to_value
MERGE
=
MERGE
MERGE
=
MERGE
...
@@ -70,8 +70,8 @@ class LLBTreePy(BTree):
...
@@ -70,8 +70,8 @@ class LLBTreePy(BTree):
class
LLTreeSetPy
(
TreeSet
):
class
LLTreeSetPy
(
TreeSet
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
MERGE
=
MERGE
MERGE
=
MERGE
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
...
...
BTrees/LOBTree.py
View file @
d861d116
...
@@ -50,16 +50,16 @@ class LOSetPy(Set):
...
@@ -50,16 +50,16 @@ class LOSetPy(Set):
class
LOBTreePy
(
BTree
):
class
LOBTreePy
(
BTree
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
_to_value
=
_to_value
_to_value
=
_to_value
MERGE_WEIGHT
=
MERGE_WEIGHT_default
MERGE_WEIGHT
=
MERGE_WEIGHT_default
class
LOTreeSetPy
(
TreeSet
):
class
LOTreeSetPy
(
TreeSet
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
...
...
BTrees/OIBTree.py
View file @
d861d116
...
@@ -58,8 +58,8 @@ class OISetPy(Set):
...
@@ -58,8 +58,8 @@ class OISetPy(Set):
class
OIBTreePy
(
BTree
):
class
OIBTreePy
(
BTree
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
_to_value
=
_to_value
_to_value
=
_to_value
MERGE
=
MERGE
MERGE
=
MERGE
...
@@ -68,8 +68,8 @@ class OIBTreePy(BTree):
...
@@ -68,8 +68,8 @@ class OIBTreePy(BTree):
class
OITreeSetPy
(
TreeSet
):
class
OITreeSetPy
(
TreeSet
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
MERGE
=
MERGE
MERGE
=
MERGE
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
...
...
BTrees/OLBTree.py
View file @
d861d116
...
@@ -59,8 +59,8 @@ class OLSetPy(Set):
...
@@ -59,8 +59,8 @@ class OLSetPy(Set):
class
OLBTreePy
(
BTree
):
class
OLBTreePy
(
BTree
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
_to_value
=
_to_value
_to_value
=
_to_value
MERGE
=
MERGE
MERGE
=
MERGE
...
@@ -69,8 +69,8 @@ class OLBTreePy(BTree):
...
@@ -69,8 +69,8 @@ class OLBTreePy(BTree):
class
OLTreeSetPy
(
TreeSet
):
class
OLTreeSetPy
(
TreeSet
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
MERGE
=
MERGE
MERGE
=
MERGE
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
MERGE_WEIGHT
=
MERGE_WEIGHT_numeric
...
...
BTrees/OOBTree.py
View file @
d861d116
...
@@ -47,15 +47,15 @@ class OOSetPy(Set):
...
@@ -47,15 +47,15 @@ class OOSetPy(Set):
class
OOBTreePy
(
BTree
):
class
OOBTreePy
(
BTree
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
_to_value
=
_to_value
_to_value
=
_to_value
class
OOTreeSetPy
(
TreeSet
):
class
OOTreeSetPy
(
TreeSet
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
...
...
BTrees/_base.py
View file @
d861d116
...
@@ -868,9 +868,9 @@ class _Tree(_Base):
...
@@ -868,9 +868,9 @@ class _Tree(_Base):
grew
=
result
[
0
]
grew
=
result
[
0
]
if
grew
:
if
grew
:
if
child
.
__class__
is
self
.
__class__
:
if
child
.
__class__
is
self
.
__class__
:
max_size
=
self
.
max_
btree
_size
max_size
=
self
.
max_
internal
_size
else
:
else
:
max_size
=
self
.
max_
bucket
_size
max_size
=
self
.
max_
leaf
_size
if
child
.
size
>
max_size
:
if
child
.
size
>
max_size
:
self
.
_grow
(
child
,
index
)
self
.
_grow
(
child
,
index
)
elif
(
grew
is
not
None
and
elif
(
grew
is
not
None
and
...
@@ -885,7 +885,7 @@ class _Tree(_Base):
...
@@ -885,7 +885,7 @@ class _Tree(_Base):
self
.
_p_changed
=
True
self
.
_p_changed
=
True
new_child
=
child
.
_split
()
new_child
=
child
.
_split
()
self
.
_data
.
insert
(
index
+
1
,
_TreeItem
(
new_child
.
minKey
(),
new_child
))
self
.
_data
.
insert
(
index
+
1
,
_TreeItem
(
new_child
.
minKey
(),
new_child
))
if
len
(
self
.
_data
)
>=
self
.
max_
btree
_size
*
2
:
if
len
(
self
.
_data
)
>=
self
.
max_
internal
_size
*
2
:
self
.
_split_root
()
self
.
_split_root
()
def
_split_root
(
self
):
def
_split_root
(
self
):
...
...
BTrees/fsBTree.py
View file @
d861d116
...
@@ -69,15 +69,15 @@ class fsSetPy(Set):
...
@@ -69,15 +69,15 @@ class fsSetPy(Set):
class
fsBTreePy
(
BTree
):
class
fsBTreePy
(
BTree
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
_to_value
=
_to_value
_to_value
=
_to_value
class
fsTreeSetPy
(
TreeSet
):
class
fsTreeSetPy
(
TreeSet
):
max_
bucket
_size
=
_BUCKET_SIZE
max_
leaf
_size
=
_BUCKET_SIZE
max_
btree
_size
=
_TREE_SIZE
max_
internal
_size
=
_TREE_SIZE
_to_key
=
_to_key
_to_key
=
_to_key
...
...
BTrees/tests/test__base.py
View file @
d861d116
...
@@ -30,8 +30,8 @@ class Test_Base(unittest.TestCase):
...
@@ -30,8 +30,8 @@ class Test_Base(unittest.TestCase):
def
_makeOne
(
self
,
items
=
None
):
def
_makeOne
(
self
,
items
=
None
):
class
_Test
(
self
.
_getTargetClass
()):
class
_Test
(
self
.
_getTargetClass
()):
max_
bucket
_size
=
10
max_
leaf
_size
=
10
max_
btree
_size
=
15
max_
internal
_size
=
15
def
clear
(
self
):
def
clear
(
self
):
self
.
_data
=
{}
self
.
_data
=
{}
def
update
(
self
,
d
):
def
update
(
self
,
d
):
...
@@ -1403,8 +1403,8 @@ class Test_Tree(unittest.TestCase):
...
@@ -1403,8 +1403,8 @@ class Test_Tree(unittest.TestCase):
class
_Test
(
self
.
_getTargetClass
()):
class
_Test
(
self
.
_getTargetClass
()):
_to_key
=
_to_value
=
lambda
self
,
x
:
x
_to_key
=
_to_value
=
lambda
self
,
x
:
x
_bucket_type
=
_Bucket
_bucket_type
=
_Bucket
max_
bucket
_size
=
10
max_
leaf
_size
=
10
max_
btree
_size
=
15
max_
internal
_size
=
15
return
_Test
(
items
)
return
_Test
(
items
)
def
test_setdefault_miss
(
self
):
def
test_setdefault_miss
(
self
):
...
@@ -2220,8 +2220,8 @@ class TreeTests(unittest.TestCase):
...
@@ -2220,8 +2220,8 @@ class TreeTests(unittest.TestCase):
class
_Test
(
self
.
_getTargetClass
()):
class
_Test
(
self
.
_getTargetClass
()):
_to_key
=
_to_value
=
lambda
self
,
x
:
x
_to_key
=
_to_value
=
lambda
self
,
x
:
x
_bucket_type
=
_Bucket
_bucket_type
=
_Bucket
max_
bucket
_size
=
10
max_
leaf
_size
=
10
max_
btree
_size
=
15
max_
internal
_size
=
15
return
_Test
(
items
)
return
_Test
(
items
)
def
test_get_empty_miss
(
self
):
def
test_get_empty_miss
(
self
):
...
@@ -2365,8 +2365,8 @@ class TreeSetTests(unittest.TestCase):
...
@@ -2365,8 +2365,8 @@ class TreeSetTests(unittest.TestCase):
class
_Test
(
self
.
_getTargetClass
()):
class
_Test
(
self
.
_getTargetClass
()):
_to_key
=
_to_value
=
lambda
self
,
x
:
x
_to_key
=
_to_value
=
lambda
self
,
x
:
x
_bucket_type
=
_Bucket
_bucket_type
=
_Bucket
max_
bucket
_size
=
10
max_
leaf
_size
=
10
max_
btree
_size
=
15
max_
internal
_size
=
15
return
_Test
(
items
)
return
_Test
(
items
)
def
test_add_new_key
(
self
):
def
test_add_new_key
(
self
):
...
...
BTrees/tests/test_btreesubclass.py
View file @
d861d116
...
@@ -18,8 +18,8 @@ class B(OOBucket):
...
@@ -18,8 +18,8 @@ class B(OOBucket):
class
T
(
OOBTree
):
class
T
(
OOBTree
):
_bucket_type
=
B
_bucket_type
=
B
max_
bucket
_size
=
2
max_
leaf
_size
=
2
max_
btree
_size
=
3
max_
internal
_size
=
3
class
S
(
T
):
class
S
(
T
):
pass
pass
...
...
CHANGES.rst
View file @
d861d116
``BTrees`` Changelog
``BTrees`` Changelog
====================
====================
- BTree subclasses can define max_
bucket_size or max_btree
_size to
- BTree subclasses can define max_
leaf_size or max_internal
_size to
control maximum sizes for
bucket and tree
nodes.
control maximum sizes for
Bucket/Set and BTree/TreeSet
nodes.
- Added support for Python 3.4.
- Added support for Python 3.4.
- Update pure-Python and C trees / sets to accept explicit None to indicate
- Update pure-Python and C trees / sets to accept explicit None to indicate
max / min value for ``minKey``, ``maxKey``. (PR #3)
max / min value for ``minKey``, ``maxKey``. (PR #3)
- Update pure-Python trees / sets to accept explicit None to indicate
- Update pure-Python trees / sets to accept explicit None to indicate
open ranges for ``keys``, ``values``, ``items``. (PR #3)
open ranges for ``keys``, ``values``, ``items``. (PR #3)
...
...
docs/index.rst
View file @
d861d116
...
@@ -399,13 +399,17 @@ Object Object 30 250
...
@@ -399,13 +399,17 @@ Object Object 30 250
For your application, especially when using object keys or values, you
For your application, especially when using object keys or values, you
may want to override the default sizes. You can do this by
may want to override the default sizes. You can do this by
subclassing any of the BTree (or TreeSet) classes and specifying new
subclassing any of the BTree (or TreeSet) classes and specifying new
values for ``max_
bucket_size`` or ``max_btree
_size`` in your subclass::
values for ``max_
leaf_size`` or ``max_internal
_size`` in your subclass::
import BTrees.OOBTree
import BTrees.OOBTree
class MyBTree(BTrees.OOBTree.BTree):
class MyBTree(BTrees.OOBTree.BTree):
max_bucket_size = 500
max_leaf_size = 500
max_btree_size = 1000
max_internal_size = 1000
``max_leaf_size`` is used for leaf nodes in a BTree, either Buckets or
Sets. ``max_internal_size`` is used for internal nodes, either BTrees
or TreeSets.
BTree Diagnostic Tools
BTree Diagnostic Tools
----------------------
----------------------
...
...
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