AVal is a class capable of applying a list of validation strategies and an exception handler to an object to be validated. It can be used by calling the validation method as well as a decorator
Project description
aval
Abstract
Abstract Validator (AVal) is a class implemented in Python, capable
of taking a list of specific validation strategies (with parameters), as well
as a method for handling exceptional situations, and applying these methods to
the validation object. The Abstract Validator can be used by calling the
validation method on an instance of a class, as well as a decorator.
Installation
Use:
pip install aval
Basic usage
def _is_string(obj: v.VObj, params: v.VParams) -> None:
t = type(obj)
if t != str:
raise v.ValidationError('Some description')
def _correct_length(obj: v.VObj, params: v.VParams) -> None:
mn = params.get('min_length', 1)
mx = params.get('max_length', 32)
ln = len(obj)
if not mn <= ln <= mx:
raise v.ValidationError('Some description'
)
vld = v.Validator([_is_string, _correct_length])
vld.validate('Any message')
Details
More detailed documentation (in Russian) can be found at https://docs.mxustin.ru/micro/validator/manual/intro
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aval-0.0b1.tar.gz.
File metadata
- Download URL: aval-0.0b1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0b2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31430763773ea391a29b36d83d29fe07132dea7567d2eaeb90a7f856406bdff9
|
|
| MD5 |
18d5e77fcd0cbf93ffaaf8eb8b9e5002
|
|
| BLAKE2b-256 |
c862fd27820a2fbdab6457dd91245df68fa9a76607ae73f43c6899234cfc9c5e
|
File details
Details for the file aval-0.0b1-py3-none-any.whl.
File metadata
- Download URL: aval-0.0b1-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0b2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9bf9433e88c1b3ddb9360863dbc2d38b9b54b66ef7d2fa3808fb0dc59c5f081
|
|
| MD5 |
b9eb516bfe520f4ea48f2c5cc66963ce
|
|
| BLAKE2b-256 |
6ce37d64526f2b39f267ccea9b1184272ccd7780e187a4f984dbbc17d9dd226d
|