MCPcopy Index your code
hub / github.com/kivy/python-for-android / find_order

Function find_order

pythonforandroid/graph.py:127–143  ·  view source on GitHub ↗

Do a topological sort on the dependency graph dict.

(graph)

Source from the content-addressed store, hash-verified

125
126
127def find_order(graph):
128 '''
129 Do a topological sort on the dependency graph dict.
130 '''
131 while graph:
132 # Find all items without a parent
133 leftmost = [name for name, dep in graph.items() if not dep]
134 if not leftmost:
135 raise ValueError('Dependency cycle detected! %s' % graph)
136 # If there is more than one, sort them for predictable order
137 leftmost.sort()
138 for result in leftmost:
139 # Yield and remove them from the graph
140 yield result
141 graph.pop(result)
142 for bset in graph.values():
143 bset.discard(result)
144
145
146def obvious_conflict_checker(ctx, name_tuples, blacklist=None):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected