From: Štěpán Balážik Date: Tue, 27 Jan 2026 23:47:24 +0000 (+0100) Subject: Fix the rest of 'Formatting a regular string which could be an f-string' X-Git-Tag: v9.21.19~15^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a384283497dae1195ce1270103ca1bbb6ee18af2;p=thirdparty%2Fbind9.git Fix the rest of 'Formatting a regular string which could be an f-string' Some fixes have to be done manually. --- diff --git a/bin/tests/system/addzone/tests_rndc_deadlock.py b/bin/tests/system/addzone/tests_rndc_deadlock.py index f805897f294..1e20fdb0a06 100755 --- a/bin/tests/system/addzone/tests_rndc_deadlock.py +++ b/bin/tests/system/addzone/tests_rndc_deadlock.py @@ -68,7 +68,7 @@ def test_rndc_deadlock(ns3): # Create 4 worker threads running "rndc" commands in a loop. with concurrent.futures.ThreadPoolExecutor() as executor: for i in range(1, 5): - domain = "example%d" % i + domain = f"example{i}" executor.submit(rndc_loop, test_state, domain, ns3) # Run "rndc status" 10 times, with 1-second pauses between attempts. diff --git a/bin/tests/system/doth/tests_gnutls.py b/bin/tests/system/doth/tests_gnutls.py index 42ef3f6973e..70ddd261f6a 100644 --- a/bin/tests/system/doth/tests_gnutls.py +++ b/bin/tests/system/doth/tests_gnutls.py @@ -48,7 +48,7 @@ def test_gnutls_cli_query(gnutls_cli_executable, named_tlsport): "--no-ocsp", "--alpn=dot", "--logfile=gnutls-cli.log", - "--port=%d" % named_tlsport, + f"--port={named_tlsport}", "10.53.0.1", ] with open("gnutls-cli.err", "wb") as gnutls_cli_stderr, subprocess.Popen( diff --git a/bin/tests/system/synthrecord/tests_synthrecord.py b/bin/tests/system/synthrecord/tests_synthrecord.py index 6159542943e..f202f5b765e 100644 --- a/bin/tests/system/synthrecord/tests_synthrecord.py +++ b/bin/tests/system/synthrecord/tests_synthrecord.py @@ -286,9 +286,7 @@ def test_synthrecord_reverse_anysoa(qname, qtype, rcode, answerscount): def build_synthetic_name_v4(prefix, ip, domain): - return dns.name.from_text( - "{0}{1}.{2}".format(prefix, format(ip).replace(".", "-"), domain) - ) + return dns.name.from_text(f"{prefix}{format(ip).replace('.', '-')}.{domain}") def build_synthetic_name_v6(prefix, ip, domain): diff --git a/bin/tests/system/tcp/ans6/ans.py b/bin/tests/system/tcp/ans6/ans.py index 04d21a96be4..210ae16c98a 100644 --- a/bin/tests/system/tcp/ans6/ans.py +++ b/bin/tests/system/tcp/ans6/ans.py @@ -58,7 +58,7 @@ def open_connections(active_conns, count, host, port): except socket.error: family = socket.AF_INET6 - log("Opening %d connections..." % count) + log(f"Opening {count} connections...") for _ in range(count): sock = socket.socket(family, socket.SOCK_STREAM) @@ -88,23 +88,23 @@ def open_connections(active_conns, count, host, port): active_conns.append(sock) if errors: - log("result=FAIL: %d connection(s) failed" % len(errors)) + log(f"result=FAIL: {len(errors)} connection(s) failed") elif queued: - log("result=FAIL: Timed out, aborting %d pending connections" % len(queued)) + log(f"result=FAIL: Timed out, aborting {len(queued)} pending connections") for sock in queued: sock.close() else: - log("result=OK: Successfully opened %d connections" % count) + log(f"result=OK: Successfully opened {count} connections") def close_connections(active_conns, count): - log("Closing {} connections...".format("all") if count == 0 else str(count)) + log(f"Closing {'all' if count == 0 else count} connections...") if count == 0: count = len(active_conns) for _ in range(count): sock = active_conns.pop(0) sock.close() - log("result=OK: Successfully closed %d connections" % count) + log(f"result=OK: Successfully closed {count} connections") def sigterm(*_): @@ -127,7 +127,7 @@ def main(): except KeyError: port = 5309 - log("Listening on %s:%d" % (listenip, port)) + log(f"Listening on {listenip}:{port}") ctlsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ctlsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) diff --git a/pyproject.toml b/pyproject.toml index a4131873c65..2bc530b2cb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,6 @@ deprecated-modules = [ [tool.pylint.messages_control] disable = [ "C0103", # invalid-name - "C0209", # consider-using-f-string "C0114", # missing-module-docstring "C0115", # missing-class-docstring "C0116", # missing-function-docstring @@ -74,6 +73,11 @@ ignore_names = [ [tool.ruff] target-version = "py310" +lint.select = [ + # f-strings + "UP031", + "UP032", +] extend-exclude = [ "bin/tests/system/vulture_ignore_list.py", "contrib",