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
Close
Hashes for aiofunctools-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a6100f0d55ff004061f3efee5c9e5d3e4ac30fbdb57dd5f6a157f8fe2ef9d6d |
|
MD5 | f9018c2a108b3d0d1534a36f92d08a2f |
|
BLAKE2b-256 | 2c81c3d0a1f2f4c19ef3baedee3af0b8e4101b2f0e15c3af152f640e7b5ce1b9 |