-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path__init__.py
41 lines (29 loc) · 1.08 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
"""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: ...
#