Skip to content

Commit

Permalink
Apply ruff autofixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Feb 24, 2023
1 parent bad46bc commit e35497f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/PIL/GdImageFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,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:
Expand Down
3 changes: 1 addition & 2 deletions src/PIL/IptcImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
import tempfile

from . import Image, ImageFile
from ._binary import i8
from ._binary import i8, o8
from ._binary import i16be as i16
from ._binary import i32be as i32
from ._binary import o8

COMPRESSION = {1: "raw", 5: "jpeg"}

Expand Down
4 changes: 2 additions & 2 deletions src/PIL/PyAccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def set_pixel(self, x, y, color):
except TypeError:
color = min(color[0], 65535)

pixel.l = color & 0xFF # noqa: E741
pixel.l = color & 0xFF
pixel.r = color >> 8


Expand All @@ -262,7 +262,7 @@ def set_pixel(self, x, y, color):
except Exception:
color = min(color[0], 65535)

pixel.l = color >> 8 # noqa: E741
pixel.l = color >> 8
pixel.r = color & 0xFF


Expand Down
2 changes: 1 addition & 1 deletion src/PIL/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit e35497f

Please sign in to comment.