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
protocols(mh): make NTPTimestamp and PMIPv6Timestamp Info classes #1886
Following the owner's ruling on #1869: NTPTimestamp and PMIPv6Timestamp (pcapkit/protocols/internet/mh.py:538, :549) become Info classes, as other nested values in the data models already are. VersionInfo, ModuleDescriptor and TCPSegment stay named tuples.
Breaking.NTPTimestamp has shipped as a tuple since 1.0.1.post2, through every 1.4.x release. PMIPv6Timestamp is beta-only (#437). Once they are Info classes, both lose indexing, unpacking, equality with a plain tuple, hashing, ordering and _replace/_asdict. Attribute access (.seconds, .fraction) and pickling still work. The dumpers will write {"seconds": …, "fraction": …} where they now write {"type": "NTPTimestamp", "value": [s, f]}.
Work:
Convert both classes. Model them on an existing small Info such as hip.Lifetime (protocols/data/internet/hip.py:559).
Rewrite mh.py:8985 (seconds, fraction = option.pmip_timestamp) to use attribute access, and update the tests that unpack or tuple() these values (tests/protocols/internet/test_mh_unit.py:2184, :2190).
Add .. versionchanged:: 1.5.0 on both classes and on docs/source/pcapkit/protocols/internet/mh.rst.
Correct docs/source/changelog/1.5.0.rst:384-386, which says no NamedTuple remains in the package. TCPSegment (toolkit/pcap.py:45) is one.
Test the new behaviour, and the dumper output for both classes.
Activity