Graphics/GraphicsUtilities.py

changeset 12
1d8dd9706f46
parent 0
de9c2efb9d02
child 13
1af94a91f439
equal deleted inserted replaced
11:b0996e4a289e 12:1d8dd9706f46
40 if nodes and not stage: 40 if nodes and not stage:
41 # there is no element, which does not depend on some other element! 41 # there is no element, which does not depend on some other element!
42 stage.append(nodes[0]) 42 stage.append(nodes[0])
43 43
44 taken.extend(stage) 44 taken.extend(stage)
45 nodes = filter(lambda x, l = stage: x not in l, nodes) 45 nodes = list(filter(lambda x, l = stage: x not in l, nodes))
46 while nodes: 46 while nodes:
47 previousStageChildren = [] 47 previousStageChildren = []
48 nodelen = len(nodes) 48 nodelen = len(nodes)
49 49
50 # second stage are those nodes, which are direct children of the first stage 50 # second stage are those nodes, which are direct children of the first stage
71 while remove in stage: 71 while remove in stage:
72 stage.remove(remove) 72 stage.remove(remove)
73 73
74 stages.append(stage) 74 stages.append(stage)
75 taken.extend(stage) 75 taken.extend(stage)
76 nodes = filter(lambda x, l = stage: x not in l, nodes) 76 nodes = list(filter(lambda x, l = stage: x not in l, nodes))
77 if nodelen == len(nodes): 77 if nodelen == len(nodes):
78 if noRecursion: 78 if noRecursion:
79 raise recursionError(nodes) 79 raise recursionError(nodes)
80 else: 80 else:
81 stages.append(nodes[:]) 81 stages.append(nodes[:])

eric ide

mercurial