Cleanup: replace %-formatting with str.format in tools/ & release/

This commit is contained in:
Campbell Barton
2024-04-27 16:06:53 +10:00
parent 5088b0154d
commit e5fb4ad03b
14 changed files with 98 additions and 94 deletions

View File

@@ -60,7 +60,7 @@ def sphobjinv_sanity_check(o):
if m:
fail_char = m.span(0)[1]
msg = "WARNING: invalid char found for name:"
print(msg, name, "(at index %d)" % fail_char, "skipping!")
print(msg, name, "(at index {:d})".format(fail_char), "skipping!")
print(" " * (len(msg) + fail_char), "^")
return False
@@ -76,19 +76,19 @@ def write_mappings(inv, output):
fw = file.write
year = datetime.date.today().year
fw("# SPDX-FileCopyrightText: 2019-%d Blender Authors\n" % year)
fw("# SPDX-FileCopyrightText: 2019-{:d} Blender Authors\n".format(year))
fw("#\n")
fw("# SPDX-License-Identifier: GPL-2.0-or-later\n")
fw("\n")
fw("# Do not edit this file.")
fw(" This file is auto generated from rna_manual_reference_updater.py\n\n")
fw("# Do not edit this file. This file is auto generated from:\n")
fw("# ./tools/utils_doc/rna_manual_reference_updater.py\n\n")
# Prevent systems with autopep8 configured from re-formatting the file.
fw("# autopep8: off\n")
fw(
"import bpy\n"
"\n"
"url_manual_prefix = \"https://docs.blender.org/manual/%s/%d.%d/\" % (\n"
"url_manual_prefix = \"https://docs.blender.org/manual/{:s}/{:d}.{:d}/\".format(\n"
" bpy.utils.manual_language_code(),\n"
" *bpy.app.version[:2],\n"
")\n"
@@ -117,7 +117,7 @@ def write_mappings(inv, output):
def is_valid_file(parser, arg):
if not os.path.isfile(arg):
parser.error("The file %s does not exist!" % arg)
parser.error("The file {:s} does not exist!".format(arg))
else:
return arg