Skip to content

Commit 7cbe8c4

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 27924be commit 7cbe8c4

27 files changed

+62
-83
lines changed

Tests/test_arro3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class DataShape(NamedTuple):
213213
),
214214
)
215215
def test_fromarray(mode: str, data_tp: DataShape, mask: list[int] | None) -> None:
216-
(dtype, elt, elts_per_pixel) = data_tp
216+
dtype, elt, elts_per_pixel = data_tp
217217

218218
ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1]
219219
if dtype == fl_uint8_4_type:
@@ -239,7 +239,7 @@ def test_fromarray(mode: str, data_tp: DataShape, mask: list[int] | None) -> Non
239239
)
240240
@pytest.mark.parametrize("data_tp", (UINT32, INT32))
241241
def test_from_int32array(mode: str, mask: list[int] | None, data_tp: DataShape) -> None:
242-
(dtype, elt, elts_per_pixel) = data_tp
242+
dtype, elt, elts_per_pixel = data_tp
243243

244244
ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1]
245245
arr = Array([elt] * (ct_pixels * elts_per_pixel), type=dtype)

Tests/test_arrow.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_multiblock_l_image() -> None:
6868
img = Image.new("L", size, 128)
6969

7070
with pytest.raises(ValueError):
71-
(schema, arr) = img.__arrow_c_array__()
71+
schema, arr = img.__arrow_c_array__()
7272

7373

7474
def test_multiblock_rgba_image() -> None:
@@ -79,7 +79,7 @@ def test_multiblock_rgba_image() -> None:
7979
img = Image.new("RGBA", size, (128, 127, 126, 125))
8080

8181
with pytest.raises(ValueError):
82-
(schema, arr) = img.__arrow_c_array__()
82+
schema, arr = img.__arrow_c_array__()
8383

8484

8585
def test_multiblock_l_schema() -> None:
@@ -114,7 +114,7 @@ def test_singleblock_l_image() -> None:
114114
img = Image.new("L", size, 128)
115115
assert img.im.isblock()
116116

117-
(schema, arr) = img.__arrow_c_array__()
117+
schema, arr = img.__arrow_c_array__()
118118
assert schema
119119
assert arr
120120

@@ -130,7 +130,7 @@ def test_singleblock_rgba_image() -> None:
130130
img = Image.new("RGBA", size, (128, 127, 126, 125))
131131
assert img.im.isblock()
132132

133-
(schema, arr) = img.__arrow_c_array__()
133+
schema, arr = img.__arrow_c_array__()
134134
assert schema
135135
assert arr
136136
Image.core.set_use_block_allocator(0)

Tests/test_file_gif.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ def test_getdata(monkeypatch: pytest.MonkeyPatch) -> None:
14331433
# with open('Tests/images/gif_header_data.pkl', 'wb') as f:
14341434
# pickle.dump((h, d), f, 1)
14351435
with open("Tests/images/gif_header_data.pkl", "rb") as f:
1436-
(h_target, d_target) = pickle.load(f)
1436+
h_target, d_target = pickle.load(f)
14371437

14381438
assert h == h_target
14391439
assert d == d_target

Tests/test_file_jpeg.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,7 @@ def _n_qtables_helper(n: int, test_file: str) -> None:
590590
assert im2.quantization == {0: bounds_qtable}
591591

592592
# values from wizard.txt in jpeg9-a src package.
593-
standard_l_qtable = [
594-
int(s)
595-
for s in """
593+
standard_l_qtable = [int(s) for s in """
596594
16 11 10 16 24 40 51 61
597595
12 12 14 19 26 58 60 55
598596
14 13 16 24 40 57 69 56
@@ -601,14 +599,9 @@ def _n_qtables_helper(n: int, test_file: str) -> None:
601599
24 35 55 64 81 104 113 92
602600
49 64 78 87 103 121 120 101
603601
72 92 95 98 112 100 103 99
604-
""".split(
605-
None
606-
)
607-
]
602+
""".split(None)]
608603

609-
standard_chrominance_qtable = [
610-
int(s)
611-
for s in """
604+
standard_chrominance_qtable = [int(s) for s in """
612605
17 18 24 47 99 99 99 99
613606
18 21 26 66 99 99 99 99
614607
24 26 56 99 99 99 99 99
@@ -617,10 +610,7 @@ def _n_qtables_helper(n: int, test_file: str) -> None:
617610
99 99 99 99 99 99 99 99
618611
99 99 99 99 99 99 99 99
619612
99 99 99 99 99 99 99 99
620-
""".split(
621-
None
622-
)
623-
]
613+
""".split(None)]
624614

