diff --git a/.github/workflows/system-info.py b/.github/workflows/system-info.py index 8e840319a7d..57f28c620b7 100644 --- a/.github/workflows/system-info.py +++ b/.github/workflows/system-info.py @@ -6,6 +6,8 @@ Requested here: https://github.com/actions/virtual-environments/issues/79 """ +from __future__ import annotations + import os import platform import sys diff --git a/Tests/32bit_segfault_check.py b/Tests/32bit_segfault_check.py index 2ff7f908f6d..06ed2ed2f60 100755 --- a/Tests/32bit_segfault_check.py +++ b/Tests/32bit_segfault_check.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from __future__ import annotations import sys diff --git a/Tests/bench_cffi_access.py b/Tests/bench_cffi_access.py index 36ce63296e4..8a37c7d5157 100644 --- a/Tests/bench_cffi_access.py +++ b/Tests/bench_cffi_access.py @@ -1,3 +1,4 @@ +from __future__ import annotations import time from PIL import PyAccess diff --git a/Tests/check_fli_oob.py b/Tests/check_fli_oob.py index 7b3d4d7ee9d..ac46ff1ebc0 100644 --- a/Tests/check_fli_oob.py +++ b/Tests/check_fli_oob.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from __future__ import annotations from PIL import Image diff --git a/Tests/check_fli_overflow.py b/Tests/check_fli_overflow.py index c600c45ed1f..0fabcb5d35f 100644 --- a/Tests/check_fli_overflow.py +++ b/Tests/check_fli_overflow.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image TEST_FILE = "Tests/images/fli_overflow.fli" diff --git a/Tests/check_icns_dos.py b/Tests/check_icns_dos.py index a34bee45c51..ac6be4869b3 100644 --- a/Tests/check_icns_dos.py +++ b/Tests/check_icns_dos.py @@ -1,5 +1,6 @@ # Tests potential DOS of IcnsImagePlugin with 0 length block. # Run from anywhere that PIL is importable. +from __future__ import annotations from io import BytesIO diff --git a/Tests/check_imaging_leaks.py b/Tests/check_imaging_leaks.py index d07082aba9f..8c17c051d4b 100755 --- a/Tests/check_imaging_leaks.py +++ b/Tests/check_imaging_leaks.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/check_j2k_dos.py b/Tests/check_j2k_dos.py index 71dcea4f39f..2c63c340214 100644 --- a/Tests/check_j2k_dos.py +++ b/Tests/check_j2k_dos.py @@ -1,5 +1,6 @@ # Tests potential DOS of Jpeg2kImagePlugin with 0 length block. # Run from anywhere that PIL is importable. +from __future__ import annotations from io import BytesIO diff --git a/Tests/check_j2k_leaks.py b/Tests/check_j2k_leaks.py index afe5836f3fd..83a12e2c29f 100644 --- a/Tests/check_j2k_leaks.py +++ b/Tests/check_j2k_leaks.py @@ -1,3 +1,4 @@ +from __future__ import annotations from io import BytesIO import pytest diff --git a/Tests/check_j2k_overflow.py b/Tests/check_j2k_overflow.py index b16412898f0..982f6ea74d2 100644 --- a/Tests/check_j2k_overflow.py +++ b/Tests/check_j2k_overflow.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/check_jp2_overflow.py b/Tests/check_jp2_overflow.py index 0210505f5fe..9afbff112b0 100755 --- a/Tests/check_jp2_overflow.py +++ b/Tests/check_jp2_overflow.py @@ -12,6 +12,7 @@ # the output should be empty. There may be python issues # in the valgrind especially if run in a debug python # version. +from __future__ import annotations from PIL import Image diff --git a/Tests/check_jpeg_leaks.py b/Tests/check_jpeg_leaks.py index 940c0b00d5b..3cd37c7af7b 100644 --- a/Tests/check_jpeg_leaks.py +++ b/Tests/check_jpeg_leaks.py @@ -1,3 +1,4 @@ +from __future__ import annotations from io import BytesIO import pytest diff --git a/Tests/check_large_memory.py b/Tests/check_large_memory.py index d98f4a694ef..9b83798d5e7 100644 --- a/Tests/check_large_memory.py +++ b/Tests/check_large_memory.py @@ -1,3 +1,4 @@ +from __future__ import annotations import sys import pytest diff --git a/Tests/check_large_memory_numpy.py b/Tests/check_large_memory_numpy.py index 24cb1f722bf..0ff3de8dcc7 100644 --- a/Tests/check_large_memory_numpy.py +++ b/Tests/check_large_memory_numpy.py @@ -1,3 +1,4 @@ +from __future__ import annotations import sys import pytest diff --git a/Tests/check_libtiff_segfault.py b/Tests/check_libtiff_segfault.py index bd7f407e4ab..ee1d7d11f0c 100644 --- a/Tests/check_libtiff_segfault.py +++ b/Tests/check_libtiff_segfault.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/check_png_dos.py b/Tests/check_png_dos.py index f4a129f50c6..292fe4b7f09 100644 --- a/Tests/check_png_dos.py +++ b/Tests/check_png_dos.py @@ -1,3 +1,4 @@ +from __future__ import annotations import zlib from io import BytesIO diff --git a/Tests/check_release_notes.py b/Tests/check_release_notes.py index 0a9a898d7f7..ebfaffa47e1 100644 --- a/Tests/check_release_notes.py +++ b/Tests/check_release_notes.py @@ -1,3 +1,4 @@ +from __future__ import annotations import sys from pathlib import Path diff --git a/Tests/check_wheel.py b/Tests/check_wheel.py index cc52cb75ebb..afe4cc3eeaa 100644 --- a/Tests/check_wheel.py +++ b/Tests/check_wheel.py @@ -1,3 +1,4 @@ +from __future__ import annotations import sys from PIL import features diff --git a/Tests/conftest.py b/Tests/conftest.py index 66da7593c2e..cd64bd755f0 100644 --- a/Tests/conftest.py +++ b/Tests/conftest.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io diff --git a/Tests/createfontdatachunk.py b/Tests/createfontdatachunk.py index e318eb73217..2e990b70916 100755 --- a/Tests/createfontdatachunk.py +++ b/Tests/createfontdatachunk.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from __future__ import annotations import base64 import os diff --git a/Tests/helper.py b/Tests/helper.py index cce7eca3a5a..b333c2fd4ef 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -1,6 +1,7 @@ """ Helper functions. """ +from __future__ import annotations import logging import os diff --git a/Tests/oss-fuzz/fuzz_font.py b/Tests/oss-fuzz/fuzz_font.py index bc2ba9a7e27..4e7c7deec9c 100755 --- a/Tests/oss-fuzz/fuzz_font.py +++ b/Tests/oss-fuzz/fuzz_font.py @@ -13,6 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations import atheris diff --git a/Tests/oss-fuzz/fuzz_pillow.py b/Tests/oss-fuzz/fuzz_pillow.py index 545daccb680..e7cd0474ad5 100644 --- a/Tests/oss-fuzz/fuzz_pillow.py +++ b/Tests/oss-fuzz/fuzz_pillow.py @@ -13,6 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations import atheris diff --git a/Tests/oss-fuzz/fuzzers.py b/Tests/oss-fuzz/fuzzers.py index 10a172b4675..3f3c1e38833 100644 --- a/Tests/oss-fuzz/fuzzers.py +++ b/Tests/oss-fuzz/fuzzers.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import warnings diff --git a/Tests/oss-fuzz/test_fuzzers.py b/Tests/oss-fuzz/test_fuzzers.py index 0526f550ef6..68834045a52 100644 --- a/Tests/oss-fuzz/test_fuzzers.py +++ b/Tests/oss-fuzz/test_fuzzers.py @@ -1,3 +1,4 @@ +from __future__ import annotations import subprocess import sys diff --git a/Tests/test_000_sanity.py b/Tests/test_000_sanity.py index 3fd982474d4..c582dfad3e4 100644 --- a/Tests/test_000_sanity.py +++ b/Tests/test_000_sanity.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image diff --git a/Tests/test_binary.py b/Tests/test_binary.py index 4882e65e655..62da2663668 100644 --- a/Tests/test_binary.py +++ b/Tests/test_binary.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import _binary diff --git a/Tests/test_bmp_reference.py b/Tests/test_bmp_reference.py index 002a44a4f4d..bed8dc3a899 100644 --- a/Tests/test_bmp_reference.py +++ b/Tests/test_bmp_reference.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import warnings diff --git a/Tests/test_box_blur.py b/Tests/test_box_blur.py index 745364ddc0f..e798cba3d4f 100644 --- a/Tests/test_box_blur.py +++ b/Tests/test_box_blur.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageFilter diff --git a/Tests/test_color_lut.py b/Tests/test_color_lut.py index 6d9a6057029..448ba2fac80 100644 --- a/Tests/test_color_lut.py +++ b/Tests/test_color_lut.py @@ -1,3 +1,4 @@ +from __future__ import annotations from array import array import pytest diff --git a/Tests/test_core_resources.py b/Tests/test_core_resources.py index 9021a9fb36d..5275652f66a 100644 --- a/Tests/test_core_resources.py +++ b/Tests/test_core_resources.py @@ -1,3 +1,4 @@ +from __future__ import annotations import sys import pytest diff --git a/Tests/test_decompression_bomb.py b/Tests/test_decompression_bomb.py index 87681a0b557..391948d40c7 100644 --- a/Tests/test_decompression_bomb.py +++ b/Tests/test_decompression_bomb.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_deprecate.py b/Tests/test_deprecate.py index f175b90af16..d45a6603c54 100644 --- a/Tests/test_deprecate.py +++ b/Tests/test_deprecate.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import _deprecate diff --git a/Tests/test_features.py b/Tests/test_features.py index c4e9cd36811..8f0e4b4184a 100644 --- a/Tests/test_features.py +++ b/Tests/test_features.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import re diff --git a/Tests/test_file_apng.py b/Tests/test_file_apng.py index 1fb97a789a5..60d951636e8 100644 --- a/Tests/test_file_apng.py +++ b/Tests/test_file_apng.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageSequence, PngImagePlugin diff --git a/Tests/test_file_blp.py b/Tests/test_file_blp.py index 8b1355b6280..4c1e38d1ddf 100644 --- a/Tests/test_file_blp.py +++ b/Tests/test_file_blp.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_file_bmp.py b/Tests/test_file_bmp.py index 58a45aa0b8a..4cc92c5f684 100644 --- a/Tests/test_file_bmp.py +++ b/Tests/test_file_bmp.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import pytest diff --git a/Tests/test_file_bufrstub.py b/Tests/test_file_bufrstub.py index a7714c92cc8..5780232a2d6 100644 --- a/Tests/test_file_bufrstub.py +++ b/Tests/test_file_bufrstub.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import BufrStubImagePlugin, Image diff --git a/Tests/test_file_container.py b/Tests/test_file_container.py index 65cf6a75ea3..0da5d3824b0 100644 --- a/Tests/test_file_container.py +++ b/Tests/test_file_container.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import ContainerIO, Image diff --git a/Tests/test_file_cur.py b/Tests/test_file_cur.py index f04a20a220a..08c3257f9d1 100644 --- a/Tests/test_file_cur.py +++ b/Tests/test_file_cur.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import CurImagePlugin, Image diff --git a/Tests/test_file_dcx.py b/Tests/test_file_dcx.py index 22686af3485..25e4badbc92 100644 --- a/Tests/test_file_dcx.py +++ b/Tests/test_file_dcx.py @@ -1,3 +1,4 @@ +from __future__ import annotations import warnings import pytest diff --git a/Tests/test_file_dds.py b/Tests/test_file_dds.py index 0dd3d5bb9b0..2d60fbb6460 100644 --- a/Tests/test_file_dds.py +++ b/Tests/test_file_dds.py @@ -1,4 +1,5 @@ """Test DdsImagePlugin""" +from __future__ import annotations from io import BytesIO import pytest diff --git a/Tests/test_file_eps.py b/Tests/test_file_eps.py index 259cf75c397..c479c384a76 100644 --- a/Tests/test_file_eps.py +++ b/Tests/test_file_eps.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import pytest diff --git a/Tests/test_file_fits.py b/Tests/test_file_fits.py index 68b3eb567fd..1383f9c5ca3 100644 --- a/Tests/test_file_fits.py +++ b/Tests/test_file_fits.py @@ -1,3 +1,4 @@ +from __future__ import annotations from io import BytesIO import pytest diff --git a/Tests/test_file_fli.py b/Tests/test_file_fli.py index f96afdc95be..10bf36cc290 100644 --- a/Tests/test_file_fli.py +++ b/Tests/test_file_fli.py @@ -1,3 +1,4 @@ +from __future__ import annotations import warnings import pytest diff --git a/Tests/test_file_fpx.py b/Tests/test_file_fpx.py index 9a1784d31a7..af3b7981561 100644 --- a/Tests/test_file_fpx.py +++ b/Tests/test_file_fpx.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_file_ftex.py b/Tests/test_file_ftex.py index ac6253db056..a494c8029c9 100644 --- a/Tests/test_file_ftex.py +++ b/Tests/test_file_ftex.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import FtexImagePlugin, Image diff --git a/Tests/test_file_gbr.py b/Tests/test_file_gbr.py index 1ea8af8ee34..7dfe0539673 100644 --- a/Tests/test_file_gbr.py +++ b/Tests/test_file_gbr.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import GbrImagePlugin, Image diff --git a/Tests/test_file_gd.py b/Tests/test_file_gd.py index 5594e5bbb9e..ec80c54a122 100644 --- a/Tests/test_file_gd.py +++ b/Tests/test_file_gd.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import GdImageFile, UnidentifiedImageError diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index 0c51a201479..78b77e9743a 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -1,3 +1,4 @@ +from __future__ import annotations import warnings from io import BytesIO diff --git a/Tests/test_file_gimpgradient.py b/Tests/test_file_gimpgradient.py index 3f056fdae1d..d5be46dc39e 100644 --- a/Tests/test_file_gimpgradient.py +++ b/Tests/test_file_gimpgradient.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import GimpGradientFile, ImagePalette diff --git a/Tests/test_file_gimppalette.py b/Tests/test_file_gimppalette.py index caec9cf2115..775d3b7cdae 100644 --- a/Tests/test_file_gimppalette.py +++ b/Tests/test_file_gimppalette.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL.GimpPaletteFile import GimpPaletteFile diff --git a/Tests/test_file_gribstub.py b/Tests/test_file_gribstub.py index dd1c5e7d281..d962e85a436 100644 --- a/Tests/test_file_gribstub.py +++ b/Tests/test_file_gribstub.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import GribStubImagePlugin, Image diff --git a/Tests/test_file_hdf5stub.py b/Tests/test_file_hdf5stub.py index 7ca10fac5dd..9c776b712ee 100644 --- a/Tests/test_file_hdf5stub.py +++ b/Tests/test_file_hdf5stub.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Hdf5StubImagePlugin, Image diff --git a/Tests/test_file_icns.py b/Tests/test_file_icns.py index 42275424d91..c62fffc5be8 100644 --- a/Tests/test_file_icns.py +++ b/Tests/test_file_icns.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import os import warnings diff --git a/Tests/test_file_ico.py b/Tests/test_file_ico.py index 4e6dbe6ede4..de9fa353adb 100644 --- a/Tests/test_file_ico.py +++ b/Tests/test_file_ico.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import os diff --git a/Tests/test_file_im.py b/Tests/test_file_im.py index fd00f260e78..0cb26d06a51 100644 --- a/Tests/test_file_im.py +++ b/Tests/test_file_im.py @@ -1,3 +1,4 @@ +from __future__ import annotations import filecmp import warnings diff --git a/Tests/test_file_imt.py b/Tests/test_file_imt.py index f56acc42949..3db4885586a 100644 --- a/Tests/test_file_imt.py +++ b/Tests/test_file_imt.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import pytest diff --git a/Tests/test_file_iptc.py b/Tests/test_file_iptc.py index dac35a8d0e8..d0ecde393a4 100644 --- a/Tests/test_file_iptc.py +++ b/Tests/test_file_iptc.py @@ -1,3 +1,4 @@ +from __future__ import annotations import sys from io import BytesIO, StringIO diff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py index ef070b6c5ba..ffaea6296ef 100644 --- a/Tests/test_file_jpeg.py +++ b/Tests/test_file_jpeg.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import re import warnings diff --git a/Tests/test_file_jpeg2k.py b/Tests/test_file_jpeg2k.py index 2016b3ccbe3..aaa4104e57c 100644 --- a/Tests/test_file_jpeg2k.py +++ b/Tests/test_file_jpeg2k.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import re from io import BytesIO diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py index a7394f1bf5c..65adf449dcc 100644 --- a/Tests/test_file_libtiff.py +++ b/Tests/test_file_libtiff.py @@ -1,3 +1,4 @@ +from __future__ import annotations import base64 import io import itertools diff --git a/Tests/test_file_libtiff_small.py b/Tests/test_file_libtiff_small.py index 03137c8b603..9501c55a6b8 100644 --- a/Tests/test_file_libtiff_small.py +++ b/Tests/test_file_libtiff_small.py @@ -1,3 +1,4 @@ +from __future__ import annotations from io import BytesIO from PIL import Image diff --git a/Tests/test_file_mcidas.py b/Tests/test_file_mcidas.py index 41f22cf0c7d..4b31aaa7857 100644 --- a/Tests/test_file_mcidas.py +++ b/Tests/test_file_mcidas.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, McIdasImagePlugin diff --git a/Tests/test_file_mic.py b/Tests/test_file_mic.py index 2588d3a0574..e7ea39ea918 100644 --- a/Tests/test_file_mic.py +++ b/Tests/test_file_mic.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImagePalette diff --git a/Tests/test_file_mpo.py b/Tests/test_file_mpo.py index 2e921e46701..da62bc6d429 100644 --- a/Tests/test_file_mpo.py +++ b/Tests/test_file_mpo.py @@ -1,3 +1,4 @@ +from __future__ import annotations import warnings from io import BytesIO diff --git a/Tests/test_file_msp.py b/Tests/test_file_msp.py index 497052b05e9..f4e357ae0fd 100644 --- a/Tests/test_file_msp.py +++ b/Tests/test_file_msp.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import pytest diff --git a/Tests/test_file_palm.py b/Tests/test_file_palm.py index 926fdb26f6b..735840de4cb 100644 --- a/Tests/test_file_palm.py +++ b/Tests/test_file_palm.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os.path import subprocess diff --git a/Tests/test_file_pcd.py b/Tests/test_file_pcd.py index dc45a48c1cb..596a3414f79 100644 --- a/Tests/test_file_pcd.py +++ b/Tests/test_file_pcd.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image diff --git a/Tests/test_file_pcx.py b/Tests/test_file_pcx.py index 485adf7853e..f42ec4a6894 100644 --- a/Tests/test_file_pcx.py +++ b/Tests/test_file_pcx.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageFile, PcxImagePlugin diff --git a/Tests/test_file_pdf.py b/Tests/test_file_pdf.py index ffc392d6b2b..9e07d9ed014 100644 --- a/Tests/test_file_pdf.py +++ b/Tests/test_file_pdf.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import os import os.path diff --git a/Tests/test_file_pixar.py b/Tests/test_file_pixar.py index 315ea4676e1..63779f202cb 100644 --- a/Tests/test_file_pixar.py +++ b/Tests/test_file_pixar.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, PixarImagePlugin diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index b8f48140851..ff386211061 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -1,3 +1,4 @@ +from __future__ import annotations import re import sys import warnings diff --git a/Tests/test_file_ppm.py b/Tests/test_file_ppm.py index 292642ca9f8..bb49a46d376 100644 --- a/Tests/test_file_ppm.py +++ b/Tests/test_file_ppm.py @@ -1,3 +1,4 @@ +from __future__ import annotations import sys from io import BytesIO diff --git a/Tests/test_file_psd.py b/Tests/test_file_psd.py index 708212fa682..8b06ce2b163 100644 --- a/Tests/test_file_psd.py +++ b/Tests/test_file_psd.py @@ -1,3 +1,4 @@ +from __future__ import annotations import warnings import pytest diff --git a/Tests/test_file_qoi.py b/Tests/test_file_qoi.py index 0a835dcf61e..b7c9457294d 100644 --- a/Tests/test_file_qoi.py +++ b/Tests/test_file_qoi.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, QoiImagePlugin diff --git a/Tests/test_file_sgi.py b/Tests/test_file_sgi.py index 6a5d8887d33..13698276b8c 100644 --- a/Tests/test_file_sgi.py +++ b/Tests/test_file_sgi.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, SgiImagePlugin diff --git a/Tests/test_file_spider.py b/Tests/test_file_spider.py index 09f1ef8e4a6..f2109875478 100644 --- a/Tests/test_file_spider.py +++ b/Tests/test_file_spider.py @@ -1,3 +1,4 @@ +from __future__ import annotations import tempfile import warnings from io import BytesIO diff --git a/Tests/test_file_sun.py b/Tests/test_file_sun.py index edb3206038b..874b37b5285 100644 --- a/Tests/test_file_sun.py +++ b/Tests/test_file_sun.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import pytest diff --git a/Tests/test_file_tar.py b/Tests/test_file_tar.py index b27fa25f3e0..4470823cdbd 100644 --- a/Tests/test_file_tar.py +++ b/Tests/test_file_tar.py @@ -1,3 +1,4 @@ +from __future__ import annotations import warnings import pytest diff --git a/Tests/test_file_tga.py b/Tests/test_file_tga.py index 1a5730f49d9..d0f228573bb 100644 --- a/Tests/test_file_tga.py +++ b/Tests/test_file_tga.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os from glob import glob from itertools import product diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 7362c93cac8..0851796d000 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import warnings from io import BytesIO diff --git a/Tests/test_file_tiff_metadata.py b/Tests/test_file_tiff_metadata.py index b7d100e7a05..edd57e6b54d 100644 --- a/Tests/test_file_tiff_metadata.py +++ b/Tests/test_file_tiff_metadata.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import struct diff --git a/Tests/test_file_wal.py b/Tests/test_file_wal.py index 4be46e9d673..0b84d0320aa 100644 --- a/Tests/test_file_wal.py +++ b/Tests/test_file_wal.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import WalImageFile from .helper import assert_image_equal_tofile diff --git a/Tests/test_file_webp.py b/Tests/test_file_webp.py index 30938e971dd..c91818ef64e 100644 --- a/Tests/test_file_webp.py +++ b/Tests/test_file_webp.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import re import sys diff --git a/Tests/test_file_webp_alpha.py b/Tests/test_file_webp_alpha.py index 5970fd2a371..79d01a4446a 100644 --- a/Tests/test_file_webp_alpha.py +++ b/Tests/test_file_webp_alpha.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_file_webp_animated.py b/Tests/test_file_webp_animated.py index 2fd5e548406..22acb4be68f 100644 --- a/Tests/test_file_webp_animated.py +++ b/Tests/test_file_webp_animated.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from packaging.version import parse as parse_version diff --git a/Tests/test_file_webp_lossless.py b/Tests/test_file_webp_lossless.py index 2da443628d7..6acf58ac3f5 100644 --- a/Tests/test_file_webp_lossless.py +++ b/Tests/test_file_webp_lossless.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_file_webp_metadata.py b/Tests/test_file_webp_metadata.py index dd47be8b21b..a7b7bbcf6ee 100644 --- a/Tests/test_file_webp_metadata.py +++ b/Tests/test_file_webp_metadata.py @@ -1,3 +1,4 @@ +from __future__ import annotations from io import BytesIO import pytest diff --git a/Tests/test_file_wmf.py b/Tests/test_file_wmf.py index 7c8b54fd173..596dc8ba181 100644 --- a/Tests/test_file_wmf.py +++ b/Tests/test_file_wmf.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, WmfImagePlugin diff --git a/Tests/test_file_xbm.py b/Tests/test_file_xbm.py index d2c05b78a82..b086ffd683f 100644 --- a/Tests/test_file_xbm.py +++ b/Tests/test_file_xbm.py @@ -1,3 +1,4 @@ +from __future__ import annotations from io import BytesIO import pytest diff --git a/Tests/test_file_xpm.py b/Tests/test_file_xpm.py index 8595b07eb91..265feab4294 100644 --- a/Tests/test_file_xpm.py +++ b/Tests/test_file_xpm.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, XpmImagePlugin diff --git a/Tests/test_file_xvthumb.py b/Tests/test_file_xvthumb.py index 9efe7ec1438..5848995c1aa 100644 --- a/Tests/test_file_xvthumb.py +++ b/Tests/test_file_xvthumb.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, XVThumbImagePlugin diff --git a/Tests/test_font_bdf.py b/Tests/test_font_bdf.py index 1e7caee3297..1e5eff2f15d 100644 --- a/Tests/test_font_bdf.py +++ b/Tests/test_font_bdf.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import BdfFontFile, FontFile diff --git a/Tests/test_font_crash.py b/Tests/test_font_crash.py index 27663f396ea..388ee711861 100644 --- a/Tests/test_font_crash.py +++ b/Tests/test_font_crash.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageDraw, ImageFont diff --git a/Tests/test_font_leaks.py b/Tests/test_font_leaks.py index 38f7ddac5de..6a038bb4038 100644 --- a/Tests/test_font_leaks.py +++ b/Tests/test_font_leaks.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image, ImageDraw, ImageFont from .helper import PillowLeakTestCase, skip_unless_feature diff --git a/Tests/test_font_pcf.py b/Tests/test_font_pcf.py index 815ef1d9254..4365b931066 100644 --- a/Tests/test_font_pcf.py +++ b/Tests/test_font_pcf.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import pytest diff --git a/Tests/test_font_pcf_charsets.py b/Tests/test_font_pcf_charsets.py index 664663fd6bb..950e5029ff5 100644 --- a/Tests/test_font_pcf_charsets.py +++ b/Tests/test_font_pcf_charsets.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import pytest diff --git a/Tests/test_format_hsv.py b/Tests/test_format_hsv.py index b485e854f52..fd47fae39ba 100644 --- a/Tests/test_format_hsv.py +++ b/Tests/test_format_hsv.py @@ -1,3 +1,4 @@ +from __future__ import annotations import colorsys import itertools diff --git a/Tests/test_format_lab.py b/Tests/test_format_lab.py index 41c8efdf316..c7610ce8a6c 100644 --- a/Tests/test_format_lab.py +++ b/Tests/test_format_lab.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image diff --git a/Tests/test_image.py b/Tests/test_image.py index f0861bb4f81..615e00e40da 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import logging import os diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index 2b4fb773395..4a794371d67 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import subprocess import sys diff --git a/Tests/test_image_array.py b/Tests/test_image_array.py index ae3518e44cb..b3e5d9e3e08 100644 --- a/Tests/test_image_array.py +++ b/Tests/test_image_array.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from packaging.version import parse as parse_version diff --git a/Tests/test_image_convert.py b/Tests/test_image_convert.py index f5775f09ccc..7c17040d30b 100644 --- a/Tests/test_image_convert.py +++ b/Tests/test_image_convert.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_image_copy.py b/Tests/test_image_copy.py index cd602fc76f6..abf5f846f89 100644 --- a/Tests/test_image_copy.py +++ b/Tests/test_image_copy.py @@ -1,3 +1,4 @@ +from __future__ import annotations import copy import pytest diff --git a/Tests/test_image_crop.py b/Tests/test_image_crop.py index daf8c8da13d..0bb54e5d811 100644 --- a/Tests/test_image_crop.py +++ b/Tests/test_image_crop.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_image_draft.py b/Tests/test_image_draft.py index 8b4b447688f..774272dd1f7 100644 --- a/Tests/test_image_draft.py +++ b/Tests/test_image_draft.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image from .helper import fromstring, skip_unless_feature, tostring diff --git a/Tests/test_image_entropy.py b/Tests/test_image_entropy.py index ea5886e72db..031fceda3fa 100644 --- a/Tests/test_image_entropy.py +++ b/Tests/test_image_entropy.py @@ -1,3 +1,4 @@ +from __future__ import annotations from .helper import hopper diff --git a/Tests/test_image_filter.py b/Tests/test_image_filter.py index a7932a351b5..5bd7ee0d273 100644 --- a/Tests/test_image_filter.py +++ b/Tests/test_image_filter.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageFilter diff --git a/Tests/test_image_frombytes.py b/Tests/test_image_frombytes.py index c299e454402..017da499d2c 100644 --- a/Tests/test_image_frombytes.py +++ b/Tests/test_image_frombytes.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_image_fromqimage.py b/Tests/test_image_fromqimage.py index 7fe992353bc..b3ca43bde6d 100644 --- a/Tests/test_image_fromqimage.py +++ b/Tests/test_image_fromqimage.py @@ -1,3 +1,4 @@ +from __future__ import annotations import warnings import pytest diff --git a/Tests/test_image_getbands.py b/Tests/test_image_getbands.py index 08fc12c1cf4..e7701dbc460 100644 --- a/Tests/test_image_getbands.py +++ b/Tests/test_image_getbands.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image diff --git a/Tests/test_image_getbbox.py b/Tests/test_image_getbbox.py index afca6670305..9e792cfdf7c 100644 --- a/Tests/test_image_getbbox.py +++ b/Tests/test_image_getbbox.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_image_getcolors.py b/Tests/test_image_getcolors.py index 7fd0398f947..dea3a60a112 100644 --- a/Tests/test_image_getcolors.py +++ b/Tests/test_image_getcolors.py @@ -1,3 +1,4 @@ +from __future__ import annotations from .helper import hopper diff --git a/Tests/test_image_getdata.py b/Tests/test_image_getdata.py index 36c81b40f07..873cc65bf91 100644 --- a/Tests/test_image_getdata.py +++ b/Tests/test_image_getdata.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image from .helper import hopper diff --git a/Tests/test_image_getextrema.py b/Tests/test_image_getextrema.py index 710794da426..b17c8a786dd 100644 --- a/Tests/test_image_getextrema.py +++ b/Tests/test_image_getextrema.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image from .helper import hopper diff --git a/Tests/test_image_getim.py b/Tests/test_image_getim.py index 746e63b1551..e969c8164a2 100644 --- a/Tests/test_image_getim.py +++ b/Tests/test_image_getim.py @@ -1,3 +1,4 @@ +from __future__ import annotations from .helper import hopper diff --git a/Tests/test_image_getpalette.py b/Tests/test_image_getpalette.py index 58a6dacbbbb..a5be972d3ed 100644 --- a/Tests/test_image_getpalette.py +++ b/Tests/test_image_getpalette.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image from .helper import hopper diff --git a/Tests/test_image_getprojection.py b/Tests/test_image_getprojection.py index f65d40708b1..aa47be3b2e0 100644 --- a/Tests/test_image_getprojection.py +++ b/Tests/test_image_getprojection.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image from .helper import hopper diff --git a/Tests/test_image_histogram.py b/Tests/test_image_histogram.py index 0ee52e724e1..7ba2f10b765 100644 --- a/Tests/test_image_histogram.py +++ b/Tests/test_image_histogram.py @@ -1,3 +1,4 @@ +from __future__ import annotations from .helper import hopper diff --git a/Tests/test_image_load.py b/Tests/test_image_load.py index f7fe99bb4c2..17847c4fd9c 100644 --- a/Tests/test_image_load.py +++ b/Tests/test_image_load.py @@ -1,3 +1,4 @@ +from __future__ import annotations import logging import os diff --git a/Tests/test_image_mode.py b/Tests/test_image_mode.py index e4c8bb9dfa6..ad90d1250dc 100644 --- a/Tests/test_image_mode.py +++ b/Tests/test_image_mode.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageMode diff --git a/Tests/test_image_paste.py b/Tests/test_image_paste.py index 1ab02017de1..0b87f607286 100644 --- a/Tests/test_image_paste.py +++ b/Tests/test_image_paste.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_image_point.py b/Tests/test_image_point.py index c406cb8ec26..fce45ec4f0e 100644 --- a/Tests/test_image_point.py +++ b/Tests/test_image_point.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from .helper import assert_image_equal, hopper diff --git a/Tests/test_image_putalpha.py b/Tests/test_image_putalpha.py index e2dcead34c5..0ba7e5919a5 100644 --- a/Tests/test_image_putalpha.py +++ b/Tests/test_image_putalpha.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image diff --git a/Tests/test_image_putdata.py b/Tests/test_image_putdata.py index 4e40aec7465..d3cb13e2e97 100644 --- a/Tests/test_image_putdata.py +++ b/Tests/test_image_putdata.py @@ -1,3 +1,4 @@ +from __future__ import annotations import sys from array import array diff --git a/Tests/test_image_putpalette.py b/Tests/test_image_putpalette.py index 3765533449f..de2d9024213 100644 --- a/Tests/test_image_putpalette.py +++ b/Tests/test_image_putpalette.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImagePalette diff --git a/Tests/test_image_quantize.py b/Tests/test_image_quantize.py index 3bafc4c9c1d..54c567aae6c 100644 --- a/Tests/test_image_quantize.py +++ b/Tests/test_image_quantize.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from packaging.version import parse as parse_version diff --git a/Tests/test_image_reduce.py b/Tests/test_image_reduce.py index ae8d740a027..a4d0f510761 100644 --- a/Tests/test_image_reduce.py +++ b/Tests/test_image_reduce.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageMath, ImageMode diff --git a/Tests/test_image_resample.py b/Tests/test_image_resample.py index be49955dd7e..b4bf6c8df3a 100644 --- a/Tests/test_image_resample.py +++ b/Tests/test_image_resample.py @@ -1,3 +1,4 @@ +from __future__ import annotations from contextlib import contextmanager import pytest diff --git a/Tests/test_image_resize.py b/Tests/test_image_resize.py index b5bfa903fe2..0d3b43ee29f 100644 --- a/Tests/test_image_resize.py +++ b/Tests/test_image_resize.py @@ -1,6 +1,7 @@ """ Tests for resize functionality. """ +from __future__ import annotations from itertools import permutations import pytest diff --git a/Tests/test_image_rotate.py b/Tests/test_image_rotate.py index 82fe46b7d7e..0931aa32d98 100644 --- a/Tests/test_image_rotate.py +++ b/Tests/test_image_rotate.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_image_split.py b/Tests/test_image_split.py index 5cb7c9a8be8..707508250f6 100644 --- a/Tests/test_image_split.py +++ b/Tests/test_image_split.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, features diff --git a/Tests/test_image_thumbnail.py b/Tests/test_image_thumbnail.py index 96a2c26623e..9e6796ca299 100644 --- a/Tests/test_image_thumbnail.py +++ b/Tests/test_image_thumbnail.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_image_tobitmap.py b/Tests/test_image_tobitmap.py index a12ce329fd1..156b9919d27 100644 --- a/Tests/test_image_tobitmap.py +++ b/Tests/test_image_tobitmap.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from .helper import assert_image_equal, fromstring, hopper diff --git a/Tests/test_image_tobytes.py b/Tests/test_image_tobytes.py index 31e1c0080c6..f6042bca527 100644 --- a/Tests/test_image_tobytes.py +++ b/Tests/test_image_tobytes.py @@ -1,3 +1,4 @@ +from __future__ import annotations from .helper import hopper diff --git a/Tests/test_image_transform.py b/Tests/test_image_transform.py index 64a5c94596f..15939ef647c 100644 --- a/Tests/test_image_transform.py +++ b/Tests/test_image_transform.py @@ -1,3 +1,4 @@ +from __future__ import annotations import math import pytest diff --git a/Tests/test_image_transpose.py b/Tests/test_image_transpose.py index 877f439ca26..66a2d9e2955 100644 --- a/Tests/test_image_transpose.py +++ b/Tests/test_image_transpose.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL.Image import Transpose diff --git a/Tests/test_imagechops.py b/Tests/test_imagechops.py index e7687cc1b76..8e3a738d708 100644 --- a/Tests/test_imagechops.py +++ b/Tests/test_imagechops.py @@ -1,3 +1,4 @@ +from __future__ import annotations from PIL import Image, ImageChops from .helper import assert_image_equal, hopper diff --git a/Tests/test_imagecms.py b/Tests/test_imagecms.py index 8efe063c11d..0dde82bd748 100644 --- a/Tests/test_imagecms.py +++ b/Tests/test_imagecms.py @@ -1,3 +1,4 @@ +from __future__ import annotations import datetime import os import re diff --git a/Tests/test_imagecolor.py b/Tests/test_imagecolor.py index 2fae6151cfd..c0ffd2ebf0b 100644 --- a/Tests/test_imagecolor.py +++ b/Tests/test_imagecolor.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageColor diff --git a/Tests/test_imagedraw.py b/Tests/test_imagedraw.py index 4052c41ff07..379fe78cd8a 100644 --- a/Tests/test_imagedraw.py +++ b/Tests/test_imagedraw.py @@ -1,3 +1,4 @@ +from __future__ import annotations import contextlib import os.path diff --git a/Tests/test_imagedraw2.py b/Tests/test_imagedraw2.py index a2c2fa1f010..d729af14d3a 100644 --- a/Tests/test_imagedraw2.py +++ b/Tests/test_imagedraw2.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os.path import pytest diff --git a/Tests/test_imageenhance.py b/Tests/test_imageenhance.py index 221ef8cdb26..f4e4d59be32 100644 --- a/Tests/test_imageenhance.py +++ b/Tests/test_imageenhance.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageEnhance diff --git a/Tests/test_imagefile.py b/Tests/test_imagefile.py index 2389c471748..4804a554f83 100644 --- a/Tests/test_imagefile.py +++ b/Tests/test_imagefile.py @@ -1,3 +1,4 @@ +from __future__ import annotations from io import BytesIO import pytest diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index 0f1c52b664f..6ad56e2b143 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -1,3 +1,4 @@ +from __future__ import annotations import copy import os import re diff --git a/Tests/test_imagefontctl.py b/Tests/test_imagefontctl.py index 6099b04e44b..bea532b051e 100644 --- a/Tests/test_imagefontctl.py +++ b/Tests/test_imagefontctl.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageDraw, ImageFont diff --git a/Tests/test_imagefontpil.py b/Tests/test_imagefontpil.py index c30463e81c2..21b4dee3c4a 100644 --- a/Tests/test_imagefontpil.py +++ b/Tests/test_imagefontpil.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageDraw, ImageFont, features diff --git a/Tests/test_imagegrab.py b/Tests/test_imagegrab.py index a75cbadc4ad..b7683ec1817 100644 --- a/Tests/test_imagegrab.py +++ b/Tests/test_imagegrab.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import shutil import subprocess diff --git a/Tests/test_imagemath.py b/Tests/test_imagemath.py index fe7ac9a7a93..22de86c7cab 100644 --- a/Tests/test_imagemath.py +++ b/Tests/test_imagemath.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageMath diff --git a/Tests/test_imagemorph.py b/Tests/test_imagemorph.py index 29c71f917c4..ec55aadf9b3 100644 --- a/Tests/test_imagemorph.py +++ b/Tests/test_imagemorph.py @@ -1,4 +1,5 @@ # Test the ImageMorphology functionality +from __future__ import annotations import pytest from PIL import Image, ImageMorph, _imagingmorph diff --git a/Tests/test_imageops.py b/Tests/test_imageops.py index a3bb536cec2..7980bead0a4 100644 --- a/Tests/test_imageops.py +++ b/Tests/test_imageops.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageDraw, ImageOps, ImageStat, features diff --git a/Tests/test_imageops_usm.py b/Tests/test_imageops_usm.py index 8837ed2a262..84d3a69507a 100644 --- a/Tests/test_imageops_usm.py +++ b/Tests/test_imageops_usm.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageFilter diff --git a/Tests/test_imagepalette.py b/Tests/test_imagepalette.py index baa698bb4f4..e5b59b74a84 100644 --- a/Tests/test_imagepalette.py +++ b/Tests/test_imagepalette.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImagePalette diff --git a/Tests/test_imagepath.py b/Tests/test_imagepath.py index c112cfd87aa..ac3ea3281f5 100644 --- a/Tests/test_imagepath.py +++ b/Tests/test_imagepath.py @@ -1,3 +1,4 @@ +from __future__ import annotations import array import math import struct diff --git a/Tests/test_imageqt.py b/Tests/test_imageqt.py index 2c73a209465..41d247f429f 100644 --- a/Tests/test_imageqt.py +++ b/Tests/test_imageqt.py @@ -1,3 +1,4 @@ +from __future__ import annotations import warnings import pytest diff --git a/Tests/test_imagesequence.py b/Tests/test_imagesequence.py index 62f52833227..6d71e4d87af 100644 --- a/Tests/test_imagesequence.py +++ b/Tests/test_imagesequence.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageSequence, TiffImagePlugin diff --git a/Tests/test_imageshow.py b/Tests/test_imageshow.py index 3e73339ed3f..761d28d3019 100644 --- a/Tests/test_imageshow.py +++ b/Tests/test_imageshow.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageShow diff --git a/Tests/test_imagestat.py b/Tests/test_imagestat.py index b3b5db13ff2..7b56b89cc4b 100644 --- a/Tests/test_imagestat.py +++ b/Tests/test_imagestat.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image, ImageStat diff --git a/Tests/test_imagetk.py b/Tests/test_imagetk.py index a0c9574ba94..bb20fbb6f92 100644 --- a/Tests/test_imagetk.py +++ b/Tests/test_imagetk.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_imagewin.py b/Tests/test_imagewin.py index 5e489284f2f..6927eedcf86 100644 --- a/Tests/test_imagewin.py +++ b/Tests/test_imagewin.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import ImageWin diff --git a/Tests/test_imagewin_pointers.py b/Tests/test_imagewin_pointers.py index df130565575..bd154335af7 100644 --- a/Tests/test_imagewin_pointers.py +++ b/Tests/test_imagewin_pointers.py @@ -1,3 +1,4 @@ +from __future__ import annotations from io import BytesIO from PIL import Image, ImageWin diff --git a/Tests/test_lib_image.py b/Tests/test_lib_image.py index f6818be46dc..92cad4ac1b1 100644 --- a/Tests/test_lib_image.py +++ b/Tests/test_lib_image.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_lib_pack.py b/Tests/test_lib_pack.py index 2a4d9acf447..1293f7628be 100644 --- a/Tests/test_lib_pack.py +++ b/Tests/test_lib_pack.py @@ -1,3 +1,4 @@ +from __future__ import annotations import sys import pytest diff --git a/Tests/test_locale.py b/Tests/test_locale.py index 7a07fbbe0a4..49b052fa485 100644 --- a/Tests/test_locale.py +++ b/Tests/test_locale.py @@ -1,3 +1,4 @@ +from __future__ import annotations import locale import pytest diff --git a/Tests/test_main.py b/Tests/test_main.py index 46ff63c4e97..a84e61a7b7d 100644 --- a/Tests/test_main.py +++ b/Tests/test_main.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import subprocess import sys diff --git a/Tests/test_map.py b/Tests/test_map.py index d816bddaf3d..76444f33d1c 100644 --- a/Tests/test_map.py +++ b/Tests/test_map.py @@ -1,3 +1,4 @@ +from __future__ import annotations import sys import pytest diff --git a/Tests/test_mode_i16.py b/Tests/test_mode_i16.py index 1786dba3847..3e17d8dccde 100644 --- a/Tests/test_mode_i16.py +++ b/Tests/test_mode_i16.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_numpy.py b/Tests/test_numpy.py index 147f94a71fd..6f0e99b3f93 100644 --- a/Tests/test_numpy.py +++ b/Tests/test_numpy.py @@ -1,3 +1,4 @@ +from __future__ import annotations import warnings import pytest diff --git a/Tests/test_pdfparser.py b/Tests/test_pdfparser.py index 105a838d9da..aeeafb6f1df 100644 --- a/Tests/test_pdfparser.py +++ b/Tests/test_pdfparser.py @@ -1,3 +1,4 @@ +from __future__ import annotations import time import pytest diff --git a/Tests/test_pickle.py b/Tests/test_pickle.py index 1c5d482bde0..eb687b57b62 100644 --- a/Tests/test_pickle.py +++ b/Tests/test_pickle.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pickle import pytest diff --git a/Tests/test_psdraw.py b/Tests/test_psdraw.py index e74d798282a..77c7952e912 100644 --- a/Tests/test_psdraw.py +++ b/Tests/test_psdraw.py @@ -1,3 +1,4 @@ +from __future__ import annotations import os import sys from io import BytesIO diff --git a/Tests/test_pyroma.py b/Tests/test_pyroma.py index aa05c2cfdd8..08133b6c30c 100644 --- a/Tests/test_pyroma.py +++ b/Tests/test_pyroma.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import __version__ diff --git a/Tests/test_qt_image_qapplication.py b/Tests/test_qt_image_qapplication.py index 5d2e41212f2..49ca016771f 100644 --- a/Tests/test_qt_image_qapplication.py +++ b/Tests/test_qt_image_qapplication.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import ImageQt diff --git a/Tests/test_qt_image_toqimage.py b/Tests/test_qt_image_toqimage.py index 95c13ba757b..396bd9080ca 100644 --- a/Tests/test_qt_image_toqimage.py +++ b/Tests/test_qt_image_toqimage.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import ImageQt diff --git a/Tests/test_sgi_crash.py b/Tests/test_sgi_crash.py index b5f9d442490..37d72d451de 100644 --- a/Tests/test_sgi_crash.py +++ b/Tests/test_sgi_crash.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import Image diff --git a/Tests/test_shell_injection.py b/Tests/test_shell_injection.py index d25d42dfca3..d93b0390416 100644 --- a/Tests/test_shell_injection.py +++ b/Tests/test_shell_injection.py @@ -1,3 +1,4 @@ +from __future__ import annotations import shutil import pytest diff --git a/Tests/test_tiff_crashes.py b/Tests/test_tiff_crashes.py index 143765b8eec..64e781cbada 100644 --- a/Tests/test_tiff_crashes.py +++ b/Tests/test_tiff_crashes.py @@ -10,6 +10,7 @@ # the output should be empty. There may be Python issues # in the valgrind especially if run in a debug Python # version. +from __future__ import annotations import pytest diff --git a/Tests/test_tiff_ifdrational.py b/Tests/test_tiff_ifdrational.py index 6e3fcec90e1..e7b41fb4738 100644 --- a/Tests/test_tiff_ifdrational.py +++ b/Tests/test_tiff_ifdrational.py @@ -1,3 +1,4 @@ +from __future__ import annotations from fractions import Fraction from PIL import Image, TiffImagePlugin, features diff --git a/Tests/test_uploader.py b/Tests/test_uploader.py index 720926e5377..6b693f7cd5d 100644 --- a/Tests/test_uploader.py +++ b/Tests/test_uploader.py @@ -1,3 +1,4 @@ +from __future__ import annotations from .helper import assert_image_equal, assert_image_similar, hopper diff --git a/Tests/test_util.py b/Tests/test_util.py index 9efbdd1f380..1457d85f795 100644 --- a/Tests/test_util.py +++ b/Tests/test_util.py @@ -1,3 +1,4 @@ +from __future__ import annotations import pytest from PIL import _util diff --git a/Tests/test_webp_leaks.py b/Tests/test_webp_leaks.py index 5bd9bacdb35..28ebc7d79f1 100644 --- a/Tests/test_webp_leaks.py +++ b/Tests/test_webp_leaks.py @@ -1,3 +1,4 @@ +from __future__ import annotations from io import BytesIO from PIL import Image diff --git a/_custom_build/backend.py b/_custom_build/backend.py index 23225d6b8eb..d1537b80987 100644 --- a/_custom_build/backend.py +++ b/_custom_build/backend.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import sys from setuptools.build_meta import * # noqa: F403 diff --git a/conftest.py b/conftest.py index e123cca80fe..4dcd5e053ea 100644 --- a/conftest.py +++ b/conftest.py @@ -1 +1,3 @@ +from __future__ import annotations + pytest_plugins = ["Tests.helper"] diff --git a/docs/Guardfile b/docs/Guardfile index 6cbf07b0637..16a891a730d 100755 --- a/docs/Guardfile +++ b/docs/Guardfile @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +from __future__ import annotations + from livereload.compiler import shell from livereload.task import Task diff --git a/docs/conf.py b/docs/conf.py index 833dfa215da..9974b0f2ae4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,6 +15,7 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) +from __future__ import annotations import PIL diff --git a/docs/example/DdsImagePlugin.py b/docs/example/DdsImagePlugin.py index 61690410b6c..e98bb86806f 100644 --- a/docs/example/DdsImagePlugin.py +++ b/docs/example/DdsImagePlugin.py @@ -9,6 +9,7 @@ Full text of the CC0 license: https://creativecommons.org/publicdomain/zero/1.0/ """ +from __future__ import annotations import struct from io import BytesIO diff --git a/docs/example/anchors.py b/docs/example/anchors.py index 3447de4f74d..3a0e40b848d 100644 --- a/docs/example/anchors.py +++ b/docs/example/anchors.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from PIL import Image, ImageDraw, ImageFont font = ImageFont.truetype("Tests/fonts/NotoSans-Regular.ttf", 16) diff --git a/pyproject.toml b/pyproject.toml index a48a4fcc604..193e8c9b247 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,6 +120,7 @@ extend-ignore = [ [tool.ruff.isort] known-first-party = ["PIL"] +required-imports = ["from __future__ import annotations"] [tool.pytest.ini_options] addopts = "-ra --color=yes" diff --git a/selftest.py b/selftest.py index 6eeadd1dbc6..600fd649688 100755 --- a/selftest.py +++ b/selftest.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # minimal sanity check +from __future__ import annotations import sys diff --git a/setup.py b/setup.py index 2a364ba97eb..1bf0bcff558 100755 --- a/setup.py +++ b/setup.py @@ -7,6 +7,7 @@ # Final rating: 10/10 # Your cheese is so fresh most people think it's a cream: Mascarpone # ------------------------------ +from __future__ import annotations import os import re diff --git a/src/PIL/BdfFontFile.py b/src/PIL/BdfFontFile.py index 161954831ae..b12ddc2d4b4 100644 --- a/src/PIL/BdfFontFile.py +++ b/src/PIL/BdfFontFile.py @@ -20,7 +20,7 @@ """ Parse X Bitmap Distribution Format (BDF) """ - +from __future__ import annotations from . import FontFile, Image diff --git a/src/PIL/BlpImagePlugin.py b/src/PIL/BlpImagePlugin.py index 398696d5c77..b8f38b78a2e 100644 --- a/src/PIL/BlpImagePlugin.py +++ b/src/PIL/BlpImagePlugin.py @@ -28,6 +28,7 @@ - DXT3 compression is used if alpha_encoding == 1. - DXT5 compression is used if alpha_encoding == 7. """ +from __future__ import annotations import os import struct diff --git a/src/PIL/BmpImagePlugin.py b/src/PIL/BmpImagePlugin.py index b51019c66be..6f730cfef16 100644 --- a/src/PIL/BmpImagePlugin.py +++ b/src/PIL/BmpImagePlugin.py @@ -22,7 +22,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations import os diff --git a/src/PIL/BufrStubImagePlugin.py b/src/PIL/BufrStubImagePlugin.py index eef25aa14cf..60f3ec25b38 100644 --- a/src/PIL/BufrStubImagePlugin.py +++ b/src/PIL/BufrStubImagePlugin.py @@ -8,6 +8,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations from . import Image, ImageFile diff --git a/src/PIL/ContainerIO.py b/src/PIL/ContainerIO.py index 45e80b39af7..387a4c182e0 100644 --- a/src/PIL/ContainerIO.py +++ b/src/PIL/ContainerIO.py @@ -13,7 +13,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations import io diff --git a/src/PIL/CurImagePlugin.py b/src/PIL/CurImagePlugin.py index fc0dae44b9c..5fb2b0193ca 100644 --- a/src/PIL/CurImagePlugin.py +++ b/src/PIL/CurImagePlugin.py @@ -15,6 +15,8 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations + from . import BmpImagePlugin, Image from ._binary import i16le as i16 from ._binary import i32le as i32 diff --git a/src/PIL/DcxImagePlugin.py b/src/PIL/DcxImagePlugin.py index cde9d42f09f..f7344df44a7 100644 --- a/src/PIL/DcxImagePlugin.py +++ b/src/PIL/DcxImagePlugin.py @@ -20,6 +20,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations from . import Image from ._binary import i32le as i32 diff --git a/src/PIL/DdsImagePlugin.py b/src/PIL/DdsImagePlugin.py index 1758c9a4d13..5b6ac2ead50 100644 --- a/src/PIL/DdsImagePlugin.py +++ b/src/PIL/DdsImagePlugin.py @@ -9,6 +9,7 @@ Full text of the CC0 license: https://creativecommons.org/publicdomain/zero/1.0/ """ +from __future__ import annotations import io import struct diff --git a/src/PIL/EpsImagePlugin.py b/src/PIL/EpsImagePlugin.py index c05208c8026..d2e60aa0759 100644 --- a/src/PIL/EpsImagePlugin.py +++ b/src/PIL/EpsImagePlugin.py @@ -19,6 +19,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import io import os diff --git a/src/PIL/ExifTags.py b/src/PIL/ExifTags.py index 2347c6d4c27..60a4d9774ae 100644 --- a/src/PIL/ExifTags.py +++ b/src/PIL/ExifTags.py @@ -13,6 +13,7 @@ This module provides constants and clear-text names for various well-known EXIF tags. """ +from __future__ import annotations from enum import IntEnum diff --git a/src/PIL/FitsImagePlugin.py b/src/PIL/FitsImagePlugin.py index 1ff8a7e913b..7dce2d60f76 100644 --- a/src/PIL/FitsImagePlugin.py +++ b/src/PIL/FitsImagePlugin.py @@ -8,6 +8,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import math diff --git a/src/PIL/FliImagePlugin.py b/src/PIL/FliImagePlugin.py index b05a16259e6..9769761fc15 100644 --- a/src/PIL/FliImagePlugin.py +++ b/src/PIL/FliImagePlugin.py @@ -14,6 +14,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import os diff --git a/src/PIL/FontFile.py b/src/PIL/FontFile.py index 085917ac38e..9621770e2a9 100644 --- a/src/PIL/FontFile.py +++ b/src/PIL/FontFile.py @@ -13,7 +13,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations import os diff --git a/src/PIL/FpxImagePlugin.py b/src/PIL/FpxImagePlugin.py index a0999130ea5..75680a94e02 100644 --- a/src/PIL/FpxImagePlugin.py +++ b/src/PIL/FpxImagePlugin.py @@ -14,6 +14,8 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations + import olefile from . import Image, ImageFile diff --git a/src/PIL/FtexImagePlugin.py b/src/PIL/FtexImagePlugin.py index c2e4ead7174..d5513a56a11 100644 --- a/src/PIL/FtexImagePlugin.py +++ b/src/PIL/FtexImagePlugin.py @@ -50,6 +50,7 @@ Note: All data is stored in little-Endian (Intel) byte order. """ +from __future__ import annotations import struct from enum import IntEnum diff --git a/src/PIL/GbrImagePlugin.py b/src/PIL/GbrImagePlugin.py index ec6e9de6e7b..6722fa2b144 100644 --- a/src/PIL/GbrImagePlugin.py +++ b/src/PIL/GbrImagePlugin.py @@ -23,6 +23,7 @@ # Version 2 files are saved by GIMP v2.8 (at least) # Version 3 files have a format specifier of 18 for 16bit floats in # the color depth field. This is currently unsupported by Pillow. +from __future__ import annotations from . import Image, ImageFile from ._binary import i32be as i32 diff --git a/src/PIL/GdImageFile.py b/src/PIL/GdImageFile.py index 3599994a8e3..d84876eb6b6 100644 --- a/src/PIL/GdImageFile.py +++ b/src/PIL/GdImageFile.py @@ -25,7 +25,7 @@ class is not registered for use with :py:func:`PIL.Image.open()`. To open a implementation is provided for convenience and demonstrational purposes only. """ - +from __future__ import annotations from . import ImageFile, ImagePalette, UnidentifiedImageError from ._binary import i16be as i16 diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py index 4ddd5095c81..57d87078bca 100644 --- a/src/PIL/GifImagePlugin.py +++ b/src/PIL/GifImagePlugin.py @@ -23,6 +23,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import itertools import math diff --git a/src/PIL/GimpGradientFile.py b/src/PIL/GimpGradientFile.py index 8e801be0b8a..2d8c78ea91a 100644 --- a/src/PIL/GimpGradientFile.py +++ b/src/PIL/GimpGradientFile.py @@ -18,7 +18,7 @@ the corresponding code in GIMP, written by Federico Mena Quintero. See the GIMP distribution for more information.) """ - +from __future__ import annotations from math import log, pi, sin, sqrt diff --git a/src/PIL/GimpPaletteFile.py b/src/PIL/GimpPaletteFile.py index d388928945a..a3109ebaa1b 100644 --- a/src/PIL/GimpPaletteFile.py +++ b/src/PIL/GimpPaletteFile.py @@ -13,6 +13,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import re diff --git a/src/PIL/GribStubImagePlugin.py b/src/PIL/GribStubImagePlugin.py index c1c71da08c9..f8106800c42 100644 --- a/src/PIL/GribStubImagePlugin.py +++ b/src/PIL/GribStubImagePlugin.py @@ -8,6 +8,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations from . import Image, ImageFile diff --git a/src/PIL/Hdf5StubImagePlugin.py b/src/PIL/Hdf5StubImagePlugin.py index c26b480acf2..65409e269fc 100644 --- a/src/PIL/Hdf5StubImagePlugin.py +++ b/src/PIL/Hdf5StubImagePlugin.py @@ -8,6 +8,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations from . import Image, ImageFile diff --git a/src/PIL/IcnsImagePlugin.py b/src/PIL/IcnsImagePlugin.py index b415a32194d..d877b4ecba6 100644 --- a/src/PIL/IcnsImagePlugin.py +++ b/src/PIL/IcnsImagePlugin.py @@ -16,6 +16,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import io import os diff --git a/src/PIL/IcoImagePlugin.py b/src/PIL/IcoImagePlugin.py index 7f0f0047cdc..1b22f8645dc 100644 --- a/src/PIL/IcoImagePlugin.py +++ b/src/PIL/IcoImagePlugin.py @@ -20,7 +20,7 @@ # Icon format references: # * https://en.wikipedia.org/wiki/ICO_(file_format) # * https://msdn.microsoft.com/en-us/library/ms997538.aspx - +from __future__ import annotations import warnings from io import BytesIO diff --git a/src/PIL/ImImagePlugin.py b/src/PIL/ImImagePlugin.py index b42ba7cac70..97d726a8a65 100644 --- a/src/PIL/ImImagePlugin.py +++ b/src/PIL/ImImagePlugin.py @@ -24,7 +24,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations import os import re diff --git a/src/PIL/ImageCms.py b/src/PIL/ImageCms.py index 0df3a4c6ce5..9d27f2513a7 100644 --- a/src/PIL/ImageCms.py +++ b/src/PIL/ImageCms.py @@ -14,6 +14,7 @@ # See the README file for information on usage and redistribution. See # below for the original description. +from __future__ import annotations import sys from enum import IntEnum diff --git a/src/PIL/ImageColor.py b/src/PIL/ImageColor.py index 894461c831d..bfad27c82d6 100644 --- a/src/PIL/ImageColor.py +++ b/src/PIL/ImageColor.py @@ -16,6 +16,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import re diff --git a/src/PIL/ImageDraw.py b/src/PIL/ImageDraw.py index 6509d4c8e43..8611dcc361e 100644 --- a/src/PIL/ImageDraw.py +++ b/src/PIL/ImageDraw.py @@ -29,6 +29,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import math import numbers diff --git a/src/PIL/ImageDraw2.py b/src/PIL/ImageDraw2.py index 7ce0224a67c..35ee5834e34 100644 --- a/src/PIL/ImageDraw2.py +++ b/src/PIL/ImageDraw2.py @@ -22,7 +22,7 @@ .. seealso:: :py:mod:`PIL.ImageDraw` """ - +from __future__ import annotations from . import Image, ImageColor, ImageDraw, ImageFont, ImagePath diff --git a/src/PIL/ImageEnhance.py b/src/PIL/ImageEnhance.py index d7fdec262f4..93a50d2a2b9 100644 --- a/src/PIL/ImageEnhance.py +++ b/src/PIL/ImageEnhance.py @@ -17,6 +17,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations from . import Image, ImageFilter, ImageStat diff --git a/src/PIL/ImageFilter.py b/src/PIL/ImageFilter.py index c24f86ef38f..021b40c0ef4 100644 --- a/src/PIL/ImageFilter.py +++ b/src/PIL/ImageFilter.py @@ -14,6 +14,8 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations + import functools diff --git a/src/PIL/ImageGrab.py b/src/PIL/ImageGrab.py index bcfffc3dc13..a4993d3d4b8 100644 --- a/src/PIL/ImageGrab.py +++ b/src/PIL/ImageGrab.py @@ -14,6 +14,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import io import os diff --git a/src/PIL/ImageMath.py b/src/PIL/ImageMath.py index 04718719522..7ca512e7568 100644 --- a/src/PIL/ImageMath.py +++ b/src/PIL/ImageMath.py @@ -14,6 +14,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import builtins diff --git a/src/PIL/ImageMode.py b/src/PIL/ImageMode.py index a0b33514296..54c3d01c43a 100644 --- a/src/PIL/ImageMode.py +++ b/src/PIL/ImageMode.py @@ -12,6 +12,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import sys diff --git a/src/PIL/ImageMorph.py b/src/PIL/ImageMorph.py index 6fccc315b3d..282e7d2a54e 100644 --- a/src/PIL/ImageMorph.py +++ b/src/PIL/ImageMorph.py @@ -4,6 +4,7 @@ # 2014-06-04 Initial version. # # Copyright (c) 2014 Dov Grobgeld +from __future__ import annotations import re diff --git a/src/PIL/ImageOps.py b/src/PIL/ImageOps.py index f183c8f279e..a9e626b2b2a 100644 --- a/src/PIL/ImageOps.py +++ b/src/PIL/ImageOps.py @@ -16,6 +16,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import functools import operator diff --git a/src/PIL/ImagePalette.py b/src/PIL/ImagePalette.py index 2129487939b..fbcfa309d29 100644 --- a/src/PIL/ImagePalette.py +++ b/src/PIL/ImagePalette.py @@ -15,6 +15,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import array diff --git a/src/PIL/ImagePath.py b/src/PIL/ImagePath.py index 3d3538c97b7..77e8a609a55 100644 --- a/src/PIL/ImagePath.py +++ b/src/PIL/ImagePath.py @@ -13,6 +13,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations from . import Image diff --git a/src/PIL/ImageQt.py b/src/PIL/ImageQt.py index 56c1aa52576..6377c750105 100644 --- a/src/PIL/ImageQt.py +++ b/src/PIL/ImageQt.py @@ -15,6 +15,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import sys from io import BytesIO diff --git a/src/PIL/ImageSequence.py b/src/PIL/ImageSequence.py index 2d96b8b1365..e09b001e82d 100644 --- a/src/PIL/ImageSequence.py +++ b/src/PIL/ImageSequence.py @@ -14,6 +14,7 @@ # ## +from __future__ import annotations class Iterator: diff --git a/src/PIL/ImageShow.py b/src/PIL/ImageShow.py index 3d8fa2e402f..fad3e098003 100644 --- a/src/PIL/ImageShow.py +++ b/src/PIL/ImageShow.py @@ -11,6 +11,8 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations + import os import shutil import subprocess diff --git a/src/PIL/ImageStat.py b/src/PIL/ImageStat.py index edc39fb532d..13864e59cfc 100644 --- a/src/PIL/ImageStat.py +++ b/src/PIL/ImageStat.py @@ -20,6 +20,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import math diff --git a/src/PIL/ImageTk.py b/src/PIL/ImageTk.py index bf98eb2c8c2..10b2cc69a1e 100644 --- a/src/PIL/ImageTk.py +++ b/src/PIL/ImageTk.py @@ -24,6 +24,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import tkinter from io import BytesIO diff --git a/src/PIL/ImageTransform.py b/src/PIL/ImageTransform.py index 7881f0d262b..1fdaa9140ff 100644 --- a/src/PIL/ImageTransform.py +++ b/src/PIL/ImageTransform.py @@ -12,6 +12,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations from . import Image diff --git a/src/PIL/ImageWin.py b/src/PIL/ImageWin.py index c7c64b35add..75910d2d9ab 100644 --- a/src/PIL/ImageWin.py +++ b/src/PIL/ImageWin.py @@ -16,6 +16,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations from . import Image diff --git a/src/PIL/ImtImagePlugin.py b/src/PIL/ImtImagePlugin.py index d409fcd59de..7469c592dd2 100644 --- a/src/PIL/ImtImagePlugin.py +++ b/src/PIL/ImtImagePlugin.py @@ -13,7 +13,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations import re diff --git a/src/PIL/IptcImagePlugin.py b/src/PIL/IptcImagePlugin.py index 3a40cf987f4..e7dc3e4e4d2 100644 --- a/src/PIL/IptcImagePlugin.py +++ b/src/PIL/IptcImagePlugin.py @@ -14,6 +14,8 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations + import os import tempfile diff --git a/src/PIL/Jpeg2KImagePlugin.py b/src/PIL/Jpeg2KImagePlugin.py index bb0cb676a2e..4b778a0d33a 100644 --- a/src/PIL/Jpeg2KImagePlugin.py +++ b/src/PIL/Jpeg2KImagePlugin.py @@ -13,6 +13,8 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations + import io import os import struct diff --git a/src/PIL/JpegImagePlugin.py b/src/PIL/JpegImagePlugin.py index 5add65f4542..59bade303f8 100644 --- a/src/PIL/JpegImagePlugin.py +++ b/src/PIL/JpegImagePlugin.py @@ -31,6 +31,8 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations + import array import io import math diff --git a/src/PIL/JpegPresets.py b/src/PIL/JpegPresets.py index a678e248e9a..9ecfdb2599a 100644 --- a/src/PIL/JpegPresets.py +++ b/src/PIL/JpegPresets.py @@ -62,6 +62,7 @@ https://web.archive.org/web/20120328125543/http://www.jpegcameras.com/libjpeg/libjpeg-3.html """ +from __future__ import annotations # fmt: off presets = { diff --git a/src/PIL/McIdasImagePlugin.py b/src/PIL/McIdasImagePlugin.py index bb79e71de5d..9a85c0d15b0 100644 --- a/src/PIL/McIdasImagePlugin.py +++ b/src/PIL/McIdasImagePlugin.py @@ -15,6 +15,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import struct diff --git a/src/PIL/MicImagePlugin.py b/src/PIL/MicImagePlugin.py index 9300d354544..f4529d9ae74 100644 --- a/src/PIL/MicImagePlugin.py +++ b/src/PIL/MicImagePlugin.py @@ -15,7 +15,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations import olefile diff --git a/src/PIL/MpegImagePlugin.py b/src/PIL/MpegImagePlugin.py index bfa88fe99c4..f4e598ca3a0 100644 --- a/src/PIL/MpegImagePlugin.py +++ b/src/PIL/MpegImagePlugin.py @@ -12,7 +12,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations from . import Image, ImageFile from ._binary import i8 diff --git a/src/PIL/MpoImagePlugin.py b/src/PIL/MpoImagePlugin.py index 89083b4ff76..199a100904c 100644 --- a/src/PIL/MpoImagePlugin.py +++ b/src/PIL/MpoImagePlugin.py @@ -17,6 +17,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import itertools import os diff --git a/src/PIL/MspImagePlugin.py b/src/PIL/MspImagePlugin.py index 3f3609f1c20..77dac65b6b3 100644 --- a/src/PIL/MspImagePlugin.py +++ b/src/PIL/MspImagePlugin.py @@ -22,6 +22,7 @@ # Figure 206. Windows Paint Version 2: "LinS" Format. Used in Windows V2.03 # # See also: https://www.fileformat.info/format/mspaint/egff.htm +from __future__ import annotations import io import struct diff --git a/src/PIL/PSDraw.py b/src/PIL/PSDraw.py index c01534bbf42..848fc2f716a 100644 --- a/src/PIL/PSDraw.py +++ b/src/PIL/PSDraw.py @@ -14,6 +14,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import sys diff --git a/src/PIL/PaletteFile.py b/src/PIL/PaletteFile.py index 4a2c497fc49..dc31754020e 100644 --- a/src/PIL/PaletteFile.py +++ b/src/PIL/PaletteFile.py @@ -12,6 +12,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations from ._binary import o8 diff --git a/src/PIL/PalmImagePlugin.py b/src/PIL/PalmImagePlugin.py index 606739c8766..65be7fef7b1 100644 --- a/src/PIL/PalmImagePlugin.py +++ b/src/PIL/PalmImagePlugin.py @@ -6,6 +6,7 @@ ## # Image plugin for Palm pixmap images (output only). ## +from __future__ import annotations from . import Image, ImageFile from ._binary import o8 diff --git a/src/PIL/PcdImagePlugin.py b/src/PIL/PcdImagePlugin.py index c7cbca8c5d7..a0515b302eb 100644 --- a/src/PIL/PcdImagePlugin.py +++ b/src/PIL/PcdImagePlugin.py @@ -13,7 +13,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations from . import Image, ImageFile diff --git a/src/PIL/PcfFontFile.py b/src/PIL/PcfFontFile.py index 8b0014f3a02..d602a163349 100644 --- a/src/PIL/PcfFontFile.py +++ b/src/PIL/PcfFontFile.py @@ -15,6 +15,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import io diff --git a/src/PIL/PcxImagePlugin.py b/src/PIL/PcxImagePlugin.py index 67990b0adc1..98ecefd0514 100644 --- a/src/PIL/PcxImagePlugin.py +++ b/src/PIL/PcxImagePlugin.py @@ -24,6 +24,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import io import logging diff --git a/src/PIL/PdfImagePlugin.py b/src/PIL/PdfImagePlugin.py index b6bb60911aa..3506aadce83 100644 --- a/src/PIL/PdfImagePlugin.py +++ b/src/PIL/PdfImagePlugin.py @@ -19,6 +19,7 @@ ## # Image plugin for PDF images (output only). ## +from __future__ import annotations import io import math diff --git a/src/PIL/PdfParser.py b/src/PIL/PdfParser.py index 8bdb65cce23..0144600066f 100644 --- a/src/PIL/PdfParser.py +++ b/src/PIL/PdfParser.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import calendar import codecs import collections diff --git a/src/PIL/PixarImagePlugin.py b/src/PIL/PixarImagePlugin.py index 850272311de..af866feb362 100644 --- a/src/PIL/PixarImagePlugin.py +++ b/src/PIL/PixarImagePlugin.py @@ -18,6 +18,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations from . import Image, ImageFile from ._binary import i16le as i16 diff --git a/src/PIL/PngImagePlugin.py b/src/PIL/PngImagePlugin.py index dbcdee1c2d7..e4ed9388011 100644 --- a/src/PIL/PngImagePlugin.py +++ b/src/PIL/PngImagePlugin.py @@ -30,6 +30,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import itertools import logging diff --git a/src/PIL/PpmImagePlugin.py b/src/PIL/PpmImagePlugin.py index 93f1528c5c5..25dbfa5b0bc 100644 --- a/src/PIL/PpmImagePlugin.py +++ b/src/PIL/PpmImagePlugin.py @@ -13,7 +13,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations from . import Image, ImageFile from ._binary import i16be as i16 diff --git a/src/PIL/PsdImagePlugin.py b/src/PIL/PsdImagePlugin.py index 46970da049b..5cff564137d 100644 --- a/src/PIL/PsdImagePlugin.py +++ b/src/PIL/PsdImagePlugin.py @@ -15,6 +15,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import io diff --git a/src/PIL/PyAccess.py b/src/PIL/PyAccess.py index 24d30d2a6eb..23ff154f6cc 100644 --- a/src/PIL/PyAccess.py +++ b/src/PIL/PyAccess.py @@ -18,6 +18,7 @@ # * Fill.c uses the integer form, but it's still going to use the old # Access.c implementation. # +from __future__ import annotations import logging import sys diff --git a/src/PIL/QoiImagePlugin.py b/src/PIL/QoiImagePlugin.py index 66344faac58..a7b9d4a9e3a 100644 --- a/src/PIL/QoiImagePlugin.py +++ b/src/PIL/QoiImagePlugin.py @@ -5,6 +5,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import os diff --git a/src/PIL/SgiImagePlugin.py b/src/PIL/SgiImagePlugin.py index a2a259c890e..f9a10f6109c 100644 --- a/src/PIL/SgiImagePlugin.py +++ b/src/PIL/SgiImagePlugin.py @@ -20,7 +20,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations import os import struct diff --git a/src/PIL/SpiderImagePlugin.py b/src/PIL/SpiderImagePlugin.py index 14cad8f9ad6..86582fb128c 100644 --- a/src/PIL/SpiderImagePlugin.py +++ b/src/PIL/SpiderImagePlugin.py @@ -32,6 +32,8 @@ # Details about the Spider image format: # https://spider.wadsworth.org/spider_doc/spider/docs/image_doc.html # +from __future__ import annotations + import os import struct import sys diff --git a/src/PIL/SunImagePlugin.py b/src/PIL/SunImagePlugin.py index 6a8d5d86b73..11ce3dfefd0 100644 --- a/src/PIL/SunImagePlugin.py +++ b/src/PIL/SunImagePlugin.py @@ -15,7 +15,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations from . import Image, ImageFile, ImagePalette from ._binary import i32be as i32 diff --git a/src/PIL/TarIO.py b/src/PIL/TarIO.py index 32928f6af30..26522d93f79 100644 --- a/src/PIL/TarIO.py +++ b/src/PIL/TarIO.py @@ -13,6 +13,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import io diff --git a/src/PIL/TgaImagePlugin.py b/src/PIL/TgaImagePlugin.py index f24ee4f5c31..65c7484f756 100644 --- a/src/PIL/TgaImagePlugin.py +++ b/src/PIL/TgaImagePlugin.py @@ -15,7 +15,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations import warnings diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index a78a5aef1bc..fc242ca64c2 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -38,6 +38,8 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations + import io import itertools import logging diff --git a/src/PIL/TiffTags.py b/src/PIL/TiffTags.py index b02c637b6f5..88ff2f4fcd5 100644 --- a/src/PIL/TiffTags.py +++ b/src/PIL/TiffTags.py @@ -16,6 +16,7 @@ # This module provides constants and clear-text names for various # well-known TIFF tags. ## +from __future__ import annotations from collections import namedtuple diff --git a/src/PIL/WalImageFile.py b/src/PIL/WalImageFile.py index 3d9f97f8485..c5bf3e04cf7 100644 --- a/src/PIL/WalImageFile.py +++ b/src/PIL/WalImageFile.py @@ -22,6 +22,7 @@ is not registered for use with :py:func:`PIL.Image.open()`. To open a WAL file, use the :py:func:`PIL.WalImageFile.open()` function instead. """ +from __future__ import annotations from . import Image, ImageFile from ._binary import i32le as i32 diff --git a/src/PIL/WebPImagePlugin.py b/src/PIL/WebPImagePlugin.py index eed58a13b19..59556206a3c 100644 --- a/src/PIL/WebPImagePlugin.py +++ b/src/PIL/WebPImagePlugin.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from io import BytesIO from . import Image, ImageFile diff --git a/src/PIL/WmfImagePlugin.py b/src/PIL/WmfImagePlugin.py index 3e5fb01512d..b5b8c69b171 100644 --- a/src/PIL/WmfImagePlugin.py +++ b/src/PIL/WmfImagePlugin.py @@ -18,6 +18,7 @@ # https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-WMF/[MS-WMF].pdf # http://wvware.sourceforge.net/caolan/index.html # http://wvware.sourceforge.net/caolan/ora-wmf.html +from __future__ import annotations from . import Image, ImageFile from ._binary import i16le as word diff --git a/src/PIL/XVThumbImagePlugin.py b/src/PIL/XVThumbImagePlugin.py index eda60c5c5ca..47ba1c54803 100644 --- a/src/PIL/XVThumbImagePlugin.py +++ b/src/PIL/XVThumbImagePlugin.py @@ -16,6 +16,7 @@ # To do: # FIXME: make save work (this requires quantization support) # +from __future__ import annotations from . import Image, ImageFile, ImagePalette from ._binary import o8 diff --git a/src/PIL/XbmImagePlugin.py b/src/PIL/XbmImagePlugin.py index 71cd57d74da..566acbfe5af 100644 --- a/src/PIL/XbmImagePlugin.py +++ b/src/PIL/XbmImagePlugin.py @@ -18,6 +18,7 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import re diff --git a/src/PIL/XpmImagePlugin.py b/src/PIL/XpmImagePlugin.py index 8491d3b7e92..bf73c9bef06 100644 --- a/src/PIL/XpmImagePlugin.py +++ b/src/PIL/XpmImagePlugin.py @@ -13,7 +13,7 @@ # # See the README file for information on usage and redistribution. # - +from __future__ import annotations import re diff --git a/src/PIL/__init__.py b/src/PIL/__init__.py index 2bb8f6d7f10..3fcac8643cb 100644 --- a/src/PIL/__init__.py +++ b/src/PIL/__init__.py @@ -12,6 +12,7 @@ ;-) """ +from __future__ import annotations from . import _version diff --git a/src/PIL/__main__.py b/src/PIL/__main__.py index a05323f93b6..943789923dc 100644 --- a/src/PIL/__main__.py +++ b/src/PIL/__main__.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from .features import pilinfo pilinfo() diff --git a/src/PIL/_binary.py b/src/PIL/_binary.py index a74ee9eb6f3..c60c9cec1b7 100644 --- a/src/PIL/_binary.py +++ b/src/PIL/_binary.py @@ -13,7 +13,7 @@ """Binary input/output support routines.""" - +from __future__ import annotations from struct import pack, unpack_from diff --git a/src/PIL/_tkinter_finder.py b/src/PIL/_tkinter_finder.py index 597c21b5e38..03a6eba44ff 100644 --- a/src/PIL/_tkinter_finder.py +++ b/src/PIL/_tkinter_finder.py @@ -1,5 +1,7 @@ """ Find compiled module linking to Tcl / Tk libraries """ +from __future__ import annotations + import sys import tkinter from tkinter import _tkinter as tk diff --git a/src/PIL/_util.py b/src/PIL/_util.py index ba27b7e49e9..4634d335bba 100644 --- a/src/PIL/_util.py +++ b/src/PIL/_util.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import os from pathlib import Path diff --git a/src/PIL/_version.py b/src/PIL/_version.py index 279b6e2289a..7d994caf4d7 100644 --- a/src/PIL/_version.py +++ b/src/PIL/_version.py @@ -1,2 +1,4 @@ # Master version for Pillow +from __future__ import annotations + __version__ = "10.2.0.dev0" diff --git a/src/PIL/features.py b/src/PIL/features.py index f14e60cf5d4..b14d6df13f2 100644 --- a/src/PIL/features.py +++ b/src/PIL/features.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import collections import os import sys