argclz.validator.ValidatorBuilder#
- final class argclz.validator.ValidatorBuilder[source]#
Bases:
object- __init__()#
Methods Summary
__init__()all(*validator)return a validator that ensure all combined validator are satisfied.
any(*validator)return a validator that ensure at least one combined validator is satisfied.
list([element_type])a list validator
non_none()optional()return a validator that pass the validation when the value is
None.tuple()a tuple validator
__call__(validator[, message])Create a validator with a failure message.
Attributes Summary
Details
- property str: StrValidatorBuilder#
a str validator
- property int: IntValidatorBuilder#
a int validator
- property float: FloatValidatorBuilder#
a float validator
- tuple(*element_type: int | ellipsis) TupleValidatorBuilder[source]#
- tuple(*element_type: type[T] | ellipsis | None) TupleValidatorBuilder
a tuple validator
overloading element_type example:
2: 2-length tupletype1, type2: 2-length tuple with type1 at pos 0 and type2 at pos 1.type1, None: 2-length tuple with type1 at pos 0 and any type at pos 1.type1, ...: at-least-1-length tuple with type1 from pos 0 to remaining pos.
- property path#
a path validator
- classmethod all(*validator)[source]#
return a validator that ensure all combined validator are satisfied. return an always-true validator if validator is empty.
- Parameters:
- Return type:
- classmethod any(*validator)[source]#
return a validator that ensure at least one combined validator is satisfied. return an always-true validator if validator is empty.
- Parameters:
- Return type:
- classmethod optional()[source]#
return a validator that pass the validation when the value is
None.- Return type: