From 5e4d6d5c5755fbe057d101b62f95208a3afa4ade Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 25 Sep 2026 10:37:20 -0500 Subject: Initialise scripts for genotype uploads files' processing. --- scripts/cli/validators.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts/cli/validators.py') diff --git a/scripts/cli/validators.py b/scripts/cli/validators.py index 6d16e4c..dc198f5 100644 --- a/scripts/cli/validators.py +++ b/scripts/cli/validators.py @@ -2,6 +2,14 @@ from pathlib import Path +def file_exists(val: str) -> Path: + """Ensure the file path specified actually exists.""" + _file = Path(val) + if _file.exists() and _file.is_file(): + return _file + raise FileNotFoundError(f"Could not find the file '{_file}'.") + + def directory_exists(val: str) -> Path: """Check that directory path specified actually exists.""" _dir = Path(val).absolute() -- cgit 1.4.1