You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The maintainer's convention, ruled on #783: "id like to keep f-string convention across the library. only use % substitution when inevitable."
Measured, so the gap is explicit:
scope
raise …Error(f'…
raise …Error('…' % …)
pcapkit/ whole tree
605
2
pcapkit/const/reg/apptype/apptype.py on ef859f776
0
6
So the tree convention really is f-strings and this generated module is the exception. #783 converted the one raise it introduced and deliberately left the six pre-existing ones, to keep a const diff over a 12,391-member file reviewable for the thing it was actually doing.
The six, on ef859f776: :92, :2308, :2368, :2378, :2478, :2484. Plus three %-formatted dunders (__new__, __repr__, __str__) that the same convention arguably covers.
Expected behavior
f-strings for the six raises named above, which is what this issue's title scopes it to.
Narrowed, 2026-09-25. This line originally read "f-strings throughout, and the module-level # pylint: disable=consider-using-f-string dropped once nothing needs it" — which over-reached past the title. "Throughout" also covers the three %-formatted dunders (__new__, __repr__, __str__) and the extend_enum(..., '%d' % value, ...) calls, and the disable cannot drop until those and three other bespoke templates are done. Left as written, this issue would close on a PR that meets its title but not its stated criteria. The remainder is #798.
Additional context
Two things whoever takes this needs to know, both measured:
It is a generated file, so the edit goes in the template.pcapkit/vendor/reg/apptype/apptype.py:93 is BASE = lambda NAME, DOCS, FLAG, TABLE, MISS, MODL: f'''… — a lambda returning an f-string, not a str.format() template. Braces in the emitted code must therefore be doubled in the template; :243's = {{}} is the existing precedent.
Also verify each converted message is byte-identical to the % form it replaces. #783 checked that for its one raise (147 chars vs 147, string-equal); %r versus !r is the trap.
Describe the bug
The maintainer's convention, ruled on #783: "id like to keep f-string convention across the library. only use
%substitution when inevitable."Measured, so the gap is explicit:
raise …Error(f'…raise …Error('…' % …)pcapkit/whole treepcapkit/const/reg/apptype/apptype.pyonef859f776So the tree convention really is f-strings and this generated module is the exception. #783 converted the one raise it introduced and deliberately left the six pre-existing ones, to keep a
constdiff over a 12,391-member file reviewable for the thing it was actually doing.The six, on
ef859f776::92,:2308,:2368,:2378,:2478,:2484. Plus three%-formatted dunders (__new__,__repr__,__str__) that the same convention arguably covers.Expected behavior
f-strings for the six raises named above, which is what this issue's title scopes it to.
Narrowed, 2026-09-25. This line originally read "f-strings throughout, and the module-level
# pylint: disable=consider-using-f-stringdropped once nothing needs it" — which over-reached past the title. "Throughout" also covers the three%-formatted dunders (__new__,__repr__,__str__) and theextend_enum(..., '%d' % value, ...)calls, and the disable cannot drop until those and three other bespoke templates are done. Left as written, this issue would close on a PR that meets its title but not its stated criteria. The remainder is #798.Additional context
Two things whoever takes this needs to know, both measured:
pcapkit/vendor/reg/apptype/apptype.py:93isBASE = lambda NAME, DOCS, FLAG, TABLE, MISS, MODL: f'''…— a lambda returning an f-string, not astr.format()template. Braces in the emitted code must therefore be doubled in the template;:243's= {{}}is the existing precedent.AppType.LINKfetches IANA's live CSV, so a crawl would rewrite thousands of unrelated member rows. Hand-edit both files and prove equivalence the way fix(const): refuse a multi-bit proto in AppType._dispatch rather than resolving it LSB-first (#759) #783 did — expandBASEand diff the changed region against the const file, expecting 0 diff lines.Also verify each converted message is byte-identical to the
%form it replaces. #783 checked that for its one raise (147 chars vs 147, string-equal);%rversus!ris the trap.Related: #783, #759.