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
c98d3f92
Commit
c98d3f92
authored
May 31, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
98337e00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
wcfs/testprog/treegen.py
wcfs/testprog/treegen.py
+12
-7
No files found.
wcfs/testprog/treegen.py
View file @
c98d3f92
...
@@ -151,9 +151,9 @@ def Trees(zstor, r):
...
@@ -151,9 +151,9 @@ def Trees(zstor, r):
zctx
=
ZCtx
(
zstor
)
zctx
=
ZCtx
(
zstor
)
defer
(
zctx
.
close
)
defer
(
zctx
.
close
)
tree
=
zctx
.
root
[
'treegen/tree'
]
=
XLOTree
()
z
tree
=
zctx
.
root
[
'treegen/tree'
]
=
XLOTree
()
at0
=
commit
(
'treegen/tree: init'
)
at0
=
commit
(
'treegen/tree: init'
)
xprint
(
"start @%s root=%s"
%
(
ashex
(
at0
),
ashex
(
tree
.
_p_oid
)))
xprint
(
"start @%s root=%s"
%
(
ashex
(
at0
),
ashex
(
z
tree
.
_p_oid
)))
while
1
:
while
1
:
treetxt
=
r
.
readline
()
treetxt
=
r
.
readline
()
...
@@ -162,11 +162,12 @@ def Trees(zstor, r):
...
@@ -162,11 +162,12 @@ def Trees(zstor, r):
treetxt
=
treetxt
.
rstrip
()
# trim trailing \n
treetxt
=
treetxt
.
rstrip
()
# trim trailing \n
tree
=
zctx
.
TopoDecode
(
treetxt
)
tree
=
zctx
.
TopoDecode
(
treetxt
)
ztree
=
trees
[
treetxt
]
=
XLOTree
()
#
ztree = trees[treetxt] = XLOTree()
zctx
.
zconn
.
add
(
ztree
)
# so that restructure can see we are working under zconn
#
zctx.zconn.add(ztree) # so that restructure can see we are working under zconn
# tree[k]=v for all k
# tree
kv
[k]=v for all k
# do tree.keys() via walkBFS
# do tree.keys() via walkBFS
treekv
=
{}
for
level
in
xbtree
.
_walkBFS
(
tree
):
for
level
in
xbtree
.
_walkBFS
(
tree
):
for
node
in
level
:
for
node
in
level
:
if
isinstance
(
node
,
xbtree
.
Bucket
):
if
isinstance
(
node
,
xbtree
.
Bucket
):
...
@@ -174,9 +175,13 @@ def Trees(zstor, r):
...
@@ -174,9 +175,13 @@ def Trees(zstor, r):
panic
(
"%s: tree must be {key->value}, not set"
%
treetxt
)
panic
(
"%s: tree must be {key->value}, not set"
%
treetxt
)
assert
len
(
node
.
keyv
)
==
len
(
node
.
valuev
)
assert
len
(
node
.
keyv
)
==
len
(
node
.
valuev
)
for
(
k
,
v
)
in
zip
(
node
.
keyv
,
node
.
valuev
):
for
(
k
,
v
)
in
zip
(
node
.
keyv
,
node
.
valuev
):
ztree
[
k
]
=
v
treekv
[
k
]
=
v
# restructure to requested topology
# change ztree to requested kv
d
=
diff
(
ztree
,
treekv
)
patch
(
ztree
,
d
,
treekv
)
# restructure ztree to requested topology
xbtree
.
Restructure
(
ztree
,
tree
)
xbtree
.
Restructure
(
ztree
,
tree
)
tid
=
commit
(
"treegen/trees: %s"
%
treetxt
)
tid
=
commit
(
"treegen/trees: %s"
%
treetxt
)
...
...
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