validation#
@author: ☙ Ryan McConnell ❧
- class grave_settings.validation.ValidationReport(settings: MutableMapping, settings_key: str, name: str, description: str, long_description: str, fixes: list[Callable[[MutableMapping, str], bool]] | None = None)[source]#
Bases:
object
- Parameters:
settings (MutableMapping) –
settings_key (str) –
name (str) –
description (str) –
long_description (str) –
fixes (list[Callable[[MutableMapping, str], bool]] | None) –
- settings: MutableMapping#
- class grave_settings.validation.Validation(key)[source]#
Bases:
object
- Parameters:
key (str) –
- validate(settings, settings_key)[source]#
- Parameters:
settings (MutableMapping) –
settings_key (str) –
- Return type:
ValidationReport | None
- class grave_settings.validation.ValidationCapsule(key)[source]#
Bases:
Validation
- Parameters:
key (str) –
- make_validation_report#
alias of
ValidationReport
- class grave_settings.validation.NotNoneValidation(key)[source]#
Bases:
Validation
- Parameters:
key (str) –
- validate(settings, settings_key)[source]#
- Parameters:
settings (MutableMapping) –
settings_key (str) –
- Return type:
ValidationReport | None
- class grave_settings.validation.TypeCheckValidation(key, _type)[source]#
Bases:
Validation
- validate(settings, settings_key)[source]#
- Parameters:
settings (MutableMapping) –
settings_key (str) –
- Return type:
ValidationReport | None
- class grave_settings.validation.SettingsValidator(settings)[source]#
Bases:
object
- Parameters:
settings (MutableMapping) –
- create_validation(name, validation_function, v_t=<class 'grave_settings.validation.Validation'>)[source]#
- Parameters:
name (str) –
validation_function (Callable[[MutableMapping, str, ...], Callable[[MutableMapping, str], bool] | None]) –
v_t (Type[Validation]) –
- create_validations(validations, v_t=<class 'grave_settings.validation.Validation'>)[source]#
- Parameters:
validations (list[tuple[str, Callable[[MutableMapping, str, ...], Optional[Callable[[MutableMapping, str], bool]]]]]) –
v_t (Type[Validation]) –
- add_validation(validation)[source]#
- Parameters:
validation (Validation) –
- add_validations(validations)[source]#
- Parameters:
validations (Iterable[Validation]) –