From 57d05c1ab26ef350689ee6c2551629254de04d0c Mon Sep 17 00:00:00 2001 From: Teal Dulcet Date: Fri, 22 Dec 2023 07:21:10 -0800 Subject: [PATCH] Fixed B007 (unused-loop-control-variable) --- management/dns_update.py | 10 +++++----- management/mailconfig.py | 2 +- management/ssl_certificates.py | 2 +- management/status_checks.py | 2 +- management/utils.py | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/management/dns_update.py b/management/dns_update.py index 96cffbae..753a4115 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -513,7 +513,7 @@ $TTL 86400 ; default time to live zone = zone.format(domain=domain, primary_domain=env["PRIMARY_HOSTNAME"]) # Add records. - for subdomain, querytype, value, explanation in records: + for subdomain, querytype, value, _explanation in records: if subdomain: zone += subdomain zone += "\tIN\t" + querytype + "\t" @@ -898,7 +898,7 @@ def write_custom_dns_config(config, env): def set_custom_dns_record(qname, rtype, value, action, env): # validate qname - for zone, fn in get_dns_zones(env): + for zone, _fn in get_dns_zones(env): # It must match a zone apex or be a subdomain of a zone # that we are otherwise hosting. if qname == zone or qname.endswith("."+zone): @@ -992,7 +992,7 @@ def get_secondary_dns(custom_dns, mode=None): resolver.lifetime = 10 values = [] - for qname, rtype, value in custom_dns: + for qname, _rtype, value in custom_dns: if qname != '_secondary_nameserver': continue for hostname in value.split(" "): hostname = hostname.strip() @@ -1078,7 +1078,7 @@ def get_custom_dns_records(custom_dns, qname, rtype): def build_recommended_dns(env): ret = [] - for (domain, zonefile, records) in build_zones(env): + for (domain, _zonefile, records) in build_zones(env): # remove records that we don't display records = [r for r in records if r[3] is not False] @@ -1106,7 +1106,7 @@ if __name__ == "__main__": if sys.argv[-1] == "--lint": write_custom_dns_config(get_custom_dns_config(env), env) else: - for zone, records in build_recommended_dns(env): + for _zone, records in build_recommended_dns(env): for record in records: print("; " + record['explanation']) print(record['qname'], record['rtype'], record['value'], sep="\t") diff --git a/management/mailconfig.py b/management/mailconfig.py index 8705d56a..b6c45c24 100755 --- a/management/mailconfig.py +++ b/management/mailconfig.py @@ -579,7 +579,7 @@ def kick(env, mail_result=None): # Remove auto-generated postmaster/admin/abuse alises from the main aliases table. # They are now stored in the auto_aliases table. - for address, forwards_to, permitted_senders, auto in get_mail_aliases(env): + for address, forwards_to, _permitted_senders, auto in get_mail_aliases(env): user, domain = address.split("@") if user in {"postmaster", "admin", "abuse"} \ and address not in required_aliases \ diff --git a/management/ssl_certificates.py b/management/ssl_certificates.py index d9c5ac51..4e84fc07 100755 --- a/management/ssl_certificates.py +++ b/management/ssl_certificates.py @@ -262,7 +262,7 @@ def provision_certificates(env, limit_domains): # primary domain listed in each certificate. from dns_update import get_dns_zones certs = { } - for zone, zonefile in get_dns_zones(env): + for zone, _zonefile in get_dns_zones(env): certs[zone] = [[]] for domain in sort_domains(domains, env): # Does the domain end with any domain we've seen so far. diff --git a/management/status_checks.py b/management/status_checks.py index ac4f3021..f73e5121 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -88,7 +88,7 @@ def run_services_checks(env, output, pool): all_running = True fatal = False ret = pool.starmap(check_service, ((i, service, env) for i, service in enumerate(get_services())), chunksize=1) - for i, running, fatal2, output2 in sorted(ret): + for _i, running, fatal2, output2 in sorted(ret): if output2 is None: continue # skip check (e.g. no port was set, e.g. no sshd) all_running = all_running and running fatal = fatal or fatal2 diff --git a/management/utils.py b/management/utils.py index 982c8c8a..a8fb5c2f 100644 --- a/management/utils.py +++ b/management/utils.py @@ -148,7 +148,7 @@ def du(path): # soft and hard links. total_size = 0 seen = set() - for dirpath, dirnames, filenames in os.walk(path): + for dirpath, _dirnames, filenames in os.walk(path): for f in filenames: fp = os.path.join(dirpath, f) try: