Describe the bug
#803 finishes #798's sweep but cannot drop # pylint: disable=consider-using-f-string from two files, because three __repr__ methods still format with %. Verified at #803's head (0a5476491):
pcapkit/const/ftp/command.py:40 return "<%s [%s]>" % (self.__class__.__name__, self._name_)
pcapkit/const/ftp/command.py:119 return "<%s.%s: %s>" % (self.__class__.__name__, self._name_, self.desc)
pcapkit/const/http/method.py:42 return "<%s.%s>" % (self.__class__.__name__, self._value_)
Per-file state after #803 — the disable is earned in exactly the two files that still have %:
const/ftp/command.py %-format lines=2 disable=1
const/http/method.py %-format lines=1 disable=1
const/tcp/flags.py %-format lines=0 disable=0 <- dropped by #803
const/reg/apptype/apptype.py %-format lines=0 disable=0 <- dropped by #803
vendor/ftp/command.py %-format lines=3 disable=2
vendor/http/method.py %-format lines=2 disable=2
Expected behavior
f-strings in all three __repr__s, and the disable dropped from both files and both generators — at which point nothing in pcapkit/{const,vendor}/{ftp,http}/ needs it.
Additional context
These were out of #798's scope, not overlooked. #798 named "three %-formatted dunders in the AppType template" specifically, so #803 correctly stopped there and pinned the reason in a test docstring rather than silently leaving a stale disable. This issue is the remainder, filed so the disable's survival is tracked rather than inferred.
The maintainer's convention from #783: "id like to keep f-string convention across the library. only use % substitution when inevitable." A __repr__ is not an inevitable case — AppType.__repr__ was converted by #803 with member-by-member byte-identity proved over all 12,391 members, so the same proof shape applies here at far smaller scale.
Three traps, all measured on #798/#803:
- These const files are generated. Edit
pcapkit/vendor/** and pcapkit/const/**. In the vendor templates braces in emitted code must be doubled, since BASE is a lambda returning an f-string, not a str.format() template.
- Do not regenerate anything under
reg/apptype/ — AppType.LINK fetches IANA's live CSV. These two files do not crawl IANA, but prove equivalence the same way: render the template and diff the changed region, expecting 0 diff lines elsewhere.
- A
%-format grep must allow both quote styles. Mine used '[^']*%[sdr] and reported 0 for these very files, because every surviving line is double-quoted. Self-test the pattern against a known-positive before trusting a zero.
Related: #798, #803, #783, #796.
Describe the bug
#803 finishes #798's sweep but cannot drop
# pylint: disable=consider-using-f-stringfrom two files, because three__repr__methods still format with%. Verified at #803's head (0a5476491):Per-file state after #803 — the disable is earned in exactly the two files that still have
%:Expected behavior
f-strings in all three
__repr__s, and the disable dropped from both files and both generators — at which point nothing inpcapkit/{const,vendor}/{ftp,http}/needs it.Additional context
These were out of #798's scope, not overlooked. #798 named "three
%-formatted dunders in theAppTypetemplate" specifically, so #803 correctly stopped there and pinned the reason in a test docstring rather than silently leaving a stale disable. This issue is the remainder, filed so the disable's survival is tracked rather than inferred.The maintainer's convention from #783: "id like to keep f-string convention across the library. only use
%substitution when inevitable." A__repr__is not an inevitable case —AppType.__repr__was converted by #803 with member-by-member byte-identity proved over all 12,391 members, so the same proof shape applies here at far smaller scale.Three traps, all measured on #798/#803:
pcapkit/vendor/**andpcapkit/const/**. In the vendor templates braces in emitted code must be doubled, sinceBASEis a lambda returning an f-string, not astr.format()template.reg/apptype/—AppType.LINKfetches IANA's live CSV. These two files do not crawl IANA, but prove equivalence the same way: render the template and diff the changed region, expecting 0 diff lines elsewhere.%-format grep must allow both quote styles. Mine used'[^']*%[sdr]and reported 0 for these very files, because every surviving line is double-quoted. Self-test the pattern against a known-positive before trusting a zero.Related: #798, #803, #783, #796.