Threaded Proxy Object
Project description
Threaded Proxy Object
pip install threadproxyobject
Tested against Windows 10 / Python 3.11 / Anaconda
import pandas as pd
import random
from time import sleep
from threadedproxyobject import ThreadedProxyObject, ThreadedProxyObjectMultiExecute
def funct(x, y):
return random.randint(x, y)
def funct2(x, y):
return [x + y]
def funct3(x, y):
while True:
print(random.randint(x, y))
sleep(1)
test = ThreadedProxyObject(funct, args=(1, 200))
test.start()
print(test)
sleep(1)
print((test) ** 10)
test2 = ThreadedProxyObject(funct2, args=(1, 200))
test2.start()
print((test2))
sleep(1)
test2.append(3)
print(test2)
test3 = ThreadedProxyObjectMultiExecute(fu=funct, args=(1, 200))
test3()
print((test3))
sleep(1)
print(test3 / 10)
test4 = ThreadedProxyObjectMultiExecute(fu=funct2, args=(1, 200))
test4()
sleep(1)
print(test4 * 10)
test5 = ThreadedProxyObjectMultiExecute(fu=funct3, args=(1, 200))
test5()
print((test5))
test5.kill()
test6 = ThreadedProxyObjectMultiExecute(fu=funct, daemon=False, args=(1, 200))
test6.start_timer_call(3)
sleep(4)
print((test6))
print(test6 + 10)
test6.stop_timer_call()
liste = [
ThreadedProxyObjectMultiExecute(
fu=funct, daemon=True, args=(1, 200)
).start_timer_call(3)
for x in range(100)
]
sleep(2)
df = pd.DataFrame(liste)
print(df[0] * 2)
# 45
# 34050628916015625
# [201]
# [201, 3]
# 129
# 12.9
# [201, 201, 201, 201, 201, 201, 201, 201, 201, 201]
# 141
# N/A
# 151
# 161
# 0 128
# 1 314
# 2 220
# 3 102
# 4 220
# ...
# 95 72
# 96 314
# 97 24
# 98 144
# 99 24
# Name: 0, Length: 100, dtype: object
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
Close
Hashes for threadedproxyobject-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f9f246339fc0679eea41796933b7a61cd40b2cb2f6f81a734c575aa6420cd89 |
|
MD5 | 816cbf1a4d71057a15ae840de7154629 |
|
BLAKE2b-256 | 8bb7ff599ca4014b002edee4786c0022c215c33cb2051a29493bb942d8516f97 |