Skip to content

refactor(utilities): rename hold_warnings to HoldWarnings #1599

Closed as not planned

Description

@JarryShaw

pcapkit.utilities.warnings.hold_warnings (added in #1588) is a class with a lowercase name. It is the only lowercase class pcapkit defines itself; the other, cached_property at pcapkit/utilities/compat.py:75, is a verbatim stdlib backport. It also needs # pylint: disable=invalid-name at pcapkit/utilities/warnings.py:217. The owner queried the name on #1588.

Change: rename it to HoldWarnings everywhere and drop the pylint disable. It is unreleased (1.5.0 has not shipped), so no alias is needed. References on main (589414eba):

Keep the ContextVar name unless it also embeds the class name.

Activity

  1. added
    refactorRestructuring for its own sake — neither a fix nor a new capability (refactor: prefix)
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 10, 2026
  2. JarryShaw commented on Oct 10, 2026

    @JarryShaw
    OwnerAuthor

    Okay since it's matching it's Stalin counterpart, i say we keep the lower case snake name

  3. JarryShaw commented on Oct 10, 2026

    @JarryShaw
    OwnerAuthor

    Recorded: the owner prefers to keep the lowercase hold_warnings, because it mirrors its stdlib counterpart warnings.catch_warnings. The rename is dropped, #1601 is closed unmerged, and the invalid-name disable stays.

    The #1601 review found one gap that does not depend on the name: the class is public (documented by autoclass and imported by pcapkit/protocols/protocol.py) but missing from pcapkit.utilities.warnings.__all__, which lists warn and every warning class. The stdlib exports catch_warnings the same way, so I've filed #1602 to add 'hold_warnings' to __all__.

  4. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorRestructuring for its own sake — neither a fix nor a new capability (refactor: prefix)

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions