Utility classes for AnyIO
Project description
anyioutils
anyioutils.Future behaves the same as asyncio.Future except that:
- you cannot directly await an
anyioutils.Futureobject, but through its.wait()method (unlike anasyncio.Future, but like anasyncio.Event). - cancelling an
anyioutils.Futuredoesn't raise ananyio.get_cancelled_exc_class(), but ananyioutils.CancelledError.
from anyioutils import CancelledError, Future
from anyio import create_task_group, run
async def set_result(future):
future.set_result("done")
async def cancel(future):
future.cancel()
async def main():
async with create_task_group() as tg:
future0 = Future()
tg.start_soon(set_result, future0)
assert await future0.wait() == "done"
future1 = Future()
tg.start_soon(cancel, future1)
try:
await future1.wait()
except CancelledError:
assert future1.cancelled()
run(main)
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 Distribution
anyioutils-0.0.0.tar.gz
(3.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anyioutils-0.0.0.tar.gz.
File metadata
- Download URL: anyioutils-0.0.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa8fd9e059fcffdb523f38de6c0fe7ecabcb3663f0fb6072495e8f33917e9fa7
|
|
| MD5 |
26b86dc8efa5081970c5f09e2ba77e27
|
|
| BLAKE2b-256 |
cac2a8304583ad29bd66bc8bb44c55f4a0a3824d03e5af8413bd89726c7f4b09
|
File details
Details for the file anyioutils-0.0.0-py3-none-any.whl.
File metadata
- Download URL: anyioutils-0.0.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bab0c1b03e1609cf80b4dccf8db72f3c02e4e740fb4b9fdbef4b22d5db2023a
|
|
| MD5 |
ebe580efb8a0ef318411b005d7bc5ab8
|
|
| BLAKE2b-256 |
deeb55751af7e9be391c8b1e2db35acfbdae313dd380adb8c0ee1944f29a3e96
|