-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup imports in common.py, lstm.py, extract exceptions #154
Conversation
kba
commented
Nov 15, 2016
- Move exceptions to its own module
- Make all imports explicit, so static code analysis tools like pyflakes can help
- remove redundant deprecated decorators
- Remove old load_components
- Remove old draw_pseg/draw_aligned
They haven't been in use for a while and not working currently
Neither is used and there is another implementation in toplevel.py
Obsolete now and won't work with current codebase
import cPickle | ||
from ocrolib.exceptions import (BadClassLabel, BadInput, FileNotFound, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should move down to third block (first-party imports).
import pylab | ||
from pylab import imshow | ||
from scipy.ndimage import morphology,measurements | ||
from pylab import (clf, cm, ginput, gray, imshow, ion, subplot, where) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got a branch that removes pylab
imports; should I open a PR for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean https://github.com/QuLogic/ocropy/commits/standard-import? Sure, open a PR with the pertinent commits, looks really helpful, I'll happily merge/cherry-pick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's the one; though I just noticed that it's based on the Python 3 work, so it'll be a pain to cherry-pick. Should get that in ASAP and then the rest would be easier.
|
||
import numpy | ||
from numpy import * | ||
from numpy import (amax, amin, array, bitwise_and, clip, dtype, mean, minimum, | ||
nan, ndarray, sin, sqrt, zeros) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The branch also standardizes these imports too...
(See below comment.)
import PIL | ||
|
||
from default import getlocal | ||
from toplevel import * | ||
from toplevel import (checks, ABINARY2, AINT2, AINT3, BOOL, DARKSEG, GRAYSCALE, | ||
LIGHTSEG, LINESEG, PAGESEG) | ||
import chars | ||
import codecs | ||
import ligatures | ||
import lstm | ||
import morph | ||
import multiprocessing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should move up to first block (standard library imports).
I see that the exceptions are deleted in |