Fixed B007 (unused-loop-control-variable)

This commit is contained in:
Teal Dulcet 2023-12-22 07:21:10 -08:00 committed by Joshua Tauberer
parent c953e5784d
commit 57d05c1ab2
5 changed files with 9 additions and 9 deletions

View File

@ -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")

View File

@ -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 \

View File

@ -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.

View File

@ -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

View File

@ -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: