🚨 use black

This commit is contained in:
otthorn 2021-04-05 00:28:23 +02:00
parent 6d2409b166
commit 0aa88e5347

49
main.py
View file

@ -45,6 +45,7 @@ def format_mname(name: str):
return mname
HANDLERS = {
"soa": soa_handler,
"originv4": originv4_handler,
@ -58,12 +59,13 @@ HANDLERS = {
"aaaa_records": aaaa_records_handler,
}
def soa_handler(zone, records):
"""Handler for SOA record"""
soa = zone['soa']
soa = zone["soa"]
records['@'].append(
records["@"].append(
dns.rdtypes.ANY.SOA.SOA(
dns.rdataclass.IN,
dns.rdatatype.SOA,
@ -77,32 +79,27 @@ def soa_handler(zone, records):
)
)
def originv4_hanlder(zone, records):
"""Handler for the IPv4 origin"""
ipv4_addr = zone["originv4"]["ipv4"]
records['@'].append(
dns.rdtypes.ANY.A.A(
dns.rdataclass.IN,
dns.rdatatypes.A,
ipv4_addr
)
records["@"].append(
dns.rdtypes.ANY.A.A(dns.rdataclass.IN, dns.rdatatypes.A, ipv4_addr)
)
def originv6_handler(zone, records):
"""Handler for the IPv6 origin"""
ipv6_addr = zone["originv6"] # Yes, re2o is this weird and inconsistent
records['@'].append(
dns.rdtypes.ANY.AAAA.AAAA(
dns.rdataclass.IN,
dns.rdatatype.AAAA,
ipv6_addr
)
records["@"].append(
dns.rdtypes.ANY.AAAA.AAAA(dns.rdataclass.IN, dns.rdatatype.AAAA, ipv6_addr)
)
def ns_records_handler(zone, records):
"""Handler for the NS record"""
@ -111,13 +108,10 @@ def ns_records_handler(zone, records):
target = record["target"]
records["@"].append(
dns.rdtypes.ANY.NS.NS(
dns.rdataclass.IN,
dns.rdatatype.NS,
target
)
dns.rdtypes.ANY.NS.NS(dns.rdataclass.IN, dns.rdatatype.NS, target)
)
def sshfp_record_handler(zone, records):
"""Handler for the SSHFP record"""
@ -136,10 +130,11 @@ def sshfp_record_handler(zone, records):
dns.rdatatype.SSHFP,
algorithm,
fp_type,
fingerprint
fingerprint,
)
)
def txt_records_handler(zone, records):
"""Handler for TXT record"""
@ -149,12 +144,11 @@ def txt_records_handler(zone, records):
records[name].append(
dns.rdtypes.ANY.TXT.TXT(
dns.rdataclass.IN,
dns.rdatatype.TXT,
record["field2"]
dns.rdataclass.IN, dns.rdatatype.TXT, record["field2"]
)
)
def srv_records_handler(zone, records):
"""Handler for SRV record"""
@ -167,10 +161,10 @@ def srv_records_handler(zone, records):
dns.rdtypes.ANY.SRV.SRV(
dns.rdataclass.IN,
dns.rdatatype.SRV,
record['priority'],
record['weight'],
record['port'],
record['target']
record["priority"],
record["weight"],
record["port"],
record["target"],
)
)
@ -187,6 +181,7 @@ def a_records_handler(zone, recordds):
)
)
parser = argparse.ArgumentParser()
parser.add_argument(