Skip to content

Commit

Permalink
STY: Use startswith (#2969)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-t-1 authored Nov 28, 2024
1 parent bd26922 commit e8cb703
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pypdf/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def _find_eof_marker(self, stream: StreamType) -> None:
HEADER_SIZE = 8 # to parse whole file, Header is e.g. '%PDF-1.6'
line = b""
first = True
while line[:5] != b"%%EOF":
while not line.startswith(b"%%EOF"):
if line != b"" and first:
if any(
line.strip().endswith(tr) for tr in (b"%%EO", b"%%E", b"%%", b"%")
Expand Down Expand Up @@ -737,7 +737,7 @@ def _find_startxref_pos(self, stream: StreamType) -> int:
logger_warning("startxref on same line as offset", __name__)
else:
line = read_previous_line(stream)
if line[:9] != b"startxref":
if not line.startswith(b"startxref"):
raise PdfReadError("startxref not found")
return startxref

Expand Down

0 comments on commit e8cb703

Please sign in to comment.