625615
for quality in range(101):
626616
qtable_from_qtable_quality = self.roundtrip(

Tests/test_font_pcf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def test_textsize(request: pytest.FixtureRequest, tmp_path: Path) -> None:
8080
tempname = save_font(request, tmp_path)
8181
font = ImageFont.load(tempname)
8282
for i in range(255):
83-
(ox, oy, dx, dy) = font.getbbox(chr(i))
83+
ox, oy, dx, dy = font.getbbox(chr(i))
8484
assert ox == 0
8585
assert oy == 0
8686
assert dy == 20

Tests/test_font_pcf_charsets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_textsize(
9595
tempname = save_font(request, tmp_path, encoding)
9696
font = ImageFont.load(tempname)
9797
for i in range(255):
98-
(ox, oy, dx, dy) = font.getbbox(bytearray([i]))
98+
ox, oy, dx, dy = font.getbbox(bytearray([i]))
9999
assert ox == 0
100100
assert oy == 0
101101
assert dy == 20

Tests/test_format_hsv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def linear_gradient() -> Image.Image:
2929
im = Image.linear_gradient(mode="L")
3030
im90 = im.rotate(90)
3131

32-
(px, h) = im.size
32+
px, h = im.size
3333

3434
r = Image.new("L", (px * 3, h))
3535
g = r.copy()
@@ -54,7 +54,7 @@ def to_xxx_colorsys(
5454
) -> Image.Image:
5555
# convert the hard way using the library colorsys routines.
5656

57-
(r, g, b) = im.split()
57+
r, g, b = im.split()
5858

5959
conv_func = int_to_float
6060

Tests/test_image_access.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ def test_embeddable(self) -> None:
278278

279279
with open("embed_pil.c", "w", encoding="utf-8") as fh:
280280
home = sys.prefix.replace("\\", "\\\\")
281-
fh.write(
282-
f"""
281+
fh.write(f"""
283282
#include "Python.h"
284283
285284
int main(int argc, char* argv[])
@@ -300,8 +299,7 @@ def test_embeddable(self) -> None:
300299
301300
return 0;
302301
}}
303-
"""
304-
)
302+
""")
305303

306304
objects = compiler.compile(["embed_pil.c"])
307305
compiler.link_executable(objects, "embed_pil")

Tests/test_image_transform.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_palette(self) -> None:
5656

5757
def test_extent(self) -> None:
5858
im = hopper("RGB")
59-
(w, h) = im.size
59+
w, h = im.size
6060
transformed = im.transform(
6161
im.size,
6262
Image.Transform.EXTENT,
@@ -72,7 +72,7 @@ def test_extent(self) -> None:
7272
def test_quad(self) -> None:
7373
# one simple quad transform, equivalent to scale & crop upper left quad
7474
im = hopper("RGB")
75-
(w, h) = im.size
75+
w, h = im.size
7676
transformed = im.transform(
7777
im.size,
7878
Image.Transform.QUAD,
@@ -99,7 +99,7 @@ def test_quad(self) -> None:
9999
)
100100
def test_fill(self, mode: str, expected_pixel: tuple[int, ...]) -> None:
101101
im = hopper(mode)
102-
(w, h) = im.size
102+
w, h = im.size
103103
transformed = im.transform(
104104
im.size,
105105
Image.Transform.EXTENT,
@@ -112,7 +112,7 @@ def test_fill(self, mode: str, expected_pixel: tuple[int, ...]) -> None:
112112
def test_mesh(self) -> None:
113113
# this should be a checkerboard of halfsized hoppers in ul, lr
114114
im = hopper("RGBA")
115-
(w, h) = im.size
115+
w, h = im.size
116116
transformed = im.transform(
117117
im.size,
118118
Image.Transform.MESH,
@@ -174,7 +174,7 @@ def op(im: Image.Image, sz: tuple[int, int]) -> Image.Image:
174174

175175
def test_alpha_premult_transform(self) -> None:
176176
def op(im: Image.Image, sz: tuple[int, int]) -> Image.Image:
177-
(w, h) = im.size
177+
w, h = im.size
178178
return im.transform(
179179
sz, Image.Transform.EXTENT, (0, 0, w, h), Image.Resampling.BILINEAR
180180
)
@@ -216,7 +216,7 @@ def op(im: Image.Image, sz: tuple[int, int]) -> Image.Image:
216216
@pytest.mark.parametrize("mode", ("RGBA", "LA"))
217217
def test_nearest_transform(self, mode: str) -> None:
218218
def op(im: Image.Image, sz: tuple[int, int]) -> Image.Image:
219-
(w, h) = im.size
219+
w, h = im.size
220220
return im.transform(
221221
sz, Image.Transform.EXTENT, (0, 0, w, h), Image.Resampling.NEAREST
222222
)
@@ -255,7 +255,7 @@ def test_missing_method_data(self) -> None:
255255
@pytest.mark.parametrize("resample", (Image.Resampling.BOX, "unknown"))
256256
def test_unknown_resampling_filter(self, resample: Image.Resampling | str) -> None:
257257
with hopper() as im:
258-
(w, h) = im.size
258+
w, h = im.size
259259
with pytest.raises(ValueError):
260260
im.transform((100, 100), Image.Transform.EXTENT, (0, 0, w, h), resample) # type: ignore[arg-type]
261261

Tests/test_imagemorph.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@ def string_to_img(image_string: str) -> Image.Image:
2222
return im
2323

2424

25-
A = string_to_img(
26-
"""
25+
A = string_to_img("""
2726
.......
2827
.......
2928
..111..
3029
..111..
3130
..111..
3231
.......
3332
.......
34-
"""
35-
)
33+
""")
3634

3735

3836
def img_to_string(im: Image.Image) -> str:

0 commit comments

Comments
 (0)