From 27924be4fd326246f44d7d7f2100455f9954c501 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 17:17:12 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.14.10 → v0.14.14](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.10...v0.14.14) - [github.com/psf/black-pre-commit-mirror: 25.12.0 → 26.1.0](https://github.com/psf/black-pre-commit-mirror/compare/25.12.0...26.1.0) - [github.com/PyCQA/bandit: 1.9.2 → 1.9.3](https://github.com/PyCQA/bandit/compare/1.9.2...1.9.3) - [github.com/Lucas-C/pre-commit-hooks: v1.5.5 → v1.5.6](https://github.com/Lucas-C/pre-commit-hooks/compare/v1.5.5...v1.5.6) - [github.com/python-jsonschema/check-jsonschema: 0.36.0 → 0.36.1](https://github.com/python-jsonschema/check-jsonschema/compare/0.36.0...0.36.1) - [github.com/zizmorcore/zizmor-pre-commit: v1.19.0 → v1.22.0](https://github.com/zizmorcore/zizmor-pre-commit/compare/v1.19.0...v1.22.0) - [github.com/tox-dev/pyproject-fmt: v2.11.1 → v2.12.1](https://github.com/tox-dev/pyproject-fmt/compare/v2.11.1...v2.12.1) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 12b3d4b4a..7eb69d164 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,24 +1,24 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.10 + rev: v0.14.14 hooks: - id: ruff-check args: [--exit-non-zero-on-fix] - repo: https://github.com/psf/black-pre-commit-mirror - rev: 25.12.0 + rev: 26.1.0 hooks: - id: black - repo: https://github.com/PyCQA/bandit - rev: 1.9.2 + rev: 1.9.3 hooks: - id: bandit args: [--severity-level=high] files: ^src/ - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.5 + rev: v1.5.6 hooks: - id: remove-tabs exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.gd$|\.opt$) @@ -51,14 +51,14 @@ repos: exclude: ^\.github/.*TEMPLATE|^Tests/(fonts|images)/ - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.36.0 + rev: 0.36.1 hooks: - id: check-github-workflows - id: check-readthedocs - id: check-renovate - repo: https://github.com/zizmorcore/zizmor-pre-commit - rev: v1.19.0 + rev: v1.22.0 hooks: - id: zizmor @@ -68,7 +68,7 @@ repos: - id: sphinx-lint - repo: https://github.com/tox-dev/pyproject-fmt - rev: v2.11.1 + rev: v2.12.1 hooks: - id: pyproject-fmt From 7cbe8c4924f34fb3d17be8955ddc384cbb68ab16 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 17:17:52 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- Tests/test_arro3.py | 4 ++-- Tests/test_arrow.py | 8 ++++---- Tests/test_file_gif.py | 2 +- Tests/test_file_jpeg.py | 18 ++++-------------- Tests/test_font_pcf.py | 2 +- Tests/test_font_pcf_charsets.py | 2 +- Tests/test_format_hsv.py | 4 ++-- Tests/test_image_access.py | 6 ++---- Tests/test_image_transform.py | 14 +++++++------- Tests/test_imagemorph.py | 6 ++---- Tests/test_imagewin_pointers.py | 2 +- Tests/test_nanoarrow.py | 4 ++-- Tests/test_pyarrow.py | 4 ++-- pyproject.toml | 16 ++++++++-------- src/PIL/BdfFontFile.py | 1 + src/PIL/EpsImagePlugin.py | 2 +- src/PIL/ExifTags.py | 1 + src/PIL/GdImageFile.py | 1 + src/PIL/GimpGradientFile.py | 1 + src/PIL/IcnsImagePlugin.py | 6 +++--- src/PIL/Image.py | 4 ++-- src/PIL/ImageDraw2.py | 3 ++- src/PIL/ImageFile.py | 4 ++-- src/PIL/ImageFont.py | 26 ++++++-------------------- src/PIL/MspImagePlugin.py | 2 +- src/PIL/WalImageFile.py | 1 + src/PIL/_binary.py | 1 + 27 files changed, 62 insertions(+), 83 deletions(-) diff --git a/Tests/test_arro3.py b/Tests/test_arro3.py index 672eedc9b..42d032f76 100644 --- a/Tests/test_arro3.py +++ b/Tests/test_arro3.py @@ -213,7 +213,7 @@ INT32 = DataShape( ), ) def test_fromarray(mode: str, data_tp: DataShape, mask: list[int] | None) -> None: - (dtype, elt, elts_per_pixel) = data_tp + dtype, elt, elts_per_pixel = data_tp ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1] if dtype == fl_uint8_4_type: @@ -239,7 +239,7 @@ def test_fromarray(mode: str, data_tp: DataShape, mask: list[int] | None) -> Non ) @pytest.mark.parametrize("data_tp", (UINT32, INT32)) def test_from_int32array(mode: str, mask: list[int] | None, data_tp: DataShape) -> None: - (dtype, elt, elts_per_pixel) = data_tp + dtype, elt, elts_per_pixel = data_tp ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1] arr = Array([elt] * (ct_pixels * elts_per_pixel), type=dtype) diff --git a/Tests/test_arrow.py b/Tests/test_arrow.py index b86c77b9a..9f84a75a4 100644 --- a/Tests/test_arrow.py +++ b/Tests/test_arrow.py @@ -68,7 +68,7 @@ def test_multiblock_l_image() -> None: img = Image.new("L", size, 128) with pytest.raises(ValueError): - (schema, arr) = img.__arrow_c_array__() + schema, arr = img.__arrow_c_array__() def test_multiblock_rgba_image() -> None: @@ -79,7 +79,7 @@ def test_multiblock_rgba_image() -> None: img = Image.new("RGBA", size, (128, 127, 126, 125)) with pytest.raises(ValueError): - (schema, arr) = img.__arrow_c_array__() + schema, arr = img.__arrow_c_array__() def test_multiblock_l_schema() -> None: @@ -114,7 +114,7 @@ def test_singleblock_l_image() -> None: img = Image.new("L", size, 128) assert img.im.isblock() - (schema, arr) = img.__arrow_c_array__() + schema, arr = img.__arrow_c_array__() assert schema assert arr @@ -130,7 +130,7 @@ def test_singleblock_rgba_image() -> None: img = Image.new("RGBA", size, (128, 127, 126, 125)) assert img.im.isblock() - (schema, arr) = img.__arrow_c_array__() + schema, arr = img.__arrow_c_array__() assert schema assert arr Image.core.set_use_block_allocator(0) diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index 2615f5a60..7924af99f 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -1433,7 +1433,7 @@ def test_getdata(monkeypatch: pytest.MonkeyPatch) -> None: # with open('Tests/images/gif_header_data.pkl', 'wb') as f: # pickle.dump((h, d), f, 1) with open("Tests/images/gif_header_data.pkl", "rb") as f: - (h_target, d_target) = pickle.load(f) + h_target, d_target = pickle.load(f) assert h == h_target assert d == d_target diff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py index f818927f6..f4c8318a9 100644 --- a/Tests/test_file_jpeg.py +++ b/Tests/test_file_jpeg.py @@ -590,9 +590,7 @@ class TestFileJpeg: assert im2.quantization == {0: bounds_qtable} # values from wizard.txt in jpeg9-a src package. - standard_l_qtable = [ - int(s) - for s in """ + standard_l_qtable = [int(s) for s in """ 16 11 10 16 24 40 51 61 12 12 14 19 26 58 60 55 14 13 16 24 40 57 69 56 @@ -601,14 +599,9 @@ class TestFileJpeg: 24 35 55 64 81 104 113 92 49 64 78 87 103 121 120 101 72 92 95 98 112 100 103 99 - """.split( - None - ) - ] + """.split(None)] - standard_chrominance_qtable = [ - int(s) - for s in """ + standard_chrominance_qtable = [int(s) for s in """ 17 18 24 47 99 99 99 99 18 21 26 66 99 99 99 99 24 26 56 99 99 99 99 99 @@ -617,10 +610,7 @@ class TestFileJpeg: 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 - """.split( - None - ) - ] + """.split(None)] for quality in range(101): qtable_from_qtable_quality = self.roundtrip( diff --git a/Tests/test_font_pcf.py b/Tests/test_font_pcf.py index 567ddaf13..1be7a4d1e 100644 --- a/Tests/test_font_pcf.py +++ b/Tests/test_font_pcf.py @@ -80,7 +80,7 @@ def test_textsize(request: pytest.FixtureRequest, tmp_path: Path) -> None: tempname = save_font(request, tmp_path) font = ImageFont.load(tempname) for i in range(255): - (ox, oy, dx, dy) = font.getbbox(chr(i)) + ox, oy, dx, dy = font.getbbox(chr(i)) assert ox == 0 assert oy == 0 assert dy == 20 diff --git a/Tests/test_font_pcf_charsets.py b/Tests/test_font_pcf_charsets.py index 895458d9d..f1ade907b 100644 --- a/Tests/test_font_pcf_charsets.py +++ b/Tests/test_font_pcf_charsets.py @@ -95,7 +95,7 @@ def test_textsize( tempname = save_font(request, tmp_path, encoding) font = ImageFont.load(tempname) for i in range(255): - (ox, oy, dx, dy) = font.getbbox(bytearray([i])) + ox, oy, dx, dy = font.getbbox(bytearray([i])) assert ox == 0 assert oy == 0 assert dy == 20 diff --git a/Tests/test_format_hsv.py b/Tests/test_format_hsv.py index 861eccc11..2aeff5c34 100644 --- a/Tests/test_format_hsv.py +++ b/Tests/test_format_hsv.py @@ -29,7 +29,7 @@ def linear_gradient() -> Image.Image: im = Image.linear_gradient(mode="L") im90 = im.rotate(90) - (px, h) = im.size + px, h = im.size r = Image.new("L", (px * 3, h)) g = r.copy() @@ -54,7 +54,7 @@ def to_xxx_colorsys( ) -> Image.Image: # convert the hard way using the library colorsys routines. - (r, g, b) = im.split() + r, g, b = im.split() conv_func = int_to_float diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index 07c12594a..6470ac9fc 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -278,8 +278,7 @@ class TestEmbeddable: with open("embed_pil.c", "w", encoding="utf-8") as fh: home = sys.prefix.replace("\\", "\\\\") - fh.write( - f""" + fh.write(f""" #include "Python.h" int main(int argc, char* argv[]) @@ -300,8 +299,7 @@ int main(int argc, char* argv[]) return 0; }} - """ - ) + """) objects = compiler.compile(["embed_pil.c"]) compiler.link_executable(objects, "embed_pil") diff --git a/Tests/test_image_transform.py b/Tests/test_image_transform.py index 3e2b9fee8..12a05ec18 100644 --- a/Tests/test_image_transform.py +++ b/Tests/test_image_transform.py @@ -56,7 +56,7 @@ class TestImageTransform: def test_extent(self) -> None: im = hopper("RGB") - (w, h) = im.size + w, h = im.size transformed = im.transform( im.size, Image.Transform.EXTENT, @@ -72,7 +72,7 @@ class TestImageTransform: def test_quad(self) -> None: # one simple quad transform, equivalent to scale & crop upper left quad im = hopper("RGB") - (w, h) = im.size + w, h = im.size transformed = im.transform( im.size, Image.Transform.QUAD, @@ -99,7 +99,7 @@ class TestImageTransform: ) def test_fill(self, mode: str, expected_pixel: tuple[int, ...]) -> None: im = hopper(mode) - (w, h) = im.size + w, h = im.size transformed = im.transform( im.size, Image.Transform.EXTENT, @@ -112,7 +112,7 @@ class TestImageTransform: def test_mesh(self) -> None: # this should be a checkerboard of halfsized hoppers in ul, lr im = hopper("RGBA") - (w, h) = im.size + w, h = im.size transformed = im.transform( im.size, Image.Transform.MESH, @@ -174,7 +174,7 @@ class TestImageTransform: def test_alpha_premult_transform(self) -> None: def op(im: Image.Image, sz: tuple[int, int]) -> Image.Image: - (w, h) = im.size + w, h = im.size return im.transform( sz, Image.Transform.EXTENT, (0, 0, w, h), Image.Resampling.BILINEAR ) @@ -216,7 +216,7 @@ class TestImageTransform: @pytest.mark.parametrize("mode", ("RGBA", "LA")) def test_nearest_transform(self, mode: str) -> None: def op(im: Image.Image, sz: tuple[int, int]) -> Image.Image: - (w, h) = im.size + w, h = im.size return im.transform( sz, Image.Transform.EXTENT, (0, 0, w, h), Image.Resampling.NEAREST ) @@ -255,7 +255,7 @@ class TestImageTransform: @pytest.mark.parametrize("resample", (Image.Resampling.BOX, "unknown")) def test_unknown_resampling_filter(self, resample: Image.Resampling | str) -> None: with hopper() as im: - (w, h) = im.size + w, h = im.size with pytest.raises(ValueError): im.transform((100, 100), Image.Transform.EXTENT, (0, 0, w, h), resample) # type: ignore[arg-type] diff --git a/Tests/test_imagemorph.py b/Tests/test_imagemorph.py index aa8356b0b..1d2fae1a6 100644 --- a/Tests/test_imagemorph.py +++ b/Tests/test_imagemorph.py @@ -22,8 +22,7 @@ def string_to_img(image_string: str) -> Image.Image: return im -A = string_to_img( - """ +A = string_to_img(""" ....... ....... ..111.. @@ -31,8 +30,7 @@ A = string_to_img( ..111.. ....... ....... - """ -) + """) def img_to_string(im: Image.Image) -> str: diff --git a/Tests/test_imagewin_pointers.py b/Tests/test_imagewin_pointers.py index e8468e59f..b74210513 100644 --- a/Tests/test_imagewin_pointers.py +++ b/Tests/test_imagewin_pointers.py @@ -87,7 +87,7 @@ if is_win32(): def test_pointer(tmp_path: Path) -> None: im = hopper() - (width, height) = im.size + width, height = im.size opath = tmp_path / "temp.png" imdib = ImageWin.Dib(im) diff --git a/Tests/test_nanoarrow.py b/Tests/test_nanoarrow.py index 69980e719..047be16c5 100644 --- a/Tests/test_nanoarrow.py +++ b/Tests/test_nanoarrow.py @@ -208,7 +208,7 @@ INT32 = DataShape( ), ) def test_fromarray(mode: str, data_tp: DataShape, mask: list[int] | None) -> None: - (dtype, elt, elts_per_pixel) = data_tp + dtype, elt, elts_per_pixel = data_tp ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1] if dtype == fl_uint8_4_type: @@ -241,7 +241,7 @@ def test_fromarray(mode: str, data_tp: DataShape, mask: list[int] | None) -> Non ) @pytest.mark.parametrize("data_tp", (UINT32, INT32)) def test_from_int32array(mode: str, mask: list[int] | None, data_tp: DataShape) -> None: - (dtype, elt, elts_per_pixel) = data_tp + dtype, elt, elts_per_pixel = data_tp ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1] arr = nanoarrow.Array( diff --git a/Tests/test_pyarrow.py b/Tests/test_pyarrow.py index a69504e78..7a161f2ac 100644 --- a/Tests/test_pyarrow.py +++ b/Tests/test_pyarrow.py @@ -211,7 +211,7 @@ INT32 = DataShape( ), ) def test_fromarray(mode: str, data_tp: DataShape, mask: list[int] | None) -> None: - (dtype, elt, elts_per_pixel) = data_tp + dtype, elt, elts_per_pixel = data_tp ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1] arr = pyarrow.array([elt] * (ct_pixels * elts_per_pixel), type=dtype) @@ -238,7 +238,7 @@ def test_fromarray(mode: str, data_tp: DataShape, mask: list[int] | None) -> Non ), ) def test_from_int32array(mode: str, data_tp: DataShape, mask: list[int] | None) -> None: - (dtype, elt, elts_per_pixel) = data_tp + dtype, elt, elts_per_pixel = data_tp ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1] arr = pyarrow.array([elt] * (ct_pixels * elts_per_pixel), type=dtype) diff --git a/pyproject.toml b/pyproject.toml index cc616bc54..91f4750e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -112,14 +112,6 @@ test-requires = [ ] xbuild-tools = [ ] -[tool.cibuildwheel.macos] -# Disable platform guessing on macOS to avoid picking up Homebrew etc. -config-settings = "raqm=enable raqm=vendor fribidi=vendor imagequant=disable platform-guessing=disable" - -[tool.cibuildwheel.macos.environment] -# Isolate macOS build environment from Homebrew etc. -PATH = "$(pwd)/build/deps/darwin/bin:$(dirname $(which python3)):/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin" - [tool.cibuildwheel.ios] # Disable platform guessing on iOS, and disable raqm (since there won't be a # vendor version, and we can't distribute it due to licensing) @@ -139,6 +131,14 @@ test-command = [ # There's no numpy wheel for iOS (yet...) test-requires = [ ] +[tool.cibuildwheel.macos] +# Disable platform guessing on macOS to avoid picking up Homebrew etc. +config-settings = "raqm=enable raqm=vendor fribidi=vendor imagequant=disable platform-guessing=disable" + +[tool.cibuildwheel.macos.environment] +# Isolate macOS build environment from Homebrew etc. +PATH = "$(pwd)/build/deps/darwin/bin:$(dirname $(which python3)):/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin" + [[tool.cibuildwheel.overrides]] # iOS environment is isolated by cibuildwheel, but needs the dependencies select = "*_iphoneos" diff --git a/src/PIL/BdfFontFile.py b/src/PIL/BdfFontFile.py index f175e2f4f..1c8c28ff0 100644 --- a/src/PIL/BdfFontFile.py +++ b/src/PIL/BdfFontFile.py @@ -20,6 +20,7 @@ """ Parse X Bitmap Distribution Format (BDF) """ + from __future__ import annotations from typing import BinaryIO diff --git a/src/PIL/EpsImagePlugin.py b/src/PIL/EpsImagePlugin.py index 2effb816c..aeb7b0c93 100644 --- a/src/PIL/EpsImagePlugin.py +++ b/src/PIL/EpsImagePlugin.py @@ -190,7 +190,7 @@ class EpsImageFile(ImageFile.ImageFile): def _open(self) -> None: assert self.fp is not None - (length, offset) = self._find_offset(self.fp) + length, offset = self._find_offset(self.fp) # go to offset - start of "%!PS" self.fp.seek(offset) diff --git a/src/PIL/ExifTags.py b/src/PIL/ExifTags.py index 2280d5ce8..c1c05cdba 100644 --- a/src/PIL/ExifTags.py +++ b/src/PIL/ExifTags.py @@ -13,6 +13,7 @@ This module provides constants and clear-text names for various well-known EXIF tags. """ + from __future__ import annotations from enum import IntEnum diff --git a/src/PIL/GdImageFile.py b/src/PIL/GdImageFile.py index 891225ce2..d73bc1982 100644 --- a/src/PIL/GdImageFile.py +++ b/src/PIL/GdImageFile.py @@ -25,6 +25,7 @@ implementation is provided for convenience and demonstrational purposes only. """ + from __future__ import annotations from typing import IO diff --git a/src/PIL/GimpGradientFile.py b/src/PIL/GimpGradientFile.py index 5f2691882..fb9587218 100644 --- a/src/PIL/GimpGradientFile.py +++ b/src/PIL/GimpGradientFile.py @@ -18,6 +18,7 @@ Stuff to translate curve segments to palette values (derived from the corresponding code in GIMP, written by Federico Mena Quintero. See the GIMP distribution for more information.) """ + from __future__ import annotations from math import log, pi, sin, sqrt diff --git a/src/PIL/IcnsImagePlugin.py b/src/PIL/IcnsImagePlugin.py index 058861d67..023835fb7 100644 --- a/src/PIL/IcnsImagePlugin.py +++ b/src/PIL/IcnsImagePlugin.py @@ -42,7 +42,7 @@ def read_32t( fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int] ) -> dict[str, Image.Image]: # The 128x128 icon seems to have an extra header for some reason. - (start, length) = start_length + start, length = start_length fobj.seek(start) sig = fobj.read(4) if sig != b"\x00\x00\x00\x00": @@ -58,7 +58,7 @@ def read_32( Read a 32bit RGB icon resource. Seems to be either uncompressed or an RLE packbits-like scheme. """ - (start, length) = start_length + start, length = start_length fobj.seek(start) pixel_size = (size[0] * size[2], size[1] * size[2]) sizesq = pixel_size[0] * pixel_size[1] @@ -111,7 +111,7 @@ def read_mk( def read_png_or_jpeg2000( fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int] ) -> dict[str, Image.Image]: - (start, length) = start_length + start, length = start_length fobj.seek(start) sig = fobj.read(12) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index fdcc680b9..cc431a86a 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -2546,7 +2546,7 @@ class Image: ] def transform(x: float, y: float, matrix: list[float]) -> tuple[float, float]: - (a, b, c, d, e, f) = matrix + a, b, c, d, e, f = matrix return a * x + b * y + c, d * x + e * y + f matrix[2], matrix[5] = transform( @@ -3489,7 +3489,7 @@ def fromarrow( msg = "arrow_c_array interface not found" raise ValueError(msg) - (schema_capsule, array_capsule) = obj.__arrow_c_array__() + schema_capsule, array_capsule = obj.__arrow_c_array__() _im = core.new_arrow(mode, size, schema_capsule, array_capsule) if _im: return Image()._new(_im) diff --git a/src/PIL/ImageDraw2.py b/src/PIL/ImageDraw2.py index 3d68658ed..2c9e39b2c 100644 --- a/src/PIL/ImageDraw2.py +++ b/src/PIL/ImageDraw2.py @@ -22,6 +22,7 @@ .. seealso:: :py:mod:`PIL.ImageDraw` """ + from __future__ import annotations from typing import Any, AnyStr, BinaryIO @@ -117,7 +118,7 @@ class Draw: def settransform(self, offset: tuple[float, float]) -> None: """Sets a transformation offset.""" - (xoffset, yoffset) = offset + xoffset, yoffset = offset self.transform = (1, 0, xoffset, 0, 1, yoffset) def arc( diff --git a/src/PIL/ImageFile.py b/src/PIL/ImageFile.py index 78abe3c77..341435437 100644 --- a/src/PIL/ImageFile.py +++ b/src/PIL/ImageFile.py @@ -801,9 +801,9 @@ class PyCodec: self.im = im if extents: - (x0, y0, x1, y1) = extents + x0, y0, x1, y1 = extents else: - (x0, y0, x1, y1) = (0, 0, 0, 0) + x0, y0, x1, y1 = (0, 0, 0, 0) if x0 == 0 and x1 == 0: self.state.xsize, self.state.ysize = self.im.size diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py index d11f7bf01..ae003d139 100644 --- a/src/PIL/ImageFont.py +++ b/src/PIL/ImageFont.py @@ -940,9 +940,7 @@ def load_default_imagefont() -> ImageFont: f = ImageFont() f._load_pilfont_data( # courB08 - BytesIO( - base64.b64decode( - b""" + BytesIO(base64.b64decode(b""" UElMZm9udAo7Ozs7OzsxMDsKREFUQQoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA @@ -1034,13 +1032,8 @@ AJsAEQAGAAAAAP/6AAX//wCbAAoAoAAPAAYAAAAA//oABQABAKAACgClABEABgAA////+AAGAAAA pQAKAKwAEgAGAAD////4AAYAAACsAAoAswASAAYAAP////gABgAAALMACgC6ABIABgAA////+QAG AAAAugAKAMEAEQAGAAD////4AAYAAgDBAAoAyAAUAAYAAP////kABQACAMgACgDOABMABgAA//// +QAGAAIAzgAKANUAEw== -""" - ) - ), - Image.open( - BytesIO( - base64.b64decode( - b""" +""")), + Image.open(BytesIO(base64.b64decode(b""" iVBORw0KGgoAAAANSUhEUgAAAx4AAAAUAQAAAAArMtZoAAAEwElEQVR4nABlAJr/AHVE4czCI/4u Mc4b7vuds/xzjz5/3/7u/n9vMe7vnfH/9++vPn/xyf5zhxzjt8GHw8+2d83u8x27199/nxuQ6Od9 M43/5z2I+9n9ZtmDBwMQECDRQw/eQIQohJXxpBCNVE6QCCAAAAD//wBlAJr/AgALyj1t/wINwq0g @@ -1064,10 +1057,7 @@ evta/58PTEWzr21hufPjA8N+qlnBwAAAAAD//2JiWLci5v1+HmFXDqcnULE/MxgYGBj+f6CaJQAA AAD//2Ji2FrkY3iYpYC5qDeGgeEMAwPDvwQBBoYvcTwOVLMEAAAA//9isDBgkP///0EOg9z35v// Gc/eeW7BwPj5+QGZhANUswMAAAD//2JgqGBgYGBgqEMXlvhMPUsAAAAA//8iYDd1AAAAAP//AwDR w7IkEbzhVQAAAABJRU5ErkJggg== -""" - ) - ) - ), +"""))), ) return f @@ -1088,9 +1078,7 @@ def load_default(size: float | None = None) -> FreeTypeFont | ImageFont: """ if isinstance(core, ModuleType) or size is not None: return truetype( - BytesIO( - base64.b64decode( - b""" + BytesIO(base64.b64decode(b""" AAEAAAAPAIAAAwBwRkZUTYwDlUAAADFoAAAAHEdERUYAqADnAAAo8AAAACRHUE9ThhmITwAAKfgAA AduR1NVQnHxefoAACkUAAAA4k9TLzJovoHLAAABeAAAAGBjbWFw5lFQMQAAA6gAAAGqZ2FzcP//AA MAACjoAAAACGdseWYmRXoPAAAGQAAAHfhoZWFkE18ayQAAAPwAAAA2aGhlYQboArEAAAE0AAAAJGh @@ -1311,9 +1299,7 @@ ABUADgAPAAAACwAQAAAAAAAAAAAAAAAAAAUAGAACAAIAAgAAAAIAGAAXAAAAGAAAABYAFgACABYAA gAWAAAAEQADAAoAFAAMAA0ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAAAEgAGAAEAHgAkAC YAJwApACoALQAuAC8AMgAzADcAOAA5ADoAPAA9AEUASABOAE8AUgBTAFUAVwBZAFoAWwBcAF0AcwA AAAAAAQAAAADa3tfFAAAAANAan9kAAAAA4QodoQ== -""" - ) - ), +""")), 10 if size is None else size, layout_engine=Layout.BASIC, ) diff --git a/src/PIL/MspImagePlugin.py b/src/PIL/MspImagePlugin.py index 277087a86..fa0f52fe8 100644 --- a/src/PIL/MspImagePlugin.py +++ b/src/PIL/MspImagePlugin.py @@ -140,7 +140,7 @@ class MspDecoder(ImageFile.PyDecoder): runtype = row[idx] idx += 1 if runtype == 0: - (runcount, runval) = struct.unpack_from("Bc", row, idx) + runcount, runval = struct.unpack_from("Bc", row, idx) img.write(runval * runcount) idx += 2 else: diff --git a/src/PIL/WalImageFile.py b/src/PIL/WalImageFile.py index fb3e1c06a..07bbf7471 100644 --- a/src/PIL/WalImageFile.py +++ b/src/PIL/WalImageFile.py @@ -22,6 +22,7 @@ and has been tested with a few sample files found using google. is not registered for use with :py:func:`PIL.Image.open()`. To open a WAL file, use the :py:func:`PIL.WalImageFile.open()` function instead. """ + from __future__ import annotations from typing import IO diff --git a/src/PIL/_binary.py b/src/PIL/_binary.py index 4594ccce3..d3236c17a 100644 --- a/src/PIL/_binary.py +++ b/src/PIL/_binary.py @@ -13,6 +13,7 @@ """Binary input/output support routines.""" + from __future__ import annotations from struct import pack, unpack_from