diff --git a/src/ocrmypdf/exec/ghostscript.py b/src/ocrmypdf/exec/ghostscript.py
index 14a1332a..44fed271 100644
--- a/src/ocrmypdf/exec/ghostscript.py
+++ b/src/ocrmypdf/exec/ghostscript.py
@@ -15,8 +15,11 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see .
+"""Interface to Ghostscript executable"""
+
import logging
import re
+import warnings
from functools import lru_cache
from os import fspath
from shutil import copy
@@ -193,7 +196,7 @@ def generate_pdfa(
output_file,
compression,
log,
- threads=1,
+ threads=None, # deprecated parameter
pdf_version='1.5',
pdfa_part='2',
):
@@ -216,6 +219,10 @@ def generate_pdfa(
"""
if not log:
log = gslog
+ if threads is not None:
+ warnings.warn(
+ "use of deprecated parameter 'threads'", category=DeprecationWarning
+ )
compression_args = []
if compression == 'jpeg':
diff --git a/src/ocrmypdf/exec/jbig2enc.py b/src/ocrmypdf/exec/jbig2enc.py
index 696c899c..dff450c8 100644
--- a/src/ocrmypdf/exec/jbig2enc.py
+++ b/src/ocrmypdf/exec/jbig2enc.py
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see .
+"""Interface to jbig2 executable"""
+
from functools import lru_cache
from subprocess import PIPE, run
diff --git a/src/ocrmypdf/exec/pngquant.py b/src/ocrmypdf/exec/pngquant.py
index 5dbe5b64..17721065 100644
--- a/src/ocrmypdf/exec/pngquant.py
+++ b/src/ocrmypdf/exec/pngquant.py
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see .
+"""Interface to pngquant executable"""
+
from functools import lru_cache
from subprocess import run
from tempfile import NamedTemporaryFile
diff --git a/src/ocrmypdf/exec/qpdf.py b/src/ocrmypdf/exec/qpdf.py
index 653cc4ff..e96848c0 100644
--- a/src/ocrmypdf/exec/qpdf.py
+++ b/src/ocrmypdf/exec/qpdf.py
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see .
+"""Interface to qpdf executable"""
+
from functools import lru_cache
from os import fspath
from subprocess import PIPE, STDOUT, CalledProcessError, run
diff --git a/src/ocrmypdf/exec/tesseract.py b/src/ocrmypdf/exec/tesseract.py
index 0b9dcaf3..f6b13d59 100644
--- a/src/ocrmypdf/exec/tesseract.py
+++ b/src/ocrmypdf/exec/tesseract.py
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see .
+"""Interface to Tesseract executable"""
+
import os
import shutil
from collections import namedtuple
diff --git a/src/ocrmypdf/exec/unpaper.py b/src/ocrmypdf/exec/unpaper.py
index e186dea8..4515a33f 100644
--- a/src/ocrmypdf/exec/unpaper.py
+++ b/src/ocrmypdf/exec/unpaper.py
@@ -18,10 +18,11 @@
# unpaper documentation:
# https://github.com/Flameeyes/unpaper/blob/master/doc/basic-concepts.md
+"""Interface to unpaper executable"""
+
import os
import shlex
import subprocess
-import sys
from functools import lru_cache
from subprocess import PIPE, STDOUT, CalledProcessError
from tempfile import TemporaryDirectory
diff --git a/src/ocrmypdf/pdfa.py b/src/ocrmypdf/pdfa.py
index 5f2a192e..617da444 100644
--- a/src/ocrmypdf/pdfa.py
+++ b/src/ocrmypdf/pdfa.py
@@ -32,8 +32,6 @@ Ghostscript's handling of pdfmark.
"""
import base64
-import os
-from binascii import hexlify
from pathlib import Path
from string import Template
diff --git a/tests/test_validation.py b/tests/test_validation.py
index 1c9bc1bc..78181e41 100644
--- a/tests/test_validation.py
+++ b/tests/test_validation.py
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see .
-import locale
import logging
import os
from unittest.mock import patch