Skip to content

Commit a2b13cc

Browse files
committed
Call startswith/endswith once with a tuple
1 parent e4cac21 commit a2b13cc

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/PIL/IcnsImagePlugin.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ def read_png_or_jpeg2000(
123123
Image._decompression_bomb_check(im.size)
124124
return {"RGBA": im}
125125
elif (
126-
sig.startswith(b"\xff\x4f\xff\x51")
127-
or sig.startswith(b"\x0d\x0a\x87\x0a")
126+
sig.startswith((b"\xff\x4f\xff\x51", b"\x0d\x0a\x87\x0a"))
128127
or sig == b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a"
129128
):
130129
if not enable_jpeg2k:

src/PIL/TiffImagePlugin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ def _setup(self) -> None:
15841584
# byte order.
15851585
elif rawmode == "I;16":
15861586
rawmode = "I;16N"
1587-
elif rawmode.endswith(";16B") or rawmode.endswith(";16L"):
1587+
elif rawmode.endswith((";16B", ";16L")):
15881588
rawmode = rawmode[:-1] + "N"
15891589

15901590
# Offset in the tile tuple is 0, we go from 0,0 to

0 commit comments

Comments
 (0)