Skip to content

Commit e7720e9

Browse files
author
andrewtliew
committed
- Fixed a missing array import.
- Fix to XFunc for Python 3, to be verified.
1 parent c4d2b7c commit e7720e9

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/compas/hpc/geometry/basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from numba import int64
66
from numba import jit
77

8+
from numpy import array
89
from numpy import sqrt
910
from numpy import sum
1011
from numpy import zeros
@@ -577,8 +578,6 @@ def multiply_matrix_vector_numba(A, b):
577578

578579
if __name__ == "__main__":
579580

580-
from numpy import array
581-
582581
u = array([1., 2., 3.])
583582
v = array([4., 5., 6.])
584583
c = array([[1., 2., 3.], [1., 1., 1.]])
@@ -623,6 +622,7 @@ def multiply_matrix_vector_numba(A, b):
623622

624623
print(multiply_matrices_numba(e, f))
625624
print(multiply_matrix_vector_numba(e, d))
625+
626626
# print(vector_component_numba(u, v))
627627
# print(vector_component_xy_numba(u, v))
628628
# print(homogenise_vectors_numba(d,3))

src/compas/utilities/xfunc.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828
import sys
2929
import importlib
3030
31-
import json
32-
import cStringIO
31+
import json
32+
try:
33+
import cStringIO
34+
except:
35+
import io
3336
import cProfile
3437
import pstats
3538
import traceback
@@ -68,8 +71,11 @@
6871
r = f(*args, **kwargs)
6972
7073
profile.disable()
71-
72-
stream = cStringIO.StringIO()
74+
75+
try:
76+
stream = cStringIO.StringIO()
77+
except:
78+
stream = io.StringIO()
7379
stats = pstats.Stats(profile, stream=stream)
7480
stats.strip_dirs()
7581
stats.sort_stats(1)
@@ -120,7 +126,8 @@
120126
def test_xfunc(numiter=100, pause=0.1):
121127
for k in range(numiter):
122128
print(k)
123-
time.sleep(pause)
129+
time.sleep(pause)
130+
return 'test_xfunc_finished'
124131

125132

126133
def _xecute(funcname, basedir, tmpdir, delete_files, mode, callback, callback_args,

0 commit comments

Comments
 (0)