PathLike¶
This page documents checkers for arguments that represent filesystem paths.
- class argscheck.pathlike.PathLike(*args, **kwargs)¶
Check if x is of a path-like type (str or pathlib.Path).
Additional checks and conversions can be performed by changing some of the default parameters.
- Parameters
is_dir – bool – If True, x must point to an existing directory.
is_file – bool – If True, x must point to an existing file.
suffix – Optional[str] – x must have this suffix (wildcards and regex are not supported).
suffixes – Optional[List[str]] – x must have these suffixes (wildcards and regex are not supported). If both suffix and suffixes are provided, then, x’s suffix(es) must match at least one of them.
ignore_suffix_case – bool – Whether the suffix’s case should be ignored. Only relevant if suffix or suffixes are provided.
as_str – bool – If True, x will be converted to str before it is returned.
as_path – bool – If True, x will be converted to pathlib.Path before it is returned.