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
{{ message }}
Repository navigation
refactor(corekit): normalise sentinel object names to SCREAMING_SNAKE #937
The four sentinel objects in pcapkit/corekit/sentinels.py carry three different casings, while all four types already follow CamelCase + Type. Normalise the objects to SCREAMING_SNAKE.
take SCREAMING_SNAKE and accept the breaking change (no backport needed). we can change _ABSENT to ABSENT just document it as private type/class in the documentation and not for public use is enough.
No deprecation alias. The break is accepted deliberately — NoValue is in pcapkit.corekit.fields.field.__all__ as of #911, so import * callers are affected.
Blast radius, measured (grep -rnw over pcapkit/ and tests/):
NoValue 109 references across 21 files
NoValueType 55 references across 13 files
_Absent 41 references across 5 files
_AbsentType 26 references across 5 files
plus docs/source/pcapkit/corekit/fields/{field,index,misc}.rst, docs/source/contributing/conventions.rst, and the sentinels.rst page that landed in #936.
Three consequences worth handling explicitly, not incidentally:
Dropping the underscore makes ABSENT/AbsentType look public to tooling. They must stay out of __all__ — test_sentinel_exports_unit.py::test_the_private_sentinel_is_exported_neither_way pins that, and should keep pinning it under the new names. Privacy becomes documentation-only, per the ruling, so Sphinx will now pick them up where _-prefixed names were hidden; decide whether sentinels.rst documents them as explicitly-private or keeps omitting them. docs(corekit): add the sentinels API page so conventions.rst references resolve (#934) #936 omitted _Absentbecause it was underscore-private, so that reasoning needs restating either way.
conventions.rst needs an object-naming rule added.:152 today states only "Keep the sentinel object's type class naming as <SENTINEL>Type" — it governs the type, never the object, which is the gap that let them diverge. The new rule belongs there.
_expected_type_name in test_sentinel_exports_unit.py should collapse. Its bare.isupper() branch and its leading-underscore branch both exist only to cope with the inconsistency; after this, <SENTINEL>Type is one mechanical rule and the helper's special cases become dead.
Blocked on #932, which owns pcapkit/corekit/enum.py (a NO_DEFAULT/sentinel re-export shim), docs/source/contributing/conventions.rst, and tests/protocols/internet/test_mh_unit.py — all three in this change's path. Starts once #932 merges.
The four sentinel objects in
pcapkit/corekit/sentinels.pycarry three different casings, while all four types already follow CamelCase +Type. Normalise the objects to SCREAMING_SNAKE.The owner's ruling, verbatim (from #719):
So:
NoValueNO_VALUE_AbsentABSENT— leading underscore dropped_AbsentTypeAbsentTypeNULL,NO_DEFAULT,NullType,NoValueType,NoDefaultTypeNo deprecation alias. The break is accepted deliberately —
NoValueis inpcapkit.corekit.fields.field.__all__as of #911, soimport *callers are affected.Blast radius, measured (
grep -rnwoverpcapkit/andtests/):plus
docs/source/pcapkit/corekit/fields/{field,index,misc}.rst,docs/source/contributing/conventions.rst, and thesentinels.rstpage that landed in #936.Three consequences worth handling explicitly, not incidentally:
ABSENT/AbsentTypelook public to tooling. They must stay out of__all__—test_sentinel_exports_unit.py::test_the_private_sentinel_is_exported_neither_waypins that, and should keep pinning it under the new names. Privacy becomes documentation-only, per the ruling, so Sphinx will now pick them up where_-prefixed names were hidden; decide whethersentinels.rstdocuments them as explicitly-private or keeps omitting them. docs(corekit): add the sentinels API page so conventions.rst references resolve (#934) #936 omitted_Absentbecause it was underscore-private, so that reasoning needs restating either way.conventions.rstneeds an object-naming rule added.:152today states only "Keep the sentinel object's type class naming as<SENTINEL>Type" — it governs the type, never the object, which is the gap that let them diverge. The new rule belongs there._expected_type_nameintest_sentinel_exports_unit.pyshould collapse. Itsbare.isupper()branch and its leading-underscore branch both exist only to cope with the inconsistency; after this,<SENTINEL>Typeis one mechanical rule and the helper's special cases become dead.Blocked on #932, which owns
pcapkit/corekit/enum.py(aNO_DEFAULT/sentinel re-export shim),docs/source/contributing/conventions.rst, andtests/protocols/internet/test_mh_unit.py— all three in this change's path. Starts once #932 merges.