refactor: replace percent formatting with format specifiers

This commit is contained in:
Mark Paronyan 2026-09-30 20:45:44 +03:00
parent 06899c92fc
commit 95ada23395
No known key found for this signature in database
GPG Key ID: 8DC7338A87FE22F8
5 changed files with 6 additions and 6 deletions

View File

@ -277,7 +277,7 @@ class DockerVM(BaseNode):
if not mac_address:
# use the node UUID to generate a random MAC address
self._mac_address = "02:42:%s:%s:%s:00" % (self.id[2:4], self.id[4:6], self.id[6:8])
self._mac_address = "02:42:{}:{}:{}:00".format(self.id[2:4], self.id[4:6], self.id[6:8])
else:
self._mac_address = mac_address

View File

@ -52,4 +52,4 @@ def unpack_zip(filename, extract_dir=None):
for fname, date_time in reversed(dirs):
os.utime(fname, (date_time, date_time))
except zipfile.BadZipFile:
raise shutil.ReadError("%s is not a zip file" % filename)
raise shutil.ReadError("{} is not a zip file".format(filename))

View File

@ -59,10 +59,10 @@ class GUID(TypeDecorator):
return str(value)
else:
if not isinstance(value, uuid.UUID):
return "%.32x" % uuid.UUID(value).int
return "{:032x}".format(uuid.UUID(value).int)
else:
# hexstring
return "%.32x" % value.int
return "{:032x}".format(value.int)
def process_result_value(self, value, dialect):
if value is None:

View File

@ -50,7 +50,7 @@ def int_to_macaddress(integer):
"""
Convert an integer to a mac address
"""
return ":".join(textwrap.wrap("%012x" % (integer), width=2))
return ":".join(textwrap.wrap("{:012x}".format(integer), width=2))
def parse_version(version):

View File

@ -183,7 +183,7 @@ class ZipFile(zipfile.ZipFile):
"""
if not isinstance(comment, bytes):
raise TypeError("comment: expected bytes, got %s" % type(comment))
raise TypeError("comment: expected bytes, got {}".format(type(comment)))
# check for valid comment length
if len(comment) >= zipfile.ZIP_MAX_COMMENT:
if self.debug: