Sort imports with isort

This commit is contained in:
James R. Barlow
2018-12-30 01:28:15 -08:00
parent 06308a22ce
commit 0880b16491
38 changed files with 176 additions and 172 deletions
+4 -3
View File
@@ -15,14 +15,15 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
import sys
import os
import platform
import sys
from pathlib import Path
from subprocess import Popen, PIPE
from subprocess import PIPE, Popen
import pytest
pytest_plugins = ['helpers_namespace']
import pytest
try:
from pytest_cov.embed import cleanup_on_sigterm
+2 -1
View File
@@ -21,10 +21,11 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import sys
import os
import sys
from subprocess import check_call
"""Replicate one type of Ghostscript feature elision warning during
PDF/A creation."""
+2 -1
View File
@@ -20,8 +20,9 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import sys
import os
import sys
"""Replicate Ghostscript PDF/A conversion failure by suppressing some
arguments"""
+1 -1
View File
@@ -21,8 +21,8 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import sys
import os
import sys
"""Replicate Ghostscript raster failure while allowing rendering"""
+1 -1
View File
@@ -22,8 +22,8 @@
"""Replicate Ghostscript render failure while allowing rasterizing"""
import sys
import os
import sys
def real_ghostscript(argv):
+1 -1
View File
@@ -21,10 +21,10 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import sys
import img2pdf
from PIL import Image
"""Tesseract bad utf8 spoof
In 'hocr' mode or 'pdf' mode, return error code 1 and some non-Unicode
-1
View File
@@ -23,7 +23,6 @@
import sys
VERSION_STRING = '''tesseract 4.0.0
leptonica-1.77.0
libjpeg 9c : libpng 1.6.35 : libtiff 4.0.10 : zlib 1.2.11 : libopenjp2 2.3.0
+5 -5
View File
@@ -49,15 +49,15 @@ Assumes Tesseract 4.0.0-alpha or higher.
"""
from pathlib import Path
import sys
import os
import shutil
import subprocess
import argparse
import json
import os
import platform
import re
import shutil
import subprocess
import sys
from pathlib import Path
if '_OCRMYPDF_SAVE_PATH' in os.environ:
os.environ['PATH'] = os.environ['_OCRMYPDF_SAVE_PATH']
+1 -2
View File
@@ -20,10 +20,9 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import sys
import os
import signal
import sys
VERSION_STRING = '''tesseract 4.0.0
leptonica-1.77.0
+1 -1
View File
@@ -32,11 +32,11 @@ In orientation check mode, report the orientation is upright.
"""
import sys
import img2pdf
import PyPDF2 as pypdf
from PIL import Image
VERSION_STRING = '''tesseract 4.0.0
leptonica-1.77.0
libjpeg 9c : libpng 1.6.35 : libtiff 4.0.10 : zlib 1.2.11 : libopenjp2 2.3.0
+6 -4
View File
@@ -15,12 +15,14 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
from ocrmypdf import hocrtransform
from ocrmypdf.exec.tesseract import HOCR_TEMPLATE
from ocrmypdf.exec import qpdf
from PIL import Image
from pathlib import Path
import pytest
from PIL import Image
from ocrmypdf import hocrtransform
from ocrmypdf.exec import qpdf
from ocrmypdf.exec.tesseract import HOCR_TEMPLATE
# pylint: disable=redefined-outer-name
+7 -7
View File
@@ -15,23 +15,23 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
from subprocess import Popen, PIPE, DEVNULL
from pathlib import Path
from math import isclose
import logging
import os
import shutil
import sys
import logging
from math import isclose
from pathlib import Path
from subprocess import DEVNULL, PIPE, Popen
from PIL import Image
import PIL
import pytest
from PIL import Image
from ocrmypdf.pdfinfo import PdfInfo, Colorspace, Encoding
from ocrmypdf.exceptions import ExitCode, MissingDependencyError
from ocrmypdf.exec import ghostscript, qpdf, tesseract
from ocrmypdf.pdfa import file_claims_pdfa
from ocrmypdf.leptonica import Pix
from ocrmypdf.pdfa import file_claims_pdfa
from ocrmypdf.pdfinfo import Colorspace, Encoding, PdfInfo
# pytest.helpers is dynamic
# pylint: disable=no-member,redefined-outer-name
+7 -8
View File
@@ -16,21 +16,20 @@
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
import pytest
import datetime
from datetime import timezone
from os import fspath
from pathlib import Path
from shutil import copyfile
from unittest.mock import patch, MagicMock
import datetime
from os import fspath
from unittest.mock import MagicMock, patch
import pytest
import pikepdf
from pikepdf.models.metadata import decode_pdf_date
from ocrmypdf.exceptions import ExitCode
from ocrmypdf.pdfa import file_claims_pdfa, generate_pdfa_ps, SRGB_ICC_PROFILE
from ocrmypdf.exec import ghostscript
from ocrmypdf.pdfa import SRGB_ICC_PROFILE, file_claims_pdfa, generate_pdfa_ps
from pikepdf.models.metadata import decode_pdf_date
try:
import fitz
+3 -2
View File
@@ -14,11 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
from ocrmypdf.pdfinfo import PdfInfo, PageInfo
from ocrmypdf._jobcontext import JobContext, JobContextManager
from multiprocessing import Process
from multiprocessing.managers import BaseProxy
from ocrmypdf._jobcontext import JobContext, JobContextManager
from ocrmypdf.pdfinfo import PageInfo, PdfInfo
def test_jobcontext_proxy(resources):
# Prove that managers are set up correctly to share state among processes
+3 -6
View File
@@ -15,20 +15,17 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
from pathlib import Path
import logging
from os import fspath
from pathlib import Path
import pytest
import logging
from PIL import Image
import pikepdf
from ocrmypdf import optimize as opt
from ocrmypdf.exec.ghostscript import rasterize_pdf
from ocrmypdf.exec import jbig2enc, pngquant
from ocrmypdf.exec.ghostscript import rasterize_pdf
check_ocrmypdf = pytest.helpers.check_ocrmypdf
+14 -12
View File
@@ -15,20 +15,22 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
from ocrmypdf import pdfinfo
from reportlab.pdfgen.canvas import Canvas
from PIL import Image
from tempfile import NamedTemporaryFile
from math import isclose
from ocrmypdf.pdfinfo import Colorspace, Encoding
from contextlib import suppress
import os
import shutil
import pytest
import img2pdf
import sys
import pikepdf
import pickle
import shutil
import sys
from contextlib import suppress
from math import isclose
from tempfile import NamedTemporaryFile
import img2pdf
import pytest
from PIL import Image
from reportlab.pdfgen.canvas import Canvas
import pikepdf
from ocrmypdf import pdfinfo
from ocrmypdf.pdfinfo import Colorspace, Encoding
def test_single_page_text(outdir):
+5 -6
View File
@@ -17,18 +17,17 @@
import logging
from io import BytesIO
from unittest.mock import Mock
from os import fspath
from unittest.mock import Mock
from PIL import Image
import pytest
import img2pdf
import pytest
from PIL import Image
import pikepdf
from ocrmypdf import leptonica
from ocrmypdf.pdfinfo import PdfInfo
from ocrmypdf.exec import ghostscript, tesseract
from ocrmypdf.pdfinfo import PdfInfo
# pytest.helpers is dynamic
# pylint: disable=no-member
+2 -2
View File
@@ -15,10 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
from os import fspath
import sys
import os
import sys
from contextlib import contextmanager
from os import fspath
from pathlib import Path
import PyPDF2 as pypdf
+2
View File
@@ -16,7 +16,9 @@
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
from pathlib import Path
import pytest
from ocrmypdf.exceptions import ExitCode
# pytest.helpers is dynamic
+10 -9
View File
@@ -15,19 +15,20 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
from subprocess import Popen, PIPE, check_output, check_call, DEVNULL
import logging
import os
import shutil
import pytest
from ocrmypdf.pdfinfo import PdfInfo, Colorspace, Encoding
import PyPDF2 as pypdf
from ocrmypdf.exceptions import ExitCode
from ocrmypdf import leptonica
from ocrmypdf.pdfa import file_claims_pdfa
from ocrmypdf.exec import ghostscript
import logging
from math import isclose
from subprocess import DEVNULL, PIPE, Popen, check_call, check_output
import PyPDF2 as pypdf
import pytest
from ocrmypdf import leptonica
from ocrmypdf.exceptions import ExitCode
from ocrmypdf.exec import ghostscript
from ocrmypdf.pdfa import file_claims_pdfa
from ocrmypdf.pdfinfo import Colorspace, Encoding, PdfInfo
check_ocrmypdf = pytest.helpers.check_ocrmypdf
run_ocrmypdf = pytest.helpers.run_ocrmypdf