Back to bricks list
Introduction
Technical Documentation
Other Classes
NumericValidator Validator
Version

NumericValidator

Validator class

This validator allows validating serialized (or deserialized) numerical parameter values.

Usage: Let validator = IntValidator(), then * validator.validate('3') -> 3 * validator.validate(3) -> 3) * validator.validate(3.0) -> 3 * validator.validate('false') -> ValueError * validator.validate('true') -> ValueError * validator.validate('foo') -> ValueError

Functions

__INIT__

Initialize self. See help(type(self)) for accurate signature.

Parameters:
NameTypeDefault valueDescription
type_type <class 'float'>
min_valuefloat -inf
max_valuefloat inf
include_minbool False
include_maxbool False
allowed_valueslist
SET_TYPE
Parameters:
NameTypeDefault valueDescription
type_Union
VALIDATE

Valitates a value.

Parameters:
NameTypeDefault valueDescription
valueUnion The value to validate an instance of `bool`, `int`, `float`, `str` or serilaizable `list`, `dict`
Return type:
Any