From acde784811428263cef38564486bfaed9cd6b690 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 19:31:18 +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 | 7 ++++++- src/libImaging/Resample.c | 12 ++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 1a43e723d..f94d307f6 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -2908,7 +2908,12 @@ class Image: Resampling.BILINEAR, Resampling.BICUBIC, ): - if resample in (Resampling.BOX, Resampling.HAMMING, Resampling.LANCZOS, Resampling.MKS2021): + if resample in ( + Resampling.BOX, + Resampling.HAMMING, + Resampling.LANCZOS, + Resampling.MKS2021, + ): unusable: dict[int, str] = { Resampling.BOX: "Image.Resampling.BOX", Resampling.HAMMING: "Image.Resampling.HAMMING", diff --git a/src/libImaging/Resample.c b/src/libImaging/Resample.c index b723f6f7b..7b8e289bd 100644 --- a/src/libImaging/Resample.c +++ b/src/libImaging/Resample.c @@ -85,16 +85,16 @@ mks_2021_filter(double x) { if (x < 0.0) x = -x; if (x < 0.5) - return 577.0/576.0 - 239.0/144.0 * pow(x, 2.0); + return 577.0 / 576.0 - 239.0 / 144.0 * pow(x, 2.0); if (x < 1.5) - return 35.0/36.0 * (x - 1.0) * (x - 239.0/140.0); + return 35.0 / 36.0 * (x - 1.0) * (x - 239.0 / 140.0); if (x < 2.5) - return 1.0/6.0 * (x - 2.0) * (65.0/24.0 - x); + return 1.0 / 6.0 * (x - 2.0) * (65.0 / 24.0 - x); if (x < 3.5) - return 1.0/36.0 * (x - 3.0) * (x - 15.0/4.0); + return 1.0 / 36.0 * (x - 3.0) * (x - 15.0 / 4.0); if (x < 4.5) - return -1.0/288.0 * pow(x - 9.0/2.0, 2.0); - return(0.0); + return -1.0 / 288.0 * pow(x - 9.0 / 2.0, 2.0); + return (0.0); } static struct filter BOX = {box_filter, 0.5};