Cleanup: use str.format to format strings in Python
Also replace redundant `{!s}` with `{:s}`.
This commit is contained in:
@@ -435,7 +435,7 @@ def main():
|
||||
os.remove(Path_Blend)
|
||||
|
||||
# export dna to xhtml
|
||||
log.info("6: export sdna to xhtml file: %r" % Path_HTML)
|
||||
log.info("6: export sdna to xhtml file: {!r}".format(Path_HTML))
|
||||
handleHTML = open(Path_HTML, "w")
|
||||
catalog.WriteToHTML(handleHTML)
|
||||
handleHTML.close()
|
||||
|
||||
@@ -232,7 +232,7 @@ def update_internal_script(report, script):
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
report({'ERROR'}, "Cannot read OSO bytecode to store in node at %r" % oso_path)
|
||||
report({'ERROR'}, "Cannot read OSO bytecode to store in node at {!r}".format(oso_path))
|
||||
ok = False
|
||||
|
||||
return ok, oso_path, bytecode, bytecode_hash
|
||||
|
||||
@@ -1382,7 +1382,7 @@ def url_retrieve_to_data_iter(
|
||||
|
||||
if size >= 0 and read < size:
|
||||
raise ContentTooShortError(
|
||||
"retrieval incomplete: got only %i out of %i bytes" % (read, size),
|
||||
"retrieval incomplete: got only {:d} out of {:d} bytes".format(read, size),
|
||||
response_headers,
|
||||
)
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class BlendFileHeader:
|
||||
|
||||
bytes_0_6 = file.read(7)
|
||||
if bytes_0_6 != b'BLENDER':
|
||||
raise BlendHeaderError("invalid first bytes %r" % bytes_0_6)
|
||||
raise BlendHeaderError("invalid first bytes {!r}".format(bytes_0_6))
|
||||
self.magic = bytes_0_6
|
||||
|
||||
byte_7 = file.read(1)
|
||||
@@ -99,21 +99,21 @@ class BlendFileHeader:
|
||||
elif byte_7 == b'-':
|
||||
self.pointer_size = 8
|
||||
else:
|
||||
raise BlendHeaderError("invalid pointer size %r" % byte_7)
|
||||
raise BlendHeaderError("invalid pointer size {!r}".format(byte_7))
|
||||
byte_8 = file.read(1)
|
||||
if byte_8 == b'v':
|
||||
self.is_little_endian = True
|
||||
elif byte_8 == b'V':
|
||||
self.is_little_endian = False
|
||||
else:
|
||||
raise BlendHeaderError("invalid endian indicator %r" % byte_8)
|
||||
raise BlendHeaderError("invalid endian indicator {!r}".format(byte_8))
|
||||
bytes_9_11 = file.read(3)
|
||||
self.version = int(bytes_9_11)
|
||||
else:
|
||||
byte_8 = file.read(1)
|
||||
header_size = int(byte_7 + byte_8)
|
||||
if header_size != 17:
|
||||
raise BlendHeaderError("unknown file header size %d" % header_size)
|
||||
raise BlendHeaderError("unknown file header size {:d}".format(header_size))
|
||||
byte_9 = file.read(1)
|
||||
if byte_9 != b'-':
|
||||
raise BlendHeaderError("invalid file header")
|
||||
@@ -121,7 +121,7 @@ class BlendFileHeader:
|
||||
byte_10_11 = file.read(2)
|
||||
self.file_format_version = int(byte_10_11)
|
||||
if self.file_format_version != 1:
|
||||
raise BlendHeaderError("unsupported file format version %r" % self.file_format_version)
|
||||
raise BlendHeaderError("unsupported file format version {:d}".format(self.file_format_version))
|
||||
byte_12 = file.read(1)
|
||||
if byte_12 != b'v':
|
||||
raise BlendHeaderError("invalid file header")
|
||||
|
||||
@@ -28,15 +28,15 @@ def drivers_editor_footer(layout, context):
|
||||
return
|
||||
|
||||
layout.separator_spacer()
|
||||
layout.label(text="Driver: {!s} ({!s})".format(act_fcurve.id_data.name, act_fcurve.data_path))
|
||||
layout.label(text="Driver: {:s} ({:s})".format(act_fcurve.id_data.name, act_fcurve.data_path))
|
||||
|
||||
if act_driver.variables:
|
||||
layout.separator(type='LINE')
|
||||
layout.label(text="Variables: %i" % len(act_driver.variables))
|
||||
layout.label(text="Variables: {:d}".format(len(act_driver.variables)))
|
||||
|
||||
if act_driver.type == 'SCRIPTED' and act_driver.expression:
|
||||
layout.separator(type='LINE')
|
||||
layout.label(text="Expression: %s" % act_driver.expression)
|
||||
layout.label(text="Expression: {:s}".format(act_driver.expression))
|
||||
|
||||
|
||||
class GRAPH_HT_header(Header):
|
||||
|
||||
Reference in New Issue
Block a user