from pathlib import Path
from typing import Dict
from typing import List


def _parse_entries(entries_path: Path) -> Dict[str, List[str]]:
    """return a dict of {year: [month], ...} from all saved entries"""

    entries = {}

    years = [f.name for f in entries_path.iterdir() if f.is_dir()]
    years.sort()

    for year in years:
        months_folder = entries_path / year
        entries[year] = [f.name for f in months_folder.iterdir() if f.is_dir()]
        entries[year].sort()

    return entries