async-chain (0.1.4)
Installation
pip install --index-url async-chainAbout this package
Utility for chaining awaits
Async Chain
Utility for chaining awaits
About
This package allows library developers to write interfaces that are both fluent and async, avoiding ugly syntax, like in the following example:
async def on_message(event):
# bad!
(await (await (await event.get_message()).get_author()).send_message("Hello world!"))
Instead, by marking all involved methods with the @async_chain.method decorator:
import async_chain
class MyEvent:
@async_chain.method
async def get_message(self):
...
The following syntax can be achieved:
async def on_message(event):
# nice!
await event.get_message().get_author().send_message("Hello world!")
Links
Tools
Packaging
Documentation
Development
Requirements
Requires Python: >=3.10,<4.0
Details
Assets (2)
Versions (3)
View all
async_chain-0.1.4.tar.gz
3.3 KiB