Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion Tests/test_imagecms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
from io import BytesIO
from pathlib import Path
from typing import Any, Literal, cast
from typing import Literal, cast

import pytest

Expand All @@ -31,6 +31,9 @@
# Skipped via setup_module()
pass

TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Any

SRGB = "Tests/icc/sRGB_IEC61966-2-1_black_scaled.icc"
HAVE_PROFILE = os.path.exists(SRGB)
Expand Down
5 changes: 4 additions & 1 deletion src/PIL/GimpPaletteFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

import re
from io import BytesIO
from typing import IO

TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import IO


class GimpPaletteFile:
Expand Down
11 changes: 8 additions & 3 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@
import sys
import tempfile
import warnings
from collections.abc import Callable, Iterator, MutableMapping, Sequence
from collections.abc import MutableMapping
from enum import IntEnum
from types import ModuleType
from typing import IO, Any, Literal, Protocol, cast
from typing import IO, Protocol, cast

# VERSION was removed in Pillow 6.0.0.
# PILLOW_VERSION was removed in Pillow 9.0.0.
Expand All @@ -64,6 +63,12 @@
except ImportError:
ElementTree = None

TYPE_CHECKING = False
if TYPE_CHECKING:
from collections.abc import Callable, Iterator, Sequence
from types import ModuleType
from typing import Any, Literal

logger = logging.getLogger(__name__)


Expand Down
8 changes: 6 additions & 2 deletions src/PIL/Jpeg2KImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
import io
import os
import struct
from collections.abc import Callable
from typing import IO, cast
from typing import cast

from . import Image, ImageFile, ImagePalette, _binary

TYPE_CHECKING = False
if TYPE_CHECKING:
from collections.abc import Callable
from typing import IO


class BoxReader:
"""
Expand Down
3 changes: 2 additions & 1 deletion src/PIL/JpegImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import sys
import tempfile
import warnings
from typing import IO, Any

from . import Image, ImageFile
from ._binary import i16be as i16
Expand All @@ -53,6 +52,8 @@

TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import IO, Any

from .MpoImagePlugin import MpoImageFile

#
Expand Down
6 changes: 4 additions & 2 deletions src/PIL/PngImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@
import struct
import warnings
import zlib
from collections.abc import Callable
from enum import IntEnum
from typing import IO, Any, NamedTuple, NoReturn, cast
from typing import IO, NamedTuple, cast

from . import Image, ImageChops, ImageFile, ImagePalette, ImageSequence
from ._binary import i16be as i16
Expand All @@ -53,6 +52,9 @@

TYPE_CHECKING = False
if TYPE_CHECKING:
from collections.abc import Callable
from typing import Any, NoReturn

from . import _imaging

logger = logging.getLogger(__name__)
Expand Down
4 changes: 3 additions & 1 deletion src/PIL/WebPImagePlugin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

from io import BytesIO
from typing import IO, Any

from . import Image, ImageFile

Expand All @@ -12,6 +11,9 @@
except ImportError:
SUPPORTED = False

TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import IO, Any

_VP8_MODES_BY_IDENTIFIER = {
b"VP8 ": "RGB",
Expand Down
Loading