diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-01-27 12:16:40 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-01-27 21:57:35 +0100 |
commit | b0a336a66929ed2a146888178157bf1af5c8598c (patch) | |
tree | 2a49bc949a64feecf2ef1326a1d4590eb32b2982 /src | |
parent | generate-sys-test: modernize Python and C code (diff) | |
download | systemd-b0a336a66929ed2a146888178157bf1af5c8598c.tar.xz systemd-b0a336a66929ed2a146888178157bf1af5c8598c.zip |
generate-dns_type-gperf: modernize python syntax
Diffstat (limited to 'src')
-rwxr-xr-x | src/resolve/generate-dns_type-gperf.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/resolve/generate-dns_type-gperf.py b/src/resolve/generate-dns_type-gperf.py index d4f7b94738..861d6230ea 100755 --- a/src/resolve/generate-dns_type-gperf.py +++ b/src/resolve/generate-dns_type-gperf.py @@ -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}') |