From d202e9f6c27191057c310b8d37ef66c4b438b762 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Sat, 15 Nov 2025 10:54:05 -0500 Subject: [PATCH 1/2] fix: remove glob of home in image-loader --- pyproject.toml | 3 +++ src/diffpy/srxplanar/loadimage.py | 14 +++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 759efc0..0df8d91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,9 @@ template = "{tag}" dev_template = "{tag}" dirty_template = "{tag}" +[tool.setuptools] +package-dir = {"" = "src"} + [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["*"] # package names should match these glob patterns (["*"] by default) diff --git a/src/diffpy/srxplanar/loadimage.py b/src/diffpy/srxplanar/loadimage.py index 5a75d50..579a835 100644 --- a/src/diffpy/srxplanar/loadimage.py +++ b/src/diffpy/srxplanar/loadimage.py @@ -73,21 +73,13 @@ def load_image(self, filename): :param filename: str or Path, image file name or path :return: 2D ndarray, flipped image array """ - filename = Path( - filename - ).expanduser() # handle "~", make it a Path object - if filename.exists(): - filenamefull = filename - else: - found_files = list(Path.home().rglob(filename.name)) - filenamefull = found_files[0] if found_files else None - - if filenamefull is None or not filenamefull.exists(): + filenamefull = Path(filename).resolve() + + if not filenamefull.exists(): raise FileNotFoundError( f"Error: file not found: {filename}, " f"Please rerun specifying a valid filename." ) - return np.zeros((100, 100)) image = np.zeros((100, 100)) for _ in range(10): # retry 10 times (5 seconds total) From bebec81f3bfbb002a29ce107db65b734d3519c33 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Sat, 15 Nov 2025 10:57:50 -0500 Subject: [PATCH 2/2] news --- news/patch_glob.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/patch_glob.rst diff --git a/news/patch_glob.rst b/news/patch_glob.rst new file mode 100644 index 0000000..32f8f62 --- /dev/null +++ b/news/patch_glob.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* Removed glob of user home in load-image + +**Fixed:** + +* + +**Security:** + +*