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
809304d1
Commit
809304d1
authored
May 25, 2020
by
Kirill Smelkov
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X "B:" indicates ø bucket with k&b, "B" - ø bucket with only keys
parent
63dd361f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
19 deletions
+26
-19
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+26
-19
No files found.
wcfs/internal/xbtree.py
View file @
809304d1
...
...
@@ -187,7 +187,10 @@ class Bucket(object):
kvv
=
[
'%s'
%
k
for
k
in
b
.
keyv
]
else
:
assert
len
(
b
.
keyv
)
==
len
(
b
.
valuev
)
kvv
=
[
'%s:%s'
%
(
k
,
v
)
for
(
k
,
v
)
in
zip
(
b
.
keyv
,
b
.
valuev
)]
if
len
(
b
.
keyv
)
==
0
:
kvv
=
[
':'
]
else
:
kvv
=
[
'%s:%s'
%
(
k
,
v
)
for
(
k
,
v
)
in
zip
(
b
.
keyv
,
b
.
valuev
)]
return
"B"
+
','
.
join
(
kvv
)
__repr__
=
__str__
...
...
@@ -762,16 +765,19 @@ def TopoEncode(tree, vencode=lambda v: '%d' % v):
tnode
=
(
'T'
if
isinstance
(
node
,
Tree
)
else
'B'
)
if
isinstance
(
node
,
Bucket
)
and
node
.
valuev
is
not
None
:
# bucket with key and values
assert
len
(
node
.
valuev
)
==
len
(
node
.
keyv
)
vtxtv
=
[]
for
v
in
node
.
valuev
:
vtxt
=
vencode
(
v
)
assert
' '
not
in
vtxt
assert
':'
not
in
vtxt
assert
','
not
in
vtxt
assert
'-'
not
in
vtxt
tnode
+=
','
.
join
([
'%d:%s'
%
(
k
,
vtxt
)
for
(
k
,
vtxt
)
in
zip
(
node
.
keyv
,
vtxtv
)])
assert
len
(
node
.
keyv
)
==
len
(
node
.
valuev
)
if
len
(
node
.
keyv
)
==
0
:
tnode
+=
':'
else
:
vtxtv
=
[]
for
v
in
node
.
valuev
:
vtxt
=
vencode
(
v
)
assert
' '
not
in
vtxt
assert
':'
not
in
vtxt
assert
','
not
in
vtxt
assert
'-'
not
in
vtxt
tnode
+=
','
.
join
([
'%d:%s'
%
(
k
,
vtxt
)
for
(
k
,
vtxt
)
in
zip
(
node
.
keyv
,
vtxtv
)])
else
:
# tree or bucket with keys
tnode
+=
','
.
join
([
'%d'
%
_
for
_
in
node
.
keyv
])
...
...
@@ -820,14 +826,15 @@ def TopoDecode(text, vdecode=int):
withV
=
(
typ
is
Bucket
and
':'
in
tkeys
)
keyv
=
[]
valuev
=
[]
if
withV
else
None
for
tkey
in
tkeyv
:
ktxt
=
tkey
if
withV
:
ktxt
,
vtxt
=
tkey
.
split
(
':'
)
v
=
vdecode
(
vtxt
)
valuev
.
append
(
v
)
k
=
int
(
ktxt
)
keyv
.
append
(
k
)
if
tkeys
!=
':'
:
# "B:" indicates ø bucket with values
for
tkey
in
tkeyv
:
ktxt
=
tkey
if
withV
:
ktxt
,
vtxt
=
tkey
.
split
(
':'
)
v
=
vdecode
(
vtxt
)
valuev
.
append
(
v
)
k
=
int
(
ktxt
)
keyv
.
append
(
k
)
if
typ
is
Bucket
:
node
=
Bucket
(
keyv
,
valuev
)
...
...
Kirill Smelkov
@kirr
mentioned in commit
c58c20d6
·
Oct 27, 2021
mentioned in commit
c58c20d6
mentioned in commit c58c20d69d8dfb7ef646e23dd20a74b5bae9ded2
Toggle commit list
Kirill Smelkov
@kirr
mentioned in commit
0e829874
·
Oct 28, 2021
mentioned in commit
0e829874
mentioned in commit 0e829874806c48bcb96ade96ba44aad3cc8f0e60
Toggle commit list
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