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
1e3b1d2f
Commit
1e3b1d2f
authored
May 25, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
57322f77
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+7
-1
No files found.
wcfs/internal/xbtree.py
View file @
1e3b1d2f
...
@@ -781,6 +781,11 @@ def TopoEncode(tree, vencode=lambda v: '%d' % v):
...
@@ -781,6 +781,11 @@ def TopoEncode(tree, vencode=lambda v: '%d' % v):
assert
isinstance
(
tree
,
Tree
)
assert
isinstance
(
tree
,
Tree
)
topo
=
''
topo
=
''
# vdecode to be used in the verification at the end
vencoded
=
{}
# vencode(vobj) -> vobj
def
vdecode
(
vtxt
):
return
vencoded
[
vtxt
]
# breadth-first traversal of the tree with '/' injected in between layers
# breadth-first traversal of the tree with '/' injected in between layers
for
nodev
in
_walkBFS
(
tree
):
for
nodev
in
_walkBFS
(
tree
):
if
len
(
topo
)
!=
0
:
if
len
(
topo
)
!=
0
:
...
@@ -803,6 +808,7 @@ def TopoEncode(tree, vencode=lambda v: '%d' % v):
...
@@ -803,6 +808,7 @@ def TopoEncode(tree, vencode=lambda v: '%d' % v):
assert
','
not
in
vtxt
assert
','
not
in
vtxt
assert
'-'
not
in
vtxt
assert
'-'
not
in
vtxt
vtxtv
.
append
(
vtxt
)
vtxtv
.
append
(
vtxt
)
vencoded
[
vtxt
]
=
v
tnode
+=
','
.
join
([
'%d:%s'
%
(
k
,
vtxt
)
tnode
+=
','
.
join
([
'%d:%s'
%
(
k
,
vtxt
)
for
(
k
,
vtxt
)
in
zip
(
node
.
keyv
,
vtxtv
)])
for
(
k
,
vtxt
)
in
zip
(
node
.
keyv
,
vtxtv
)])
else
:
else
:
...
@@ -813,7 +819,7 @@ def TopoEncode(tree, vencode=lambda v: '%d' % v):
...
@@ -813,7 +819,7 @@ def TopoEncode(tree, vencode=lambda v: '%d' % v):
topo
+=
'-'
.
join
(
tnodev
)
topo
+=
'-'
.
join
(
tnodev
)
if
1
:
# make sure that every topology we emit, can be loaded back
if
1
:
# make sure that every topology we emit, can be loaded back
t2
=
TopoDecode
(
topo
)
t2
=
TopoDecode
(
topo
,
vdecode
)
if
t2
!=
tree
:
if
t2
!=
tree
:
panic
(
"BUG: TopoEncode: D(E(·)) != identity
\
n
· = %s
\
n
D(E(·) = %s"
%
(
tree
,
t2
))
panic
(
"BUG: TopoEncode: D(E(·)) != identity
\
n
· = %s
\
n
D(E(·) = %s"
%
(
tree
,
t2
))
return
topo
return
topo
...
...
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