INNER CODE UNIT · Python

get_project_root

DataTalksClub/datatalksclub.github.io · scripts/add_dateadded_from_git.py:30

def get_project_root() -> Path:
    """Return the project root directory (parent of scripts directory)."""
    return Path(__file__).parent.parent


def resolve_podcast_path(podcast_file: str) -> Optional[Path]:
    """Resolve a podcast file path relative to the project root."""
    project_root = get_project_root()
    file_path = Path(podcast_file)

    if file_path.exists():
        return file_path.resolve()

    candidate = project_root / podcast_file
    if candidate.exists():
        return candidate.resolve()

    return None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…