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
Initialize self. See help(type(self)) for accurate signature.
Name | Type | Default value | Description |
---|---|---|---|
min_value | float | -inf | |
max_value | float | inf | |
include_min | bool | True | |
include_max | bool | True | |
allowed_values | List |
Name | Type | Default value | Description |
---|---|---|---|
type_ | Union |
Valitates a value.
Name | Type | Default value | Description |
---|---|---|---|
value | Union | The value to validate an instance of `bool`, `int`, `float`, `str` or serilaizable `list`, `dict` |
Any |