From 88662ddabdfd50ba5c931bfda1b3b769ed5c44ee Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Mon, 31 Mar 2025 19:38:07 +0000 Subject: [PATCH] allow uuid keyword in toml file --- corrlib/toml.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/corrlib/toml.py b/corrlib/toml.py index 94d12e7..007c8e1 100644 --- a/corrlib/toml.py +++ b/corrlib/toml.py @@ -11,7 +11,7 @@ the import of projects via TOML. import tomllib as toml import shutil from .input import sfcf -from .main import import_project +from .main import import_project, update_aliases from .meas_io import write_measurement import datalad.api as dl import os @@ -58,7 +58,15 @@ def import_toml(path: str, file: str, copy_file: bool=True) -> None: project: dict = toml_dict['project'] measurements: dict = toml_dict['measurements'] check_measurement_data(measurements) - uuid = import_project(path, project['url'], aliases = project.get('aliases', None)) + aliases = project.get('aliases', None) + uuid = project.get('uuid', None) + if uuid is not None: + if not os.path.exists(path + "/projects/" + uuid): + uuid = import_project(path, project['url'], aliases=aliases) + else: + update_aliases(path, uuid, aliases) + else: + uuid = import_project(path, project['url'], aliases=aliases) for mname, md in measurements.items(): print("Import measurement: " + mname) ensemble = md['ensemble']