generate-dns_type: apply "ruff format" and "ruff check --fix"

This commit is contained in:
Yu Watanabe
2026-05-18 02:44:46 +09:00
parent 4084459014
commit 246e4594ed
+7 -9
View File
@@ -1,26 +1,24 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later
"""Generate %-from-name.gperf from %-list.txt
"""
"""Generate %-from-name.gperf from %-list.txt"""
import sys
name, prefix, input = sys.argv[1:]
print("""\
%{
print(f'''\
%{{
_Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
#if __GNUC__ >= 15
_Pragma("GCC diagnostic ignored \\"-Wzero-as-null-pointer-constant\\"")
#endif
%}""")
print("""\
struct {}_name {{ const char* name; int id; }};
%}}
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}')