From a6d7884b90193c6ad27662af9b472d5e379344c4 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 30 Oct 2023 20:14:30 +0200 Subject: [PATCH] Adjust code for ruff-format style --- Tests/helper.py | 4 ++-- Tests/test_file_jpeg.py | 8 ++------ Tests/test_font_leaks.py | 5 ++++- Tests/test_image_access.py | 4 +--- setup.py | 9 ++++----- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Tests/helper.py b/Tests/helper.py index de5468d84..6b2d1ab06 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -119,8 +119,8 @@ def assert_image_similar(a, b, epsilon, msg=None): ave_diff = diff / (a.size[0] * a.size[1]) try: assert epsilon >= ave_diff, ( - (msg or "") - + f" average pixel value difference {ave_diff:.4f} > epsilon {epsilon:.4f}" + f"{msg or ""} average pixel value difference " + f"{ave_diff:.4f} > epsilon {epsilon:.4f}" ) except Exception as e: if HAS_UPLOADER: diff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py index a0822d000..64c55c240 100644 --- a/Tests/test_file_jpeg.py +++ b/Tests/test_file_jpeg.py @@ -546,9 +546,7 @@ 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 = [ @@ -562,9 +560,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) ] # list of qtable lists assert_image_similar( diff --git a/Tests/test_font_leaks.py b/Tests/test_font_leaks.py index 38f7ddac5..a305b6185 100644 --- a/Tests/test_font_leaks.py +++ b/Tests/test_font_leaks.py @@ -13,7 +13,10 @@ class TestTTypeFontLeak(PillowLeakTestCase): draw = ImageDraw.ImageDraw(im) self._test_leak( lambda: draw.text( - (0, 0), "some text " * 1024, font=font, fill="black" # ~10k + (0, 0), + "some text " * 1024, # ~10k + font=font, + fill="black", ) ) diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index 2b4fb7733..5b0a30330 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -228,9 +228,7 @@ class TestImageGetPixel(AccessTest): assert im.getpixel([0, 0]) == (20, 20, 70) @pytest.mark.parametrize("mode", ("I;16", "I;16B")) - @pytest.mark.parametrize( - "expected_color", (2**15 - 1, 2**15, 2**15 + 1, 2**16 - 1) - ) + @pytest.mark.parametrize("expected_color", (2**15 - 1, 2**15, 2**15 + 1, 2**16 - 1)) def test_signedness(self, mode, expected_color): # see https://github.com/python-pillow/Pillow/issues/452 # pixelaccess is using signed int* instead of uint* diff --git a/setup.py b/setup.py index f13f03713..b1742f229 100755 --- a/setup.py +++ b/setup.py @@ -52,7 +52,6 @@ if sys.platform == "win32" and sys.version_info >= (3, 13): ) ) - _IMAGING = ("decode", "encode", "map", "display", "outline", "path") _LIB_IMAGING = ( @@ -418,11 +417,11 @@ class pil_build_ext(build_ext): ) except Exception: sdk_path = None - if ( - not sdk_path - or sdk_path == "/Applications/Xcode.app/Contents/Developer" + xcode_sdk_path = ( + "/Applications/Xcode.app/Contents/Developer" "/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" - ): + ) + if not sdk_path or sdk_path == xcode_sdk_path: commandlinetools_sdk_path = ( "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" )