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):
...
@@ -187,7 +187,10 @@ class Bucket(object):
kvv
=
[
'%s'
%
k
for
k
in
b
.
keyv
]
kvv
=
[
'%s'
%
k
for
k
in
b
.
keyv
]
else
:
else
:
assert
len
(
b
.
keyv
)
==
len
(
b
.
valuev
)
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
)
return
"B"
+
','
.
join
(
kvv
)
__repr__
=
__str__
__repr__
=
__str__
...
@@ -762,16 +765,19 @@ def TopoEncode(tree, vencode=lambda v: '%d' % v):
...
@@ -762,16 +765,19 @@ def TopoEncode(tree, vencode=lambda v: '%d' % v):
tnode
=
(
'T'
if
isinstance
(
node
,
Tree
)
else
'B'
)
tnode
=
(
'T'
if
isinstance
(
node
,
Tree
)
else
'B'
)
if
isinstance
(
node
,
Bucket
)
and
node
.
valuev
is
not
None
:
if
isinstance
(
node
,
Bucket
)
and
node
.
valuev
is
not
None
:
# bucket with key and values
# bucket with key and values
assert
len
(
node
.
valuev
)
==
len
(
node
.
keyv
)
assert
len
(
node
.
keyv
)
==
len
(
node
.
valuev
)
vtxtv
=
[]
if
len
(
node
.
keyv
)
==
0
:
for
v
in
node
.
valuev
:
tnode
+=
':'
vtxt
=
vencode
(
v
)
else
:
assert
' '
not
in
vtxt
vtxtv
=
[]
assert
':'
not
in
vtxt
for
v
in
node
.
valuev
:
assert
','
not
in
vtxt
vtxt
=
vencode
(
v
)
assert
'-'
not
in
vtxt
assert
' '
not
in
vtxt
tnode
+=
','
.
join
([
'%d:%s'
%
(
k
,
vtxt
)
assert
':'
not
in
vtxt
for
(
k
,
vtxt
)
in
zip
(
node
.
keyv
,
vtxtv
)])
assert
','
not
in
vtxt
assert
'-'
not
in
vtxt
tnode
+=
','
.
join
([
'%d:%s'
%
(
k
,
vtxt
)
for
(
k
,
vtxt
)
in
zip
(
node
.
keyv
,
vtxtv
)])
else
:
else
:
# tree or bucket with keys
# tree or bucket with keys
tnode
+=
','
.
join
([
'%d'
%
_
for
_
in
node
.
keyv
])
tnode
+=
','
.
join
([
'%d'
%
_
for
_
in
node
.
keyv
])
...
@@ -820,14 +826,15 @@ def TopoDecode(text, vdecode=int):
...
@@ -820,14 +826,15 @@ def TopoDecode(text, vdecode=int):
withV
=
(
typ
is
Bucket
and
':'
in
tkeys
)
withV
=
(
typ
is
Bucket
and
':'
in
tkeys
)
keyv
=
[]
keyv
=
[]
valuev
=
[]
if
withV
else
None
valuev
=
[]
if
withV
else
None
for
tkey
in
tkeyv
:
if
tkeys
!=
':'
:
# "B:" indicates ø bucket with values
ktxt
=
tkey
for
tkey
in
tkeyv
:
if
withV
:
ktxt
=
tkey
ktxt
,
vtxt
=
tkey
.
split
(
':'
)
if
withV
:
v
=
vdecode
(
vtxt
)
ktxt
,
vtxt
=
tkey
.
split
(
':'
)
valuev
.
append
(
v
)
v
=
vdecode
(
vtxt
)
k
=
int
(
ktxt
)
valuev
.
append
(
v
)
keyv
.
append
(
k
)
k
=
int
(
ktxt
)
keyv
.
append
(
k
)
if
typ
is
Bucket
:
if
typ
is
Bucket
:
node
=
Bucket
(
keyv
,
valuev
)
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