Repository navigation
refactor(interface): make the registry-entry helpers public in pcapkit.interface.registry (#1519) - #1568
Merged
Conversation
…t.interface.registry (#1519) - `_same_entry`, `_restore_shipped` and `_restore_shipped_dumper` move out of `pcapkit.foundation.extraction` into the new `pcapkit.interface.registry` as `same_entry`, `restore_shipped` and `restore_shipped_dumper`. The bodies are unchanged; the docstrings now state the contract in full. - `extraction.py` imports them at top level, and the lazy import in `TraceFlowBase.register_dumper` now names the new module. - They are not re-exported from `pcapkit.interface` or `pcapkit`, the same as `pcapkit.interface.misc`. - New `docs/source/pcapkit/interface/registry.rst`, added to the interface toctree and table. - `tests/interface/test_registry.py` pins each helper's contract (15 tests).
Owner
Author
|
Verdict: GOOD TO GO at
Non-blocking:
|
2 of 13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeAdded a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseDescription of your pull request and other information
_same_entry,_restore_shippedand_restore_shipped_dumperleavefoundation/extraction.pyfor the newpcapkit/interface/registry.py. Their public names aresame_entry,restore_shippedandrestore_shipped_dumper, and the bodies are unchanged. I named the module after what the helpers operate on, keeping the one-word style ofcoreandmisc.extraction.pyimports the helpers at top level, and its eight call sites use the public names. The lazy import inTraceFlowBase.register_dumpernow points at the new module and stays inside the function. It no longer needs to: hoisting it to top level imports cleanly from every entry point.pcapkit.interfaceorpcapkit. They are registrar plumbing, andpcapkit.interface.miscis not re-exported either.pcapkit.__all__is unchanged.interface/registry.rstpage, listed in the interface toctree and table.tests/interface/test_registry.pyhas 15 tests and all 15 fail onorigin/main(module missing). Five mutations of the helpers, such as an asymmetricsame_entry, a dropped silent no-op, or a subscript lookup on adefaultdict, are each caught. Coverage ofregistry.pyis 100% of lines and branches. With thetraceflow.pyedit reverted, 2 tests intest_restore_builtin_unit.pyfail withImportError.Closes #1519