|
4 | 4 | import os |
5 | 5 | import sys |
6 | 6 | import warnings |
| 7 | +from types import NoneType |
7 | 8 | # FIXME from ... import wrap |
8 | 9 |
|
9 | 10 | ### printing |
@@ -150,7 +151,7 @@ def __str__(self): |
150 | 151 |
|
151 | 152 | def checktype(value,type_): |
152 | 153 | """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. |
154 | 155 | If the types don't check out, an exception is thrown.""" |
155 | 156 | # True skips any check |
156 | 157 | if type_ is True: |
@@ -245,7 +246,7 @@ def CHK_(x): |
245 | 246 | pass |
246 | 247 | raise CheckError(x,": failed all checks:",[strc(x) for x in checks]) |
247 | 248 | return CHK_ |
248 | | - |
| 249 | + |
249 | 250 |
|
250 | 251 | @makeargcheck("value should be type book or 0/1") |
251 | 252 | def BOOL(x): |
@@ -292,7 +293,7 @@ def AFLOAT(a): |
292 | 293 |
|
293 | 294 | @makeargcheck("array must contain integer values") |
294 | 295 | def AINT(a): |
295 | | - return a.dtype in int_dtypes |
| 296 | + return a.dtype in int_dtypes |
296 | 297 |
|
297 | 298 | @makeargcheck("expected a byte (uint8) array") |
298 | 299 | def ABYTE(a): |
@@ -408,10 +409,10 @@ def SEGMENTATION(a): |
408 | 409 | return isinstance(a,numpy.ndarray) and a.ndim==2 and a.dtype in ['int32','int64'] |
409 | 410 | @makeargcheck("expected a segmentation with white background") |
410 | 411 | def WHITESEG(a): |
411 | | - return numpy.amax(a)==0xffffff |
| 412 | + return numpy.amax(a)==0xffffff |
412 | 413 | @makeargcheck("expected a segmentation with black background") |
413 | 414 | def BLACKSEG(a): |
414 | | - return numpy.amax(a)<0xffffff |
| 415 | + return numpy.amax(a)<0xffffff |
415 | 416 | @makeargcheck("all non-zero pixels in a page segmentation must have a column value >0") |
416 | 417 | def PAGEEXTRA(a): |
417 | 418 | u = numpy.unique(a) |
|
0 commit comments