parameters: (libraries)
return_statement: return sorted_deps
docstring: Returns all transitive library dependencies in dependency order.
docstring_summary: Returns all transitive library dependencies in dependency order.
docstring_tokens: Returns all transitive library dependencies in dependency order .
function: def GetSortedTransitiveDependencies(libraries):
    """Returns all transitive library dependencies in dependency order."""
    def GraphNode(library):
      return (library, GetNonSystemDependencies(library))
  
    # First: find all library dependencies.
    unchecked_deps = libraries
    all_deps = set(libraries)
    while unchecked_deps:
      lib = unchecked_deps.pop()
      new_deps = GetNonSystemDependencies(lib).difference(all_deps)
      unchecked_deps.extend(new_deps)
      all_deps = all_deps.union(new_deps)
  
    # Then: simple, slow topological sort.
    sorted_deps = []
    unsorted_deps = dict(map(GraphNode, all_deps))
    while unsorted_deps:
      for library, dependencies in unsorted_deps.items():
        if not dependencies.intersection(unsorted_deps.keys()):
          sorted_deps.append(library)
          del unsorted_deps[library]
  
    return sorted_deps
function_tokens: def GetSortedTransitiveDependencies ( libraries ) : def GraphNode ( library ) : return ( library , GetNonSystemDependencies ( library ) ) # First: find all library dependencies. unchecked_deps = libraries all_deps = set ( libraries ) while unchecked_deps : lib = unchecked_deps . pop ( ) new_deps = GetNonSystemDependencies ( lib ) . difference ( all_deps ) unchecked_deps . extend ( new_deps ) all_deps = all_deps . union ( new_deps ) # Then: simple, slow topological sort. sorted_deps = [ ] unsorted_deps = dict ( map ( GraphNode , all_deps ) ) while unsorted_deps : for library , dependencies in unsorted_deps . items ( ) : if not dependencies . intersection ( unsorted_deps . keys ( ) ) : sorted_deps . append ( library ) del unsorted_deps [ library ] return sorted_deps