Skip to content

Commit 38f4660

Browse files
authored
Merge pull request #6109 from radarhere/black
2 parents d1124cd + 72b7ab5 commit 38f4660

28 files changed

+98
-98
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: f1d4e742c91dd5179d742b0db9293c4472b765f8 # frozen: 21.12b0
3+
rev: fc0be6eb1e2a96091e6f64009ee5e9081bf8b6c6 # frozen: 22.1.0
44
hooks:
55
- id: black
66
args: ["--target-version", "py37"]
@@ -19,7 +19,7 @@ repos:
1919
- id: yesqa
2020

2121
- repo: https://github.com/Lucas-C/pre-commit-hooks
22-
rev: 3592548bbd98528887eeed63486cf6c9bae00b98 # frozen: v1.1.10
22+
rev: ca52c4245639abd55c970e6bbbca95cab3de22d8 # frozen: v1.1.13
2323
hooks:
2424
- id: remove-tabs
2525
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.opt$)

Tests/32bit_segfault_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
from PIL import Image
66

7-
if sys.maxsize < 2 ** 32:
7+
if sys.maxsize < 2**32:
88
im = Image.new("L", (999999, 999999), 0)

Tests/check_large_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
XDIM = 48000
2424

2525

26-
pytestmark = pytest.mark.skipif(sys.maxsize <= 2 ** 32, reason="requires 64-bit system")
26+
pytestmark = pytest.mark.skipif(sys.maxsize <= 2**32, reason="requires 64-bit system")
2727

2828

2929
def _write_png(tmp_path, xdim, ydim):

Tests/check_large_memory_numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
XDIM = 48000
2020

2121

22-
pytestmark = pytest.mark.skipif(sys.maxsize <= 2 ** 32, reason="requires 64-bit system")
22+
pytestmark = pytest.mark.skipif(sys.maxsize <= 2**32, reason="requires 64-bit system")
2323

2424

2525
def _write_png(tmp_path, xdim, ydim):

Tests/test_core_resources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ def test_set_blocks_max(self):
110110

111111
with pytest.raises(ValueError):
112112
Image.core.set_blocks_max(-1)
113-
if sys.maxsize < 2 ** 32:
113+
if sys.maxsize < 2**32:
114114
with pytest.raises(ValueError):
115-
Image.core.set_blocks_max(2 ** 29)
115+
Image.core.set_blocks_max(2**29)
116116

117117
@pytest.mark.skipif(is_pypy(), reason="Images not collected")
118118
def test_set_blocks_max_stats(self):

Tests/test_file_libtiff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def test_additional_metadata(self, tmp_path):
218218
values = {
219219
2: "test",
220220
3: 1,
221-
4: 2 ** 20,
221+
4: 2**20,
222222
5: TiffImagePlugin.IFDRational(100, 1),
223223
12: 1.05,
224224
}
@@ -1019,7 +1019,7 @@ def test_save_single_strip(self, tmp_path):
10191019
im = hopper("RGB").resize((256, 256))
10201020
out = str(tmp_path / "temp.tif")
10211021

1022-
TiffImagePlugin.STRIP_SIZE = 2 ** 18
1022+
TiffImagePlugin.STRIP_SIZE = 2**18
10231023
try:
10241024

10251025
im.save(out, compression="tiff_adobe_deflate")

Tests/test_file_tiff_metadata.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def test_ifd_unsigned_rational(tmp_path):
258258
im = hopper()
259259
info = TiffImagePlugin.ImageFileDirectory_v2()
260260

261-
max_long = 2 ** 32 - 1
261+
max_long = 2**32 - 1
262262

263263
# 4 bytes unsigned long
264264
numerator = max_long
@@ -290,8 +290,8 @@ def test_ifd_signed_rational(tmp_path):
290290
info = TiffImagePlugin.ImageFileDirectory_v2()
291291

