From: Bob Halley Date: Thu, 30 Mar 2023 13:29:20 +0000 (-0700) Subject: run black X-Git-Tag: v2.4.0rc1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=301346cf567cfde62e8b9823a19271a88aebf342;p=thirdparty%2Fdnspython.git run black --- diff --git a/Makefile b/Makefile index 66b4cff4..e0f7ccdd 100644 --- a/Makefile +++ b/Makefile @@ -80,3 +80,6 @@ pokit: findjunk: find dns -type f | egrep -v '.*\.py' | egrep -v 'py\.typed' + +poblack: + poetry run black dns examples tests diff --git a/dns/quic/_common.py b/dns/quic/_common.py index 625fab7f..442b3820 100644 --- a/dns/quic/_common.py +++ b/dns/quic/_common.py @@ -151,7 +151,7 @@ class BaseQuicManager: conf = aioquic.quic.configuration.QuicConfiguration( alpn_protocols=["doq", "doq-i03"], verify_mode=verify_mode, - server_name=server_name + server_name=server_name, ) if verify_path is not None: conf.load_verify_locations(verify_path) diff --git a/dns/rdtypes/ANY/LOC.py b/dns/rdtypes/ANY/LOC.py index 52c97532..028375de 100644 --- a/dns/rdtypes/ANY/LOC.py +++ b/dns/rdtypes/ANY/LOC.py @@ -40,7 +40,7 @@ def _exponent_of(what, desc): if what == 0: return 0 exp = None - for (i, pow) in enumerate(_pows): + for i, pow in enumerate(_pows): if what < pow: exp = i - 1 break diff --git a/dns/rdtypes/IN/APL.py b/dns/rdtypes/IN/APL.py index 05e1689f..f1bb01db 100644 --- a/dns/rdtypes/IN/APL.py +++ b/dns/rdtypes/IN/APL.py @@ -124,7 +124,6 @@ class APL(dns.rdata.Rdata): @classmethod def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - items = [] while parser.remaining() > 0: header = parser.get_struct("!HBB") diff --git a/dns/rdtypes/util.py b/dns/rdtypes/util.py index 46c98cf7..54908fdc 100644 --- a/dns/rdtypes/util.py +++ b/dns/rdtypes/util.py @@ -120,7 +120,7 @@ class Bitmap: def __init__(self, windows=None): last_window = -1 self.windows = windows - for (window, bitmap) in self.windows: + for window, bitmap in self.windows: if not isinstance(window, int): raise ValueError(f"bad {self.type_name} window type") if window <= last_window: @@ -135,9 +135,9 @@ class Bitmap: def to_text(self) -> str: text = "" - for (window, bitmap) in self.windows: + for window, bitmap in self.windows: bits = [] - for (i, byte) in enumerate(bitmap): + for i, byte in enumerate(bitmap): for j in range(0, 8): if byte & (0x80 >> j): rdtype = window * 256 + i * 8 + j @@ -183,7 +183,7 @@ class Bitmap: return cls(windows) def to_wire(self, file: Any) -> None: - for (window, bitmap) in self.windows: + for window, bitmap in self.windows: file.write(struct.pack("!BB", window, len(bitmap))) file.write(bitmap) @@ -231,7 +231,7 @@ def weighted_processing_order(iterable): total = sum(rdata._processing_weight() or _no_weight for rdata in rdatas) while len(rdatas) > 1: r = random.uniform(0, total) - for (n, rdata) in enumerate(rdatas): + for n, rdata in enumerate(rdatas): weight = rdata._processing_weight() or _no_weight if weight > r: break diff --git a/examples/edns.py b/examples/edns.py index 0566bfb8..9738a0d0 100755 --- a/examples/edns.py +++ b/examples/edns.py @@ -60,7 +60,7 @@ q_list.append( (l, dns.message.make_query(n, t, options=[dns.edns.ECSOption("192.168.0.0", 20)])) ) -for (addr, q) in q_list: +for addr, q in q_list: r = dns.query.udp(q, addr) if not r.options: print("No EDNS options returned") diff --git a/examples/edns_resolver.py b/examples/edns_resolver.py index 6edf4a9e..a43ad252 100644 --- a/examples/edns_resolver.py +++ b/examples/edns_resolver.py @@ -53,7 +53,7 @@ o_list.append((l, dict(options=[dns.edns.ECSOption(external_ip, 24)]))) aresolver = dns.resolver.Resolver() -for (addr, edns_kwargs) in o_list: +for addr, edns_kwargs in o_list: if edns_kwargs: aresolver.use_edns(**edns_kwargs) aresolver.nameservers = ["8.8.8.8"] diff --git a/examples/reverse.py b/examples/reverse.py index 5829c681..012617c2 100755 --- a/examples/reverse.py +++ b/examples/reverse.py @@ -26,7 +26,7 @@ reverse_map = {} # type: Dict[str, List[str]] for filename in sys.argv[1:]: zone = dns.zone.from_file(filename, os.path.basename(filename), relativize=False) - for (name, ttl, rdata) in zone.iterate_rdatas("A"): + for name, ttl, rdata in zone.iterate_rdatas("A"): print(type(rdata)) try: reverse_map[rdata.address].append(name.to_text())