Skip to content

Commit 5c2205a

Browse files
authored
_typing is only imported under TYPE_CHECKING (#179)
2 parents bd4ebe8 + 548098e commit 5c2205a

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

Tests/test_file_pcx.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import io
4-
from pathlib import Path
54

65
import pytest
76

src/PIL/ImageFile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
import logging
3535
import os
3636
import struct
37-
from typing import IO, NamedTuple, cast
37+
from typing import NamedTuple, cast
3838

3939
from . import ExifTags, Image
4040
from ._util import DeferredError, is_path
4141

4242
TYPE_CHECKING = False
4343
if TYPE_CHECKING:
44-
from typing import Any, Self
44+
from typing import IO, Any, Self
4545

4646
from ._typing import StrOrBytesPath
4747

src/PIL/ImageFont.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
from enum import IntEnum
3636
from io import BytesIO
3737
from types import ModuleType
38-
from typing import IO, NotRequired, TypedDict, cast
38+
from typing import TypedDict, cast
3939

4040
from . import Image
4141
from ._util import DeferredError, is_path
4242

4343
TYPE_CHECKING = False
4444
if TYPE_CHECKING:
45-
from typing import Any, BinaryIO
45+
from typing import IO, Any, BinaryIO, NotRequired
4646

4747
from . import ImageFile
4848
from ._imaging import ImagingFont

src/PIL/_typing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
import os
44
import sys
55
from collections.abc import Sequence
6+
from numbers import _IntegralLike as IntegralLike
67
from typing import Any, Protocol, TypeVar
78

89
TYPE_CHECKING = False
910
if TYPE_CHECKING:
10-
from numbers import _IntegralLike as IntegralLike # noqa: TC004
11-
1211
try:
1312
import numpy.typing as npt
1413

0 commit comments

Comments
 (0)