Skip to main content

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

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.2.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onecondition-1.0.2-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file onecondition-1.0.2.tar.gz.

File metadata

  • Download URL: onecondition-1.0.2.tar.gz
  • Upload date:
  • Size: 16.8 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.2.tar.gz
Algorithm Hash digest
SHA256 c6b7bd61c77faefe9acc73cb140a932abd5f6942b75e5c346efa3e672cf21256
MD5 c282d38ae5646e40cb11e52134eea95f
BLAKE2b-256 3a817f77a24f9cc3ef150a9e427ab57b92664eb01c0ef315c399c38fd5771adb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onecondition-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for onecondition-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c64273cacf0ef1be5364d392ea120a40e1844370122f9721ebc2ef82275a77a5
MD5 840640c606c52d2c7909e81dc20a945a
BLAKE2b-256 edb8ad226ecd2a7a0698e3b5c3bd39881a5158f3eae538a5b7ce5ca7bf546e2e

See more details on using hashes here.

Supported by

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