Additional ruff fixes

This commit is contained in:
James R. Barlow
2023-04-14 01:25:16 -07:00
parent 1d0e4e7c9f
commit 4924b11b6b
21 changed files with 113 additions and 22 deletions
@@ -54,6 +54,7 @@ def log_listener(q: Queue):
def process_sigbus(*args):
"""Handle SIGBUS signal at the worker level."""
raise InputFileError("A worker process lost access to an input file")
@@ -80,6 +81,7 @@ def process_init(q: Queue, user_init: UserInit, loglevel) -> None:
def thread_init(q: Queue, user_init: UserInit, loglevel) -> None:
"""Begin a thread pool worker."""
del q # unused but required argument
del loglevel # unused but required argument
# As a thread, block SIGBUS so the main thread deals with it...
@@ -162,14 +164,17 @@ class StandardExecutor(Executor):
@hookimpl
def get_executor(progressbar_class):
"""Return the default executor."""
return StandardExecutor(pbar_class=progressbar_class)
@hookimpl
def get_progressbar_class():
"""Return the default progress bar class."""
return tqdm
@hookimpl
def get_logging_console():
"""Return the default logging console handler."""
return logging.StreamHandler(stream=TqdmConsole(sys.stderr))
@@ -16,6 +16,7 @@ log = logging.getLogger(__name__)
@hookimpl
def check_options(options):
"""Check that the options are valid for this plugin."""
check_external_program(
program='gs',
package='ghostscript',
@@ -45,6 +46,7 @@ def rasterize_pdf_page(
rotation,
filter_vector,
):
"""Rasterize a single page of a PDF file using Ghostscript."""
ghostscript.rasterize_pdf(
input_file,
output_file,
@@ -68,6 +70,7 @@ def generate_pdfa(
pdfa_part,
progressbar_class,
):
"""Generate a PDF/A from the list of PDF pages and PDF/A metadata."""
ghostscript.generate_pdfa(
pdf_pages=[*pdf_pages, pdfmark],
output_file=output_file,