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