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
0d76b785
Commit
0d76b785
authored
May 12, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
75192d09
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+13
-4
No files found.
wcfs/internal/xbtree.py
View file @
0d76b785
...
...
@@ -465,6 +465,7 @@ def __walkBFS(tree): # i[] of [](of _NodeInRange on each level)
assert
isinstance
(
tree
,
Tree
)
currentq
=
[]
nextq
=
[
_NodeInRange
(
_Range
(
-
inf
,
+
inf
),
tree
)]
while
len
(
nextq
)
>
0
:
yield
tuple
(
nextq
)
currentq
=
nextq
...
...
@@ -476,6 +477,7 @@ def __walkBFS(tree): # i[] of [](of _NodeInRange on each level)
v
=
(
rn
.
range
.
klo
,)
+
rn
.
node
.
keyv
+
(
rn
.
range
.
khi
,)
rv
=
zip
(
v
[:
-
1
],
v
[
1
:])
# (klo,k1), (k1,k2), ..., (kN,khi)
assert
len
(
rv
)
==
len
(
rn
.
node
.
children
)
for
i
in
range
(
len
(
rv
)):
nextq
.
append
(
_NodeInRange
(
_Range
(
*
rv
[
i
]),
rn
.
node
.
children
[
i
]))
...
...
@@ -487,13 +489,16 @@ def __zwalkBFS(ztree): # i[] of [](of _NodeInRange on each level)
zbucketType
=
ztreeType
.
_bucket_type
currentq
=
[]
nextq
=
[
ztree
]
nextq
=
[
_NodeInRange
(
_Range
(
-
inf
,
+
inf
),
ztree
)]
while
len
(
nextq
)
>
0
:
yield
tuple
(
nextq
)
currentq
=
nextq
nextq
=
[]
while
len
(
currentq
)
>
0
:
znode
=
currentq
.
pop
(
0
)
rn
=
currentq
.
pop
(
0
)
znode
=
rn
.
node
ztype
=
_zclassify
(
znode
)
assert
ztype
.
is_ztree
or
ztype
.
is_zbucket
...
...
@@ -503,7 +508,7 @@ def __zwalkBFS(ztree): # i[] of [](of _NodeInRange on each level)
if
ztype
.
is_ztree
:
assert
type
(
znode
)
is
ztreeType
kind
,
key
s
,
kids
=
zbcheck
.
crack_btree
(
znode
,
ztype
.
is_map
)
kind
,
key
v
,
kids
=
zbcheck
.
crack_btree
(
znode
,
ztype
.
is_map
)
if
kind
==
zbcheck
.
BTREE_EMPTY
:
b
=
znode
.
_bucket_type
()
children
=
[
b
]
...
...
@@ -519,8 +524,12 @@ def __zwalkBFS(ztree): # i[] of [](of _NodeInRange on each level)
else
:
panic
(
"bad tree kind %r"
%
kind
)
nextq
+=
children
v
=
[
rn
.
range
.
klo
]
+
keyv
+
[
rn
.
range
.
khi
]
rv
=
zip
(
v
[:
-
1
],
v
[
1
:])
# (klo,k1), (k1,k2), ..., (kN,khi)
assert
len
(
rv
)
==
len
(
children
)
for
i
in
range
(
len
(
rv
)):
nextq
.
append
(
_NodeInRange
(
_Range
(
*
rv
[
i
]),
children
))
# TopoDecode decodes topology-encoded text into Tree structure.
...
...
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