Provides fallback for operations in python
Project description
pyfallback
Install
pip install fallback
Usage
from pyfallback import Fallback
json = {
'attr-1': 'value-1',
}
json = Fallback(json, fallback="default")
# fallback
json["attr-1"].get() # "value1"
json["attr-2"].get() # "default"
# chaining
json["attr-1"].split('-')[0].get() # "value"
# see tests/test_fallback.py for more example
Contributing
Just submit a pull request :D
Note: this project uses poetry and pyenv
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
pyfallback-0.1.0.tar.gz
(6.5 kB
view hashes)
Built Distribution
Close
Hashes for pyfallback-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b83a08240f91bdbd3c4799ec2a3217579d3f0a7fa8b437ad860848e84a1c7883 |
|
MD5 | bf96536f032f2d020909153eaba0b7c5 |
|
BLAKE2b-256 | f1addcd478fdd41dae9441ec30220ecb49f68b0cdc11b04ac0ba5b076b524bf4 |