From 44d6534b5e2856c9fff9ab39df9cf4d4e357fb1a Mon Sep 17 00:00:00 2001 From: JJJHolscher Date: Wed, 13 Dec 2023 13:52:19 +0100 Subject: [PATCH] run_dir fn --- pyproject.toml | 2 +- src/root.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d3fb10c..9d57667 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "jo3util" -version = "0.0.10" +version = "0.0.13" description = "" dependencies = [] dynamic = ["readme"] diff --git a/src/root.py b/src/root.py index c82fa6a..04ffd40 100644 --- a/src/root.py +++ b/src/root.py @@ -81,12 +81,10 @@ def root_file(): raise NotImplementedError -def run_dir(obj, subdir=Path("run")): - run_id: str = json.dumps(obj, default=lambda x: vars(x)) +def run_dir(obj, root=Path(os.path.abspath("./run"))): + run_id: str = json.dumps( + obj, + default=lambda x: vars(x) if hasattr(x, "__dict__") else str(x) + ) run_id: str = hash_string(run_id) - - path = root_dir() - if subdir: - path /= subdir - path /= run_id - return path + return root / run_id