Skip to content

Commit 7de1212

Browse files
authored
Merge branch 'main' into libavif-plugin
2 parents 4508f37 + b57b4e5 commit 7de1212

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+300
-294
lines changed

.github/workflows/test-mingw.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
mingw-w64-x86_64-ghostscript \
6262
mingw-w64-x86_64-lcms2 \
6363
mingw-w64-x86_64-libavif \
64-
mingw-w64-x86_64-libimagequant \
6564
mingw-w64-x86_64-libjpeg-turbo \
6665
mingw-w64-x86_64-libraqm \
6766
mingw-w64-x86_64-libtiff \

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.8.6
3+
rev: v0.9.4
44
hooks:
55
- id: ruff
66
args: [--exit-non-zero-on-fix]
77

88
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 24.10.0
9+
rev: 25.1.0
1010
hooks:
1111
- id: black
1212

1313
- repo: https://github.com/PyCQA/bandit
14-
rev: 1.8.0
14+
rev: 1.8.2
1515
hooks:
1616
- id: bandit
1717
args: [--severity-level=high]
@@ -24,7 +24,7 @@ repos:
2424
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.gd$|\.opt$)
2525

2626
- repo: https://github.com/pre-commit/mirrors-clang-format
27-
rev: v19.1.6
27+
rev: v19.1.7
2828
hooks:
2929
- id: clang-format
3030
types: [c]
@@ -50,14 +50,14 @@ repos:
5050
exclude: ^.github/.*TEMPLATE|^Tests/(fonts|images)/
5151

5252
- repo: https://github.com/python-jsonschema/check-jsonschema
53-
rev: 0.30.0
53+
rev: 0.31.1
5454
hooks:
5555
- id: check-github-workflows
5656
- id: check-readthedocs
5757
- id: check-renovate
5858

5959
- repo: https://github.com/woodruffw/zizmor-pre-commit
60-
rev: v1.0.0
60+
rev: v1.3.0
6161
hooks:
6262
- id: zizmor
6363

@@ -78,7 +78,7 @@ repos:
7878
additional_dependencies: [trove-classifiers>=2024.10.12]
7979

8080
- repo: https://github.com/tox-dev/tox-ini-fmt
81-
rev: 1.4.1
81+
rev: 1.5.0
8282
hooks:
8383
- id: tox-ini-fmt
8484

3.17 KB
Loading

Tests/test_color_lut.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class TestColorLut3DCoreAPI:
2020
def generate_identity_table(
2121
self, channels: int, size: int | tuple[int, int, int]
22-
) -> tuple[int, int, int, int, list[float]]:
22+
) -> tuple[int, tuple[int, int, int], list[float]]:
2323
if isinstance(size, tuple):
2424
size_1d, size_2d, size_3d = size
2525
else:
@@ -39,9 +39,7 @@ def generate_identity_table(
3939
]
4040
return (
4141
channels,
42-
size_1d,
43-
size_2d,
44-
size_3d,
42+
(size_1d, size_2d, size_3d),
4543
[item for sublist in table for item in sublist],
4644
)
4745

@@ -89,21 +87,21 @@ def test_wrong_args(self) -> None:
8987

9088
with pytest.raises(ValueError, match=r"size1D \* size2D \* size3D"):
9189
im.im.color_lut_3d(
92-
"RGB", Image.Resampling.BILINEAR, 3, 2, 2, 2, [0, 0, 0] * 7
90+
"RGB", Image.Resampling.BILINEAR, 3, (2, 2, 2), [0, 0, 0] * 7
9391
)
9492

9593
with pytest.raises(ValueError, match=r"size1D \* size2D \* size3D"):
9694
im.im.color_lut_3d(
97-
"RGB", Image.Resampling.BILINEAR, 3, 2, 2, 2, [0, 0, 0] * 9
95+
"RGB", Image.Resampling.BILINEAR, 3, (2, 2, 2), [0, 0, 0] * 9
9896
)
9997

10098
with pytest.raises(TypeError):
10199
im.im.color_lut_3d(
102-
"RGB", Image.Resampling.BILINEAR, 3, 2, 2, 2, [0, 0, "0"] * 8
100+
"RGB", Image.Resampling.BILINEAR, 3, (2, 2, 2), [0, 0, "0"] * 8
103101
)
104102

