-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
52 lines (29 loc) · 772 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import time
import traceback
import cv2
from build.module_name import *
from concurrent.futures import ThreadPoolExecutor
def call_and_print_exc(fn):
try:
fn()
except Exception:
traceback.print_exc()
print(PySomeClass)
m = some_class_factory(10)
m2 = PySomeClass(10)
print(m, m2)
print(m.multiply(20))
# print(m.multiply("20"))
arr = m.multiply_list([0.0, 1.0, 2.0, 3.0])
print(arr)
print(m.multiply_two(50, 200))
print(m.image)
print(m.image.shape)
cv2.imwrite("/tmp/test.png", m.image)
print(m.multiplier)
m.multiplier = 100
print(m.multiplier)
start = time.time()
with ThreadPoolExecutor(4) as ex:
ex.map(lambda x: m.function_that_takes_a_while(), [None] * 4)
print(f"Threaded fun took {time.time() - start} seconds")