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
578232ad
Commit
578232ad
authored
Jul 08, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8a8cb32d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
wcfs/internal/xbtree/xbtreetest/treeenv.go
wcfs/internal/xbtree/xbtreetest/treeenv.go
+1
-1
wcfs/internal/xbtree/xbtreetest/treegen.py
wcfs/internal/xbtree/xbtreetest/treegen.py
+5
-2
No files found.
wcfs/internal/xbtree/xbtreetest/treeenv.go
View file @
578232ad
...
...
@@ -231,7 +231,7 @@ func xGetBlkDataTab(db *zodb.DB, at zodb.Tid) map[zodb.Oid]string {
for
k
,
xzblk
:=
range
zblkdir
.
Data
{
zblk
,
ok
:=
xzblk
.
(
zodb
.
IPersistent
)
if
!
ok
{
exc
.
Raisef
(
"root['treegen/values'][%q]: expected
%s, got %s"
,
k
,
xzodb
.
TypeOf
(
zblk
)
,
xzodb
.
TypeOf
(
xzblk
))
exc
.
Raisef
(
"root['treegen/values'][%q]: expected
IPersistent, got %s"
,
k
,
xzodb
.
TypeOf
(
xzblk
))
}
oid
:=
zblk
.
POid
()
...
...
wcfs/internal/xbtree/xbtreetest/treegen.py
View file @
578232ad
...
...
@@ -220,7 +220,7 @@ def TreesSrv(zstor, r):
t
,
D
=
treetxt
.
split
()
assert
D
.
startswith
(
'D'
)
kv
=
kvDecode
(
t
[
1
:],
zctx
.
vdecode
)
zv
=
kvDecode
(
D
[
1
:],
lambda
vtxt
:
vtxt
)
zv
=
_kvDecode
(
D
[
1
:],
kdecode
=
lambda
ktxt
:
ktxt
,
vdecode
=
lambda
vtxt
:
vtxt
)
zdataTab
=
zctx
.
root
[
'treegen/values'
]
patch
(
ztree
,
diff
(
ztree
,
kv
),
kv
)
patch
(
zdataTab
,
diff
(
zdataTab
,
zv
),
zv
)
# XXX v->ZBlk(v)
...
...
@@ -363,12 +363,15 @@ def kvEncode(kvDict, vencode): # -> kvText
# kvDecode decodes key->value mapping from text.
# e.g. '1:a,2:b' -> {1:'a', 2:'b'}
def
kvDecode
(
kvText
,
vdecode
):
# -> kvDict
return
_kvDecode
(
kvText
,
int
,
vdecode
)
def
_kvDecode
(
kvText
,
kdecode
,
vdecode
):
# -> kvDict
if
kvText
==
""
:
return
{}
kv
=
{}
for
item
in
kvText
.
split
(
','
):
ktxt
,
vtxt
=
item
.
split
(
':'
)
k
=
int
(
ktxt
)
k
=
kdecode
(
ktxt
)
v
=
vdecode
(
vtxt
)
if
k
in
kv
:
raise
ValueError
(
"key %s present multiple times"
%
k
)
...
...
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