Skip to main content

An ultra-lightweight package for validating single conditions.

Project description

1️⃣ OneCondition

An ultra-lightweight package for validating single conditions.

Python Version PyPI Version GitHub Build Codacy Badge License PyPI Downloads

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

onecondition on Read the Docs

Project details


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)

Uploaded Source

Built Distribution

onecondition-1.0.10-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

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

Hashes for onecondition-1.0.10.tar.gz
Algorithm Hash digest
SHA256 44ee87670832deb255ced512aa4a92641f58fa48fc69af843b6b808afce254f2
MD5 dd438dea6d03ba551cd6344361ae5e9f
BLAKE2b-256 b5fdcccebe6662d5c0777eac740ab22c15398aa0e13d0cee834c4e8be2e7b87d

See more details on using hashes here.

File details

Details for the file onecondition-1.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for onecondition-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 97b2536bb6c2fdf360be6c0832d5b3b9d82a2857b7d2d17f6974810e757768f8
MD5 1a3b9cd9fca95de69e223608df142ec8
BLAKE2b-256 15d0aec7235fdbb091f8d735be4ce25beb001da31d534cfaf50967fa991facfa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page