From 4bd33d4e90f212d01f80879ff30f4ece6142fba1 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Tue, 27 Feb 2024 20:12:03 -0800 Subject: [PATCH] ulwgl_util: don't parse config twice - The root configuration file has already been read and abstracted as a Dictionary in the previous context, so just pass the reference --- ULWGL/ulwgl_util.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ULWGL/ulwgl_util.py b/ULWGL/ulwgl_util.py index 68905e54..5cbdb5e6 100644 --- a/ULWGL/ulwgl_util.py +++ b/ULWGL/ulwgl_util.py @@ -68,13 +68,9 @@ def force_rename(src: Path, dst: Path): # noqa: D103 src.rename(dst) -def setup_runtime(root: Path) -> None: # noqa: D103 - # Open the JSON file and load its content into a Python dictionary - with root.joinpath(CONFIG).open(mode="r") as file: - data = load(file) - +def setup_runtime(root: Path, json: Dict[str, Any]) -> None: # noqa: D103 # Access the 'runtime_platform' value - runtime_platform_value: str = data["ulwgl"]["versions"]["runtime_platform"] + runtime_platform_value: str = json["ulwgl"]["versions"]["runtime_platform"] # Assuming runtime_platform_value is "sniper_platform_0.20240125.75305" # Split the string at 'sniper_platform_' @@ -232,7 +228,7 @@ def _install_ulwgl( cp(root.joinpath("reaper"), local.joinpath("reaper")) # Runtime platform - setup_runtime(root) + setup_runtime(root, json) # Launcher files for file in root.glob("*.py"):