From cd9a6a2ddfb0653601865794f3539210b94955ce Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Mon, 13 Jul 2015 12:54:02 -0600 Subject: BUG: Fixed import error on Windows from not correctly defining a function listed in __all__ for numpy/testing/utils.py. --- numpy/testing/utils.py | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'numpy/testing/utils.py') diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index 75d974b18..aff37c250 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -153,6 +153,29 @@ if os.name == 'nt': processName, instance, win32pdh.PDH_FMT_LONG, None) elif sys.platform[:5] == 'linux': + + def memusage(_proc_pid_stat='/proc/%s/stat' % (os.getpid())): + """ + Return virtual memory size in bytes of the running python. + + """ + try: + f = open(_proc_pid_stat, 'r') + l = f.readline().split(' ') + f.close() + return int(l[22]) + except: + return +else: + def memusage(): + """ + Return memory usage of running python. [Not implemented] + + """ + raise NotImplementedError + + +if sys.platform[:5] == 'linux': def jiffies(_proc_pid_stat='/proc/%s/stat' % (os.getpid()), _load_time=[]): """ @@ -172,19 +195,6 @@ elif sys.platform[:5] == 'linux': return int(l[13]) except: return int(100*(time.time()-_load_time[0])) - - def memusage(_proc_pid_stat='/proc/%s/stat' % (os.getpid())): - """ - Return virtual memory size in bytes of the running python. - - """ - try: - f = open(_proc_pid_stat, 'r') - l = f.readline().split(' ') - f.close() - return int(l[22]) - except: - return else: # os.getpid is not in all platforms available. # Using time is safe but inaccurate, especially when process @@ -202,13 +212,6 @@ else: _load_time.append(time.time()) return int(100*(time.time()-_load_time[0])) - def memusage(): - """ - Return memory usage of running python. [Not implemented] - - """ - raise NotImplementedError - def build_err_msg(arrays, err_msg, header='Items are not equal:', verbose=True, names=('ACTUAL', 'DESIRED'), precision=8): -- cgit v1.2.1