Repository navigation
fix(corekit): export SchemaField, SwitchField, PortEnumField and nested_packet_context (#2174) - #2191
Merged
Merged
Conversation
…ed_packet_context (#2174) fields.misc.__all__ omitted SchemaField and nested_packet_context, fields.strings.__all__ omitted BytesField (dropped by 19b98fc while the package kept exporting it), and the fields package, pcapkit.corekit and pcapkit.all omitted SwitchField and PortEnumField, so import * dropped documented field classes. DeferredPacket.to_dict was annotated as dict, widening Info.to_dict's OrderedMultiDict. Add the field classes to every __all__ that re-lists fields, and nested_packet_context to misc.__all__ only: like packet_byteorder and parse_ip_address it is a helper reached by its module path, not a field. Annotate to_dict as OrderedMultiDict[str, Any]. Test: tests/corekit/test_fields_all_exports_2174_unit.py checks each field submodule's __all__ against the package's in both directions, with written-down exclusions, and the to_dict annotation; it fails on origin/main.
Owner
Author
|
Review: GOOD TO GO at |
5 tasks done
Contributor
|
Coverage: 91.55% (unit tier, Python 3.15,
Per-file detail: the |
Owner
Author
|
Ready to merge at
|
5 tasks done
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.
make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— corrects a defectDescription
Closes #2174.
__all__lists drifted from what they define and re-export:misc.__all__omitsSchemaFieldandnested_packet_context;SwitchFieldandPortEnumFieldare missing fromfields/__init__.py,corekit/__init__.pyandpcapkit.all;strings.__all__lostBytesFieldin19b98fc91, an accident, since the class stayed public and the package kept exporting it.nested_packet_contextstays inmisc.__all__only, like the other field helpers.DeferredPacket.to_dictis annotatedOrderedMultiDict[str, Any], which is what it returns.tests/corekit/test_fields_all_exports_2174_unit.py. Every name inpcapkit.corekit.fields.__all__must be listed by its own defining module, and every listed name must resolve. It records the deliberate non-exports with reasons. Onmainit fails 14 times, e.g.'BytesField' not found in ['_TextField', 'StringField', …].fields/misc.py; all three merge cleanly.