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
50b699df
Commit
50b699df
authored
May 12, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ee5f34ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+7
-2
No files found.
wcfs/internal/xbtree.py
View file @
50b699df
...
...
@@ -229,7 +229,7 @@ def Restructure(ztree, newStructure):
# we will modify nodes from new set:
# - node.Z will point to associated znode
# - bucket.next_bucket will point to bucket that is coming
next
in the tree
# - bucket.next_bucket will point to bucket that is coming
with next keys
in the tree
tnew
=
newStructure
.
copy
()
zrlevelv
=
list
(
__zwalkBFS
(
ztree
))
# [] of _NodeInRange
...
...
@@ -246,6 +246,10 @@ def Restructure(ztree, newStructure):
zrlevel
=
zrlevelv
.
pop
(
0
)
# XXX filter-out buckets
_
=
[]
for
zrn
in
zrlevel
:
assert
isinstance
(
zrn
.
node
,
(
ztreeType
,
zbucketType
))
if
isinstance
(
zrn
.
node
,
z
if
len
(
zrlevel
)
==
len
(
rlevel
):
# map 1-1
for
(
zrn
,
rn
)
in
zip
(
zrlevel
,
rlevel
):
...
...
@@ -283,7 +287,7 @@ def Restructure(ztree, newStructure):
# https://github.com/zopefoundation/BTrees/blob/4.5.0-1-gc8bf24e/BTrees/BucketTemplate.c#L1195
zstate
=
()
for
k
in
node
.
keyv
:
zstate
+=
(
k
,
kv
[
k
])
# (k1, v1, k2, v2, ..., kN, vN)
zstate
+=
(
k
,
kv
.
pop
(
k
))
# (k1, v1, k2, v2, ..., kN, vN)
zstate
=
(
zstate
,)
if
node
.
next_bucket
is
not
None
:
# next
...
...
@@ -309,6 +313,7 @@ def Restructure(ztree, newStructure):
assert
tnew
.
Z
is
ztree
assert
len
(
kv
)
==
0
# all keys must have been popped
_bcheck
(
ztree
)
# verify ztree after our tweaks
tstruct
=
StructureOf
(
ztree
)
...
...
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