diff options
author | Pjotr Prins | 2024-04-01 07:24:46 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-09-12 07:40:02 -0500 |
commit | a9e73d2aa87d45e65cbaf9598ddcff278ba80ae5 (patch) | |
tree | 1ca21b73076c009c50896def40559f68c36a35e4 | |
parent | dd888f89e60a986e030ad3d6ebdf081f986e4201 (diff) | |
download | genenetwork3-a9e73d2aa87d45e65cbaf9598ddcff278ba80ae5.tar.gz |
Getting Rqtl to run on fallback
-rw-r--r-- | gn3/fs_helpers.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gn3/fs_helpers.py b/gn3/fs_helpers.py index 74e7ada..845c48b 100644 --- a/gn3/fs_helpers.py +++ b/gn3/fs_helpers.py @@ -13,14 +13,19 @@ from typing import List from typing import ValuesView from werkzeug.utils import secure_filename +def assert_path_exists(path: str, throw_error: bool = True) -> bool: + """Throw error if any of them do not exist.""" + if not os.path.isfile(path): + if throw_error: + raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path) + else: + return False + return True + def assert_paths_exist(paths: ValuesView, throw_error: bool = True) -> bool: """Given a list of PATHS, throw error if any of them do not exist.""" for path in paths: - if not os.path.isfile(path): - if throw_error: - raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path) - else: - return False + assert_path_exists(path,throw_error) return True def get_hash_of_files(files: List[str]) -> str: |