nodes: 0, module; 1, function_definition; 2, function_name:sorted_source_files; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, assert_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Returns a list of targets in topologically sorted order."""; 12, attribute; 13, string; 14, assignment; 15, identifier:node; 16, call; 17, block; 18, call; 19, identifier:self; 20, identifier:final; 21, string_content:Call build() before using the graph.; 22, identifier:out; 23, list; 24, attribute; 25, argument_list; 26, if_statement; 27, identifier:list; 28, argument_list; 29, identifier:nx; 30, identifier:topological_sort; 31, attribute; 32, call; 33, block; 34, else_clause; 35, call; 36, identifier:self; 37, identifier:graph; 38, identifier:isinstance; 39, argument_list; 40, expression_statement; 41, comment:# add a one-element list for uniformity; 42, block; 43, identifier:reversed; 44, argument_list; 45, identifier:node; 46, identifier:NodeSet; 47, call; 48, expression_statement; 49, identifier:out; 50, attribute; 51, argument_list; 52, call; 53, identifier:out; 54, identifier:append; 55, attribute; 56, attribute; 57, argument_list; 58, identifier:node; 59, identifier:nodes; 60, identifier:out; 61, identifier:append; 62, list; 63, identifier:node
code: def sorted_source_files(self):
          """Returns a list of targets in topologically sorted order."""
  
          assert self.final, 'Call build() before using the graph.'
          out = []
          for node in nx.topological_sort(self.graph):
              if isinstance(node, NodeSet):
                  out.append(node.nodes)
              else:
                  # add a one-element list for uniformity
                  out.append([node])
          return list(reversed(out))