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
ca32f0c0
Commit
ca32f0c0
authored
May 04, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f59124e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+12
-6
No files found.
wcfs/internal/xbtree.py
View file @
ca32f0c0
...
...
@@ -33,6 +33,7 @@ from __future__ import print_function, absolute_import
from
BTrees
import
check
as
bcheck
from
golang
import
panic
import
itertools
import
re
inf
=
float
(
'inf'
)
...
...
@@ -46,6 +47,7 @@ class Tree:
_assertIncv
(
keyv
)
# XXX assert children keys consistent?
# XXX assert all children are of the same type
# XXX assert type(child) is Tree | Bucket
t
.
keyv
=
tuple
(
keyv
)
t
.
children
=
tuple
(
children
)
...
...
@@ -150,9 +152,7 @@ def iterAllStructPermutations(keys, maxdepth, maxsplit):
klo
=
keyv
[
0
]
-
1
khi
=
keyv
[
-
1
]
+
1
+
1
# hi is ")", not "]"
_keyvSliceBy
(
keyv
,
klo
,
khi
)
yield
from
_iterAllStructPermutations
(
klo
,
khi
,
keyv
,
maxdepth
,
maxsplit
)
def
_iterAllStructPermutations
(
klo
,
khi
,
keyv
,
maxdepth
,
maxsplit
):
...
...
@@ -172,10 +172,16 @@ def _iterAllStructPermutations(klo, khi, keyv, maxdepth, maxsplit):
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
if
maxdepth
==
0
:
continue
ichildren
=
[]
# of _iterAllStructPermutations for each child link
for
xlo
,
xhi
in
...:
ichildren
.
append
(
_iterAllStructPermutations
(
xlo
,
xhi
,
_keyvSliceBy
(
keyv
,
xlo
,
xhi
),
maxdepth
-
1
,
maxsplit
))
for
children
in
itertools
.
product
(
ichildren
):
yield
Tree
(
ksplitv
,
*
children
)
# FIXME ksplitv w/o klo, khi
# _keyvSliceBy returns [] of keys from keyv : k ∈ [klo, khi)
...
...
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