An ultra-lightweight package for validating single conditions.
Project description
1️⃣ OneCondition
An ultra-lightweight package for validating single conditions.
Usage
>>> import onecondition as oc
>>> def inverse(user_input):
... oc.validate.instance(user_input, (int, float))
... oc.validate.positive(user_input)
... return 1 / user_input
>>> inverse(4)
0.25
>>> inverse(0)
Traceback (most recent call last):
...
onecondition.ValidationError: Value `0` must be positive (non-zero)
>>> inverse("foobar")
Traceback (most recent call last):
...
onecondition.ValidationError: Value `'foobar'` must be an instance of (<class 'int'>, <class 'float'>), not a <class 'str'>
Full Documentation
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
onecondition-1.1.6.tar.gz
(17.7 kB
view hashes)
Built Distribution
Close
Hashes for onecondition-1.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4000391af52400f3106a1e53e48db0f22548671cce4a544f8ea8f3e92cd64e51 |
|
MD5 | 0f6b5b91c7b66f23b296c8c4064e6f87 |
|
BLAKE2b-256 | 08749b79d3c543fc6b56994d73e078b3d9429d86b876076e78847b7893d89e65 |