summaryrefslogtreecommitdiff
path: root/lib9p/idl.gen
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-03-22 03:26:04 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-03-22 19:32:44 -0600
commit8f98e46ecb901df499010e77e17d044ce2f3f3a4 (patch)
treeb84518bfe9084bd4b79df742d56d5cbe46d95369 /lib9p/idl.gen
parenta3e4bb076965497736b07ed38b92646fb5c7c219 (diff)
Python: Clean up f-strings
Diffstat (limited to 'lib9p/idl.gen')
-rwxr-xr-xlib9p/idl.gen10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib9p/idl.gen b/lib9p/idl.gen
index 65ff734..eaeca49 100755
--- a/lib9p/idl.gen
+++ b/lib9p/idl.gen
@@ -440,9 +440,7 @@ enum {idprefix}version {{
continue
msg = id2typ[n]
ret += ifdef_push(1, c_ver_ifdef(msg.in_versions))
- ret += (
- f"\t{idprefix.upper()}TYP_{msg.typname.ljust(namewidth)} = {msg.msgid},\n"
- )
+ ret += f"\t{idprefix.upper()}TYP_{msg.typname:<{namewidth}} = {msg.msgid},\n"
ret += ifdef_pop(0)
ret += "};\n"
@@ -464,7 +462,7 @@ enum {idprefix}version {{
ret = ""
v_width = max(len(c_ver_enum(v)) for v in typ.in_versions)
for version, line in lines.items():
- ret += f"/* {c_ver_enum(version).ljust(v_width)}: {line} */\n"
+ ret += f"/* {c_ver_enum(version):<{v_width}}: {line} */\n"
return ret
for typ in topo_sorted(typs):
@@ -496,7 +494,7 @@ enum {idprefix}version {{
prefix = f"{idprefix.upper()}{typ.typname.upper()}_"
namewidth = max(len(name) for name in typ.vals)
for name, val in typ.vals.items():
- ret += f"#define {prefix}{name.ljust(namewidth)} (({c_typename(typ)})UINT{typ.static_size*8}_C({val}))\n"
+ ret += f"#define {prefix}{name:<{namewidth}} (({c_typename(typ)})UINT{typ.static_size*8}_C({val}))\n"
case idl.Bitfield():
ret += f"typedef {c_typename(typ.prim)} {c_typename(typ)};\n"
@@ -581,7 +579,7 @@ enum {idprefix}version {{
if member.val:
continue
ret += ifdef_push(2, c_ver_ifdef(member.in_versions))
- ret += f"\t{c_typename(member.typ, member).ljust(typewidth)} {'*' if member.cnt else ' '}{member.membname};\n"
+ ret += f"\t{c_typename(member.typ, member):<{typewidth}} {'*' if member.cnt else ' '}{member.membname};\n"
ret += ifdef_pop(1)
ret += "};\n"
del typ