# pyfallback
## Install
> pip install fallback
## Usage
```python
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 <br />
Note: this project uses poetry and pyenv
Raw data
{
"_id": null,
"home_page": "https://github.com/weilueluo/pyfallback",
"name": "pyfallback",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "fallback,pyfallback",
"author": "Weilue Luo",
"author_email": "luoweilue@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ed/68/d2b6fdf546c86c4026f92bd6027945fb3e67aba3f805f5e9603ed92f9d7d/pyfallback-0.1.0.tar.gz",
"platform": null,
"description": "# pyfallback\n\n## Install\n> pip install fallback\n\n## Usage\n\n```python\nfrom pyfallback import Fallback\n\njson = {\n 'attr-1': 'value-1',\n}\njson = Fallback(json, fallback=\"default\")\n\n# fallback\njson[\"attr-1\"].get() # \"value1\"\njson[\"attr-2\"].get() # \"default\"\n\n# chaining\njson[\"attr-1\"].split('-')[0].get() # \"value\"\n\n# see tests/test_fallback.py for more example \n```\n\n## Contributing\nJust submit a pull request :D <br />\nNote: this project uses poetry and pyenv\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Provides fallback for operations in python",
"version": "0.1.0",
"split_keywords": [
"fallback",
"pyfallback"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f1addcd478fdd41dae9441ec30220ecb49f68b0cdc11b04ac0ba5b076b524bf4",
"md5": "bf96536f032f2d020909153eaba0b7c5",
"sha256": "b83a08240f91bdbd3c4799ec2a3217579d3f0a7fa8b437ad860848e84a1c7883"
},
"downloads": -1,
"filename": "pyfallback-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bf96536f032f2d020909153eaba0b7c5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 6655,
"upload_time": "2023-01-15T18:33:37",
"upload_time_iso_8601": "2023-01-15T18:33:37.881001Z",
"url": "https://files.pythonhosted.org/packages/f1/ad/dcd478fdd41dae9441ec30220ecb49f68b0cdc11b04ac0ba5b076b524bf4/pyfallback-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ed68d2b6fdf546c86c4026f92bd6027945fb3e67aba3f805f5e9603ed92f9d7d",
"md5": "f5142b2ce5749716f06b4778ae6fd3f7",
"sha256": "19172d17a43cbadd725e6e133c4bd4802ccf5132bf1becb14031b0b116765729"
},
"downloads": -1,
"filename": "pyfallback-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "f5142b2ce5749716f06b4778ae6fd3f7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 6502,
"upload_time": "2023-01-15T18:33:39",
"upload_time_iso_8601": "2023-01-15T18:33:39.313815Z",
"url": "https://files.pythonhosted.org/packages/ed/68/d2b6fdf546c86c4026f92bd6027945fb3e67aba3f805f5e9603ed92f9d7d/pyfallback-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-15 18:33:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "weilueluo",
"github_project": "pyfallback",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyfallback"
}