From e466b9bb5387a83cdd54a177cc49fcc9a85f1210 Mon Sep 17 00:00:00 2001 From: Teal Dulcet Date: Sat, 23 Dec 2023 05:20:45 -0800 Subject: [PATCH] Fixed RUF005 (collection-literal-concatenation) --- management/backup.py | 20 ++++++++++---------- management/status_checks.py | 2 +- management/web_update.py | 2 +- tests/fail2ban.py | 2 +- tests/tls.py | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/management/backup.py b/management/backup.py index 183ff607..55320049 100755 --- a/management/backup.py +++ b/management/backup.py @@ -59,7 +59,7 @@ def backup_status(env): "--archive-dir", backup_cache_dir, "--gpg-options", "'--cipher-algo=AES256'", "--log-fd", "1", - ] + get_duplicity_additional_args(env) + [ + *get_duplicity_additional_args(env), get_duplicity_target_url(config) ], get_duplicity_env_vars(env), @@ -322,8 +322,8 @@ def perform_backup(full_backup): "--exclude", backup_root, "--volsize", "250", "--gpg-options", "'--cipher-algo=AES256'", - "--allow-source-mismatch" - ] + get_duplicity_additional_args(env) + [ + "--allow-source-mismatch", + *get_duplicity_additional_args(env), env["STORAGE_ROOT"], get_duplicity_target_url(config), ], @@ -344,7 +344,7 @@ def perform_backup(full_backup): "--verbosity", "error", "--archive-dir", backup_cache_dir, "--force", - ] + get_duplicity_additional_args(env) + [ + *get_duplicity_additional_args(env), get_duplicity_target_url(config) ], get_duplicity_env_vars(env)) @@ -360,7 +360,7 @@ def perform_backup(full_backup): "--verbosity", "error", "--archive-dir", backup_cache_dir, "--force", - ] + get_duplicity_additional_args(env) + [ + *get_duplicity_additional_args(env), get_duplicity_target_url(config) ], get_duplicity_env_vars(env)) @@ -399,7 +399,7 @@ def run_duplicity_verification(): "--compare-data", "--archive-dir", backup_cache_dir, "--exclude", backup_root, - ] + get_duplicity_additional_args(env) + [ + *get_duplicity_additional_args(env), get_duplicity_target_url(config), env["STORAGE_ROOT"], ], get_duplicity_env_vars(env)) @@ -412,9 +412,9 @@ def run_duplicity_restore(args): "/usr/bin/duplicity", "restore", "--archive-dir", backup_cache_dir, - ] + get_duplicity_additional_args(env) + [ - get_duplicity_target_url(config) - ] + args, + *get_duplicity_additional_args(env), + get_duplicity_target_url(config), + *args], get_duplicity_env_vars(env)) def print_duplicity_command(): @@ -426,7 +426,7 @@ def print_duplicity_command(): print(f"export {k}={shlex.quote(v)}") print("duplicity", "{command}", shlex.join([ "--archive-dir", backup_cache_dir, - ] + get_duplicity_additional_args(env) + [ + *get_duplicity_additional_args(env), get_duplicity_target_url(config) ])) diff --git a/management/status_checks.py b/management/status_checks.py index fa27396d..831a7510 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -518,7 +518,7 @@ def check_dns_zone(domain, env, output, dns_zonefiles): secondary_ns = custom_secondary_ns or ["ns2." + env['PRIMARY_HOSTNAME']] existing_ns = query_dns(domain, "NS") - correct_ns = "; ".join(sorted(["ns1." + env['PRIMARY_HOSTNAME']] + secondary_ns)) + correct_ns = "; ".join(sorted(["ns1." + env["PRIMARY_HOSTNAME"], *secondary_ns])) ip = query_dns(domain, "A") probably_external_dns = False diff --git a/management/web_update.py b/management/web_update.py index 722c8883..a0f0f799 100644 --- a/management/web_update.py +++ b/management/web_update.py @@ -215,7 +215,7 @@ def make_domain_config(domain, templates, ssl_certificates, env): # Combine the pieces. Iteratively place each template into the "# ADDITIONAL DIRECTIVES HERE" placeholder # of the previous template. nginx_conf = "# ADDITIONAL DIRECTIVES HERE\n" - for t in templates + [nginx_conf_extra]: + for t in [*templates, nginx_conf_extra]: nginx_conf = re.sub("[ \t]*# ADDITIONAL DIRECTIVES HERE *\n", t, nginx_conf) # Replace substitution strings in the template & return. diff --git a/tests/fail2ban.py b/tests/fail2ban.py index 2f2ac352..dbab874a 100644 --- a/tests/fail2ban.py +++ b/tests/fail2ban.py @@ -181,7 +181,7 @@ def run_test(testfunc, args, count, within_seconds, parallel): # Distribute the requests across the pool. asyncresults = [] for i in range(count): - ar = p.apply_async(testfunc_runner, [i, testfunc] + list(args)) + ar = p.apply_async(testfunc_runner, [i, testfunc, *list(args)]) asyncresults.append(ar) # Wait for all runs to finish. diff --git a/tests/tls.py b/tests/tls.py index 10782a9b..8795f36a 100644 --- a/tests/tls.py +++ b/tests/tls.py @@ -88,7 +88,7 @@ def sslyze(opts, port, ok_ciphers): try: # Execute SSLyze. - out = subprocess.check_output([SSLYZE] + common_opts + opts + [connection_string]) + out = subprocess.check_output([SSLYZE, *common_opts, *opts, connection_string]) out = out.decode("utf8") # Trim output to make better for storing in git.