Context manager to raise an exception when a future is done
Project description
async_interrupt
Interrupt context manager for asyncio.
This module provides a context manager that can be used to interrupt a block of code as soon as possible when a future is done.
The purpose is to raise as soon as possible to avoid any race conditions.
This is based loosely on async_timeout by Andrew Svetlov and cpython asyncio.timeout
Usage
async with interrupt(future, ValueError, "message"):
future.set_result(None)
await asyncio.sleep(0)
Installation
Install this via pip (or your favourite package manager):
pip install async_interrupt
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Credits
This package was created with Copier and the browniebroke/pypackage-template project template.
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
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 async_interrupt-1.2.2.tar.gz.
File metadata
- Download URL: async_interrupt-1.2.2.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be4331a029b8625777905376a6dc1370984c8c810f30b79703f3ee039d262bf7
|
|
| MD5 |
e4b399bd7b06522130a832302e7facc2
|
|
| BLAKE2b-256 |
5679732a581e3ceb09f938d33ad8ab3419856181d95bb621aa2441a10f281e10
|
Provenance
The following attestation bundles were made for async_interrupt-1.2.2.tar.gz:
Publisher:
ci.yml on Bluetooth-Devices/async_interrupt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
async_interrupt-1.2.2.tar.gz -
Subject digest:
be4331a029b8625777905376a6dc1370984c8c810f30b79703f3ee039d262bf7 - Sigstore transparency entry: 173502608
- Sigstore integration time:
-
Permalink:
Bluetooth-Devices/async_interrupt@2a9ba44d611c905e47898145786426600ebff34f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Bluetooth-Devices
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@2a9ba44d611c905e47898145786426600ebff34f -
Trigger Event:
push
-
Statement type:
File details
Details for the file async_interrupt-1.2.2-py3-none-any.whl.
File metadata
- Download URL: async_interrupt-1.2.2-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a8deb884acfb5fe55188a693ae8a4381bbbd2cb6e670dac83869489513eec2c
|
|
| MD5 |
d39b60fb0503b4d33b852959c48a79d9
|
|
| BLAKE2b-256 |
5a77060b972fa7819fa9eea9a70acf8c7c0c58341a1e300ee5ccb063e757a4a7
|
Provenance
The following attestation bundles were made for async_interrupt-1.2.2-py3-none-any.whl:
Publisher:
ci.yml on Bluetooth-Devices/async_interrupt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
async_interrupt-1.2.2-py3-none-any.whl -
Subject digest:
0a8deb884acfb5fe55188a693ae8a4381bbbd2cb6e670dac83869489513eec2c - Sigstore transparency entry: 173502609
- Sigstore integration time:
-
Permalink:
Bluetooth-Devices/async_interrupt@2a9ba44d611c905e47898145786426600ebff34f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Bluetooth-Devices
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@2a9ba44d611c905e47898145786426600ebff34f -
Trigger Event:
push
-
Statement type: