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.10.tar.gz
(17.5 kB
view details)
Built Distribution
File details
Details for the file onecondition-1.0.10.tar.gz
.
File metadata
- Download URL: onecondition-1.0.10.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44ee87670832deb255ced512aa4a92641f58fa48fc69af843b6b808afce254f2 |
|
MD5 | dd438dea6d03ba551cd6344361ae5e9f |
|
BLAKE2b-256 | b5fdcccebe6662d5c0777eac740ab22c15398aa0e13d0cee834c4e8be2e7b87d |
File details
Details for the file onecondition-1.0.10-py3-none-any.whl
.
File metadata
- Download URL: onecondition-1.0.10-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97b2536bb6c2fdf360be6c0832d5b3b9d82a2857b7d2d17f6974810e757768f8 |
|
MD5 | 1a3b9cd9fca95de69e223608df142ec8 |
|
BLAKE2b-256 | 15d0aec7235fdbb091f8d735be4ce25beb001da31d534cfaf50967fa991facfa |