A signal based timeout context manager
Project description
A signal based timeout context manager and decorator.
Since it is signal based this package can not work under Windows operating system.
Usage
As a context manager:
import sys
from time import sleep
rom timeoutcontext import timeout
try:
with timeout(1):
sleep(2)
except TimeoutError:
print('timeout')
As a decorator:
import sys
from time import sleep
from timeoutcontext import timeout
@timeout(1)
def wait():
sleep(2)
try:
wait()
except TimeoutError:
print('timeout')
License
Free software: BSD license
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timeoutcontext-2.0.0.tar.gz
(1.9 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 timeoutcontext-2.0.0.tar.gz.
File metadata
- Download URL: timeoutcontext-2.0.0.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fc76808bba0b1d51cb7ced0e6c961952b3f2fd343c9d73e2b3e8adbd382fbfc
|
|
| MD5 |
fa8c1515ffd8497d1e372eea86d0f61e
|
|
| BLAKE2b-256 |
524ff5cce31dde27074684cb5b9c2dff1c15c1d75569fbac6077439f5cb419b5
|
File details
Details for the file timeoutcontext-2.0.0-py3-none-any.whl.
File metadata
- Download URL: timeoutcontext-2.0.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d4d2b5be28560f9852df436e6ae111a2b726831eee28bb01d16e5a5256f2224
|
|
| MD5 |
b50760210323f2986756f4052bab6fbf
|
|
| BLAKE2b-256 |
08bc27dcde76e5f54bf0a71c16ebc7819e78fec45d8f19155e40f6ee891e3fb7
|