Repository navigation
Conversation
`patch_psparser()` replaced `PSBaseParser.seek`, `_parse_keyword` and `nexttoken` only when `pdfminer.__version__ <= "20240706"`. The project now requires `pdfminer.six>=20251230`, so the condition is always false: the function runs at import time and does nothing, and the three replacement methods are never installed. Remove `unstructured/patches/` and the import-time call in `pdf.py`. Behavior is unchanged for every supported pdfminer.six version.
This branch has not been deployed
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.
Summary
unstructured/partition/pdf.pycallspatch_psparser()at import time. It replacesPSBaseParser.seek,_parse_keywordandnexttoken, but only when:pyproject.tomlnow requirespdfminer.six>=20251230, <20270000. pdfminer.six versions areYYYYMMDDstrings, so every allowed version compares greater than"20240706"and the condition is always false. The function runs on every import ofpdf.pyand does nothing, and the three replacement methods are never installed. Coverage over the full test suite confirms they never run.This PR removes
unstructured/patches/(its only module waspdfminer.py) and the import and call inpdf.py.Behavior
Unchanged for every supported pdfminer.six version: the code removed was never reached.
Validation
test_unstructured/partition/pdf_imageand the PDF/image cases intest_unstructured/partition/test_auto.pypass (687 passed, 3 skipped).ruff check/ruff format --checkpass.