From 17832331b859124590e9b43c6620185796fd8504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Wed, 21 Jan 2026 22:40:56 +0100 Subject: [PATCH] Apply black formatting changes Generated by black 26.1.0 which got updated in CI. --- bin/tests/system/bailiwick/ans1/ans.py | 1 - bin/tests/system/bailiwick/ans2/ans.py | 1 - bin/tests/system/checkds/tests_checkds.py | 1 - bin/tests/system/conftest.py | 1 - bin/tests/system/cookie/ans9/ans.py | 2 +- bin/tests/system/isctest/asyncserver.py | 1 - bin/tests/system/isctest/log/basic.py | 1 - bin/tests/system/isctest/log/watchlog.py | 1 - bin/tests/system/isctest/mark.py | 1 - bin/tests/system/isctest/text.py | 1 - bin/tests/system/keepalive/tests_keepalive.py | 1 - .../system/keyfromlabel/tests_keyfromlabel.py | 1 - bin/tests/system/mkeys/tests_sh_mkeys.py | 1 - bin/tests/system/optout/tests_optout.py | 1 - bin/tests/system/pipelined/ans5/ans.py | 2 +- bin/tests/system/rndc/tests_cve-2023-3341.py | 1 - bin/tests/system/rpzextra/tests_rpzextra.py | 1 - bin/tests/system/selftest/tests_zone_analyzer.py | 1 - bin/tests/system/statschannel/generic.py | 5 ++--- bin/tests/system/statschannel/tests_json.py | 1 - bin/tests/system/statschannel/tests_xml.py | 1 - bin/tests/system/tcp/ans6/ans.py | 3 +-- bin/tests/system/timeouts/tests_tcp_timeouts.py | 14 ++++++-------- bin/tests/system/tsig/tests_tsig_hypothesis.py | 1 - bin/tests/system/xferquota/setup.py | 6 ++---- contrib/gitchangelog/gitchangelog.py | 13 +++---------- doc/arm/_ext/iscconf.py | 1 - doc/arm/_ext/namedconf.py | 1 + doc/misc/parsegrammar.py | 1 + 29 files changed, 18 insertions(+), 49 deletions(-) diff --git a/bin/tests/system/bailiwick/ans1/ans.py b/bin/tests/system/bailiwick/ans1/ans.py index f0b152ac3d..859e77491f 100644 --- a/bin/tests/system/bailiwick/ans1/ans.py +++ b/bin/tests/system/bailiwick/ans1/ans.py @@ -24,7 +24,6 @@ from isctest.asyncserver import ( from bailiwick_ans import ResponseSpoofer, spoofing_server - ATTACKER_IP = "10.53.0.3" TTL = 3600 diff --git a/bin/tests/system/bailiwick/ans2/ans.py b/bin/tests/system/bailiwick/ans2/ans.py index 1a9be3d931..151a2c6ccc 100644 --- a/bin/tests/system/bailiwick/ans2/ans.py +++ b/bin/tests/system/bailiwick/ans2/ans.py @@ -24,7 +24,6 @@ from isctest.asyncserver import ( from bailiwick_ans import ResponseSpoofer, spoofing_server - ATTACKER_IP = "10.53.0.3" TTL = 3600 diff --git a/bin/tests/system/checkds/tests_checkds.py b/bin/tests/system/checkds/tests_checkds.py index 50dc2c0222..f42c33f63b 100755 --- a/bin/tests/system/checkds/tests_checkds.py +++ b/bin/tests/system/checkds/tests_checkds.py @@ -28,7 +28,6 @@ import dns.rcode import dns.rdataclass import dns.rdatatype - pytestmark = [ pytest.mark.skipif( sys.version_info < (3, 7), reason="Python >= 3.7 required [GL #3001]" diff --git a/bin/tests/system/conftest.py b/bin/tests/system/conftest.py index fe3e406367..790bb66e9c 100644 --- a/bin/tests/system/conftest.py +++ b/bin/tests/system/conftest.py @@ -27,7 +27,6 @@ pytest.register_assert_rewrite("isctest") import isctest - # Silence warnings caused by passing a pytest fixture to another fixture. # pylint: disable=redefined-outer-name diff --git a/bin/tests/system/cookie/ans9/ans.py b/bin/tests/system/cookie/ans9/ans.py index 1a477f872c..3b0f82cc1d 100644 --- a/bin/tests/system/cookie/ans9/ans.py +++ b/bin/tests/system/cookie/ans9/ans.py @@ -294,7 +294,7 @@ while running: if s == query4_tcp1 or s == query6_tcp1 or s == query4_tcp2 or s == query6_tcp2: try: - (cs, _) = s.accept() + cs, _ = s.accept() if s == query4_tcp1 or s == query6_tcp1: print( "TCP Query received on %s" diff --git a/bin/tests/system/isctest/asyncserver.py b/bin/tests/system/isctest/asyncserver.py index eeca1b88ec..d35710ba5d 100644 --- a/bin/tests/system/isctest/asyncserver.py +++ b/bin/tests/system/isctest/asyncserver.py @@ -55,7 +55,6 @@ import dns.tsig import dns.version import dns.zone - _UdpHandler = Callable[ [bytes, Tuple[str, int], asyncio.DatagramTransport], Coroutine[Any, Any, None] ] diff --git a/bin/tests/system/isctest/log/basic.py b/bin/tests/system/isctest/log/basic.py index 38ffab9bfc..41b5ee68a1 100644 --- a/bin/tests/system/isctest/log/basic.py +++ b/bin/tests/system/isctest/log/basic.py @@ -14,7 +14,6 @@ from pathlib import Path import textwrap from typing import Dict, Optional - CONFTEST_LOGGER = logging.getLogger("conftest") LOG_FORMAT = "%(asctime)s %(levelname)7s:%(name)s %(message)s" LOG_INDENT = 4 diff --git a/bin/tests/system/isctest/log/watchlog.py b/bin/tests/system/isctest/log/watchlog.py index 447879662a..d7154995b7 100644 --- a/bin/tests/system/isctest/log/watchlog.py +++ b/bin/tests/system/isctest/log/watchlog.py @@ -17,7 +17,6 @@ import time from isctest.text import compile_pattern, FlexPattern, LineReader - T = TypeVar("T") OneOrMore = Union[T, List[T]] diff --git a/bin/tests/system/isctest/mark.py b/bin/tests/system/isctest/mark.py index ccd57090df..53860a806c 100644 --- a/bin/tests/system/isctest/mark.py +++ b/bin/tests/system/isctest/mark.py @@ -20,7 +20,6 @@ import subprocess import pytest - long_test = pytest.mark.skipif( not os.environ.get("CI_ENABLE_LONG_TESTS"), reason="CI_ENABLE_LONG_TESTS not set" ) diff --git a/bin/tests/system/isctest/text.py b/bin/tests/system/isctest/text.py index ca3cc835e7..33798c3703 100644 --- a/bin/tests/system/isctest/text.py +++ b/bin/tests/system/isctest/text.py @@ -16,7 +16,6 @@ import re from re import compile as Re from typing import Iterator, List, Match, Optional, Pattern, TextIO, Union - FlexPattern = Union[str, Pattern] diff --git a/bin/tests/system/keepalive/tests_keepalive.py b/bin/tests/system/keepalive/tests_keepalive.py index d09d566f6e..032faf04a3 100644 --- a/bin/tests/system/keepalive/tests_keepalive.py +++ b/bin/tests/system/keepalive/tests_keepalive.py @@ -12,7 +12,6 @@ import isctest import pytest - pytestmark = pytest.mark.extra_artifacts( ["ns2/named.stats"], ) diff --git a/bin/tests/system/keyfromlabel/tests_keyfromlabel.py b/bin/tests/system/keyfromlabel/tests_keyfromlabel.py index f2c1c0bea2..4cafa46d83 100644 --- a/bin/tests/system/keyfromlabel/tests_keyfromlabel.py +++ b/bin/tests/system/keyfromlabel/tests_keyfromlabel.py @@ -18,7 +18,6 @@ import pytest import isctest.mark - pytestmark = [ isctest.mark.supported_openssl_version, isctest.mark.softhsm2_environment, diff --git a/bin/tests/system/mkeys/tests_sh_mkeys.py b/bin/tests/system/mkeys/tests_sh_mkeys.py index d809d105d9..8df669884e 100644 --- a/bin/tests/system/mkeys/tests_sh_mkeys.py +++ b/bin/tests/system/mkeys/tests_sh_mkeys.py @@ -11,7 +11,6 @@ import pytest - pytestmark = pytest.mark.extra_artifacts( [ "delv.*", diff --git a/bin/tests/system/optout/tests_optout.py b/bin/tests/system/optout/tests_optout.py index ce5071ffa7..4652a35e32 100755 --- a/bin/tests/system/optout/tests_optout.py +++ b/bin/tests/system/optout/tests_optout.py @@ -28,7 +28,6 @@ import dns.rcode import dns.rdataclass import dns.rdatatype - pytestmark = [ pytest.mark.skipif( sys.version_info < (3, 7), reason="Python >= 3.7 required [GL #3001]" diff --git a/bin/tests/system/pipelined/ans5/ans.py b/bin/tests/system/pipelined/ans5/ans.py index b58ad84bef..51f10ba3c7 100644 --- a/bin/tests/system/pipelined/ans5/ans.py +++ b/bin/tests/system/pipelined/ans5/ans.py @@ -199,7 +199,7 @@ def main(): while True: try: - (clientsock, _) = sock.accept() + clientsock, _ = sock.accept() log("Accepted connection from %s" % clientsock) thread = TCPDelayer(clientsock, serverip, port) thread.start() diff --git a/bin/tests/system/rndc/tests_cve-2023-3341.py b/bin/tests/system/rndc/tests_cve-2023-3341.py index 73a5117e9f..90f2218a9b 100644 --- a/bin/tests/system/rndc/tests_cve-2023-3341.py +++ b/bin/tests/system/rndc/tests_cve-2023-3341.py @@ -18,7 +18,6 @@ import pytest import isctest - pytestmark = pytest.mark.extra_artifacts( [ "ns2/nil.db", diff --git a/bin/tests/system/rpzextra/tests_rpzextra.py b/bin/tests/system/rpzextra/tests_rpzextra.py index e6a8324942..7e9414c0ba 100644 --- a/bin/tests/system/rpzextra/tests_rpzextra.py +++ b/bin/tests/system/rpzextra/tests_rpzextra.py @@ -21,7 +21,6 @@ import dns.rrset import isctest - pytestmark = pytest.mark.extra_artifacts( [ "ns3/*-rpz-external.local.db", diff --git a/bin/tests/system/selftest/tests_zone_analyzer.py b/bin/tests/system/selftest/tests_zone_analyzer.py index 9cea8c7986..dcbe45519d 100755 --- a/bin/tests/system/selftest/tests_zone_analyzer.py +++ b/bin/tests/system/selftest/tests_zone_analyzer.py @@ -14,7 +14,6 @@ isctest.name.ZoneAnalyzer self-test Generate insane test zone and check expected output of ZoneAnalyzer utility class """ - import collections import itertools from pathlib import Path diff --git a/bin/tests/system/statschannel/generic.py b/bin/tests/system/statschannel/generic.py index 611d396925..fa64f5c483 100644 --- a/bin/tests/system/statschannel/generic.py +++ b/bin/tests/system/statschannel/generic.py @@ -20,7 +20,6 @@ import dns.rcode import isctest - # ISO datetime format without msec fmt = "%Y-%m-%dT%H:%M:%SZ" @@ -87,7 +86,7 @@ def test_zone_timers_primary(fetch_zones, load_timers, **kwargs): zones = fetch_zones(statsip, statsport) for zone in zones: - (name, loaded, expires, refresh) = load_timers(zone, True) + name, loaded, expires, refresh = load_timers(zone, True) mtime = zone_mtime(zonedir, name) check_zone_timers(loaded, expires, refresh, mtime) @@ -103,7 +102,7 @@ def test_zone_timers_secondary(fetch_zones, load_timers, **kwargs): zones = fetch_zones(statsip, statsport) again = False for zone in zones: - (name, loaded, expires, refresh) = load_timers(zone, False) + name, loaded, expires, refresh = load_timers(zone, False) mtime = zone_mtime(zonedir, name) if (mtime != dayzero) or (tries == 0): # mtime was either retrieved successfully or no tries were diff --git a/bin/tests/system/statschannel/tests_json.py b/bin/tests/system/statschannel/tests_json.py index 9e9a2dc405..0817363f15 100755 --- a/bin/tests/system/statschannel/tests_json.py +++ b/bin/tests/system/statschannel/tests_json.py @@ -21,7 +21,6 @@ import isctest.mark pytest.register_assert_rewrite("generic") import generic - pytestmark = [ isctest.mark.have_json_c, pytest.mark.extra_artifacts( diff --git a/bin/tests/system/statschannel/tests_xml.py b/bin/tests/system/statschannel/tests_xml.py index d41fc4fc76..cffb8d1422 100755 --- a/bin/tests/system/statschannel/tests_xml.py +++ b/bin/tests/system/statschannel/tests_xml.py @@ -22,7 +22,6 @@ import isctest.mark pytest.register_assert_rewrite("generic") import generic - pytestmark = [ isctest.mark.have_libxml2, pytest.mark.extra_artifacts( diff --git a/bin/tests/system/tcp/ans6/ans.py b/bin/tests/system/tcp/ans6/ans.py index b94697e2cd..a9df8b7df7 100644 --- a/bin/tests/system/tcp/ans6/ans.py +++ b/bin/tests/system/tcp/ans6/ans.py @@ -39,7 +39,6 @@ import socket import sys import time - # Timeout for establishing all connections requested by a single 'open' command. OPEN_TIMEOUT = 2 VERSION_QUERY = b"\x00\x1e\xaf\xb8\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07version\x04bind\x00\x00\x10\x00\x03" @@ -136,7 +135,7 @@ def main(): ctlsock.listen(1) while True: - (clientsock, _) = ctlsock.accept() + clientsock, _ = ctlsock.accept() log("Accepted control connection from %s" % clientsock) cmdline = clientsock.recv(512).decode("ascii").strip() if cmdline: diff --git a/bin/tests/system/timeouts/tests_tcp_timeouts.py b/bin/tests/system/timeouts/tests_tcp_timeouts.py index e25bba5a04..ca982ef6c9 100644 --- a/bin/tests/system/timeouts/tests_tcp_timeouts.py +++ b/bin/tests/system/timeouts/tests_tcp_timeouts.py @@ -170,7 +170,7 @@ def test_long_axfr(named_port): dns.query.send_tcp(sock, msg, timeout()) # Receive the initial DNS message with SOA - (response, _) = dns.query.receive_tcp(sock, timeout(), one_rr_per_rrset=True) + response, _ = dns.query.receive_tcp(sock, timeout(), one_rr_per_rrset=True) soa = response.get_rrset( dns.message.ANSWER, name, dns.rdataclass.IN, dns.rdatatype.SOA ) @@ -178,9 +178,7 @@ def test_long_axfr(named_port): # Pull DNS message from wire until the second SOA is received while True: - (response, _) = dns.query.receive_tcp( - sock, timeout(), one_rr_per_rrset=True - ) + response, _ = dns.query.receive_tcp(sock, timeout(), one_rr_per_rrset=True) soa = response.get_rrset( dns.message.ANSWER, name, dns.rdataclass.IN, dns.rdatatype.SOA ) @@ -226,7 +224,7 @@ def test_max_transfer_idle_out(named_port): dns.query.send_tcp(sock, msg, timeout()) # Receive the initial DNS message with SOA - (response, _) = dns.query.receive_tcp(sock, timeout(), one_rr_per_rrset=True) + response, _ = dns.query.receive_tcp(sock, timeout(), one_rr_per_rrset=True) soa = response.get_rrset( dns.message.ANSWER, name, dns.rdataclass.IN, dns.rdatatype.SOA ) @@ -237,7 +235,7 @@ def test_max_transfer_idle_out(named_port): with pytest.raises(ConnectionResetError): # Process queued TCP messages while True: - (response, _) = dns.query.receive_tcp( + response, _ = dns.query.receive_tcp( sock, timeout(), one_rr_per_rrset=True ) soa = response.get_rrset( @@ -258,7 +256,7 @@ def test_max_transfer_time_out(named_port): dns.query.send_tcp(sock, msg, timeout()) # Receive the initial DNS message with SOA - (response, _) = dns.query.receive_tcp(sock, timeout(), one_rr_per_rrset=True) + response, _ = dns.query.receive_tcp(sock, timeout(), one_rr_per_rrset=True) soa = response.get_rrset( dns.message.ANSWER, name, dns.rdataclass.IN, dns.rdatatype.SOA ) @@ -268,7 +266,7 @@ def test_max_transfer_time_out(named_port): with pytest.raises(EOFError): while True: time.sleep(1) - (response, _) = dns.query.receive_tcp( + response, _ = dns.query.receive_tcp( sock, timeout(), one_rr_per_rrset=True ) soa = response.get_rrset( diff --git a/bin/tests/system/tsig/tests_tsig_hypothesis.py b/bin/tests/system/tsig/tests_tsig_hypothesis.py index 3e134d5bb0..858ee5e04a 100644 --- a/bin/tests/system/tsig/tests_tsig_hypothesis.py +++ b/bin/tests/system/tsig/tests_tsig_hypothesis.py @@ -34,7 +34,6 @@ from isctest.hypothesis.strategies import dns_names, uint from hypothesis import assume, example, given, HealthCheck, settings from hypothesis.strategies import binary, booleans, composite, just, sampled_from - pytestmark = pytest.mark.extra_artifacts( [ "ans*/ans.run", diff --git a/bin/tests/system/xferquota/setup.py b/bin/tests/system/xferquota/setup.py index cbbb0529da..ec457bf171 100644 --- a/bin/tests/system/xferquota/setup.py +++ b/bin/tests/system/xferquota/setup.py @@ -20,8 +20,7 @@ zones = 300 for z in range(zones): zn = f"zone{z:06d}.example" with open(f"ns1/{zn}.db", "w", encoding="utf-8") as f: - f.write( - """$TTL 300 + f.write("""$TTL 300 @ IN SOA ns1 . 1 300 120 3600 86400 NS ns1 NS ns2 @@ -31,8 +30,7 @@ ns2 A 10.53.0.2 MX 20 mail2.isp.example. www A 10.0.0.1 xyzzy A 10.0.0.2 -""" - ) +""") with open("ns1/zones.conf", "w", encoding="utf-8") as priconf, open( "ns2/zones.conf", "w", encoding="utf-8" diff --git a/contrib/gitchangelog/gitchangelog.py b/contrib/gitchangelog/gitchangelog.py index 33583185b9..262a41c552 100755 --- a/contrib/gitchangelog/gitchangelog.py +++ b/contrib/gitchangelog/gitchangelog.py @@ -483,7 +483,7 @@ class TextProc(object): return TextProc(lambda text: value.fun(self.fun(text))) import inspect - (_frame, filename, lineno, _function_name, lines, _index) = inspect.stack()[1] + _frame, filename, lineno, _function_name, lines, _index = inspect.stack()[1] raise SyntaxError( "Invalid syntax in config file", ( @@ -2084,10 +2084,7 @@ def safe_print(content): raise ## XXXvlab: should use $COLUMNS in bash and for windows: ## http://stackoverflow.com/questions/14978548 - stderr( - paragraph_wrap( - textwrap.dedent( - """\ + stderr(paragraph_wrap(textwrap.dedent("""\ UnicodeEncodeError: There was a problem outputing the resulting changelog to your console. @@ -2095,11 +2092,7 @@ def safe_print(content): This probably means that the changelog contains characters that can't be translated to characters in your current charset (%s). - """ - ) - % sys.stdout.encoding - ) - ) + """) % sys.stdout.encoding)) if WIN32 and PY_VERSION < 3.6 and sys.stdout.encoding != "utf-8": ## As of PY 3.6, encoding is now ``utf-8`` regardless of ## PYTHONIOENCODING diff --git a/doc/arm/_ext/iscconf.py b/doc/arm/_ext/iscconf.py index dc440e2928..4313194119 100644 --- a/doc/arm/_ext/iscconf.py +++ b/doc/arm/_ext/iscconf.py @@ -35,7 +35,6 @@ from sphinx.util.nodes import make_refnode import checkgrammar - logger = logging.getLogger(__name__) diff --git a/doc/arm/_ext/namedconf.py b/doc/arm/_ext/namedconf.py index bcf4a0c007..2578d0df5b 100644 --- a/doc/arm/_ext/namedconf.py +++ b/doc/arm/_ext/namedconf.py @@ -15,6 +15,7 @@ Sphinx domain "namedconf". See iscconf.py for details. """ + from docutils import nodes import iscconf diff --git a/doc/misc/parsegrammar.py b/doc/misc/parsegrammar.py index b3fede04e5..eff382639b 100644 --- a/doc/misc/parsegrammar.py +++ b/doc/misc/parsegrammar.py @@ -59,6 +59,7 @@ end node, key "_mapbody" denotes a nested map. } } """ + import fileinput import json import re