Run pyupgrade against the changes from the merge-forward

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-10-22 13:00:52 +01:00
parent 6d17f6e8ca
commit d52647d98b
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF
2 changed files with 8 additions and 8 deletions

View file

@ -69,7 +69,7 @@ def sync(
ret = []
remote = set()
source = salt.utils.url.create("_" + form)
mod_dir = os.path.join(opts["extension_modules"], "{}".format(form))
mod_dir = os.path.join(opts["extension_modules"], f"{form}")
touched = False
with salt.utils.files.set_umask(0o077):
try:
@ -100,7 +100,7 @@ def sync(
)
)
local_cache_dir = os.path.join(
opts["cachedir"], "files", sub_env, "_{}".format(form)
opts["cachedir"], "files", sub_env, f"_{form}"
)
log.debug("Local cache dir: '%s'", local_cache_dir)
for fn_ in cache:
@ -129,13 +129,13 @@ def sync(
if src_digest != dst_digest:
# The downloaded file differs, replace!
shutil.copyfile(fn_, dest)
ret.append("{}.{}".format(form, relname))
ret.append(f"{form}.{relname}")
else:
dest_dir = os.path.dirname(dest)
if not os.path.isdir(dest_dir):
os.makedirs(dest_dir)
shutil.copyfile(fn_, dest)
ret.append("{}.{}".format(form, relname))
ret.append(f"{form}.{relname}")
touched = bool(ret)
if opts["clean_dynamic_modules"] is True:

View file

@ -40,7 +40,7 @@ def test_fib_txt_output(salt_call_cli):
@pytest.mark.parametrize("indent", [-1, 0, 1])
def test_json_out_indent(salt_call_cli, indent):
ret = salt_call_cli.run("--out=json", "--out-indent={}".format(indent), "test.ping")
ret = salt_call_cli.run("--out=json", f"--out-indent={indent}", "test.ping")
assert ret.returncode == 0
assert ret.data is True
if indent == -1:
@ -164,7 +164,7 @@ def test_issue_14979_output_file_permissions(salt_call_cli):
try:
stat1 = output_file.stat()
except OSError:
pytest.fail("Failed to generate output file {}".format(output_file))
pytest.fail(f"Failed to generate output file {output_file}")
# Let's change umask
os.umask(0o777) # pylint: disable=blacklisted-function
@ -187,7 +187,7 @@ def test_issue_14979_output_file_permissions(salt_call_cli):
try:
stat3 = output_file.stat()
except OSError:
pytest.fail("Failed to generate output file {}".format(output_file))
pytest.fail(f"Failed to generate output file {output_file}")
# Mode must have changed since we're creating a new log file
assert stat1.st_mode != stat3.st_mode
@ -290,7 +290,7 @@ def test_syslog_file_not_found(salt_minion, salt_call_cli, tmp_path):
with salt.utils.files.fopen(str(config_dir / "minion"), "w") as fh_:
fh_.write(salt.utils.yaml.dump(minion_config, default_flow_style=False))
ret = salt_call_cli.run(
"--config-dir={}".format(config_dir),
f"--config-dir={config_dir}",
"--log-level=debug",
"cmd.run",
"echo foo",