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
17bcbc1a
Commit
17bcbc1a
authored
May 04, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ca32f0c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+3
-4
wcfs/internal/xbtree_test.py
wcfs/internal/xbtree_test.py
+3
-1
No files found.
wcfs/internal/xbtree.py
View file @
17bcbc1a
...
@@ -45,9 +45,9 @@ class Tree:
...
@@ -45,9 +45,9 @@ class Tree:
def
__init__
(
t
,
keyv
,
*
children
):
def
__init__
(
t
,
keyv
,
*
children
):
assert
len
(
children
)
==
len
(
keyv
)
+
1
,
(
keyv
,
children
)
assert
len
(
children
)
==
len
(
keyv
)
+
1
,
(
keyv
,
children
)
_assertIncv
(
keyv
)
_assertIncv
(
keyv
)
# XXX assert children keys consistent?
# XXX assert all children are of the same type
# XXX assert all children are of the same type
# XXX assert type(child) is Tree | Bucket
# XXX assert type(child) is Tree | Bucket
# XXX assert children keys consistent
t
.
keyv
=
tuple
(
keyv
)
t
.
keyv
=
tuple
(
keyv
)
t
.
children
=
tuple
(
children
)
t
.
children
=
tuple
(
children
)
...
@@ -159,20 +159,19 @@ def _iterAllStructPermutations(klo, khi, keyv, maxdepth, maxsplit):
...
@@ -159,20 +159,19 @@ def _iterAllStructPermutations(klo, khi, keyv, maxdepth, maxsplit):
assert
klo
<=
khi
assert
klo
<=
khi
# XXX assert keyv sorted, in [klo, khi)
# XXX assert keyv sorted, in [klo, khi)
for
nsplit
in
range
(
0
,
maxsplit
):
for
nsplit
in
range
(
0
,
maxsplit
):
for
ksplitv
in
_iterSplitByN
(
klo
,
khi
,
nsplit
)
for
ksplitv
in
_iterSplitByN
(
klo
,
khi
,
nsplit
)
# child_i
# child_i
xlo
,
xhi
xlo
,
xhi
#
just Tree +
Buckets
#
emit Tree ->
Buckets
children
=
[]
children
=
[]
for
xlo
,
xhi
in
...:
for
xlo
,
xhi
in
...:
children
.
append
(
Bucket
(
*
_keyvSliceBy
(
keyv
,
xlo
,
xhi
)))
children
.
append
(
Bucket
(
*
_keyvSliceBy
(
keyv
,
xlo
,
xhi
)))
yield
Tree
(
ksplitv
,
children
)
# FIXME ksplitv wo klo/khi
yield
Tree
(
ksplitv
,
children
)
# FIXME ksplitv wo klo/khi
#
Tree + ...(Trees) + Buckets
#
emit Tree -> Trees -> ...
if
maxdepth
==
0
:
if
maxdepth
==
0
:
continue
continue
ichildren
=
[]
# of _iterAllStructPermutations for each child link
ichildren
=
[]
# of _iterAllStructPermutations for each child link
...
...
wcfs/internal/xbtree_test.py
View file @
17bcbc1a
...
@@ -50,12 +50,14 @@ def test_topologyOf():
...
@@ -50,12 +50,14 @@ def test_topologyOf():
T
([],
B
(
7
)),
T
([],
B
(
7
)),
T
([],
B
(
11
)))
))
T
([],
B
(
11
)))
))
"""
#assert btree.TopoEncodingOf(t) == ((4,), (2,), ø(4), (6,10), ø(5?), ø(7), ø(11), x(5?))
#assert btree.TopoEncodingOf(t) == ((4,), (2,), ø(4), (6,10), ø(5?), ø(7), ø(11), x(5?))
assert btree.TopoEncodingOf(t) ==
\
assert btree.TopoEncodingOf(t) ==
\
(4,), (2,),(), (),(),(6,10), B(1),B(3),(),(),(), (),B(7),B(11), B(5)
(4,), (2,),(), (),(),(6,10), B(1),B(3),(),(),(), (),B(7),B(11), B(5)
# T4 T2-T T-T-T6,10 B1-B3-T-T-T T-B7-B11 B5
# T4 T2-T T-T-T6,10 B1-B3-T-T-T T-B7-B11 B5 <-- good
"""
"""
"""
assert xbtree.TopologyOf(t) == ( (4,),
assert xbtree.TopologyOf(t) == ( (4,),
...
...
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