argclz.validator.PathValidatorBuilder#

class argclz.validator.PathValidatorBuilder[source]#

Bases: AbstractTypeValidatorBuilder[Path]

a path validator

__init__()[source]#

Methods Summary

__init__()

freeze(*args, **kwargs)

(internal use) return a copy of itself.

is_dir()

Check if path is a directory

is_exists()

Check if path exists

is_file()

Check if path is a file

is_suffix(suffix)

Check path suffix or in a list of suffixes

optional()

__call__(value)

Details

is_suffix(suffix)[source]#

Check path suffix or in a list of suffixes

Parameters:

suffix (str | list[str] | tuple[str, ...])

Return type:

Self

is_exists()[source]#

Check if path exists

Return type:

Self

is_file()[source]#

Check if path is a file

Return type:

Self

is_dir()[source]#

Check if path is a directory

Return type:

Self

__call__(value)#
Parameters:

value (Any) – type-casted value.

Returns:

True if value pass the validation.

Raises:

ValueError – when value does not pass the validation.

Return type:

bool

freeze(*args, **kwargs)#

(internal use) return a copy of itself.

Return type:

Self

optional()#
Return type:

Self