bagof.validators.numbers
Validators for numeric types (int, float, etc.).
Classes
IsNumber
IsPositive
IsNegative
IsNonNegative
IsNonPositive
IsLessThan
IsLessEqual
IsGreaterThan
IsGreaterEqual
IsInRange
IsInRange(min_value: NUMBER, max_value: NUMBER, inclusive: bool | tuple[bool, bool] = True, hint: Any = UNSET, compose: bool = False)
Validator for numbers in a range.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_value
|
NUMBER
|
The minimum value of the range. |
required |
max_value
|
NUMBER
|
The maximum value of the range. |
required |
inclusive
|
bool | (bool, bool)
|
Whether the range is inclusive on both ends. If a single boolean is provided, it applies to both ends. |
True
|
hint
|
Any
|
The type hint to validate against. |
UNSET
|
compose
|
bool
|
Whether to compose this validator with others, when they are
found in |
False
|