parameters: (self)
return_statement: return sorted_deps
docstring: Return a list of all tags topologically ordered such that if B depends on A, then
          A precedes B in the list.
docstring_summary: Return a list of all tags topologically ordered such that if B depends on A, then
          A precedes B in the list.
docstring_tokens: Return a list of all tags topologically ordered such that if B depends on A then A precedes B in the list .
function: def topo_sort(self):
          """Return a list of all tags topologically ordered such that if B depends on A, then
          A precedes B in the list."""
          graph = self.copy()   # since we destructively modify it
  
          # nodes with no dependencies
          start_vertices = filter(lambda v: graph.incoming[v] == [], self.vertices)
  
          sorted_deps = []
          while start_vertices:
              s, start_vertices = start_vertices[0], start_vertices[1:]
              sorted_deps.append(s)
              for child in list(graph.outgoing[s]):
                  graph.remove_edge(s, child)
                  if not graph.incoming[child]:
                      start_vertices.append(child)
  
          if graph.edges:
              raise CycleException()
  
          return sorted_deps
function_tokens: def topo_sort ( self ) : graph = self . copy ( ) # since we destructively modify it # nodes with no dependencies start_vertices = filter ( lambda v : graph . incoming [ v ] == [ ] , self . vertices ) sorted_deps = [ ] while start_vertices : s , start_vertices = start_vertices [ 0 ] , start_vertices [ 1 : ] sorted_deps . append ( s ) for child in list ( graph . outgoing [ s ] ) : graph . remove_edge ( s , child ) if not graph . incoming [ child ] : start_vertices . append ( child ) if graph . edges : raise CycleException ( ) return sorted_deps