Skip to content

validators

Answer validators.

Classes

ExprValidator

ExprValidator(expr: str = '')

A callable that will validate input by rendering an expression.

Functions

__call__
__call__(value: T) -> T

Validate the input.

PARAMETER DESCRIPTION
value

The value to validate.

TYPE: T

RETURNS DESCRIPTION
T

The value if the expression returns nothing.

RAISES DESCRIPTION
ValueError

If the expression returns a value. The message of the ValueError is the rendered expression.

Functions

is_bool

is_bool(value: Any) -> bool

Is the value a boolean or convertible to a boolean?

is_float

is_float(value: Any) -> bool

Is the value a float or convertible to a float?

is_int

is_int(value: Any) -> bool

Is the value an int or convertible to an int?