preprocess_path

preprocess_path(
    str_or_path: Path | str,
    mk_path: bool = False,
    is_file: bool = False,
    is_dir: bool = True
) -> Path

Preprocess the path for file operations.

Parameters:
NameDescription
str_or_pathThe path to be processed.

Type: pathlib.Path | str
mk_pathWhether to create the path if it doesn’t exist.

Default is True.

Type: bool

Default: False
is_fileWhether the path is a file.

Default is False.

Type: bool

Default: False
is_dirWhether the path is a directory.

Default is True.

Type: bool

Default: True
Returns:
TypeDescription
pathlib.PathPath: The preprocessed path.