1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union, Protocol
# TODO: Remove when 3.11 becomes minimal version.
Self = TypeVar("Self")
if TYPE_CHECKING:
from .facets.plain import PlainQuantity as Quantity
from .facets.plain import PlainUnit as Unit
from .util import UnitsContainer
class PintScalar(Protocol):
def __add__(self, other: Any) -> Any:
...
def __sub__(self, other: Any) -> Any:
...
def __mul__(self, other: Any) -> Any:
...
def __truediv__(self, other: Any) -> Any:
...
def __floordiv__(self, other: Any) -> Any:
...
def __mod__(self, other: Any) -> Any:
...
def __divmod__(self, other: Any) -> Any:
...
def __pow__(self, other: Any, modulo: Any) -> Any:
...
class PintArray(Protocol):
def __len__(self) -> int:
...
def __getitem__(self, key: Any) -> Any:
...
def __setitem__(self, key: Any, value: Any) -> None:
...
# TODO: Change when Python 3.10 becomes minimal version.
# Magnitude = PintScalar | PintArray
Magnitude = Union[PintScalar, PintArray]
UnitLike = Union[str, "UnitsContainer", "Unit"]
QuantityOrUnitLike = Union["Quantity", UnitLike]
Shape = tuple[int, ...]
_MagnitudeType = TypeVar("_MagnitudeType")
S = TypeVar("S")
FuncType = Callable[..., Any]
F = TypeVar("F", bound=FuncType)
|