Cleanup unused imports
This commit is contained in:
@@ -8,6 +8,7 @@ tasks.py
|
||||
.ruffus_history.sqlite
|
||||
.idea/
|
||||
.pytest_cache/
|
||||
.pylintrc
|
||||
|
||||
# Package building
|
||||
*.egg-info/
|
||||
|
||||
@@ -22,7 +22,6 @@ from pathlib import Path
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import multiprocessing
|
||||
import atexit
|
||||
import textwrap
|
||||
import logging
|
||||
|
||||
@@ -16,14 +16,13 @@
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from tempfile import NamedTemporaryFile
|
||||
from subprocess import run, PIPE, STDOUT, CalledProcessError
|
||||
from subprocess import run, PIPE, STDOUT
|
||||
from shutil import copy
|
||||
from functools import lru_cache
|
||||
import re
|
||||
import sys
|
||||
from PIL import Image
|
||||
from . import get_version
|
||||
from ..exceptions import SubprocessOutputError, MissingDependencyError
|
||||
from ..exceptions import SubprocessOutputError
|
||||
from ..helpers import fspath
|
||||
|
||||
|
||||
|
||||
@@ -17,15 +17,10 @@
|
||||
|
||||
from subprocess import CalledProcessError, STDOUT, PIPE, run
|
||||
from functools import lru_cache
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import resource
|
||||
|
||||
from ..exceptions import InputFileError, SubprocessOutputError, \
|
||||
MissingDependencyError, EncryptedPdfError
|
||||
EncryptedPdfError
|
||||
from . import get_version
|
||||
from ..helpers import re_symlink
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
|
||||
@@ -17,13 +17,11 @@
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from functools import lru_cache
|
||||
from collections import namedtuple
|
||||
from textwrap import dedent
|
||||
from subprocess import PIPE, CalledProcessError, \
|
||||
TimeoutExpired, check_output, STDOUT
|
||||
from subprocess import CalledProcessError, TimeoutExpired, check_output, STDOUT
|
||||
from contextlib import suppress
|
||||
|
||||
from ..exceptions import MissingDependencyError, TesseractConfigError
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
from functools import partial
|
||||
from collections.abc import Iterable
|
||||
from contextlib import suppress, contextmanager
|
||||
from contextlib import suppress
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import os
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
@@ -31,7 +31,6 @@
|
||||
from reportlab.pdfgen.canvas import Canvas
|
||||
from reportlab.lib.units import inch
|
||||
from xml.etree import ElementTree
|
||||
from PIL import Image
|
||||
from collections import namedtuple
|
||||
from math import atan, sin, cos
|
||||
import re
|
||||
|
||||
@@ -27,9 +27,9 @@ import logging
|
||||
import warnings
|
||||
from tempfile import TemporaryFile
|
||||
from ctypes.util import find_library
|
||||
from .lib._leptonica import ffi
|
||||
from functools import lru_cache
|
||||
from enum import Enum
|
||||
|
||||
from .lib._leptonica import ffi
|
||||
from .helpers import fspath
|
||||
|
||||
lept = ffi.dlopen(find_library('lept'))
|
||||
@@ -635,4 +635,4 @@ if __name__ == '__main__':
|
||||
parser_deskew.set_defaults(func=deskew)
|
||||
|
||||
args = parser.parse_args()
|
||||
args.func(args)
|
||||
args.func(args)
|
||||
|
||||
@@ -16,14 +16,11 @@
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from pathlib import Path
|
||||
from subprocess import CalledProcessError
|
||||
import concurrent.futures
|
||||
from collections import defaultdict, namedtuple
|
||||
import struct
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from io import BytesIO
|
||||
from PIL import Image
|
||||
|
||||
import pikepdf
|
||||
|
||||
@@ -16,17 +16,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 subprocess import Popen, PIPE
|
||||
from decimal import Decimal
|
||||
from math import hypot, isclose
|
||||
import re
|
||||
import sys
|
||||
from collections import namedtuple
|
||||
from collections.abc import MutableMapping, Mapping
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
from enum import Enum
|
||||
from contextlib import contextmanager
|
||||
|
||||
from .exec import ghostscript
|
||||
from .helpers import fspath
|
||||
|
||||
@@ -22,7 +22,6 @@ from datetime import datetime, timezone
|
||||
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
import re
|
||||
|
||||
import img2pdf
|
||||
@@ -32,11 +31,11 @@ from PIL import Image
|
||||
from ruffus import formatter, regex, Pipeline, suffix
|
||||
|
||||
from .hocrtransform import HocrTransform
|
||||
from .pdfinfo import PdfInfo, Encoding, Colorspace
|
||||
from .pdfinfo import PdfInfo, Colorspace
|
||||
from .pdfa import generate_pdfa_ps, encode_pdf_date
|
||||
from .helpers import re_symlink, is_iterable_notstr, page_number, flatten_groups
|
||||
from .exec import ghostscript, tesseract, qpdf
|
||||
from .exceptions import PdfMergeFailedError, UnsupportedImageFormatError, \
|
||||
from .exceptions import UnsupportedImageFormatError, \
|
||||
DpiError, PriorOcrFoundError, InputFileError
|
||||
from . import leptonica
|
||||
from . import PROGRAM_NAME, VERSION
|
||||
|
||||
@@ -20,18 +20,6 @@
|
||||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import argparse
|
||||
import json
|
||||
import platform
|
||||
import re
|
||||
|
||||
|
||||
"""Cache output of tesseract to speed up test suite
|
||||
|
||||
The cache is keyed by an environment variable that slips the input test file
|
||||
@@ -66,6 +54,16 @@ given.
|
||||
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import argparse
|
||||
import json
|
||||
import platform
|
||||
import re
|
||||
|
||||
if '_OCRMYPDF_SAVE_PATH' in os.environ:
|
||||
os.environ['PATH'] = os.environ['_OCRMYPDF_SAVE_PATH']
|
||||
|
||||
|
||||
@@ -20,12 +20,6 @@
|
||||
# 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 img2pdf
|
||||
import PyPDF2 as pypdf
|
||||
from PIL import Image
|
||||
|
||||
|
||||
"""Tesseract no-op spoof
|
||||
|
||||
To quickly run tests where getting OCR output is not necessary.
|
||||
@@ -37,6 +31,11 @@ In 'pdf' mode, convert the image to PDF using another program.
|
||||
In orientation check mode, report the orientation is upright.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import img2pdf
|
||||
import PyPDF2 as pypdf
|
||||
from PIL import Image
|
||||
|
||||
|
||||
VERSION_STRING = '''tesseract 3.05.01
|
||||
leptonica-1.72
|
||||
|
||||
@@ -18,17 +18,11 @@
|
||||
from ocrmypdf import hocrtransform
|
||||
from ocrmypdf.exec.tesseract import HOCR_TEMPLATE
|
||||
from ocrmypdf.exec import qpdf
|
||||
from reportlab.pdfgen.canvas import Canvas
|
||||
from PIL import Image
|
||||
from tempfile import NamedTemporaryFile
|
||||
from contextlib import suppress
|
||||
from pathlib import Path
|
||||
import os
|
||||
import shutil
|
||||
import pytest
|
||||
import img2pdf
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
+1
-2
@@ -34,8 +34,7 @@ from ocrmypdf.pdfa import file_claims_pdfa
|
||||
from ocrmypdf.leptonica import Pix
|
||||
|
||||
# pytest.helpers is dynamic
|
||||
# pylint: disable=no-member
|
||||
# pylint: disable=w0612
|
||||
# pylint: disable=no-member,redefined-outer-name
|
||||
|
||||
check_ocrmypdf = pytest.helpers.check_ocrmypdf
|
||||
run_ocrmypdf = pytest.helpers.run_ocrmypdf
|
||||
|
||||
@@ -19,8 +19,6 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
import pikepdf
|
||||
|
||||
from ocrmypdf import optimize as opt
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user