validators

Validators for use in frameworks such as Pydantic or Marshmallow.

suou.validators.matches(regex: str | int, /, length: int = 0, *, flags=0)

Return a function which returns True if X is shorter than length and matches the given regex.

suou.validators.not_greater_than(y)

Return a function that returns True if X is not greater than (i.e. lesser than or equal to) the given value.

suou.validators.not_less_than(y)

Return a function that returns True if X is not less than (i.e. greater than or equal to) the given value.

suou.validators.yesno(x: str | int | bool | None) bool

Returns False if x.lower() is in ‘0’, ‘’, ‘no’, ‘n’, ‘false’ or ‘off’.

New in 0.9.0

Changed in 0.11.1: now accepts None and bool.