diff --git a/src/_numtype/__init__.pyi b/src/_numtype/__init__.pyi index 007260aa..f5692476 100644 --- a/src/_numtype/__init__.pyi +++ b/src/_numtype/__init__.pyi @@ -154,6 +154,7 @@ from ._shape import ( Shape3N as Shape3N, Shape4 as Shape4, Shape4N as Shape4N, + ShapeLike as ShapeLike, ) ### diff --git a/src/_numtype/_shape.pyi b/src/_numtype/_shape.pyi index e8899833..a6cdcc3e 100644 --- a/src/_numtype/_shape.pyi +++ b/src/_numtype/_shape.pyi @@ -1,4 +1,5 @@ -from typing import Any, Never, TypeAlias +from collections.abc import Sequence +from typing import Any, Never, SupportsIndex, TypeAlias from typing_extensions import TypeAliasType __all__ = [ @@ -15,6 +16,7 @@ __all__ = [ "Shape3N", "Shape4", "Shape4N", + "ShapeLike", "ShapeN", ] @@ -35,3 +37,5 @@ Shape1N = TypeAliasType("Shape1N", tuple[int, *tuple[int, ...]]) Shape2N = TypeAliasType("Shape2N", tuple[int, int, *tuple[int, ...]]) Shape3N = TypeAliasType("Shape3N", tuple[int, int, int, *tuple[int, ...]]) Shape4N = TypeAliasType("Shape4N", tuple[int, int, int, int, *tuple[int, ...]]) + +ShapeLike: TypeAlias = SupportsIndex | Sequence[SupportsIndex] diff --git a/src/numpy-stubs/__init__.pyi b/src/numpy-stubs/__init__.pyi index 78521987..220fbee3 100644 --- a/src/numpy-stubs/__init__.pyi +++ b/src/numpy-stubs/__init__.pyi @@ -346,7 +346,6 @@ from ._typing import ( _NestedSequence, _NumberLike_co, _ScalarLike_co, - _ShapeLike, _TD64Like_co, ) from .lib import scimath as emath @@ -1322,7 +1321,7 @@ class _ArrayOrScalarCommon: def copy(self, order: _OrderKACF = ...) -> Self: ... def __copy__(self) -> Self: ... def __deepcopy__(self, memo: dict[int, Any] | None, /) -> Self: ... - def __setstate__(self, state: tuple[CanIndex, _ShapeLike, _DTypeT_co, bool_, bytes | list[Any]], /) -> None: ... + def __setstate__(self, state: tuple[CanIndex, _nt.ShapeLike, _DTypeT_co, bool_, bytes | list[Any]], /) -> None: ... def __array_namespace__(self, /, *, api_version: _ArrayAPIVersion | None = None) -> ModuleType: ... # @@ -1351,7 +1350,7 @@ class _ArrayOrScalarCommon: def max( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, *, keepdims: py_bool | _NoValueType = ..., @@ -1362,7 +1361,7 @@ class _ArrayOrScalarCommon: def max( self, /, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, out: _ArrayT, *, keepdims: py_bool | _NoValueType = ..., @@ -1373,7 +1372,7 @@ class _ArrayOrScalarCommon: def max( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, keepdims: py_bool | _NoValueType = ..., @@ -1396,7 +1395,7 @@ class _ArrayOrScalarCommon: def min( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, *, keepdims: py_bool | _NoValueType = ..., @@ -1407,7 +1406,7 @@ class _ArrayOrScalarCommon: def min( self, /, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, out: _ArrayT, *, keepdims: py_bool | _NoValueType = ..., @@ -1418,7 +1417,7 @@ class _ArrayOrScalarCommon: def min( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, keepdims: py_bool | _NoValueType = ..., @@ -1492,7 +1491,7 @@ class _ArrayOrScalarCommon: def sum( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, *, @@ -1504,7 +1503,7 @@ class _ArrayOrScalarCommon: def sum( self, /, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, *, @@ -1516,7 +1515,7 @@ class _ArrayOrScalarCommon: def sum( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1540,7 +1539,7 @@ class _ArrayOrScalarCommon: def prod( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, *, @@ -1552,7 +1551,7 @@ class _ArrayOrScalarCommon: def prod( self, /, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, *, @@ -1564,7 +1563,7 @@ class _ArrayOrScalarCommon: def prod( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1577,7 +1576,7 @@ class _ArrayOrScalarCommon: @overload def mean( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, *, @@ -1588,7 +1587,7 @@ class _ArrayOrScalarCommon: def mean( self, /, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, *, @@ -1599,7 +1598,7 @@ class _ArrayOrScalarCommon: def mean( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1611,7 +1610,7 @@ class _ArrayOrScalarCommon: @overload def std( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0, @@ -1624,7 +1623,7 @@ class _ArrayOrScalarCommon: @overload def std( self, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0, @@ -1637,7 +1636,7 @@ class _ArrayOrScalarCommon: @overload def std( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1652,7 +1651,7 @@ class _ArrayOrScalarCommon: @overload def var( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0, @@ -1665,7 +1664,7 @@ class _ArrayOrScalarCommon: @overload def var( self, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0, @@ -1678,7 +1677,7 @@ class _ArrayOrScalarCommon: @overload def var( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1751,11 +1750,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]): # def __new__( cls, - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: DTypeLike | None = float, # noqa: PYI011 buffer: Buffer | None = None, offset: CanIndex = 0, - strides: _ShapeLike | None = None, + strides: _nt.ShapeLike | None = None, order: _OrderKACF | None = None, ) -> Self: ... @@ -2775,7 +2774,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]): # @overload - def transpose(self, axes: _ShapeLike | None, /) -> Self: ... + def transpose(self, axes: _nt.ShapeLike | None, /) -> Self: ... @overload def transpose(self, /, *axes: CanIndex) -> Self: ... diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index bbd85b3a..d316b813 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -33,7 +33,6 @@ from numpy._typing import ( _ArrayLikeNumber_co, _DTypeLike, _ScalarLike_co, - _ShapeLike, _SupportsArrayFunc as _CanArrayFunc, _SupportsDType as _HasDType, ) @@ -360,7 +359,7 @@ class nditer: order: _OrderKACF = "K", casting: _CastingKind = "safe", op_axes: _OpAxes = None, - itershape: _ShapeLike | None = None, + itershape: _nt.ShapeLike | None = None, buffersize: CanIndex = 0, ) -> None: ... @overload @@ -374,7 +373,7 @@ class nditer: order: _OrderKACF = "K", casting: _CastingKind = "safe", op_axes: Sequence[_OpAxes] | None = None, - itershape: _ShapeLike | None = None, + itershape: _nt.ShapeLike | None = None, buffersize: CanIndex = 0, ) -> None: ... @@ -561,7 +560,7 @@ def empty( ) -> _nt.Array[Incomplete, _AnyShapeT]: ... @overload # unknown shape, default dtype def empty( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderCF = "C", *, @@ -570,7 +569,7 @@ def empty( ) -> _nt.Array[np.float64]: ... @overload # unknown shape, known dtype def empty( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", *, @@ -579,7 +578,7 @@ def empty( ) -> np.ndarray[Incomplete, _DTypeT]: ... @overload # unknown shape, known scalar-type def empty( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", *, @@ -588,7 +587,7 @@ def empty( ) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, unknown dtype def empty( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: npt.DTypeLike | None = None, order: _OrderCF = "C", *, @@ -671,7 +670,7 @@ def zeros( ) -> _nt.Array[Incomplete, _AnyShapeT]: ... @overload # unknown shape, default dtype def zeros( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", *, @@ -680,7 +679,7 @@ def zeros( ) -> _nt.Array[np.float64]: ... @overload # unknown shape, known dtype def zeros( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", *, @@ -689,7 +688,7 @@ def zeros( ) -> np.ndarray[Incomplete, _DTypeT]: ... @overload # unknown shape, known scalar-type def zeros( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", *, @@ -698,7 +697,7 @@ def zeros( ) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, unknown dtype def zeros( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: npt.DTypeLike | None = None, order: _OrderCF = "C", *, @@ -967,7 +966,7 @@ def empty_like( dtype: np.dtype[_ScalarT] | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[_ScalarT]: ... @@ -989,7 +988,7 @@ def empty_like( dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> np.ndarray[Incomplete, _DTypeT]: ... @@ -1011,7 +1010,7 @@ def empty_like( dtype: _DTypeLike[_ScalarT], order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[_ScalarT]: ... @@ -1022,7 +1021,7 @@ def empty_like( dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.bool_]: ... @@ -1033,7 +1032,7 @@ def empty_like( dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.intp]: ... @@ -1044,7 +1043,7 @@ def empty_like( dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.float64]: ... @@ -1055,7 +1054,7 @@ def empty_like( dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.complex128]: ... @@ -1077,7 +1076,7 @@ def empty_like( dtype: npt.DTypeLike | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[Incomplete]: ... @@ -1630,24 +1629,24 @@ def putmask(a: _nt.Array, /, mask: _nt.ToBool_nd, values: npt.ArrayLike) -> None # @overload -def unravel_index(indices: _ToInt, shape: _ShapeLike, order: _OrderCF = "C") -> tuple[np.intp, ...]: ... +def unravel_index(indices: _ToInt, shape: _nt.ShapeLike, order: _OrderCF = "C") -> tuple[np.intp, ...]: ... @overload def unravel_index( - indices: _nt.ToInteger_1nd, shape: _ShapeLike, order: _OrderCF = "C" + indices: _nt.ToInteger_1nd, shape: _nt.ShapeLike, order: _OrderCF = "C" ) -> tuple[_nt.Array[np.intp], ...]: ... # @overload def ravel_multi_index( multi_index: SupportsLenAndGetItem[_ToInt], - dims: _ShapeLike, + dims: _nt.ShapeLike, mode: _ModeKind | tuple[_ModeKind, ...] = "raise", order: _OrderCF = "C", ) -> np.intp: ... @overload def ravel_multi_index( multi_index: SupportsLenAndGetItem[_nt.ToInteger_1nd], - dims: _ShapeLike, + dims: _nt.ShapeLike, mode: _ModeKind | tuple[_ModeKind, ...] = "raise", order: _OrderCF = "C", ) -> _nt.Array[np.intp]: ... diff --git a/src/numpy-stubs/_core/defchararray.pyi b/src/numpy-stubs/_core/defchararray.pyi index 5045655a..7edadedc 100644 --- a/src/numpy-stubs/_core/defchararray.pyi +++ b/src/numpy-stubs/_core/defchararray.pyi @@ -5,11 +5,9 @@ from typing_extensions import Buffer, TypeAliasType, TypeVar, override import _numtype as _nt import numpy as np from numpy import _OrderKACF as _Order # noqa: ICN003 -from numpy._typing import ( - _ArrayLikeAnyString_co as _ToAnyCharND, - _ArrayLikeString_co as _ToStringND, - _ShapeLike as _ToShape, -) +from numpy._typing import _ArrayLikeAnyString_co as _ToAnyCharND, _ArrayLikeString_co as _ToStringND + +_ToShape: TypeAlias = _nt.ShapeLike from ._multiarray_umath import compare_chararrays from .strings import ( diff --git a/src/numpy-stubs/_core/fromnumeric.pyi b/src/numpy-stubs/_core/fromnumeric.pyi index a0bbe5e5..41141d26 100644 --- a/src/numpy-stubs/_core/fromnumeric.pyi +++ b/src/numpy-stubs/_core/fromnumeric.pyi @@ -7,7 +7,7 @@ import _numtype as _nt import numpy as np from numpy import _CastingKind, _ModeKind, _OrderACF, _OrderKACF, _PartitionKind, _SortKind, _SortSide # noqa: ICN003 from numpy._globals import _NoValueType -from numpy._typing import ArrayLike, DTypeLike, _DTypeLike, _ShapeLike +from numpy._typing import ArrayLike, DTypeLike, _DTypeLike __all__ = [ "all", @@ -187,9 +187,9 @@ def repeat(a: ArrayLike, repeats: _nt.CoInteger_nd, axis: CanIndex | None = None # @overload -def transpose(a: _nt._ToArray_nd[_ScalarT], axes: _ShapeLike | None = ...) -> _nt.Array[_ScalarT]: ... +def transpose(a: _nt._ToArray_nd[_ScalarT], axes: _nt.ShapeLike | None = ...) -> _nt.Array[_ScalarT]: ... @overload -def transpose(a: ArrayLike, axes: _ShapeLike | None = ...) -> _nt.Array[Incomplete]: ... +def transpose(a: ArrayLike, axes: _nt.ShapeLike | None = ...) -> _nt.Array[Incomplete]: ... # @overload @@ -390,13 +390,13 @@ def resize(a: ArrayLike, new_shape: Sequence[CanIndex]) -> _nt.Array[Incomplete] # @overload # workaround for microsoft/pyright#10232 -def squeeze(a: _ScalarT, axis: _ShapeLike | None = None) -> _nt.Array0D[_ScalarT]: ... +def squeeze(a: _ScalarT, axis: _nt.ShapeLike | None = None) -> _nt.Array0D[_ScalarT]: ... @overload # workaround for microsoft/pyright#10232 -def squeeze(a: _nt._ToArray_nnd[_ScalarT], axis: _ShapeLike | None = None) -> _nt.Array[_ScalarT]: ... +def squeeze(a: _nt._ToArray_nnd[_ScalarT], axis: _nt.ShapeLike | None = None) -> _nt.Array[_ScalarT]: ... @overload -def squeeze(a: _nt._ToArray_nd[_ScalarT], axis: _ShapeLike | None = None) -> _nt.Array[_ScalarT]: ... +def squeeze(a: _nt._ToArray_nd[_ScalarT], axis: _nt.ShapeLike | None = None) -> _nt.Array[_ScalarT]: ... @overload -def squeeze(a: ArrayLike, axis: _ShapeLike | None = None) -> _nt.Array[Incomplete]: ... +def squeeze(a: ArrayLike, axis: _nt.ShapeLike | None = None) -> _nt.Array[Incomplete]: ... # @overload @@ -601,7 +601,7 @@ def sum( @overload def sum( a: ArrayLike, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: _Option[bool] = ..., @@ -611,7 +611,7 @@ def sum( @overload def sum( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, dtype: _DTypeLike[_ScalarT], out: None = None, @@ -622,7 +622,7 @@ def sum( @overload def sum( a: ArrayLike, - axis: _ShapeLike | None = ..., + axis: _nt.ShapeLike | None = ..., dtype: DTypeLike | None = None, out: None = None, keepdims: _Option[bool] = ..., @@ -632,7 +632,7 @@ def sum( @overload def sum( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -886,10 +886,10 @@ def ptp( ) -> _ScalarT: ... @overload def ptp( - a: ArrayLike, axis: _ShapeLike | None = None, out: None = None, keepdims: _Option[bool] = ... + a: ArrayLike, axis: _nt.ShapeLike | None = None, out: None = None, keepdims: _Option[bool] = ... ) -> Incomplete: ... @overload -def ptp(a: ArrayLike, axis: _ShapeLike | None = None, *, out: _ArrayT, keepdims: _Option[bool] = ...) -> _ArrayT: ... +def ptp(a: ArrayLike, axis: _nt.ShapeLike | None = None, *, out: _ArrayT, keepdims: _Option[bool] = ...) -> _ArrayT: ... # @overload @@ -904,7 +904,7 @@ def amax( @overload def amax( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, keepdims: _Option[bool] = ..., initial: _Option[_nt.CoComplex_0d] = ..., @@ -913,7 +913,7 @@ def amax( @overload def amax( a: ArrayLike, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, out: _ArrayT, keepdims: _Option[bool] = ..., initial: _Option[_nt.CoComplex_0d] = ..., @@ -922,7 +922,7 @@ def amax( @overload def amax( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, keepdims: _Option[bool] = ..., @@ -943,7 +943,7 @@ def amin( @overload def amin( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, keepdims: _Option[bool] = ..., initial: _Option[_nt.CoComplex_0d] = ..., @@ -952,7 +952,7 @@ def amin( @overload def amin( a: ArrayLike, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, out: _ArrayT, keepdims: _Option[bool] = ..., initial: _Option[_nt.CoComplex_0d] = ..., @@ -961,7 +961,7 @@ def amin( @overload def amin( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, keepdims: _Option[bool] = ..., @@ -1025,7 +1025,7 @@ def prod( @overload def prod( a: _nt.CoComplex_nd | _nt.ToObject_nd, - axis: _ShapeLike | None = ..., + axis: _nt.ShapeLike | None = ..., dtype: None = None, out: None = None, keepdims: _Option[bool] = ..., @@ -1056,7 +1056,7 @@ def prod( @overload def prod( a: _nt.CoComplex_nd | _nt.ToObject_nd, - axis: _ShapeLike | None = ..., + axis: _nt.ShapeLike | None = ..., dtype: DTypeLike | None = ..., out: None = None, keepdims: _Option[bool] = ..., @@ -1066,7 +1066,7 @@ def prod( @overload def prod( a: _nt.CoComplex_nd | _nt.ToObject_nd, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: _Option[bool] = ..., @@ -1076,7 +1076,7 @@ def prod( @overload def prod( a: _nt.CoComplex_nd | _nt.ToObject_nd, - axis: _ShapeLike | None = ..., + axis: _nt.ShapeLike | None = ..., dtype: DTypeLike | None = ..., *, out: _ArrayT, @@ -1290,7 +1290,7 @@ def mean( @overload def mean( a: _nt.ToObject_nd, - axis: _ShapeLike | None = ..., + axis: _nt.ShapeLike | None = ..., dtype: None = None, out: None = None, keepdims: _Option[bool] = ..., @@ -1340,7 +1340,7 @@ def mean( @overload def mean( a: _nt.CoComplex_nd | _nt.ToTimeDelta_nd | _nt.ToObject_nd, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: _Option[bool] = ..., @@ -1350,7 +1350,7 @@ def mean( @overload def mean( a: _nt.CoComplex_nd | _nt.ToTimeDelta_nd | _nt.ToObject_nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1360,7 +1360,7 @@ def mean( @overload def mean( a: _nt.CoComplex_nd | _nt.ToTimeDelta_nd | _nt.ToObject_nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: _nt.Array | None = None, keepdims: _Option[bool] = ..., @@ -1385,7 +1385,7 @@ def std( @overload def std( a: _nt.ToObject_nd, - axis: _ShapeLike | None = ..., + axis: _nt.ShapeLike | None = ..., dtype: None = None, out: None = None, ddof: float = 0, @@ -1424,7 +1424,7 @@ def std( @overload def std( a: _nt.CoComplex_nd | _nt.ToObject_nd, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0, @@ -1437,7 +1437,7 @@ def std( @overload def std( a: _nt.CoComplex_nd | _nt.ToObject_nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1450,7 +1450,7 @@ def std( @overload def std( a: _nt.CoComplex_nd | _nt.ToObject_nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: _nt.Array | None = None, ddof: float = 0, @@ -1478,7 +1478,7 @@ def var( @overload def var( a: _nt.ToObject_nd, - axis: _ShapeLike | None = ..., + axis: _nt.ShapeLike | None = ..., dtype: None = None, out: None = None, ddof: float = 0, @@ -1517,7 +1517,7 @@ def var( @overload def var( a: _nt.CoComplex_nd | _nt.ToObject_nd, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0, @@ -1530,7 +1530,7 @@ def var( @overload def var( a: _nt.CoComplex_nd | _nt.ToObject_nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1543,7 +1543,7 @@ def var( @overload def var( a: _nt.CoComplex_nd | _nt.ToObject_nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: _nt.Array | None = None, ddof: float = 0, diff --git a/src/numpy-stubs/_core/memmap.pyi b/src/numpy-stubs/_core/memmap.pyi index ba020c73..03832993 100644 --- a/src/numpy-stubs/_core/memmap.pyi +++ b/src/numpy-stubs/_core/memmap.pyi @@ -18,7 +18,7 @@ import _numtype as _nt import numpy as np import numpy.typing as npt from numpy import _OrderKACF # noqa: ICN003 -from numpy._typing import _DTypeLike, _ShapeLike +from numpy._typing import _DTypeLike __all__ = ["memmap"] @@ -64,7 +64,7 @@ class memmap(np.ndarray[_ShapeT_co, _DTypeT_co], Generic[_ShapeT_co, _DTypeT_co] dtype: _DTypeT_co, mode: _ToMode = "r+", offset: int = 0, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, order: _OrderKACF = "C", ) -> memmap[Incomplete, _DTypeT_co]: ... @overload @@ -74,7 +74,7 @@ class memmap(np.ndarray[_ShapeT_co, _DTypeT_co], Generic[_ShapeT_co, _DTypeT_co] dtype: _DTypeLike[_ScalarT], mode: _ToMode = "r+", offset: int = 0, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, order: _OrderKACF = "C", ) -> memmap[Incomplete, np.dtype[_ScalarT]]: ... @overload diff --git a/src/numpy-stubs/_core/numeric.pyi b/src/numpy-stubs/_core/numeric.pyi index 4e8cc8ab..2e0ce10b 100644 --- a/src/numpy-stubs/_core/numeric.pyi +++ b/src/numpy-stubs/_core/numeric.pyi @@ -19,7 +19,7 @@ import _numtype as _nt import numpy as np import numpy.typing as npt from numpy import _AnyShapeT, _OrderCF, _OrderKACF, ufunc # noqa: ICN003 -from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike, _ShapeLike, _SupportsArrayFunc, _SupportsDType +from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike, _SupportsArrayFunc, _SupportsDType from numpy.lib._array_utils_impl import normalize_axis_tuple as normalize_axis_tuple from ._asarray import require @@ -605,7 +605,7 @@ _ShapeLike3D: TypeAlias = tuple[SupportsIndex, SupportsIndex, SupportsIndex] _PyScalar: TypeAlias = complex | str | bytes _Device: TypeAlias = L["cpu"] _Mode: TypeAlias = L["valid", "same", "full"] -_Axes: TypeAlias = int | tuple[_ShapeLike, _ShapeLike] +_Axes: TypeAlias = int | tuple[_nt.ShapeLike, _nt.ShapeLike] @type_check_only class _CanArray(Protocol[_ArrayT_co]): @@ -700,7 +700,7 @@ def ones( ) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, default dtype def ones( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderCF = "C", *, @@ -709,7 +709,7 @@ def ones( ) -> _nt.Array[np.float64]: ... @overload # unknown shape, known dtype def ones( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _DTypeT | _SupportsDType[_DTypeT], order: _OrderCF = "C", *, @@ -718,7 +718,7 @@ def ones( ) -> np.ndarray[_nt.AnyShape, _DTypeT]: ... @overload # unknown shape, known scalar-type def ones( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", *, @@ -727,7 +727,7 @@ def ones( ) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, unknown dtype def ones( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: npt.DTypeLike | None = None, order: _OrderCF = "C", *, @@ -920,7 +920,7 @@ def full( ) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, known fill scalar-type def full( - shape: _ShapeLike, + shape: _nt.ShapeLike, fill_value: _ScalarT, dtype: None = None, order: _OrderCF = "C", @@ -930,7 +930,7 @@ def full( ) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, bool fill def full( - shape: _ShapeLike, + shape: _nt.ShapeLike, fill_value: py_bool, dtype: None = None, order: _OrderCF = "C", @@ -940,7 +940,7 @@ def full( ) -> _nt.Array[np.bool]: ... @overload # unknown shape, int fill def full( - shape: _ShapeLike, + shape: _nt.ShapeLike, fill_value: _nt.JustInt, dtype: None = None, order: _OrderCF = "C", @@ -950,7 +950,7 @@ def full( ) -> _nt.Array[np.intp]: ... @overload # unknown shape, float fill def full( - shape: _ShapeLike, + shape: _nt.ShapeLike, fill_value: _nt.JustFloat, dtype: None = None, order: _OrderCF = "C", @@ -960,7 +960,7 @@ def full( ) -> _nt.Array[np.float64]: ... @overload # unknown shape, complex fill def full( - shape: _ShapeLike, + shape: _nt.ShapeLike, fill_value: _nt.JustComplex, dtype: None = None, order: _OrderCF = "C", @@ -970,7 +970,7 @@ def full( ) -> _nt.Array[np.complex128]: ... @overload # unknown shape, known dtype def full( - shape: _ShapeLike, + shape: _nt.ShapeLike, fill_value: object, dtype: _DTypeT | _SupportsDType[_DTypeT], order: _OrderCF = "C", @@ -980,7 +980,7 @@ def full( ) -> np.ndarray[_nt.AnyShape, _DTypeT]: ... @overload # unknown shape, known scalar-type def full( - shape: _ShapeLike, + shape: _nt.ShapeLike, fill_value: object, dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", @@ -990,7 +990,7 @@ def full( ) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, float64 def full( - shape: _ShapeLike, + shape: _nt.ShapeLike, fill_value: object, dtype: _nt.ToDTypeFloat64, order: _OrderCF = "C", @@ -1000,7 +1000,7 @@ def full( ) -> _nt.Array[np.float64]: ... @overload # unknown shape, unknown dtype def full( - shape: _ShapeLike, + shape: _nt.ShapeLike, fill_value: object, dtype: DTypeLike | None = None, order: _OrderCF = "C", @@ -1246,7 +1246,7 @@ def zeros_like( dtype: np.dtype[_ScalarT] | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[_ScalarT]: ... @@ -1266,7 +1266,7 @@ def zeros_like( dtype: _DTypeT | _SupportsDType[_DTypeT], order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> np.ndarray[_nt.AnyShape, _DTypeT]: ... @@ -1286,7 +1286,7 @@ def zeros_like( dtype: _DTypeLike[_ScalarT], order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[_ScalarT]: ... @@ -1296,7 +1296,7 @@ def zeros_like( dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.bool_]: ... @@ -1306,7 +1306,7 @@ def zeros_like( dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.intp]: ... @@ -1316,7 +1316,7 @@ def zeros_like( dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.float64]: ... @@ -1326,7 +1326,7 @@ def zeros_like( dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.complex128]: ... @@ -1346,7 +1346,7 @@ def zeros_like( dtype: npt.DTypeLike | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array: ... @@ -1588,7 +1588,7 @@ def ones_like( dtype: np.dtype[_ScalarT] | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[_ScalarT]: ... @@ -1608,7 +1608,7 @@ def ones_like( dtype: _DTypeT | _SupportsDType[_DTypeT], order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> np.ndarray[_nt.AnyShape, _DTypeT]: ... @@ -1628,7 +1628,7 @@ def ones_like( dtype: _DTypeLike[_ScalarT], order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[_ScalarT]: ... @@ -1638,7 +1638,7 @@ def ones_like( dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.bool_]: ... @@ -1648,7 +1648,7 @@ def ones_like( dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.intp]: ... @@ -1658,7 +1658,7 @@ def ones_like( dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.float64]: ... @@ -1668,7 +1668,7 @@ def ones_like( dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.complex128]: ... @@ -1688,7 +1688,7 @@ def ones_like( dtype: npt.DTypeLike | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array: ... @@ -1910,7 +1910,7 @@ def full_like( dtype: np.dtype[_ScalarT] | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[_ScalarT]: ... @@ -1932,7 +1932,7 @@ def full_like( dtype: _DTypeT | _SupportsDType[_DTypeT], order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> np.ndarray[_nt.AnyShape, _DTypeT]: ... @@ -1954,7 +1954,7 @@ def full_like( dtype: _DTypeLike[_ScalarT], order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[_ScalarT]: ... @@ -1965,7 +1965,7 @@ def full_like( dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.bool_]: ... @@ -1976,7 +1976,7 @@ def full_like( dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.intp]: ... @@ -1987,7 +1987,7 @@ def full_like( dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.float64]: ... @@ -1998,7 +1998,7 @@ def full_like( dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array[np.complex128]: ... @@ -2020,7 +2020,7 @@ def full_like( dtype: npt.DTypeLike | None = None, order: _OrderKACF = "K", subok: py_bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.Array: ... @@ -2029,11 +2029,11 @@ def full_like( @overload def count_nonzero(a: ArrayLike, axis: None = None, *, keepdims: L[False] = False) -> np.intp: ... @overload -def count_nonzero(a: _nt.ToGeneric_0d, axis: _ShapeLike | None = None, *, keepdims: L[True]) -> np.intp: ... +def count_nonzero(a: _nt.ToGeneric_0d, axis: _nt.ShapeLike | None = None, *, keepdims: L[True]) -> np.intp: ... @overload -def count_nonzero(a: _nt.ToGeneric_1nd, axis: _ShapeLike | None = None, *, keepdims: L[True]) -> _nt.Array[np.intp]: ... +def count_nonzero(a: _nt.ToGeneric_1nd, axis: _nt.ShapeLike | None = None, *, keepdims: L[True]) -> _nt.Array[np.intp]: ... @overload -def count_nonzero(a: ArrayLike, axis: _ShapeLike | None = None, *, keepdims: py_bool = False) -> Incomplete: ... +def count_nonzero(a: ArrayLike, axis: _nt.ShapeLike | None = None, *, keepdims: py_bool = False) -> Incomplete: ... # def flatnonzero(a: ArrayLike) -> _nt.Array1D[np.intp]: ... @@ -2174,13 +2174,13 @@ def tensordot( # @overload -def roll(a: _ArrayLike[_ScalarT], shift: _ShapeLike, axis: _ShapeLike | None = None) -> _nt.Array[_ScalarT]: ... +def roll(a: _ArrayLike[_ScalarT], shift: _nt.ShapeLike, axis: _nt.ShapeLike | None = None) -> _nt.Array[_ScalarT]: ... @overload -def roll(a: ArrayLike, shift: _ShapeLike, axis: _ShapeLike | None = None) -> _nt.Array: ... +def roll(a: ArrayLike, shift: _nt.ShapeLike, axis: _nt.ShapeLike | None = None) -> _nt.Array: ... # def rollaxis(a: _nt.Array[_ScalarT], axis: int, start: int = 0) -> _nt.Array[_ScalarT]: ... -def moveaxis(a: _nt.Array[_ScalarT], source: _ShapeLike, destination: _ShapeLike) -> _nt.Array[_ScalarT]: ... +def moveaxis(a: _nt.Array[_ScalarT], source: _nt.ShapeLike, destination: _nt.ShapeLike) -> _nt.Array[_ScalarT]: ... # @overload diff --git a/src/numpy-stubs/_core/records.pyi b/src/numpy-stubs/_core/records.pyi index e05e632f..d2e67048 100644 --- a/src/numpy-stubs/_core/records.pyi +++ b/src/numpy-stubs/_core/records.pyi @@ -6,7 +6,7 @@ from typing_extensions import Buffer, TypeVar, override import _numtype as _nt import numpy as np from numpy import _ByteOrder, _OrderKACF # noqa: ICN003 -from numpy._typing import ArrayLike, DTypeLike, _ArrayLikeVoid_co, _ShapeLike +from numpy._typing import ArrayLike, DTypeLike, _ArrayLikeVoid_co __all__ = [ "array", @@ -73,11 +73,11 @@ class recarray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def __new__( subtype, - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: None = None, buf: Buffer | None = None, offset: SupportsIndex = 0, - strides: _ShapeLike | None = None, + strides: _nt.ShapeLike | None = None, *, formats: DTypeLike | None, names: str | Sequence[str] | None = None, @@ -89,11 +89,11 @@ class recarray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def __new__( subtype, - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: DTypeLike | None, buf: Buffer | None = None, offset: SupportsIndex = ..., - strides: _ShapeLike | None = None, + strides: _nt.ShapeLike | None = None, formats: None = None, names: None = None, titles: None = None, @@ -122,7 +122,7 @@ def find_duplicate(list: Iterable[_T]) -> list[_T]: ... def fromarrays( arrayList: Iterable[ArrayLike], dtype: DTypeLike | None = None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, formats: None = None, names: None = None, titles: None = None, @@ -133,7 +133,7 @@ def fromarrays( def fromarrays( arrayList: Iterable[ArrayLike], dtype: None = None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, formats: DTypeLike | None, names: str | Sequence[str] | None = None, @@ -147,7 +147,7 @@ def fromarrays( def fromrecords( recList: _ArrayLikeVoid_co | _nt.SequenceND[tuple[Incomplete, ...]], dtype: DTypeLike | None = None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, formats: None = None, names: None = None, titles: None = None, @@ -158,7 +158,7 @@ def fromrecords( def fromrecords( recList: _ArrayLikeVoid_co | _nt.SequenceND[tuple[Incomplete, ...]], dtype: None = None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, formats: DTypeLike | None, names: str | Sequence[str] | None = None, @@ -172,7 +172,7 @@ def fromrecords( def fromstring( datastring: Buffer, dtype: DTypeLike | None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, offset: int = 0, formats: None = None, names: None = None, @@ -184,7 +184,7 @@ def fromstring( def fromstring( datastring: Buffer, dtype: None = None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, offset: int = 0, *, formats: DTypeLike | None, @@ -202,7 +202,7 @@ def get_remaining_size(fd: IO[Any]) -> int: ... # undocumented def fromfile( fd: StrOrBytesPath | _SupportsReadInto, dtype: DTypeLike | None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, offset: int = 0, formats: None = None, names: None = None, @@ -214,7 +214,7 @@ def fromfile( def fromfile( fd: StrOrBytesPath | _SupportsReadInto, dtype: None = None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, offset: int = 0, *, formats: DTypeLike | None, @@ -229,7 +229,7 @@ def fromfile( def array( # type: ignore[overload-overlap] obj: _ScalarT | _nt.Array[_ScalarT], dtype: None = None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, offset: int = 0, strides: tuple[int, ...] | None = None, formats: None = None, @@ -243,7 +243,7 @@ def array( # type: ignore[overload-overlap] def array( obj: ArrayLike, dtype: DTypeLike | None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, offset: int = 0, strides: tuple[int, ...] | None = None, formats: None = None, @@ -257,7 +257,7 @@ def array( def array( obj: ArrayLike, dtype: None = None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, offset: int = 0, strides: tuple[int, ...] | None = None, *, @@ -272,7 +272,7 @@ def array( def array( obj: None, dtype: DTypeLike | None, - shape: _ShapeLike, + shape: _nt.ShapeLike, offset: int = 0, strides: tuple[int, ...] | None = None, formats: None = None, @@ -287,7 +287,7 @@ def array( obj: None, dtype: None = None, *, - shape: _ShapeLike, + shape: _nt.ShapeLike, offset: int = 0, strides: tuple[int, ...] | None = None, formats: DTypeLike | None, @@ -301,7 +301,7 @@ def array( def array( obj: _SupportsReadInto, dtype: DTypeLike | None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, offset: int = 0, strides: tuple[int, ...] | None = None, formats: None = None, @@ -315,7 +315,7 @@ def array( def array( obj: _SupportsReadInto, dtype: None = None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, offset: int = 0, strides: tuple[int, ...] | None = None, *, diff --git a/src/numpy-stubs/_core/umath.pyi b/src/numpy-stubs/_core/umath.pyi index c77b7221..ee304c4c 100644 --- a/src/numpy-stubs/_core/umath.pyi +++ b/src/numpy-stubs/_core/umath.pyi @@ -18,12 +18,7 @@ from typing_extensions import TypeAliasType, TypeVar, Unpack import _numtype as _nt import numpy as np from numpy import _CastingKind, _OrderKACF # noqa: ICN003 -from numpy._typing import ( - _DTypeLike as _ToDType, - _DTypeLikeComplex as _ToDTypeComplex, - _DTypeLikeFloat as _ToDTypeFloat, - _ShapeLike, -) +from numpy._typing import _DTypeLike as _ToDType, _DTypeLikeComplex as _ToDTypeComplex, _DTypeLikeFloat as _ToDTypeFloat from . import _multiarray_umath as _multiarray_umath from ._multiarray_umath import ( @@ -1613,7 +1608,7 @@ class _Reduce2(Protocol): self, a: _nt.ToGeneric_nd, /, - axis: _ShapeLike | None = 0, + axis: _nt.ShapeLike | None = 0, dtype: _nt.ToDType | None = None, out: _nt.Array | EllipsisType | None = None, keepdims: bool = False, diff --git a/src/numpy-stubs/_typing/__init__.pyi b/src/numpy-stubs/_typing/__init__.pyi index 92b12314..04d67c81 100644 --- a/src/numpy-stubs/_typing/__init__.pyi +++ b/src/numpy-stubs/_typing/__init__.pyi @@ -1,3 +1,4 @@ +from . import _shape as _shape from ._array_like import ( ArrayLike as ArrayLike, NDArray as NDArray, @@ -107,4 +108,3 @@ from ._scalars import ( _UIntLike_co as _UIntLike_co, _VoidLike_co as _VoidLike_co, ) -from ._shape import _ShapeLike as _ShapeLike diff --git a/src/numpy-stubs/_typing/_shape.pyi b/src/numpy-stubs/_typing/_shape.pyi index b411fc7b..f0c549c5 100644 --- a/src/numpy-stubs/_typing/_shape.pyi +++ b/src/numpy-stubs/_typing/_shape.pyi @@ -1,7 +1,4 @@ -from collections.abc import Sequence -from typing import SupportsIndex, TypeAlias # TODO(jorenham): https://github.com/numpy/numtype/issues/565 # Anything that can be coerced to a shape tuple -_ShapeLike: TypeAlias = SupportsIndex | Sequence[SupportsIndex] # noqa: PYI047 diff --git a/src/numpy-stubs/ctypeslib.pyi b/src/numpy-stubs/ctypeslib.pyi index e43fe960..dbf80257 100644 --- a/src/numpy-stubs/ctypeslib.pyi +++ b/src/numpy-stubs/ctypeslib.pyi @@ -9,7 +9,7 @@ import _numtype as _nt import numpy as np from numpy._core._internal import _ctypes from numpy._core.multiarray import flagsobj -from numpy._typing import _ArrayLike, _DTypeLike, _ShapeLike, _VoidDTypeLike +from numpy._typing import _ArrayLike, _DTypeLike, _VoidDTypeLike from numpy._typing._char_codes import _LongCodes, _ULongCodes __all__ = ["as_array", "as_ctypes", "as_ctypes_type", "c_intp", "load_library", "ndpointer"] @@ -75,7 +75,7 @@ def load_library(libname: StrOrBytesPath, loader_path: StrOrBytesPath) -> ct.CDL def ndpointer( dtype: None = None, ndim: int | None = None, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, flags: _FlagsKind | Iterable[_FlagsKind] | int | flagsobj | None = None, ) -> type[_ndptr[None]]: ... @overload @@ -83,7 +83,7 @@ def ndpointer( dtype: _DTypeLike[_ScalarT], ndim: int | None = None, *, - shape: _ShapeLike, + shape: _nt.ShapeLike, flags: _FlagsKind | Iterable[_FlagsKind] | int | flagsobj | None = None, ) -> type[_concrete_ndptr[np.dtype[_ScalarT]]]: ... @overload @@ -91,7 +91,7 @@ def ndpointer( dtype: type | str, ndim: int | None = None, *, - shape: _ShapeLike, + shape: _nt.ShapeLike, flags: _FlagsKind | Iterable[_FlagsKind] | int | flagsobj | None = None, ) -> type[_concrete_ndptr[np.dtype]]: ... @overload @@ -113,9 +113,9 @@ def ndpointer( @overload def as_array(obj: ct._PointerLike, shape: Sequence[int]) -> _nt.Array[Any]: ... @overload -def as_array(obj: _ArrayLike[_ScalarT], shape: _ShapeLike | None = ...) -> _nt.Array[_ScalarT]: ... +def as_array(obj: _ArrayLike[_ScalarT], shape: _nt.ShapeLike | None = ...) -> _nt.Array[_ScalarT]: ... @overload -def as_array(obj: object, shape: _ShapeLike | None = ...) -> _nt.Array[Any]: ... +def as_array(obj: object, shape: _nt.ShapeLike | None = ...) -> _nt.Array[Any]: ... # def as_ctypes(obj: _HasCType[_CT]) -> _CT: ... diff --git a/src/numpy-stubs/fft/_helper.pyi b/src/numpy-stubs/fft/_helper.pyi index aaca3447..db487160 100644 --- a/src/numpy-stubs/fft/_helper.pyi +++ b/src/numpy-stubs/fft/_helper.pyi @@ -3,7 +3,6 @@ from typing_extensions import TypeVar import _numtype as _nt import numpy as np -from numpy._typing import _ShapeLike __all__ = ["fftfreq", "fftshift", "ifftshift", "rfftfreq"] @@ -23,65 +22,65 @@ integer_types: Final[tuple[type[int], type[np.integer]]] = ... # keep in sync with `ifftshift` @overload -def fftshift(x: _nt.ToBool_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.bool]: ... +def fftshift(x: _nt.ToBool_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.bool]: ... @overload -def fftshift(x: _nt.ToBool_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.bool]: ... +def fftshift(x: _nt.ToBool_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.bool]: ... @overload -def fftshift(x: _nt.CanLenArray[_ScalarT, _ShapeT], axes: _ShapeLike | None = None) -> _nt.Array[_ScalarT, _ShapeT]: ... +def fftshift(x: _nt.CanLenArray[_ScalarT, _ShapeT], axes: _nt.ShapeLike | None = None) -> _nt.Array[_ScalarT, _ShapeT]: ... @overload -def fftshift(x: _nt.ToInt_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.intp]: ... +def fftshift(x: _nt.ToInt_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.intp]: ... @overload -def fftshift(x: _nt.ToInt_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.intp]: ... +def fftshift(x: _nt.ToInt_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.intp]: ... @overload -def fftshift(x: _nt.ToFloat64_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.float64]: ... +def fftshift(x: _nt.ToFloat64_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.float64]: ... @overload -def fftshift(x: _nt.ToFloat64_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.float64]: ... +def fftshift(x: _nt.ToFloat64_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.float64]: ... @overload -def fftshift(x: _nt.ToComplex128_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.complex128]: ... +def fftshift(x: _nt.ToComplex128_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.complex128]: ... @overload -def fftshift(x: _nt.ToComplex128_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.complex128]: ... +def fftshift(x: _nt.ToComplex128_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.complex128]: ... @overload -def fftshift(x: _nt.ToBytes_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.bytes_]: ... +def fftshift(x: _nt.ToBytes_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.bytes_]: ... @overload -def fftshift(x: _nt.ToBytes_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.bytes_]: ... +def fftshift(x: _nt.ToBytes_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.bytes_]: ... @overload -def fftshift(x: _nt.ToStr_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.str_]: ... +def fftshift(x: _nt.ToStr_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.str_]: ... @overload -def fftshift(x: _nt.ToStr_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.str_]: ... +def fftshift(x: _nt.ToStr_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.str_]: ... @overload -def fftshift(x: _nt.ToGeneric_1nd, axes: _ShapeLike | None = None) -> _nt.Array[Any]: ... +def fftshift(x: _nt.ToGeneric_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[Any]: ... # keep in sync with `fftshift` @overload -def ifftshift(x: _nt.ToBool_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.bool]: ... +def ifftshift(x: _nt.ToBool_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.bool]: ... @overload -def ifftshift(x: _nt.ToBool_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.bool]: ... +def ifftshift(x: _nt.ToBool_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.bool]: ... @overload def ifftshift( - x: _nt.CanLenArray[_ScalarT, _ShapeT], axes: _ShapeLike | None = None + x: _nt.CanLenArray[_ScalarT, _ShapeT], axes: _nt.ShapeLike | None = None ) -> _nt.Array[_ScalarT, _ShapeT]: ... @overload -def ifftshift(x: _nt.ToInt_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.intp]: ... +def ifftshift(x: _nt.ToInt_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.intp]: ... @overload -def ifftshift(x: _nt.ToInt_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.intp]: ... +def ifftshift(x: _nt.ToInt_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.intp]: ... @overload -def ifftshift(x: _nt.ToFloat64_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.float64]: ... +def ifftshift(x: _nt.ToFloat64_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.float64]: ... @overload -def ifftshift(x: _nt.ToFloat64_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.float64]: ... +def ifftshift(x: _nt.ToFloat64_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.float64]: ... @overload -def ifftshift(x: _nt.ToComplex128_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.complex128]: ... +def ifftshift(x: _nt.ToComplex128_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.complex128]: ... @overload -def ifftshift(x: _nt.ToComplex128_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.complex128]: ... +def ifftshift(x: _nt.ToComplex128_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.complex128]: ... @overload -def ifftshift(x: _nt.ToBytes_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.bytes_]: ... +def ifftshift(x: _nt.ToBytes_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.bytes_]: ... @overload -def ifftshift(x: _nt.ToBytes_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.bytes_]: ... +def ifftshift(x: _nt.ToBytes_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.bytes_]: ... @overload -def ifftshift(x: _nt.ToStr_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.str_]: ... +def ifftshift(x: _nt.ToStr_1d, axes: _nt.ShapeLike | None = None) -> _nt.Array1D[np.str_]: ... @overload -def ifftshift(x: _nt.ToStr_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.str_]: ... +def ifftshift(x: _nt.ToStr_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[np.str_]: ... @overload -def ifftshift(x: _nt.ToGeneric_1nd, axes: _ShapeLike | None = None) -> _nt.Array[Any]: ... +def ifftshift(x: _nt.ToGeneric_1nd, axes: _nt.ShapeLike | None = None) -> _nt.Array[Any]: ... # keep in sync with `rfftfreq` @overload # 0d float | integer -> 1d float64 diff --git a/src/numpy-stubs/lib/_function_base_impl.pyi b/src/numpy-stubs/lib/_function_base_impl.pyi index 3eb606b5..55326c42 100644 --- a/src/numpy-stubs/lib/_function_base_impl.pyi +++ b/src/numpy-stubs/lib/_function_base_impl.pyi @@ -21,7 +21,7 @@ import numpy as np from numpy import _OrderKACF as _Order # noqa: ICN003 from numpy._core.multiarray import bincount from numpy._globals import _NoValueType -from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike, _ShapeLike +from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike __all__ = [ "angle", @@ -518,65 +518,65 @@ def copy(a: ArrayLike, order: _Order = "K", subok: L[False] = False) -> _nt.Arra def gradient( f: _ArrayNoD[_InexactTimeT], *varargs: _nt.CoComplex_nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1, # `| Any` instead of ` | tuple` is returned to avoid several mypy_primer errors ) -> _nt.Array1D[_InexactTimeT] | Any: ... @overload # 1d, known inexact scalar-type def gradient( - f: _nt.Array1D[_InexactTimeT], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.Array1D[_InexactTimeT], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _nt.Array1D[_InexactTimeT]: ... @overload # 2d, known inexact scalar-type def gradient( - f: _nt.Array2D[_InexactTimeT], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.Array2D[_InexactTimeT], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _Mesh2[_InexactTimeT, _InexactTimeT]: ... @overload # 3d, known inexact scalar-type def gradient( - f: _nt.Array3D[_InexactTimeT], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.Array3D[_InexactTimeT], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _Mesh3[_InexactTimeT, _InexactTimeT, _InexactTimeT]: ... @overload # ?d, datetime64 scalar-type def gradient( - f: _ArrayNoD[np.datetime64], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _ArrayNoD[np.datetime64], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _nt.Array1D[np.timedelta64] | tuple[_nt.Array[np.timedelta64], ...]: ... @overload # 1d, datetime64 scalar-type def gradient( - f: _nt.Array1D[np.datetime64], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.Array1D[np.datetime64], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _nt.Array1D[np.timedelta64]: ... @overload # 2d, datetime64 scalar-type def gradient( - f: _nt.Array2D[np.datetime64], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.Array2D[np.datetime64], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _Mesh2[np.timedelta64, np.timedelta64]: ... @overload # 3d, datetime64 scalar-type def gradient( - f: _nt.Array3D[np.datetime64], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.Array3D[np.datetime64], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _Mesh3[np.timedelta64, np.timedelta64, np.timedelta64]: ... @overload # 1d float-like def gradient( - f: Sequence[float], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: Sequence[float], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _nt.Array1D[np.float64]: ... @overload # 2d float-like def gradient( - f: _nt.Sequence2D[float], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.Sequence2D[float], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _Mesh2[np.float64, np.float64]: ... @overload # 3d float-like def gradient( - f: _nt.Sequence3D[float], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.Sequence3D[float], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _Mesh3[np.float64, np.float64, np.float64]: ... @overload # 1d complex-like (the `list` avoids overlap with the float-like overload) def gradient( - f: list[complex], *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: list[complex], *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _nt.Array1D[np.complex128]: ... @overload # 2d float-like def gradient( - f: _nt.ToComplex128_2ds, *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.ToComplex128_2ds, *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _Mesh2[np.complex128, np.complex128]: ... @overload # 3d float-like def gradient( - f: _nt.ToComplex128_3ds, *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.ToComplex128_3ds, *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> _Mesh3[np.complex128, np.complex128, np.complex128]: ... @overload # fallback def gradient( - f: ArrayLike, *varargs: _nt.CoComplex_nd, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: ArrayLike, *varargs: _nt.CoComplex_nd, axis: _nt.ShapeLike | None = None, edge_order: L[1, 2] = 1 ) -> Incomplete: ... # @@ -876,7 +876,7 @@ def sort_complex(a: _ArrayLike[np.longdouble]) -> _nt.Array[np.clongdouble]: ... # def trim_zeros( - filt: _TrimZerosSequence[_T], trim: L["f", "b", "fb", "bf"] = "fb", axis: _ShapeLike | None = None + filt: _TrimZerosSequence[_T], trim: L["f", "b", "fb", "bf"] = "fb", axis: _nt.ShapeLike | None = None ) -> _T: ... # NOTE: condition is usually boolean, but anything with zero/non-zero semantics works @@ -1285,7 +1285,7 @@ def median( @overload # known array-type, keepdims=True def median( a: _ArrayNumericT, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, *, @@ -1294,7 +1294,7 @@ def median( @overload # known scalar-type, keepdims=True def median( a: _ArrayLike[_ScalarNumericT], - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, *, @@ -1303,7 +1303,7 @@ def median( @overload # known scalar-type, axis= def median( a: _ArrayLike[_ScalarNumericT], - axis: _ShapeLike, + axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, keepdims: bool = False, @@ -1311,7 +1311,7 @@ def median( @overload # float array-like, keepdims=True def median( a: _nt.SequenceND[float], - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, *, @@ -1319,12 +1319,12 @@ def median( ) -> _nt.Array[np.float64]: ... @overload # float array-like, axis= def median( - a: _nt.SequenceND[float], axis: _ShapeLike, out: None = None, overwrite_input: bool = False, keepdims: bool = False + a: _nt.SequenceND[float], axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, keepdims: bool = False ) -> _nt.Array[np.float64]: ... @overload # complex array-like, keepdims=True def median( a: _nt.SequenceND[list[complex]], - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, *, @@ -1333,7 +1333,7 @@ def median( @overload # complex array-like, axis= def median( a: _nt.SequenceND[list[complex]], - axis: _ShapeLike, + axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, keepdims: bool = False, @@ -1341,7 +1341,7 @@ def median( @overload # out= (keyword) def median( a: _nt.CoComplex_nd | _ArrayLike[np.timedelta64 | np.object_], - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, overwrite_input: bool = False, @@ -1350,7 +1350,7 @@ def median( @overload # out= (positional) def median( a: _nt.CoComplex_nd | _ArrayLike[np.timedelta64 | np.object_], - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, out: _ArrayT, overwrite_input: bool = False, keepdims: bool = False, @@ -1358,7 +1358,7 @@ def median( @overload # fallback def median( a: _nt.CoComplex_nd | _ArrayLike[np.timedelta64 | np.object_], - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, keepdims: bool = False, @@ -1381,7 +1381,7 @@ def percentile( def percentile( a: _ArrayLike[_InexactDateTimeT], q: _nt.CoFloating_0d, - axis: _ShapeLike, + axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1393,7 +1393,7 @@ def percentile( def percentile( a: _ArrayLike[_InexactDateTimeT], q: _nt.CoFloating_0d, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1417,7 +1417,7 @@ def percentile( def percentile( a: _ArrayLike[_InexactDateTimeT], q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1441,7 +1441,7 @@ def percentile( def percentile( a: _nt.CastsArray[np.float64], q: _nt.CoFloating_0d, - axis: _ShapeLike, + axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1453,7 +1453,7 @@ def percentile( def percentile( a: _nt.CastsArray[np.float64], q: _nt.CoFloating_0d, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1477,7 +1477,7 @@ def percentile( def percentile( a: _nt.CastsArray[np.float64], q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1501,7 +1501,7 @@ def percentile( def percentile( a: _nt.ToComplex128_1nd, q: _nt.CoFloating_0d, - axis: _ShapeLike, + axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1513,7 +1513,7 @@ def percentile( def percentile( a: _nt.ToComplex128_1nd, q: _nt.CoFloating_0d, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1537,7 +1537,7 @@ def percentile( def percentile( a: _nt.ToComplex128_1nd, q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1561,7 +1561,7 @@ def percentile( def percentile( a: _nt.ToObject_1nd, q: _nt.CoFloating_0d, - axis: _ShapeLike, + axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1573,7 +1573,7 @@ def percentile( def percentile( a: _nt.ToObject_1nd, q: _nt.CoFloating_0d, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1597,7 +1597,7 @@ def percentile( def percentile( a: _nt.ToObject_1nd, q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1609,7 +1609,7 @@ def percentile( def percentile( a: ArrayLike, q: _nt.CoFloating_1nd, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, out: _ArrayT, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1621,7 +1621,7 @@ def percentile( def percentile( a: ArrayLike, q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, overwrite_input: bool = False, @@ -1633,7 +1633,7 @@ def percentile( def percentile( a: _nt.CoComplex_1nd | _nt.ToObject_1nd, q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1659,7 +1659,7 @@ def quantile( def quantile( a: _ArrayLike[_InexactDateTimeT], q: _nt.CoFloating_0d, - axis: _ShapeLike, + axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1671,7 +1671,7 @@ def quantile( def quantile( a: _ArrayLike[_InexactDateTimeT], q: _nt.CoFloating_0d, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1695,7 +1695,7 @@ def quantile( def quantile( a: _ArrayLike[_InexactDateTimeT], q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1719,7 +1719,7 @@ def quantile( def quantile( a: _nt.CastsArray[np.float64], q: _nt.CoFloating_0d, - axis: _ShapeLike, + axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1731,7 +1731,7 @@ def quantile( def quantile( a: _nt.CastsArray[np.float64], q: _nt.CoFloating_0d, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1755,7 +1755,7 @@ def quantile( def quantile( a: _nt.CastsArray[np.float64], q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1779,7 +1779,7 @@ def quantile( def quantile( a: _nt.ToComplex128_1nd, q: _nt.CoFloating_0d, - axis: _ShapeLike, + axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1791,7 +1791,7 @@ def quantile( def quantile( a: _nt.ToComplex128_1nd, q: _nt.CoFloating_0d, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1815,7 +1815,7 @@ def quantile( def quantile( a: _nt.ToComplex128_1nd, q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1839,7 +1839,7 @@ def quantile( def quantile( a: _nt.ToObject_1nd, q: _nt.CoFloating_0d, - axis: _ShapeLike, + axis: _nt.ShapeLike, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1851,7 +1851,7 @@ def quantile( def quantile( a: _nt.ToObject_1nd, q: _nt.CoFloating_0d, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1875,7 +1875,7 @@ def quantile( def quantile( a: _nt.ToObject_1nd, q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1887,7 +1887,7 @@ def quantile( def quantile( a: ArrayLike, q: _nt.CoFloating_1nd, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, out: _ArrayT, overwrite_input: bool = False, method: _PercentileMethod = "linear", @@ -1899,7 +1899,7 @@ def quantile( def quantile( a: ArrayLike, q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, overwrite_input: bool = False, @@ -1911,7 +1911,7 @@ def quantile( def quantile( a: _nt.CoComplex_1nd | _nt.ToObject_1nd, q: _nt.CoFloating_1nd, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", diff --git a/src/numpy-stubs/lib/_shape_base_impl.pyi b/src/numpy-stubs/lib/_shape_base_impl.pyi index 88f1f1c7..b6b8b6a8 100644 --- a/src/numpy-stubs/lib/_shape_base_impl.pyi +++ b/src/numpy-stubs/lib/_shape_base_impl.pyi @@ -6,7 +6,7 @@ from typing_extensions import ParamSpec, TypeVar, deprecated import _numtype as _nt import numpy as np from numpy import _CastingKind # noqa: ICN003 -from numpy._typing import ArrayLike, DTypeLike, _ArrayLike as _ToArray, _ShapeLike as _ToShape +from numpy._typing import ArrayLike, DTypeLike, _ArrayLike as _ToArray __all__ = [ "apply_along_axis", @@ -28,6 +28,7 @@ __all__ = [ _Tss = ParamSpec("_Tss") _ScalarT = TypeVar("_ScalarT", bound=np.generic) +_ToShape: TypeAlias = _nt.ShapeLike _ArrayList: TypeAlias = list[_nt.Array[_ScalarT]] diff --git a/src/numpy-stubs/lib/_stride_tricks_impl.pyi b/src/numpy-stubs/lib/_stride_tricks_impl.pyi index e67f51dd..d9b47442 100644 --- a/src/numpy-stubs/lib/_stride_tricks_impl.pyi +++ b/src/numpy-stubs/lib/_stride_tricks_impl.pyi @@ -5,7 +5,7 @@ from typing_extensions import TypeVar import _numtype as _nt import numpy as np -from numpy._typing import ArrayLike, _ArrayLike, _ShapeLike +from numpy._typing import ArrayLike, _ArrayLike __all__ = ["broadcast_arrays", "broadcast_shapes", "broadcast_to"] @@ -39,7 +39,7 @@ def as_strided( @overload def sliding_window_view( x: _ArrayLike[_ScalarT], - window_shape: _ShapeLike, + window_shape: _nt.ShapeLike, axis: SupportsIndex | None = None, *, subok: bool = False, @@ -48,7 +48,7 @@ def sliding_window_view( @overload def sliding_window_view( x: ArrayLike, - window_shape: _ShapeLike, + window_shape: _nt.ShapeLike, axis: SupportsIndex | None = None, *, subok: bool = False, @@ -57,10 +57,10 @@ def sliding_window_view( # @overload -def broadcast_to(array: _ArrayLike[_ScalarT], shape: _ShapeLike, subok: bool = False) -> _nt.Array[_ScalarT]: ... +def broadcast_to(array: _ArrayLike[_ScalarT], shape: _nt.ShapeLike, subok: bool = False) -> _nt.Array[_ScalarT]: ... @overload -def broadcast_to(array: ArrayLike, shape: _ShapeLike, subok: bool = False) -> _nt.Array[Incomplete]: ... +def broadcast_to(array: ArrayLike, shape: _nt.ShapeLike, subok: bool = False) -> _nt.Array[Incomplete]: ... # -def broadcast_shapes(*args: _ShapeLike) -> _nt.Shape: ... +def broadcast_shapes(*args: _nt.ShapeLike) -> _nt.Shape: ... def broadcast_arrays(*args: ArrayLike, subok: bool = False) -> tuple[_nt.Array[Incomplete], ...]: ... diff --git a/src/numpy-stubs/ma/core.pyi b/src/numpy-stubs/ma/core.pyi index 7d58acfa..6e3fb21c 100644 --- a/src/numpy-stubs/ma/core.pyi +++ b/src/numpy-stubs/ma/core.pyi @@ -46,7 +46,6 @@ from numpy._typing import ( _ArrayLike, _DTypeLike, _ScalarLike_co, - _ShapeLike, _SupportsArrayFunc as _CanArrayFunc, _SupportsDType as _HasDType, _VoidDTypeLike, @@ -690,16 +689,16 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): # keep roughly in sync with `ma.core.compress`, but swap the first two arguments @override # type: ignore[override] @overload - def compress(self, condition: _nt.ToBool_nd, axis: _ShapeLike | None, out: _ArrayT) -> _ArrayT: ... + def compress(self, condition: _nt.ToBool_nd, axis: _nt.ShapeLike | None, out: _ArrayT) -> _ArrayT: ... @overload - def compress(self, condition: _nt.ToBool_nd, axis: _ShapeLike | None = None, *, out: _ArrayT) -> _ArrayT: ... + def compress(self, condition: _nt.ToBool_nd, axis: _nt.ShapeLike | None = None, *, out: _ArrayT) -> _ArrayT: ... @overload def compress( self, condition: _nt.ToBool_nd, axis: None = None, out: None = None ) -> MaskedArray[_nt.Rank1, _DTypeT_co]: ... @overload def compress( # pyright: ignore[reportIncompatibleMethodOverride] - self, condition: _nt.ToBool_nd, axis: _ShapeLike | None = None, out: None = None + self, condition: _nt.ToBool_nd, axis: _nt.ShapeLike | None = None, out: None = None ) -> MaskedArray[_nt.AnyShape, _DTypeT_co]: ... # TODO: How to deal with the non-commutative nature of `==` and `!=`? @@ -1219,11 +1218,11 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def count(self, axis: None = None, keepdims: L[False] | _NoValueType = ...) -> int: ... @overload - def count(self, axis: _ShapeLike, keepdims: bool | _NoValueType = ...) -> _nt.MArray[np.int_]: ... + def count(self, axis: _nt.ShapeLike, keepdims: bool | _NoValueType = ...) -> _nt.MArray[np.int_]: ... @overload - def count(self, axis: _ShapeLike | None = None, *, keepdims: L[True]) -> _nt.MArray[np.int_]: ... + def count(self, axis: _nt.ShapeLike | None = None, *, keepdims: L[True]) -> _nt.MArray[np.int_]: ... @overload - def count(self, axis: _ShapeLike | None, keepdims: L[True]) -> _nt.MArray[np.int_]: ... + def count(self, axis: _nt.ShapeLike | None, keepdims: L[True]) -> _nt.MArray[np.int_]: ... # Keep in sync with `ndarray.reshape` @override @@ -1302,34 +1301,34 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def all(self, axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ...) -> bool_: ... @overload - def all(self, axis: _ShapeLike | None = None, out: None = None, *, keepdims: L[True]) -> _nt.MArray[bool_]: ... + def all(self, axis: _nt.ShapeLike | None = None, out: None = None, *, keepdims: L[True]) -> _nt.MArray[bool_]: ... @overload - def all(self, axis: _ShapeLike | None, out: None, keepdims: L[True]) -> _nt.MArray[bool_]: ... + def all(self, axis: _nt.ShapeLike | None, out: None, keepdims: L[True]) -> _nt.MArray[bool_]: ... @overload def all( - self, axis: _ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ... + self, axis: _nt.ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ... ) -> bool_ | _nt.MArray[bool_]: ... @overload - def all(self, axis: _ShapeLike | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... + def all(self, axis: _nt.ShapeLike | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... @overload - def all(self, axis: _ShapeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... # pyright: ignore[reportIncompatibleMethodOverride] + def all(self, axis: _nt.ShapeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... # pyright: ignore[reportIncompatibleMethodOverride] # Keep in sync with `ma.core.any` @override # type: ignore[override] @overload def any(self, axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ...) -> bool_: ... @overload - def any(self, axis: _ShapeLike | None = None, out: None = None, *, keepdims: L[True]) -> _nt.MArray[bool_]: ... + def any(self, axis: _nt.ShapeLike | None = None, out: None = None, *, keepdims: L[True]) -> _nt.MArray[bool_]: ... @overload - def any(self, axis: _ShapeLike | None, out: None, keepdims: L[True]) -> _nt.MArray[bool_]: ... + def any(self, axis: _nt.ShapeLike | None, out: None, keepdims: L[True]) -> _nt.MArray[bool_]: ... @overload def any( - self, axis: _ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ... + self, axis: _nt.ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ... ) -> bool_ | _nt.MArray[bool_]: ... @overload - def any(self, axis: _ShapeLike | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... + def any(self, axis: _nt.ShapeLike | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... @overload - def any(self, axis: _ShapeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... # pyright: ignore[reportIncompatibleMethodOverride] + def any(self, axis: _nt.ShapeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... # pyright: ignore[reportIncompatibleMethodOverride] # Keep in sync with `ndarray.trace` and `ma.core.trace` @override # type: ignore[override] @@ -1370,20 +1369,20 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): def sum( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ..., ) -> Incomplete: ... @overload def sum( - self, /, axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... + self, /, axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... ) -> _ArrayT: ... @overload def sum( # pyright: ignore[reportIncompatibleMethodOverride] self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1407,20 +1406,20 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): def prod( self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ..., ) -> Incomplete: ... @overload def prod( - self, /, axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... + self, /, axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... ) -> _ArrayT: ... @overload def prod( # pyright: ignore[reportIncompatibleMethodOverride] self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1445,20 +1444,20 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def mean( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ..., ) -> Incomplete: ... @overload def mean( - self, /, axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... + self, /, axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... ) -> _ArrayT: ... @overload def mean( # pyright: ignore[reportIncompatibleMethodOverride] self, /, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1478,7 +1477,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def var( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0, @@ -1488,7 +1487,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def var( self, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0, @@ -1498,7 +1497,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def var( # pyright: ignore[reportIncompatibleMethodOverride] self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1512,7 +1511,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def std( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0, @@ -1522,7 +1521,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def std( self, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0, @@ -1532,7 +1531,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def std( # pyright: ignore[reportIncompatibleMethodOverride] self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -1667,7 +1666,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def min( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, fill_value: _ScalarLike_co | None = None, keepdims: bool | _NoValueType = ..., @@ -1675,7 +1674,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def min( self, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, out: _ArrayT, fill_value: _ScalarLike_co | None = None, keepdims: bool | _NoValueType = ..., @@ -1683,7 +1682,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def min( # pyright: ignore[reportIncompatibleMethodOverride] self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, fill_value: _ScalarLike_co | None = None, @@ -1703,7 +1702,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def max( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, fill_value: _ScalarLike_co | None = None, keepdims: bool | _NoValueType = ..., @@ -1711,7 +1710,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def max( self, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, out: _ArrayT, fill_value: _ScalarLike_co | None = None, keepdims: bool | _NoValueType = ..., @@ -1719,7 +1718,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def max( # pyright: ignore[reportIncompatibleMethodOverride] self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, fill_value: _ScalarLike_co | None = None, @@ -1739,19 +1738,19 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def ptp( self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, fill_value: _ScalarLike_co | None = None, keepdims: bool = False, ) -> Any: ... @overload def ptp( - self, axis: _ShapeLike | None, out: _ArrayT, fill_value: _ScalarLike_co | None = None, keepdims: bool = False + self, axis: _nt.ShapeLike | None, out: _ArrayT, fill_value: _ScalarLike_co | None = None, keepdims: bool = False ) -> _ArrayT: ... @overload def ptp( # pyright: ignore[reportIncompatibleVariableOverride] self, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, fill_value: _ScalarLike_co | None = None, @@ -2048,20 +2047,20 @@ anomalies = anom @overload def all(a: ArrayLike, axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ...) -> np.bool: ... @overload -def all(a: ArrayLike, axis: _ShapeLike | None, out: None, keepdims: L[True]) -> _nt.MArray[np.bool]: ... +def all(a: ArrayLike, axis: _nt.ShapeLike | None, out: None, keepdims: L[True]) -> _nt.MArray[np.bool]: ... @overload def all( - a: ArrayLike, axis: _ShapeLike | None = None, out: None = None, *, keepdims: L[True] + a: ArrayLike, axis: _nt.ShapeLike | None = None, out: None = None, *, keepdims: L[True] ) -> _nt.MArray[np.bool]: ... @overload def all( - a: ArrayLike, axis: _ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ... + a: ArrayLike, axis: _nt.ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ... ) -> np.bool | _nt.MArray[np.bool]: ... @overload -def all(a: ArrayLike, axis: _ShapeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... +def all(a: ArrayLike, axis: _nt.ShapeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... @overload def all( - a: ArrayLike, axis: _ShapeLike | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ... + a: ArrayLike, axis: _nt.ShapeLike | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ... ) -> _ArrayT: ... # TODO: sync with `MaskedArray.any` @@ -2069,20 +2068,20 @@ def all( @overload def any(a: ArrayLike, axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ...) -> np.bool: ... @overload -def any(a: ArrayLike, axis: _ShapeLike | None, out: None, keepdims: L[True]) -> _nt.MArray[np.bool]: ... +def any(a: ArrayLike, axis: _nt.ShapeLike | None, out: None, keepdims: L[True]) -> _nt.MArray[np.bool]: ... @overload def any( - a: ArrayLike, axis: _ShapeLike | None = None, out: None = None, *, keepdims: L[True] + a: ArrayLike, axis: _nt.ShapeLike | None = None, out: None = None, *, keepdims: L[True] ) -> _nt.MArray[np.bool]: ... @overload def any( - a: ArrayLike, axis: _ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ... + a: ArrayLike, axis: _nt.ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ... ) -> np.bool | _nt.MArray[np.bool]: ... @overload -def any(a: ArrayLike, axis: _ShapeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... +def any(a: ArrayLike, axis: _nt.ShapeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... @overload def any( - a: ArrayLike, axis: _ShapeLike | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ... + a: ArrayLike, axis: _nt.ShapeLike | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ... ) -> _ArrayT: ... # TODO: sync with `MaskedArray.compress` @@ -2094,7 +2093,7 @@ def compress( ) -> _nt.MArray1D[_ScalarT]: ... @overload def compress( - condition: _nt.ToBool_nd, a: _ArrayLike[_ScalarT], axis: _ShapeLike, out: None = None + condition: _nt.ToBool_nd, a: _ArrayLike[_ScalarT], axis: _nt.ShapeLike, out: None = None ) -> _nt.MArray[_ScalarT]: ... @overload def compress( @@ -2102,12 +2101,12 @@ def compress( ) -> _nt.MArray1D[Incomplete]: ... @overload def compress( - condition: _nt.ToBool_nd, a: ArrayLike, axis: _ShapeLike | None = None, out: None = None + condition: _nt.ToBool_nd, a: ArrayLike, axis: _nt.ShapeLike | None = None, out: None = None ) -> _nt.MArray[Incomplete]: ... @overload -def compress(condition: _nt.ToBool_nd, a: ArrayLike, axis: _ShapeLike | None, out: _ArrayT) -> _ArrayT: ... +def compress(condition: _nt.ToBool_nd, a: ArrayLike, axis: _nt.ShapeLike | None, out: _ArrayT) -> _ArrayT: ... @overload -def compress(condition: _nt.ToBool_nd, a: ArrayLike, axis: _ShapeLike | None = None, *, out: _ArrayT) -> _ArrayT: ... +def compress(condition: _nt.ToBool_nd, a: ArrayLike, axis: _nt.ShapeLike | None = None, *, out: _ArrayT) -> _ArrayT: ... # TODO: sync with `MaskedArray.cumsum` # Keep in sync with `cumprod` @@ -2136,19 +2135,19 @@ def cumprod(a: ArrayLike, axis: CanIndex | None = None, dtype: DTypeLike | None @overload def mean( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ..., ) -> Incomplete: ... @overload def mean( - a: ArrayLike, axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... + a: ArrayLike, axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... ) -> _ArrayT: ... @overload def mean( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -2160,19 +2159,19 @@ def mean( @overload def sum( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ..., ) -> Incomplete: ... @overload def sum( - a: ArrayLike, axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... + a: ArrayLike, axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... ) -> _ArrayT: ... @overload def sum( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -2184,19 +2183,19 @@ def sum( @overload def prod( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ..., ) -> Incomplete: ... @overload def prod( - a: ArrayLike, axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... + a: ArrayLike, axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ... ) -> _ArrayT: ... @overload def prod( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -2236,7 +2235,7 @@ def trace( @overload def std( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0, @@ -2246,7 +2245,7 @@ def std( @overload def std( a: ArrayLike, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0, @@ -2256,7 +2255,7 @@ def std( @overload def std( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -2270,7 +2269,7 @@ def std( @overload def var( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0, @@ -2280,7 +2279,7 @@ def var( @overload def var( a: ArrayLike, - axis: _ShapeLike | None, + axis: _nt.ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0, @@ -2290,7 +2289,7 @@ def var( @overload def var( a: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, @@ -2303,11 +2302,11 @@ def var( @overload def count(a: ArrayLike, axis: None = None, keepdims: L[False] | _NoValueType = ...) -> int: ... @overload -def count(a: ArrayLike, axis: _ShapeLike, keepdims: bool | _NoValueType = ...) -> _nt.Array[np.int_]: ... +def count(a: ArrayLike, axis: _nt.ShapeLike, keepdims: bool | _NoValueType = ...) -> _nt.Array[np.int_]: ... @overload -def count(a: ArrayLike, axis: _ShapeLike | None = None, *, keepdims: L[True]) -> _nt.Array[np.int_]: ... +def count(a: ArrayLike, axis: _nt.ShapeLike | None = None, *, keepdims: L[True]) -> _nt.Array[np.int_]: ... @overload -def count(a: ArrayLike, axis: _ShapeLike | None, keepdims: L[True]) -> _nt.Array[np.int_]: ... +def count(a: ArrayLike, axis: _nt.ShapeLike | None, keepdims: L[True]) -> _nt.Array[np.int_]: ... # TODO: sync with `MaskedArray.argmin` # Keep in sync with `argmax` @@ -2417,7 +2416,7 @@ def min( @overload def min( obj: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, out: None = None, fill_value: _ScalarLike_co | None = None, keepdims: bool | _NoValueType = ..., @@ -2433,7 +2432,7 @@ def min( @overload def min( obj: ArrayLike, - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, out: _ArrayT, fill_value: _ScalarLike_co | None = None, @@ -2928,7 +2927,7 @@ def empty( ) -> _nt.MArray[Incomplete, _ShapeT]: ... @overload # unknown shape, default dtype def empty( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _nt.ToDTypeFloat64 | None = None, order: np._OrderCF = "C", *, @@ -2939,7 +2938,7 @@ def empty( ) -> _nt.MArray[np.float64]: ... @overload # unknown shape, known dtype def empty( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _DTypeT | _HasDType[_DTypeT], order: np._OrderCF = "C", *, @@ -2950,7 +2949,7 @@ def empty( ) -> MaskedArray[Incomplete, _DTypeT]: ... @overload # unknown shape, known scalar-type def empty( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: _DTypeLike[_ScalarT], order: np._OrderCF = "C", *, @@ -2961,7 +2960,7 @@ def empty( ) -> _nt.MArray[_ScalarT]: ... @overload # unknown shape, unknown dtype def empty( - shape: _ShapeLike, + shape: _nt.ShapeLike, dtype: DTypeLike | None = None, order: np._OrderCF = "C", *, @@ -3232,7 +3231,7 @@ def empty_like( dtype: np.dtype[_ScalarT] | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.MArray[_ScalarT]: ... @@ -3254,7 +3253,7 @@ def empty_like( dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> MaskedArray[Incomplete, _DTypeT]: ... @@ -3276,7 +3275,7 @@ def empty_like( dtype: _DTypeLike[_ScalarT], order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.MArray[_ScalarT]: ... @@ -3287,7 +3286,7 @@ def empty_like( dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.MArray[np.bool_]: ... @@ -3298,7 +3297,7 @@ def empty_like( dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.MArray[np.intp]: ... @@ -3309,7 +3308,7 @@ def empty_like( dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.MArray[np.float64]: ... @@ -3320,7 +3319,7 @@ def empty_like( dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.MArray[np.complex128]: ... @@ -3342,7 +3341,7 @@ def empty_like( dtype: DTypeLike | None = None, order: _OrderKACF = "K", subok: bool = True, - shape: _ShapeLike | None = None, + shape: _nt.ShapeLike | None = None, *, device: _Device | None = None, ) -> _nt.MArray[Incomplete]: ... @@ -3496,12 +3495,12 @@ def indices( # keep roughly in sync with `_core.fromnumeric.squeeze` @overload # workaround for microsoft/pyright#10232 def squeeze( - a: _ScalarT, axis: _ShapeLike | None = None, *, fill_value: complex | None = None, hardmask: bool = False + a: _ScalarT, axis: _nt.ShapeLike | None = None, *, fill_value: complex | None = None, hardmask: bool = False ) -> _nt.MArray0D[_ScalarT]: ... @overload # workaround for microsoft/pyright#10232 def squeeze( a: _nt._ToArray_nnd[_ScalarT], - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, fill_value: complex | None = None, hardmask: bool = False, @@ -3509,12 +3508,12 @@ def squeeze( @overload def squeeze( a: _nt._ToArray_nd[_ScalarT], - axis: _ShapeLike | None = None, + axis: _nt.ShapeLike | None = None, *, fill_value: complex | None = None, hardmask: bool = False, ) -> _nt.MArray[_ScalarT]: ... @overload def squeeze( - a: ArrayLike, axis: _ShapeLike | None = None, *, fill_value: complex | None = None, hardmask: bool = False + a: ArrayLike, axis: _nt.ShapeLike | None = None, *, fill_value: complex | None = None, hardmask: bool = False ) -> _nt.MArray[Incomplete]: ... diff --git a/src/numpy-stubs/ma/extras.pyi b/src/numpy-stubs/ma/extras.pyi index cc102f25..90bb9a65 100644 --- a/src/numpy-stubs/ma/extras.pyi +++ b/src/numpy-stubs/ma/extras.pyi @@ -5,7 +5,7 @@ from typing_extensions import TypeVar, override import _numtype as _nt import numpy as np -from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike, _ShapeLike +from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike from numpy.lib._function_base_impl import average from numpy.lib._index_tricks_impl import AxisConcatenator @@ -312,9 +312,9 @@ def stack( # keep in sync with `numpy._core.shape_base_impl.hsplit` @overload -def hsplit(ary: _ArrayLike[_ScalarT], indices_or_sections: _ShapeLike) -> list[_nt.MArray[_ScalarT]]: ... +def hsplit(ary: _ArrayLike[_ScalarT], indices_or_sections: _nt.ShapeLike) -> list[_nt.MArray[_ScalarT]]: ... @overload -def hsplit(ary: ArrayLike, indices_or_sections: _ShapeLike) -> list[_nt.MArray[Incomplete]]: ... +def hsplit(ary: ArrayLike, indices_or_sections: _nt.ShapeLike) -> list[_nt.MArray[Incomplete]]: ... # keep in sync with `numpy._core.twodim_base_impl.hsplit` @overload diff --git a/src/numpy-stubs/random/_generator.pyi b/src/numpy-stubs/random/_generator.pyi index 81d4df5f..2ccced65 100644 --- a/src/numpy-stubs/random/_generator.pyi +++ b/src/numpy-stubs/random/_generator.pyi @@ -6,7 +6,7 @@ from typing_extensions import TypeVar, override import _numtype as _nt import numpy as np import numpy.typing as npt -from numpy._typing import _ArrayLike, _BoolCodes, _DTypeLike, _ShapeLike +from numpy._typing import _ArrayLike, _BoolCodes, _DTypeLike from numpy.random import BitGenerator, RandomState, SeedSequence ### @@ -105,7 +105,7 @@ class Generator: self, /, a: int, - size: _ShapeLike, + size: _nt.ShapeLike, replace: bool = True, p: _nt.CoFloating_nd | None = None, axis: int = 0, @@ -116,7 +116,7 @@ class Generator: self, /, a: _ArrayLike[_ScalarT], - size: _ShapeLike, + size: _nt.ShapeLike, replace: bool = True, p: _nt.CoFloating_nd | None = None, axis: int = 0, @@ -127,7 +127,7 @@ class Generator: self, /, a: npt.ArrayLike, - size: _ShapeLike, + size: _nt.ShapeLike, replace: bool = True, p: _nt.CoFloating_nd | None = None, axis: int = 0, @@ -142,19 +142,19 @@ class Generator: def random(self, /, size: None = None, dtype: _DTypeLikeFloat = ..., out: None = None) -> float: ... @overload def random( - self, /, size: _ShapeLike | None = None, dtype: _nt.ToDTypeFloat64 = ..., *, out: _nt.Array[np.float64, _ShapeT] + self, /, size: _nt.ShapeLike | None = None, dtype: _nt.ToDTypeFloat64 = ..., *, out: _nt.Array[np.float64, _ShapeT] ) -> _nt.Array[np.float64, _ShapeT]: ... @overload def random( - self, /, size: _ShapeLike, dtype: _nt.ToDTypeFloat64 = ..., out: _nt.Array[np.float64] | None = None + self, /, size: _nt.ShapeLike, dtype: _nt.ToDTypeFloat64 = ..., out: _nt.Array[np.float64] | None = None ) -> _nt.Array[np.float64]: ... @overload def random( - self, /, size: _ShapeLike | None = None, dtype: _nt.ToDTypeFloat32 = ..., *, out: _nt.Array[np.float32, _ShapeT] + self, /, size: _nt.ShapeLike | None = None, dtype: _nt.ToDTypeFloat32 = ..., *, out: _nt.Array[np.float32, _ShapeT] ) -> _nt.Array[np.float32, _ShapeT]: ... @overload def random( - self, /, size: _ShapeLike, dtype: _nt.ToDTypeFloat32, out: _nt.Array[np.float32] | None = None + self, /, size: _nt.ShapeLike, dtype: _nt.ToDTypeFloat32, out: _nt.Array[np.float32] | None = None ) -> _nt.Array[np.float32]: ... # @@ -174,15 +174,15 @@ class Generator: def uniform(self, /, low: _nt.CoFloating_0d = 0.0, high: _nt.CoFloating_0d = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def uniform( - self, /, low: _nt.CoFloating_nd, high: _nt.CoFloating_nd, size: _ShapeLike + self, /, low: _nt.CoFloating_nd, high: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def uniform( - self, /, low: _nt.CoFloating_nd = 0.0, high: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, low: _nt.CoFloating_nd = 0.0, high: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def uniform( - self, /, low: _nt.CoFloating_nd = 0.0, high: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, low: _nt.CoFloating_nd = 0.0, high: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -204,7 +204,7 @@ class Generator: ) -> float: ... @overload # size: (int, ...) def triangular( - self, /, left: _nt.CoFloating_nd, mode: _nt.CoFloating_nd, right: _nt.CoFloating_nd, size: _ShapeLike + self, /, left: _nt.CoFloating_nd, mode: _nt.CoFloating_nd, right: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def triangular( @@ -213,7 +213,7 @@ class Generator: left: _nt.CoFloating_nd, mode: _nt.CoFloating_nd, right: _nt.CoFloating_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, ) -> float | _nt.Array[np.float64]: ... # @@ -224,10 +224,10 @@ class Generator: @overload # size: None (default) def beta(self, /, a: _nt.CoFloating_0d, b: _nt.CoFloating_0d, size: None = None) -> float: ... @overload # size: (int, ...) - def beta(self, /, a: _nt.CoFloating_nd, b: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def beta(self, /, a: _nt.CoFloating_nd, b: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback def beta( - self, /, a: _nt.CoFloating_nd, b: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, a: _nt.CoFloating_nd, b: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -239,7 +239,7 @@ class Generator: def standard_exponential( self, /, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, dtype: _nt.ToDTypeFloat64 = ..., method: _ExpMethod = "zig", *, @@ -249,7 +249,7 @@ class Generator: def standard_exponential( self, /, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeFloat64 = ..., method: _ExpMethod = "zig", out: _nt.Array[np.float64] | None = None, @@ -258,7 +258,7 @@ class Generator: def standard_exponential( self, /, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, dtype: _nt.ToDTypeFloat32 = ..., method: _ExpMethod = "zig", *, @@ -268,7 +268,7 @@ class Generator: def standard_exponential( self, /, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeFloat32, method: _ExpMethod = "zig", out: _nt.Array[np.float32] | None = None, @@ -280,12 +280,12 @@ class Generator: @overload def exponential(self, /, scale: _nt.CoFloating_0d = 1.0, size: None = None) -> float: ... @overload - def exponential(self, /, scale: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def exponential(self, /, scale: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload - def exponential(self, /, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def exponential(self, /, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload def exponential( - self, /, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -305,15 +305,15 @@ class Generator: def laplace(self, /, loc: _nt.CoFloating_0d = 0.0, scale: _nt.CoFloating_0d = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def laplace( - self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def laplace( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def laplace( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -333,15 +333,15 @@ class Generator: def logistic(self, /, loc: _nt.CoFloating_0d = 0.0, scale: _nt.CoFloating_0d = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def logistic( - self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def logistic( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def logistic( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -350,9 +350,9 @@ class Generator: @overload # size: None (default) def power(self, /, a: _nt.CoFloating_0d, size: None = None) -> float: ... @overload # size: (int, ...) - def power(self, /, a: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def power(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback - def power(self, /, a: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... + def power(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... # @overload # workaround for microsoft/pyright#10232 @@ -360,9 +360,9 @@ class Generator: @overload # size: None (default) def pareto(self, /, a: _nt.CoFloating_0d, size: None = None) -> float: ... @overload # size: (int, ...) - def pareto(self, /, a: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def pareto(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback - def pareto(self, /, a: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... + def pareto(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... # @overload # workaround for microsoft/pyright#10232 @@ -381,15 +381,15 @@ class Generator: def gumbel(self, /, loc: _nt.CoFloating_0d = 0.0, scale: _nt.CoFloating_0d = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def gumbel( - self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def gumbel( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def gumbel( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -398,9 +398,9 @@ class Generator: @overload # size: None (default) def weibull(self, /, a: _nt.CoFloating_0d, size: None = None) -> float: ... @overload # size: (int, ...) - def weibull(self, /, a: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def weibull(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback - def weibull(self, /, a: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... + def weibull(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... # @overload # workaround for microsoft/pyright#10232 @@ -408,12 +408,12 @@ class Generator: @overload # size: None (default) def rayleigh(self, /, scale: _nt.CoFloating_0d = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) - def rayleigh(self, /, scale: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def rayleigh(self, /, scale: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) - def rayleigh(self, /, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def rayleigh(self, /, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback def rayleigh( - self, /, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -422,9 +422,9 @@ class Generator: @overload # size: None (default) def chisquare(self, /, df: _nt.CoFloating_0d, size: None = None) -> float: ... @overload # size: (int, ...) - def chisquare(self, /, df: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def chisquare(self, /, df: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback - def chisquare(self, /, df: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... + def chisquare(self, /, df: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... # @overload # workaround for microsoft/pyright#10232 @@ -439,11 +439,11 @@ class Generator: def noncentral_chisquare(self, /, df: _nt.CoFloating_0d, nonc: _nt.CoFloating_0d, size: None = None) -> float: ... @overload # size: (int, ...) def noncentral_chisquare( - self, /, df: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _ShapeLike + self, /, df: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def noncentral_chisquare( - self, /, df: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, df: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -451,19 +451,19 @@ class Generator: def standard_normal(self, /, size: None = None, dtype: _DTypeLikeFloat = ..., out: None = None) -> float: ... @overload def standard_normal( - self, /, size: _ShapeLike | None = None, dtype: _nt.ToDTypeFloat64 = ..., *, out: _nt.Array[np.float64] + self, /, size: _nt.ShapeLike | None = None, dtype: _nt.ToDTypeFloat64 = ..., *, out: _nt.Array[np.float64] ) -> _nt.Array[np.float64]: ... @overload def standard_normal( - self, /, size: _ShapeLike, dtype: _nt.ToDTypeFloat64 = ..., out: _nt.Array[np.float64] | None = None + self, /, size: _nt.ShapeLike, dtype: _nt.ToDTypeFloat64 = ..., out: _nt.Array[np.float64] | None = None ) -> _nt.Array[np.float64]: ... @overload def standard_normal( - self, /, size: _ShapeLike | None = ..., dtype: _nt.ToDTypeFloat32 = ..., *, out: _nt.Array[np.float32] + self, /, size: _nt.ShapeLike | None = ..., dtype: _nt.ToDTypeFloat32 = ..., *, out: _nt.Array[np.float32] ) -> _nt.Array[np.float32]: ... @overload def standard_normal( - self, /, size: _ShapeLike, dtype: _nt.ToDTypeFloat32, out: _nt.Array[np.float32] | None = None + self, /, size: _nt.ShapeLike, dtype: _nt.ToDTypeFloat32, out: _nt.Array[np.float32] | None = None ) -> _nt.Array[np.float32]: ... # @@ -483,15 +483,15 @@ class Generator: def normal(self, /, loc: _nt.CoFloating_0d = 0.0, scale: _nt.CoFloating_0d = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def normal( - self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def normal( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def normal( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -513,15 +513,15 @@ class Generator: ) -> float: ... @overload # size: (int, ...) (positional) def lognormal( - self, /, mean: _nt.CoFloating_nd, sigma: _nt.CoFloating_nd, size: _ShapeLike + self, /, mean: _nt.CoFloating_nd, sigma: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def lognormal( - self, /, mean: _nt.CoFloating_nd = 0.0, sigma: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, mean: _nt.CoFloating_nd = 0.0, sigma: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def lognormal( - self, /, mean: _nt.CoFloating_nd = 0.0, sigma: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, mean: _nt.CoFloating_nd = 0.0, sigma: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -537,18 +537,18 @@ class Generator: def vonmises(self, /, mu: _nt.CoFloating_0d, kappa: _nt.CoFloating_0d, size: None = None) -> float: ... @overload # size: (int, ...) def vonmises( - self, /, mu: _nt.CoFloating_nd, kappa: _nt.CoFloating_nd, size: _ShapeLike + self, /, mu: _nt.CoFloating_nd, kappa: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def vonmises( - self, /, mu: _nt.CoFloating_nd, kappa: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, mu: _nt.CoFloating_nd, kappa: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def standard_cauchy(self, /, size: None = None) -> float: ... @overload # size: (int, ...) - def standard_cauchy(self, /, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def standard_cauchy(self, /, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... # @overload # workaround for microsoft/pyright#10232 @@ -556,9 +556,9 @@ class Generator: @overload # size: None (default) def standard_t(self, /, df: float, size: None = None) -> float: ... @overload # size: (int, ...) - def standard_t(self, /, df: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def standard_t(self, /, df: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback - def standard_t(self, /, df: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... + def standard_t(self, /, df: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... # @overload # workaround for microsoft/pyright#10232 @@ -582,7 +582,7 @@ class Generator: self, /, shape: _nt.CoFloating_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, dtype: _nt.ToDTypeFloat64 = ..., *, out: _nt.Array[np.float64], @@ -592,7 +592,7 @@ class Generator: self, /, shape: _nt.CoFloating_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeFloat64 = ..., out: _nt.Array[np.float64] | None = None, ) -> _nt.Array[np.float64]: ... @@ -601,7 +601,7 @@ class Generator: self, /, shape: _nt.CoFloating_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, dtype: _nt.ToDTypeFloat64 = ..., out: _nt.Array[np.float64] | None = None, ) -> float | _nt.Array[np.float64]: ... @@ -610,7 +610,7 @@ class Generator: self, /, shape: _nt.CoFloating_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeFloat32, out: _nt.Array[np.float32] | None = None, ) -> _nt.Array[np.float32]: ... @@ -619,7 +619,7 @@ class Generator: self, /, shape: _nt.CoFloating_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeFloat32, out: _nt.Array[np.float32], @@ -629,7 +629,7 @@ class Generator: self, /, shape: _nt.CoFloating_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeFloat32, out: None = None, @@ -648,15 +648,15 @@ class Generator: def gamma(self, /, shape: _nt.CoFloating_0d, scale: _nt.CoFloating_0d = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def gamma( - self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike + self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def gamma( - self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def gamma( - self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -671,10 +671,10 @@ class Generator: @overload # size: None (default) def f(self, /, dfnum: _nt.CoFloating_0d, dfden: _nt.CoFloating_0d, size: None = None) -> float: ... @overload # size: (int, ...) - def f(self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def f(self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback def f( - self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -696,7 +696,7 @@ class Generator: ) -> float: ... @overload # size: (int, ...) def noncentral_f( - self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _ShapeLike + self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def noncentral_f( @@ -705,7 +705,7 @@ class Generator: dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, ) -> float | _nt.Array[np.float64]: ... # @@ -720,10 +720,10 @@ class Generator: @overload # size: None (default) def wald(self, /, mean: float, scale: float, size: None = None) -> float: ... @overload # size: (int, ...) - def wald(self, /, mean: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def wald(self, /, mean: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback def wald( - self, /, mean: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, mean: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... ### @@ -840,13 +840,13 @@ class Generator: dtype: _nt.ToDTypeUInt64, endpoint: bool = False, ) -> np.uint64: ... - @overload # size: _ShapeLike (positional) + @overload # size: _nt.ShapeLike (positional) def integers( self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _DTypeLike[np.int64] = ..., endpoint: bool = False, ) -> _nt.Array[np.int64]: ... @@ -856,7 +856,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _DTypeLike[_IntegerT], endpoint: bool = False, ) -> _nt.Array[_IntegerT]: ... @@ -866,7 +866,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: type[bool] | _BoolCodes, endpoint: bool = False, ) -> _nt.Array[np.bool]: ... @@ -876,7 +876,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt8, endpoint: bool = False, ) -> _nt.Array[np.int8]: ... @@ -886,7 +886,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt8, endpoint: bool = False, ) -> _nt.Array[np.uint8]: ... @@ -896,7 +896,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt16, endpoint: bool = False, ) -> _nt.Array[np.int16]: ... @@ -906,7 +906,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt16, endpoint: bool = False, ) -> _nt.Array[np.uint16]: ... @@ -916,7 +916,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt32, endpoint: bool = False, ) -> _nt.Array[np.int32]: ... @@ -926,7 +926,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt32, endpoint: bool = False, ) -> _nt.Array[np.uint32]: ... @@ -936,7 +936,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt64, endpoint: bool = False, ) -> _nt.Array[np.int64]: ... @@ -946,18 +946,18 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt64, endpoint: bool = False, ) -> _nt.Array[np.uint64]: ... - @overload # size: _ShapeLike (keyword) + @overload # size: _nt.ShapeLike (keyword) def integers( self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _DTypeLike[np.int64] = ..., endpoint: bool = False, ) -> _nt.Array[np.int64]: ... @@ -968,7 +968,7 @@ class Generator: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _DTypeLike[_IntegerT], endpoint: bool = False, ) -> _nt.Array[_IntegerT]: ... @@ -979,7 +979,7 @@ class Generator: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: type[bool] | _BoolCodes, endpoint: bool = False, ) -> _nt.Array[np.bool]: ... @@ -990,7 +990,7 @@ class Generator: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt8, endpoint: bool = False, ) -> _nt.Array[np.int8]: ... @@ -1001,7 +1001,7 @@ class Generator: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt8, endpoint: bool = False, ) -> _nt.Array[np.uint8]: ... @@ -1012,7 +1012,7 @@ class Generator: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt16, endpoint: bool = False, ) -> _nt.Array[np.int16]: ... @@ -1023,7 +1023,7 @@ class Generator: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt16, endpoint: bool = False, ) -> _nt.Array[np.uint16]: ... @@ -1034,7 +1034,7 @@ class Generator: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt32, endpoint: bool = False, ) -> _nt.Array[np.int32]: ... @@ -1045,7 +1045,7 @@ class Generator: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt32, endpoint: bool = False, ) -> _nt.Array[np.uint32]: ... @@ -1056,7 +1056,7 @@ class Generator: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt64, endpoint: bool = False, ) -> _nt.Array[np.int64]: ... @@ -1067,7 +1067,7 @@ class Generator: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt64, endpoint: bool = False, ) -> _nt.Array[np.uint64]: ... @@ -1077,7 +1077,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: type[bool], endpoint: bool = False, @@ -1088,7 +1088,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _DTypeLike[_IntegerT], endpoint: bool = False, @@ -1099,7 +1099,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _BoolCodes, endpoint: bool = False, @@ -1110,7 +1110,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeInt8, endpoint: bool = False, @@ -1121,7 +1121,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeUInt8, endpoint: bool = False, @@ -1132,7 +1132,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeInt16, endpoint: bool = False, @@ -1143,7 +1143,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeUInt16, endpoint: bool = False, @@ -1154,7 +1154,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeInt32, endpoint: bool = False, @@ -1165,7 +1165,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeUInt32, endpoint: bool = False, @@ -1176,7 +1176,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeInt64 = ..., endpoint: bool = False, @@ -1187,7 +1187,7 @@ class Generator: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeUInt64, endpoint: bool = False, @@ -1201,10 +1201,10 @@ class Generator: @overload # size: None (default) def binomial(self, /, n: int, p: _nt.CoFloating_0d, size: None = None) -> int: ... @overload # size: (int, ...) - def binomial(self, /, n: _nt.CoInteger_nd, p: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.int64]: ... + def binomial(self, /, n: _nt.CoInteger_nd, p: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.int64]: ... @overload # fallback def binomial( - self, /, n: _nt.CoInteger_nd, p: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, n: _nt.CoInteger_nd, p: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> int | _nt.Array[np.int64]: ... # @@ -1220,11 +1220,11 @@ class Generator: def negative_binomial(self, /, n: _nt.CoFloating_0d, p: _nt.CoFloating_0d, size: None = None) -> int: ... @overload # size: (int, ...) def negative_binomial( - self, /, n: _nt.CoFloating_nd, p: _nt.CoFloating_nd, size: _ShapeLike + self, /, n: _nt.CoFloating_nd, p: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.int64]: ... @overload # fallback def negative_binomial( - self, /, n: _nt.CoFloating_nd, p: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, n: _nt.CoFloating_nd, p: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> int | _nt.Array[np.int64]: ... # @@ -1233,11 +1233,11 @@ class Generator: @overload # size: None (default) def poisson(self, /, lam: _nt.CoFloating_0d = 1.0, size: None = None) -> int: ... @overload # size: (int, ...) (positional) - def poisson(self, /, lam: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.int64]: ... + def poisson(self, /, lam: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.int64]: ... @overload # size: (int, ...) (keyword) - def poisson(self, /, lam: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike) -> _nt.Array[np.int64]: ... + def poisson(self, /, lam: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike) -> _nt.Array[np.int64]: ... @overload # fallback - def poisson(self, /, lam: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None) -> int | _nt.Array[np.int64]: ... + def poisson(self, /, lam: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None) -> int | _nt.Array[np.int64]: ... # @overload # workaround for microsoft/pyright#10232 @@ -1245,9 +1245,9 @@ class Generator: @overload # size: None (default) def zipf(self, /, a: _nt.CoFloating_0d, size: None = None) -> int: ... @overload # size: (int, ...) - def zipf(self, /, a: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.int64]: ... + def zipf(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.int64]: ... @overload # fallback - def zipf(self, /, a: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> int | _nt.Array[np.int64]: ... + def zipf(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> int | _nt.Array[np.int64]: ... # @overload # workaround for microsoft/pyright#10232 @@ -1255,9 +1255,9 @@ class Generator: @overload # size: None (default) def geometric(self, /, p: _nt.CoFloating_0d, size: None = None) -> int: ... @overload # size: (int, ...) - def geometric(self, /, p: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.int64]: ... + def geometric(self, /, p: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.int64]: ... @overload # fallback - def geometric(self, /, p: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> int | _nt.Array[np.int64]: ... + def geometric(self, /, p: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> int | _nt.Array[np.int64]: ... # @overload # workaround for microsoft/pyright#10232 @@ -1276,7 +1276,7 @@ class Generator: def hypergeometric(self, /, ngood: int, nbad: int, nsample: int, size: None = None) -> int: ... @overload # size: (int, ...) def hypergeometric( - self, /, ngood: _nt.CoInteger_nd, nbad: _nt.CoInteger_nd, nsample: _nt.CoInteger_nd, size: _ShapeLike + self, /, ngood: _nt.CoInteger_nd, nbad: _nt.CoInteger_nd, nsample: _nt.CoInteger_nd, size: _nt.ShapeLike ) -> _nt.Array[np.int64]: ... @overload # fallback def hypergeometric( @@ -1285,7 +1285,7 @@ class Generator: ngood: _nt.CoInteger_nd, nbad: _nt.CoInteger_nd, nsample: _nt.CoInteger_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, ) -> int | _nt.Array[np.int64]: ... # @@ -1294,9 +1294,9 @@ class Generator: @overload # size: None (default) def logseries(self, /, p: _nt.CoFloating_0d, size: None = None) -> int: ... @overload # size: (int, ...) - def logseries(self, /, p: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.int64]: ... + def logseries(self, /, p: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.int64]: ... @overload # fallback - def logseries(self, /, p: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> int | _nt.Array[np.int64]: ... + def logseries(self, /, p: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> int | _nt.Array[np.int64]: ... ### # multivariate @@ -1307,7 +1307,7 @@ class Generator: /, mean: _nt.CoFloating_nd, cov: _nt.CoFloating_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, check_valid: Literal["warn", "raise", "ignore"] = "warn", tol: float = 1e-8, *, @@ -1315,11 +1315,11 @@ class Generator: ) -> _nt.Array[np.float64]: ... # - def dirichlet(self, /, alpha: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> _nt.Array[np.float64]: ... + def dirichlet(self, /, alpha: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> _nt.Array[np.float64]: ... # def multinomial( - self, /, n: _nt.CoInteger_nd, pvals: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, n: _nt.CoInteger_nd, pvals: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> _nt.Array[np.int64]: ... # @@ -1327,7 +1327,7 @@ class Generator: self, colors: _nt.CoInteger_nd, nsample: int, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, method: Literal["marginals", "count"] = "marginals", ) -> _nt.Array[np.int64]: ... diff --git a/src/numpy-stubs/random/bit_generator.pyi b/src/numpy-stubs/random/bit_generator.pyi index 3c3009cc..f41f92d4 100644 --- a/src/numpy-stubs/random/bit_generator.pyi +++ b/src/numpy-stubs/random/bit_generator.pyi @@ -18,7 +18,7 @@ from typing_extensions import CapsuleType, TypeVar, override import _numtype as _nt import numpy as np -from numpy._typing import _ArrayLikeInt_co, _DTypeLike, _ShapeLike, _UInt32Codes, _UInt64Codes +from numpy._typing import _ArrayLikeInt_co, _DTypeLike, _UInt32Codes, _UInt64Codes __all__ = ["BitGenerator", "SeedSequence"] @@ -93,11 +93,11 @@ class BitGenerator(_CythonMixin, abc.ABC, Generic[_StateT]): @overload def random_raw(self, /, size: None = None, output: L[True] = True) -> int: ... @overload - def random_raw(self, /, size: _ShapeLike, output: L[True] = True) -> _nt.Array[np.uint64]: ... + def random_raw(self, /, size: _nt.ShapeLike, output: L[True] = True) -> _nt.Array[np.uint64]: ... @overload - def random_raw(self, /, size: _ShapeLike | None, output: L[False]) -> None: ... + def random_raw(self, /, size: _nt.ShapeLike | None, output: L[False]) -> None: ... @overload - def random_raw(self, /, size: _ShapeLike | None = None, *, output: L[False]) -> None: ... + def random_raw(self, /, size: _nt.ShapeLike | None = None, *, output: L[False]) -> None: ... ### diff --git a/src/numpy-stubs/random/mtrand.pyi b/src/numpy-stubs/random/mtrand.pyi index be3897b9..a0fbc90f 100644 --- a/src/numpy-stubs/random/mtrand.pyi +++ b/src/numpy-stubs/random/mtrand.pyi @@ -6,7 +6,7 @@ from typing_extensions import TypeVar, override import _numtype as _nt import numpy as np import numpy.typing as npt -from numpy._typing import _ArrayLike, _BoolCodes, _DTypeLike, _ShapeLike +from numpy._typing import _ArrayLike, _BoolCodes, _DTypeLike from numpy.random.bit_generator import BitGenerator __all__ = [ @@ -106,15 +106,15 @@ class RandomState: ) -> Any: ... @overload def choice( - self, /, a: int, size: _ShapeLike, replace: bool = True, p: _nt.CoFloating_nd | None = None + self, /, a: int, size: _nt.ShapeLike, replace: bool = True, p: _nt.CoFloating_nd | None = None ) -> _nt.Array[np.int_]: ... @overload def choice( - self, /, a: _ArrayLike[_ScalarT], size: _ShapeLike, replace: bool = True, p: _nt.CoFloating_nd | None = None + self, /, a: _ArrayLike[_ScalarT], size: _nt.ShapeLike, replace: bool = True, p: _nt.CoFloating_nd | None = None ) -> _nt.Array[_ScalarT]: ... @overload def choice( - self, /, a: npt.ArrayLike, size: _ShapeLike, replace: bool = True, p: _nt.CoFloating_nd | None = None + self, /, a: npt.ArrayLike, size: _nt.ShapeLike, replace: bool = True, p: _nt.CoFloating_nd | None = None ) -> _nt.Array[Any]: ... # @@ -147,28 +147,28 @@ class RandomState: @overload def random_sample(self, /, size: None = None) -> float: ... @overload - def random_sample(self, /, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def random_sample(self, /, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... # @overload def random(self, /, size: None = None) -> float: ... @overload - def random(self, /, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def random(self, /, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... # @overload # size: None (default) def uniform(self, /, low: float = 0.0, high: float = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def uniform( - self, /, low: _nt.CoFloating_nd, high: _nt.CoFloating_nd, size: _ShapeLike + self, /, low: _nt.CoFloating_nd, high: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def uniform( - self, /, low: _nt.CoFloating_nd = 0.0, high: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, low: _nt.CoFloating_nd = 0.0, high: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def uniform( - self, /, low: _nt.CoFloating_nd = 0.0, high: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, low: _nt.CoFloating_nd = 0.0, high: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -176,7 +176,7 @@ class RandomState: def triangular(self, /, left: float, mode: float, right: float, size: None = None) -> float: ... @overload # size: (int, ...) def triangular( - self, /, left: _nt.CoFloating_nd, mode: _nt.CoFloating_nd, right: _nt.CoFloating_nd, size: _ShapeLike + self, /, left: _nt.CoFloating_nd, mode: _nt.CoFloating_nd, right: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def triangular( @@ -185,35 +185,35 @@ class RandomState: left: _nt.CoFloating_nd, mode: _nt.CoFloating_nd, right: _nt.CoFloating_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, ) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def beta(self, /, a: float, b: float, size: None = None) -> float: ... @overload # size: (int, ...) - def beta(self, /, a: _nt.CoFloating_nd, b: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def beta(self, /, a: _nt.CoFloating_nd, b: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback def beta( - self, /, a: _nt.CoFloating_nd, b: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, a: _nt.CoFloating_nd, b: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def standard_exponential(self, /, size: None = None) -> float: ... @overload # size: (int, ...) - def standard_exponential(self, /, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def standard_exponential(self, /, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... # @overload # size: None (default) def exponential(self, /, scale: float = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) - def exponential(self, /, scale: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def exponential(self, /, scale: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) - def exponential(self, /, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def exponential(self, /, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback def exponential( - self, /, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -221,15 +221,15 @@ class RandomState: def laplace(self, /, loc: float = 0.0, scale: float = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def laplace( - self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def laplace( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def laplace( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -237,109 +237,109 @@ class RandomState: def logistic(self, /, loc: float = 0.0, scale: float = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def logistic( - self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def logistic( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def logistic( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def power(self, /, a: float, size: None = None) -> float: ... @overload # size: (int, ...) - def power(self, /, a: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def power(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback - def power(self, /, a: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... + def power(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def pareto(self, /, a: float, size: None = None) -> float: ... @overload # size: (int, ...) - def pareto(self, /, a: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def pareto(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback - def pareto(self, /, a: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... + def pareto(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def gumbel(self, /, loc: float = 0.0, scale: float = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def gumbel( - self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def gumbel( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def gumbel( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def weibull(self, /, a: float, size: None = None) -> float: ... @overload # size: (int, ...) - def weibull(self, /, a: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def weibull(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback - def weibull(self, /, a: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... + def weibull(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def rayleigh(self, /, scale: float = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) - def rayleigh(self, /, scale: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def rayleigh(self, /, scale: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) - def rayleigh(self, /, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def rayleigh(self, /, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback def rayleigh( - self, /, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def chisquare(self, /, df: float, size: None = None) -> float: ... @overload # size: (int, ...) - def chisquare(self, /, df: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def chisquare(self, /, df: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback - def chisquare(self, /, df: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... + def chisquare(self, /, df: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def noncentral_chisquare(self, /, df: float, nonc: float, size: None = None) -> float: ... @overload # size: (int, ...) def noncentral_chisquare( - self, /, df: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _ShapeLike + self, /, df: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def noncentral_chisquare( - self, /, df: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, df: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def standard_normal(self, /, size: None = None) -> float: ... @overload # size: (int, ...) - def standard_normal(self, /, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def standard_normal(self, /, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... # @overload # size: None (default) def normal(self, /, loc: float = 0.0, scale: float = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def normal( - self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def normal( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def normal( - self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, loc: _nt.CoFloating_nd = 0.0, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -347,15 +347,15 @@ class RandomState: def lognormal(self, /, mean: float = 0.0, sigma: float = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def lognormal( - self, /, mean: _nt.CoFloating_nd, sigma: _nt.CoFloating_nd, size: _ShapeLike + self, /, mean: _nt.CoFloating_nd, sigma: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def lognormal( - self, /, mean: _nt.CoFloating_nd = 0.0, sigma: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, mean: _nt.CoFloating_nd = 0.0, sigma: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def lognormal( - self, /, mean: _nt.CoFloating_nd = 0.0, sigma: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, mean: _nt.CoFloating_nd = 0.0, sigma: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -363,35 +363,35 @@ class RandomState: def vonmises(self, /, mu: float, kappa: float, size: None = None) -> float: ... @overload # size: (int, ...) def vonmises( - self, /, mu: _nt.CoFloating_nd, kappa: _nt.CoFloating_nd, size: _ShapeLike + self, /, mu: _nt.CoFloating_nd, kappa: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def vonmises( - self, /, mu: _nt.CoFloating_nd, kappa: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, mu: _nt.CoFloating_nd, kappa: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def standard_cauchy(self, /, size: None = None) -> float: ... @overload # size: (int, ...) - def standard_cauchy(self, /, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def standard_cauchy(self, /, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... # @overload # size: None (default) def standard_t(self, /, df: float, size: None = None) -> float: ... @overload # size: (int, ...) - def standard_t(self, /, df: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def standard_t(self, /, df: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback - def standard_t(self, /, df: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... + def standard_t(self, /, df: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def standard_gamma(self, /, shape: float, size: None = None) -> float: ... @overload # size: (int, ...) - def standard_gamma(self, /, shape: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def standard_gamma(self, /, shape: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback def standard_gamma( - self, /, shape: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, shape: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -399,25 +399,25 @@ class RandomState: def gamma(self, /, shape: float, scale: float = 1.0, size: None = None) -> float: ... @overload # size: (int, ...) (positional) def gamma( - self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike + self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # size: (int, ...) (keyword) def gamma( - self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike + self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def gamma( - self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None + self, /, shape: _nt.CoFloating_nd, scale: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def f(self, /, dfnum: float, dfden: float, size: None = None) -> float: ... @overload # size: (int, ...) - def f(self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def f(self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback def f( - self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... # @@ -425,7 +425,7 @@ class RandomState: def noncentral_f(self, /, dfnum: float, dfden: float, nonc: float, size: None = None) -> float: ... @overload # size: (int, ...) def noncentral_f( - self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _ShapeLike + self, /, dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.float64]: ... @overload # fallback def noncentral_f( @@ -434,17 +434,17 @@ class RandomState: dfnum: _nt.CoFloating_nd, dfden: _nt.CoFloating_nd, nonc: _nt.CoFloating_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, ) -> float | _nt.Array[np.float64]: ... # @overload # size: None (default) def wald(self, /, mean: float, scale: float, size: None = None) -> float: ... @overload # size: (int, ...) - def wald(self, /, mean: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.float64]: ... + def wald(self, /, mean: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.float64]: ... @overload # fallback def wald( - self, /, mean: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, mean: _nt.CoFloating_nd, scale: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> float | _nt.Array[np.float64]: ... ### @@ -454,22 +454,22 @@ class RandomState: @overload def tomaxint(self, /, size: None = None) -> int: ... @overload # Generates long values, but stores it in a 64bit int - def tomaxint(self, /, size: _ShapeLike) -> _nt.Array[np.int64]: ... + def tomaxint(self, /, size: _nt.ShapeLike) -> _nt.Array[np.int64]: ... # @overload # size: None (default) def random_integers(self, /, low: int, high: int | None = None, size: None = None) -> int: ... @overload # size: (int, ...) (positional) def random_integers( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None, size: _ShapeLike + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None, size: _nt.ShapeLike ) -> _nt.Array[np.int_]: ... @overload # size: (int, ...) (keyword) def random_integers( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, size: _ShapeLike + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, size: _nt.ShapeLike ) -> _nt.Array[np.int_]: ... @overload # fallback def random_integers( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, size: _ShapeLike | None = None + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, size: _nt.ShapeLike | None = None ) -> int | _nt.Array[np.int_]: ... # @@ -517,51 +517,51 @@ class RandomState: def randint( self, /, low: int, high: int | None = None, size: None = None, *, dtype: _nt.ToDTypeUInt64 ) -> np.uint64: ... - @overload # size: _ShapeLike (positional) - def randint(self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike) -> _nt.Array[np.int_]: ... + @overload # size: _nt.ShapeLike (positional) + def randint(self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike) -> _nt.Array[np.int_]: ... @overload def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike, dtype: _nt.ToDTypeBool + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike, dtype: _nt.ToDTypeBool ) -> _nt.Array[np.bool]: ... @overload def randint( # type: ignore[overload-overlap] - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike, dtype: _DTypeLike[_IntegerT] + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike, dtype: _DTypeLike[_IntegerT] ) -> _nt.Array[_IntegerT]: ... @overload def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike, dtype: _nt.ToDTypeInt8 + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike, dtype: _nt.ToDTypeInt8 ) -> _nt.Array[np.int8]: ... @overload def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike, dtype: _nt.ToDTypeUInt8 + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt8 ) -> _nt.Array[np.uint8]: ... @overload def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike, dtype: _nt.ToDTypeInt16 + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike, dtype: _nt.ToDTypeInt16 ) -> _nt.Array[np.int16]: ... @overload def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike, dtype: _nt.ToDTypeUInt16 + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt16 ) -> _nt.Array[np.uint16]: ... @overload def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike, dtype: _nt.ToDTypeInt32 + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike, dtype: _nt.ToDTypeInt32 ) -> _nt.Array[np.int32]: ... @overload def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike, dtype: _nt.ToDTypeUInt32 + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt32 ) -> _nt.Array[np.uint32]: ... @overload def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike, dtype: _nt.ToDTypeInt64 + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike, dtype: _nt.ToDTypeInt64 ) -> _nt.Array[np.int64]: ... @overload def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _ShapeLike, dtype: _nt.ToDTypeUInt64 + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd, size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt64 ) -> _nt.Array[np.uint64]: ... - @overload # size: _ShapeLike (keyword) + @overload # size: _nt.ShapeLike (keyword) def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, size: _ShapeLike + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, size: _nt.ShapeLike ) -> _nt.Array[np.int_]: ... @overload def randint( @@ -570,7 +570,7 @@ class RandomState: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeBool, ) -> _nt.Array[np.bool]: ... @overload @@ -580,7 +580,7 @@ class RandomState: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _DTypeLike[_IntegerT], ) -> _nt.Array[_IntegerT]: ... @overload @@ -590,7 +590,7 @@ class RandomState: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt8, ) -> _nt.Array[np.int8]: ... @overload @@ -600,7 +600,7 @@ class RandomState: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt8, ) -> _nt.Array[np.uint8]: ... @overload @@ -610,7 +610,7 @@ class RandomState: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt16, ) -> _nt.Array[np.int16]: ... @overload @@ -620,7 +620,7 @@ class RandomState: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt16, ) -> _nt.Array[np.uint16]: ... @overload @@ -630,7 +630,7 @@ class RandomState: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt32, ) -> _nt.Array[np.int32]: ... @overload @@ -640,7 +640,7 @@ class RandomState: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt32, ) -> _nt.Array[np.uint32]: ... @overload @@ -650,7 +650,7 @@ class RandomState: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeInt64, ) -> _nt.Array[np.int64]: ... @overload @@ -660,12 +660,12 @@ class RandomState: low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, *, - size: _ShapeLike, + size: _nt.ShapeLike, dtype: _nt.ToDTypeUInt64, ) -> _nt.Array[np.uint64]: ... @overload # fallback def randint( - self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, size: _ShapeLike | None = None + self, /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, size: _nt.ShapeLike | None = None ) -> int | _nt.Array[np.int_]: ... @overload def randint( @@ -673,7 +673,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: type[bool], ) -> bool | _nt.Array[np.bool]: ... @@ -683,7 +683,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _DTypeLike[_IntegerT], ) -> _IntegerT | _nt.Array[_IntegerT]: ... @@ -693,7 +693,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _BoolCodes, ) -> np.bool | _nt.Array[np.bool]: ... @@ -703,7 +703,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeInt8, ) -> np.int8 | _nt.Array[np.int8]: ... @@ -713,7 +713,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeUInt8, ) -> np.uint8 | _nt.Array[np.uint8]: ... @@ -723,7 +723,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeInt16, ) -> np.int16 | _nt.Array[np.int16]: ... @@ -733,7 +733,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeUInt16, ) -> np.uint16 | _nt.Array[np.uint16]: ... @@ -743,7 +743,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeInt32, ) -> np.int32 | _nt.Array[np.int32]: ... @@ -753,7 +753,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeUInt32, ) -> np.uint32 | _nt.Array[np.uint32]: ... @@ -763,7 +763,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeInt64, ) -> int | np.int64 | _nt.Array[np.int64]: ... @@ -773,7 +773,7 @@ class RandomState: /, low: _nt.CoInteger_nd, high: _nt.CoInteger_nd | None = None, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, *, dtype: _nt.ToDTypeUInt64, ) -> np.uint64 | _nt.Array[np.uint64]: ... @@ -782,10 +782,10 @@ class RandomState: @overload # size: None (default) def binomial(self, /, n: int, p: float, size: None = None) -> int: ... @overload # size: (int, ...) - def binomial(self, /, n: _nt.CoInteger_nd, p: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.int_]: ... + def binomial(self, /, n: _nt.CoInteger_nd, p: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.int_]: ... @overload # fallback def binomial( - self, /, n: _nt.CoInteger_nd, p: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, n: _nt.CoInteger_nd, p: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> int | _nt.Array[np.int_]: ... # @@ -793,45 +793,45 @@ class RandomState: def negative_binomial(self, /, n: float, p: float, size: None = None) -> int: ... @overload # size: (int, ...) def negative_binomial( - self, /, n: _nt.CoFloating_nd, p: _nt.CoFloating_nd, size: _ShapeLike + self, /, n: _nt.CoFloating_nd, p: _nt.CoFloating_nd, size: _nt.ShapeLike ) -> _nt.Array[np.int_]: ... @overload # fallback def negative_binomial( - self, /, n: _nt.CoFloating_nd, p: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, n: _nt.CoFloating_nd, p: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> int | _nt.Array[np.int_]: ... # @overload # size: None (default) def poisson(self, /, lam: float = 1.0, size: None = None) -> int: ... @overload # size: (int, ...) (positional) - def poisson(self, /, lam: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.int_]: ... + def poisson(self, /, lam: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.int_]: ... @overload # size: (int, ...) (keyword) - def poisson(self, /, lam: _nt.CoFloating_nd = 1.0, *, size: _ShapeLike) -> _nt.Array[np.int_]: ... + def poisson(self, /, lam: _nt.CoFloating_nd = 1.0, *, size: _nt.ShapeLike) -> _nt.Array[np.int_]: ... @overload # fallback - def poisson(self, /, lam: _nt.CoFloating_nd = 1.0, size: _ShapeLike | None = None) -> int | _nt.Array[np.int_]: ... + def poisson(self, /, lam: _nt.CoFloating_nd = 1.0, size: _nt.ShapeLike | None = None) -> int | _nt.Array[np.int_]: ... # @overload # size: None (default) def zipf(self, /, a: float, size: None = None) -> int: ... @overload # size: (int, ...) - def zipf(self, /, a: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.int_]: ... + def zipf(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.int_]: ... @overload # fallback - def zipf(self, /, a: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> int | _nt.Array[np.int_]: ... + def zipf(self, /, a: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> int | _nt.Array[np.int_]: ... # @overload # size: None (default) def geometric(self, /, p: float, size: None = None) -> int: ... @overload # size: (int, ...) - def geometric(self, /, p: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.int_]: ... + def geometric(self, /, p: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.int_]: ... @overload # fallback - def geometric(self, /, p: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> int | _nt.Array[np.int_]: ... + def geometric(self, /, p: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> int | _nt.Array[np.int_]: ... # @overload # size: None (default) def hypergeometric(self, /, ngood: int, nbad: int, nsample: int, size: None = None) -> int: ... @overload # size: (int, ...) def hypergeometric( - self, /, ngood: _nt.CoInteger_nd, nbad: _nt.CoInteger_nd, nsample: _nt.CoInteger_nd, size: _ShapeLike + self, /, ngood: _nt.CoInteger_nd, nbad: _nt.CoInteger_nd, nsample: _nt.CoInteger_nd, size: _nt.ShapeLike ) -> _nt.Array[np.int_]: ... @overload # fallback def hypergeometric( @@ -840,16 +840,16 @@ class RandomState: ngood: _nt.CoInteger_nd, nbad: _nt.CoInteger_nd, nsample: _nt.CoInteger_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, ) -> int | _nt.Array[np.int_]: ... # @overload # size: None (default) def logseries(self, /, p: float, size: None = None) -> int: ... @overload # size: (int, ...) - def logseries(self, /, p: _nt.CoFloating_nd, size: _ShapeLike) -> _nt.Array[np.int_]: ... + def logseries(self, /, p: _nt.CoFloating_nd, size: _nt.ShapeLike) -> _nt.Array[np.int_]: ... @overload # fallback - def logseries(self, /, p: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> int | _nt.Array[np.int_]: ... + def logseries(self, /, p: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> int | _nt.Array[np.int_]: ... ### # multivariate @@ -860,17 +860,17 @@ class RandomState: /, mean: _nt.CoFloating_nd, cov: _nt.CoFloating_nd, - size: _ShapeLike | None = None, + size: _nt.ShapeLike | None = None, check_valid: Literal["warn", "raise", "ignore"] = "warn", tol: float = 1e-8, ) -> _nt.Array[np.float64]: ... # - def dirichlet(self, /, alpha: _nt.CoFloating_nd, size: _ShapeLike | None = None) -> _nt.Array[np.float64]: ... + def dirichlet(self, /, alpha: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None) -> _nt.Array[np.float64]: ... # def multinomial( - self, /, n: _nt.CoInteger_nd, pvals: _nt.CoFloating_nd, size: _ShapeLike | None = None + self, /, n: _nt.CoInteger_nd, pvals: _nt.CoFloating_nd, size: _nt.ShapeLike | None = None ) -> _nt.Array[np.int_]: ... ###