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 Codecov Coverage 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.13.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: onecondition-1.0.13.tar.gz
  • Upload date:
  • Size: 17.6 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.13.tar.gz
Algorithm Hash digest
SHA256 55ba8980adac125f8f383f2400487d1886788218ce29d167ac2d84154bdd6374
MD5 a3463e5427875d8fda78d69e5b3cb2e3
BLAKE2b-256 2d7e64b48545ce3c4d3e84827c8b6034499870938f451f47f8b1eccdea55dcb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for onecondition-1.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 b43a60933a8a75ac8c33a05a9d66a30b9657a8075c439014b9afb30c2184d053
MD5 a9e0acf4beaba4b2e6c8690a6993d665
BLAKE2b-256 fb877d535fe102423e5b7b78e77b7c9025544b6b76a00160dc41e0c8301c9953

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