Skip to content

Commit 44b2a94

Browse files
committed
Apply ruff autofixes/noqas
1 parent ad56070 commit 44b2a94

File tree

9 files changed

+13
-14
lines changed

9 files changed

+13
-14
lines changed

src/PIL/BdfFontFile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def bdf_char(f):
6464
bitmap.append(s[:-1])
6565
bitmap = b"".join(bitmap)
6666

67-
[x, y, l, d] = [int(p) for p in props["BBX"].split()]
67+
[x, y, l, d] = [int(p) for p in props["BBX"].split()] # noqa: E741
6868
[dx, dy] = [int(p) for p in props["DWIDTH"].split()]
6969

7070
bbox = (dx, dy), (l, -d - y, x + l, -d), (0, 0, x, y)

src/PIL/GdImageFile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _open(self):
4747
# Header
4848
s = self.fp.read(1037)
4949

50-
if not i16(s) in [65534, 65535]:
50+
if i16(s) not in [65534, 65535]:
5151
msg = "Not a valid GD 2.x .gd file"
5252
raise SyntaxError(msg)
5353

src/PIL/Image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ def tobytes(self, encoder_name="raw", *args):
767767

768768
data = []
769769
while True:
770-
l, s, d = e.encode(bufsize)
770+
l, s, d = e.encode(bufsize) # noqa: E741
771771
data.append(d)
772772
if s:
773773
break
@@ -1756,7 +1756,7 @@ def alpha_composite(self, im, dest=(0, 0), source=(0, 0)):
17561756
if not isinstance(dest, (list, tuple)):
17571757
msg = "Destination must be a tuple"
17581758
raise ValueError(msg)
1759-
if not len(source) in (2, 4):
1759+
if len(source) not in (2, 4):
17601760
msg = "Source must be a 2 or 4-tuple"
17611761
raise ValueError(msg)
17621762
if not len(dest) == 2:

src/PIL/ImageFile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,12 +530,12 @@ def _encode_tile(im, fp, tile, bufsize, fh, exc=None):
530530
encoder.setimage(im.im, b)
531531
if encoder.pushes_fd:
532532
encoder.setfd(fp)
533-
l, s = encoder.encode_to_pyfd()
533+
l, s = encoder.encode_to_pyfd() # noqa: E741
534534
else:
535535
if exc:
536536
# compress to Python file-compatible object
537537
while True:
538-
l, s, d = encoder.encode(bufsize)
538+
l, s, d = encoder.encode(bufsize) # noqa: E741
539539
fp.write(d)
540540
if s:
541541
break

src/PIL/IptcImagePlugin.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
import tempfile
1919

2020
from . import Image, ImageFile
21-
from ._binary import i8
21+
from ._binary import i8, o8
2222
from ._binary import i16be as i16
2323
from ._binary import i32be as i32
24-
from ._binary import o8
2524

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

src/PIL/PcfFontFile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def __init__(self, fp, charset_encoding="iso8859-1"):
8686

8787
for ch, ix in enumerate(encoding):
8888
if ix is not None:
89-
x, y, l, r, w, a, d, f = metrics[ix]
89+
x, y, l, r, w, a, d, f = metrics[ix] # noqa: E741
9090
glyph = (w, 0), (l, d - y, x + l, d), (0, 0, x, y), bitmaps[ix]
9191
self.glyph[ch] = glyph
9292

@@ -206,7 +206,7 @@ def _load_bitmaps(self, metrics):
206206
mode = "1"
207207

208208
for i in range(nbitmaps):
209-
x, y, l, r, w, a, d, f = metrics[i]
209+
x, y, l, r, w, a, d, f = metrics[i] # noqa: E741
210210
b, e = offsets[i], offsets[i + 1]
211211
bitmaps.append(Image.frombytes("1", (x, y), data[b:e], "raw", mode, pad(x)))
212212

src/PIL/PyAccess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def set_pixel(self, x, y, color):
241241
except TypeError:
242242
color = min(color[0], 65535)
243243

244-
pixel.l = color & 0xFF # noqa: E741
244+
pixel.l = color & 0xFF
245245
pixel.r = color >> 8
246246

247247

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

265-
pixel.l = color >> 8 # noqa: E741
265+
pixel.l = color >> 8
266266
pixel.r = color & 0xFF
267267

268268

src/PIL/TiffImagePlugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ def _save(im, fp, filename):
18451845
e.setimage(im.im, (0, 0) + im.size)
18461846
while True:
18471847
# undone, change to self.decodermaxblock:
1848-
l, s, d = e.encode(16 * 1024)
1848+
l, s, d = e.encode(16 * 1024) # noqa: E741
18491849
if not _fp:
18501850
fp.write(d)
18511851
if s:

src/PIL/features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def check_module(feature):
2424
:returns: ``True`` if available, ``False`` otherwise.
2525
:raises ValueError: If the module is not defined in this version of Pillow.
2626
"""
27-
if not (feature in modules):
27+
if feature not in modules:
2828
msg = f"Unknown module {feature}"
2929
raise ValueError(msg)
3030

0 commit comments

Comments
 (0)