Skip to main content

scorebook.utils.io_helpers

Input/output helper functions for Scorebook.

validate_path

def validate_path(file_path: str,
expected_suffix: Optional[str] = None) -> Path

Validate that a file path exists and optionally check its suffix.

Arguments:

  • file_path - Path to the file as string or Path object
  • expected_suffix - Optional file extension to validate (e.g. ".json", ".csv")

Returns:

Path object for the validated file path

Raises:

  • FileNotFoundError - If the file does not exist
  • ValueError - If the file has the wrong extension