From ca2f96d75ea4d7faac13a01c056589d82fb2d060 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 25 Apr 2025 14:00:47 +0300 Subject: [PATCH] Allow nullish zip_path for convenience --- src/mflux/dreambooth/state/zip_util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mflux/dreambooth/state/zip_util.py b/src/mflux/dreambooth/state/zip_util.py index 9f5767a..4bca683 100644 --- a/src/mflux/dreambooth/state/zip_util.py +++ b/src/mflux/dreambooth/state/zip_util.py @@ -6,7 +6,9 @@ from zipfile import ZipFile class ZipUtil: @staticmethod - def unzip(zip_path: str | Path, filename: str, loader: callable): + def unzip(zip_path: str | Path | None, filename: str, loader: callable): + if not zip_path: # Would be nicer to do this in typing, but that's more effort on the callers' side + raise ValueError("zip_path cannot be None") zip_path = Path(zip_path) if not zip_path.exists(): raise FileNotFoundError(f"ZIP file not found at: {zip_path}")