292292
# pair of 4 byte signed longs
293-
numerator = 2 ** 31 - 1
294-
denominator = -(2 ** 31)
293+
numerator = 2**31 - 1
294+
denominator = -(2**31)
295295

296296
info[37380] = TiffImagePlugin.IFDRational(numerator, denominator)
297297

@@ -302,8 +302,8 @@ def test_ifd_signed_rational(tmp_path):
302302
assert numerator == reloaded.tag_v2[37380].numerator
303303
assert denominator == reloaded.tag_v2[37380].denominator
304304

305-
numerator = -(2 ** 31)
306-
denominator = 2 ** 31 - 1
305+
numerator = -(2**31)
306+
denominator = 2**31 - 1
307307

308308
info[37380] = TiffImagePlugin.IFDRational(numerator, denominator)
309309

@@ -315,7 +315,7 @@ def test_ifd_signed_rational(tmp_path):
315315
assert denominator == reloaded.tag_v2[37380].denominator
316316

317317
# out of bounds of 4 byte signed long
318-
numerator = -(2 ** 31) - 1
318+
numerator = -(2**31) - 1
319319
denominator = 1
320320

321321
info[37380] = TiffImagePlugin.IFDRational(numerator, denominator)
@@ -324,7 +324,7 @@ def test_ifd_signed_rational(tmp_path):
324324
im.save(out, tiffinfo=info, compression="raw")
325325

326326
with Image.open(out) as reloaded:
327-
assert 2 ** 31 - 1 == reloaded.tag_v2[37380].numerator
327+
assert 2**31 - 1 == reloaded.tag_v2[37380].numerator
328328
assert -1 == reloaded.tag_v2[37380].denominator
329329

330330

Tests/test_file_webp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_write_unsupported_mode_P(self, tmp_path):
128128

129129
self._roundtrip(tmp_path, "P", 50.0)
130130

131-
@pytest.mark.skipif(sys.maxsize <= 2 ** 32, reason="Requires 64-bit system")
131+
@pytest.mark.skipif(sys.maxsize <= 2**32, reason="Requires 64-bit system")
132132
def test_write_encoding_error_message(self, tmp_path):
133133
temp_file = str(tmp_path / "temp.webp")
134134
im = Image.new("RGB", (15000, 15000))

Tests/test_image_access.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ def test_signedness(self):
205205
# see https://github.com/python-pillow/Pillow/issues/452
206206
# pixelaccess is using signed int* instead of uint*
207207
for mode in ("I;16", "I;16B"):
208-
self.check(mode, 2 ** 15 - 1)
209-
self.check(mode, 2 ** 15)
210-
self.check(mode, 2 ** 15 + 1)
211-
self.check(mode, 2 ** 16 - 1)
208+
self.check(mode, 2**15 - 1)
209+
self.check(mode, 2**15)
210+
self.check(mode, 2**15 + 1)
211+
self.check(mode, 2**16 - 1)
212212

213213
def test_p_putpixel_rgb_rgba(self):
214214
for color in [(255, 0, 0), (255, 0, 0, 255)]:
@@ -386,7 +386,7 @@ def test_putpixel_type_error2(self, mode):
386386
def test_putpixel_overflow_error(self, mode):
387387
im = hopper(mode)
388388
with pytest.raises(OverflowError):
389-
im.putpixel((0, 0), 2 ** 80)
389+
im.putpixel((0, 0), 2**80)
390390

391391
def test_putpixel_unrecognized_mode(self):
392392
im = hopper("BGR;15")

Tests/test_image_putdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def put(value):
3838
assert put(0xFFFFFFFF) == (255, 255, 255, 255)
3939
assert put(-1) == (255, 255, 255, 255)
4040
assert put(-1) == (255, 255, 255, 255)
41-
if sys.maxsize > 2 ** 32:
41+
if sys.maxsize > 2**32:
4242
assert put(sys.maxsize) == (255, 255, 255, 255)
4343
else:
4444
assert put(sys.maxsize) == (255, 255, 255, 127)

0 commit comments

Comments
 (0)