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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

condition_chain-0.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file condition_chain-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for condition_chain-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c8950d893a756408d160cd6c6aefdfcfae3ea91d7a470adb9569f8f022bc831
MD5 d9329a36e6dece2e2543b0318380fa66
BLAKE2b-256 90c00159130b6e40772672b96b1d99ec5ce26c59ff866818b8c6f3f158ad8ec0

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