This repository was archived by the owner on Jun 14, 2018. It is now read-only.
Update pyocr to use psm_parameter based on tesseract version#102
Open
ddddavidmartin wants to merge 6 commits intoopenpaperwork:masterfrom
Open
Update pyocr to use psm_parameter based on tesseract version#102ddddavidmartin wants to merge 6 commits intoopenpaperwork:masterfrom
ddddavidmartin wants to merge 6 commits intoopenpaperwork:masterfrom
Conversation
It is a bit more compact and arguably more Pythonic.
…issues. Unfortunately builders.py now imports psm_parameter from tesseract.py, and tesseract.py imports DigitBuilder from builders.py. We could move psm_parameter into util.py, but it needs get_version as well and it is very much tesseract specific. I do not see a great solution for this and keeping the circular import seems the least bad solution. We keep it from breaking the program by using an explicit import of the module [0]. [0] https://stackoverflow.com/a/37126790
In ddfe4dd we used absolute imports to avoid the cicular dependencies between tesseract.py and builders.py to be an issue. For it to work both modules have to use explicit imports.
We are importing from builders.py in tesseract.py, and vice versa. So to avoid it falling over we simply do the import of the psm_parameter only when it is actually needed.
This should not be necessary anymore now that we updated builders.py to only import from tesseract.py when it is actually used.
…eprecated_psm_option_string
Contributor
Author
|
I haven't been able to run the tests other than linting. If you could run those that would be great! :) |
Member
|
I am sorry, you arrived right in the middle of the migration to https://gitlab.gnome.org/ . Can you resubmit your changes on gitlab.gnome.org once the migration is finished please ? |
Member
|
Repository as been migrated as expected here: https://gitlab.gnome.org/World/OpenPaperwork/pyocr |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Let's try again after #100 did not quite work. This should fix #99.
We now
psm_parameterfunction inbuilders.pywhen it is needed; this avoids circular import issues betweenbuilders.pyandtesseract.py. This is not great, but the best/simplest solution I could come up with.Thanks!