WIP: Comment créer l'arbre des règles en utilisant anytree ?
This commit is contained in:
parent
ef03bd717b
commit
5f70690871
|
@ -43,7 +43,7 @@ class TreeNode(object):
|
||||||
|
|
||||||
|
|
||||||
cnd_list = []
|
cnd_list = []
|
||||||
nodes_list = [] #[Node("0")]
|
nodes_list = [] # [Node("0")]
|
||||||
|
|
||||||
for i in conditions_set: # sorted(conditions_set, key=id):
|
for i in conditions_set: # sorted(conditions_set, key=id):
|
||||||
cndt = TreeNode(i[0], i[1], i[2], i[3], i[4]) # TODO y,z,...
|
cndt = TreeNode(i[0], i[1], i[2], i[3], i[4]) # TODO y,z,...
|
||||||
|
@ -53,7 +53,7 @@ for i in cnd_list:
|
||||||
for j in cnd_list:
|
for j in cnd_list:
|
||||||
if (i.id == j.parent):
|
if (i.id == j.parent):
|
||||||
i.add_child(j)
|
i.add_child(j)
|
||||||
nodes_list.append(Node(str(i))) #(Node(str(i), parent=str(i.parent))) #(i)
|
nodes_list.append(Node(str(i))) # (Node(str(i), parent=str(i.parent))) #(i)
|
||||||
|
|
||||||
|
|
||||||
n0 = Node("0")
|
n0 = Node("0")
|
||||||
|
@ -66,5 +66,4 @@ for pre, fill, node in RenderTree(n0):
|
||||||
print("%s%s" % (pre, node.name))
|
print("%s%s" % (pre, node.name))
|
||||||
|
|
||||||
for i in nodes_list:
|
for i in nodes_list:
|
||||||
print(i) #print(i.id, ' ', i.parent)
|
print(i) # print(i.id, ' ', i.parent)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue