Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_typing.py46 linesDownload Raw Back to PIL
1from __future__ import annotations
2
3import os
4import sys
5from collections.abc import Sequence
6from typing import Any, Protocol, TypeVar
7
8TYPE_CHECKING = False
9if TYPE_CHECKING:
10    from numbers import _IntegralLike as IntegralLike
11
12    try:
13        import numpy.typing as npt
14
15        NumpyArray = npt.NDArray[Any]
16    except ImportError:
17        pass
18
19if sys.version_info >= (3, 13):
20    from types import CapsuleType
21else:
22    CapsuleType = object
23
24if sys.version_info >= (3, 12):
25    from collections.abc import Buffer
26else:
27    Buffer = Any
28
29
30_Ink = float | tuple[int, ...] | str
31
32Coords = Sequence[float] | Sequence[Sequence[float]]
33
34
35_T_co = TypeVar("_T_co", covariant=True)
36
37
38class SupportsRead(Protocol[_T_co]):
39    def read(self, length: int = ..., /) -> _T_co: ...
40
41
42StrOrBytesPath = str | bytes | os.PathLike[str] | os.PathLike[bytes]
43
44
45__all__ = ["Buffer", "IntegralLike", "StrOrBytesPath", "SupportsRead"]
46