From 8f98e46ecb901df499010e77e17d044ce2f3f3a4 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 22 Mar 2025 03:26:04 -0600 Subject: Python: Clean up f-strings --- lib9p/idl.gen | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib9p/idl.gen') 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 -- cgit v1.2.3-2-g168b