def validate_report_path()

in evaluate.py [0:0]


def validate_report_path(path: str) -> str:
    """Validate and normalize a report file path."""
    if not path:
        raise ValueError("Report path cannot be empty")

    # Convert to absolute path and normalize separators
    abs_path = os.path.abspath(os.path.expanduser(path))

    # Check if path does not exist
    if os.path.exists(abs_path):
        raise FileExistsError(f"Grading report already exists: {abs_path}")

    # Check if the parent directory exists
    parent_dir = os.path.dirname(abs_path)
    if not os.path.exists(parent_dir):
        raise FileNotFoundError(
            f"Parent directory for grading report does not exist: {parent_dir}"
        )

    # Check if path has .csv extension
    if not abs_path.endswith(".csv"):
        raise ValueError(f"Report must be in CSV format: {abs_path}")

    return abs_path