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.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for condition_chain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a1069d35342015906371d3e8479901763c8cc71d870ef07029c5aaf4a57c9fd
MD5 e678b04b5066e2985f081a6340ab94ca
BLAKE2b-256 cf3f4cd5c718c8df4af3f21822ce8c63d82a46d245857ad41017c2bd3f37f956

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