mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-03 20:10:08 +03:00
Moved imports into TYPE_CHECKING
This commit is contained in:
parent
98d6c3bf88
commit
27a7582b35
|
@ -7,7 +7,7 @@ import shutil
|
|||
import sys
|
||||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
from typing import Any, Literal, cast
|
||||
from typing import Literal, cast
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -31,6 +31,9 @@ except ImportError:
|
|||
# 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)
|
||||
|
|
|
@ -17,7 +17,10 @@ from __future__ import annotations
|
|||
|
||||
import re
|
||||
from io import BytesIO
|
||||
from typing import IO
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from typing import IO
|
||||
|
||||
|
||||
class GimpPaletteFile:
|
||||
|
|
|
@ -38,10 +38,9 @@ import struct
|
|||
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.
|
||||
|
@ -64,6 +63,12 @@ try:
|
|||
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__)
|
||||
|
||||
|
||||
|
|
|
@ -18,11 +18,15 @@ from __future__ import annotations
|
|||
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:
|
||||
"""
|
||||
|
|
|
@ -42,7 +42,6 @@ import subprocess
|
|||
import sys
|
||||
import tempfile
|
||||
import warnings
|
||||
from typing import IO, Any
|
||||
|
||||
from . import Image, ImageFile
|
||||
from ._binary import i16be as i16
|
||||
|
@ -53,6 +52,8 @@ from .JpegPresets import presets
|
|||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from typing import IO, Any
|
||||
|
||||
from .MpoImagePlugin import MpoImageFile
|
||||
|
||||
#
|
||||
|
|
|
@ -38,9 +38,8 @@ import re
|
|||
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
|
||||
|
@ -53,6 +52,9 @@ from ._util import DeferredError
|
|||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
from typing import Any, NoReturn
|
||||
|
||||
from . import _imaging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from io import BytesIO
|
||||
from typing import IO, Any
|
||||
|
||||
from . import Image, ImageFile
|
||||
|
||||
|
@ -12,6 +11,9 @@ try:
|
|||
except ImportError:
|
||||
SUPPORTED = False
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from typing import IO, Any
|
||||
|
||||
_VP8_MODES_BY_IDENTIFIER = {
|
||||
b"VP8 ": "RGB",
|
||||
|
|
Loading…
Reference in New Issue
Block a user