Skip to content

Commit 8febdad

Browse files
committed
Review, typos and lint
1 parent fea4196 commit 8febdad

File tree

7 files changed

+18
-13
lines changed

7 files changed

+18
-13
lines changed

Tests/test_file_blp.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from PIL import Image
21
import pytest
32

3+
from PIL import Image
4+
45
from .helper import assert_image_equal_tofile
56

67

Tests/test_file_eps.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import io
2+
23
import pytest
34

45
from PIL import EpsImagePlugin, Image, features
@@ -268,9 +269,7 @@ def test_emptyline():
268269
@pytest.mark.timeout(timeout=5)
269270
@pytest.mark.parametrize(
270271
"test_file",
271-
[
272-
("Tests/images/timeout-d675703545fee17acab56e5fec644c19979175de.eps")
273-
],
272+
["Tests/images/timeout-d675703545fee17acab56e5fec644c19979175de.eps"],
274273
)
275274
def test_timeout(test_file):
276275
with open(test_file, "rb") as f:

Tests/test_file_psd.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,18 @@ def test_combined_larger_than_size():
131131
with Image.open("Tests/images/combined_larger_than_size.psd"):
132132
pass
133133

134+
134135
@pytest.mark.parametrize(
135136
"test_file,raises",
136137
[
137-
("Tests/images/timeout-1ee28a249896e05b83840ae8140622de8e648ba9.psd", Image.UnidentifiedImageError),
138-
("Tests/images/timeout-598843abc37fc080ec36a2699ebbd44f795d3a6f.psd", Image.UnidentifiedImageError),
138+
(
139+
"Tests/images/timeout-1ee28a249896e05b83840ae8140622de8e648ba9.psd",
140+
Image.UnidentifiedImageError,
141+
),
142+
(
143+
"Tests/images/timeout-598843abc37fc080ec36a2699ebbd44f795d3a6f.psd",
144+
Image.UnidentifiedImageError,
145+
),
139146
("Tests/images/timeout-c8efc3fded6426986ba867a399791bae544f59bc.psd", OSError),
140147
("Tests/images/timeout-dedc7a4ebd856d79b4359bbcc79e8ef231ce38f6.psd", OSError),
141148
],

Tests/test_file_tiff.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -625,12 +625,11 @@ def test_close_on_load_nonexclusive(self, tmp_path):
625625
)
626626
def test_string_dimension(self):
627627
# Assert that an error is raised if one of the dimensions is a string
628-
with pytest.raises(OSError):
629-
with Image.open("Tests/images/string_dimension.tiff") as im:
628+
with Image.open("Tests/images/string_dimension.tiff") as im:
629+
with pytest.raises(OSError):
630630
im.load()
631631

632632

633-
634633
@pytest.mark.skipif(not is_win32(), reason="Windows only")
635634
class TestFileTiffW32:
636635
def test_fd_leak(self, tmp_path):

src/PIL/ImageFile.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def _safe_read(fp, size):
547547
:param size: Number of bytes to read.
548548
:returns: A string containing <i>size</i> bytes of data.
549549
550-
Raises an OSError if the file is truncated and the read can not be completed
550+
Raises an OSError if the file is truncated and the read cannot be completed
551551
552552
"""
553553
if size <= 0:
@@ -569,8 +569,6 @@ def _safe_read(fp, size):
569569
return b"".join(data)
570570

571571

572-
573-
574572
class PyCodecState:
575573
def __init__(self):
576574
self.xsize = 0

src/PIL/PsdImagePlugin.py

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def _close__fp(self):
171171
finally:
172172
self.__fp = None
173173

174+
174175
def _layerinfo(fp, ct_bytes):
175176
# read layerinfo block
176177
layers = []

src/libImaging/FliDecode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8 *buf, Py_ssize_t byt
244244
}
245245
advance = I32(ptr);
246246
if (advance == 0 ) {
247-
// If there's no advance, we're in in infinite loop
247+
// If there's no advance, we're in an infinite loop
248248
state->errcode = IMAGING_CODEC_BROKEN;
249249
return -1;
250250
}

0 commit comments

Comments
 (0)