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
f219083d
Commit
f219083d
authored
May 07, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6526c4ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+11
-7
No files found.
wcfs/internal/xbtree.py
View file @
f219083d
...
...
@@ -86,14 +86,20 @@ inf = float('inf')
# Tree represents a tree node.
class
Tree
:
class
Tree
(
object
)
:
# .keyv () of keys
# .children () of children len(.children) == len(.keyv) + 1
def
__init__
(
t
,
keyv
,
*
children
):
assert
len
(
children
)
==
len
(
keyv
)
+
1
,
(
keyv
,
children
)
_assertIncv
(
keyv
)
# XXX assert all children are of the same type
# XXX assert type(child) is Tree | Bucket
if
len
(
children
)
>
0
:
# assert all children are of the same type
childtypes
=
set
([
type
(
_
)
for
_
in
children
])
if
len
(
childtypes
)
!=
1
:
panic
(
"children are of distinct types: %s"
%
(
childtypes
,))
# assert type(child) is Tree | Bucket
childtype
=
childtypes
.
pop
()
assert
childtype
in
(
Tree
,
Bucket
),
childtype
# XXX assert children keys consistent
t
.
keyv
=
tuple
(
keyv
)
t
.
children
=
tuple
(
children
)
...
...
@@ -120,11 +126,9 @@ class Tree:
# return 'R'+str(t)
# TODO def graphviz() -> str for graphviz
# TODO def TopoEncode() -> str with topology encoding
# TODO @staticmethod def TopoDecode(in) <- Tree from topology string
# Bucked represents a bucket node.
class
Bucket
:
class
Bucket
(
object
)
:
# .keyv () of keys
def
__init__
(
b
,
*
keyv
):
# XXX *keyv -> keyv ?
_assertIncv
(
keyv
)
...
...
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