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.0.7.tar.gz
(17.5 kB
view hashes)
Built Distribution
Close
Hashes for onecondition-1.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b52e7165f49ac943b5eea3848711da80605fc55f295e3a56d459702b39998ca5 |
|
MD5 | c7bd80d45f71ae29b15c732b4082390e |
|
BLAKE2b-256 | da928595974294cde52ffdc0202cd87cbe30948b538b9c3bca1998afd2df08fc |