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
3e3625a7
Commit
3e3625a7
authored
Apr 30, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5c9f7ec4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+20
-3
No files found.
wcfs/internal/xbtree.py
View file @
3e3625a7
...
@@ -26,12 +26,16 @@ It is primarily used to verify ΔBTail in wcfs.
...
@@ -26,12 +26,16 @@ It is primarily used to verify ΔBTail in wcfs.
XXX Typology:
XXX Typology:
"""
"""
# Tree represents internal tree node.
from
BTrees
import
check
as
bcheck
# Tree represents a tree node.
class
Tree
:
class
Tree
:
# .keyv () of keys
# .keyv () of keys
# .children () of children len(.children) == len(.keyv) + 1
# .children () of children len(.children) == len(.keyv) + 1
def
__init__
(
tree
,
keyv
,
*
children
):
def
__init__
(
tree
,
keyv
,
*
children
):
assert
len
(
children
)
==
len
(
keyv
)
+
1
assert
len
(
children
)
==
len
(
keyv
)
+
1
,
(
keyv
,
children
)
# XXX assert keyv ↑
# XXX assert children keys consistent?
tree
.
keyv
=
tuple
(
keyv
)
tree
.
keyv
=
tuple
(
keyv
)
tree
.
children
=
tuple
(
children
)
tree
.
children
=
tuple
(
children
)
...
@@ -45,7 +49,20 @@ class Tree:
...
@@ -45,7 +49,20 @@ class Tree:
# StructureOf returns internal structure of the tree.
# StructureOf returns internal structure of the tree.
def
StructureOf
(
tree
):
def
StructureOf
(
tree
):
1
/
0
typ
=
type
(
tree
)
assert
"Tree"
in
typ
.
__name__
,
typ
kind
,
keys
,
children
=
bcheck
.
crack_btree
(
tree
,
True
)
if
kind
==
bcheck
.
BTREE_EMPTY
:
return
Tree
([])
if
kind
==
bcheck
.
BTREE_ONE
:
return
Tree
([])
if
kind
==
bcheck
.
BTREE_NORMAL
:
return
Tree
(
keys
,
*
[
StructureOf
(
_
)
for
_
in
children
])
panic
(
"bad kind %r"
%
kind
)
# TypologyOf returns topology encoding for internal structure of the tree.
# TypologyOf returns topology encoding for internal structure of the tree.
#
#
...
...
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