Skip to content

Commit

Permalink
pageinfo: add a python3.4 implementation of isclose()
Browse files Browse the repository at this point in the history
  • Loading branch information
James R. Barlow committed Oct 28, 2016
1 parent 245f05d commit cab65d1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ocrmypdf/pageinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@

from subprocess import Popen, PIPE
from decimal import Decimal, getcontext
from math import hypot, isclose
from math import hypot
import re
import sys
import PyPDF2 as pypdf
from collections import namedtuple

try:
from math import isclose
except ImportError:
def isclose(a, b, rel_tol=1e-9):
"Python 3.4 does not have math.isclose()"
diff = abs(b - a)
return diff <= abs(rel_tol * b) or diff <= abs(rel_tol * a)

matrix_mult = pypdf.pdf.utils.matrixMultiply

FRIENDLY_COLORSPACE = {
Expand Down

0 comments on commit cab65d1

Please sign in to comment.