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.1.tar.gz
(17.8 kB
view hashes)
Built Distribution
Close
Hashes for onecondition-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 725da9ee0b57a704c591c7175a6b66ce2f258f5172febe9b9a726d366d57ec63 |
|
MD5 | 6c4f39b6f5e01e72caa0bb467e41fc08 |
|
BLAKE2b-256 | f2f20df0c55365e0901338a1c5177e194f388a00ee7f4a082e85f60e12425059 |