argclz.validator.ListValidatorBuilder#
- class argclz.validator.ListValidatorBuilder[source]#
Bases:
AbstractTypeValidatorBuilder[list[T]]a list validator
Methods Summary
__init__([element_type])allow_empty([allow])Allow or disallow empty lists
freeze()(internal use) return a copy of itself.
length_in_range(a, b, /)Enforce a length range for lists
on_item(validator)Apply an additional validator to each item in the list
optional()__call__(value)Details
- allow_empty(allow=True)[source]#
Allow or disallow empty lists
- Parameters:
allow (bool)
- Return type:
Self
- __call__(value)[source]#
- Parameters:
value (Any) – type-casted value.
- Returns:
True if value pass the validation.
- Raises:
ValueError – when value does not pass the validation.
- Return type:
- optional()#
- Return type:
Self