From 27f5e33b2a3018ea3a45b72a8233de6f3afba42b Mon Sep 17 00:00:00 2001 From: Izzard <ri0005@orca.eps.surrey.ac.uk> Date: Tue, 30 Nov 2021 15:03:52 +0000 Subject: [PATCH] still issues with the decorators... --- binarycpython/utils/dataIO.py | 21 ++++++++++++++++----- binarycpython/utils/spacing_functions.py | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/binarycpython/utils/dataIO.py b/binarycpython/utils/dataIO.py index e63b29996..71918813a 100644 --- a/binarycpython/utils/dataIO.py +++ b/binarycpython/utils/dataIO.py @@ -12,6 +12,7 @@ import json import msgpack import os import pathlib +import subprocess import time from typing import Union, Any @@ -734,9 +735,19 @@ class dataIO(): def NFSpath(self,path): """ Test path to see if it's on an NFS mount. - """ - if os.path.exists(path) and os.path.ismount(path): - s = os.stat(path) - print(s) - # use `stat -f -L -c %T "$_[0]"`=~/^nfs/io ? 1 : 0; + Args: + path : the path to be tested + + Returns: + True : if on an NFS mount point. + False : if not. + None : if the path does not exist. + """ + if os.path.exists(path): + cmd = 'stat -f -L -c %T "' + path + '"' + return 'nfs' in subprocess.Popen(cmd, + shell=True, + stdout=subprocess.PIPE).stdout.read().decode() + else: + return None diff --git a/binarycpython/utils/spacing_functions.py b/binarycpython/utils/spacing_functions.py index 14cab7627..7b44078d7 100644 --- a/binarycpython/utils/spacing_functions.py +++ b/binarycpython/utils/spacing_functions.py @@ -339,7 +339,7 @@ class spacing_functions(): else: __decorator = __dummy_decorator - @__decorator() + @__decorator def _const_dt(cachedir=None, num_cores=None, bse_options_json=None, # JSON string -- GitLab