def toposort_flatten(data, sort=True):
 result = []
 for d in toposort(data):
  result.extend((sorted if sort else list)(d))
 return result

def toposort_flatten ( data , sort = True ) : result = [ ] for d in toposort ( data ) : result . extend ( ( sorted if sort else list ) ( d ) ) return result
returns a single list of dependencies .