Repository navigation
refactor(const,protocols): reparent the last seven non-registry enums onto EnumLookup #930
Description
#877's phase 2 is half done. #921 re-parented 17 of the 24 non-registry enumerations onto EnumLookup; seven are still outside it, and #877 is closed, so nothing tracks them.
Measured on 4f3d43df7 by walking every importable pcapkit.* module (vendor templates excluded) and filtering on issubclass(cls, EnumLookup):
pcapkit.const.ftp.command.CommandType
pcapkit.const.ftp.command.ConformanceRequirement
pcapkit.protocols.internet.esp.ESPStatus
pcapkit.protocols.internet.mh.FastBindingAcknowledgmentStatus
pcapkit.protocols.internet.mh.IPv6AddressPrefixCode
pcapkit.protocols.internet.mh.LMAAddressCode
pcapkit.protocols.internet.mh.LocalizedRoutingStatus
Why these seven and not the other 17. They were deliberately deferred, not overlooked. At the time #921 was written, const/ftp/command.py was held by #913 and esp.py / mh.py by #904 — so widening the in-flight worker's scope would have collided. All three blockers have since merged (1f433..., b3551cb63), so the contention is gone.
Scope
Re-parent each from (EnumBase,) to (EnumLookup, EnumBase), the same change #921 made for the other 17. #921's own PR is the pattern to follow, including its test file tests/corekit/test_enum_lookup_reparent_877_unit.py.
Two things #921 learned that apply here:
EnumLookup.getis a@classmethod. Any existinggetoverride that is a@staticmethodcannot callsuper().get(...)— it raisesRuntimeError: super(): no arguments. Check each of the seven for an override before assuming a bare re-parent suffices.- Member-table sizes must not change. Verify
(len(__members__), len(list(cls)))before and after for each, since a re-parent that silently mints a member is the defect this programme exists to prevent.
Note the exception contract has moved since #921: EnumLookup.get now raises EnumKeyError / EnumValueError from pcapkit.utilities.exceptions (#923, merged as 4f3d43df7), so a name miss is KeyError-derived and raised quietly. mh.py's two except KeyError: raise EnumKeyError(...) conversions already reflect that and should be left alone.
Not blocked. No open PR touches these three files — #657 is docs-only and merges last.
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Activity
refactor(const,protocols): reparent the last seven non-registry enums…
JarryShaw commentedon Sep 29, 2026
Correcting my own brief in this issue's body. The "Why these seven and not the other 17" paragraph says
esp.py/mh.pywere "held by #904". That is wrong, and #932's worker traced it back here after I flagged the same error in itsconventions.rstprose.Measured: #904 never touched either file — its file list is
pcapkit/protocols/internet/ipv6.py, theipv6_generic_extset, andtests/protocols/internet/test_mh_unit.py. The PR that genuinely held bothesp.pyandmh.pyis #924 (issue #917,refactor(ipv6): rename IPv6_GenericExt to IPv6_Ext), merged17:13:44Zas93cf940b3.The
#913half is correct — it did holdpcapkit/const/ftp/command.pyandpcapkit/vendor/ftp/command.py, merged13:54:26Zas1f4337e12.The deferral itself was still the right call, so the conclusion does not move — only the attribution. Leaving the body as written and recording the correction here rather than silently editing it, since #921's description carries the same error and cannot be corrected the same way.
refactor(const,protocols): reparent the last seven non-registry enums…
refactor(const,protocols): reparent the last seven non-registry enums…
docs(contributing): split conventions.rst into one file per anchor (#918
docs(contributing): split conventions.rst into one file per anchor (#918