Validation¶
Validate a configuration value by converting it to a specific type.
These functions are used by staticconf.readers
and
staticconf.schema
to coerce config values to a type.
- staticconf.validation.build_list_type_validator(item_validator: Callable[[Any], Any]) Callable[[Any], List[Any]] [source]¶
Return a function which validates that the value is a list of items which are validated using item_validator.
- staticconf.validation.build_map_type_validator(item_validator: Callable[[Any], Any]) Callable[[Any], Dict[Any, Any]] [source]¶
Return a function which validates that the value is a mapping of items. The function should return pairs of items that will be passed to the dict constructor.
- staticconf.validation.get_validators() ItemsView[str, Callable[[Any], Any]] [source]¶
Return an iterator of (validator_name, validator) pairs.
- staticconf.validation.validate_log_level(value: Any) int [source]¶
Validate a log level from a string value. Returns a constant from the
logging
module.