Skip to content

Commit

Permalink
wip to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fschuch committed Mar 3, 2024
1 parent 25fe89d commit 3b04746
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions xcompact3d_toolbox/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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

0 comments on commit 3b04746

Please sign in to comment.