Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.9/dist-packages/PIL/_typing.py: 59%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from __future__ import annotations
3import os
4import sys
5from collections.abc import Sequence
6from typing import TYPE_CHECKING, Any, Protocol, TypeVar, Union
8if TYPE_CHECKING:
9 from numbers import _IntegralLike as IntegralLike
11 try:
12 import numpy.typing as npt
14 NumpyArray = npt.NDArray[Any] # requires numpy>=1.21
15 except (ImportError, AttributeError):
16 pass
18if sys.version_info >= (3, 13):
19 from types import CapsuleType
20else:
21 CapsuleType = object
23if sys.version_info >= (3, 12):
24 from collections.abc import Buffer
25else:
26 Buffer = Any
28if sys.version_info >= (3, 10):
29 from typing import TypeGuard
30else:
31 try:
32 from typing_extensions import TypeGuard
33 except ImportError:
35 class TypeGuard: # type: ignore[no-redef]
36 def __class_getitem__(cls, item: Any) -> type[bool]:
37 return bool
40Coords = Union[Sequence[float], Sequence[Sequence[float]]]
43_T_co = TypeVar("_T_co", covariant=True)
46class SupportsRead(Protocol[_T_co]):
47 def read(self, length: int = ..., /) -> _T_co: ...
50StrOrBytesPath = Union[str, bytes, os.PathLike[str], os.PathLike[bytes]]
53__all__ = ["Buffer", "IntegralLike", "StrOrBytesPath", "SupportsRead", "TypeGuard"]