Skip to content
This repository has been 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
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ddddavidmartin
Copy link
Contributor

Let's try again after #100 did not quite work. This should fix #99.

We now

  • use the psm parameter based on the tesseract version
  • only import the psm_parameter function in builders.py when it is needed; this avoids circular import issues between builders.py and tesseract.py. This is not great, but the best/simplest solution I could come up with.

Thanks!

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.
@ddddavidmartin
Copy link
Contributor Author

I haven't been able to run the tests other than linting. If you could run those that would be great! :)

@jflesch
Copy link
Member

jflesch commented Jun 13, 2018

I am sorry, you arrived right in the middle of the migration to https://gitlab.gnome.org/ .
The repository is currently at https://gitlab.gnome.org/jflesch/pyocr and will be moved soon to https://gitlab.gnome.org/World/OpenPaperwork/pyocr

Can you resubmit your changes on gitlab.gnome.org once the migration is finished please ?

@jflesch
Copy link
Member

jflesch commented Jun 13, 2018

Repository as been migrated as expected here: https://gitlab.gnome.org/World/OpenPaperwork/pyocr

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants