aiofunctools-0.0.3
توضیحات
Python functools for async!
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | aiofunctools-0.0.3 |
| نام | aiofunctools |
| نسخه کتابخانه | 0.0.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Pando85 |
| ایمیل نویسنده | pand855@gmail.com |
| آدرس صفحه اصلی | http://github.com/pando85/aiofunctools |
| آدرس اینترنتی | https://pypi.org/project/aiofunctools/ |
| مجوز | GPLv3+ |
[](https://travis-ci.org/pando85/aiofunctools) [](https://github.com/pando85/aiofunctools/blob/master/LICENSE) [](https://aiofunctools.readthedocs.io/en/latest/?badge=latest)
# aiofunctools
Library to help in Python functional programing. It’s asyncio compatible.
Basic idea behind it is [Railway Oriented Programing](https://fsharpforfunandprofit.com/rop/).
This allows us to:
- simplify our code.
- improve error management.
- be cool! be functional!
Examples:
Old code example:
```python
async def create_user_handler(request) -> Response:
try:
user = check_valid_user(request)
create_user(user)
except InvalidBody:
return_422('Invalid body')
except UserAlreadyExists:
return_409('User already exists')
return_201(user)
```
ROP example:
```python
async def create_user_handler(request) -> Response:
return await compose(
check_valid_user,
create_user,
return_201
)(request)
```
نیازمندی
| مقدار | نام |
|---|---|
| >=0.9.0 | toolz |
نحوه نصب
نصب پکیج whl aiofunctools-0.0.3:
pip install aiofunctools-0.0.3.whl
نصب پکیج tar.gz aiofunctools-0.0.3:
pip install aiofunctools-0.0.3.tar.gz