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
Release history Release notifications | RSS feed
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)
Built Distribution
File details
Details for the file condition_chain-1.0.0.tar.gz
.
File metadata
- Download URL: condition_chain-1.0.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62ff3030722cb34894d74b262e5b5bf1be66e8ad8487304799ee2424be584934 |
|
MD5 | 52e4d1adc85f2461dd7b13b957d87958 |
|
BLAKE2b-256 | 5048219e152013cb80869d97a6f35929781997d015c514bc977fccfa55710c7b |
File details
Details for the file condition_chain-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: condition_chain-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c4c58715c824b27d29d7962c9718a9ac57a7bb148dd2915a3700b38991dd22b |
|
MD5 | ec989d3a41183a28e73858699e231d5b |
|
BLAKE2b-256 | 5b671b4b53932f0abca94551456b9f1e5bfe3092efd2bf1eba6fda9ac49edaa9 |