Skip to content

Commit 05af87c

Browse files
Quantity: add dunder methods (#8)
* dunders * Update src/metrology_apis/__init__.py Co-authored-by: Lucas Colley <[email protected]> * Update src/metrology_apis/__init__.py Co-authored-by: Lucas Colley <[email protected]> * Update src/metrology_apis/__init__.py Co-authored-by: Lucas Colley <[email protected]> * Update src/metrology_apis/__init__.py Co-authored-by: Lucas Colley <[email protected]> * fixes * `JustInt | JustFloat` * lint --------- Co-authored-by: Lucas Colley <[email protected]>
1 parent ad6d3ba commit 05af87c

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

src/metrology_apis/__init__.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,62 @@ def unit(self) -> U: ...
4444
def __eq__[B]( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
4545
self: "Quantity[V, U]", other: "Quantity[op.CanEq[V, B], U]", /
4646
) -> B: ...
47+
48+
@override
49+
def __ne__[B]( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
50+
self: "Quantity[V, U]", other: "Quantity[op.CanEq[V, B], U]", /
51+
) -> B: ...
52+
53+
def __lt__[B](
54+
self: "Quantity[V, U]", other: "Quantity[op.CanLt[V, B], U]", /
55+
) -> B: ...
56+
def __le__[B](
57+
self: "Quantity[V, U]", other: "Quantity[op.CanLe[V, B], U]", /
58+
) -> B: ...
59+
def __gt__[B](
60+
self: "Quantity[V, U]", other: "Quantity[op.CanGt[V, B], U]", /
61+
) -> B: ...
62+
def __ge__[B](
63+
self: "Quantity[V, U]", other: "Quantity[op.CanGe[V, B], U]", /
64+
) -> B: ...
65+
66+
def __pos__[R](self: "Quantity[op.CanPos[R], U]") -> "Quantity[R, U]": ...
67+
def __neg__[R](self: "Quantity[op.CanNeg[R], U]") -> "Quantity[R, U]": ...
68+
def __abs__[R](self: "Quantity[op.CanAbs[R], U]") -> "Quantity[R, U]": ...
69+
70+
def __add__[R](
71+
self: "Quantity[V, U]", other: "Quantity[op.CanRAdd[V, R], U]", /
72+
) -> "Quantity[R, U]": ...
73+
def __radd__[R](
74+
self: "Quantity[V, U]", other: "Quantity[op.CanAdd[V, R], U]", /
75+
) -> "Quantity[R, U]": ...
76+
def __sub__[R](
77+
self: "Quantity[V, U]", other: "Quantity[op.CanRSub[V, R], U]", /
78+
) -> "Quantity[R, U]": ...
79+
def __rsub__[R](
80+
self: "Quantity[V, U]", other: "Quantity[op.CanSub[V, R], U]", /
81+
) -> "Quantity[R, U]": ...
82+
83+
def __mul__[R](
84+
self: "Quantity[V, U]", other: "Quantity[op.CanRMul[V, R], U]", /
85+
) -> "Quantity[R, U]": ...
86+
def __rmul__[R](
87+
self: "Quantity[V, U]", other: "Quantity[op.CanMul[V, R], U]", /
88+
) -> "Quantity[R, U]": ...
89+
def __truediv__[R](
90+
self: "Quantity[V, U]", other: "Quantity[op.CanRTruediv[V, R], U]", /
91+
) -> "Quantity[R, U]": ...
92+
def __rtruediv__[R](
93+
self: "Quantity[V, U]", other: "Quantity[op.CanTruediv[V, R], U]", /
94+
) -> "Quantity[R, U]": ...
95+
96+
def __pow__[R](
97+
self: "Quantity[op.CanPow2[op.JustInt | op.JustFloat, R], U]",
98+
other: op.JustInt | op.JustFloat,
99+
/,
100+
) -> "Quantity[R, U]": ...
101+
def __rpow__[R](
102+
self: "Quantity[op.CanRPow[op.JustInt | op.JustFloat, R], U]",
103+
other: op.JustInt | op.JustFloat,
104+
/,
105+
) -> "Quantity[R, U]": ...

0 commit comments

Comments
 (0)