From 50ad959a8051fec95f26b573f9fe067bdf3fdf6a Mon Sep 17 00:00:00 2001 From: Astounds Date: Sat, 25 Apr 2026 01:02:17 -0500 Subject: refactor: replace string concatenations with f-strings --- settings.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'settings.py') diff --git a/settings.py b/settings.py index 3fd96ac..677a33a 100644 --- a/settings.py +++ b/settings.py @@ -397,14 +397,14 @@ acceptable_targets = SETTINGS_INFO.keys() | { def comment_string(comment): result = '' for line in comment.splitlines(): - result += '# ' + line + '\n' + result += f'# {line}\n' return result def save_settings(settings_dict): with open(settings_file_path, 'w', encoding='utf-8') as file: for setting_name, setting_info in SETTINGS_INFO.items(): - file.write(comment_string(setting_info['comment']) + setting_name + ' = ' + repr(settings_dict[setting_name]) + '\n\n') + file.write(f"{comment_string(setting_info['comment'])}{setting_name} = {repr(settings_dict[setting_name])}\n\n") def add_missing_settings(settings_dict): @@ -481,7 +481,7 @@ upgrade_functions = { def log_ignored_line(line_number, message): - print('WARNING: Ignoring settings.txt line ' + str(line_number) + ' (' + message + ')') + print(f'WARNING: Ignoring settings.txt line {line_number} ({message})') if os.path.isfile("settings.txt"): @@ -535,7 +535,7 @@ else: continue if target.id not in acceptable_targets: - log_ignored_line(node.lineno, target.id + " is not a valid setting") + log_ignored_line(node.lineno, f"{target.id} is not a valid setting") continue if type(node.value) not in attributes: @@ -645,6 +645,6 @@ def settings_page(): for func, old_value, value in to_call: func(old_value, value) - return flask.redirect(util.URL_ORIGIN + '/settings', 303) + return flask.redirect(f'{util.URL_ORIGIN}/settings', 303) else: flask.abort(400) -- cgit v1.2.3