Cleanup: use str.format to format strings in Python
This commit is contained in:
@@ -283,7 +283,7 @@ class BoundingBox:
|
||||
self.corners = (minimum, maximum)
|
||||
|
||||
def __repr__(self):
|
||||
return "BoundingBox(%r, %r)" % (self.minimum, self.maximum)
|
||||
return "BoundingBox({!r}, {!r})".format(self.minimum, self.maximum)
|
||||
|
||||
@classmethod
|
||||
def from_sequence(cls, sequence):
|
||||
|
||||
@@ -696,7 +696,7 @@ def dump_py_messages_from_files(msgs, reports, files, settings):
|
||||
for node in ast.walk(root_node):
|
||||
if type(node) == ast.Call:
|
||||
# ~ print("found function at")
|
||||
# ~ print("%s:%d" % (fp, node.lineno))
|
||||
# ~ print("{:s}:{:d}".format(fp, node.lineno))
|
||||
|
||||
# We can't skip such situations! from blah import foo\nfoo("bar") would also be an ast.Name func!
|
||||
if type(node.func) == ast.Name:
|
||||
|
||||
@@ -75,10 +75,11 @@ def locale_explode(locale):
|
||||
m = _locale_explode_re.match(locale)
|
||||
if m:
|
||||
lang, country, variant = m.groups()
|
||||
return (lang, country, variant,
|
||||
"%s_%s" % (lang, country) if country else None,
|
||||
"%s@%s" % (lang, variant) if variant else None)
|
||||
|
||||
return (
|
||||
lang, country, variant,
|
||||
"{:s}_{:s}".format(lang, country) if country else None,
|
||||
"{:s}@{:s}".format(lang, variant) if variant else None
|
||||
)
|
||||
try:
|
||||
import bpy.app.translations as bpy_translations
|
||||
assert ret == bpy_translations.locale_explode(locale)
|
||||
|
||||
@@ -71,7 +71,7 @@ def language_menu(args, settings):
|
||||
continue
|
||||
for po_path in os.listdir(po_dir):
|
||||
uid = po_to_uid.get(po_path, None)
|
||||
# print("Checking %s, found uid %s" % (po_path, uid))
|
||||
# print("Checking {:s}, found uid {:s}".format(po_path, uid))
|
||||
po_path = os.path.join(po_dir, po_path)
|
||||
if uid is not None:
|
||||
po = utils_i18n.I18nMessages(uid=uid, kind='PO', src=po_path, settings=settings)
|
||||
|
||||
@@ -475,7 +475,7 @@ class NODE_OT_viewer_shortcut_set(Operator):
|
||||
nodes.active = old_active
|
||||
|
||||
viewer_node.ui_shortcut = self.viewer_index
|
||||
self.report({'INFO'}, "Assigned shortcut %i to %s" % (self.viewer_index, viewer_node.name))
|
||||
self.report({'INFO'}, "Assigned shortcut {:d} to {:s}".format(self.viewer_index, viewer_node.name))
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -510,7 +510,7 @@ class NODE_OT_viewer_shortcut_get(Operator):
|
||||
viewer_node = n
|
||||
|
||||
if not viewer_node:
|
||||
self.report({'INFO'}, "Shortcut %i is not assigned to a Viewer node yet" % self.viewer_index)
|
||||
self.report({'INFO'}, "Shortcut {:d} is not assigned to a Viewer node yet".format(self.viewer_index))
|
||||
return {'CANCELLED'}
|
||||
|
||||
# Use the node active status to enable this viewer node and disable others.
|
||||
|
||||
Reference in New Issue
Block a user