Commit d1f27435 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 846e08c0
......@@ -506,7 +506,12 @@ def _allStructs(klo, khi, keyv, maxdepth, maxsplit, allowEmptyBuckets):
# (klo, khi, keyv, maxdepth, maxsplit))
for nsplit in range(0, maxsplit+1):
for ksplitv in _iterSplitByN(klo, khi, nsplit):
if not allowEmptyBuckets:
iksplitv = _iterSplitKeyvByN(klo, khi, keyv, nsplit)
else:
iksplitv = _iterSplitByN(klo, khi, nsplit)
for ksplitv in iksplitv:
# ksplitv = [klo, s1, s2, ..., sN, khi]
#print('ksplitv: %r' % ksplitv)
......@@ -514,8 +519,8 @@ def _allStructs(klo, khi, keyv, maxdepth, maxsplit, allowEmptyBuckets):
children = []
for (xlo, xhi) in zip(ksplitv[:-1], ksplitv[1:]): # (klo, s1), (s1, s2), ..., (sN, khi)
bkeyv = _keyvSliceBy(keyv, xlo, xhi)
if len(bkeyv) == 0 and (not allowEmptyBuckets):
break
if not allowEmptyBuckets:
assert len(bkeyv) > 0
children.append(Bucket(*bkeyv))
else:
yield Tree(ksplitv[1:-1], *children) # (s1, s2, ..., sN)
......@@ -526,8 +531,8 @@ def _allStructs(klo, khi, keyv, maxdepth, maxsplit, allowEmptyBuckets):
ichildrenv = [] # of _allStructs for each child link
for (xlo, xhi) in zip(ksplitv[:-1], ksplitv[1:]): # (klo, s1), (s1, s2), ..., (sN, khi)
ckeyv = _keyvSliceBy(keyv, xlo, xhi)
if len(ckeyv) == 0 and (not allowEmptyBuckets):
break
if not allowEmptyBuckets:
assert len(ckeyv) > 0
ichildrenv.append( _allStructs(
xlo, xhi, ckeyv, maxdepth - 1, maxsplit, allowEmptyBuckets))
else:
......
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