diff options
author | Ian Henriksen <insertinterestingnamehere@gmail.com> | 2015-07-13 12:54:02 -0600 |
---|---|---|
committer | Ian Henriksen <insertinterestingnamehere@gmail.com> | 2015-07-13 12:54:50 -0600 |
commit | cd9a6a2ddfb0653601865794f3539210b94955ce (patch) | |
tree | 1e52a894fb26b88578177c218dbbada82ef44ef1 /numpy/testing/utils.py | |
parent | ddc53885e1b66b6e4e7d299d2c808ddc472913b9 (diff) | |
download | numpy-cd9a6a2ddfb0653601865794f3539210b94955ce.tar.gz |
BUG: Fixed import error on Windows from not correctly defining a
function listed in __all__ for numpy/testing/utils.py.
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r-- | numpy/testing/utils.py | 43 |
1 files changed, 23 insertions, 20 deletions
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): |