Repository navigation
Conversation
`hold_warnings`, added in #1588, was the only lowercase class pcapkit defines itself, and needed `# pylint: disable=invalid-name`. Rename it to `HoldWarnings` in `pcapkit/utilities/warnings.py`, its one caller in `pcapkit/protocols/protocol.py`, the two docs pages and #1588's test file, and drop the disable. It has not shipped, so no alias is kept. `HoldWarnings` is documented and imported from another module, so it is public: list it in `pcapkit.utilities.warnings.__all__`, beside `warn`. The `pcapkit_held_warnings` ContextVar and the test's `_HoldNothing` stand-in keep their names: neither embeds the class name. A new test pins that `HoldWarnings` is importable and exported, and that neither `pcapkit.utilities.warnings` nor `pcapkit.protocols.protocol` has a `hold_warnings` attribute.
JarryShaw
force-pushed
the
refactor/1599-hold-warnings-rename
branch
from
October 10, 2026 12:42
5f4a331 to
bfac36b
Compare
Owner
Author
This was referenced Oct 10, 2026
Closed
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
Closes #1599.
Renames
pcapkit.utilities.warnings.hold_warnings(#1588, unreleased) toHoldWarningsand drops its# pylint: disable=invalid-name. No alias, since it has never shipped. Touched:pcapkit/utilities/warnings.py, its one callerpcapkit/protocols/protocol.py,docs/source/pcapkit/utilities/{functools,warnings}.rst, and #1588's test file.HoldWarningsis documented byautoclassand imported from another module, so it is public. It is now listed inpcapkit.utilities.warnings.__all__, besidewarn. It was missing there onmaintoo.pcapkit.utilitiesimports onlywarn, so neitherpcapkitnorpcapkit.allchanges.The
pcapkit_held_warningsContextVar and the test's_HoldNothingstand-in keep their names: neither embeds the class name.New test
test_hold_class_is_named_in_camel_caseassertsHoldWarningsimports and is in__all__, and that neitherpcapkit.utilities.warningsnorpcapkit.protocols.protocolhashold_warnings. It fails in three cases:main:ImportError: cannot import name 'HoldWarnings'hold_warnings = HoldWarningsalias added:AssertionError: True is not false__all__entry:AssertionError: 'HoldWarnings' not found in ['warn', 'BaseWarning', ...]Lint:
pylint pcapkit/utilities/warnings.pygives 10.00/10 without the disable. Onmain's copy with the disable removed, it reportsC0103: Class name "hold_warnings" doesn't conform to PascalCase naming style. isort is clean. mypy reports nothing inwarnings.py.Tests: I ran narrow selections only. They covered #1588's file,
tests/protocols/test_protocol_*_unit.py,tests/test_docstring_contract.py, and thetests/projectdocs and public-API checks. All passed.