@@ -2302,12 +2302,22 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType_co, _DType_co]):
2302
2302
def __ge__ (self : NDArray [Any ], other : _ArrayLikeObject_co , / ) -> NDArray [np .bool ]: ...
2303
2303
2304
2304
# Unary ops
2305
+
2306
+ # TODO: Uncomment once https://github.com/python/mypy/issues/14070 is fixed
2307
+ # @overload
2308
+ # def __abs__(self: ndarray[_ShapeType, dtypes.Complex64DType], /) -> ndarray[_ShapeType, dtypes.Float32DType]: ...
2309
+ # @overload
2310
+ # def __abs__(self: ndarray[_ShapeType, dtypes.Complex128DType], /) -> ndarray[_ShapeType, dtypes.Float64DType]: ...
2311
+ # @overload
2312
+ # def __abs__(self: ndarray[_ShapeType, dtypes.CLongDoubleDType], /) -> ndarray[_ShapeType, dtypes.LongDoubleDType]: ...
2313
+ # @overload
2314
+ # def __abs__(self: ndarray[_ShapeType, dtype[complex128]], /) -> ndarray[_ShapeType, dtype[float64]]: ...
2305
2315
@overload
2306
- def __abs__ (self : _RealArrayT , / ) -> _RealArrayT : ...
2307
- @ overload
2308
- def __abs__ ( self : ndarray [ _ShapeType , dtype [ complex128 ]], / ) -> ndarray [_ShapeType , dtype [float64 ]]: ...
2316
+ def __abs__ (
2317
+ self : ndarray [ _ShapeType , dtype [ complexfloating [ _NBit_fc ]]], /
2318
+ ) -> ndarray [_ShapeType , dtype [floating [ _NBit_fc ] ]]: ...
2309
2319
@overload
2310
- def __abs__ (self : ndarray [ _ShapeType , dtype [ complexfloating [ _NBit1 ]]], / ) -> ndarray [ _ShapeType , dtype [ floating [ _NBit1 ]]] : ...
2320
+ def __abs__ (self : _RealArrayT , / ) -> _RealArrayT : ...
2311
2321
def __invert__ (self : _IntegralArrayT , / ) -> _IntegralArrayT : ... # noqa: PYI019
2312
2322
def __neg__ (self : _NumericArrayT , / ) -> _NumericArrayT : ... # noqa: PYI019
2313
2323
def __pos__ (self : _NumericArrayT , / ) -> _NumericArrayT : ... # noqa: PYI019
@@ -3060,6 +3070,7 @@ _ScalarType = TypeVar("_ScalarType", bound=generic)
3060
3070
_NBit = TypeVar ("_NBit" , bound = NBitBase )
3061
3071
_NBit1 = TypeVar ("_NBit1" , bound = NBitBase )
3062
3072
_NBit2 = TypeVar ("_NBit2" , bound = NBitBase , default = _NBit1 )
3073
+ _NBit_fc = TypeVar ("_NBit_fc" , _NBitHalf , _NBitSingle , _NBitDouble , _NBitLongDouble )
3063
3074
3064
3075
class generic (_ArrayOrScalarCommon ):
3065
3076
@abstractmethod
0 commit comments