Back to bricks list
Introduction Version

FloatValidator

Validator class

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

Usage: Let validator = FloatValidator(), then * validator.validate(5.5) -> 5.5 * validator.validate(4.0) -> 4.0 * validator.validate(4) -> 4.0 * validator.validate('4') -> 4.0 * validator.validate(math.inf) -> math.inf * validator.validate('Infinity') -> math.inf * validator.validate('-Infinity') -> -math.nan * validator.validate('false') -> ValueError * validator.validate('true') -> ValueError * validator.validate('foo') -> ValueError * validator.validate('inf') -> ValueError * validator.validate('infinity') -> ValueError * validator.validate('nan') -> ValueError

Functions

__INIT__

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

Parameters:
NameTypeDefault valueDescription
min_valuefloat -inf
max_valuefloat inf
include_minbool True
include_maxbool True
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