A small module to support automation of generating valid python variable names from external data.
Project description
threaders
threaders is a small module to help write
clean threaded code using threading decorators
and minimize repeating copy-paste actions.
Installing
Install and update using pip:
pip install -U threaders
A Simple Example:
from threaders import threaders
import time
@threaders.threader()
def function_to_be_threaded(x):
“”” :rtype: Thread “””
t = time.time()
time.sleep(0.5*(x+0.1)/5+0.05)
return time.time()-t
def main():
# create threads
threads = []
for i in range(10):
threads.append(function_to_be_threaded(i))
# get first result
print(threaders.get_first_result(threads))
# kill threads
t = time.time()
for thread in threads:
thread.join()
print(“all threads terminated: {}”.format(time.time()-t))
if __name__ == “__main__”:
main()
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 Distributions
Built Distribution
Hashes for threaders-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea167d6bc92c09fd229a91536fb02a830a1434ba58a70ef69050ec5ef862f8aa |
|
MD5 | 454585ab9881a4ba7e263229229c0d03 |
|
BLAKE2b-256 | 0af99b3c3500e355c6f4c2cfde61a70b3bdd06f06a679c1c41f473a4f00c0999 |