summaryrefslogtreecommitdiff
path: root/testing/tools/fixup_pdf_template.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/tools/fixup_pdf_template.py')
-rwxr-xr-xtesting/tools/fixup_pdf_template.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/testing/tools/fixup_pdf_template.py b/testing/tools/fixup_pdf_template.py
index bee7a3d002..0f536785c1 100755
--- a/testing/tools/fixup_pdf_template.py
+++ b/testing/tools/fixup_pdf_template.py
@@ -30,11 +30,15 @@ import os
import re
import sys
+SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
+
+
class StreamLenState:
START = 1
FIND_STREAM = 2
FIND_ENDSTREAM = 3
+
class TemplateProcessor:
HEADER_TOKEN = '{{header}}'
HEADER_REPLACEMENT = '%PDF-1.7\n%\xa0\xf2\xa4\xf4'
@@ -45,7 +49,7 @@ class TemplateProcessor:
XREF_REPLACEMENT_N = '%010d %05d n \n'
XREF_REPLACEMENT_F = '0000000000 65535 f \n'
# XREF rows must be exactly 20 bytes - space required.
- assert(len(XREF_REPLACEMENT_F) == 20)
+ assert len(XREF_REPLACEMENT_F) == 20
TRAILER_TOKEN = '{{trailer}}'
TRAILER_REPLACEMENT = 'trailer <<\n /Root 1 0 R\n /Size %d\n>>'
@@ -230,7 +234,7 @@ class TemplateProcessor:
def preprocess_line(self, line):
if self.STREAMLEN_TOKEN in line:
- assert(self.streamlen_state == StreamLenState.START)
+ assert self.streamlen_state == StreamLenState.START
self.streamlen_state = StreamLenState.FIND_STREAM
self.streamlens.append(0)
return