Skip to content

Commit 69e8592

Browse files
committed
Small cleanups after removing files.
1 parent 57a666e commit 69e8592

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

ocrolib/native.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import os,hashlib
77
from ctypes import c_int,c_float,c_double,c_byte
8+
from numpy.ctypeslib import ndpointer
89
import ctypes
910
import time
1011
import errno
@@ -13,9 +14,9 @@
1314
@contextlib.contextmanager
1415
def lockfile(fname,delay=0.5):
1516
while 1:
16-
try:
17+
try:
1718
fd = os.open(fname,os.O_RDWR|os.O_CREAT|os.O_EXCL)
18-
except OSError as e:
19+
except OSError as e:
1920
if e.errno!=errno.EEXIST: raise
2021
time.sleep(delay)
2122
continue

ocrolib/toplevel.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import sys
66
import warnings
7+
from types import NoneType
78
# FIXME from ... import wrap
89

910
### printing
@@ -150,7 +151,7 @@ def __str__(self):
150151

151152
def checktype(value,type_):
152153
"""Check value against the type spec. If everything
153-
is OK, this just returns the value itself.
154+
is OK, this just returns the value itself.
154155
If the types don't check out, an exception is thrown."""
155156
# True skips any check
156157
if type_ is True:
@@ -245,7 +246,7 @@ def CHK_(x):
245246
pass
246247
raise CheckError(x,": failed all checks:",[strc(x) for x in checks])
247248
return CHK_
248-
249+
249250

250251
@makeargcheck("value should be type book or 0/1")
251252
def BOOL(x):
@@ -292,7 +293,7 @@ def AFLOAT(a):
292293

293294
@makeargcheck("array must contain integer values")
294295
def AINT(a):
295-
return a.dtype in int_dtypes
296+
return a.dtype in int_dtypes
296297

297298
@makeargcheck("expected a byte (uint8) array")
298299
def ABYTE(a):
@@ -408,10 +409,10 @@ def SEGMENTATION(a):
408409
return isinstance(a,numpy.ndarray) and a.ndim==2 and a.dtype in ['int32','int64']
409410
@makeargcheck("expected a segmentation with white background")
410411
def WHITESEG(a):
411-
return numpy.amax(a)==0xffffff
412+
return numpy.amax(a)==0xffffff
412413
@makeargcheck("expected a segmentation with black background")
413414
def BLACKSEG(a):
414-
return numpy.amax(a)<0xffffff
415+
return numpy.amax(a)<0xffffff
415416
@makeargcheck("all non-zero pixels in a page segmentation must have a column value >0")
416417
def PAGEEXTRA(a):
417418
u = numpy.unique(a)

ocropus-visualize-results

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import matplotlib
44
matplotlib.use("AGG")
5-
65
import sys,os,signal
7-
86
from scipy.ndimage import interpolation
97
import pylab
108
from pylab import *
11-
9+
import glob
1210
import ocrolib
1311
from ocrolib import linerec,morph
1412
from scipy.misc import imsave

0 commit comments

Comments
 (0)