Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions .mypyignore-todo
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,24 @@ numpy(\..+)?\.floating.as_integer_ratio
numpy(\..+)?\.complexfloating.__hash__
numpy(\..+)?\.complexfloating.__complex__

numpy(\.lib\._polynomial_impl|\.matlib)?\.poly1d\.integ

numpy._globals._CopyMode.IF_NEEDED
numpy._globals._CopyMode.__bool__

numpy._pyinstaller.hook-numpy

numpy.compat
numpy.compat.py3k

numpy._pyinstaller.hook-numpy
numpy.ctypeslib._ctypeslib
numpy.fft.helper

numpy(\.lib\._polynomial_impl|\.matlib)?\.poly1d\.integ
numpy.lib(._arrayterator_impl)?.Arrayterator.__array__
numpy.lib.(_array_utils_impl|array_utils).normalize_axis_tuple
numpy.lib._iotools.NameValidator.defaultdeletechars
numpy.lib.format.open_memmap
numpy.lib.format.read_array(_header_(1|2)_0)?
numpy.lib.mixins.NDArrayOperatorsMixin.__array_ufunc__
numpy.lib.recfunctions.unstructured_to_structured

numpy.distutils

Expand All @@ -34,22 +41,6 @@ numpy.f2py.crackfortran
numpy.f2py.symbolic
numpy.f2py.((cb|common|f90mod|use)_)?rules

numpy.fft.helper

numpy.lib(._arrayterator_impl)?.Arrayterator.__array__
numpy.lib.(_array_utils_impl|array_utils).normalize_axis_tuple
numpy.lib._iotools.NameValidator.defaultdeletechars
numpy.lib.format.open_memmap
numpy.lib.format.read_array(_header_(1|2)_0)?
numpy.lib.mixins.NDArrayOperatorsMixin.__array_ufunc__
numpy.lib.recfunctions.unstructured_to_structured

numpy.linalg(._linalg)?.cholesky
numpy.linalg(._linalg)?.pinv
numpy.linalg(._linalg)?.tensordot
numpy.linalg.lapack_lite
numpy.linalg.linalg

numpy.ma.testutils
numpy.ma.timer_comparison
numpy.ma.core._convert2ma.__doc__
Expand Down
153 changes: 142 additions & 11 deletions src/numpy-stubs/_typing/_ufunc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ class _Kwargs3(_KwargsCommon, total=False):
where: _ArrayLikeBool_co | None
signature: _Tuple3[DTypeLike] | str | None

@type_check_only
class _Kwargs3_g(_KwargsCommon, total=False):
signature: _Tuple3[DTypeLike] | str | None

@type_check_only
class _Kwargs4(_KwargsCommon, total=False):
where: _ArrayLikeBool_co | None
Expand All @@ -94,6 +90,18 @@ class _Kwargs4_(_KwargsCommon, total=False):
where: _ArrayLikeBool_co | None
signature: _Tuple4_[DTypeLike] | str | None

@type_check_only
class _Kwargs2_g(_KwargsCommon, total=False):
signature: _Tuple2[DTypeLike] | str | None
axes: Sequence[_Tuple2[SupportsIndex]]
axis: SupportsIndex

@type_check_only
class _Kwargs3_g(_KwargsCommon, total=False):
signature: _Tuple3[DTypeLike] | str | None
axes: Sequence[_Tuple2[SupportsIndex]]
axis: SupportsIndex

###
# ufunc method signatures

Expand Down Expand Up @@ -592,9 +600,119 @@ class _Call22(Protocol):
**kwds: Unpack[_Kwargs4],
) -> _Tuple2[Any]: ...

@type_check_only
class _Call11_g(Protocol):
@overload
def __call__(
self,
x: ArrayLike,
/,
out: _Out1[_ArrayT],
*,
dtype: None = None,
**kwds: Unpack[_Kwargs2_g],
) -> _ArrayT: ...
@overload
def __call__(
self,
x: ArrayLike,
/,
out: _Out1[_AnyArray | None] = None,
*,
dtype: DTypeLike | None = None,
**kwds: Unpack[_Kwargs2_g],
) -> Any: ...

