Commit e0cbe930 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ae5b52ae
......@@ -487,7 +487,7 @@ def AllStructs(keys, maxdepth, maxsplit, allowEmptyBuckets=False): # -> i[] of T
yield Tree([], Bucket())
return
# XXX ok? (should be -inf,+inf)
# XXX ok? (ideally should be -inf,+inf)
klo = 0
khi = 0
......@@ -525,11 +525,14 @@ def _allStructs(klo, khi, keyv, maxdepth, maxsplit, allowEmptyBuckets):
continue
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
ichildrenv.append( _allStructs(
xlo, xhi, _keyvSliceBy(keyv, xlo, xhi), maxdepth - 1, maxsplit, allowEmptyBuckets))
for children in itertools.product(*ichildrenv):
yield Tree(ksplitv[1:-1], *children) # (s1, s2, ..., sN)
xlo, xhi, ckeyv, maxdepth - 1, maxsplit, allowEmptyBuckets))
else:
for children in itertools.product(*ichildrenv):
yield Tree(ksplitv[1:-1], *children) # (s1, s2, ..., sN)
# _keyvSliceBy returns [] of keys from keyv : k ∈ [klo, khi)
......
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