fix: restore truncated identifiers and missing imports (NameError in process_document, prepare_dataset, plugin discovery) - #101
Open
Anai-Guo wants to merge 1 commit into
Conversation
Several identifiers lost their final character, and two modules use a stdlib module they never import: - DocumentProcessor.process_document: `documen` / `document.tex` made every call fail (NameError for str input, AttributeError for Document input), which also broke process_file/process_url/process_text. - prepare_dataset in peft_methods.py and unified_peft.py (x2) returned the undefined `tokenized_datase`. - vector_store_enhanced.py used `importlib.util` without importing it, so every plugin in discover_plugins was logged as a failed load. - document_loader.py used `io.BytesIO` for PDFs loaded from URLs without importing `io`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What does this PR do?
Fixes a handful of identifiers that lost their last character, plus two missing stdlib imports. Each one makes the affected code path fail at runtime.
multimind/document_processing/document.pytext = documen/text = document.texDocumentProcessor.process_documentalways raises (NameErrorforstrinput,AttributeErrorforDocumentinput), soprocess_file/process_text/process_urlfail toomultimind/fine_tuning/peft_methods.pyreturn tokenized_dataseprepare_datasetraisesNameErrormultimind/fine_tuning/unified_peft.py(2脳)return tokenized_datasemultimind/vector_store/vector_store_enhanced.pyimportlib.utilused, never importedNameErroris caught by theexcept, so every plugin indiscover_pluginsgets logged as a failed loadmultimind/document_loader/document_loader.pyio.BytesIOused, never importedNameErrorAll of these were flagged by
pyflakesasundefined name. The repo's ruff config doesn't catch them because it doesn't enable F821.Before / after
Before:
After:
Checklist
ruff checkon the changed files: no new findings馃 Generated with Claude Code