From 7d97fa8b86a9f61069579fbedb2cc09fb437b12f Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 14 Jun 2023 16:12:47 +1000 Subject: [PATCH] Use snake case --- Tests/test_imageops.py | 4 ++-- src/PIL/ImageOps.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Tests/test_imageops.py b/Tests/test_imageops.py index e7d04cceb3b..b05785be0ec 100644 --- a/Tests/test_imageops.py +++ b/Tests/test_imageops.py @@ -404,13 +404,13 @@ def check(orientation_im): assert 0x0112 not in transposed_im.getexif() -def test_exif_transpose_inplace(): +def test_exif_transpose_in_place(): with Image.open("Tests/images/orientation_rectangle.jpg") as im: assert im.size == (2, 1) assert im.getexif()[0x0112] == 8 expected = im.rotate(90, expand=True) - ImageOps.exif_transpose(im, inPlace=True) + ImageOps.exif_transpose(im, in_place=True) assert im.size == (1, 2) assert 0x0112 not in im.getexif() assert_image_equal(im, expected) diff --git a/src/PIL/ImageOps.py b/src/PIL/ImageOps.py index 752d132a320..17702778c13 100644 --- a/src/PIL/ImageOps.py +++ b/src/PIL/ImageOps.py @@ -576,13 +576,13 @@ def solarize(image, threshold=128): return _lut(image, lut) -def exif_transpose(image, *, inPlace=False): +def exif_transpose(image, *, in_place=False): """ If an image has an EXIF Orientation tag, other than 1, transpose the image accordingly, and remove the orientation data. :param image: The image to transpose. - :param inPlace: Boolean. Keyword-only argument. + :param in_place: Boolean. Keyword-only argument. If ``True``, the original image is modified in-place, and ``None`` is returned. If ``False`` (default), a new :py:class:`~PIL.Image.Image` object is returned with the transposition applied. If there is no transposition, a copy of the @@ -601,11 +601,11 @@ def exif_transpose(image, *, inPlace=False): }.get(orientation) if method is not None: transposed_image = image.transpose(method) - if inPlace: + if in_place: image.im = transposed_image.im image.pyaccess = None image._size = transposed_image._size - exif_image = image if inPlace else transposed_image + exif_image = image if in_place else transposed_image exif = exif_image.getexif() if ExifTags.Base.Orientation in exif: @@ -622,7 +622,7 @@ def exif_transpose(image, *, inPlace=False): exif_image.info["XML:com.adobe.xmp"] = re.sub( pattern, "", exif_image.info["XML:com.adobe.xmp"] ) - if not inPlace: + if not in_place: return transposed_image - elif not inPlace: + elif not in_place: return image.copy()