Skip to content

Commit 0dc5b3e

Browse files
Peter Konradin-takumasa
authored andcommitted
Quantity type stub
1 parent 3ffd8cc commit 0dc5b3e

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

quantities/quantity.pyi

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
from typing import Optional
2+
3+
from quantities.dimensionality import Dimensionality
4+
from quantities.typing.quantities import DimensionalityDescriptor, QuantityData
5+
import numpy.typing as npt
6+
7+
def validate_unit_quantity(value: Quantity) -> Quantity:
8+
...
9+
10+
def validate_dimensionality(value: DimensionalityDescriptor) -> Dimensionality:
11+
...
12+
13+
def get_conversion_factor(from_u: Quantity, to_u: Quantity) -> float:
14+
...
15+
16+
17+
class Quantity(npt.NDArray):
18+
19+
def __new__(cls, data: QuantityData, units: DimensionalityDescriptor = '',
20+
dtype: Optional[object] = None, copy: bool = True) -> Quantity:
21+
...
22+
23+
@property
24+
def dimensionality(self) -> Dimensionality:
25+
...
26+
27+
@property
28+
def _reference(self) :
29+
...
30+
31+
@property
32+
def magnitude(self) -> npt.NDArray:
33+
...
34+
35+
@property
36+
def real(self) -> Quantity:
37+
...
38+
39+
@property
40+
def imag(self) -> Quantity:
41+
...
42+
43+
@property
44+
def units(self) -> Quantity:
45+
...
46+
47+
def rescale(self, units: Optional[DimensionalityDescriptor] = None) -> Quantity:
48+
...
49+
50+
def rescale_preferred(self) -> Quantity:
51+
...
52+
53+
def __add__(self, other) -> Quantity:
54+
...
55+
56+
def __radd__(self, other) -> Quantity:
57+
...
58+
59+
def __iadd__(self, other) -> Quantity:
60+
...
61+
62+
def __sub__(self, other) -> Quantity:
63+
...
64+
65+
def __rsub__(self, other) -> Quantity:
66+
...
67+
68+
def __isub__(self, other) -> Quantity:
69+
...
70+
71+
def __mod__(self, other) -> Quantity:
72+
...
73+
74+
def __imod__(self, other) -> Quantity:
75+
...
76+
77+
def __imul__(self, other) -> Quantity:
78+
...
79+
80+
def __rmul__(self, other) -> Quantity:
81+
...
82+
83+
def __itruediv__(self, other) -> Quantity:
84+
...
85+
86+
def __rtruediv__(self, other) -> Quantity:
87+
...
88+
89+
def __pow__(self, power) -> Quantity:
90+
...
91+
92+
def __ipow__(self, other) -> Quantity:
93+
...
94+
95+
def __round__(self, decimals: int = 0) -> Quantity:
96+
...
97+
98+
def __repr__(self) -> str:
99+
...
100+
101+
def __str__(self) -> str:
102+
...
103+
104+
def __getitem__(self, item: int) -> Quantity:
105+
...
106+
107+
def __setitem__(self, key: int, value: QuantityData) -> None:
108+
...
109+

0 commit comments

Comments
 (0)