Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/PIL/_typing.py: 56%
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 Any, Protocol, TypeVar, Union
8TYPE_CHECKING = False
9if TYPE_CHECKING:
10 from numbers import _IntegralLike as IntegralLike
12 try:
13 import numpy.typing as npt
15 NumpyArray = npt.NDArray[Any] # requires numpy>=1.21
16 except (ImportError, AttributeError):
17 pass
19if sys.version_info >= (3, 13):
20 from types import CapsuleType
21else:
22 CapsuleType = object
24if sys.version_info >= (3, 12):
25 from collections.abc import Buffer
26else:
27 Buffer = Any
29if sys.version_info >= (3, 10):
30 from typing import TypeGuard
31else:
32 try:
33 from typing_extensions import TypeGuard
34 except ImportError:
36 class TypeGuard: # type: ignore[no-redef]
37 def __class_getitem__(cls, item: Any) -> type[bool]:
38 return bool
41Coords = Union[Sequence[float], Sequence[Sequence[float]]]
44_T_co = TypeVar("_T_co", covariant=True)
47class SupportsRead(Protocol[_T_co]):
48 def read(self, length: int = ..., /) -> _T_co: ...
51StrOrBytesPath = Union[str, bytes, os.PathLike[str], os.PathLike[bytes]]
54__all__ = ["Buffer", "IntegralLike", "StrOrBytesPath", "SupportsRead", "TypeGuard"]