105103
with pytest.raises(TypeError):
106-
im.im.color_lut_3d("RGB", Image.Resampling.BILINEAR, 3, 2, 2, 2, 16)
104+
im.im.color_lut_3d("RGB", Image.Resampling.BILINEAR, 3, (2, 2, 2), 16)
107105

108106
@pytest.mark.parametrize(
109107
"lut_mode, table_channels, table_size",
@@ -264,7 +262,7 @@ def test_channels_order(self) -> None:
264262
assert_image_equal(
265263
Image.merge('RGB', im.split()[::-1]),
266264
im._new(im.im.color_lut_3d('RGB', Image.Resampling.BILINEAR,
267-
3, 2, 2, 2, [
265+
3, (2, 2, 2), [
268266
0, 0, 0, 0, 0, 1,
269267
0, 1, 0, 0, 1, 1,
270268

@@ -286,7 +284,7 @@ def test_overflow(self) -> None:
286284

287285
# fmt: off
288286
transformed = im._new(im.im.color_lut_3d('RGB', Image.Resampling.BILINEAR,
289-
3, 2, 2, 2,
287+
3, (2, 2, 2),
290288
[
291289
-1, -1, -1, 2, -1, -1,
292290
-1, 2, -1, 2, 2, -1,
@@ -307,7 +305,7 @@ def test_overflow(self) -> None:
307305

308306
# fmt: off
309307
transformed = im._new(im.im.color_lut_3d('RGB', Image.Resampling.BILINEAR,
310-
3, 2, 2, 2,
308+
3, (2, 2, 2),
311309
[
312310
-3, -3, -3, 5, -3, -3,
313311
-3, 5, -3, 5, 5, -3,

Tests/test_file_gif.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ def test_invalid_file() -> None:
8686
def test_l_mode_transparency() -> None:
8787
with Image.open("Tests/images/no_palette_with_transparency.gif") as im:
8888
assert im.mode == "L"
89-
assert im.load()[0, 0] == 128
89+
assert im.getpixel((0, 0)) == 128
9090
assert im.info["transparency"] == 255
9191

9292
im.seek(1)
9393
assert im.mode == "L"
94-
assert im.load()[0, 0] == 128
94+
assert im.getpixel((0, 0)) == 128
9595

9696

9797
def test_l_mode_after_rgb() -> None:
@@ -311,18 +311,18 @@ def test_loading_multiple_palettes(path: str, mode: str) -> None:
311311
with Image.open(path) as im:
312312
assert im.mode == "P"
313313
first_frame_colors = im.palette.colors.keys()
314-
original_color = im.convert("RGB").load()[0, 0]
314+
original_color = im.convert("RGB").getpixel((0, 0))
315315

316316
im.seek(1)
317317
assert im.mode == mode
318318
if mode == "RGBA":
319319
im = im.convert("RGB")
320320

321321
# Check a color only from the old palette
322-
assert im.load()[0, 0] == original_color
322+
assert im.getpixel((0, 0)) == original_color
323323

324324
# Check a color from the new palette
325-
assert im.load()[24, 24] not in first_frame_colors
325+
assert im.getpixel((24, 24)) not in first_frame_colors
326326

327327

328328
def test_headers_saving_for_animated_gifs(tmp_path: Path) -> None:
@@ -488,8 +488,7 @@ def test_eoferror() -> None:
488488

489489
def test_first_frame_transparency() -> None:
490490
with Image.open("Tests/images/first_frame_transparency.gif") as im:
491-
px = im.load()
492-
assert px[0, 0] == im.info["transparency"]
491+
assert im.getpixel((0, 0)) == im.info["transparency"]
493492

494493

495494
def test_dispose_none() -> None:

Tests/test_file_jpeg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ def test_icc_after_SOF(self) -> None:
934934

935935
def test_jpeg_magic_number(self, monkeypatch: pytest.MonkeyPatch) -> None:
936936
size = 4097
937-
buffer = BytesIO(b"\xFF" * size) # Many xFF bytes
937+
buffer = BytesIO(b"\xff" * size) # Many xff bytes
938938
max_pos = 0
939939
orig_read = buffer.read
940940

Tests/test_file_libtiff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ class Tc(NamedTuple):
309309
}
310310

311311
def check_tags(
312-
tiffinfo: TiffImagePlugin.ImageFileDirectory_v2 | dict[int, str]
312+
tiffinfo: TiffImagePlugin.ImageFileDirectory_v2 | dict[int, str],
313313
) -> None:
314314
im = hopper()
315315

Tests/test_file_pdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def test_pdf_append(tmp_path: Path) -> None:
264264
# append some info
265265
pdf.info.Title = "abc"
266266
pdf.info.Author = "def"
267-
pdf.info.Subject = "ghi\uABCD"
267+
pdf.info.Subject = "ghi\uabcd"
268268
pdf.info.Keywords = "qw)e\\r(ty"
269269
pdf.info.Creator = "hopper()"
270270
pdf.start_writing()
@@ -292,7 +292,7 @@ def test_pdf_append(tmp_path: Path) -> None:
292292
assert pdf.info.Title == "abc"
293293
assert pdf.info.Producer == "PdfParser"
294294
assert pdf.info.Keywords == "qw)e\\r(ty"
295-
assert pdf.info.Subject == "ghi\uABCD"
295+
assert pdf.info.Subject == "ghi\uabcd"
296296
assert b"CreationDate" in pdf.info
297297
assert b"ModDate" in pdf.info
298298
check_pdf_pages_consistency(pdf)

Tests/test_file_ppm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_sanity() -> None:
4949
(b"P5 3 1 257 \x00\x00\x00\x80\x01\x01", "I", (0, 32640, 65535)),
5050
# P6 with maxval < 255
5151
(
52-
b"P6 3 1 17 \x00\x01\x02\x08\x09\x0A\x0F\x10\x11",
52+
b"P6 3 1 17 \x00\x01\x02\x08\x09\x0a\x0f\x10\x11",
5353
"RGB",
5454
(
5555
(0, 15, 30),
@@ -60,7 +60,7 @@ def test_sanity() -> None:
6060
# P6 with maxval > 255
6161
(
6262
b"P6 3 1 257 \x00\x00\x00\x01\x00\x02"
63-
b"\x00\x80\x00\x81\x00\x82\x01\x00\x01\x01\xFF\xFF",
63+
b"\x00\x80\x00\x81\x00\x82\x01\x00\x01\x01\xff\xff",
6464
"RGB",
6565
(
6666
(0, 1, 2),

Tests/test_file_tiff.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ def im_generator(ims: list[Image.Image]) -> Generator[Image.Image, None, None]:
746746
assert reread.n_frames == 3
747747

748748
def test_fixoffsets(self) -> None:
749-
b = BytesIO(b"II\x2A\x00\x00\x00\x00\x00")
749+
b = BytesIO(b"II\x2a\x00\x00\x00\x00\x00")
750750
with TiffImagePlugin.AppendingTiffWriter(b) as a:
751751
b.seek(0)
752752
a.fixOffsets(1, isShort=True)
@@ -759,14 +759,14 @@ def test_fixoffsets(self) -> None:
759759
with pytest.raises(RuntimeError):
760760
a.fixOffsets(1)
761761

762-
b = BytesIO(b"II\x2A\x00\x00\x00\x00\x00")
762+
b = BytesIO(b"II\x2a\x00\x00\x00\x00\x00")
763763
with TiffImagePlugin.AppendingTiffWriter(b) as a:
764764
a.offsetOfNewPage = 2**16
765765

766766
b.seek(0)
767767
a.fixOffsets(1, isShort=True)
768768

769-
b = BytesIO(b"II\x2B\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00")
769+
b = BytesIO(b"II\x2b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00")
770770
with TiffImagePlugin.AppendingTiffWriter(b) as a:
771771
a.offsetOfNewPage = 2**32
772772

@@ -777,15 +777,15 @@ def test_fixoffsets(self) -> None:
777777
a.fixOffsets(1, isLong=True)
778778

779779
def test_appending_tiff_writer_writelong(self) -> None:
780-
data = b"II\x2A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
780+
data = b"II\x2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
781781
b = BytesIO(data)
782782
with TiffImagePlugin.AppendingTiffWriter(b) as a:
783783
a.seek(-4, os.SEEK_CUR)
784784
a.writeLong(2**32 - 1)
785785
assert b.getvalue() == data[:-4] + b"\xff\xff\xff\xff"
786786

787787
def test_appending_tiff_writer_rewritelastshorttolong(self) -> None:
788-
data = b"II\x2A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
788+
data = b"II\x2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
789789
b = BytesIO(data)
790790
with TiffImagePlugin.AppendingTiffWriter(b) as a:
791791
a.seek(-2, os.SEEK_CUR)

0 commit comments

Comments
 (0)