WIP: Comment créer l'arbre des règles en utilisant anytree ?

This commit is contained in:
Jean Sirmai 2022-01-02 12:50:02 +01:00
parent ef03bd717b
commit 5f70690871
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 3 additions and 4 deletions

View File

@ -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)