]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
generate-dns_type-gperf: modernize python syntax
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 27 Jan 2021 11:16:40 +0000 (12:16 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 27 Jan 2021 20:57:35 +0000 (21:57 +0100)
src/resolve/generate-dns_type-gperf.py

index d4f7b94738734a2c86bcc30e83da7a77fe7a82bf..861d6230eab1f942b1f370bfc49bdba540aeedf2 100755 (executable)
@@ -1,7 +1,6 @@
 #!/usr/bin/env python3
 
-"""Generate %-from-name.gperf from %-list.txt
-"""
+"Generate %-from-name.gperf from %-list.txt"
 
 import sys
 
@@ -13,12 +12,12 @@ print("""\
 _Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
 #endif
 %}""")
-print("""\
-struct {}_name {{ const char* name; int id; }};
+print(f"""\
+struct {name}_name {{ const char* name; int id; }};
 %null-strings
-%%""".format(name))
+%%""")
 
 for line in open(input):
     line = line.rstrip()
     s = line.replace('_', '-')
-    print("{}, {}{}".format(s, prefix, line))
+    print(f'{s}, {prefix}{line}')