diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py index 0ca965d38..58c460ef3 100644 --- a/src/PIL/GifImagePlugin.py +++ b/src/PIL/GifImagePlugin.py @@ -31,7 +31,7 @@ import os import subprocess from enum import IntEnum from functools import cached_property -from typing import IO, Any, Literal, NamedTuple, cast +from typing import Any, NamedTuple, cast from . import ( Image, @@ -49,6 +49,8 @@ from ._util import DeferredError TYPE_CHECKING = False if TYPE_CHECKING: + from typing import IO, Literal + from . import _imaging from ._typing import Buffer diff --git a/src/PIL/ImageDraw.py b/src/PIL/ImageDraw.py index ae092345a..ed46899b4 100644 --- a/src/PIL/ImageDraw.py +++ b/src/PIL/ImageDraw.py @@ -33,22 +33,23 @@ from __future__ import annotations import math import struct -from collections.abc import Callable, Sequence +from collections.abc import Sequence from typing import cast from . import Image, ImageColor -# experimental access to the outline API -Outline: Callable[[], Image.core._Outline] = Image.core.outline - TYPE_CHECKING = False if TYPE_CHECKING: + from collections.abc import Callable from types import ModuleType from typing import Any, AnyStr from . import ImageDraw2, ImageFont from ._typing import Coords +# experimental access to the outline API +Outline: Callable[[], Image.core._Outline] = Image.core.outline + _Ink = float | tuple[int, ...] | str """