Skip to content

Commit

Permalink
Updated config maker to accept strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Irreq committed Sep 29, 2023
1 parent 9a64fc2 commit 59bbbdb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/config_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,18 @@ def write(self, json_data):
with open(self.file, "w+") as config:
config.write(self.header())
for key, value in json_data.items():
if isinstance(value, str):
if value[0] == "'":
output = f'"{value[1:-1]}"'
config.write(self.data(key, output))
continue
if self.is_expression(value):
try:
output = eval(eval_expression(value, json_data))

except NameError:
output = f'"{value}"'

else:
output = json.dumps(value)

Expand Down

0 comments on commit 59bbbdb

Please sign in to comment.