Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
f59124e0
Commit
f59124e0
authored
May 04, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a64f6f45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+26
-3
No files found.
wcfs/internal/xbtree.py
View file @
f59124e0
...
...
@@ -155,8 +155,27 @@ def iterAllStructPermutations(keys, maxdepth, maxsplit):
def
_iterAllStructPermutations
(
keyv
,
maxdepth
,
maxsplit
):
def
_iterAllStructPermutations
(
klo
,
khi
,
keyv
,
maxdepth
,
maxsplit
):
assert
klo
<=
khi
# XXX assert keyv sorted, in [klo, khi)
for
nsplit
in
range
(
0
,
maxsplit
):
for
ksplitv
in
_iterSplitByN
(
klo
,
khi
,
nsplit
)
# child_i
xlo
,
xhi
# just Tree + Buckets
children
=
[]
for
xlo
,
xhi
in
...:
children
.
append
(
Bucket
(
*
_keyvSliceBy
(
keyv
,
xlo
,
xhi
)))
yield
Tree
(
ksplitv
,
children
)
# FIXME ksplitv wo klo/khi
# Tree + ...(Trees) + Buckets
Tree
(
ksplitv
,
_
)
# FIXME ksplitv w/o klo, khi
maxdepth
=
maxdepth
-
1
# _keyvSliceBy returns [] of keys from keyv : k ∈ [klo, khi)
...
...
@@ -165,10 +184,14 @@ def _keyvSliceBy(keyv, klo, khi):
assert
_keyvSorted
(
keyv
)
return
list
([
k
for
k
in
keyv
if
(
klo
<=
k
<
khi
)])
# iterSplitBy iterates through all nsplit splitting of [lo, hi) range.
# iterSplitBy
N
iterates through all nsplit splitting of [lo, hi) range.
# hi > lo
# XXX nsplit > ...
def
iterSplitBy
(
lo
,
hi
,
nsplit
):
# -> [] of [lo, s1, s2, ..., sn, hi)
# lo <= si < hi
# si < s_{i+1}
#
# XXX remove lo and hi from the output?
def
iterSplitByN
(
lo
,
hi
,
nsplit
):
# -> [] of [lo, s1, s2, ..., sn, hi)
if
nsplit
==
0
:
yield
[
lo
,
hi
]
return
...
...
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