diff options
| author | Astounds <kirito@disroot.org> | 2026-04-25 01:02:17 -0500 |
|---|---|---|
| committer | Astounds <kirito@disroot.org> | 2026-04-25 01:02:17 -0500 |
| commit | 50ad959a8051fec95f26b573f9fe067bdf3fdf6a (patch) | |
| tree | 4d94f63cf9adb951d4200b0f2bb0c762d45297c4 /settings.py | |
| parent | a0f315be51ef121618e73d5b450c8616c0d11d21 (diff) | |
| download | yt-local-50ad959a8051fec95f26b573f9fe067bdf3fdf6a.tar.lz yt-local-50ad959a8051fec95f26b573f9fe067bdf3fdf6a.tar.xz yt-local-50ad959a8051fec95f26b573f9fe067bdf3fdf6a.zip | |
refactor: replace string concatenations with f-strings
Diffstat (limited to 'settings.py')
| -rw-r--r-- | settings.py | 10 |
1 files changed, 5 insertions, 5 deletions
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) |
