From 23fb57dd266886cc767ffaf7c3082e88d3e8c59f Mon Sep 17 00:00:00 2001 From: olokelo Date: Sat, 2 Mar 2024 10:37:55 +0100 Subject: [PATCH] minor fixes, linting corrections --- Tests/test_file_jxl_metadata.py | 5 ++++- Tests/test_jxl_leaks.py | 3 ++- src/PIL/JxlImagePlugin.py | 9 ++------- src/PIL/features.py | 3 ++- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Tests/test_file_jxl_metadata.py b/Tests/test_file_jxl_metadata.py index 0184d4814..7e4a02912 100644 --- a/Tests/test_file_jxl_metadata.py +++ b/Tests/test_file_jxl_metadata.py @@ -21,7 +21,10 @@ except ImportError: # cjxl flower.jpg flower.jxl --lossless_jpeg=0 -q 75 -e 8 -# python -c "from PIL import Image; im=Image.open('Tests/images/flower2.webp'); f=open('/tmp/xmp.xml', 'wb'); f.write(im.info['xmp']); f.close()" +# >>> from PIL import Image +# >>> with Image.open('Tests/images/flower2.webp') as im: +# >>> with open('/tmp/xmp.xml', 'wb') as f: +# >>> f.write(im.info['xmp']) # cjxl flower2.jpg flower2.jxl --lossless_jpeg=0 -q 75 -e 8 -x xmp=/tmp/xmp.xml diff --git a/Tests/test_jxl_leaks.py b/Tests/test_jxl_leaks.py index 5a18ab9a5..307cc6154 100644 --- a/Tests/test_jxl_leaks.py +++ b/Tests/test_jxl_leaks.py @@ -11,7 +11,8 @@ test_file = "Tests/images/hopper.jxl" @skip_unless_feature("jxl") class TestJxlLeaks(PillowLeakTestCase): - # TODO: lower the limit, I'm not sure what is correct limit since I have libjxl debug system-wide + # TODO: lower the limit, I'm not sure what is correct limit + # since I have libjxl debug system-wide mem_limit = 16 * 1024 # kb iterations = 100 diff --git a/src/PIL/JxlImagePlugin.py b/src/PIL/JxlImagePlugin.py index 1372c443f..b4304e9f0 100644 --- a/src/PIL/JxlImagePlugin.py +++ b/src/PIL/JxlImagePlugin.py @@ -67,13 +67,8 @@ class JxlImageFile(ImageFile.ImageFile): xmp = self._decoder.get_xmp() if icc: self.info["icc_profile"] = icc - import traceback - - try: - if exif: - self.info["exif"] = self._fix_exif(exif) - except: - traceback.print_exc() + if exif: + self.info["exif"] = self._fix_exif(exif) if xmp: self.info["xmp"] = xmp diff --git a/src/PIL/features.py b/src/PIL/features.py index e735cb159..e8d428cac 100644 --- a/src/PIL/features.py +++ b/src/PIL/features.py @@ -270,7 +270,8 @@ def pilinfo(out=None, supported_formats=True): ("transp_webp", "WEBP Transparency"), ("webp_mux", "WEBPMUX"), ("webp_anim", "WEBP Animation"), - ("jxl", "JPEG XL")("jpg", "JPEG"), + ("jxl", "JPEG XL"), + ("jpg", "JPEG"), ("jpg_2000", "OPENJPEG (JPEG2000)"), ("zlib", "ZLIB (PNG/ZIP)"), ("libtiff", "LIBTIFF"),