]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix the rest of 'Formatting a regular string which could be an f-string'
authorŠtěpán Balážik <stepan@isc.org>
Tue, 27 Jan 2026 23:47:24 +0000 (00:47 +0100)
committerŠtěpán Balážik <stepan@isc.org>
Fri, 20 Feb 2026 14:17:31 +0000 (15:17 +0100)
Some fixes have to be done manually.

bin/tests/system/addzone/tests_rndc_deadlock.py
bin/tests/system/doth/tests_gnutls.py
bin/tests/system/synthrecord/tests_synthrecord.py
bin/tests/system/tcp/ans6/ans.py
pyproject.toml

index f805897f2943068551aed5fef42e0439d63c9d73..1e20fdb0a06219b9442b823bd4f03061b71bc51e 100755 (executable)
@@ -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.
index 42ef3f6973e61dff154c368fcaf501437e8858bb..70ddd261f6a5221ab623de1720db85b6d9dabe23 100644 (file)
@@ -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(
index 6159542943e6fcc499b88f7c42ee578254675d44..f202f5b765e4036799a89fc7d39fd1d6a24b1d64 100644 (file)
@@ -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):
index 04d21a96be4e8293ce137e5f3910f458369cea48..210ae16c98adcfb3fac8f505590ce623ef865454 100644 (file)
@@ -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)
index a4131873c65c7f67a2fa56336e2c0bdbe004d06e..2bc530b2cb1ae0d6468bea1d1ced979ef70ac53f 100644 (file)
@@ -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",