Horus is a recursive data-structure validator that walks nested dicts, lists, tuples and scalars and checks every node against rule sets of regex patterns, reporting compliance with human-readable messages and the exact path of each violation.
Project description
Horus
Horus is a recursive data-structure validator. It walks nested dicts, lists, tuples and scalars and checks every node against rule sets of regex patterns, reporting compliance with human-readable messages and the exact path of each violation.
Installation
pip install wedjat
The package is distributed as
wedjaton PyPI but imported asHorus.
Usage
from Horus import Horus, newType
validator_rules = {
"name": {"first": "Empty,EnSmCp", "last": "Empty,EnSmCp"},
"age": "Empty,Dg",
"hoppies": [{"hoppy": "Empty,EnSmCp"}],
"trips": ["Empty,EnSmCp"],
}
validator_input = {
"name": {"first": "Ahmed", "last": "KamalELSaman"},
"age": 35,
"hoppies": [{"hoppy": "Cycle"}, {"hoppy": "Swim"}],
"trips": ["Germany"],
}
Horus.eye(validator_rules, validator_input)
Each rule is a comma-separated list of rule names. The leading names are refuse patterns (input that matches is rejected) and the final name is the accept pattern (input that does not match is rejected). Rules are defined in validator_rules.py as {name: {"pattern": ..., "message": ...}}.
License
MIT
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 Distributions
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 wedjat-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wedjat-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9bfebe0608422912d19c3d7c1d7be88cd8a9f87cef3d0279a19b9e220471228
|
|
| MD5 |
5bb0fc599ba3f4c3f52bb79bade91dc4
|
|
| BLAKE2b-256 |
d0bcc00774e2dfaaf196f1c8f4d4af1335696af0c81c0cc46497f670273a7a6d
|