Specify a timeout with any given function
Project description
bombfuse
Python module for specifying timeouts when executing functions
Installation
To install this package, run the following command:
$ pip install bombfuse
Usage
>>> import time
>>> import bombfuse
>>> import sys
>>> # here's an infinite loop
>>> def func(msg):
>>> while True:
>>> time.sleep(1)
>>> sys.stdout.write(msg + "\n")
>>> sys.stdout.flush()
>>>
>>> # time out in 5 seconds
>>> bombfuse.timeout(5, func, "Hello world!")
Hello world!
Hello world!
Hello world!
Hello world!
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bombfuse\__init__.py", line 64, in timeout
raise e
bombfuse.TimeoutError: The function 'func' timed out
>>>
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
bombfuse-0.3.3.tar.gz
(3.1 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 bombfuse-0.3.3.tar.gz.
File metadata
- Download URL: bombfuse-0.3.3.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fda90d4d4308d0f963ae8044d35099be5538a5f9f1c8c3c8dd2e97fd04f4941
|
|
| MD5 |
ed017ebac8b82f844b90acfdbf39594d
|
|
| BLAKE2b-256 |
ddb4d5fd1a8dabf398773c8d28ecc0a6bcdd9fed15d90953d1483410786f259b
|
File details
Details for the file bombfuse-0.3.3-py3-none-any.whl.
File metadata
- Download URL: bombfuse-0.3.3-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d89c57dc655ae95689750d9a3f31bb7addb1b2664b2294f94f591ece02c07a3
|
|
| MD5 |
9cdc4a623da21bda2fefc93b7cac29a2
|
|
| BLAKE2b-256 |
3241755aab2d03d056ababeb925401023754d12b2d89d1fbd9122059c4c709f1
|