diff --git a/floris/type_dec.py b/floris/type_dec.py index 830f6c6ab..e2cec3ce6 100644 --- a/floris/type_dec.py +++ b/floris/type_dec.py @@ -85,8 +85,12 @@ 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`` - object. + """ + Converts an input string or ``pathlib.Path`` object to a fully resolved ``pathlib.Path`` + object. If the input is a string, it is converted to a pathlib.Path object. + The function then checks if the path exists as an absolute path, a relative path from + the script, or a relative path from the system location. If the path does not exist in + any of these locations, a FileExistsError is raised. Args: fn (str | Path): The user input file path or file name. @@ -113,11 +117,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" diff --git a/setup.py b/setup.py index 11ee8c385..a31e1e0f3 100644 --- a/setup.py +++ b/setup.py @@ -30,19 +30,19 @@ REQUIRED = [ # simulation "attrs", - "pyyaml", - "numexpr", - "numpy>=1.20", - "scipy>=1.1", + "pyyaml~=6.0", + "numexpr~=2.0", + "numpy~=1.20", + "scipy~=1.1", # tools - "matplotlib>=3", - "pandas", - "shapely", + "matplotlib~=3.0", + "pandas~=2.0", + "shapely~=2.0", # utilities - "coloredlogs>=10.0", - "flatten_dict", + "coloredlogs~=10.0", + "flatten_dict~=0.0", ] # What packages are optional?