Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add from __future__ import annotations using Ruff/isort #7631

Merged
merged 3 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/system-info.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
Requested here:
https://github.com/actions/virtual-environments/issues/79
"""
from __future__ import annotations

import os
import platform
import sys
Expand Down
1 change: 1 addition & 0 deletions Tests/32bit_segfault_check.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from __future__ import annotations

import sys

Expand Down
1 change: 1 addition & 0 deletions Tests/bench_cffi_access.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import time

from PIL import PyAccess
Expand Down
1 change: 1 addition & 0 deletions Tests/check_fli_oob.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from __future__ import annotations

from PIL import Image

Expand Down
1 change: 1 addition & 0 deletions Tests/check_fli_overflow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from PIL import Image

TEST_FILE = "Tests/images/fli_overflow.fli"
Expand Down
1 change: 1 addition & 0 deletions Tests/check_icns_dos.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions Tests/check_imaging_leaks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from __future__ import annotations
import pytest

from PIL import Image
Expand Down
1 change: 1 addition & 0 deletions Tests/check_j2k_dos.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions Tests/check_j2k_leaks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from io import BytesIO

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/check_j2k_overflow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image
Expand Down
1 change: 1 addition & 0 deletions Tests/check_jp2_overflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Tests/check_jpeg_leaks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from io import BytesIO

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/check_large_memory.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import sys

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/check_large_memory_numpy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import sys

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/check_libtiff_segfault.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image
Expand Down
1 change: 1 addition & 0 deletions Tests/check_png_dos.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import zlib
from io import BytesIO

Expand Down
1 change: 1 addition & 0 deletions Tests/check_release_notes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import sys
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions Tests/check_wheel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import sys

from PIL import features
Expand Down
1 change: 1 addition & 0 deletions Tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import io


Expand Down
1 change: 1 addition & 0 deletions Tests/createfontdatachunk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from __future__ import annotations
import base64
import os

Expand Down
1 change: 1 addition & 0 deletions Tests/helper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Helper functions.
"""
from __future__ import annotations

import logging
import os
Expand Down
1 change: 1 addition & 0 deletions Tests/oss-fuzz/fuzz_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Tests/oss-fuzz/fuzz_pillow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Tests/oss-fuzz/fuzzers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import io
import warnings

Expand Down
1 change: 1 addition & 0 deletions Tests/oss-fuzz/test_fuzzers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import subprocess
import sys

Expand Down
1 change: 1 addition & 0 deletions Tests/test_000_sanity.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from PIL import Image


Expand Down
1 change: 1 addition & 0 deletions Tests/test_binary.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from PIL import _binary


Expand Down
1 change: 1 addition & 0 deletions Tests/test_bmp_reference.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import os
import warnings

Expand Down
1 change: 1 addition & 0 deletions Tests/test_box_blur.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image, ImageFilter
Expand Down
1 change: 1 addition & 0 deletions Tests/test_color_lut.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from array import array

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/test_core_resources.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import sys

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/test_decompression_bomb.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_deprecate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import _deprecate
Expand Down
1 change: 1 addition & 0 deletions Tests/test_features.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import io
import re

Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_apng.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image, ImageSequence, PngImagePlugin
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_blp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_bmp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import io

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_bufrstub.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import BufrStubImagePlugin, Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_container.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import ContainerIO, Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_cur.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import CurImagePlugin, Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_dcx.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import warnings

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_dds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test DdsImagePlugin"""
from __future__ import annotations
from io import BytesIO

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_eps.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import io

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_fits.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from io import BytesIO

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_fli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import warnings

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_fpx.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_ftex.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import FtexImagePlugin, Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_gbr.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import GbrImagePlugin, Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_gd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import GdImageFile, UnidentifiedImageError
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_gif.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import warnings
from io import BytesIO

Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_gimpgradient.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from PIL import GimpGradientFile, ImagePalette


Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_gimppalette.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL.GimpPaletteFile import GimpPaletteFile
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_gribstub.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import GribStubImagePlugin, Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_hdf5stub.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Hdf5StubImagePlugin, Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_icns.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import io
import os
import warnings
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_ico.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import io
import os

Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_im.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import filecmp
import warnings

Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_imt.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import io

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_iptc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import sys
from io import BytesIO, StringIO

Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_jpeg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import os
import re
import warnings
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_jpeg2k.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import os
import re
from io import BytesIO
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_libtiff.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import base64
import io
import itertools
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_libtiff_small.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from io import BytesIO

from PIL import Image
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_mcidas.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image, McIdasImagePlugin
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_mic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image, ImagePalette
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_mpo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import warnings
from io import BytesIO

Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_msp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import os

import pytest
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_palm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import os.path
import subprocess

Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_pcd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from PIL import Image


Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_pcx.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image, ImageFile, PcxImagePlugin
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_pdf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import io
import os
import os.path
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_pixar.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import pytest

from PIL import Image, PixarImagePlugin
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_png.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import re
import sys
import warnings
Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_ppm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import sys
from io import BytesIO

Expand Down
1 change: 1 addition & 0 deletions Tests/test_file_psd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import warnings

import pytest
Expand Down
Loading
Loading