Python functools for async!
Project description
aiofunctools
Library to help in Python functional programing. It’s asyncio compatible.
Basic idea behind it is Railway Oriented Programing.
This allows us to:
- simplify our code.
- improve error management.
- be cool! be functional!
Examples:
Old code example:
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:
async def create_user_handler(request) -> Response:
return await compose(
check_valid_user,
create_user,
return_201
)(request)
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file aiofunctools-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: aiofunctools-0.0.3-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9019e4a8814a74dbdf899c31d23340b38fa4ef2fe5dd70da30cad896386aa30f |
|
MD5 | efca7cb0aa30b59dde4f137c211b65d1 |
|
BLAKE2b-256 | 59ff6db0ee1af66c0aff6c01d54a0bb889b5cb3005c5904f60cec308bb7da1c3 |