zsv.ticker enables flexible and idiomatic regular execution of tasks:
from zsv.ticker import Ticker
ticker = Ticker()
ticker.start(5)
while ticker.tick():
execute_task()
Ticker aims to be more idiomatic and easy to use than a time calculation and sleep call, and further enables the instantaneous termination of a waiting task:
import signal
from time import sleep
from zsv.ticker import Ticker
ticker = Ticker()
ticker.start(5)
def abort(signum, frame):
ticker.stop()
signal.signal(signal.SIGINT, abort)
while ticker.tick():
print("tick")
sleep(2)
print("tock")
The above script wraps a stop call in a signal handler registered to SIGINT: hitting Ctrl+C after the script prints “tick” but before it prints “tock” will yield a final “tock” before it terminates.
Release files for zsv.ticker 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zsv.ticker-1.1.0.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zsv.ticker-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.2 kB
Release files / zsv.ticker-1.1.0.tar.gz
| Download URL | zsv.ticker-1.1.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7b088bd3e73e3b5d65b4c4ed6a1fa1e712521fdd18c0c705c290264c639b6d7
|
|
BLAKE2b-256 checksum How to use checksums |
0406b84dd0e779f2482c542fed586795a70e3e4b62f6c6d31f27ad24c26c6f24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|
Release files / zsv.ticker-1.1.0-py3-none-any.whl
| Download URL | zsv.ticker-1.1.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65249d3a413e9fa32d84f285326e9711576df215a0691447a7ec5f5b083a0cd2
|
|
BLAKE2b-256 checksum How to use checksums |
6b3dd0cb11d4514aab02beed1d109ec14db00f7e13e3f457b693f6ae5c070643
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|