Pre-release delinting

This commit is contained in:
James R. Barlow
2020-06-09 15:27:14 -07:00
parent fe156db41d
commit 64891c2fc3
22 changed files with 29 additions and 46 deletions
+1 -2
View File
@@ -26,14 +26,13 @@ from ocrmypdf._plugin_manager import get_parser_options_plugins
from ocrmypdf._sync import run_pipeline
from ocrmypdf._validation import check_closed_streams, check_options
from ocrmypdf.api import Verbosity, configure_logging
from ocrmypdf.cli import get_parser, plugins_only_parser
from ocrmypdf.exceptions import BadArgsError, ExitCode, MissingDependencyError
log = logging.getLogger('ocrmypdf')
def run(args=None):
parser, options, plugin_manager = get_parser_options_plugins(args=args)
_parser, options, plugin_manager = get_parser_options_plugins(args=args)
if not check_closed_streams(options):
return ExitCode.bad_args
+1 -3
View File
@@ -21,11 +21,10 @@ import logging
import os
import shutil
from collections import namedtuple
from contextlib import suppress
from os import fspath
from pathlib import Path
from subprocess import PIPE, STDOUT, CalledProcessError, TimeoutExpired
from typing import List, Optional
from typing import List
from PIL import Image
@@ -34,7 +33,6 @@ from ocrmypdf.exceptions import (
SubprocessOutputError,
TesseractConfigError,
)
from ocrmypdf.helpers import safe_symlink
from ocrmypdf.subprocess import get_version, run
log = logging.getLogger(__name__)
+1 -1
View File
@@ -28,7 +28,7 @@ from pikepdf.models.metadata import encode_pdf_date
from PIL import Image, ImageColor, ImageDraw
from ocrmypdf import leptonica
from ocrmypdf._exec import ghostscript, unpaper
from ocrmypdf._exec import unpaper
from ocrmypdf._version import PROGRAM_NAME
from ocrmypdf._version import __version__ as VERSION
from ocrmypdf.exceptions import (
+1 -1
View File
@@ -61,7 +61,7 @@ def get_parser_options_plugins(
plugin_manager = get_plugin_manager(pre_options.plugins)
parser = get_parser()
plugin_manager.hook.add_options(parser=parser)
plugin_manager.hook.add_options(parser=parser) # pylint: disable=no-member
options = parser.parse_args(args=args)
return parser, options, plugin_manager
+1 -2
View File
@@ -15,14 +15,13 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
import inspect
import logging
import os
import sys
from argparse import ArgumentParser
from enum import IntEnum
from pathlib import Path
from typing import Dict, Iterable
from typing import Iterable
from ocrmypdf._logging import PageNumberFilter, TqdmConsole
from ocrmypdf._plugin_manager import get_plugin_manager
@@ -16,13 +16,11 @@
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
import logging
from pathlib import Path
from ocrmypdf import hookimpl
from ocrmypdf._exec import ghostscript
from ocrmypdf._validation import HOCR_OK_LANGS
from ocrmypdf.exceptions import MissingDependencyError
from ocrmypdf.helpers import Resolution
from ocrmypdf.subprocess import check_external_program
log = logging.getLogger(__name__)
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
import argparse
import logging
import os
+2 -2
View File
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
from abc import ABC, abstractstaticmethod
from abc import ABC, abstractmethod, abstractstaticmethod
from argparse import ArgumentParser, Namespace
from collections import namedtuple
from pathlib import Path
@@ -134,7 +134,7 @@ class OcrEngine(ABC):
def creator_tag(options: Namespace) -> str:
"""Returns the creator tag to identify this software's role in creating the PDF."""
@abstractstaticmethod
@abstractmethod
def __str__(self):
"""Returns name of OCR engine and version."""