mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-21 01:32:00 +03:00
Merge pull request #8844 from radarhere/import
Do not import TYPE_CHECKING
This commit is contained in:
commit
60b5131e9f
|
@ -31,7 +31,7 @@ import os
|
|||
import subprocess
|
||||
from enum import IntEnum
|
||||
from functools import cached_property
|
||||
from typing import IO, TYPE_CHECKING, Any, Literal, NamedTuple, Union
|
||||
from typing import IO, Any, Literal, NamedTuple, Union
|
||||
|
||||
from . import (
|
||||
Image,
|
||||
|
@ -47,6 +47,7 @@ from ._binary import o8
|
|||
from ._binary import o16le as o16
|
||||
from ._util import DeferredError
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from . import _imaging
|
||||
from ._typing import Buffer
|
||||
|
|
|
@ -41,14 +41,7 @@ import warnings
|
|||
from collections.abc import Callable, Iterator, MutableMapping, Sequence
|
||||
from enum import IntEnum
|
||||
from types import ModuleType
|
||||
from typing import (
|
||||
IO,
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Literal,
|
||||
Protocol,
|
||||
cast,
|
||||
)
|
||||
from typing import IO, Any, Literal, Protocol, cast
|
||||
|
||||
# VERSION was removed in Pillow 6.0.0.
|
||||
# PILLOW_VERSION was removed in Pillow 9.0.0.
|
||||
|
@ -218,6 +211,7 @@ if hasattr(core, "DEFAULT_STRATEGY"):
|
|||
# --------------------------------------------------------------------
|
||||
# Registries
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
import mmap
|
||||
from xml.etree.ElementTree import Element
|
||||
|
|
|
@ -35,7 +35,7 @@ import math
|
|||
import struct
|
||||
from collections.abc import Sequence
|
||||
from types import ModuleType
|
||||
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Union, cast
|
||||
from typing import Any, AnyStr, Callable, Union, cast
|
||||
|
||||
from . import Image, ImageColor
|
||||
from ._deprecate import deprecate
|
||||
|
@ -44,6 +44,7 @@ from ._typing import Coords
|
|||
# experimental access to the outline API
|
||||
Outline: Callable[[], Image.core._Outline] = Image.core.outline
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from . import ImageDraw2, ImageFont
|
||||
|
||||
|
|
|
@ -34,12 +34,13 @@ import itertools
|
|||
import logging
|
||||
import os
|
||||
import struct
|
||||
from typing import IO, TYPE_CHECKING, Any, NamedTuple, cast
|
||||
from typing import IO, Any, NamedTuple, cast
|
||||
|
||||
from . import ExifTags, Image
|
||||
from ._deprecate import deprecate
|
||||
from ._util import DeferredError, is_path
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from ._typing import StrOrBytesPath
|
||||
|
||||
|
|
|
@ -20,8 +20,9 @@ import abc
|
|||
import functools
|
||||
from collections.abc import Sequence
|
||||
from types import ModuleType
|
||||
from typing import TYPE_CHECKING, Any, Callable, cast
|
||||
from typing import Any, Callable, cast
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from . import _imaging
|
||||
from ._typing import NumpyArray
|
||||
|
|
|
@ -34,12 +34,13 @@ import warnings
|
|||
from enum import IntEnum
|
||||
from io import BytesIO
|
||||
from types import ModuleType
|
||||
from typing import IO, TYPE_CHECKING, Any, BinaryIO, TypedDict, cast
|
||||
from typing import IO, Any, BinaryIO, TypedDict, cast
|
||||
|
||||
from . import Image, features
|
||||
from ._typing import StrOrBytesPath
|
||||
from ._util import DeferredError, is_path
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from . import ImageFile
|
||||
from ._imaging import ImagingFont
|
||||
|
|
|
@ -19,10 +19,11 @@ from __future__ import annotations
|
|||
|
||||
import array
|
||||
from collections.abc import Sequence
|
||||
from typing import IO, TYPE_CHECKING
|
||||
from typing import IO
|
||||
|
||||
from . import GimpGradientFile, GimpPaletteFile, ImageColor, PaletteFile
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from . import Image
|
||||
|
||||
|
|
|
@ -19,11 +19,12 @@ from __future__ import annotations
|
|||
|
||||
import sys
|
||||
from io import BytesIO
|
||||
from typing import TYPE_CHECKING, Any, Callable, Union
|
||||
from typing import Any, Callable, Union
|
||||
|
||||
from . import Image
|
||||
from ._util import is_path
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
import PyQt6
|
||||
import PySide6
|
||||
|
|
|
@ -28,10 +28,11 @@ from __future__ import annotations
|
|||
|
||||
import tkinter
|
||||
from io import BytesIO
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import Any
|
||||
|
||||
from . import Image, ImageFile
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from ._typing import CapsuleType
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ import subprocess
|
|||
import sys
|
||||
import tempfile
|
||||
import warnings
|
||||
from typing import IO, TYPE_CHECKING, Any
|
||||
from typing import IO, Any
|
||||
|
||||
from . import Image, ImageFile
|
||||
from ._binary import i16be as i16
|
||||
|
@ -52,6 +52,7 @@ from ._binary import o16be as o16
|
|||
from ._deprecate import deprecate
|
||||
from .JpegPresets import presets
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from .MpoImagePlugin import MpoImageFile
|
||||
|
||||
|
|
|
@ -17,10 +17,13 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from typing import IO, TYPE_CHECKING
|
||||
from typing import IO
|
||||
|
||||
from . import EpsImagePlugin
|
||||
|
||||
TYPE_CHECKING = False
|
||||
|
||||
|
||||
##
|
||||
# Simple PostScript graphics interface.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import os
|
|||
import re
|
||||
import time
|
||||
import zlib
|
||||
from typing import IO, TYPE_CHECKING, Any, NamedTuple, Union
|
||||
from typing import IO, Any, NamedTuple, Union
|
||||
|
||||
|
||||
# see 7.9.2.2 Text String Type on page 86 and D.3 PDFDocEncoding Character Set
|
||||
|
@ -251,6 +251,7 @@ class PdfArray(list[Any]):
|
|||
return b"[ " + b" ".join(pdf_repr(x) for x in self) + b" ]"
|
||||
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
_DictBase = collections.UserDict[Union[str, bytes], Any]
|
||||
else:
|
||||
|
|
|
@ -40,7 +40,7 @@ import warnings
|
|||
import zlib
|
||||
from collections.abc import Callable
|
||||
from enum import IntEnum
|
||||
from typing import IO, TYPE_CHECKING, Any, NamedTuple, NoReturn, cast
|
||||
from typing import IO, Any, NamedTuple, NoReturn, cast
|
||||
|
||||
from . import Image, ImageChops, ImageFile, ImagePalette, ImageSequence
|
||||
from ._binary import i16be as i16
|
||||
|
@ -50,6 +50,7 @@ from ._binary import o16be as o16
|
|||
from ._binary import o32be as o32
|
||||
from ._util import DeferredError
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from . import _imaging
|
||||
|
||||
|
|
|
@ -37,11 +37,13 @@ from __future__ import annotations
|
|||
import os
|
||||
import struct
|
||||
import sys
|
||||
from typing import IO, TYPE_CHECKING, Any, cast
|
||||
from typing import IO, Any, cast
|
||||
|
||||
from . import Image, ImageFile
|
||||
from ._util import DeferredError
|
||||
|
||||
TYPE_CHECKING = False
|
||||
|
||||
|
||||
def isInt(f: Any) -> int:
|
||||
try:
|
||||
|
|
|
@ -50,7 +50,7 @@ import warnings
|
|||
from collections.abc import Iterator, MutableMapping
|
||||
from fractions import Fraction
|
||||
from numbers import Number, Rational
|
||||
from typing import IO, TYPE_CHECKING, Any, Callable, NoReturn, cast
|
||||
from typing import IO, Any, Callable, NoReturn, cast
|
||||
|
||||
from . import ExifTags, Image, ImageFile, ImageOps, ImagePalette, TiffTags
|
||||
from ._binary import i16be as i16
|
||||
|
@ -61,6 +61,7 @@ from ._typing import StrOrBytesPath
|
|||
from ._util import DeferredError, is_path
|
||||
from .TiffTags import TYPES
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from ._typing import Buffer, IntegralLike
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@ from __future__ import annotations
|
|||
import os
|
||||
import sys
|
||||
from collections.abc import Sequence
|
||||
from typing import TYPE_CHECKING, Any, Protocol, TypeVar, Union
|
||||
from typing import Any, Protocol, TypeVar, Union
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from numbers import _IntegralLike as IntegralLike
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user