mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Merge pull request #5670 from radarhere/pre-commit
pre-commit autoupdate --freeze
This commit is contained in:
commit
95885d14aa
|
@ -1,6 +1,6 @@
|
|||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: e66be67b9b6811913470f70c28b4d50f94d05b22 # frozen: 20.8b1
|
||||
rev: e3000ace2fd1fcb1c181bb7a8285f1f976bcbdc7 # frozen: 21.7b0
|
||||
hooks:
|
||||
- id: black
|
||||
args: ["--target-version", "py36"]
|
||||
|
@ -9,35 +9,38 @@ repos:
|
|||
types: []
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 377d260ffa6f746693f97b46d95025afc4bd8275 # frozen: 5.4.2
|
||||
rev: fd5ba70665a37ec301a1f714ed09336048b3be63 # frozen: 5.9.3
|
||||
hooks:
|
||||
- id: isort
|
||||
|
||||
- repo: https://github.com/asottile/yesqa
|
||||
rev: 7a009f3ee493c796827ee334f9058b110a0e0db8 # frozen: v1.2.1
|
||||
rev: 644ede78511c02fc6f8e03e014cc1ddcfbf1e1f5 # frozen: v1.2.3
|
||||
hooks:
|
||||
- id: yesqa
|
||||
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||
rev: f30f4974a08a6b2f6a1eeaf30a4d501cf909163a # frozen: v1.1.9
|
||||
rev: 3592548bbd98528887eeed63486cf6c9bae00b98 # frozen: v1.1.10
|
||||
hooks:
|
||||
- id: remove-tabs
|
||||
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.opt$)
|
||||
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 05f6544aef321e2fee03a1277ce2eef8880fb927 # frozen: 3.8.3
|
||||
rev: dcd740bc0ebaf2b3d43e59a0060d157c97de13f3 # frozen: 3.9.2
|
||||
hooks:
|
||||
- id: flake8
|
||||
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]
|
||||
|
||||
- repo: https://github.com/pre-commit/pygrep-hooks
|
||||
rev: eae6397e4c259ed3d057511f6dd5330b92867e62 # frozen: v1.6.0
|
||||
rev: 6f51a66bba59954917140ec2eeeaa4d5e630e6ce # frozen: v1.9.0
|
||||
hooks:
|
||||
- id: python-check-blanket-noqa
|
||||
- id: rst-backticks
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: e1668fe86af3810fbca72b8653fe478e66a0afdc # frozen: v3.2.0
|
||||
rev: 38b88246ccc552bffaaf54259d064beeee434539 # frozen: v4.0.1
|
||||
hooks:
|
||||
- id: check-merge-conflict
|
||||
- id: check-yaml
|
||||
|
||||
ci:
|
||||
autoupdate_schedule: quarterly
|
||||
|
|
|
@ -33,7 +33,7 @@ def _write_png(tmp_path, xdim, ydim):
|
|||
|
||||
|
||||
def test_large(tmp_path):
|
||||
""" succeeded prepatch"""
|
||||
"""succeeded prepatch"""
|
||||
_write_png(tmp_path, XDIM, YDIM)
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ def _write_png(tmp_path, xdim, ydim):
|
|||
|
||||
|
||||
def test_large(tmp_path):
|
||||
""" succeeded prepatch"""
|
||||
"""succeeded prepatch"""
|
||||
_write_png(tmp_path, XDIM, YDIM)
|
||||
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ def test__accept_false():
|
|||
|
||||
|
||||
def test_short_header():
|
||||
""" Check a short header"""
|
||||
"""Check a short header"""
|
||||
with open(TEST_FILE_DXT5, "rb") as f:
|
||||
img_file = f.read()
|
||||
|
||||
|
@ -210,7 +210,7 @@ def test_short_header():
|
|||
|
||||
|
||||
def test_short_file():
|
||||
""" Check that the appropriate error is thrown for a short file"""
|
||||
"""Check that the appropriate error is thrown for a short file"""
|
||||
|
||||
with open(TEST_FILE_DXT5, "rb") as f:
|
||||
img_file = f.read()
|
||||
|
@ -224,7 +224,7 @@ def test_short_file():
|
|||
|
||||
|
||||
def test_dxt5_colorblock_alpha_issue_4142():
|
||||
""" Check that colorblocks are decoded correctly in DXT5"""
|
||||
"""Check that colorblocks are decoded correctly in DXT5"""
|
||||
|
||||
with Image.open("Tests/images/dxt5-colorblock-alpha-issue-4142.dds") as im:
|
||||
px = im.getpixel((0, 0))
|
||||
|
|
|
@ -630,7 +630,7 @@ class TestFileJpeg:
|
|||
reloaded.save(f, quality="keep", optimize=True)
|
||||
|
||||
def test_bad_mpo_header(self):
|
||||
""" Treat unknown MPO as JPEG """
|
||||
"""Treat unknown MPO as JPEG"""
|
||||
# Arrange
|
||||
|
||||
# Act
|
||||
|
|
|
@ -97,13 +97,13 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
self._assert_noerr(tmp_path, im)
|
||||
|
||||
def test_g4_eq_png(self):
|
||||
""" Checking that we're actually getting the data that we expect"""
|
||||
"""Checking that we're actually getting the data that we expect"""
|
||||
with Image.open("Tests/images/hopper_bw_500.png") as png:
|
||||
assert_image_equal_tofile(png, "Tests/images/hopper_g4_500.tif")
|
||||
|
||||
# see https://github.com/python-pillow/Pillow/issues/279
|
||||
def test_g4_fillorder_eq_png(self):
|
||||
""" Checking that we're actually getting the data that we expect"""
|
||||
"""Checking that we're actually getting the data that we expect"""
|
||||
with Image.open("Tests/images/g4-fillorder-test.tif") as g4:
|
||||
assert_image_equal_tofile(g4, "Tests/images/g4-fillorder-test.png")
|
||||
|
||||
|
@ -137,7 +137,7 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
assert_image_equal_tofile(im, "Tests/images/tiff_adobe_deflate.png")
|
||||
|
||||
def test_write_metadata(self, tmp_path):
|
||||
""" Test metadata writing through libtiff """
|
||||
"""Test metadata writing through libtiff"""
|
||||
for legacy_api in [False, True]:
|
||||
f = str(tmp_path / "temp.tiff")
|
||||
with Image.open("Tests/images/hopper_g4.tif") as img:
|
||||
|
|
|
@ -122,7 +122,7 @@ def test_read_metadata():
|
|||
|
||||
|
||||
def test_write_metadata(tmp_path):
|
||||
""" Test metadata writing through the python code """
|
||||
"""Test metadata writing through the python code"""
|
||||
with Image.open("Tests/images/hopper.tif") as img:
|
||||
f = str(tmp_path / "temp.tiff")
|
||||
img.save(f, tiffinfo=img.tag)
|
||||
|
|
|
@ -41,7 +41,7 @@ def test_toarray():
|
|||
|
||||
def test_fromarray():
|
||||
class Wrapper:
|
||||
""" Class with API matching Image.fromarray """
|
||||
"""Class with API matching Image.fromarray"""
|
||||
|
||||
def __init__(self, img, arr_params):
|
||||
self.img = img
|
||||
|
|
|
@ -32,7 +32,7 @@ def test_16bit_lut():
|
|||
|
||||
|
||||
def test_f_lut():
|
||||
""" Tests for floating point lut of 8bit gray image """
|
||||
"""Tests for floating point lut of 8bit gray image"""
|
||||
im = hopper("L")
|
||||
lut = [0.5 * float(x) for x in range(256)]
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ def _dib_accept(prefix):
|
|||
# Image plugin for the Windows BMP format.
|
||||
# =============================================================================
|
||||
class BmpImageFile(ImageFile.ImageFile):
|
||||
""" Image plugin for the Windows Bitmap format (BMP) """
|
||||
"""Image plugin for the Windows Bitmap format (BMP)"""
|
||||
|
||||
# ------------------------------------------------------------- Description
|
||||
format_description = "Windows Bitmap"
|
||||
|
@ -70,7 +70,7 @@ class BmpImageFile(ImageFile.ImageFile):
|
|||
vars()[k] = v
|
||||
|
||||
def _bitmap(self, header=0, offset=0):
|
||||
""" Read relevant info about the BMP """
|
||||
"""Read relevant info about the BMP"""
|
||||
read, seek = self.fp.read, self.fp.seek
|
||||
if header:
|
||||
seek(header)
|
||||
|
@ -257,7 +257,7 @@ class BmpImageFile(ImageFile.ImageFile):
|
|||
]
|
||||
|
||||
def _open(self):
|
||||
""" Open file, check magic number and read header """
|
||||
"""Open file, check magic number and read header"""
|
||||
# read 14 bytes: magic number, filesize, reserved, header final offset
|
||||
head_data = self.fp.read(14)
|
||||
# choke if the file does not have the required magic bytes
|
||||
|
|
|
@ -128,7 +128,7 @@ class PyAccess:
|
|||
|
||||
|
||||
class _PyAccess32_2(PyAccess):
|
||||
""" PA, LA, stored in first and last bytes of a 32 bit word """
|
||||
"""PA, LA, stored in first and last bytes of a 32 bit word"""
|
||||
|
||||
def _post_init(self, *args, **kwargs):
|
||||
self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32)
|
||||
|
@ -145,7 +145,7 @@ class _PyAccess32_2(PyAccess):
|
|||
|
||||
|
||||
class _PyAccess32_3(PyAccess):
|
||||
""" RGB and friends, stored in the first three bytes of a 32 bit word """
|
||||
"""RGB and friends, stored in the first three bytes of a 32 bit word"""
|
||||
|
||||
def _post_init(self, *args, **kwargs):
|
||||
self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32)
|
||||
|
@ -164,7 +164,7 @@ class _PyAccess32_3(PyAccess):
|
|||
|
||||
|
||||
class _PyAccess32_4(PyAccess):
|
||||
""" RGBA etc, all 4 bytes of a 32 bit word """
|
||||
"""RGBA etc, all 4 bytes of a 32 bit word"""
|
||||
|
||||
def _post_init(self, *args, **kwargs):
|
||||
self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32)
|
||||
|
@ -183,7 +183,7 @@ class _PyAccess32_4(PyAccess):
|
|||
|
||||
|
||||
class _PyAccess8(PyAccess):
|
||||
""" 1, L, P, 8 bit images stored as uint8 """
|
||||
"""1, L, P, 8 bit images stored as uint8"""
|
||||
|
||||
def _post_init(self, *args, **kwargs):
|
||||
self.pixels = self.image8
|
||||
|
@ -201,7 +201,7 @@ class _PyAccess8(PyAccess):
|
|||
|
||||
|
||||
class _PyAccessI16_N(PyAccess):
|
||||
""" I;16 access, native bitendian without conversion """
|
||||
"""I;16 access, native bitendian without conversion"""
|
||||
|
||||
def _post_init(self, *args, **kwargs):
|
||||
self.pixels = ffi.cast("unsigned short **", self.image)
|
||||
|
@ -219,7 +219,7 @@ class _PyAccessI16_N(PyAccess):
|
|||
|
||||
|
||||
class _PyAccessI16_L(PyAccess):
|
||||
""" I;16L access, with conversion """
|
||||
"""I;16L access, with conversion"""
|
||||
|
||||
def _post_init(self, *args, **kwargs):
|
||||
self.pixels = ffi.cast("struct Pixel_I16 **", self.image)
|
||||
|
@ -240,7 +240,7 @@ class _PyAccessI16_L(PyAccess):
|
|||
|
||||
|
||||
class _PyAccessI16_B(PyAccess):
|
||||
""" I;16B access, with conversion """
|
||||
"""I;16B access, with conversion"""
|
||||
|
||||
def _post_init(self, *args, **kwargs):
|
||||
self.pixels = ffi.cast("struct Pixel_I16 **", self.image)
|
||||
|
@ -261,7 +261,7 @@ class _PyAccessI16_B(PyAccess):
|
|||
|
||||
|
||||
class _PyAccessI32_N(PyAccess):
|
||||
""" Signed Int32 access, native endian """
|
||||
"""Signed Int32 access, native endian"""
|
||||
|
||||
def _post_init(self, *args, **kwargs):
|
||||
self.pixels = self.image32
|
||||
|
@ -274,7 +274,7 @@ class _PyAccessI32_N(PyAccess):
|
|||
|
||||
|
||||
class _PyAccessI32_Swap(PyAccess):
|
||||
""" I;32L/B access, with byteswapping conversion """
|
||||
"""I;32L/B access, with byteswapping conversion"""
|
||||
|
||||
def _post_init(self, *args, **kwargs):
|
||||
self.pixels = self.image32
|
||||
|
@ -293,7 +293,7 @@ class _PyAccessI32_Swap(PyAccess):
|
|||
|
||||
|
||||
class _PyAccessF(PyAccess):
|
||||
""" 32 bit float access """
|
||||
"""32 bit float access"""
|
||||
|
||||
def _post_init(self, *args, **kwargs):
|
||||
self.pixels = ffi.cast("float **", self.image32)
|
||||
|
|
Loading…
Reference in New Issue
Block a user