PPF-1707: Add a __repr__ method to the Widget base class#1712
Open
annaswims wants to merge 1 commit intochinapandaman:masterfrom
Open
PPF-1707: Add a __repr__ method to the Widget base class#1712annaswims wants to merge 1 commit intochinapandaman:masterfrom
annaswims wants to merge 1 commit intochinapandaman:masterfrom
Conversation
Widget.__repr__ now renders the class name, name, value, and all non-None public attributes, omitting internal bookkeeping fields. Documents the .widgets dict in inspect.md and adds tests covering repr output for Text, Checkbox, attribute filtering, and size propagation.
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.
All Submissions:
New Feature Submissions:
Changes to Core Features:
What this PR does
#1711
Adds
__repr__to theWidgetbase class (middleware/base.py) so that widgets render meaningfully when inspected. The output includes the class name,name,value, and all non-Nonepublic attributes, while omitting internal bookkeeping fields (SET_ATTR_TRIGGER_HOOK_MAP,attr_set_tracker,hooks_to_trigger) and_-prefixed private attributes.Before:
After:
Changes
PyPDFForm/lib/middleware/base.py— added__repr__toWidgetdocs/inspect.md— new "Inspect individual form field widgets" section documentingpdf.widgetsdocs/index.md— addedpprint(pdf.widgets)to the quick-look exampletests/test_extract_middleware_attributes.py— six new tests coveringTextandCheckboxrepr output, attribute filtering, size propagation, and per-widget repr across a real PDF