import pathlib
from typing import List


def _write_dataset_files(
    root_path: pathlib.Path, namespace: str, datasets: List[str]
) -> str:
  """Write the repo content containing the datasets."""
  repo_path = root_path / namespace
  # Create all datasets
  for ds_name in datasets:
    ds_path = repo_path / ds_name / f'{ds_name}.py'
    ds_path.parent.mkdir(parents=True)  # Create the containing dir
    ds_path.touch()  # Create the file

  # Additional noisy files should be ignored
  (repo_path / '__init__.py').touch()
  (repo_path / 'empty_dir').mkdir()
  return str(repo_path)