Run pyupgrade against the files modified in the merge-forward

This commit is contained in:
Pedro Algarvio 2024-02-16 07:22:49 +00:00
parent 94b6f4cc78
commit 76a86f765d
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF
3 changed files with 7 additions and 11 deletions

View file

@ -39,7 +39,7 @@ def digest(instr, checksum="md5"):
if hash_func is None:
raise salt.exceptions.CommandExecutionError(
"Hash func '{}' is not supported.".format(checksum)
f"Hash func '{checksum}' is not supported."
)
return hash_func(instr)
@ -63,9 +63,7 @@ def digest_file(infile, checksum="md5"):
salt '*' hashutil.digest_file /path/to/file
"""
if not __salt__["file.file_exists"](infile):
raise salt.exceptions.CommandExecutionError(
"File path '{}' not found.".format(infile)
)
raise salt.exceptions.CommandExecutionError(f"File path '{infile}' not found.")
with salt.utils.files.fopen(infile, "rb") as f:
file_hash = __salt__["hashutil.digest"](f.read(), checksum)

View file

@ -111,9 +111,7 @@ def decrypt(
rend_func = renderers.get(rend)
if rend_func is None:
raise SaltInvocationError(
"Decryption renderer '{}' is not available".format(rend)
)
raise SaltInvocationError(f"Decryption renderer '{rend}' is not available")
return rend_func(data, translate_newlines=translate_newlines)
@ -159,7 +157,7 @@ def pem_finger(path=None, key=None, sum_type="sha256"):
for ind, _ in enumerate(pre):
if ind % 2:
# Is odd
finger += "{}:".format(pre[ind])
finger += f"{pre[ind]}:"
else:
finger += pre[ind]
return finger.rstrip(":")

View file

@ -42,7 +42,7 @@ def die(func):
name = func.__name__[5:]
def _die():
salt.utils.process.appendproctitle("test_{}".format(name))
salt.utils.process.appendproctitle(f"test_{name}")
attrname = "die_" + name
setattr(self, attrname, _die)
@ -62,7 +62,7 @@ def incr(func):
name = func.__name__[5:]
def _incr(counter, num):
salt.utils.process.appendproctitle("test_{}".format(name))
salt.utils.process.appendproctitle(f"test_{name}")
for _ in range(0, num):
counter.value += 1
@ -84,7 +84,7 @@ def spin(func):
name = func.__name__[5:]
def _spin():
salt.utils.process.appendproctitle("test_{}".format(name))
salt.utils.process.appendproctitle(f"test_{name}")
while True:
time.sleep(1)