-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path__init__.py
62 lines (46 loc) · 2.93 KB
/
__init__.py
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
"""Metrology APIs."""
from typing import Final, Protocol, Self, runtime_checkable
import optype as op
__version__: Final = "0.0.1.dev0"
__all__ = ["__version__", "Dimension", "Quantity", "Unit"]
@runtime_checkable
class Dimension(Protocol):
def __mul__(self, other: Self, /) -> Self: ...
def __truediv__(self, other: Self, /) -> Self: ...
def __pow__(self, other: int, /) -> Self: ...
@runtime_checkable
class Unit(Protocol):
@property
def dimension(self) -> Dimension: ...
def __mul__(self, other: Self, /) -> Self: ...
def __truediv__(self, other: Self, /) -> Self: ...
def __pow__(self, other: int | float, /) -> Self: ...
def __rmul__(self, other: Self, /) -> Self: ...
def __rtruediv__(self, other: Self, /) -> Self: ...
def __rpow__(self, other: int | float, /) -> Self: ...
@runtime_checkable
class Quantity[V, U: Unit](Protocol):
@property
def value(self) -> V: ...
@property
def unit(self) -> U: ...
### Dunder Methods
def __eq__[B](self: "Quantity[V, U]", other: "Quantity[op.CanEq[V, B], U]", /) -> B: ...
def __ne__[B](self: "Quantity[V, U]", other: "Quantity[op.CanEq[V, B], U]", /) -> B: ...
def __lt__[B](self: "Quantity[V, U]", other: "Quantity[op.CanOrd[V, B], U]", /) -> B: ...
def __le__[B](self: "Quantity[V, U]", other: "Quantity[op.CanOrd[V, B], U]", /) -> B: ...
def __gt__[B](self: "Quantity[V, U]", other: "Quantity[op.CanOrd[V, B], U]", /) -> B: ...
def __ge__[B](self: "Quantity[V, U]", other: "Quantity[op.CanOrd[V, B], U]", /) -> B: ...
def __pos__(self: "Quantity[V, U]") -> "Quantity[op.CanPos[V], U]": ...
def __neg__(self: "Quantity[V, U]") -> "Quantity[op.CanNeg[V], U]": ...
def __abs__(self: "Quantity[V, U]") -> "Quantity[op.CanAbs[V], U]": ...
def __add__[B](self: "Quantity[V, U]", other: "Quantity[op.CanAdd[V, B], U]", /) -> "Quantity[op.CanAdd[V, B], U]": ...
def __radd__[B](self: "Quantity[V, U]", other: "Quantity[op.CanAdd[V, B], U]", /) -> "Quantity[op.CanAdd[V, B], U]": ...
def __sub__[B](self: "Quantity[V, U]", other: "Quantity[op.CanSub[V, B], U]", /) -> "Quantity[op.CanSub[V, B], U]": ...
def __rsub__[B](self: "Quantity[V, U]", other: "Quantity[op.CanSub[V, B], U]", /) -> "Quantity[op.CanSub[V, B], U]": ...
def __mul__[B](self: "Quantity[V, U]", other: "Quantity[op.CanMul[V, B], U]", /) -> "Quantity[op.CanMul[V, B], U]": ...
def __rmul__[B](self: "Quantity[V, U]", other: "Quantity[op.CanMul[V, B], U]", /) -> "Quantity[op.CanMul[V, B], U]": ...
def __truediv__[B](self: "Quantity[V, U]", other: "Quantity[op.CanDiv[V, B], U]", /) -> "Quantity[op.CanDiv[V, B], U]": ...
def __rtruediv__[B](self: "Quantity[V, U]", other: "Quantity[op.CanDiv[V, B], U]", /) -> "Quantity[op.CanDiv[V, B], U]": ...
def __pow__(self: "Quantity[V, U]", other: int | float, /) -> "Quantity[op.CanPow[V], U]": ...
def __rpow__(self: "Quantity[V, U]", other: int | float, /) -> "Quantity[op.CanPow[V], U]": ...