fix(uspto): parse proportional and missing CALS colwidth - #3821
Closed
santhreal wants to merge 4 commits into
Closed
fix(uspto): parse proportional and missing CALS colwidth#3821santhreal wants to merge 4 commits into
santhreal wants to merge 4 commits into
Conversation
The USPTO table parser stripped only pt/mm units then cast colwidth to int/float. A proportional width (1*, standard CALS) reached float(1*) and raised ValueError, and a colspec with no colwidth reached re.sub(None) and raised TypeError. Both crashes are caught at the call site, so every affected table is dropped from the output document. Extract the leading numeric magnitude instead, defaulting to 1.0 when the width is absent, so proportional and unit-less tables parse with correct relative offsets rather than being silently lost. Signed-off-by: santhreal <64453045+santhreal@users.noreply.github.com>
Contributor
|
✅ DCO Check Passed Thanks @santhreal, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ceberam
requested changes
Jul 21, 2026
ceberam
left a comment
Member
There was a problem hiding this comment.
Good catch @santhreal ! I've just added a minor styling comment.
Member
|
@santhreal could you fix the DCO? (your last commit was not sign), as well as the conflict with |
…width Signed-off-by: santhreal <64453045+santhreal@users.noreply.github.com> # Conflicts: # tests/test_backend_patent_uspto.py
…y.github.com> I, santhreal <64453045+santhreal@users.noreply.github.com>, hereby add my Signed-off-by to this commit: 82e7e7e Signed-off-by: santhreal <64453045+santhreal@users.noreply.github.com>
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.
The USPTO table parser strips only
pt/mmfromcolwidththen casts to int/float. A proportional width likecolwidth="1*"(standard CALS) reachesfloat("1*")and raisesValueError, and a<colspec>with nocolwidthreachesre.sub("pt", "", None)and raisesTypeError. Both crashes are caught at the call site (XmlTable.parse()is wrapped intry/except Exception), so every affected table is silently dropped from the output document.This extracts the leading numeric magnitude instead, defaulting to
1.0when the width is absent, so proportional and unit-less tables parse with correct relative offsets rather than being lost.Repro against the real backend:
Added
test_table_colwidth_variantscovering proportional, unit-less, and fixed-pt(control) widths.