nodes: 0, module; 1, function_definition; 2, function_name:find_package_indexes_in_dir; 3, parameters; 4, block; 5, identifier:self; 6, identifier:simple_dir; 7, expression_statement; 8, expression_statement; 9, comment:# Package indexes must be in directories, so ignore anything else.; 10, expression_statement; 11, return_statement; 12, comment:"""Given a directory that contains simple packages indexes, return
          a sorted list of normalized package names.  This presumes every
          directory within is a simple package index directory."""; 13, assignment; 14, assignment; 15, identifier:packages; 16, identifier:packages; 17, call; 18, identifier:packages; 19, list_comprehension; 20, identifier:sorted; 21, argument_list; 22, identifier:x; 23, for_in_clause; 24, if_clause; 25, set_comprehension; 26, identifier:x; 27, identifier:packages; 28, call; 29, comment:# Filter out all of the "non" normalized names here; 30, call; 31, for_in_clause; 32, attribute; 33, argument_list; 34, identifier:canonicalize_name; 35, argument_list; 36, identifier:x; 37, call; 38, attribute; 39, identifier:isdir; 40, call; 41, identifier:x; 42, attribute; 43, argument_list; 44, identifier:os; 45, identifier:path; 46, attribute; 47, argument_list; 48, identifier:os; 49, identifier:listdir; 50, identifier:simple_dir; 51, attribute; 52, identifier:join; 53, identifier:simple_dir; 54, identifier:x; 55, identifier:os; 56, identifier:path
code: def find_package_indexes_in_dir(self, simple_dir):
          """Given a directory that contains simple packages indexes, return
          a sorted list of normalized package names.  This presumes every
          directory within is a simple package index directory."""
          packages = sorted(
              {
                  # Filter out all of the "non" normalized names here
                  canonicalize_name(x)
                  for x in os.listdir(simple_dir)
              }
          )
          # Package indexes must be in directories, so ignore anything else.
          packages = [x for x in packages if os.path.isdir(os.path.join(simple_dir, x))]
          return packages