From f2bfd4cea2e9d17bbe07da3fc8d4ba2b3667c1ef Mon Sep 17 00:00:00 2001 From: Ali Date: Mon, 9 Dec 2024 14:17:13 +0100 Subject: [PATCH 1/3] refactor AIIDA_CONFIG_FOLDER --- src/aiida_workgraph/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aiida_workgraph/config.py b/src/aiida_workgraph/config.py index ab316c38..335a9ec7 100644 --- a/src/aiida_workgraph/config.py +++ b/src/aiida_workgraph/config.py @@ -1,5 +1,5 @@ import json -from aiida.manage.configuration.settings import AIIDA_CONFIG_FOLDER +from aiida.manage.configuration.settings import AiiDAConfigDir WORKGRAPH_EXTRA_KEY = "_workgraph" WORKGRAPH_SHORT_EXTRA_KEY = "_workgraph_short" @@ -11,7 +11,7 @@ def load_config() -> dict: """Load the configuration from the config file.""" - config_file_path = AIIDA_CONFIG_FOLDER / "workgraph.json" + config_file_path = AiiDAConfigDir.get() / "workgraph.json" try: with config_file_path.open("r") as f: config = json.load(f) From ffb4f399d8f9ed8cbec48ef4f6880a5e4675956c Mon Sep 17 00:00:00 2001 From: Ali Date: Tue, 10 Dec 2024 14:22:03 +0100 Subject: [PATCH 2/3] apply code review --- src/aiida_workgraph/config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/aiida_workgraph/config.py b/src/aiida_workgraph/config.py index 335a9ec7..e2a0a0de 100644 --- a/src/aiida_workgraph/config.py +++ b/src/aiida_workgraph/config.py @@ -1,5 +1,5 @@ import json -from aiida.manage.configuration.settings import AiiDAConfigDir +from aiida.manage import get_config WORKGRAPH_EXTRA_KEY = "_workgraph" WORKGRAPH_SHORT_EXTRA_KEY = "_workgraph_short" @@ -11,7 +11,8 @@ def load_config() -> dict: """Load the configuration from the config file.""" - config_file_path = AiiDAConfigDir.get() / "workgraph.json" + config = get_config() + config_file_path = config.dirpath / "workgraph.json" try: with config_file_path.open("r") as f: config = json.load(f) From 6cbb478d6f7b457bc4dcd6c16118716c013dff5e Mon Sep 17 00:00:00 2001 From: Ali Date: Tue, 10 Dec 2024 15:04:37 +0100 Subject: [PATCH 3/3] apply code review --- src/aiida_workgraph/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aiida_workgraph/config.py b/src/aiida_workgraph/config.py index e2a0a0de..4fce3c41 100644 --- a/src/aiida_workgraph/config.py +++ b/src/aiida_workgraph/config.py @@ -1,5 +1,6 @@ import json from aiida.manage import get_config +from pathlib import Path WORKGRAPH_EXTRA_KEY = "_workgraph" WORKGRAPH_SHORT_EXTRA_KEY = "_workgraph_short" @@ -12,7 +13,7 @@ def load_config() -> dict: """Load the configuration from the config file.""" config = get_config() - config_file_path = config.dirpath / "workgraph.json" + config_file_path = Path(config.dirpath) / "workgraph.json" try: with config_file_path.open("r") as f: config = json.load(f)