resettabletimer
Wrapper for threading.Timer to provide a resettable Timer implementation. Also provides fake timer for testing.
Usage
ResettableTimer
from resettabletimer import ResettableTimer
delay = 5 # seconds
function = print
# Create resettable timer
t = ResettableTimer(delay, function, ["Hello"], {"end":" timer!\n"})
# Starting and canceling work similarly than with threading.Timer
t.start()
# Wait 1-5 seconds
# Reset the timer
t.reset()
# Hello should be printed after five seconds
FakeTimer
from resettabletimer import FakeTimer
t = FakeTimer(2, print, ["Hello"], {"end":" timer!\n"})
# Starting and canceling work similarly than with threading.Timer
t.start()
# Wait >2 seconds
# Nothing happens
# Time passage is controlled with pass_time
t.pass_time(2)
# Hello should be printed
Testing
Check and automatically fix formatting with:
pycodestyle resettabletimer
autopep8 -aaar --in-place resettabletimer
Run static analysis with:
pylint -E --enable=invalid-name,unused-import,useless-object-inheritance resettabletimer
Run unit tests:
# Run unit tests
python3 -m unittest discover -s tst/
# Run unit tests with coverage analysis
coverage run \
--branch \
--source resettabletimer/ \
-m unittest discover -s tst/
coverage report -m
Metadata
Release files for resettabletimer 1.0.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 | Provenance | |
|---|---|---|---|---|
| resettabletimer-1.0.0.tar.gz | 3.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| resettabletimer-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / resettabletimer-1.0.0.tar.gz
| Download URL | resettabletimer-1.0.0.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2ca68f40b8743f825118fec9a5a769a78790ce2351bacf8f79e6c3eb9ca7a22
|
|
BLAKE2b-256 checksum How to use checksums |
875f7c7dc782c934d1a6c8af64b2b9a37541b995da02ec238f06a9b088df41e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / resettabletimer-1.0.0-py3-none-any.whl
| Download URL | resettabletimer-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37409ccb6899dc997d96e8692741af091880e172ac62724cf289e406d6d622d1
|
|
BLAKE2b-256 checksum How to use checksums |
3cb2226feccd7832500924a1d378840c59d50d5b03bbe08869176e0158662750
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Security for resettabletimer 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.