def list_directory(project_tree, directory):
  """List Paths directly below the given path, relative to the ProjectTree.

  Raises an exception if the path is not a directory.

  :returns: A DirectoryListing.
  """
  try:
    path = normpath(directory.path)
    entries = [join(path, e) for e in project_tree.listdir(path)]
    return DirectoryListing(directory,
                            True,
                            tuple(Path(e) for e in entries))
  except (__HOLE__, OSError) as e:
    if e.errno == errno.ENOENT:
      return DirectoryListing(directory, False, tuple())
    else:
      raise e
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/engine/exp/fs.py/list_directory