From 8c2cf22919c07541ceacf69909c2d91f6045a374 Mon Sep 17 00:00:00 2001 From: RHammond2 <13874373+RHammond2@users.noreply.github.com> Date: Fri, 1 Dec 2023 09:09:23 -0800 Subject: [PATCH] udpate to be inclusive of file checking --- floris/type_dec.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/floris/type_dec.py b/floris/type_dec.py index 830f6c6ab..07359c140 100644 --- a/floris/type_dec.py +++ b/floris/type_dec.py @@ -85,7 +85,7 @@ def iter_validator(iter_type, item_types: Union[Any, Tuple[Any]]) -> Callable: return validator def convert_to_path(fn: str | Path) -> Path: - """Converts an input string or pathlib.Path object to a fully resolved ``pathlib.Path`` + """Converts an input string or ``pathlib.Path`` object to a fully resolved ``pathlib.Path`` object. Args: @@ -113,11 +113,11 @@ def convert_to_path(fn: str | Path) -> Path: absolute_fn = fn.resolve() relative_fn_script = (base_fn_script / fn).resolve() relative_fn_sys = (base_fn_sys / fn).resolve() - if absolute_fn.is_dir(): + if absolute_fn.exists(): return absolute_fn - if relative_fn_script.is_dir(): + if relative_fn_script.exists(): return relative_fn_script - if relative_fn_sys.is_dir(): + if relative_fn_sys.exists(): return relative_fn_sys raise FileExistsError( f"{fn} could not be found as either a\n"