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
d3abf4fa
Commit
d3abf4fa
authored
May 25, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
13f4b6df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+5
-3
No files found.
wcfs/internal/xbtree.py
View file @
d3abf4fa
...
...
@@ -183,7 +183,7 @@ class Bucket(object):
return
(
a
.
keyv
==
b
.
keyv
and
a
.
valuev
==
b
.
valuev
)
def
__str__
(
b
):
if
b
.
value
s
is
None
:
if
b
.
value
v
is
None
:
kvv
=
[
'%s'
%
k
for
k
in
b
.
keyv
]
else
:
assert
len
(
b
.
keyv
)
==
len
(
b
.
valuev
)
...
...
@@ -500,6 +500,8 @@ def Restructure(ztree, newStructure):
# specified keys and btree depth up-to maxdepth. Each tree node is split by
# up-to maxsplit points.
#
# Generated trees contains Buckets with only keys.
#
# If allowEmptyBuckets=y tree structures with empty buckets are also generated.
# By default, except for empty-tree case, only tree structures with non-empty
# buckets are generated, because ZODB BTree package misbehaves if it finds an
...
...
@@ -522,7 +524,7 @@ def AllStructs(keys, maxdepth, maxsplit, allowEmptyBuckets=False): # -> i[] of T
else
:
# the only possible case for empty tree is T/B
if
not
allowEmptyBuckets
:
yield
Tree
([],
Bucket
(
))
# XXX -> !values
yield
Tree
([],
Bucket
(
[],
None
))
return
# XXX ok? (ideally should be -inf,+inf)
...
...
@@ -559,7 +561,7 @@ def _allStructs(klo, khi, keyv, maxdepth, maxsplit, allowEmptyBuckets):
bkeyv
=
_keyvSliceBy
(
keyv
,
xlo
,
xhi
)
if
not
allowEmptyBuckets
:
assert
len
(
bkeyv
)
>
0
children
.
append
(
Bucket
(
*
bkeyv
))
# XXX -> !values
children
.
append
(
Bucket
(
bkeyv
,
None
))
else
:
yield
Tree
(
ksplitv
[
1
:
-
1
],
*
children
)
# (s1, s2, ..., sN)
...
...
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