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 Distribution
Built Distribution
Hashes for threaders-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9578d8730323a1e3de9ff3a40dca1fddaf7fb086f901b2906172eb994e52eadd |
|
MD5 | b5c6129474626f4d62f784fc0ee80998 |
|
BLAKE2b-256 | 1e07cde158c31218384366bab1e0aea1f56319c023dbeab260c0b8a9488f1850 |