From 1aa3886ed76b3f8fc60d604a34dffe573b491c20 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Tue, 7 May 2024 12:33:59 +0000
Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 src/PIL/Image.py       | 30 ++++++++++++++++++++++++++----
 src/PIL/ImageFont.py   | 16 +++++++++++++---
 src/PIL/_imagingft.pyi | 36 +++++++++++++++++++++++++++++-------
 3 files changed, 68 insertions(+), 14 deletions(-)

diff --git a/src/PIL/Image.py b/src/PIL/Image.py
index f81e95695..9f55ea924 100644
--- a/src/PIL/Image.py
+++ b/src/PIL/Image.py
@@ -481,9 +481,11 @@ def _getscaleoffset(expr):
 # --------------------------------------------------------------------
 # Implementation wrapper
 
+
 class _GetDataTransform(Protocol):
     def getdata(self) -> tuple[Transform, Sequence[int]]: ...
 
+
 class Image:
     """
     This class represents an image object.  To create
@@ -1689,7 +1691,12 @@ class Image:
             return self.im.entropy(extrema)
         return self.im.entropy()
 
-    def paste(self, im: Image | str | int | tuple[int, ...], box: tuple[int, int, int, int] | tuple[int, int] | None = None, mask: Image | None = None) -> None:
+    def paste(
+        self,
+        im: Image | str | int | tuple[int, ...],
+        box: tuple[int, int, int, int] | tuple[int, int] | None = None,
+        mask: Image | None = None,
+    ) -> None:
         """
         Pastes another image into this image. The box argument is either
         a 2-tuple giving the upper left corner, a 4-tuple defining the
@@ -2124,7 +2131,13 @@ class Image:
             min(self.size[1], math.ceil(box[3] + support_y)),
         )
 
-    def resize(self, size: tuple[int, int], resample: Resampling | None = None, box: tuple[float, float, float, float] | None = None, reducing_gap: float | None = None) -> Image:
+    def resize(
+        self,
+        size: tuple[int, int],
+        resample: Resampling | None = None,
+        box: tuple[float, float, float, float] | None = None,
+        reducing_gap: float | None = None,
+    ) -> Image:
         """
         Returns a resized copy of this image.
 
@@ -2230,7 +2243,11 @@ class Image:
 
         return self._new(self.im.resize(size, resample, box))
 
-    def reduce(self, factor: int | tuple[int, int], box: tuple[int, int, int, int] | None = None) -> Image:
+    def reduce(
+        self,
+        factor: int | tuple[int, int],
+        box: tuple[int, int, int, int] | None = None,
+    ) -> Image:
         """
         Returns a copy of the image reduced ``factor`` times.
         If the size of the image is not dividable by ``factor``,
@@ -2578,7 +2595,12 @@ class Image:
         """
         return 0
 
-    def thumbnail(self, size: tuple[int, int], resample: Resampling = Resampling.BICUBIC, reducing_gap: float = 2.0) -> None:
+    def thumbnail(
+        self,
+        size: tuple[int, int],
+        resample: Resampling = Resampling.BICUBIC,
+        reducing_gap: float = 2.0,
+    ) -> None:
         """
         Make this image into a thumbnail.  This method modifies the
         image to contain a thumbnail version of itself, no larger than
diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py
index 536ee5fe6..fb7e1d8b6 100644
--- a/src/PIL/ImageFont.py
+++ b/src/PIL/ImageFont.py
@@ -158,7 +158,9 @@ class ImageFont:
         Image._decompression_bomb_check(self.font.getsize(text))
         return self.font.getmask(text, mode)
 
-    def getbbox(self, text: str, *args: object, **kwargs: object) -> tuple[int, int, int, int]:
+    def getbbox(
+        self, text: str, *args: object, **kwargs: object
+    ) -> tuple[int, int, int, int]:
         """
         Returns bounding box (in pixels) of given text.
 
@@ -274,7 +276,9 @@ class FreeTypeFont:
         """
         return self.font.ascent, self.font.descent
 
-    def getlength(self, text: str, mode="", direction=None, features=None, language=None) -> float:
+    def getlength(
+        self, text: str, mode="", direction=None, features=None, language=None
+    ) -> float:
         """
         Returns length (in pixels with 1/64 precision) of given text when rendered
         in font with provided direction, features, and language.
@@ -744,7 +748,13 @@ def load(filename: str) -> ImageFont:
     return f
 
 
-def truetype(font: StrOrBytesPath | BinaryIO | None = None, size: float = 10, index: int = 0, encoding: str = "", layout_engine: Layout | None = None) -> FreeTypeFont:
+def truetype(
+    font: StrOrBytesPath | BinaryIO | None = None,
+    size: float = 10,
+    index: int = 0,
+    encoding: str = "",
+    layout_engine: Layout | None = None,
+) -> FreeTypeFont:
     """
     Load a TrueType or OpenType font from a file or file-like object,
     and create a font object.
diff --git a/src/PIL/_imagingft.pyi b/src/PIL/_imagingft.pyi
index 2c2ea9a54..987e7fd6f 100644
--- a/src/PIL/_imagingft.pyi
+++ b/src/PIL/_imagingft.pyi
@@ -6,7 +6,6 @@ class _Axis(TypedDict):
     maximum: int | None
     name: str | None
 
-
 class Font:
     @property
     def family(self) -> str | None: ...
@@ -24,15 +23,38 @@ class Font:
     def y_ppem(self) -> int: ...
     @property
     def glyphs(self) -> int: ...
-
-    def render(self, string: str, fill, mode = ..., dir = ..., features = ..., lang = ..., stroke_width = ..., anchor = ..., foreground_ink_long = ..., x_start = ..., y_start = ..., /) -> tuple[Any, tuple[int, int]]: ...
-    def getsize(self, string: str, mode = ..., dir = ..., features = ..., lang = ..., anchor = ..., /) -> tuple[tuple[int, int], tuple[int, int]]: ...
-    def getlength(self, string: str, mode = ..., dir = ..., features = ..., lang = ..., /) -> int: ...
+    def render(
+        self,
+        string: str,
+        fill,
+        mode=...,
+        dir=...,
+        features=...,
+        lang=...,
+        stroke_width=...,
+        anchor=...,
+        foreground_ink_long=...,
+        x_start=...,
+        y_start=...,
+        /,
+    ) -> tuple[Any, tuple[int, int]]: ...
+    def getsize(
+        self, string: str, mode=..., dir=..., features=..., lang=..., anchor=..., /
+    ) -> tuple[tuple[int, int], tuple[int, int]]: ...
+    def getlength(
+        self, string: str, mode=..., dir=..., features=..., lang=..., /
+    ) -> int: ...
     def getvarnames(self) -> list[str]: ...
     def getvaraxes(self) -> list[_Axis]: ...
     def setvarname(self, instance_index: int, /) -> None: ...
     def setvaraxes(self, axes: list[float], /) -> None: ...
 
-def getfont(filename: str | bytes | bytearray, size, index = ..., encoding = ..., font_bytes = ..., layout_engine = ...) -> Font: ...
-
+def getfont(
+    filename: str | bytes | bytearray,
+    size,
+    index=...,
+    encoding=...,
+    font_bytes=...,
+    layout_engine=...,
+) -> Font: ...
 def __getattr__(name: str) -> Any: ...