@type_check_only
class _Call12_g(Protocol):
@overload
def __call__(
self,
x: ArrayLike,
out1: None = None,
out2: None = None,
/,
out: _Tuple2[None] = (None, None),
*,
dtype: DTypeLike | None = None,
**kwds: Unpack[_Kwargs3_g],
) -> tuple[Any, Any]: ...
@overload
def __call__(
self,
x: ArrayLike,
out1: None = None,
out2: None = None,
/,
*,
out: tuple[None, _ArrayT2],
dtype: None = None,
**kwds: Unpack[_Kwargs3_g],
) -> tuple[Any, _ArrayT2]: ...
@overload
def __call__(
self,
x: ArrayLike,
out1: None = None,
out2: None = None,
/,
*,
out: tuple[_ArrayT1, None],
dtype: None = None,
**kwds: Unpack[_Kwargs3_g],
) -> tuple[_ArrayT1, Any]: ...
@overload
def __call__(
self,
x: ArrayLike,
out1: None = None,
out2: None = None,
/,
*,
out: tuple[_ArrayT1, _ArrayT2],
dtype: None = None,
**kwds: Unpack[_Kwargs3_g],
) -> tuple[_ArrayT1, _ArrayT2]: ...
@overload
def __call__(
self,
x: ArrayLike,
out1: None,
out2: _ArrayT2,
/,
*,
out: _Tuple2[None] = (None, None),
dtype: None = None,
**kwds: Unpack[_Kwargs3_g],
) -> tuple[Any, _ArrayT2]: ...
@overload
def __call__(
self,
x: ArrayLike,
out1: _ArrayT1,
out2: None,
/,
*,
out: _Tuple2[None] = (None, None),
dtype: None = None,
**kwds: Unpack[_Kwargs3_g],
) -> tuple[_ArrayT1, Any]: ...
@overload
def __call__(
self,
x: ArrayLike,
out1: _ArrayT1,
out2: _ArrayT2,
/,
*,
out: _Tuple2[None] = (None, None),
dtype: None = None,
**kwds: Unpack[_Kwargs3_g],
) -> tuple[_ArrayT1, _ArrayT2]: ...

@type_check_only
class _Call21_g(Protocol):
# Scalar for 1D array-likes; ndarray otherwise
# scalar for 1D array-likes; ndarray otherwise
@overload
def __call__(
self,
Expand All @@ -604,8 +722,6 @@ class _Call21_g(Protocol):
out: _Out1[_ArrayT],
*,
dtype: None = None,
axis: SupportsIndex = ...,
axes: Sequence[_Tuple2[SupportsIndex]] = ...,
**kwds: Unpack[_Kwargs3_g],
) -> _ArrayT: ...
@overload
Expand All @@ -617,8 +733,6 @@ class _Call21_g(Protocol):
out: _Out1[_AnyArray | None] = None,
*,
dtype: DTypeLike | None = None,
axis: SupportsIndex = ...,
axes: Sequence[_Tuple2[SupportsIndex]] = ...,
**kwds: Unpack[_Kwargs3_g],
) -> Any: ...

Expand Down Expand Up @@ -1074,7 +1188,6 @@ _CallT11 = TypeVar("_CallT11", bound=Callable[Concatenate[Any, ...], object], de
_CallT12 = TypeVar("_CallT12", bound=Callable[Concatenate[Any, ...], tuple[object, object]], default=_Call12)
_CallT21 = TypeVar("_CallT21", bound=Callable[Concatenate[Any, Any, ...], object], default=_Call21)
_CallT22 = TypeVar("_CallT22", bound=Callable[Concatenate[Any, Any, ...], tuple[object, object]], default=_Call22)
_CallT21G = TypeVar("_CallT21G", bound=Callable[Concatenate[Any, ...], object], default=_Call21_g)

_ufunc_1_1 = TypeAliasType(
"_ufunc_1_1",
Expand All @@ -1097,12 +1210,30 @@ _ufunc_2_2 = TypeAliasType(
type_params=(_CallT22,),
)

#

_CallT11G = TypeVar("_CallT11G", bound=Callable[Concatenate[Any, ...], object], default=_Call11_g)
_CallT12G = TypeVar("_CallT12G", bound=Callable[Concatenate[Any, ...], object], default=_Call12_g)
_CallT21G = TypeVar("_CallT21G", bound=Callable[Concatenate[Any, ...], object], default=_Call21_g)

_gufunc_1_1 = TypeAliasType(
"_gufunc_1_1",
np.ufunc[_CallT11G, _AtE, _ReduceE, _ReduceAtE, _AccumulateE, _OuterE],
type_params=(_CallT11G,),
)
_gufunc_1_2 = TypeAliasType(
"_gufunc_1_2",
np.ufunc[_CallT12G, _AtE, _ReduceE, _ReduceAtE, _AccumulateE, _OuterE],
type_params=(_CallT12G,),
)
_gufunc_2_1 = TypeAliasType(
"_gufunc_2_1",
np.ufunc[_CallT21G, _AtE, _ReduceE, _ReduceAtE, _AccumulateE, _Outer2],
np.ufunc[_CallT21G, _AtE, _ReduceE, _ReduceAtE, _AccumulateE, _Outer1],
type_params=(_CallT21G,),
)

#

_pyfunc_1_1 = TypeAliasType(
"_pyfunc_1_1",
np.ufunc[_Call11_py[_OutT], _At1, _ReduceE, _ReduceAtE, _AccumulateE, _OuterE],
Expand Down
Loading