mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
e0da2b7120
commit
27b0cf67e7
1
.github/workflows/system-info.py
vendored
1
.github/workflows/system-info.py
vendored
|
@ -6,6 +6,7 @@ This sort of info is missing from GitHub Actions.
|
||||||
Requested here:
|
Requested here:
|
||||||
https://github.com/actions/virtual-environments/issues/79
|
https://github.com/actions/virtual-environments/issues/79
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Helper functions.
|
Helper functions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
"""Test DdsImagePlugin"""
|
"""Test DdsImagePlugin"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
|
@ -9,7 +9,6 @@ from .test_file_libtiff import LibTiffTestCase
|
||||||
|
|
||||||
|
|
||||||
class TestFileLibTiffSmall(LibTiffTestCase):
|
class TestFileLibTiffSmall(LibTiffTestCase):
|
||||||
|
|
||||||
"""The small lena image was failing on open in the libtiff
|
"""The small lena image was failing on open in the libtiff
|
||||||
decoder because the file pointer was set to the wrong place
|
decoder because the file pointer was set to the wrong place
|
||||||
by a spurious seek. It wasn't failing with the byteio method.
|
by a spurious seek. It wasn't failing with the byteio method.
|
||||||
|
|
|
@ -230,9 +230,7 @@ class TestImageGetPixel(AccessTest):
|
||||||
assert im.getpixel([0, 0]) == (20, 20, 70)
|
assert im.getpixel([0, 0]) == (20, 20, 70)
|
||||||
|
|
||||||
@pytest.mark.parametrize("mode", ("I;16", "I;16B"))
|
@pytest.mark.parametrize("mode", ("I;16", "I;16B"))
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize("expected_color", (2**15 - 1, 2**15, 2**15 + 1, 2**16 - 1))
|
||||||
"expected_color", (2**15 - 1, 2**15, 2**15 + 1, 2**16 - 1)
|
|
||||||
)
|
|
||||||
def test_signedness(self, mode, expected_color) -> None:
|
def test_signedness(self, mode, expected_color) -> None:
|
||||||
# see https://github.com/python-pillow/Pillow/issues/452
|
# see https://github.com/python-pillow/Pillow/issues/452
|
||||||
# pixelaccess is using signed int* instead of uint*
|
# pixelaccess is using signed int* instead of uint*
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Tests for resize functionality.
|
Tests for resize functionality.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from itertools import permutations
|
from itertools import permutations
|
||||||
|
|
|
@ -342,9 +342,11 @@ def test_extended_information() -> None:
|
||||||
|
|
||||||
def truncate_tuple(tuple_or_float):
|
def truncate_tuple(tuple_or_float):
|
||||||
return tuple(
|
return tuple(
|
||||||
|
(
|
||||||
truncate_tuple(val)
|
truncate_tuple(val)
|
||||||
if isinstance(val, tuple)
|
if isinstance(val, tuple)
|
||||||
else int(val * power) / power
|
else int(val * power) / power
|
||||||
|
)
|
||||||
for val in tuple_or_float
|
for val in tuple_or_float
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ The contents of this file are hereby released in the public domain (CC0)
|
||||||
Full text of the CC0 license:
|
Full text of the CC0 license:
|
||||||
https://creativecommons.org/publicdomain/zero/1.0/
|
https://creativecommons.org/publicdomain/zero/1.0/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
|
|
|
@ -28,6 +28,7 @@ BLP files come in many different flavours:
|
||||||
- DXT3 compression is used if alpha_encoding == 1.
|
- DXT3 compression is used if alpha_encoding == 1.
|
||||||
- DXT5 compression is used if alpha_encoding == 7.
|
- DXT5 compression is used if alpha_encoding == 7.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -9,6 +9,7 @@ The contents of this file are hereby released in the public domain (CC0)
|
||||||
Full text of the CC0 license:
|
Full text of the CC0 license:
|
||||||
https://creativecommons.org/publicdomain/zero/1.0/
|
https://creativecommons.org/publicdomain/zero/1.0/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import io
|
import io
|
||||||
|
|
|
@ -50,9 +50,7 @@ class FontFile:
|
||||||
| None
|
| None
|
||||||
] = [None] * 256
|
] = [None] * 256
|
||||||
|
|
||||||
def __getitem__(
|
def __getitem__(self, ix: int) -> (
|
||||||
self, ix: int
|
|
||||||
) -> (
|
|
||||||
tuple[
|
tuple[
|
||||||
tuple[int, int],
|
tuple[int, int],
|
||||||
tuple[int, int, int, int],
|
tuple[int, int, int, int],
|
||||||
|
|
|
@ -50,6 +50,7 @@ bytes for that mipmap level.
|
||||||
|
|
||||||
Note: All data is stored in little-Endian (Intel) byte order.
|
Note: All data is stored in little-Endian (Intel) byte order.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
|
|
|
@ -641,9 +641,9 @@ def _write_multiple_frames(im, fp, palette):
|
||||||
if encoderinfo.get("optimize") and im_frame.mode != "1":
|
if encoderinfo.get("optimize") and im_frame.mode != "1":
|
||||||
if "transparency" not in encoderinfo:
|
if "transparency" not in encoderinfo:
|
||||||
try:
|
try:
|
||||||
encoderinfo[
|
encoderinfo["transparency"] = (
|
||||||
"transparency"
|
im_frame.palette._new_color_index(im_frame)
|
||||||
] = im_frame.palette._new_color_index(im_frame)
|
)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
if "transparency" in encoderinfo:
|
if "transparency" in encoderinfo:
|
||||||
|
|
|
@ -281,7 +281,6 @@ class ImageCmsProfile:
|
||||||
|
|
||||||
|
|
||||||
class ImageCmsTransform(Image.ImagePointHandler):
|
class ImageCmsTransform(Image.ImagePointHandler):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Transform. This can be used with the procedural API, or with the standard
|
Transform. This can be used with the procedural API, or with the standard
|
||||||
:py:func:`~PIL.Image.Image.point` method.
|
:py:func:`~PIL.Image.Image.point` method.
|
||||||
|
@ -369,7 +368,6 @@ def get_display_profile(handle=None):
|
||||||
|
|
||||||
|
|
||||||
class PyCMSError(Exception):
|
class PyCMSError(Exception):
|
||||||
|
|
||||||
"""(pyCMS) Exception class.
|
"""(pyCMS) Exception class.
|
||||||
This is used for all errors in the pyCMS API."""
|
This is used for all errors in the pyCMS API."""
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ Libjpeg ref.:
|
||||||
https://web.archive.org/web/20120328125543/http://www.jpegcameras.com/libjpeg/libjpeg-3.html
|
https://web.archive.org/web/20120328125543/http://www.jpegcameras.com/libjpeg/libjpeg-3.html
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
|
|
|
@ -188,9 +188,9 @@ def _save(im, fp, filename, save_all=False):
|
||||||
x_resolution = y_resolution = im.encoderinfo.get("resolution", 72.0)
|
x_resolution = y_resolution = im.encoderinfo.get("resolution", 72.0)
|
||||||
|
|
||||||
info = {
|
info = {
|
||||||
"title": None
|
"title": (
|
||||||
if is_appending
|
None if is_appending else os.path.splitext(os.path.basename(filename))[0]
|
||||||
else os.path.splitext(os.path.basename(filename))[0],
|
),
|
||||||
"author": None,
|
"author": None,
|
||||||
"subject": None,
|
"subject": None,
|
||||||
"keywords": None,
|
"keywords": None,
|
||||||
|
|
|
@ -12,6 +12,7 @@ Use PIL.__version__ for this Pillow version.
|
||||||
|
|
||||||
;-)
|
;-)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from . import _version
|
from . import _version
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
""" Find compiled module linking to Tcl / Tk libraries
|
""" Find compiled module linking to Tcl / Tk libraries
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
Loading…
Reference in New Issue
Block a user