From deb5a78ac86eeb258d114236f76e588665330afc Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 21 May 2023 14:12:30 +1000 Subject: [PATCH] Use "not in" --- src/PIL/GdImageFile.py | 2 +- src/PIL/Image.py | 2 +- src/PIL/features.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PIL/GdImageFile.py b/src/PIL/GdImageFile.py index 7dda4f14301..bafc43a19d4 100644 --- a/src/PIL/GdImageFile.py +++ b/src/PIL/GdImageFile.py @@ -47,7 +47,7 @@ def _open(self): # Header s = self.fp.read(1037) - if not i16(s) in [65534, 65535]: + if i16(s) not in [65534, 65535]: msg = "Not a valid GD 2.x .gd file" raise SyntaxError(msg) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index e0fb6a8858c..ba1c7306ba1 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -1731,7 +1731,7 @@ def alpha_composite(self, im, dest=(0, 0), source=(0, 0)): if not isinstance(dest, (list, tuple)): msg = "Destination must be a tuple" raise ValueError(msg) - if not len(source) in (2, 4): + if len(source) not in (2, 4): msg = "Source must be a 2 or 4-tuple" raise ValueError(msg) if not len(dest) == 2: diff --git a/src/PIL/features.py b/src/PIL/features.py index 80a16a75e0c..f14e60cf5d4 100644 --- a/src/PIL/features.py +++ b/src/PIL/features.py @@ -24,7 +24,7 @@ def check_module(feature): :returns: ``True`` if available, ``False`` otherwise. :raises ValueError: If the module is not defined in this version of Pillow. """ - if not (feature in modules): + if feature not in modules: msg = f"Unknown module {feature}" raise ValueError(msg)