_check_input_exists

_check_input_exists(input_var: str, input_var_name: str, base_path: Path, is_file: bool = False) str | None[source]

Check that the input path base_path / input_var exists.

Parameters:
  • input_var (str) – Value of the input which should be checked for existence.

  • input_var_name (str) – Variable name, used to format the error message.

  • base_path (Path) – Base path the input var is relative to.

  • is_file (bool) – Whether to check if the path is a valid file or folder. Defaults to False

Returns:

Value of input_var

Return type:

Optional[str]

Raises:
  • ValueError – If is_file is True and the path is not a file.

  • ValueError – If is_file is False and the path is not a folder.