1- from typing import Optional , Any
1+ from typing import Any , Optional
22
3- from quantities .dimensionality import Dimensionality
4- from quantities .typing .quantities import DimensionalityDescriptor , QuantityData
53import numpy .typing as npt
64
5+ from quantities .dimensionality import Dimensionality
6+ from quantities .typing .quantities import DimensionalityDescriptor , QuantityData
77
88def validate_unit_quantity (value : Quantity ) -> Quantity :
99 ...
@@ -23,8 +23,8 @@ def scale_other_units(f: Any) -> None:
2323
2424class Quantity (npt .NDArray ):
2525
26- def __new__ (cls , data : QuantityData , units : DimensionalityDescriptor = '' ,
27- dtype : Optional [object ] = None , copy : bool = True ) -> Quantity : #type: ignore
26+ def __new__ (cls , data : QuantityData , units : DimensionalityDescriptor = ... ,
27+ dtype : Optional [object ] = ... , copy : bool = ... ) -> Quantity :
2828 ...
2929
3030 @property
@@ -51,59 +51,54 @@ class Quantity(npt.NDArray):
5151 def units (self ) -> Quantity :
5252 ...
5353
54- def rescale (self , units : Optional [DimensionalityDescriptor ] = None ) -> Quantity :
54+ def rescale (self , units : Optional [DimensionalityDescriptor ] = ... ) -> Quantity :
5555 ...
5656
5757 def rescale_preferred (self ) -> Quantity :
5858 ...
5959
60- def __add__ (self , other ) -> Quantity :
61- ...
60+ # numeric methods
61+ def __add__ (self , other : Quantity ) -> Quantity : ... # type: ignore[override]
62+ def __radd__ (self , other : Quantity ) -> Quantity : ... # type: ignore[override]
63+ def __iadd__ (self , other : Quantity ) -> Quantity : ... # type: ignore[override]
6264
63- def __radd__ (self , other ) -> Quantity :
64- ...
65+ def __sub__ (self , other : Quantity ) -> Quantity : ... # type: ignore[override]
66+ def __rsub__ (self , other : Quantity ) -> Quantity : ... # type: ignore[override]
67+ def __isub__ (self , other : Quantity ) -> Quantity : ... # type: ignore[override]
6568
66- def __iadd__ (self , other ) -> Quantity :
67- ...
69+ def __mul__ (self , other ) -> Quantity : ...
70+ def __rmul__ (self , other ) -> Quantity : ...
71+ def __imul__ (self , other ) -> Quantity : ...
6872
73+ # NOTE matmul is not supported
6974
70- def __sub__ (self , other ) -> Quantity : # type: ignore[override]
71- ...
75+ def __truediv__ (self , other ) -> Quantity : ... # type: ignore[override]
76+ def __rtruediv__ (self , other ) -> Quantity : ... # type: ignore[override]
77+ def __itruediv__ (self , other ) -> Quantity : ... # type: ignore[override]
7278
79+ def __floordiv__ (self , other ) -> Quantity : ... # type: ignore[override]
80+ def __rfloordiv__ (self , other ) -> Quantity : ... # type: ignore[override]
81+ def __ifloordiv__ (self , other ) -> Quantity : ... # type: ignore[override]
7382
74- def __rsub__ (self , other ) -> Quantity : # type: ignore[override]
75- ...
83+ def __mod__ (self , other : Quantity ) -> Quantity : ... # type: ignore[override]
84+ def __rmod__ (self , other : Quantity ) -> Quantity : ... # type: ignore[override]
85+ def __imod__ (self , other : Quantity ) -> Quantity : ... # type: ignore[override]
7686
87+ # NOTE divmod is not supported
7788
78- def __isub__ (self , other ) -> Quantity : # type: ignore[override]
79- ...
89+ def __pow__ (self , power ) -> Quantity : ...
90+ def __rpow__ (self , power ) -> Quantity : ...
91+ def __ipow__ (self , power ) -> Quantity : ...
8092
81- def __mod__ (self , other ) -> Quantity :
82- ...
93+ # shift and bitwise are not supported
8394
84- def __imod__ (self , other ) -> Quantity :
85- ...
86-
87- # def __imul__(self, other):
88- # ...
89-
90- def __rmul__ (self , other ) -> Quantity :
91- ...
92-
93- # def __itruediv__(self, other) :
94- # ...
95-
96-
97- def __rtruediv__ (self , other ) -> Quantity : # type: ignore[override]
98- ...
99-
100- def __pow__ (self , power ) -> Quantity :
101- ...
102-
103- def __ipow__ (self , other ) -> Quantity :
104- ...
95+ # unary methods
96+ def __neg__ (self ) -> Quantity : ...
97+ # def __pos__(self) -> Quantity: ... # GH#94
98+ def __abs__ (self ) -> Quantity : ...
99+ # NOTE invert is not supported
105100
106- def __round__ (self , decimals : int = 0 ) -> Quantity :
101+ def __round__ (self , decimals : int = ... ) -> Quantity :
107102 ...
108103
109104 def __repr__ (self ) -> str :
0 commit comments