From a7850fb51a3955cc0f3448841e02502f6f055347 Mon Sep 17 00:00:00 2001 From: yucongalicechen Date: Tue, 31 Dec 2024 10:56:06 -0500 Subject: [PATCH 1/3] fix: remove user_config.py --- src/diffpy/utils/user_config.py | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 src/diffpy/utils/user_config.py diff --git a/src/diffpy/utils/user_config.py b/src/diffpy/utils/user_config.py deleted file mode 100644 index ca2cc004..00000000 --- a/src/diffpy/utils/user_config.py +++ /dev/null @@ -1,30 +0,0 @@ -import json -from pathlib import Path - -CONFIG_FILE = "diffpyconfig.json" -CWD_CONFIG_PATH = Path.cwd() / CONFIG_FILE -HOME_CONFIG_PATH = Path.home() / CONFIG_FILE - - -def find_conf_file(): - if CWD_CONFIG_PATH.exists() and CWD_CONFIG_PATH.is_file(): - return CWD_CONFIG_PATH - elif HOME_CONFIG_PATH.exists() and HOME_CONFIG_PATH.is_file(): - return HOME_CONFIG_PATH - return None - - -def read_conf_file(): - conf_file = find_conf_file() - if conf_file: - with open(conf_file, "r") as f: - config = json.load(f) - if not config.get("username") or not config.get("email"): - raise ValueError("Please provide a configuration file with username and email.") - return config.get("username"), config.get("email") - return None, None - - -def write_conf_file(username, email): - with open(HOME_CONFIG_PATH, "w") as f: - json.dump({"username": username, "email": email}, f) From f870c2f8cfb624b16f3fa1396655e7bee273de1d Mon Sep 17 00:00:00 2001 From: yucongalicechen Date: Tue, 31 Dec 2024 10:59:05 -0500 Subject: [PATCH 2/3] add news --- news/remove-userconfig.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/remove-userconfig.rst diff --git a/news/remove-userconfig.rst b/news/remove-userconfig.rst new file mode 100644 index 00000000..0d8e047b --- /dev/null +++ b/news/remove-userconfig.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* `user_config.py` function. + +**Fixed:** + +* + +**Security:** + +* From 59c8ecb973b623921ee71252fc232cf552839ba6 Mon Sep 17 00:00:00 2001 From: yucongalicechen Date: Tue, 31 Dec 2024 11:24:41 -0500 Subject: [PATCH 3/3] docs: improve news --- news/remove-userconfig.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/remove-userconfig.rst b/news/remove-userconfig.rst index 0d8e047b..967d9559 100644 --- a/news/remove-userconfig.rst +++ b/news/remove-userconfig.rst @@ -12,7 +12,7 @@ **Removed:** -* `user_config.py` function. +* `user_config.py`. Replaced by `_load_config` and `check_and_build_global_config` in `tools.py`. **Fixed:**