Commit d3abf4fa authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 13f4b6df
...@@ -183,7 +183,7 @@ class Bucket(object): ...@@ -183,7 +183,7 @@ class Bucket(object):
return (a.keyv == b.keyv and a.valuev == b.valuev) return (a.keyv == b.keyv and a.valuev == b.valuev)
def __str__(b): def __str__(b):
if b.values is None: if b.valuev is None:
kvv = ['%s' % k for k in b.keyv] kvv = ['%s' % k for k in b.keyv]
else: else:
assert len(b.keyv) == len(b.valuev) assert len(b.keyv) == len(b.valuev)
...@@ -500,6 +500,8 @@ def Restructure(ztree, newStructure): ...@@ -500,6 +500,8 @@ def Restructure(ztree, newStructure):
# specified keys and btree depth up-to maxdepth. Each tree node is split by # specified keys and btree depth up-to maxdepth. Each tree node is split by
# up-to maxsplit points. # up-to maxsplit points.
# #
# Generated trees contains Buckets with only keys.
#
# If allowEmptyBuckets=y tree structures with empty buckets are also generated. # If allowEmptyBuckets=y tree structures with empty buckets are also generated.
# By default, except for empty-tree case, only tree structures with non-empty # By default, except for empty-tree case, only tree structures with non-empty
# buckets are generated, because ZODB BTree package misbehaves if it finds an # buckets are generated, because ZODB BTree package misbehaves if it finds an
...@@ -522,7 +524,7 @@ def AllStructs(keys, maxdepth, maxsplit, allowEmptyBuckets=False): # -> i[] of T ...@@ -522,7 +524,7 @@ def AllStructs(keys, maxdepth, maxsplit, allowEmptyBuckets=False): # -> i[] of T
else: else:
# the only possible case for empty tree is T/B # the only possible case for empty tree is T/B
if not allowEmptyBuckets: if not allowEmptyBuckets:
yield Tree([], Bucket()) # XXX -> !values yield Tree([], Bucket([], None))
return return
# XXX ok? (ideally should be -inf,+inf) # XXX ok? (ideally should be -inf,+inf)
...@@ -559,7 +561,7 @@ def _allStructs(klo, khi, keyv, maxdepth, maxsplit, allowEmptyBuckets): ...@@ -559,7 +561,7 @@ def _allStructs(klo, khi, keyv, maxdepth, maxsplit, allowEmptyBuckets):
bkeyv = _keyvSliceBy(keyv, xlo, xhi) bkeyv = _keyvSliceBy(keyv, xlo, xhi)
if not allowEmptyBuckets: if not allowEmptyBuckets:
assert len(bkeyv) > 0 assert len(bkeyv) > 0
children.append(Bucket(*bkeyv)) # XXX -> !values children.append(Bucket(bkeyv, None))
else: else:
yield Tree(ksplitv[1:-1], *children) # (s1, s2, ..., sN) yield Tree(ksplitv[1:-1], *children) # (s1, s2, ..., sN)
......
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