Graphics/GraphicsUtilities.py

changeset 5148
1a879f9af1c0
parent 4631
5c1a96925da4
child 5389
9b1c800daff3
equal deleted inserted replaced
5147:d39dd5cee0c8 5148:1a879f9af1c0
46 if nodes and not stage: 46 if nodes and not stage:
47 # there is no element, which does not depend on some other element! 47 # there is no element, which does not depend on some other element!
48 stage.append(nodes[0]) 48 stage.append(nodes[0])
49 49
50 taken.extend(stage) 50 taken.extend(stage)
51 nodes = list(filter(lambda x, l=stage: x not in l, nodes)) 51 nodes = list(filter(lambda x, li=stage: x not in li, nodes))
52 while nodes: 52 while nodes:
53 previousStageChildren = [] 53 previousStageChildren = []
54 nodelen = len(nodes) 54 nodelen = len(nodes)
55 55
56 # second stage are those nodes, which are direct children of the 56 # second stage are those nodes, which are direct children of the
78 while remove in stage: 78 while remove in stage:
79 stage.remove(remove) 79 stage.remove(remove)
80 80
81 stages.append(stage) 81 stages.append(stage)
82 taken.extend(stage) 82 taken.extend(stage)
83 nodes = list(filter(lambda x, l=stage: x not in l, nodes)) 83 nodes = list(filter(lambda x, li=stage: x not in li, nodes))
84 if nodelen == len(nodes): 84 if nodelen == len(nodes):
85 if noRecursion: 85 if noRecursion:
86 raise RecursionError(nodes) 86 raise RecursionError(nodes)
87 else: 87 else:
88 stages.append(nodes[:]) 88 stages.append(nodes[:])

eric ide

mercurial