bagof.converters.numbers
Converters for numeric types.
Classes
ToNumber
Converter for numbers.Number types.
Example
ToBool
ToPositive
ToNegative
ToNonNegative
ToNonPositive
ToLessThan
ToLessEqual
ToGreaterThan
ToGreaterEqual
ToInRange
ToInRange(min_value: NUMBER, max_value: NUMBER, inclusive: bool | tuple[bool, bool] = True, hint: Any = UNSET)
Converter that also checks the value is within a range.
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 convert to. |
UNSET
|