Skip to main content

Process a series of conditional judgement with a chained call.

Project description


Condition Chain
===============

Process a series of conditional judgement with a chained call.

Example
-------

>>> from condition_chain import Condition
>>> condition = Condition(1).be(2).equal(2.0 - 2)\
.differ('a').instance_of(str).expect(lambda x: x, 1)
>>> print(condition.result(), condition.success, condition.failures, sep='\n')
False
[('be', 2), ('equal', 0.0), ('differ', 'a'), ('instance_of', 'str'), ('expect', ('<lambda>', 1))]
[('be', 2), ('equal', 0.0), ('instance_of', 'str')]
>>> condition = Condition([1,2,3]).contain(1).have('append').hold(3)
True
[('contain', 1), ('have', 'append'), ('hold', 3)]
[]

Install
-------

.. code-block:: shell
pip install condition_chain

Author
------
Yixian Du (duyixian1234@outlook.com)

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

condition_chain-1.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

condition_chain-1.0.0-py2.py3-none-any.whl (3.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file condition_chain-1.0.0.tar.gz.

File metadata

File hashes

Hashes for condition_chain-1.0.0.tar.gz
Algorithm Hash digest
SHA256 62ff3030722cb34894d74b262e5b5bf1be66e8ad8487304799ee2424be584934
MD5 52e4d1adc85f2461dd7b13b957d87958
BLAKE2b-256 5048219e152013cb80869d97a6f35929781997d015c514bc977fccfa55710c7b

See more details on using hashes here.

File details

Details for the file condition_chain-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for condition_chain-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9c4c58715c824b27d29d7962c9718a9ac57a7bb148dd2915a3700b38991dd22b
MD5 ec989d3a41183a28e73858699e231d5b
BLAKE2b-256 5b671b4b53932f0abca94551456b9f1e5bfe3092efd2bf1eba6fda9ac49edaa9

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