Update pre-commit

This commit is contained in:
Andrew Murray 2020-08-31 07:37:17 +10:00
parent 280eb84c2d
commit 298b7d0333
23 changed files with 197 additions and 159 deletions

View File

@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 6bedb5c58a7d8c25aa9509f8217bc24e9797e90d # frozen: 19.10b0
rev: e66be67b9b6811913470f70c28b4d50f94d05b22 # frozen: 20.8b1
hooks:
- id: black
args: ["--target-version", "py35"]
@ -9,7 +9,7 @@ repos:
types: []
- repo: https://github.com/timothycrosley/isort
rev: 9ae09866e278fbc6ec0383ccb16b5c84e78e6e4d # frozen: 5.3.2
rev: 377d260ffa6f746693f97b46d95025afc4bd8275 # frozen: 5.4.2
hooks:
- id: isort
@ -31,7 +31,7 @@ repos:
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: 20b9ac745c5adaab12b845b3564c773dcc051d0e # frozen: v1.5.2
rev: eae6397e4c259ed3d057511f6dd5330b92867e62 # frozen: v1.6.0
hooks:
- id: python-check-blanket-noqa
- id: rst-backticks

View File

@ -171,7 +171,6 @@ post patch:
| @ @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
0 +----------------------------------------------------------------------->Gi
0 11.33
"""
im = hopper("RGB")
exif = b"12345678" * 4096
@ -206,8 +205,7 @@ base case:
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
0 +----------------------------------------------------------------------->Gi
0 7.882
"""
0 7.882"""
im = hopper("RGB")
for _ in range(iterations):

View File

@ -359,7 +359,10 @@ def test_apng_save_split_fdat(tmp_path):
with Image.open("Tests/images/old-style-jpeg-compression.png") as im:
frames = [im.copy(), Image.new("RGBA", im.size, (255, 0, 0, 255))]
im.save(
test_file, save_all=True, default_image=True, append_images=frames,
test_file,
save_all=True,
default_image=True,
append_images=frames,
)
with Image.open(test_file) as im:
exception = None

View File

@ -99,7 +99,8 @@ class TestFileJpeg:
assert k > 0.9
@pytest.mark.parametrize(
"test_image_path", [TEST_FILE, "Tests/images/pil_sample_cmyk.jpg"],
"test_image_path",
[TEST_FILE, "Tests/images/pil_sample_cmyk.jpg"],
)
def test_dpi(self, test_image_path):
def test(xdpi, ydpi=None):

View File

@ -768,7 +768,12 @@ class TestFileLibTiff(LibTiffTestCase):
assert im.mode == "RGBA"
assert im.size == (100, 40)
assert im.tile, [
("libtiff", (0, 0, 100, 40), 0, ("RGBa;16N", "tiff_lzw", False, 38236),)
(
"libtiff",
(0, 0, 100, 40),
0,
("RGBa;16N", "tiff_lzw", False, 38236),
)
]
im.load()

View File

@ -85,7 +85,10 @@ def test_wedge():
im.getchannel(0), comparable.getchannel(0), 1, "Hue conversion is wrong"
)
assert_image_similar(
im.getchannel(1), comparable.getchannel(1), 1, "Saturation conversion is wrong",
im.getchannel(1),
comparable.getchannel(1),
1,
"Saturation conversion is wrong",
)
assert_image_similar(
im.getchannel(2), comparable.getchannel(2), 1, "Value conversion is wrong"
@ -113,7 +116,10 @@ def test_convert():
im.getchannel(0), comparable.getchannel(0), 1, "Hue conversion is wrong"
)
assert_image_similar(
im.getchannel(1), comparable.getchannel(1), 1, "Saturation conversion is wrong",
im.getchannel(1),
comparable.getchannel(1),
1,
"Saturation conversion is wrong",
)
assert_image_similar(
im.getchannel(2), comparable.getchannel(2), 1, "Value conversion is wrong"
@ -126,11 +132,20 @@ def test_hsv_to_rgb():
comparable = to_rgb_colorsys(comparable)
assert_image_similar(
converted.getchannel(0), comparable.getchannel(0), 3, "R conversion is wrong",
converted.getchannel(0),
comparable.getchannel(0),
3,
"R conversion is wrong",
)
assert_image_similar(
converted.getchannel(1), comparable.getchannel(1), 3, "G conversion is wrong",
converted.getchannel(1),
comparable.getchannel(1),
3,
"G conversion is wrong",
)
assert_image_similar(
converted.getchannel(2), comparable.getchannel(2), 3, "B conversion is wrong",
converted.getchannel(2),
comparable.getchannel(2),
3,
"B conversion is wrong",
)

View File

@ -707,7 +707,8 @@ class TestImage:
}
@pytest.mark.parametrize(
"test_module", [PIL, Image],
"test_module",
[PIL, Image],
)
def test_pillow_version(self, test_module):
with pytest.warns(DeprecationWarning):

View File

@ -132,9 +132,11 @@ class TestImageGetPixel(AccessTest):
# check putpixel negative index
im.putpixel((-1, -1), c)
assert im.getpixel((-1, -1)) == c, (
"put/getpixel roundtrip negative index failed for mode %s, color %s"
% (mode, c)
assert (
im.getpixel((-1, -1)) == c
), "put/getpixel roundtrip negative index failed for mode %s, color %s" % (
mode,
c,
)
# Check 0

View File

@ -667,7 +667,10 @@ def test_floodfill_border():
# Act
ImageDraw.floodfill(
im, centre_point, ImageColor.getrgb("red"), border=ImageColor.getrgb("black"),
im,
centre_point,
ImageColor.getrgb("red"),
border=ImageColor.getrgb("black"),
)
# Assert

View File

@ -34,6 +34,9 @@ def test_similar():
(0, size_final[1] - size_bitmap[1]), text, fill=(0, 0, 0), font=font_bitmap
)
draw_outline.text(
(0, size_final[1] - size_outline[1]), text, fill=(0, 0, 0), font=font_outline,
(0, size_final[1] - size_outline[1]),
text,
fill=(0, 0, 0),
font=font_outline,
)
assert_image_similar(im_bitmap, im_outline, 20)

View File

@ -19,7 +19,8 @@ def test_register():
@pytest.mark.parametrize(
"order", [-1, 0],
"order",
[-1, 0],
)
def test_viewer_show(order):
class TestViewer(ImageShow.Viewer):
@ -41,7 +42,8 @@ def test_viewer_show(order):
@pytest.mark.skipif(
not on_ci() or is_win32(), reason="Only run on CIs; hangs on Windows CIs",
not on_ci() or is_win32(),
reason="Only run on CIs; hangs on Windows CIs",
)
def test_show():
for mode in ("1", "I;16", "LA", "RGB", "RGBA"):

View File

@ -1110,7 +1110,10 @@ def _write_multiple_frames(im, fp, chunk, rawmode):
# animation control
chunk(
fp, b"acTL", o32(len(im_frames)), o32(loop), # 0: num_frames # 4: num_plays
fp,
b"acTL",
o32(len(im_frames)),
o32(loop), # 0: num_frames # 4: num_plays
)
# default image IDAT (if it exists)
@ -1155,7 +1158,9 @@ def _write_multiple_frames(im, fp, chunk, rawmode):
else:
fdat_chunks = _fdat(fp, chunk, seq_num)
ImageFile._save(
im_frame, fdat_chunks, [("zip", (0, 0) + im_frame.size, 0, rawmode)],
im_frame,
fdat_chunks,
[("zip", (0, 0) + im_frame.size, 0, rawmode)],
)
seq_num = fdat_chunks.seq_num