From 3b04746f77290ae1bd2a29a63b8fa09cfd6ec480 Mon Sep 17 00:00:00 2001 From: "Felipe N. Schuch" Date: Sun, 3 Mar 2024 16:37:55 -0300 Subject: [PATCH] wip to fix tests --- xcompact3d_toolbox/io.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/xcompact3d_toolbox/io.py b/xcompact3d_toolbox/io.py index 0373f24..dac3d69 100644 --- a/xcompact3d_toolbox/io.py +++ b/xcompact3d_toolbox/io.py @@ -1164,7 +1164,7 @@ def prm_to_dict(filename="incompact3d.prm"): line = line.split("#") # Get variable's name and value - param = line[1].strip() + parameter = line[1].strip() value = line[0].strip() try: @@ -1180,16 +1180,16 @@ def prm_to_dict(filename="incompact3d.prm"): else: # Int value = int(value) except TypeError: - warnings.warn(f"Can't convert {param} : {value}", stacklevel=1) + warnings.warn(f"Can't convert {parameter} : {value}", stacklevel=1) continue - if "(" in param and param[-1] == ")": # Param is a list - param = param.split("(")[0] - if param not in dict_outer: - dict_outer[param] = [] - dict_outer[param].append(value) + if "(" in parameter and parameter[-1] == ")": # Param is a list + parameter = parameter.split("(")[0] + if parameter not in dict_outer: + dict_outer[parameter] = [] + dict_outer[parameter].append(value) else: # Not a list - dict_outer[param] = value + dict_outer[parameter] = value return dict_outer @@ -1226,7 +1226,7 @@ def i3d_string_to_dict(string): continue # Get variable's name and value - param = line.partition("=")[0] + parameter = line.partition("=")[0] value = line.partition("=")[-1] try: @@ -1242,15 +1242,15 @@ def i3d_string_to_dict(string): else: # Int value = int(value) except TypeError: - warnings.warn(f"Can't convert {param} : {value}", stacklevel=1) + warnings.warn(f"Can't convert {parameter} : {value}", stacklevel=1) continue - if "(" in param and param[-1] == ")": # Param is a list - param = param.split("(")[0] - if param not in dict_inner: - dict_inner[param] = [] - dict_inner[param].append(value) + if "(" in parameter and parameter[-1] == ")": # Param is a list + parameter = parameter.split("(")[0] + if parameter not in dict_inner: + dict_inner[parameter] = [] + dict_inner[parameter].append(value) else: # Not a list - dict_inner[param] = value + dict_inner[parameter] = value return dict_outer