A package that allows to cancel, certain functions that can be a pain, when working with threading.
Project description
Installation
pip install cancelable
Usage
Without the normal time package:
from cancelable import time
import threading
def count():
i = 1
while True:
time.sleep(1)
print(i)
i += 1
threading._start_new_thread(count, ())
input("Click enter to cancel counting\n")
time.cancel()
With the normal time package:
from cancelable import time as cancelableTime
import threading
def count():
i = 1
while True:
cancelableTime.sleep(1)
print(i)
i += 1
threading._start_new_thread(count, ())
input("Click enter to cancel counting\n")
cancelableTime.cancel()
To do
Add more functions such as input()
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
cancelable-0.0.3.tar.gz
(7.9 kB
view details)
Built Distribution
File details
Details for the file cancelable-0.0.3.tar.gz
.
File metadata
- Download URL: cancelable-0.0.3.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.0.1 keyring/23.0.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c252a7891a8b793951005fc9db4bba45fb619d950d08c38d8136da7395a6e68 |
|
MD5 | a57da685b01384cad44a691e2de13627 |
|
BLAKE2b-256 | 646bc5205c006345bfe7cecc125b9efd4e177d099b6625f1bd2c4db610fa50e7 |
File details
Details for the file cancelable-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: cancelable-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.0 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.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.0.1 keyring/23.0.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 078ba9f506f5ab448a4d9a802dd3a3825a1ae3e7105cf602ea2717393c741067 |
|
MD5 | 891514bea3cb79e0540d388be8969b97 |
|
BLAKE2b-256 | b8e726695a3ba657382387cce5ab06d3f30704f152520add488df396ba8116a1 |