Fix various pylint warnings in testing/tools/*.py
Remove unused imports, superfluous parenthesis, and fix wrong variable
names.
Change-Id: I5bced8678929275c9f2342da775685915429a9e8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/137893
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/tools/api_check.py b/testing/tools/api_check.py
index bea8845..55d911d 100755
--- a/testing/tools/api_check.py
+++ b/testing/tools/api_check.py
@@ -88,7 +88,7 @@
functions = []
functions_in_file = []
for line in contents:
- if (file_regex.match(line)):
+ if file_regex.match(line):
functions.append(functions_in_file)
functions_in_file = []
match = chk_regex.match(line)
diff --git a/testing/tools/common.py b/testing/tools/common.py
index 80b7815..900e483 100755
--- a/testing/tools/common.py
+++ b/testing/tools/common.py
@@ -4,7 +4,6 @@
# found in the LICENSE file.
import datetime
-import glob
import os
import re
import subprocess
diff --git a/testing/tools/fixup_pdf_template.py b/testing/tools/fixup_pdf_template.py
index 36369ba..eb36392 100755
--- a/testing/tools/fixup_pdf_template.py
+++ b/testing/tools/fixup_pdf_template.py
@@ -159,7 +159,7 @@
for line in preprocessed:
outfile.write(processor.process_line(line))
except IOError:
- print('failed to process %s' % input_path, file=sys.stderr)
+ print('failed to process %s' % infile, file=sys.stderr)
def insert_includes(input_path, output_file, visited_set):
@@ -170,7 +170,7 @@
visited_set.add(input_path)
try:
_, file_extension = os.path.splitext(input_path)
- override_line_endings = (file_extension in EXTENSION_OVERRIDE_LINE_ENDINGS)
+ override_line_endings = file_extension in EXTENSION_OVERRIDE_LINE_ENDINGS
end_of_file_line_ending = False
with open(input_path, 'rb') as infile:
diff --git a/testing/tools/githelper.py b/testing/tools/githelper.py
index 19071b0..4333e6a 100644
--- a/testing/tools/githelper.py
+++ b/testing/tools/githelper.py
@@ -3,8 +3,6 @@
# found in the LICENSE file.
"""Classes for dealing with git."""
-import subprocess
-
from common import RunCommandPropagateErr
diff --git a/testing/tools/pngdiffer.py b/testing/tools/pngdiffer.py
index e61bc68..7411a82 100755
--- a/testing/tools/pngdiffer.py
+++ b/testing/tools/pngdiffer.py
@@ -8,7 +8,6 @@
import os
import shutil
import subprocess
-import sys
EXACT_MATCHING = 'exact'
FUZZY_MATCHING = 'fuzzy'
diff --git a/testing/tools/safetynet_compare.py b/testing/tools/safetynet_compare.py
index 44061ad..a5e4f63 100755
--- a/testing/tools/safetynet_compare.py
+++ b/testing/tools/safetynet_compare.py
@@ -12,11 +12,9 @@
import os
import re
import shutil
-import subprocess
import sys
import tempfile
-from common import GetBooleanGnArg
from common import PrintErr
from common import RunCommandPropagateErr
from githelper import GitHelper