Validators
provide.foundation.config.validators
¶
TODO: Add module docstring.
Functions¶
validate_choice
¶
Create a validator that ensures value is one of the given choices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
choices
|
list[Any]
|
List of valid choices |
required |
Returns:
| Type | Description |
|---|---|
Callable[[Any, Any, Any], None]
|
Validator function for use with attrs |
Source code in provide/foundation/config/validators.py
validate_log_level
¶
Validate that a log level is valid.
Source code in provide/foundation/config/validators.py
validate_non_negative
¶
Validate that a value is non-negative.
Source code in provide/foundation/config/validators.py
validate_overflow_policy
¶
Validate rate limit overflow policy.
Source code in provide/foundation/config/validators.py
validate_port
¶
Validate that a port number is valid.
Source code in provide/foundation/config/validators.py
validate_positive
¶
Validate that a value is positive.
Source code in provide/foundation/config/validators.py
validate_range
¶
Create a validator that ensures value is within the given numeric range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_val
|
float
|
Minimum allowed value (inclusive) |
required |
max_val
|
float
|
Maximum allowed value (inclusive) |
required |
Returns:
| Type | Description |
|---|---|
Callable[[Any, Any, Any], None]
|
Validator function for use with attrs |
Source code in provide/foundation/config/validators.py
validate_sample_rate
¶
Validate that a sample rate is between 0.0 and 1.0.