Skip to main content

A package that allows to cancel, certain functions that can be a pain, when working with threading.

Project description

Installation

pip install cancelable-py

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cancelable-py-0.0.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cancelable_py-0.0.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file cancelable-py-0.0.2.tar.gz.

File metadata

  • Download URL: cancelable-py-0.0.2.tar.gz
  • Upload date:
  • Size: 7.8 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

Hashes for cancelable-py-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bc8ae492605f9696f0cb3a3485620cd03ee52511d65901dcf0db9d05d24d9b32
MD5 45521ca07cdfab4143f55189b9814188
BLAKE2b-256 88aa36bb9bd61bb5236a8c16c66b06a3d800607002c477a7971e7e7bb912c448

See more details on using hashes here.

File details

Details for the file cancelable_py-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: cancelable_py-0.0.2-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

Hashes for cancelable_py-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a75915c2bc5f98d470e58d951f9c99c46ba1d69ec1aba7bd21e740937e14d86e
MD5 ba4a98aed29e98636d1d158635c20503
BLAKE2b-256 a8f19496dba1c414e17845f0d14567ce260324d311322ddbcc13fb50ee1e38ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page