diff --git a/.libcst.codemod.yaml b/.libcst.codemod.yaml new file mode 100644 index 00000000..66114fd6 --- /dev/null +++ b/.libcst.codemod.yaml @@ -0,0 +1,11 @@ +generated_code_marker: "@generated" +formatter: + - "./.venv/bin/ruff" + - "format" + - "--stdin-filename=__generated__.pyi" + - "-" +blacklist_patterns: [] +modules: + - "libcst.codemod.commands" + - "tools.codemods" +repo_root: "." diff --git a/pyproject.toml b/pyproject.toml index b42a9056..be80634f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ dev = [ "ruff>=0.9.3", "basedmypy[faster-cache]>=2.9.1", "basedpyright>=1.24.0", + "libcst>=1.6.0", ] [tool.hatch.build.targets.sdist] @@ -67,13 +68,13 @@ strict = true disable_bytearray_promotion = true disable_memoryview_promotion = true enable_error_code = ["ignore-without-code", "truthy-bool"] +disable_error_code = ["explicit-override"] # TODO # basedmypy only warn_unreachable = false warn_unused_ignores = false disallow_any_explicit = false - [tool.pyright] include = ["src/numpy-stubs"] ignore = [".venv"] @@ -88,9 +89,9 @@ deprecateTypingAliases = true enableReachabilityAnalysis = false enableTypeIgnoreComments = false reportCallInDefaultInitializer = true -reportImplicitOverride = true +reportImplicitOverride = false # TODO reportImportCycles = true -reportMissingSuperCall = true +reportMissingSuperCall = false reportPrivateUsage = false reportPropertyTypeMismatch = false reportShadowedImports = true diff --git a/src/numpy-stubs/__init__.pyi b/src/numpy-stubs/__init__.pyi index 9f65abba..9d57e65a 100644 --- a/src/numpy-stubs/__init__.pyi +++ b/src/numpy-stubs/__init__.pyi @@ -1179,14 +1179,14 @@ test: Final[PytestTester] = ... @final class dtype(Generic[_SCT_co]): - names: None | tuple[builtins.str, ...] + names: tuple[builtins.str, ...] | None def __hash__(self) -> int: ... # `None` results in the default dtype @overload def __new__( cls, - dtype: None | type[float64], + dtype: type[float64] | None, align: builtins.bool = ..., copy: builtins.bool = ..., metadata: dict[builtins.str, Any] = ..., @@ -1236,7 +1236,7 @@ class dtype(Generic[_SCT_co]): @overload def __new__( cls, - dtype: None | type[float | float64 | int_ | np.bool], + dtype: type[float | float64 | int_ | np.bool] | None, align: builtins.bool = ..., copy: builtins.bool = ..., metadata: dict[str, Any] = ..., @@ -1762,7 +1762,7 @@ class dtype(Generic[_SCT_co]): @property def descr(self) -> list[tuple[LiteralString, LiteralString] | tuple[LiteralString, LiteralString, _Shape]]: ... @property - def fields(self) -> None | MappingProxyType[LiteralString, tuple[dtype[Any], int] | tuple[dtype[Any], int, Any]]: ... + def fields(self) -> MappingProxyType[LiteralString, tuple[dtype[Any], int] | tuple[dtype[Any], int, Any]] | None: ... @property def flags(self) -> int: ... @property @@ -1778,7 +1778,7 @@ class dtype(Generic[_SCT_co]): @property def kind(self) -> _DTypeKind: ... @property - def metadata(self) -> None | MappingProxyType[builtins.str, Any]: ... + def metadata(self) -> MappingProxyType[builtins.str, Any] | None: ... @property def name(self) -> LiteralString: ... @property @@ -1788,7 +1788,7 @@ class dtype(Generic[_SCT_co]): @property def ndim(self) -> int: ... @property - def subdtype(self) -> None | tuple[dtype[Any], _Shape]: ... + def subdtype(self) -> tuple[dtype[Any], _Shape] | None: ... def newbyteorder(self, new_order: _ByteOrder = ..., /) -> Self: ... @property def str(self) -> LiteralString: ... @@ -1860,7 +1860,7 @@ class _ArrayOrScalarCommon: def __int__(self, /) -> int: ... def __float__(self, /) -> float: ... def __copy__(self) -> Self: ... - def __deepcopy__(self, memo: None | dict[int, Any], /) -> Self: ... + def __deepcopy__(self, memo: dict[int, Any] | None, /) -> Self: ... # TODO: How to deal with the non-commutative nature of `==` and `!=`? # xref numpy/numpy#17368 @@ -1875,7 +1875,7 @@ class _ArrayOrScalarCommon: def tofile(self, fid: StrOrBytesPath | _SupportsFileMethods, sep: str = ..., format: str = ...) -> None: ... # generics and 0d arrays return builtin scalars def tolist(self) -> Any: ... - def to_device(self, device: L["cpu"], /, *, stream: None | int | Any = ...) -> Self: ... + def to_device(self, device: L["cpu"], /, *, stream: int | Any | None = ...) -> Self: ... @property def __array_interface__(self) -> dict[str, Any]: ... @property @@ -1898,11 +1898,11 @@ class _ArrayOrScalarCommon: def conjugate(self) -> Self: ... def argsort( self, - axis: None | SupportsIndex = ..., - kind: None | _SortKind = ..., - order: None | str | Sequence[str] = ..., + axis: SupportsIndex | None = ..., + kind: _SortKind | None = ..., + order: str | Sequence[str] | None = ..., *, - stable: None | bool = ..., + stable: bool | None = ..., ) -> NDArray[Any]: ... @overload # axis=None (default), out=None (default), keepdims=False (default) def argmax(self, /, axis: None = None, out: None = None, *, keepdims: L[False] = False) -> intp: ... @@ -2208,7 +2208,7 @@ class _ArrayOrScalarCommon: class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): __hash__: ClassVar[None] # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride] @property - def base(self) -> None | NDArray[Any]: ... + def base(self) -> NDArray[Any] | None: ... @property def ndim(self) -> int: ... @property @@ -2225,9 +2225,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): cls, shape: _ShapeLike, dtype: DTypeLike = ..., - buffer: None | _SupportsBuffer = ..., + buffer: _SupportsBuffer | None = ..., offset: SupportsIndex = ..., - strides: None | _ShapeLike = ..., + strides: _ShapeLike | None = ..., order: _OrderKACF = ..., ) -> Self: ... @@ -2236,9 +2236,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... @overload - def __array__(self, dtype: None = ..., /, *, copy: None | bool = ...) -> ndarray[_ShapeT_co, _DType_co]: ... + def __array__(self, dtype: None = ..., /, *, copy: bool | None = ...) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __array__(self, dtype: _DType, /, *, copy: None | bool = ...) -> ndarray[_ShapeT_co, _DType]: ... + def __array__(self, dtype: _DType, /, *, copy: bool | None = ...) -> ndarray[_ShapeT_co, _DType]: ... def __array_ufunc__( self, ufunc: ufunc, @@ -2257,11 +2257,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): # NOTE: In practice any object is accepted by `obj`, but as `__array_finalize__` # is a pseudo-abstract method the type has been narrowed down in order to # grant subclasses a bit more flexibility - def __array_finalize__(self, obj: None | NDArray[Any], /) -> None: ... + def __array_finalize__(self, obj: NDArray[Any] | None, /) -> None: ... def __array_wrap__( self, array: ndarray[_ShapeT, _DType], - context: None | tuple[ufunc, tuple[Any, ...], int] = ..., + context: tuple[ufunc, tuple[Any, ...], int] | None = ..., return_scalar: builtins.bool = ..., /, ) -> ndarray[_ShapeT, _DType]: ... @@ -2364,7 +2364,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): def setflags(self, write: builtins.bool = ..., align: builtins.bool = ..., uic: builtins.bool = ...) -> None: ... def squeeze( self, - axis: None | SupportsIndex | tuple[SupportsIndex, ...] = ..., + axis: SupportsIndex | tuple[SupportsIndex, ...] | None = ..., ) -> ndarray[_Shape, _DType_co]: ... def swapaxes( self, @@ -2372,7 +2372,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): axis2: SupportsIndex, ) -> ndarray[_Shape, _DType_co]: ... @overload - def transpose(self, axes: None | _ShapeLike, /) -> Self: ... + def transpose(self, axes: _ShapeLike | None, /) -> Self: ... @overload def transpose(self, *axes: SupportsIndex) -> Self: ... @overload @@ -2382,7 +2382,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def all( self, - axis: None | int | tuple[int, ...] = None, + axis: int | tuple[int, ...] | None = None, out: None = None, keepdims: SupportsIndex = False, *, @@ -2391,7 +2391,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def all( self, - axis: None | int | tuple[int, ...], + axis: int | tuple[int, ...] | None, out: _ArrayT, keepdims: SupportsIndex = False, *, @@ -2400,7 +2400,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def all( self, - axis: None | int | tuple[int, ...] = None, + axis: int | tuple[int, ...] | None = None, *, out: _ArrayT, keepdims: SupportsIndex = False, @@ -2413,7 +2413,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def any( self, - axis: None | int | tuple[int, ...] = None, + axis: int | tuple[int, ...] | None = None, out: None = None, keepdims: SupportsIndex = False, *, @@ -2422,7 +2422,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def any( self, - axis: None | int | tuple[int, ...], + axis: int | tuple[int, ...] | None, out: _ArrayT, keepdims: SupportsIndex = False, *, @@ -2431,7 +2431,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def any( self, - axis: None | int | tuple[int, ...] = None, + axis: int | tuple[int, ...] | None = None, *, out: _ArrayT, keepdims: SupportsIndex = False, @@ -2440,9 +2440,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): def argpartition( self, kth: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., kind: _PartitionKind = ..., - order: None | str | Sequence[str] = ..., + order: str | Sequence[str] | None = ..., ) -> NDArray[intp]: ... def diagonal( self, @@ -2467,7 +2467,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): kth: _ArrayLikeInt_co, axis: SupportsIndex = ..., kind: _PartitionKind = ..., - order: None | str | Sequence[str] = ..., + order: str | Sequence[str] | None = ..., ) -> None: ... # `put` is technically available to `generic`, @@ -2483,14 +2483,14 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): self, # >= 1D array v: _ScalarLike_co, # 0D array-like side: _SortSide = ..., - sorter: None | _ArrayLikeInt_co = ..., + sorter: _ArrayLikeInt_co | None = ..., ) -> intp: ... @overload def searchsorted( self, # >= 1D array v: ArrayLike, side: _SortSide = ..., - sorter: None | _ArrayLikeInt_co = ..., + sorter: _ArrayLikeInt_co | None = ..., ) -> NDArray[intp]: ... def setfield( self, @@ -2501,10 +2501,10 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): def sort( self, axis: SupportsIndex = ..., - kind: None | _SortKind = ..., - order: None | str | Sequence[str] = ..., + kind: _SortKind | None = ..., + order: str | Sequence[str] | None = ..., *, - stable: None | bool = ..., + stable: bool | None = ..., ) -> None: ... @overload def trace( @@ -2528,7 +2528,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): def take( # type: ignore[misc] self: NDArray[_SCT], indices: _IntLike_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., mode: _ModeKind = ..., ) -> _SCT: ... @@ -2536,7 +2536,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): def take( # type: ignore[misc] self, indices: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., mode: _ModeKind = ..., ) -> ndarray[_Shape, _DType_co]: ... @@ -2544,14 +2544,14 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): def take( self, indices: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: _ArrayT = ..., mode: _ModeKind = ..., ) -> _ArrayT: ... def repeat( self, repeats: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., ) -> ndarray[_Shape, _DType_co]: ... def flatten(self, /, order: _OrderKACF = "C") -> ndarray[tuple[int], _DType_co]: ... def ravel(self, /, order: _OrderKACF = "C") -> ndarray[tuple[int], _DType_co]: ... @@ -3711,7 +3711,7 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): def take( # type: ignore[misc] self, indices: _IntLike_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., mode: _ModeKind = ..., ) -> Self: ... @@ -3719,7 +3719,7 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): def take( # type: ignore[misc] self, indices: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., mode: _ModeKind = ..., ) -> NDArray[Self]: ... @@ -3727,11 +3727,11 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): def take( self, indices: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: _ArrayT = ..., mode: _ModeKind = ..., ) -> _ArrayT: ... - def repeat(self, repeats: _ArrayLikeInt_co, axis: None | SupportsIndex = ...) -> NDArray[Self]: ... + def repeat(self, repeats: _ArrayLikeInt_co, axis: SupportsIndex | None = ...) -> NDArray[Self]: ... def flatten(self, /, order: _OrderKACF = "C") -> ndarray[tuple[int], dtype[Self]]: ... def ravel(self, /, order: _OrderKACF = "C") -> ndarray[tuple[int], dtype[Self]]: ... @overload # (() | []) @@ -3816,8 +3816,8 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): order: _OrderACF = "C", copy: builtins.bool | None = None, ) -> ndarray[tuple[L[1], L[1], L[1], L[1], L[1], *tuple[L[1], ...]], dtype[Self]]: ... - def squeeze(self, axis: None | L[0] | tuple[()] = ...) -> Self: ... - def transpose(self, axes: None | tuple[()] = ..., /) -> Self: ... + def squeeze(self, axis: L[0] | tuple[()] | None = ...) -> Self: ... + def transpose(self, axes: tuple[()] | None = ..., /) -> Self: ... @overload def all( self, @@ -4726,7 +4726,7 @@ class ufunc: def identity(self) -> Any: ... # This is None for ufuncs and a string for gufuncs. @property - def signature(self) -> None | LiteralString: ... + def signature(self) -> LiteralString | None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... # The next four methods will always exist, but they will just # raise a ValueError ufuncs with that don't accept two input @@ -4861,18 +4861,18 @@ class errstate: self, *, call: _ErrCall = ..., - all: None | _ErrKind = ..., - divide: None | _ErrKind = ..., - over: None | _ErrKind = ..., - under: None | _ErrKind = ..., - invalid: None | _ErrKind = ..., + all: _ErrKind | None = ..., + divide: _ErrKind | None = ..., + over: _ErrKind | None = ..., + under: _ErrKind | None = ..., + invalid: _ErrKind | None = ..., ) -> None: ... def __enter__(self) -> None: ... def __exit__( self, - exc_type: None | type[BaseException], - exc_value: None | BaseException, - traceback: None | TracebackType, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, /, ) -> None: ... def __call__(self, func: _CallableT) -> _CallableT: ... @@ -5005,21 +5005,21 @@ class nditer: def __new__( cls, op: ArrayLike | Sequence[ArrayLike | None], - flags: None | Sequence[_NDIterFlagsKind] = ..., - op_flags: None | Sequence[Sequence[_NDIterFlagsOp]] = ..., + flags: Sequence[_NDIterFlagsKind] | None = ..., + op_flags: Sequence[Sequence[_NDIterFlagsOp]] | None = ..., op_dtypes: DTypeLike | Sequence[DTypeLike] = ..., order: _OrderKACF = ..., casting: _CastingKind = ..., - op_axes: None | Sequence[Sequence[SupportsIndex]] = ..., - itershape: None | _ShapeLike = ..., + op_axes: Sequence[Sequence[SupportsIndex]] | None = ..., + itershape: _ShapeLike | None = ..., buffersize: SupportsIndex = ..., ) -> nditer: ... def __enter__(self) -> nditer: ... def __exit__( self, - exc_type: None | type[BaseException], - exc_value: None | BaseException, - traceback: None | TracebackType, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, ) -> None: ... def __iter__(self) -> nditer: ... def __next__(self) -> tuple[NDArray[Any], ...]: ... @@ -5080,60 +5080,58 @@ class memmap(ndarray[_ShapeT_co, _DType_co]): mode: str @overload def __new__( - subtype, + cls, filename: StrOrBytesPath | _SupportsFileMethodsRW, dtype: type[uint8] = ..., mode: _MemMapModeKind = ..., offset: int = ..., - shape: None | int | tuple[int, ...] = ..., + shape: int | tuple[int, ...] | None = ..., order: _OrderKACF = ..., ) -> memmap[Any, dtype[uint8]]: ... @overload def __new__( - subtype, + cls, filename: StrOrBytesPath | _SupportsFileMethodsRW, dtype: _DTypeLike[_SCT], mode: _MemMapModeKind = ..., offset: int = ..., - shape: None | int | tuple[int, ...] = ..., + shape: int | tuple[int, ...] | None = ..., order: _OrderKACF = ..., ) -> memmap[Any, dtype[_SCT]]: ... @overload def __new__( - subtype, + cls, filename: StrOrBytesPath | _SupportsFileMethodsRW, dtype: DTypeLike, mode: _MemMapModeKind = ..., offset: int = ..., - shape: None | int | tuple[int, ...] = ..., + shape: int | tuple[int, ...] | None = ..., order: _OrderKACF = ..., ) -> memmap[Any, dtype[Any]]: ... def __array_finalize__(self, obj: object) -> None: ... def __array_wrap__( self, array: memmap[_ShapeT_co, _DType_co], - context: None | tuple[ufunc, tuple[Any, ...], int] = ..., + context: tuple[ufunc, tuple[Any, ...], int] | None = ..., return_scalar: builtins.bool = ..., ) -> Any: ... def flush(self) -> None: ... -# TODO: Add a mypy plugin for managing functions whose output type is dependent -# on the literal value of some sort of signature (e.g. `einsum` and `vectorize`) class vectorize: pyfunc: Callable[..., Any] cache: builtins.bool - signature: None | LiteralString - otypes: None | LiteralString + signature: LiteralString | None + otypes: LiteralString | None excluded: set[int | str] - __doc__: None | str + __doc__: str | None def __init__( self, pyfunc: Callable[..., Any], - otypes: None | str | Iterable[DTypeLike] = ..., - doc: None | str = ..., - excluded: None | Iterable[int | str] = ..., + otypes: str | Iterable[DTypeLike] | None = ..., + doc: str | None = ..., + excluded: Iterable[int | str] | None = ..., cache: builtins.bool = ..., - signature: None | str = ..., + signature: str | None = ..., ) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... @@ -5181,7 +5179,7 @@ class poly1d: self, c_or_r: ArrayLike, r: builtins.bool = ..., - variable: None | str = ..., + variable: str | None = ..., ) -> None: ... def __len__(self) -> int: ... def __neg__(self) -> poly1d: ... @@ -5204,13 +5202,13 @@ class poly1d: def integ( self, m: SupportsInt | SupportsIndex = ..., - k: None | _ArrayLikeComplex_co | _ArrayLikeObject_co = ..., + k: _ArrayLikeComplex_co | _ArrayLikeObject_co | None = ..., ) -> poly1d: ... class matrix(ndarray[_2DShapeT_co, _DType_co]): __array_priority__: ClassVar[float] def __new__( - subtype, + cls, data: ArrayLike, dtype: DTypeLike = ..., copy: builtins.bool = ..., @@ -5225,14 +5223,12 @@ class matrix(ndarray[_2DShapeT_co, _DType_co]): @overload def __getitem__( self, - key: ( - None - | slice - | EllipsisType - | SupportsIndex - | _ArrayLikeInt_co - | tuple[None | slice | EllipsisType | _ArrayLikeInt_co | SupportsIndex, ...] - ), + key: slice + | EllipsisType + | SupportsIndex + | _ArrayLikeInt_co + | tuple[slice | EllipsisType | _ArrayLikeInt_co | SupportsIndex | None, ...] + | None, /, ) -> matrix[_2D, _DType_co]: ... @overload @@ -5249,74 +5245,74 @@ class matrix(ndarray[_2DShapeT_co, _DType_co]): @overload def sum(self, axis: _ShapeLike, dtype: DTypeLike = ..., out: None = ...) -> matrix[_2D, Any]: ... @overload - def sum(self, axis: None | _ShapeLike = ..., dtype: DTypeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + def sum(self, axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... @overload def mean(self, axis: None = ..., dtype: DTypeLike = ..., out: None = ...) -> Any: ... @overload def mean(self, axis: _ShapeLike, dtype: DTypeLike = ..., out: None = ...) -> matrix[_2D, Any]: ... @overload - def mean(self, axis: None | _ShapeLike = ..., dtype: DTypeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + def mean(self, axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... @overload def std(self, axis: None = ..., dtype: DTypeLike = ..., out: None = ..., ddof: float = ...) -> Any: ... @overload def std(self, axis: _ShapeLike, dtype: DTypeLike = ..., out: None = ..., ddof: float = ...) -> matrix[_2D, Any]: ... @overload - def std(self, axis: None | _ShapeLike = ..., dtype: DTypeLike = ..., out: _ArrayT = ..., ddof: float = ...) -> _ArrayT: ... + def std(self, axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayT = ..., ddof: float = ...) -> _ArrayT: ... @overload def var(self, axis: None = ..., dtype: DTypeLike = ..., out: None = ..., ddof: float = ...) -> Any: ... @overload def var(self, axis: _ShapeLike, dtype: DTypeLike = ..., out: None = ..., ddof: float = ...) -> matrix[_2D, Any]: ... @overload - def var(self, axis: None | _ShapeLike = ..., dtype: DTypeLike = ..., out: _ArrayT = ..., ddof: float = ...) -> _ArrayT: ... + def var(self, axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayT = ..., ddof: float = ...) -> _ArrayT: ... @overload def prod(self, axis: None = ..., dtype: DTypeLike = ..., out: None = ...) -> Any: ... @overload def prod(self, axis: _ShapeLike, dtype: DTypeLike = ..., out: None = ...) -> matrix[_2D, Any]: ... @overload - def prod(self, axis: None | _ShapeLike = ..., dtype: DTypeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + def prod(self, axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... @overload def any(self, axis: None = ..., out: None = ...) -> np.bool: ... @overload def any(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, dtype[np.bool]]: ... @overload - def any(self, axis: None | _ShapeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + def any(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... @overload def all(self, axis: None = ..., out: None = ...) -> np.bool: ... @overload def all(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, dtype[np.bool]]: ... @overload - def all(self, axis: None | _ShapeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + def all(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... @overload def max(self: NDArray[_SCT], axis: None = ..., out: None = ...) -> _SCT: ... @overload def max(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, _DType_co]: ... @overload - def max(self, axis: None | _ShapeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + def max(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... @overload def min(self: NDArray[_SCT], axis: None = ..., out: None = ...) -> _SCT: ... @overload def min(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, _DType_co]: ... @overload - def min(self, axis: None | _ShapeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + def min(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... @overload def argmax(self: NDArray[_SCT], axis: None = ..., out: None = ...) -> intp: ... @overload def argmax(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, dtype[intp]]: ... @overload - def argmax(self, axis: None | _ShapeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + def argmax(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... @overload def argmin(self: NDArray[_SCT], axis: None = ..., out: None = ...) -> intp: ... @overload def argmin(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, dtype[intp]]: ... @overload - def argmin(self, axis: None | _ShapeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + def argmin(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... @overload def ptp(self: NDArray[_SCT], axis: None = ..., out: None = ...) -> _SCT: ... @overload def ptp(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, _DType_co]: ... @overload - def ptp(self, axis: None | _ShapeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... - def squeeze(self, axis: None | _ShapeLike = ...) -> matrix[_2D, _DType_co]: ... + def ptp(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... + def squeeze(self, axis: _ShapeLike | None = ...) -> matrix[_2D, _DType_co]: ... def tolist(self: _SupportsItem[_T]) -> list[list[_T]]: ... def ravel(self, /, order: _OrderKACF = "C") -> matrix[tuple[L[1], int], _DType_co]: ... # pyright: ignore[reportIncompatibleMethodOverride] def flatten(self, /, order: _OrderKACF = "C") -> matrix[tuple[L[1], int], _DType_co]: ... # pyright: ignore[reportIncompatibleMethodOverride] diff --git a/src/numpy-stubs/_array_api_info.pyi b/src/numpy-stubs/_array_api_info.pyi index c1ec7f48..a04b6e6b 100644 --- a/src/numpy-stubs/_array_api_info.pyi +++ b/src/numpy-stubs/_array_api_info.pyi @@ -13,7 +13,7 @@ from typing import ( import numpy as np _Device: TypeAlias = Literal["cpu"] -_DeviceLike: TypeAlias = None | _Device +_DeviceLike: TypeAlias = _Device | None _Capabilities = TypedDict( "_Capabilities", diff --git a/src/numpy-stubs/_core/_asarray.pyi b/src/numpy-stubs/_core/_asarray.pyi index e433ba02..0a667a7d 100644 --- a/src/numpy-stubs/_core/_asarray.pyi +++ b/src/numpy-stubs/_core/_asarray.pyi @@ -15,7 +15,7 @@ _RequirementsWithE: TypeAlias = _Requirements | _E def require( a: _ArrayType, dtype: None = ..., - requirements: None | _Requirements | Iterable[_Requirements] = ..., + requirements: _Requirements | Iterable[_Requirements] | None = ..., *, like: _SupportsArrayFunc = ..., ) -> _ArrayType: ... @@ -27,7 +27,7 @@ def require( def require( a: object, dtype: DTypeLike = ..., - requirements: None | _Requirements | Iterable[_Requirements] = ..., + requirements: _Requirements | Iterable[_Requirements] | None = ..., *, like: _SupportsArrayFunc = ..., ) -> NDArray[Any]: ... diff --git a/src/numpy-stubs/_core/_ufunc_config.pyi b/src/numpy-stubs/_core/_ufunc_config.pyi index 3ec1f620..86df9827 100644 --- a/src/numpy-stubs/_core/_ufunc_config.pyi +++ b/src/numpy-stubs/_core/_ufunc_config.pyi @@ -16,11 +16,11 @@ class _ErrDict(TypedDict): invalid: _ErrKind def seterr( - all: None | _ErrKind = ..., - divide: None | _ErrKind = ..., - over: None | _ErrKind = ..., - under: None | _ErrKind = ..., - invalid: None | _ErrKind = ..., + all: _ErrKind | None = ..., + divide: _ErrKind | None = ..., + over: _ErrKind | None = ..., + under: _ErrKind | None = ..., + invalid: _ErrKind | None = ..., ) -> _ErrDict: ... def geterr() -> _ErrDict: ... def setbufsize(size: int) -> int: ... diff --git a/src/numpy-stubs/_core/arrayprint.pyi b/src/numpy-stubs/_core/arrayprint.pyi index 3fb63ba6..f2d4bd8c 100644 --- a/src/numpy-stubs/_core/arrayprint.pyi +++ b/src/numpy-stubs/_core/arrayprint.pyi @@ -48,90 +48,90 @@ class _FormatOptions(TypedDict): suppress: bool nanstr: str infstr: str - formatter: None | _FormatDict + formatter: _FormatDict | None sign: Literal["-", "+", " "] floatmode: _FloatMode legacy: Literal[False, "1.13", "1.21"] def set_printoptions( - precision: None | SupportsIndex = ..., - threshold: None | int = ..., - edgeitems: None | int = ..., - linewidth: None | int = ..., - suppress: None | bool = ..., - nanstr: None | str = ..., - infstr: None | str = ..., - formatter: None | _FormatDict = ..., + precision: SupportsIndex | None = ..., + threshold: int | None = ..., + edgeitems: int | None = ..., + linewidth: int | None = ..., + suppress: bool | None = ..., + nanstr: str | None = ..., + infstr: str | None = ..., + formatter: _FormatDict | None = ..., sign: Literal["-", "+", " "] | None = ..., - floatmode: None | _FloatMode = ..., + floatmode: _FloatMode | None = ..., *, legacy: Literal[False, "1.13", "1.21"] | None = ..., - override_repr: None | Callable[[NDArray[Any]], str] = ..., + override_repr: Callable[[NDArray[Any]], str] | None = ..., ) -> None: ... def get_printoptions() -> _FormatOptions: ... def array2string( a: NDArray[Any], - max_line_width: None | int = ..., - precision: None | SupportsIndex = ..., - suppress_small: None | bool = ..., + max_line_width: int | None = ..., + precision: SupportsIndex | None = ..., + suppress_small: bool | None = ..., separator: str = ..., prefix: str = ..., # NOTE: With the `style` argument being deprecated, # all arguments between `formatter` and `suffix` are de facto # keyworld-only arguments *, - formatter: None | _FormatDict = ..., - threshold: None | int = ..., - edgeitems: None | int = ..., + formatter: _FormatDict | None = ..., + threshold: int | None = ..., + edgeitems: int | None = ..., sign: Literal["-", "+", " "] | None = ..., - floatmode: None | _FloatMode = ..., + floatmode: _FloatMode | None = ..., suffix: str = ..., legacy: Literal[False, "1.13", "1.21"] | None = ..., ) -> str: ... def format_float_scientific( x: _FloatLike_co, - precision: None | int = ..., + precision: int | None = ..., unique: bool = ..., trim: Literal["k", ".", "0", "-"] = ..., sign: bool = ..., - pad_left: None | int = ..., - exp_digits: None | int = ..., - min_digits: None | int = ..., + pad_left: int | None = ..., + exp_digits: int | None = ..., + min_digits: int | None = ..., ) -> str: ... def format_float_positional( x: _FloatLike_co, - precision: None | int = ..., + precision: int | None = ..., unique: bool = ..., fractional: bool = ..., trim: Literal["k", ".", "0", "-"] = ..., sign: bool = ..., - pad_left: None | int = ..., - pad_right: None | int = ..., - min_digits: None | int = ..., + pad_left: int | None = ..., + pad_right: int | None = ..., + min_digits: int | None = ..., ) -> str: ... def array_repr( arr: NDArray[Any], - max_line_width: None | int = ..., - precision: None | SupportsIndex = ..., - suppress_small: None | bool = ..., + max_line_width: int | None = ..., + precision: SupportsIndex | None = ..., + suppress_small: bool | None = ..., ) -> str: ... def array_str( a: NDArray[Any], - max_line_width: None | int = ..., - precision: None | SupportsIndex = ..., - suppress_small: None | bool = ..., + max_line_width: int | None = ..., + precision: SupportsIndex | None = ..., + suppress_small: bool | None = ..., ) -> str: ... def printoptions( - precision: None | SupportsIndex = ..., - threshold: None | int = ..., - edgeitems: None | int = ..., - linewidth: None | int = ..., - suppress: None | bool = ..., - nanstr: None | str = ..., - infstr: None | str = ..., - formatter: None | _FormatDict = ..., + precision: SupportsIndex | None = ..., + threshold: int | None = ..., + edgeitems: int | None = ..., + linewidth: int | None = ..., + suppress: bool | None = ..., + nanstr: str | None = ..., + infstr: str | None = ..., + formatter: _FormatDict | None = ..., sign: Literal["-", "+", " "] | None = ..., - floatmode: None | _FloatMode = ..., + floatmode: _FloatMode | None = ..., *, legacy: Literal[False, "1.13", "1.21"] | None = ..., ) -> _GeneratorContextManager[_FormatOptions]: ... diff --git a/src/numpy-stubs/_core/defchararray.pyi b/src/numpy-stubs/_core/defchararray.pyi index 99d53413..697c8136 100644 --- a/src/numpy-stubs/_core/defchararray.pyi +++ b/src/numpy-stubs/_core/defchararray.pyi @@ -91,7 +91,7 @@ _StringDTypeOrUnicodeArray: TypeAlias = np.ndarray[_Shape, np.dtype[np.str_]] | class chararray(ndarray[_ShapeT_co, _CharDType_co]): @overload def __new__( - subtype, + cls, shape: _ShapeLike, itemsize: SupportsIndex | SupportsInt = ..., unicode: L[False] = ..., @@ -102,7 +102,7 @@ class chararray(ndarray[_ShapeT_co, _CharDType_co]): ) -> chararray[_Shape, dtype[bytes_]]: ... @overload def __new__( - subtype, + cls, shape: _ShapeLike, itemsize: SupportsIndex | SupportsInt = ..., unicode: L[True] = ..., @@ -212,38 +212,38 @@ class chararray(ndarray[_ShapeT_co, _CharDType_co]): self: _CharArray[str_], sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def count( self: _CharArray[bytes_], sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... def decode( self: _CharArray[bytes_], - encoding: None | str = ..., - errors: None | str = ..., + encoding: str | None = ..., + errors: str | None = ..., ) -> _CharArray[str_]: ... def encode( self: _CharArray[str_], - encoding: None | str = ..., - errors: None | str = ..., + encoding: str | None = ..., + errors: str | None = ..., ) -> _CharArray[bytes_]: ... @overload def endswith( self: _CharArray[str_], suffix: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.bool]: ... @overload def endswith( self: _CharArray[bytes_], suffix: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.bool]: ... def expandtabs( self, @@ -254,28 +254,28 @@ class chararray(ndarray[_ShapeT_co, _CharDType_co]): self: _CharArray[str_], sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def find( self: _CharArray[bytes_], sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def index( self: _CharArray[str_], sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def index( self: _CharArray[bytes_], sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def join( @@ -302,12 +302,12 @@ class chararray(ndarray[_ShapeT_co, _CharDType_co]): @overload def lstrip( self: _CharArray[str_], - chars: None | U_co = ..., + chars: U_co | None = ..., ) -> _CharArray[str_]: ... @overload def lstrip( self: _CharArray[bytes_], - chars: None | S_co = ..., + chars: S_co | None = ..., ) -> _CharArray[bytes_]: ... @overload def partition( @@ -324,42 +324,42 @@ class chararray(ndarray[_ShapeT_co, _CharDType_co]): self: _CharArray[str_], old: U_co, new: U_co, - count: None | i_co = ..., + count: i_co | None = ..., ) -> _CharArray[str_]: ... @overload def replace( self: _CharArray[bytes_], old: S_co, new: S_co, - count: None | i_co = ..., + count: i_co | None = ..., ) -> _CharArray[bytes_]: ... @overload def rfind( self: _CharArray[str_], sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def rfind( self: _CharArray[bytes_], sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def rindex( self: _CharArray[str_], sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def rindex( self: _CharArray[bytes_], sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def rjust( @@ -386,73 +386,73 @@ class chararray(ndarray[_ShapeT_co, _CharDType_co]): @overload def rsplit( self: _CharArray[str_], - sep: None | U_co = ..., - maxsplit: None | i_co = ..., + sep: U_co | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... @overload def rsplit( self: _CharArray[bytes_], - sep: None | S_co = ..., - maxsplit: None | i_co = ..., + sep: S_co | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... @overload def rstrip( self: _CharArray[str_], - chars: None | U_co = ..., + chars: U_co | None = ..., ) -> _CharArray[str_]: ... @overload def rstrip( self: _CharArray[bytes_], - chars: None | S_co = ..., + chars: S_co | None = ..., ) -> _CharArray[bytes_]: ... @overload def split( self: _CharArray[str_], - sep: None | U_co = ..., - maxsplit: None | i_co = ..., + sep: U_co | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... @overload def split( self: _CharArray[bytes_], - sep: None | S_co = ..., - maxsplit: None | i_co = ..., + sep: S_co | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... - def splitlines(self, keepends: None | b_co = ...) -> NDArray[object_]: ... + def splitlines(self, keepends: b_co | None = ...) -> NDArray[object_]: ... @overload def startswith( self: _CharArray[str_], prefix: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.bool]: ... @overload def startswith( self: _CharArray[bytes_], prefix: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.bool]: ... @overload def strip( self: _CharArray[str_], - chars: None | U_co = ..., + chars: U_co | None = ..., ) -> _CharArray[str_]: ... @overload def strip( self: _CharArray[bytes_], - chars: None | S_co = ..., + chars: S_co | None = ..., ) -> _CharArray[bytes_]: ... @overload def translate( self: _CharArray[str_], table: U_co, - deletechars: None | U_co = ..., + deletechars: U_co | None = ..., ) -> _CharArray[str_]: ... @overload def translate( self: _CharArray[bytes_], table: S_co, - deletechars: None | S_co = ..., + deletechars: S_co | None = ..., ) -> _CharArray[bytes_]: ... def zfill(self, width: i_co) -> chararray[_Shape, _CharDType_co]: ... def capitalize(self) -> chararray[_ShapeT_co, _CharDType_co]: ... @@ -514,7 +514,7 @@ def add(x1: S_co, x2: S_co) -> NDArray[np.bytes_]: ... @overload def add(x1: _StringDTypeSupportsArray, x2: _StringDTypeSupportsArray) -> _StringDTypeArray: ... @overload -def add(x1: T_co, T_co) -> _StringDTypeOrUnicodeArray: ... +def add(x1: T_co, x2: T_co) -> _StringDTypeOrUnicodeArray: ... @overload def multiply(a: U_co, i: i_co) -> NDArray[np.str_]: ... @overload @@ -549,13 +549,13 @@ def center(a: _StringDTypeSupportsArray, width: i_co, fillchar: _StringDTypeSupp def center(a: T_co, width: i_co, fillchar: T_co = ...) -> _StringDTypeOrUnicodeArray: ... def decode( a: S_co, - encoding: None | str = ..., - errors: None | str = ..., + encoding: str | None = ..., + errors: str | None = ..., ) -> NDArray[str_]: ... def encode( a: U_co | T_co, - encoding: None | str = ..., - errors: None | str = ..., + encoding: str | None = ..., + errors: str | None = ..., ) -> NDArray[bytes_]: ... @overload def expandtabs(a: U_co, tabsize: i_co = ...) -> NDArray[str_]: ... @@ -590,13 +590,13 @@ def lower(a: _StringDTypeSupportsArray) -> _StringDTypeArray: ... @overload def lower(a: T_co) -> _StringDTypeOrUnicodeArray: ... @overload -def lstrip(a: U_co, chars: None | U_co = ...) -> NDArray[str_]: ... +def lstrip(a: U_co, chars: U_co | None = ...) -> NDArray[str_]: ... @overload -def lstrip(a: S_co, chars: None | S_co = ...) -> NDArray[bytes_]: ... +def lstrip(a: S_co, chars: S_co | None = ...) -> NDArray[bytes_]: ... @overload -def lstrip(a: _StringDTypeSupportsArray, chars: None | _StringDTypeSupportsArray = ...) -> _StringDTypeArray: ... +def lstrip(a: _StringDTypeSupportsArray, chars: _StringDTypeSupportsArray | None = ...) -> _StringDTypeArray: ... @overload -def lstrip(a: T_co, chars: None | T_co = ...) -> _StringDTypeOrUnicodeArray: ... +def lstrip(a: T_co, chars: T_co | None = ...) -> _StringDTypeOrUnicodeArray: ... @overload def partition(a: U_co, sep: U_co) -> NDArray[str_]: ... @overload @@ -610,14 +610,14 @@ def replace( a: U_co, old: U_co, new: U_co, - count: None | i_co = ..., + count: i_co | None = ..., ) -> NDArray[str_]: ... @overload def replace( a: S_co, old: S_co, new: S_co, - count: None | i_co = ..., + count: i_co | None = ..., ) -> NDArray[bytes_]: ... @overload def replace( @@ -668,68 +668,68 @@ def rpartition(a: T_co, sep: T_co) -> _StringDTypeOrUnicodeArray: ... @overload def rsplit( a: U_co, - sep: None | U_co = ..., - maxsplit: None | i_co = ..., + sep: U_co | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... @overload def rsplit( a: S_co, - sep: None | S_co = ..., - maxsplit: None | i_co = ..., + sep: S_co | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... @overload def rsplit( a: _StringDTypeSupportsArray, - sep: None | _StringDTypeSupportsArray = ..., - maxsplit: None | i_co = ..., + sep: _StringDTypeSupportsArray | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... @overload def rsplit( a: T_co, - sep: None | T_co = ..., - maxsplit: None | i_co = ..., + sep: T_co | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... @overload -def rstrip(a: U_co, chars: None | U_co = ...) -> NDArray[str_]: ... +def rstrip(a: U_co, chars: U_co | None = ...) -> NDArray[str_]: ... @overload -def rstrip(a: S_co, chars: None | S_co = ...) -> NDArray[bytes_]: ... +def rstrip(a: S_co, chars: S_co | None = ...) -> NDArray[bytes_]: ... @overload -def rstrip(a: _StringDTypeSupportsArray, chars: None | _StringDTypeSupportsArray = ...) -> _StringDTypeArray: ... +def rstrip(a: _StringDTypeSupportsArray, chars: _StringDTypeSupportsArray | None = ...) -> _StringDTypeArray: ... @overload -def rstrip(a: T_co, chars: None | T_co = ...) -> _StringDTypeOrUnicodeArray: ... +def rstrip(a: T_co, chars: T_co | None = ...) -> _StringDTypeOrUnicodeArray: ... @overload def split( a: U_co, - sep: None | U_co = ..., - maxsplit: None | i_co = ..., + sep: U_co | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... @overload def split( a: S_co, - sep: None | S_co = ..., - maxsplit: None | i_co = ..., + sep: S_co | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... @overload def split( a: _StringDTypeSupportsArray, - sep: None | _StringDTypeSupportsArray = ..., - maxsplit: None | i_co = ..., + sep: _StringDTypeSupportsArray | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... @overload def split( a: T_co, - sep: None | T_co = ..., - maxsplit: None | i_co = ..., + sep: T_co | None = ..., + maxsplit: i_co | None = ..., ) -> NDArray[object_]: ... -def splitlines(a: UST_co, keepends: None | b_co = ...) -> NDArray[np.object_]: ... +def splitlines(a: UST_co, keepends: b_co | None = ...) -> NDArray[np.object_]: ... @overload -def strip(a: U_co, chars: None | U_co = ...) -> NDArray[str_]: ... +def strip(a: U_co, chars: U_co | None = ...) -> NDArray[str_]: ... @overload -def strip(a: S_co, chars: None | S_co = ...) -> NDArray[bytes_]: ... +def strip(a: S_co, chars: S_co | None = ...) -> NDArray[bytes_]: ... @overload -def strip(a: _StringDTypeSupportsArray, chars: None | _StringDTypeSupportsArray = ...) -> _StringDTypeArray: ... +def strip(a: _StringDTypeSupportsArray, chars: _StringDTypeSupportsArray | None = ...) -> _StringDTypeArray: ... @overload -def strip(a: T_co, chars: None | T_co = ...) -> _StringDTypeOrUnicodeArray: ... +def strip(a: T_co, chars: T_co | None = ...) -> _StringDTypeOrUnicodeArray: ... @overload def swapcase(a: U_co) -> NDArray[str_]: ... @overload @@ -750,25 +750,25 @@ def title(a: T_co) -> _StringDTypeOrUnicodeArray: ... def translate( a: U_co, table: str, - deletechars: None | str = ..., + deletechars: str | None = ..., ) -> NDArray[str_]: ... @overload def translate( a: S_co, table: str, - deletechars: None | str = ..., + deletechars: str | None = ..., ) -> NDArray[bytes_]: ... @overload def translate( a: _StringDTypeSupportsArray, table: str, - deletechars: None | str = ..., + deletechars: str | None = ..., ) -> _StringDTypeArray: ... @overload def translate( a: T_co, table: str, - deletechars: None | str = ..., + deletechars: str | None = ..., ) -> _StringDTypeOrUnicodeArray: ... @overload def upper(a: U_co) -> NDArray[str_]: ... @@ -793,14 +793,14 @@ def count( a: U_co, sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def count( a: S_co, sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def count( @@ -814,14 +814,14 @@ def endswith( a: U_co, suffix: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.bool]: ... @overload def endswith( a: S_co, suffix: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.bool]: ... @overload def endswith( @@ -835,14 +835,14 @@ def find( a: U_co, sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def find( a: S_co, sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def find( @@ -856,14 +856,14 @@ def index( a: U_co, sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def index( a: S_co, sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def index( @@ -886,14 +886,14 @@ def rfind( a: U_co, sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def rfind( a: S_co, sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def rfind( @@ -907,14 +907,14 @@ def rindex( a: U_co, sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def rindex( a: S_co, sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[int_]: ... @overload def rindex( @@ -928,14 +928,14 @@ def startswith( a: U_co, prefix: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.bool]: ... @overload def startswith( a: S_co, prefix: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.bool]: ... @overload def startswith( @@ -952,7 +952,7 @@ def str_len(A: UST_co) -> NDArray[int_]: ... @overload def array( obj: U_co, - itemsize: None | int = ..., + itemsize: int | None = ..., copy: bool = ..., unicode: L[False] = ..., order: _OrderKACF = ..., @@ -960,7 +960,7 @@ def array( @overload def array( obj: S_co, - itemsize: None | int = ..., + itemsize: int | None = ..., copy: bool = ..., unicode: L[False] = ..., order: _OrderKACF = ..., @@ -968,7 +968,7 @@ def array( @overload def array( obj: object, - itemsize: None | int = ..., + itemsize: int | None = ..., copy: bool = ..., unicode: L[False] = ..., order: _OrderKACF = ..., @@ -976,7 +976,7 @@ def array( @overload def array( obj: object, - itemsize: None | int = ..., + itemsize: int | None = ..., copy: bool = ..., unicode: L[True] = ..., order: _OrderKACF = ..., @@ -984,28 +984,28 @@ def array( @overload def asarray( obj: U_co, - itemsize: None | int = ..., + itemsize: int | None = ..., unicode: L[False] = ..., order: _OrderKACF = ..., ) -> _CharArray[str_]: ... @overload def asarray( obj: S_co, - itemsize: None | int = ..., + itemsize: int | None = ..., unicode: L[False] = ..., order: _OrderKACF = ..., ) -> _CharArray[bytes_]: ... @overload def asarray( obj: object, - itemsize: None | int = ..., + itemsize: int | None = ..., unicode: L[False] = ..., order: _OrderKACF = ..., ) -> _CharArray[bytes_]: ... @overload def asarray( obj: object, - itemsize: None | int = ..., + itemsize: int | None = ..., unicode: L[True] = ..., order: _OrderKACF = ..., ) -> _CharArray[str_]: ... diff --git a/src/numpy-stubs/_core/einsumfunc.pyi b/src/numpy-stubs/_core/einsumfunc.pyi index 109b1399..344399ea 100644 --- a/src/numpy-stubs/_core/einsumfunc.pyi +++ b/src/numpy-stubs/_core/einsumfunc.pyi @@ -43,7 +43,7 @@ def einsum( /, *operands: _ArrayLikeBool_co, out: None = ..., - dtype: None | _DTypeLikeBool = ..., + dtype: _DTypeLikeBool | None = ..., order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., @@ -54,7 +54,7 @@ def einsum( /, *operands: _ArrayLikeUInt_co, out: None = ..., - dtype: None | _DTypeLikeUInt = ..., + dtype: _DTypeLikeUInt | None = ..., order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., @@ -65,7 +65,7 @@ def einsum( /, *operands: _ArrayLikeInt_co, out: None = ..., - dtype: None | _DTypeLikeInt = ..., + dtype: _DTypeLikeInt | None = ..., order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., @@ -76,7 +76,7 @@ def einsum( /, *operands: _ArrayLikeFloat_co, out: None = ..., - dtype: None | _DTypeLikeFloat = ..., + dtype: _DTypeLikeFloat | None = ..., order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., @@ -87,7 +87,7 @@ def einsum( /, *operands: _ArrayLikeComplex_co, out: None = ..., - dtype: None | _DTypeLikeComplex = ..., + dtype: _DTypeLikeComplex | None = ..., order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., @@ -98,7 +98,7 @@ def einsum( /, *operands: Any, casting: _CastingUnsafe, - dtype: None | _DTypeLikeComplex_co = ..., + dtype: _DTypeLikeComplex_co | None = ..., out: None = ..., order: _OrderKACF = ..., optimize: _OptimizeKind = ..., @@ -109,7 +109,7 @@ def einsum( /, *operands: _ArrayLikeComplex_co, out: _ArrayType, - dtype: None | _DTypeLikeComplex_co = ..., + dtype: _DTypeLikeComplex_co | None = ..., order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., @@ -121,7 +121,7 @@ def einsum( *operands: Any, out: _ArrayType, casting: _CastingUnsafe, - dtype: None | _DTypeLikeComplex_co = ..., + dtype: _DTypeLikeComplex_co | None = ..., order: _OrderKACF = ..., optimize: _OptimizeKind = ..., ) -> _ArrayType: ... @@ -131,7 +131,7 @@ def einsum( /, *operands: _ArrayLikeObject_co, out: None = ..., - dtype: None | _DTypeLikeObject = ..., + dtype: _DTypeLikeObject | None = ..., order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., @@ -142,7 +142,7 @@ def einsum( /, *operands: Any, casting: _CastingUnsafe, - dtype: None | _DTypeLikeObject = ..., + dtype: _DTypeLikeObject | None = ..., out: None = ..., order: _OrderKACF = ..., optimize: _OptimizeKind = ..., @@ -153,7 +153,7 @@ def einsum( /, *operands: _ArrayLikeObject_co, out: _ArrayType, - dtype: None | _DTypeLikeObject = ..., + dtype: _DTypeLikeObject | None = ..., order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., @@ -165,7 +165,7 @@ def einsum( *operands: Any, out: _ArrayType, casting: _CastingUnsafe, - dtype: None | _DTypeLikeObject = ..., + dtype: _DTypeLikeObject | None = ..., order: _OrderKACF = ..., optimize: _OptimizeKind = ..., ) -> _ArrayType: ... diff --git a/src/numpy-stubs/_core/fromnumeric.pyi b/src/numpy-stubs/_core/fromnumeric.pyi index ae6f9941..0dd79088 100644 --- a/src/numpy-stubs/_core/fromnumeric.pyi +++ b/src/numpy-stubs/_core/fromnumeric.pyi @@ -135,7 +135,7 @@ def take( def take( a: ArrayLike, indices: _IntLike_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., mode: _ModeKind = ..., ) -> Any: ... @@ -143,7 +143,7 @@ def take( def take( a: _ArrayLike[_SCT], indices: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., mode: _ModeKind = ..., ) -> NDArray[_SCT]: ... @@ -151,7 +151,7 @@ def take( def take( a: ArrayLike, indices: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., mode: _ModeKind = ..., ) -> NDArray[Any]: ... @@ -159,7 +159,7 @@ def take( def take( a: ArrayLike, indices: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: _ArrayType = ..., mode: _ModeKind = ..., ) -> _ArrayType: ... @@ -262,13 +262,13 @@ def choose( def repeat( a: _ArrayLike[_SCT], repeats: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., ) -> NDArray[_SCT]: ... @overload def repeat( a: ArrayLike, repeats: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., ) -> NDArray[Any]: ... def put( a: NDArray[Any], @@ -289,9 +289,9 @@ def swapaxes( axis2: SupportsIndex, ) -> NDArray[Any]: ... @overload -def transpose(a: _ArrayLike[_SCT], axes: None | _ShapeLike = ...) -> NDArray[_SCT]: ... +def transpose(a: _ArrayLike[_SCT], axes: _ShapeLike | None = ...) -> NDArray[_SCT]: ... @overload -def transpose(a: ArrayLike, axes: None | _ShapeLike = ...) -> NDArray[Any]: ... +def transpose(a: ArrayLike, axes: _ShapeLike | None = ...) -> NDArray[Any]: ... @overload def matrix_transpose(x: _ArrayLike[_SCT]) -> NDArray[_SCT]: ... @overload @@ -300,50 +300,50 @@ def matrix_transpose(x: ArrayLike) -> NDArray[Any]: ... def partition( a: _ArrayLike[_SCT], kth: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., kind: _PartitionKind = ..., - order: None | str | Sequence[str] = ..., + order: str | Sequence[str] | None = ..., ) -> NDArray[_SCT]: ... @overload def partition( a: ArrayLike, kth: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., kind: _PartitionKind = ..., - order: None | str | Sequence[str] = ..., + order: str | Sequence[str] | None = ..., ) -> NDArray[Any]: ... def argpartition( a: ArrayLike, kth: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., kind: _PartitionKind = ..., - order: None | str | Sequence[str] = ..., + order: str | Sequence[str] | None = ..., ) -> NDArray[intp]: ... @overload def sort( a: _ArrayLike[_SCT], - axis: None | SupportsIndex = ..., - kind: None | _SortKind = ..., - order: None | str | Sequence[str] = ..., + axis: SupportsIndex | None = ..., + kind: _SortKind | None = ..., + order: str | Sequence[str] | None = ..., *, - stable: None | bool = ..., + stable: bool | None = ..., ) -> NDArray[_SCT]: ... @overload def sort( a: ArrayLike, - axis: None | SupportsIndex = ..., - kind: None | _SortKind = ..., - order: None | str | Sequence[str] = ..., + axis: SupportsIndex | None = ..., + kind: _SortKind | None = ..., + order: str | Sequence[str] | None = ..., *, - stable: None | bool = ..., + stable: bool | None = ..., ) -> NDArray[Any]: ... def argsort( a: ArrayLike, - axis: None | SupportsIndex = ..., - kind: None | _SortKind = ..., - order: None | str | Sequence[str] = ..., + axis: SupportsIndex | None = ..., + kind: _SortKind | None = ..., + order: str | Sequence[str] | None = ..., *, - stable: None | bool = ..., + stable: bool | None = ..., ) -> NDArray[intp]: ... @overload def argmax( @@ -356,7 +356,7 @@ def argmax( @overload def argmax( a: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., *, keepdims: bool = ..., @@ -364,7 +364,7 @@ def argmax( @overload def argmax( a: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: _ArrayType = ..., *, keepdims: bool = ..., @@ -380,7 +380,7 @@ def argmin( @overload def argmin( a: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., *, keepdims: bool = ..., @@ -388,7 +388,7 @@ def argmin( @overload def argmin( a: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: _ArrayType = ..., *, keepdims: bool = ..., @@ -398,14 +398,14 @@ def searchsorted( a: ArrayLike, v: _ScalarLike_co, side: _SortSide = ..., - sorter: None | _ArrayLikeInt_co = ..., # 1D int array + sorter: _ArrayLikeInt_co | None = ..., # 1D int array ) -> intp: ... @overload def searchsorted( a: ArrayLike, v: ArrayLike, side: _SortSide = ..., - sorter: None | _ArrayLikeInt_co = ..., # 1D int array + sorter: _ArrayLikeInt_co | None = ..., # 1D int array ) -> NDArray[intp]: ... # unlike `reshape`, `resize` only accepts positive integers, so literal ints can be used @@ -428,17 +428,17 @@ def resize(a: ArrayLike, new_shape: Sequence[SupportsIndex]) -> NDArray[Any]: .. @overload def squeeze( a: _SCT, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., ) -> _SCT: ... @overload def squeeze( a: _ArrayLike[_SCT], - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., ) -> NDArray[_SCT]: ... @overload def squeeze( a: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., ) -> NDArray[Any]: ... @overload def diagonal( @@ -523,117 +523,117 @@ def shape(a: ArrayLike) -> tuple[int, ...]: ... def compress( condition: _ArrayLikeBool_co, # 1D bool array a: _ArrayLike[_SCT], - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., ) -> NDArray[_SCT]: ... @overload def compress( condition: _ArrayLikeBool_co, # 1D bool array a: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., ) -> NDArray[Any]: ... @overload def compress( condition: _ArrayLikeBool_co, # 1D bool array a: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: _ArrayType = ..., ) -> _ArrayType: ... @overload def clip( a: _SCT, - a_min: None | ArrayLike, - a_max: None | ArrayLike, + a_min: ArrayLike | None, + a_max: ArrayLike | None, out: None = ..., *, - min: None | ArrayLike = ..., - max: None | ArrayLike = ..., + min: ArrayLike | None = ..., + max: ArrayLike | None = ..., dtype: None = ..., - where: None | _ArrayLikeBool_co = ..., + where: _ArrayLikeBool_co | None = ..., order: _OrderKACF = ..., subok: bool = ..., - signature: str | tuple[None | str, ...] = ..., + signature: str | tuple[str | None, ...] = ..., casting: _CastingKind = ..., ) -> _SCT: ... @overload def clip( a: _ScalarLike_co, - a_min: None | ArrayLike, - a_max: None | ArrayLike, + a_min: ArrayLike | None, + a_max: ArrayLike | None, out: None = ..., *, - min: None | ArrayLike = ..., - max: None | ArrayLike = ..., + min: ArrayLike | None = ..., + max: ArrayLike | None = ..., dtype: None = ..., - where: None | _ArrayLikeBool_co = ..., + where: _ArrayLikeBool_co | None = ..., order: _OrderKACF = ..., subok: bool = ..., - signature: str | tuple[None | str, ...] = ..., + signature: str | tuple[str | None, ...] = ..., casting: _CastingKind = ..., ) -> Any: ... @overload def clip( a: _ArrayLike[_SCT], - a_min: None | ArrayLike, - a_max: None | ArrayLike, + a_min: ArrayLike | None, + a_max: ArrayLike | None, out: None = ..., *, - min: None | ArrayLike = ..., - max: None | ArrayLike = ..., + min: ArrayLike | None = ..., + max: ArrayLike | None = ..., dtype: None = ..., - where: None | _ArrayLikeBool_co = ..., + where: _ArrayLikeBool_co | None = ..., order: _OrderKACF = ..., subok: bool = ..., - signature: str | tuple[None | str, ...] = ..., + signature: str | tuple[str | None, ...] = ..., casting: _CastingKind = ..., ) -> NDArray[_SCT]: ... @overload def clip( a: ArrayLike, - a_min: None | ArrayLike, - a_max: None | ArrayLike, + a_min: ArrayLike | None, + a_max: ArrayLike | None, out: None = ..., *, - min: None | ArrayLike = ..., - max: None | ArrayLike = ..., + min: ArrayLike | None = ..., + max: ArrayLike | None = ..., dtype: None = ..., - where: None | _ArrayLikeBool_co = ..., + where: _ArrayLikeBool_co | None = ..., order: _OrderKACF = ..., subok: bool = ..., - signature: str | tuple[None | str, ...] = ..., + signature: str | tuple[str | None, ...] = ..., casting: _CastingKind = ..., ) -> NDArray[Any]: ... @overload def clip( a: ArrayLike, - a_min: None | ArrayLike, - a_max: None | ArrayLike, + a_min: ArrayLike | None, + a_max: ArrayLike | None, out: _ArrayType = ..., *, - min: None | ArrayLike = ..., - max: None | ArrayLike = ..., + min: ArrayLike | None = ..., + max: ArrayLike | None = ..., dtype: DTypeLike, - where: None | _ArrayLikeBool_co = ..., + where: _ArrayLikeBool_co | None = ..., order: _OrderKACF = ..., subok: bool = ..., - signature: str | tuple[None | str, ...] = ..., + signature: str | tuple[str | None, ...] = ..., casting: _CastingKind = ..., ) -> Any: ... @overload def clip( a: ArrayLike, - a_min: None | ArrayLike, - a_max: None | ArrayLike, + a_min: ArrayLike | None, + a_max: ArrayLike | None, out: _ArrayType, *, - min: None | ArrayLike = ..., - max: None | ArrayLike = ..., + min: ArrayLike | None = ..., + max: ArrayLike | None = ..., dtype: DTypeLike = ..., - where: None | _ArrayLikeBool_co = ..., + where: _ArrayLikeBool_co | None = ..., order: _OrderKACF = ..., subok: bool = ..., - signature: str | tuple[None | str, ...] = ..., + signature: str | tuple[str | None, ...] = ..., casting: _CastingKind = ..., ) -> _ArrayType: ... @overload @@ -680,7 +680,7 @@ def sum( @overload def sum( a: ArrayLike, - axis: None | _ShapeLike, + axis: _ShapeLike | None, dtype: _DTypeLike[_SCT], out: None = ..., keepdims: bool = ..., @@ -690,7 +690,7 @@ def sum( @overload def sum( a: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., *, dtype: _DTypeLike[_SCT], out: None = ..., @@ -701,7 +701,7 @@ def sum( @overload def sum( a: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: None = ..., keepdims: bool = ..., @@ -711,7 +711,7 @@ def sum( @overload def sum( a: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayType = ..., keepdims: bool = ..., @@ -730,7 +730,7 @@ def all( @overload def all( a: ArrayLike, - axis: None | int | tuple[int, ...] = None, + axis: int | tuple[int, ...] | None = None, out: None = None, keepdims: SupportsIndex = False, *, @@ -739,7 +739,7 @@ def all( @overload def all( a: ArrayLike, - axis: None | int | tuple[int, ...], + axis: int | tuple[int, ...] | None, out: _ArrayType, keepdims: SupportsIndex = False, *, @@ -748,7 +748,7 @@ def all( @overload def all( a: ArrayLike, - axis: None | int | tuple[int, ...] = None, + axis: int | tuple[int, ...] | None = None, *, out: _ArrayType, keepdims: SupportsIndex = False, @@ -766,7 +766,7 @@ def any( @overload def any( a: ArrayLike, - axis: None | int | tuple[int, ...] = None, + axis: int | tuple[int, ...] | None = None, out: None = None, keepdims: SupportsIndex = False, *, @@ -775,7 +775,7 @@ def any( @overload def any( a: ArrayLike, - axis: None | int | tuple[int, ...], + axis: int | tuple[int, ...] | None, out: _ArrayType, keepdims: SupportsIndex = False, *, @@ -784,7 +784,7 @@ def any( @overload def any( a: ArrayLike, - axis: None | int | tuple[int, ...] = None, + axis: int | tuple[int, ...] | None = None, *, out: _ArrayType, keepdims: SupportsIndex = False, @@ -793,35 +793,35 @@ def any( @overload def cumsum( a: _ArrayLike[_SCT], - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., ) -> NDArray[_SCT]: ... @overload def cumsum( a: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., ) -> NDArray[Any]: ... @overload def cumsum( a: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: _DTypeLike[_SCT] = ..., out: None = ..., ) -> NDArray[_SCT]: ... @overload def cumsum( a: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: DTypeLike = ..., out: None = ..., ) -> NDArray[Any]: ... @overload def cumsum( a: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: DTypeLike = ..., out: _ArrayType = ..., ) -> _ArrayType: ... @@ -830,7 +830,7 @@ def cumulative_sum( x: _ArrayLike[_SCT], /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., include_initial: bool = ..., @@ -840,7 +840,7 @@ def cumulative_sum( x: ArrayLike, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., include_initial: bool = ..., @@ -850,7 +850,7 @@ def cumulative_sum( x: ArrayLike, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: _DTypeLike[_SCT] = ..., out: None = ..., include_initial: bool = ..., @@ -860,7 +860,7 @@ def cumulative_sum( x: ArrayLike, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: DTypeLike = ..., out: None = ..., include_initial: bool = ..., @@ -870,7 +870,7 @@ def cumulative_sum( x: ArrayLike, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: DTypeLike = ..., out: _ArrayType = ..., include_initial: bool = ..., @@ -885,14 +885,14 @@ def ptp( @overload def ptp( a: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., out: None = ..., keepdims: bool = ..., ) -> Any: ... @overload def ptp( a: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., out: _ArrayType = ..., keepdims: bool = ..., ) -> _ArrayType: ... @@ -908,7 +908,7 @@ def amax( @overload def amax( a: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., out: None = ..., keepdims: bool = ..., initial: _NumberLike_co = ..., @@ -917,7 +917,7 @@ def amax( @overload def amax( a: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., out: _ArrayType = ..., keepdims: bool = ..., initial: _NumberLike_co = ..., @@ -935,7 +935,7 @@ def amin( @overload def amin( a: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., out: None = ..., keepdims: bool = ..., initial: _NumberLike_co = ..., @@ -944,7 +944,7 @@ def amin( @overload def amin( a: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., out: _ArrayType = ..., keepdims: bool = ..., initial: _NumberLike_co = ..., @@ -1011,7 +1011,7 @@ def prod( @overload def prod( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: None = ..., out: None = ..., keepdims: bool = ..., @@ -1031,8 +1031,8 @@ def prod( @overload def prod( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., - dtype: None | DTypeLike = ..., + axis: _ShapeLike | None = ..., + dtype: DTypeLike | None = ..., out: None = ..., keepdims: bool = ..., initial: _NumberLike_co = ..., @@ -1041,8 +1041,8 @@ def prod( @overload def prod( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., - dtype: None | DTypeLike = ..., + axis: _ShapeLike | None = ..., + dtype: DTypeLike | None = ..., out: _ArrayType = ..., keepdims: bool = ..., initial: _NumberLike_co = ..., @@ -1051,63 +1051,63 @@ def prod( @overload def cumprod( a: _ArrayLikeBool_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., ) -> NDArray[int_]: ... @overload def cumprod( a: _ArrayLikeUInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., ) -> NDArray[uint64]: ... @overload def cumprod( a: _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., ) -> NDArray[int64]: ... @overload def cumprod( a: _ArrayLikeFloat_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., ) -> NDArray[floating[Any]]: ... @overload def cumprod( a: _ArrayLikeComplex_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., ) -> NDArray[complexfloating[Any, Any]]: ... @overload def cumprod( a: _ArrayLikeObject_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., ) -> NDArray[object_]: ... @overload def cumprod( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: _DTypeLike[_SCT] = ..., out: None = ..., ) -> NDArray[_SCT]: ... @overload def cumprod( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: DTypeLike = ..., out: None = ..., ) -> NDArray[Any]: ... @overload def cumprod( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: DTypeLike = ..., out: _ArrayType = ..., ) -> _ArrayType: ... @@ -1116,7 +1116,7 @@ def cumulative_prod( x: _ArrayLikeBool_co, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., include_initial: bool = ..., @@ -1126,7 +1126,7 @@ def cumulative_prod( x: _ArrayLikeUInt_co, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., include_initial: bool = ..., @@ -1136,7 +1136,7 @@ def cumulative_prod( x: _ArrayLikeInt_co, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., include_initial: bool = ..., @@ -1146,7 +1146,7 @@ def cumulative_prod( x: _ArrayLikeFloat_co, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., include_initial: bool = ..., @@ -1156,7 +1156,7 @@ def cumulative_prod( x: _ArrayLikeComplex_co, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., include_initial: bool = ..., @@ -1166,7 +1166,7 @@ def cumulative_prod( x: _ArrayLikeObject_co, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: None = ..., out: None = ..., include_initial: bool = ..., @@ -1176,7 +1176,7 @@ def cumulative_prod( x: _ArrayLikeComplex_co | _ArrayLikeObject_co, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: _DTypeLike[_SCT] = ..., out: None = ..., include_initial: bool = ..., @@ -1186,7 +1186,7 @@ def cumulative_prod( x: _ArrayLikeComplex_co | _ArrayLikeObject_co, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: DTypeLike = ..., out: None = ..., include_initial: bool = ..., @@ -1196,13 +1196,13 @@ def cumulative_prod( x: _ArrayLikeComplex_co | _ArrayLikeObject_co, /, *, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., dtype: DTypeLike = ..., out: _ArrayType = ..., include_initial: bool = ..., ) -> _ArrayType: ... def ndim(a: ArrayLike) -> int: ... -def size(a: ArrayLike, axis: None | int = ...) -> int: ... +def size(a: ArrayLike, axis: int | None = ...) -> int: ... @overload def around( a: _BoolLike_co, @@ -1278,7 +1278,7 @@ def mean( @overload def mean( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: None = ..., out: None = ..., keepdims: bool = ..., @@ -1318,7 +1318,7 @@ def mean( @overload def mean( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: None = ..., keepdims: bool = ..., @@ -1328,7 +1328,7 @@ def mean( @overload def mean( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayType = ..., keepdims: bool = ..., @@ -1351,7 +1351,7 @@ def std( @overload def std( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: None = ..., out: None = ..., ddof: float = ..., @@ -1377,7 +1377,7 @@ def std( @overload def std( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: None = ..., ddof: float = ..., @@ -1390,7 +1390,7 @@ def std( @overload def std( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayType = ..., ddof: float = ..., @@ -1416,7 +1416,7 @@ def var( @overload def var( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: None = ..., out: None = ..., ddof: float = ..., @@ -1442,7 +1442,7 @@ def var( @overload def var( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: None = ..., ddof: float = ..., @@ -1455,7 +1455,7 @@ def var( @overload def var( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayType = ..., ddof: float = ..., diff --git a/src/numpy-stubs/_core/function_base.pyi b/src/numpy-stubs/_core/function_base.pyi index 44d5228a..d3c0906c 100644 --- a/src/numpy-stubs/_core/function_base.pyi +++ b/src/numpy-stubs/_core/function_base.pyi @@ -29,7 +29,7 @@ def linspace( dtype: None = ..., axis: SupportsIndex = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[floating[Any]]: ... @overload def linspace( @@ -41,7 +41,7 @@ def linspace( dtype: None = ..., axis: SupportsIndex = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[complexfloating[Any, Any]]: ... @overload def linspace( @@ -53,7 +53,7 @@ def linspace( dtype: _DTypeLike[_SCT] = ..., axis: SupportsIndex = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[_SCT]: ... @overload def linspace( @@ -65,7 +65,7 @@ def linspace( dtype: DTypeLike = ..., axis: SupportsIndex = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[Any]: ... @overload def linspace( @@ -77,7 +77,7 @@ def linspace( dtype: None = ..., axis: SupportsIndex = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> tuple[NDArray[floating[Any]], floating[Any]]: ... @overload def linspace( @@ -89,7 +89,7 @@ def linspace( dtype: None = ..., axis: SupportsIndex = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> tuple[NDArray[complexfloating[Any, Any]], complexfloating[Any, Any]]: ... @overload def linspace( @@ -101,7 +101,7 @@ def linspace( dtype: _DTypeLike[_SCT] = ..., axis: SupportsIndex = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> tuple[NDArray[_SCT], _SCT]: ... @overload def linspace( @@ -113,7 +113,7 @@ def linspace( dtype: DTypeLike = ..., axis: SupportsIndex = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> tuple[NDArray[Any], Any]: ... @overload def logspace( diff --git a/src/numpy-stubs/_core/multiarray.pyi b/src/numpy-stubs/_core/multiarray.pyi index be1afa39..f95cd21c 100644 --- a/src/numpy-stubs/_core/multiarray.pyi +++ b/src/numpy-stubs/_core/multiarray.pyi @@ -239,8 +239,8 @@ class _SupportsArray(Protocol[_ArrayType_co]): @type_check_only class _KwargsEmpty(TypedDict, total=False): - device: None | L["cpu"] - like: None | _SupportsArrayFunc + device: L["cpu"] | None + like: _SupportsArrayFunc | None @type_check_only class _ConstructorEmpty(Protocol): @@ -408,9 +408,9 @@ def empty_like( dtype: None = ..., order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> _ArrayType: ... @overload def empty_like( @@ -418,9 +418,9 @@ def empty_like( dtype: None = ..., order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[_SCT]: ... @overload def empty_like( @@ -428,9 +428,9 @@ def empty_like( dtype: None = ..., order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[Any]: ... @overload def empty_like( @@ -438,9 +438,9 @@ def empty_like( dtype: _DTypeLike[_SCT], order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[_SCT]: ... @overload def empty_like( @@ -448,75 +448,75 @@ def empty_like( dtype: DTypeLike, order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[Any]: ... @overload def array( object: _ArrayType, dtype: None = ..., *, - copy: None | bool | _CopyMode = ..., + copy: bool | _CopyMode | None = ..., order: _OrderKACF = ..., subok: L[True], ndmin: int = ..., - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> _ArrayType: ... @overload def array( object: _SupportsArray[_ArrayType], dtype: None = ..., *, - copy: None | bool | _CopyMode = ..., + copy: bool | _CopyMode | None = ..., order: _OrderKACF = ..., subok: L[True], ndmin: L[0] = ..., - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> _ArrayType: ... @overload def array( object: _ArrayLike[_SCT], dtype: None = ..., *, - copy: None | bool | _CopyMode = ..., + copy: bool | _CopyMode | None = ..., order: _OrderKACF = ..., subok: bool = ..., ndmin: int = ..., - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def array( object: object, dtype: None = ..., *, - copy: None | bool | _CopyMode = ..., + copy: bool | _CopyMode | None = ..., order: _OrderKACF = ..., subok: bool = ..., ndmin: int = ..., - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def array( object: Any, dtype: _DTypeLike[_SCT], *, - copy: None | bool | _CopyMode = ..., + copy: bool | _CopyMode | None = ..., order: _OrderKACF = ..., subok: bool = ..., ndmin: int = ..., - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def array( object: Any, dtype: DTypeLike, *, - copy: None | bool | _CopyMode = ..., + copy: bool | _CopyMode | None = ..., order: _OrderKACF = ..., subok: bool = ..., ndmin: int = ..., - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def unravel_index( # type: ignore[misc] @@ -550,51 +550,51 @@ def ravel_multi_index( def concatenate( # type: ignore[misc] arrays: _ArrayLike[_SCT], /, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., *, dtype: None = ..., - casting: None | _CastingKind = ..., + casting: _CastingKind | None = ..., ) -> NDArray[_SCT]: ... @overload def concatenate( # type: ignore[misc] arrays: SupportsLenAndGetItem[ArrayLike], /, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., *, dtype: None = ..., - casting: None | _CastingKind = ..., + casting: _CastingKind | None = ..., ) -> NDArray[Any]: ... @overload def concatenate( # type: ignore[misc] arrays: SupportsLenAndGetItem[ArrayLike], /, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., *, dtype: _DTypeLike[_SCT], - casting: None | _CastingKind = ..., + casting: _CastingKind | None = ..., ) -> NDArray[_SCT]: ... @overload def concatenate( # type: ignore[misc] arrays: SupportsLenAndGetItem[ArrayLike], /, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: None = ..., *, dtype: DTypeLike, - casting: None | _CastingKind = ..., + casting: _CastingKind | None = ..., ) -> NDArray[Any]: ... @overload def concatenate( arrays: SupportsLenAndGetItem[ArrayLike], /, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., out: _ArrayType = ..., *, dtype: DTypeLike = ..., - casting: None | _CastingKind = ..., + casting: _CastingKind | None = ..., ) -> _ArrayType: ... def inner( a: ArrayLike, @@ -615,12 +615,12 @@ def where( ) -> NDArray[Any]: ... def lexsort( keys: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., ) -> Any: ... def can_cast( from_: ArrayLike | DTypeLike, to: DTypeLike, - casting: None | _CastingKind = ..., + casting: _CastingKind | None = ..., ) -> bool: ... def min_scalar_type( a: ArrayLike, @@ -652,14 +652,14 @@ def vdot(a: Any, b: _ArrayLikeObject_co, /) -> Any: ... def bincount( x: ArrayLike, /, - weights: None | ArrayLike = ..., + weights: ArrayLike | None = ..., minlength: SupportsIndex = ..., ) -> NDArray[intp]: ... def copyto( dst: NDArray[Any], src: ArrayLike, - casting: None | _CastingKind = ..., - where: None | _ArrayLikeBool_co = ..., + casting: _CastingKind | None = ..., + where: _ArrayLikeBool_co | None = ..., ) -> None: ... def putmask( a: NDArray[Any], @@ -670,27 +670,27 @@ def putmask( def packbits( a: _ArrayLikeInt_co, /, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., bitorder: L["big", "little"] = ..., ) -> NDArray[uint8]: ... def unpackbits( a: _ArrayLike[uint8], /, - axis: None | SupportsIndex = ..., - count: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., + count: SupportsIndex | None = ..., bitorder: L["big", "little"] = ..., ) -> NDArray[uint8]: ... def shares_memory( a: object, b: object, /, - max_work: None | int = ..., + max_work: int | None = ..., ) -> bool: ... def may_share_memory( a: object, b: object, /, - max_work: None | int = ..., + max_work: int | None = ..., ) -> bool: ... @overload def asarray( @@ -698,9 +698,9 @@ def asarray( dtype: None = ..., order: _OrderKACF = ..., *, - device: None | L["cpu"] = ..., - copy: None | bool = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + copy: bool | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def asarray( @@ -708,9 +708,9 @@ def asarray( dtype: None = ..., order: _OrderKACF = ..., *, - device: None | L["cpu"] = ..., - copy: None | bool = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + copy: bool | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def asarray( @@ -718,9 +718,9 @@ def asarray( dtype: _DTypeLike[_SCT], order: _OrderKACF = ..., *, - device: None | L["cpu"] = ..., - copy: None | bool = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + copy: bool | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def asarray( @@ -728,9 +728,9 @@ def asarray( dtype: DTypeLike, order: _OrderKACF = ..., *, - device: None | L["cpu"] = ..., - copy: None | bool = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + copy: bool | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def asanyarray( @@ -738,9 +738,9 @@ def asanyarray( dtype: None = ..., order: _OrderKACF = ..., *, - device: None | L["cpu"] = ..., - copy: None | bool = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + copy: bool | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _ArrayType: ... @overload def asanyarray( @@ -748,9 +748,9 @@ def asanyarray( dtype: None = ..., order: _OrderKACF = ..., *, - device: None | L["cpu"] = ..., - copy: None | bool = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + copy: bool | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def asanyarray( @@ -758,9 +758,9 @@ def asanyarray( dtype: None = ..., order: _OrderKACF = ..., *, - device: None | L["cpu"] = ..., - copy: None | bool = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + copy: bool | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def asanyarray( @@ -768,9 +768,9 @@ def asanyarray( dtype: _DTypeLike[_SCT], order: _OrderKACF = ..., *, - device: None | L["cpu"] = ..., - copy: None | bool = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + copy: bool | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def asanyarray( @@ -778,65 +778,65 @@ def asanyarray( dtype: DTypeLike, order: _OrderKACF = ..., *, - device: None | L["cpu"] = ..., - copy: None | bool = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + copy: bool | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def ascontiguousarray( a: _ArrayLike[_SCT], dtype: None = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def ascontiguousarray( a: object, dtype: None = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def ascontiguousarray( a: Any, dtype: _DTypeLike[_SCT], *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def ascontiguousarray( a: Any, dtype: DTypeLike, *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def asfortranarray( a: _ArrayLike[_SCT], dtype: None = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def asfortranarray( a: object, dtype: None = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def asfortranarray( a: Any, dtype: _DTypeLike[_SCT], *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def asfortranarray( a: Any, dtype: DTypeLike, *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... def promote_types(__type1: DTypeLike, __type2: DTypeLike) -> dtype[Any]: ... @@ -848,7 +848,7 @@ def fromstring( count: SupportsIndex = ..., *, sep: str, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[float64]: ... @overload def fromstring( @@ -857,7 +857,7 @@ def fromstring( count: SupportsIndex = ..., *, sep: str, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def fromstring( @@ -866,7 +866,7 @@ def fromstring( count: SupportsIndex = ..., *, sep: str, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def frompyfunc( # type: ignore[overload-overlap] @@ -947,7 +947,7 @@ def frompyfunc( nin: SupportsIndex, nout: SupportsIndex, *, - identity: None | object = ..., + identity: object | None = ..., ) -> ufunc: ... @overload def fromfile( @@ -957,7 +957,7 @@ def fromfile( sep: str = ..., offset: SupportsIndex = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[float64]: ... @overload def fromfile( @@ -967,7 +967,7 @@ def fromfile( sep: str = ..., offset: SupportsIndex = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def fromfile( @@ -977,7 +977,7 @@ def fromfile( sep: str = ..., offset: SupportsIndex = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def fromiter( @@ -985,7 +985,7 @@ def fromiter( dtype: _DTypeLike[_SCT], count: SupportsIndex = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def fromiter( @@ -993,7 +993,7 @@ def fromiter( dtype: DTypeLike, count: SupportsIndex = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def frombuffer( @@ -1002,7 +1002,7 @@ def frombuffer( count: SupportsIndex = ..., offset: SupportsIndex = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[float64]: ... @overload def frombuffer( @@ -1011,7 +1011,7 @@ def frombuffer( count: SupportsIndex = ..., offset: SupportsIndex = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def frombuffer( @@ -1020,7 +1020,7 @@ def frombuffer( count: SupportsIndex = ..., offset: SupportsIndex = ..., *, - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def arange( # type: ignore[misc] @@ -1028,8 +1028,8 @@ def arange( # type: ignore[misc] /, *, dtype: None = ..., - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, signedinteger[Any]]: ... @overload def arange( # type: ignore[misc] @@ -1038,8 +1038,8 @@ def arange( # type: ignore[misc] step: _IntLike_co = ..., dtype: None = ..., *, - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, signedinteger[Any]]: ... @overload def arange( # type: ignore[misc] @@ -1047,8 +1047,8 @@ def arange( # type: ignore[misc] /, *, dtype: None = ..., - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, floating[Any]]: ... @overload def arange( # type: ignore[misc] @@ -1057,8 +1057,8 @@ def arange( # type: ignore[misc] step: _FloatLike_co = ..., dtype: None = ..., *, - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, floating[Any]]: ... @overload def arange( @@ -1066,8 +1066,8 @@ def arange( /, *, dtype: None = ..., - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, timedelta64]: ... @overload def arange( @@ -1076,8 +1076,8 @@ def arange( step: _TD64Like_co = ..., dtype: None = ..., *, - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, timedelta64]: ... @overload def arange( # both start and stop must always be specified for datetime64 @@ -1086,8 +1086,8 @@ def arange( # both start and stop must always be specified for datetime64 step: datetime64 = ..., dtype: None = ..., *, - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, datetime64]: ... @overload def arange( @@ -1095,8 +1095,8 @@ def arange( /, *, dtype: _DTypeLike[_SCT], - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, _SCT]: ... @overload def arange( @@ -1105,8 +1105,8 @@ def arange( step: Any = ..., dtype: _DTypeLike[_SCT] = ..., *, - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, _SCT]: ... @overload def arange( @@ -1114,8 +1114,8 @@ def arange( /, *, dtype: DTypeLike, - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, Any]: ... @overload def arange( @@ -1124,8 +1124,8 @@ def arange( step: Any = ..., dtype: DTypeLike = ..., *, - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> _1DArray[int, Any]: ... def datetime_data( dtype: str | _DTypeLike[datetime64] | _DTypeLike[timedelta64], @@ -1140,8 +1140,8 @@ def busday_count( # type: ignore[misc] begindates: _ScalarLike_co | dt.date, enddates: _ScalarLike_co | dt.date, weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: None = ..., ) -> int_: ... @overload @@ -1149,8 +1149,8 @@ def busday_count( # type: ignore[misc] begindates: ArrayLike | dt.date | _NestedSequence[dt.date], enddates: ArrayLike | dt.date | _NestedSequence[dt.date], weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: None = ..., ) -> NDArray[int_]: ... @overload @@ -1158,8 +1158,8 @@ def busday_count( begindates: ArrayLike | dt.date | _NestedSequence[dt.date], enddates: ArrayLike | dt.date | _NestedSequence[dt.date], weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: _ArrayType = ..., ) -> _ArrayType: ... @@ -1170,8 +1170,8 @@ def busday_offset( # type: ignore[misc] offsets: _TD64Like_co | dt.timedelta, roll: L["raise"] = ..., weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: None = ..., ) -> datetime64: ... @overload @@ -1180,8 +1180,8 @@ def busday_offset( # type: ignore[misc] offsets: _ArrayLikeTD64_co | dt.timedelta | _NestedSequence[dt.timedelta], roll: L["raise"] = ..., weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: None = ..., ) -> NDArray[datetime64]: ... @overload @@ -1190,8 +1190,8 @@ def busday_offset( # type: ignore[misc] offsets: _ArrayLikeTD64_co | dt.timedelta | _NestedSequence[dt.timedelta], roll: L["raise"] = ..., weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: _ArrayType = ..., ) -> _ArrayType: ... @overload @@ -1200,8 +1200,8 @@ def busday_offset( # type: ignore[misc] offsets: _ScalarLike_co | dt.timedelta, roll: _RollKind, weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: None = ..., ) -> datetime64: ... @overload @@ -1210,8 +1210,8 @@ def busday_offset( # type: ignore[misc] offsets: ArrayLike | dt.timedelta | _NestedSequence[dt.timedelta], roll: _RollKind, weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: None = ..., ) -> NDArray[datetime64]: ... @overload @@ -1220,45 +1220,45 @@ def busday_offset( offsets: ArrayLike | dt.timedelta | _NestedSequence[dt.timedelta], roll: _RollKind, weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: _ArrayType = ..., ) -> _ArrayType: ... @overload def is_busday( # type: ignore[misc] dates: _ScalarLike_co | dt.date, weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: None = ..., ) -> np.bool: ... @overload def is_busday( # type: ignore[misc] dates: ArrayLike | _NestedSequence[dt.date], weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: None = ..., ) -> NDArray[np.bool]: ... @overload def is_busday( dates: ArrayLike | _NestedSequence[dt.date], weekmask: ArrayLike = ..., - holidays: None | ArrayLike | dt.date | _NestedSequence[dt.date] = ..., - busdaycal: None | busdaycalendar = ..., + holidays: ArrayLike | dt.date | _NestedSequence[dt.date] | None = ..., + busdaycal: busdaycalendar | None = ..., out: _ArrayType = ..., ) -> _ArrayType: ... @overload def datetime_as_string( # type: ignore[misc] arr: datetime64 | dt.date, - unit: None | L["auto"] | _UnitKind = ..., + unit: L["auto"] | _UnitKind | None = ..., timezone: L["naive", "UTC", "local"] | dt.tzinfo = ..., casting: _CastingKind = ..., ) -> str_: ... @overload def datetime_as_string( arr: _ArrayLikeDT64_co | _NestedSequence[dt.date], - unit: None | L["auto"] | _UnitKind = ..., + unit: L["auto"] | _UnitKind | None = ..., timezone: L["naive", "UTC", "local"] | dt.tzinfo = ..., casting: _CastingKind = ..., ) -> NDArray[str_]: ... @@ -1347,8 +1347,8 @@ class flagsobj: def nested_iters( op: ArrayLike | Sequence[ArrayLike], axes: Sequence[Sequence[SupportsIndex]], - flags: None | Sequence[_NDIterFlagsKind] = ..., - op_flags: None | Sequence[Sequence[_NDIterFlagsOp]] = ..., + flags: Sequence[_NDIterFlagsKind] | None = ..., + op_flags: Sequence[Sequence[_NDIterFlagsOp]] | None = ..., op_dtypes: DTypeLike | Sequence[DTypeLike] = ..., order: _OrderKACF = ..., casting: _CastingKind = ..., diff --git a/src/numpy-stubs/_core/numeric.pyi b/src/numpy-stubs/_core/numeric.pyi index 083ba763..c95d2a72 100644 --- a/src/numpy-stubs/_core/numeric.pyi +++ b/src/numpy-stubs/_core/numeric.pyi @@ -194,7 +194,7 @@ def zeros_like( subok: L[True] = ..., shape: None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> _ArrayType: ... @overload def zeros_like( @@ -202,9 +202,9 @@ def zeros_like( dtype: None = ..., order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[_SCT]: ... @overload def zeros_like( @@ -212,9 +212,9 @@ def zeros_like( dtype: None = ..., order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[Any]: ... @overload def zeros_like( @@ -222,9 +222,9 @@ def zeros_like( dtype: _DTypeLike[_SCT], order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[_SCT]: ... @overload def zeros_like( @@ -232,9 +232,9 @@ def zeros_like( dtype: DTypeLike, order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[Any]: ... ones: Final[_ConstructorEmpty] @@ -247,7 +247,7 @@ def ones_like( subok: L[True] = ..., shape: None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> _ArrayType: ... @overload def ones_like( @@ -255,9 +255,9 @@ def ones_like( dtype: None = ..., order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[_SCT]: ... @overload def ones_like( @@ -265,9 +265,9 @@ def ones_like( dtype: None = ..., order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[Any]: ... @overload def ones_like( @@ -275,9 +275,9 @@ def ones_like( dtype: _DTypeLike[_SCT], order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[_SCT]: ... @overload def ones_like( @@ -285,9 +285,9 @@ def ones_like( dtype: DTypeLike, order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[Any]: ... # TODO: Add overloads for bool, int, float, complex, str, bytes, and memoryview @@ -320,7 +320,7 @@ def full( def full( shape: _SizeType, fill_value: Any, - dtype: None | DTypeLike = ..., + dtype: DTypeLike | None = ..., order: _OrderCF = ..., **kwargs: Unpack[_KwargsEmpty], ) -> _Array[tuple[_SizeType], Any]: ... @@ -354,7 +354,7 @@ def full( def full( shape: _ShapeType, fill_value: Any, - dtype: None | DTypeLike = ..., + dtype: DTypeLike | None = ..., order: _OrderCF = ..., **kwargs: Unpack[_KwargsEmpty], ) -> _Array[_ShapeType, Any]: ... @@ -388,7 +388,7 @@ def full( def full( shape: _ShapeLike, fill_value: Any, - dtype: None | DTypeLike = ..., + dtype: DTypeLike | None = ..., order: _OrderCF = ..., **kwargs: Unpack[_KwargsEmpty], ) -> NDArray[Any]: ... @@ -401,7 +401,7 @@ def full_like( subok: L[True] = ..., shape: None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> _ArrayType: ... @overload def full_like( @@ -410,9 +410,9 @@ def full_like( dtype: None = ..., order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[_SCT]: ... @overload def full_like( @@ -421,9 +421,9 @@ def full_like( dtype: None = ..., order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[Any]: ... @overload def full_like( @@ -432,9 +432,9 @@ def full_like( dtype: _DTypeLike[_SCT], order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[_SCT]: ... @overload def full_like( @@ -443,9 +443,9 @@ def full_like( dtype: DTypeLike, order: _OrderKACF = ..., subok: bool = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[Any]: ... @overload def count_nonzero( @@ -666,13 +666,13 @@ def tensordot( def roll( a: _ArrayLike[_SCT], shift: _ShapeLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., ) -> NDArray[_SCT]: ... @overload def roll( a: ArrayLike, shift: _ShapeLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., ) -> NDArray[Any]: ... def rollaxis( a: NDArray[_SCT], @@ -691,7 +691,7 @@ def cross( axisa: int = ..., axisb: int = ..., axisc: int = ..., - axis: None | int = ..., + axis: int | None = ..., ) -> NDArray[Any]: ... @overload def cross( @@ -700,7 +700,7 @@ def cross( axisa: int = ..., axisb: int = ..., axisc: int = ..., - axis: None | int = ..., + axis: int | None = ..., ) -> NoReturn: ... @overload def cross( @@ -709,7 +709,7 @@ def cross( axisa: int = ..., axisb: int = ..., axisc: int = ..., - axis: None | int = ..., + axis: int | None = ..., ) -> NDArray[unsignedinteger[Any]]: ... @overload def cross( @@ -718,7 +718,7 @@ def cross( axisa: int = ..., axisb: int = ..., axisc: int = ..., - axis: None | int = ..., + axis: int | None = ..., ) -> NDArray[signedinteger[Any]]: ... @overload def cross( @@ -727,7 +727,7 @@ def cross( axisa: int = ..., axisb: int = ..., axisc: int = ..., - axis: None | int = ..., + axis: int | None = ..., ) -> NDArray[floating[Any]]: ... @overload def cross( @@ -736,7 +736,7 @@ def cross( axisa: int = ..., axisb: int = ..., axisc: int = ..., - axis: None | int = ..., + axis: int | None = ..., ) -> NDArray[complexfloating[Any, Any]]: ... @overload def cross( @@ -745,7 +745,7 @@ def cross( axisa: int = ..., axisb: int = ..., axisc: int = ..., - axis: None | int = ..., + axis: int | None = ..., ) -> NDArray[object_]: ... @overload def indices( @@ -792,7 +792,7 @@ def fromfunction( **kwargs: Any, ) -> _T: ... def isscalar(element: object) -> TypeGuard[generic | bool | int | float | complex | str | bytes | memoryview]: ... -def binary_repr(num: SupportsIndex, width: None | int = ...) -> str: ... +def binary_repr(num: SupportsIndex, width: int | None = ...) -> str: ... def base_repr( number: SupportsAbs[float], base: float = ..., @@ -849,12 +849,12 @@ def astype( x: ndarray[_ShapeType, dtype[Any]], dtype: _DTypeLike[_SCT], copy: bool = ..., - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> ndarray[_ShapeType, dtype[_SCT]]: ... @overload def astype( x: ndarray[_ShapeType, dtype[Any]], dtype: DTypeLike, copy: bool = ..., - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> ndarray[_ShapeType, dtype[Any]]: ... diff --git a/src/numpy-stubs/_core/records.pyi b/src/numpy-stubs/_core/records.pyi index c9af66f5..d8358971 100644 --- a/src/numpy-stubs/_core/records.pyi +++ b/src/numpy-stubs/_core/records.pyi @@ -1,4 +1,4 @@ -from _typeshed import StrOrBytesPath +from _typeshed import Incomplete, StrOrBytesPath from collections.abc import Iterable, Sequence from types import EllipsisType from typing import Any, Literal, Protocol, SupportsIndex, TypeAlias, TypeVar, overload, type_check_only @@ -63,28 +63,28 @@ class recarray(ndarray[_ShapeT_co, _DType_co]): # mutually exclusive @overload def __new__( - subtype, + cls, shape: _ShapeLike, dtype: None = ..., - buf: None | _SupportsBuffer = ..., + buf: _SupportsBuffer | None = ..., offset: SupportsIndex = ..., - strides: None | _ShapeLike = ..., + strides: _ShapeLike | None = ..., *, formats: DTypeLike, - names: None | str | Sequence[str] = ..., - titles: None | str | Sequence[str] = ..., - byteorder: None | _ByteOrder = ..., + names: str | Sequence[str] | None = ..., + titles: str | Sequence[str] | None = ..., + byteorder: _ByteOrder | None = ..., aligned: bool = ..., order: _OrderKACF = ..., ) -> recarray[Any, dtype[record]]: ... @overload def __new__( - subtype, + cls, shape: _ShapeLike, dtype: DTypeLike, - buf: None | _SupportsBuffer = ..., + buf: _SupportsBuffer | None = ..., offset: SupportsIndex = ..., - strides: None | _ShapeLike = ..., + strides: _ShapeLike | None = ..., formats: None = ..., names: None = ..., titles: None = ..., @@ -92,7 +92,7 @@ class recarray(ndarray[_ShapeT_co, _DType_co]): aligned: Literal[False] = ..., order: _OrderKACF = ..., ) -> recarray[Any, dtype[Any]]: ... - def __array_finalize__(self, obj: object) -> None: ... + def __array_finalize__(self, obj: Incomplete) -> None: ... def __getattribute__(self, attr: str) -> Any: ... def __setattr__(self, attr: str, val: ArrayLike) -> None: ... @overload @@ -100,26 +100,22 @@ class recarray(ndarray[_ShapeT_co, _DType_co]): @overload def __getitem__( self: recarray[Any, dtype[void]], - indx: ( - None - | slice - | EllipsisType - | SupportsIndex - | _ArrayLikeInt_co - | tuple[None | slice | EllipsisType | _ArrayLikeInt_co | SupportsIndex, ...] - ), + indx: slice + | EllipsisType + | SupportsIndex + | _ArrayLikeInt_co + | tuple[slice | EllipsisType | _ArrayLikeInt_co | SupportsIndex | None, ...] + | None, ) -> recarray[_Shape, _DType_co]: ... @overload def __getitem__( self, - indx: ( - None - | slice - | EllipsisType - | SupportsIndex - | _ArrayLikeInt_co - | tuple[None | slice | EllipsisType | _ArrayLikeInt_co | SupportsIndex, ...] - ), + indx: slice + | EllipsisType + | SupportsIndex + | _ArrayLikeInt_co + | tuple[slice | EllipsisType | _ArrayLikeInt_co | SupportsIndex | None, ...] + | None, ) -> ndarray[_Shape, _DType_co]: ... @overload def __getitem__(self, indx: str) -> NDArray[Any]: ... @@ -135,17 +131,17 @@ class format_parser: def __init__( self, formats: DTypeLike, - names: None | str | Sequence[str], - titles: None | str | Sequence[str], + names: str | Sequence[str] | None, + titles: str | Sequence[str] | None, aligned: bool = ..., - byteorder: None | _ByteOrder = ..., + byteorder: _ByteOrder | None = ..., ) -> None: ... @overload def fromarrays( arrayList: Iterable[ArrayLike], dtype: DTypeLike = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., formats: None = ..., names: None = ..., titles: None = ..., @@ -156,19 +152,19 @@ def fromarrays( def fromarrays( arrayList: Iterable[ArrayLike], dtype: None = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, formats: DTypeLike, - names: None | str | Sequence[str] = ..., - titles: None | str | Sequence[str] = ..., + names: str | Sequence[str] | None = ..., + titles: str | Sequence[str] | None = ..., aligned: bool = ..., - byteorder: None | _ByteOrder = ..., + byteorder: _ByteOrder | None = ..., ) -> _RecArray[record]: ... @overload def fromrecords( recList: _ArrayLikeVoid_co | tuple[Any, ...] | _NestedSequence[tuple[Any, ...]], dtype: DTypeLike = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., formats: None = ..., names: None = ..., titles: None = ..., @@ -179,19 +175,19 @@ def fromrecords( def fromrecords( recList: _ArrayLikeVoid_co | tuple[Any, ...] | _NestedSequence[tuple[Any, ...]], dtype: None = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., *, formats: DTypeLike = ..., - names: None | str | Sequence[str] = ..., - titles: None | str | Sequence[str] = ..., + names: str | Sequence[str] | None = ..., + titles: str | Sequence[str] | None = ..., aligned: bool = ..., - byteorder: None | _ByteOrder = ..., + byteorder: _ByteOrder | None = ..., ) -> _RecArray[record]: ... @overload def fromstring( datastring: _SupportsBuffer, dtype: DTypeLike, - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., offset: int = ..., formats: None = ..., names: None = ..., @@ -203,20 +199,20 @@ def fromstring( def fromstring( datastring: _SupportsBuffer, dtype: None = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., offset: int = ..., *, formats: DTypeLike, - names: None | str | Sequence[str] = ..., - titles: None | str | Sequence[str] = ..., + names: str | Sequence[str] | None = ..., + titles: str | Sequence[str] | None = ..., aligned: bool = ..., - byteorder: None | _ByteOrder = ..., + byteorder: _ByteOrder | None = ..., ) -> _RecArray[record]: ... @overload def fromfile( fd: StrOrBytesPath | _SupportsReadInto, dtype: DTypeLike, - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., offset: int = ..., formats: None = ..., names: None = ..., @@ -228,20 +224,20 @@ def fromfile( def fromfile( fd: StrOrBytesPath | _SupportsReadInto, dtype: None = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., offset: int = ..., *, formats: DTypeLike, - names: None | str | Sequence[str] = ..., - titles: None | str | Sequence[str] = ..., + names: str | Sequence[str] | None = ..., + titles: str | Sequence[str] | None = ..., aligned: bool = ..., - byteorder: None | _ByteOrder = ..., + byteorder: _ByteOrder | None = ..., ) -> _RecArray[record]: ... @overload def array( obj: _SCT | NDArray[_SCT], dtype: None = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., offset: int = ..., formats: None = ..., names: None = ..., @@ -254,7 +250,7 @@ def array( def array( obj: ArrayLike, dtype: DTypeLike, - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., offset: int = ..., formats: None = ..., names: None = ..., @@ -267,14 +263,14 @@ def array( def array( obj: ArrayLike, dtype: None = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., offset: int = ..., *, formats: DTypeLike, - names: None | str | Sequence[str] = ..., - titles: None | str | Sequence[str] = ..., + names: str | Sequence[str] | None = ..., + titles: str | Sequence[str] | None = ..., aligned: bool = ..., - byteorder: None | _ByteOrder = ..., + byteorder: _ByteOrder | None = ..., copy: bool = ..., ) -> _RecArray[record]: ... @overload @@ -298,17 +294,17 @@ def array( shape: _ShapeLike, offset: int = ..., formats: DTypeLike, - names: None | str | Sequence[str] = ..., - titles: None | str | Sequence[str] = ..., + names: str | Sequence[str] | None = ..., + titles: str | Sequence[str] | None = ..., aligned: bool = ..., - byteorder: None | _ByteOrder = ..., + byteorder: _ByteOrder | None = ..., copy: bool = ..., ) -> _RecArray[record]: ... @overload def array( obj: _SupportsReadInto, dtype: DTypeLike, - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., offset: int = ..., formats: None = ..., names: None = ..., @@ -321,14 +317,14 @@ def array( def array( obj: _SupportsReadInto, dtype: None = ..., - shape: None | _ShapeLike = ..., + shape: _ShapeLike | None = ..., offset: int = ..., *, formats: DTypeLike, - names: None | str | Sequence[str] = ..., - titles: None | str | Sequence[str] = ..., + names: str | Sequence[str] | None = ..., + titles: str | Sequence[str] | None = ..., aligned: bool = ..., - byteorder: None | _ByteOrder = ..., + byteorder: _ByteOrder | None = ..., copy: bool = ..., ) -> _RecArray[record]: ... def find_duplicate(list: Iterable[_T]) -> list[_T]: ... diff --git a/src/numpy-stubs/_core/strings.pyi b/src/numpy-stubs/_core/strings.pyi index b0340b52..6e36c16d 100644 --- a/src/numpy-stubs/_core/strings.pyi +++ b/src/numpy-stubs/_core/strings.pyi @@ -59,7 +59,7 @@ def add(x1: S_co, x2: S_co) -> NDArray[np.bytes_]: ... @overload def add(x1: _StringDTypeSupportsArray, x2: _StringDTypeSupportsArray) -> _StringDTypeArray: ... @overload -def add(x1: T_co, T_co) -> _StringDTypeOrUnicodeArray: ... +def add(x1: T_co, x2: T_co) -> _StringDTypeOrUnicodeArray: ... @overload def multiply(a: U_co, i: i_co) -> NDArray[np.str_]: ... @overload @@ -133,14 +133,14 @@ def index( a: U_co, sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.int_]: ... @overload def index( a: S_co, sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.int_]: ... @overload def index( @@ -154,14 +154,14 @@ def rindex( a: U_co, sub: U_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.int_]: ... @overload def rindex( a: S_co, sub: S_co, start: i_co = ..., - end: None | i_co = ..., + end: i_co | None = ..., ) -> NDArray[np.int_]: ... @overload def rindex( @@ -235,13 +235,13 @@ def endswith( ) -> NDArray[np.bool]: ... def decode( a: S_co, - encoding: None | str = ..., - errors: None | str = ..., + encoding: str | None = ..., + errors: str | None = ..., ) -> NDArray[np.str_]: ... def encode( a: U_co | T_co, - encoding: None | str = ..., - errors: None | str = ..., + encoding: str | None = ..., + errors: str | None = ..., ) -> NDArray[np.bytes_]: ... @overload def expandtabs(a: U_co, tabsize: i_co = ...) -> NDArray[np.str_]: ... @@ -292,29 +292,29 @@ def rjust( fillchar: T_co = ..., ) -> _StringDTypeOrUnicodeArray: ... @overload -def lstrip(a: U_co, chars: None | U_co = ...) -> NDArray[np.str_]: ... +def lstrip(a: U_co, chars: U_co | None = ...) -> NDArray[np.str_]: ... @overload -def lstrip(a: S_co, chars: None | S_co = ...) -> NDArray[np.bytes_]: ... +def lstrip(a: S_co, chars: S_co | None = ...) -> NDArray[np.bytes_]: ... @overload -def lstrip(a: _StringDTypeSupportsArray, chars: None | _StringDTypeSupportsArray = ...) -> _StringDTypeArray: ... +def lstrip(a: _StringDTypeSupportsArray, chars: _StringDTypeSupportsArray | None = ...) -> _StringDTypeArray: ... @overload -def lstrip(a: T_co, chars: None | T_co = ...) -> _StringDTypeOrUnicodeArray: ... +def lstrip(a: T_co, chars: T_co | None = ...) -> _StringDTypeOrUnicodeArray: ... @overload -def rstrip(a: U_co, char: None | U_co = ...) -> NDArray[np.str_]: ... +def rstrip(a: U_co, char: U_co | None = ...) -> NDArray[np.str_]: ... @overload -def rstrip(a: S_co, char: None | S_co = ...) -> NDArray[np.bytes_]: ... +def rstrip(a: S_co, char: S_co | None = ...) -> NDArray[np.bytes_]: ... @overload -def rstrip(a: _StringDTypeSupportsArray, chars: None | _StringDTypeSupportsArray = ...) -> _StringDTypeArray: ... +def rstrip(a: _StringDTypeSupportsArray, chars: _StringDTypeSupportsArray | None = ...) -> _StringDTypeArray: ... @overload -def rstrip(a: T_co, chars: None | T_co = ...) -> _StringDTypeOrUnicodeArray: ... +def rstrip(a: T_co, chars: T_co | None = ...) -> _StringDTypeOrUnicodeArray: ... @overload -def strip(a: U_co, chars: None | U_co = ...) -> NDArray[np.str_]: ... +def strip(a: U_co, chars: U_co | None = ...) -> NDArray[np.str_]: ... @overload -def strip(a: S_co, chars: None | S_co = ...) -> NDArray[np.bytes_]: ... +def strip(a: S_co, chars: S_co | None = ...) -> NDArray[np.bytes_]: ... @overload -def strip(a: _StringDTypeSupportsArray, chars: None | _StringDTypeSupportsArray = ...) -> _StringDTypeArray: ... +def strip(a: _StringDTypeSupportsArray, chars: _StringDTypeSupportsArray | None = ...) -> _StringDTypeArray: ... @overload -def strip(a: T_co, chars: None | T_co = ...) -> _StringDTypeOrUnicodeArray: ... +def strip(a: T_co, chars: T_co | None = ...) -> _StringDTypeOrUnicodeArray: ... @overload def zfill(a: U_co, width: i_co) -> NDArray[np.str_]: ... @overload @@ -419,23 +419,23 @@ def rpartition(a: T_co, sep: T_co) -> _StringDTypeOrUnicodeArray: ... def translate( a: U_co, table: str, - deletechars: None | str = ..., + deletechars: str | None = ..., ) -> NDArray[np.str_]: ... @overload def translate( a: S_co, table: str, - deletechars: None | str = ..., + deletechars: str | None = ..., ) -> NDArray[np.bytes_]: ... @overload def translate( a: _StringDTypeSupportsArray, table: str, - deletechars: None | str = ..., + deletechars: str | None = ..., ) -> _StringDTypeArray: ... @overload def translate( a: T_co, table: str, - deletechars: None | str = ..., + deletechars: str | None = ..., ) -> _StringDTypeOrUnicodeArray: ... diff --git a/src/numpy-stubs/_pytesttester.pyi b/src/numpy-stubs/_pytesttester.pyi index f5db633f..a12abb1c 100644 --- a/src/numpy-stubs/_pytesttester.pyi +++ b/src/numpy-stubs/_pytesttester.pyi @@ -10,9 +10,9 @@ class PytestTester: self, label: L["fast", "full"] = ..., verbose: int = ..., - extra_argv: None | Iterable[str] = ..., + extra_argv: Iterable[str] | None = ..., doctests: L[False] = ..., coverage: bool = ..., durations: int = ..., - tests: None | Iterable[str] = ..., + tests: Iterable[str] | None = ..., ) -> bool: ... diff --git a/src/numpy-stubs/ctypeslib/_ctypeslib.pyi b/src/numpy-stubs/ctypeslib/_ctypeslib.pyi index c003a38f..6f3523b4 100644 --- a/src/numpy-stubs/ctypeslib/_ctypeslib.pyi +++ b/src/numpy-stubs/ctypeslib/_ctypeslib.pyi @@ -67,7 +67,7 @@ __all__ = ["as_array", "as_ctypes", "as_ctypes_type", "c_intp", "load_library", # TODO: Add a proper `_Shape` bound once we've got variadic typevars _DType = TypeVar("_DType", bound=dtype[Any]) -_DTypeOptional = TypeVar("_DTypeOptional", bound=None | dtype[Any]) +_DTypeOptional = TypeVar("_DTypeOptional", bound=dtype[Any] | None) _SCT = TypeVar("_SCT", bound=generic) _FlagsKind: TypeAlias = L[ @@ -93,8 +93,8 @@ class _ndptr(ct.c_void_p, Generic[_DTypeOptional]): # returned by `ndpointer` _dtype_: ClassVar[_DTypeOptional] _shape_: ClassVar[None] - _ndim_: ClassVar[None | int] - _flags_: ClassVar[None | list[_FlagsKind]] + _ndim_: ClassVar[int | None] + _flags_: ClassVar[list[_FlagsKind] | None] @overload @classmethod @@ -117,8 +117,8 @@ c_intp = _c_intp def ndpointer( dtype: None = ..., ndim: int = ..., - shape: None | _ShapeLike = ..., - flags: None | _FlagsKind | Iterable[_FlagsKind] | int | flagsobj = ..., + shape: _ShapeLike | None = ..., + flags: _FlagsKind | Iterable[_FlagsKind] | int | flagsobj | None = ..., ) -> type[_ndptr[None]]: ... @overload def ndpointer( @@ -126,7 +126,7 @@ def ndpointer( ndim: int = ..., *, shape: _ShapeLike, - flags: None | _FlagsKind | Iterable[_FlagsKind] | int | flagsobj = ..., + flags: _FlagsKind | Iterable[_FlagsKind] | int | flagsobj | None = ..., ) -> type[_concrete_ndptr[dtype[_SCT]]]: ... @overload def ndpointer( @@ -134,21 +134,21 @@ def ndpointer( ndim: int = ..., *, shape: _ShapeLike, - flags: None | _FlagsKind | Iterable[_FlagsKind] | int | flagsobj = ..., + flags: _FlagsKind | Iterable[_FlagsKind] | int | flagsobj | None = ..., ) -> type[_concrete_ndptr[dtype[Any]]]: ... @overload def ndpointer( dtype: _DTypeLike[_SCT], ndim: int = ..., shape: None = ..., - flags: None | _FlagsKind | Iterable[_FlagsKind] | int | flagsobj = ..., + flags: _FlagsKind | Iterable[_FlagsKind] | int | flagsobj | None = ..., ) -> type[_ndptr[dtype[_SCT]]]: ... @overload def ndpointer( dtype: DTypeLike, ndim: int = ..., shape: None = ..., - flags: None | _FlagsKind | Iterable[_FlagsKind] | int | flagsobj = ..., + flags: _FlagsKind | Iterable[_FlagsKind] | int | flagsobj | None = ..., ) -> type[_ndptr[dtype[Any]]]: ... @overload def as_ctypes_type(dtype: _BoolCodes | _DTypeLike[np.bool] | type[ct.c_bool]) -> type[ct.c_bool]: ... @@ -187,9 +187,9 @@ def as_ctypes_type(dtype: str) -> type[Any]: ... @overload def as_array(obj: ct._PointerLike, shape: Sequence[int]) -> NDArray[Any]: ... @overload -def as_array(obj: _ArrayLike[_SCT], shape: None | _ShapeLike = ...) -> NDArray[_SCT]: ... +def as_array(obj: _ArrayLike[_SCT], shape: _ShapeLike | None = ...) -> NDArray[_SCT]: ... @overload -def as_array(obj: object, shape: None | _ShapeLike = ...) -> NDArray[Any]: ... +def as_array(obj: object, shape: _ShapeLike | None = ...) -> NDArray[Any]: ... @overload def as_ctypes(obj: np.bool) -> ct.c_bool: ... @overload diff --git a/src/numpy-stubs/exceptions.pyi b/src/numpy-stubs/exceptions.pyi index dc58ae70..2748a153 100644 --- a/src/numpy-stubs/exceptions.pyi +++ b/src/numpy-stubs/exceptions.pyi @@ -17,9 +17,9 @@ class TooHardError(RuntimeError): ... class DTypePromotionError(TypeError): ... class AxisError(ValueError, IndexError): - axis: None | int - ndim: None | int + axis: int | None + ndim: int | None @overload def __init__(self, axis: str, ndim: None = ..., msg_prefix: None = ...) -> None: ... @overload - def __init__(self, axis: int, ndim: int, msg_prefix: None | str = ...) -> None: ... + def __init__(self, axis: int, ndim: int, msg_prefix: str | None = ...) -> None: ... diff --git a/src/numpy-stubs/fft/_helper.pyi b/src/numpy-stubs/fft/_helper.pyi index a311df6b..d508ae1c 100644 --- a/src/numpy-stubs/fft/_helper.pyi +++ b/src/numpy-stubs/fft/_helper.pyi @@ -15,34 +15,34 @@ __all__ = ["fftfreq", "fftshift", "ifftshift", "rfftfreq"] _SCT = TypeVar("_SCT", bound=generic) @overload -def fftshift(x: _ArrayLike[_SCT], axes: None | _ShapeLike = ...) -> NDArray[_SCT]: ... +def fftshift(x: _ArrayLike[_SCT], axes: _ShapeLike | None = ...) -> NDArray[_SCT]: ... @overload -def fftshift(x: ArrayLike, axes: None | _ShapeLike = ...) -> NDArray[Any]: ... +def fftshift(x: ArrayLike, axes: _ShapeLike | None = ...) -> NDArray[Any]: ... @overload -def ifftshift(x: _ArrayLike[_SCT], axes: None | _ShapeLike = ...) -> NDArray[_SCT]: ... +def ifftshift(x: _ArrayLike[_SCT], axes: _ShapeLike | None = ...) -> NDArray[_SCT]: ... @overload -def ifftshift(x: ArrayLike, axes: None | _ShapeLike = ...) -> NDArray[Any]: ... +def ifftshift(x: ArrayLike, axes: _ShapeLike | None = ...) -> NDArray[Any]: ... @overload def fftfreq( n: int | integer[Any], d: _ArrayLikeFloat_co = ..., - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[floating[Any]]: ... @overload def fftfreq( n: int | integer[Any], d: _ArrayLikeComplex_co = ..., - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[complexfloating[Any, Any]]: ... @overload def rfftfreq( n: int | integer[Any], d: _ArrayLikeFloat_co = ..., - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[floating[Any]]: ... @overload def rfftfreq( n: int | integer[Any], d: _ArrayLikeComplex_co = ..., - device: None | L["cpu"] = ..., + device: L["cpu"] | None = ..., ) -> NDArray[complexfloating[Any, Any]]: ... diff --git a/src/numpy-stubs/fft/_pocketfft.pyi b/src/numpy-stubs/fft/_pocketfft.pyi index ed7de28a..20264b0c 100644 --- a/src/numpy-stubs/fft/_pocketfft.pyi +++ b/src/numpy-stubs/fft/_pocketfft.pyi @@ -25,101 +25,101 @@ _NormKind: TypeAlias = L["backward", "ortho", "forward"] | None def fft( a: ArrayLike, - n: None | int = ..., + n: int | None = ..., axis: int = ..., norm: _NormKind = ..., - out: None | NDArray[complex128] = ..., + out: NDArray[complex128] | None = ..., ) -> NDArray[complex128]: ... def ifft( a: ArrayLike, - n: None | int = ..., + n: int | None = ..., axis: int = ..., norm: _NormKind = ..., - out: None | NDArray[complex128] = ..., + out: NDArray[complex128] | None = ..., ) -> NDArray[complex128]: ... def rfft( a: ArrayLike, - n: None | int = ..., + n: int | None = ..., axis: int = ..., norm: _NormKind = ..., - out: None | NDArray[complex128] = ..., + out: NDArray[complex128] | None = ..., ) -> NDArray[complex128]: ... def irfft( a: ArrayLike, - n: None | int = ..., + n: int | None = ..., axis: int = ..., norm: _NormKind = ..., - out: None | NDArray[float64] = ..., + out: NDArray[float64] | None = ..., ) -> NDArray[float64]: ... # Input array must be compatible with `np.conjugate` def hfft( a: _ArrayLikeNumber_co, - n: None | int = ..., + n: int | None = ..., axis: int = ..., norm: _NormKind = ..., - out: None | NDArray[float64] = ..., + out: NDArray[float64] | None = ..., ) -> NDArray[float64]: ... def ihfft( a: ArrayLike, - n: None | int = ..., + n: int | None = ..., axis: int = ..., norm: _NormKind = ..., - out: None | NDArray[complex128] = ..., + out: NDArray[complex128] | None = ..., ) -> NDArray[complex128]: ... def fftn( a: ArrayLike, - s: None | Sequence[int] = ..., - axes: None | Sequence[int] = ..., + s: Sequence[int] | None = ..., + axes: Sequence[int] | None = ..., norm: _NormKind = ..., - out: None | NDArray[complex128] = ..., + out: NDArray[complex128] | None = ..., ) -> NDArray[complex128]: ... def ifftn( a: ArrayLike, - s: None | Sequence[int] = ..., - axes: None | Sequence[int] = ..., + s: Sequence[int] | None = ..., + axes: Sequence[int] | None = ..., norm: _NormKind = ..., - out: None | NDArray[complex128] = ..., + out: NDArray[complex128] | None = ..., ) -> NDArray[complex128]: ... def rfftn( a: ArrayLike, - s: None | Sequence[int] = ..., - axes: None | Sequence[int] = ..., + s: Sequence[int] | None = ..., + axes: Sequence[int] | None = ..., norm: _NormKind = ..., - out: None | NDArray[complex128] = ..., + out: NDArray[complex128] | None = ..., ) -> NDArray[complex128]: ... def irfftn( a: ArrayLike, - s: None | Sequence[int] = ..., - axes: None | Sequence[int] = ..., + s: Sequence[int] | None = ..., + axes: Sequence[int] | None = ..., norm: _NormKind = ..., - out: None | NDArray[float64] = ..., + out: NDArray[float64] | None = ..., ) -> NDArray[float64]: ... def fft2( a: ArrayLike, - s: None | Sequence[int] = ..., - axes: None | Sequence[int] = ..., + s: Sequence[int] | None = ..., + axes: Sequence[int] | None = ..., norm: _NormKind = ..., - out: None | NDArray[complex128] = ..., + out: NDArray[complex128] | None = ..., ) -> NDArray[complex128]: ... def ifft2( a: ArrayLike, - s: None | Sequence[int] = ..., - axes: None | Sequence[int] = ..., + s: Sequence[int] | None = ..., + axes: Sequence[int] | None = ..., norm: _NormKind = ..., - out: None | NDArray[complex128] = ..., + out: NDArray[complex128] | None = ..., ) -> NDArray[complex128]: ... def rfft2( a: ArrayLike, - s: None | Sequence[int] = ..., - axes: None | Sequence[int] = ..., + s: Sequence[int] | None = ..., + axes: Sequence[int] | None = ..., norm: _NormKind = ..., - out: None | NDArray[complex128] = ..., + out: NDArray[complex128] | None = ..., ) -> NDArray[complex128]: ... def irfft2( a: ArrayLike, - s: None | Sequence[int] = ..., - axes: None | Sequence[int] = ..., + s: Sequence[int] | None = ..., + axes: Sequence[int] | None = ..., norm: _NormKind = ..., - out: None | NDArray[float64] = ..., + out: NDArray[float64] | None = ..., ) -> NDArray[float64]: ... diff --git a/src/numpy-stubs/lib/_array_utils_impl.pyi b/src/numpy-stubs/lib/_array_utils_impl.pyi index fc241803..90254636 100644 --- a/src/numpy-stubs/lib/_array_utils_impl.pyi +++ b/src/numpy-stubs/lib/_array_utils_impl.pyi @@ -14,11 +14,11 @@ def byte_bounds(a: generic | NDArray[Any]) -> tuple[int, int]: ... def normalize_axis_tuple( axis: int | Iterable[int], ndim: int = ..., - argname: None | str = ..., - allow_duplicate: None | bool = ..., + argname: str | None = ..., + allow_duplicate: bool | None = ..., ) -> tuple[int, int]: ... def normalize_axis_index( axis: int = ..., ndim: int = ..., - msg_prefix: None | str = ..., + msg_prefix: str | None = ..., ) -> int: ... diff --git a/src/numpy-stubs/lib/_arraypad_impl.pyi b/src/numpy-stubs/lib/_arraypad_impl.pyi index 5796f2be..2105a1d3 100644 --- a/src/numpy-stubs/lib/_arraypad_impl.pyi +++ b/src/numpy-stubs/lib/_arraypad_impl.pyi @@ -55,7 +55,7 @@ def pad( pad_width: _ArrayLikeInt, mode: _ModeKind = ..., *, - stat_length: None | _ArrayLikeInt = ..., + stat_length: _ArrayLikeInt | None = ..., constant_values: ArrayLike = ..., end_values: ArrayLike = ..., reflect_type: L["odd", "even"] = ..., @@ -66,7 +66,7 @@ def pad( pad_width: _ArrayLikeInt, mode: _ModeKind = ..., *, - stat_length: None | _ArrayLikeInt = ..., + stat_length: _ArrayLikeInt | None = ..., constant_values: ArrayLike = ..., end_values: ArrayLike = ..., reflect_type: L["odd", "even"] = ..., diff --git a/src/numpy-stubs/lib/_arraysetops_impl.pyi b/src/numpy-stubs/lib/_arraysetops_impl.pyi index a100c19c..a70aa617 100644 --- a/src/numpy-stubs/lib/_arraysetops_impl.pyi +++ b/src/numpy-stubs/lib/_arraysetops_impl.pyi @@ -119,32 +119,32 @@ class UniqueInverseResult(NamedTuple, Generic[_SCT]): @overload def ediff1d( ary: _ArrayLikeBool_co, - to_end: None | ArrayLike = ..., - to_begin: None | ArrayLike = ..., + to_end: ArrayLike | None = ..., + to_begin: ArrayLike | None = ..., ) -> NDArray[int8]: ... @overload def ediff1d( ary: _ArrayLike[_NumberType], - to_end: None | ArrayLike = ..., - to_begin: None | ArrayLike = ..., + to_end: ArrayLike | None = ..., + to_begin: ArrayLike | None = ..., ) -> NDArray[_NumberType]: ... @overload def ediff1d( ary: _ArrayLikeNumber_co, - to_end: None | ArrayLike = ..., - to_begin: None | ArrayLike = ..., + to_end: ArrayLike | None = ..., + to_begin: ArrayLike | None = ..., ) -> NDArray[Any]: ... @overload def ediff1d( ary: _ArrayLikeDT64_co | _ArrayLikeTD64_co, - to_end: None | ArrayLike = ..., - to_begin: None | ArrayLike = ..., + to_end: ArrayLike | None = ..., + to_begin: ArrayLike | None = ..., ) -> NDArray[timedelta64]: ... @overload def ediff1d( ary: _ArrayLikeObject_co, - to_end: None | ArrayLike = ..., - to_begin: None | ArrayLike = ..., + to_end: ArrayLike | None = ..., + to_begin: ArrayLike | None = ..., ) -> NDArray[object_]: ... @overload def unique( @@ -152,7 +152,7 @@ def unique( return_index: L[False] = ..., return_inverse: L[False] = ..., return_counts: L[False] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> NDArray[_SCT]: ... @@ -162,7 +162,7 @@ def unique( return_index: L[False] = ..., return_inverse: L[False] = ..., return_counts: L[False] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> NDArray[Any]: ... @@ -172,7 +172,7 @@ def unique( return_index: L[True] = ..., return_inverse: L[False] = ..., return_counts: L[False] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[_SCT], NDArray[intp]]: ... @@ -182,7 +182,7 @@ def unique( return_index: L[True] = ..., return_inverse: L[False] = ..., return_counts: L[False] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[Any], NDArray[intp]]: ... @@ -192,7 +192,7 @@ def unique( return_index: L[False] = ..., return_inverse: L[True] = ..., return_counts: L[False] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[_SCT], NDArray[intp]]: ... @@ -202,7 +202,7 @@ def unique( return_index: L[False] = ..., return_inverse: L[True] = ..., return_counts: L[False] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[Any], NDArray[intp]]: ... @@ -212,7 +212,7 @@ def unique( return_index: L[False] = ..., return_inverse: L[False] = ..., return_counts: L[True] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[_SCT], NDArray[intp]]: ... @@ -222,7 +222,7 @@ def unique( return_index: L[False] = ..., return_inverse: L[False] = ..., return_counts: L[True] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[Any], NDArray[intp]]: ... @@ -232,7 +232,7 @@ def unique( return_index: L[True] = ..., return_inverse: L[True] = ..., return_counts: L[False] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[_SCT], NDArray[intp], NDArray[intp]]: ... @@ -242,7 +242,7 @@ def unique( return_index: L[True] = ..., return_inverse: L[True] = ..., return_counts: L[False] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[Any], NDArray[intp], NDArray[intp]]: ... @@ -252,7 +252,7 @@ def unique( return_index: L[True] = ..., return_inverse: L[False] = ..., return_counts: L[True] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[_SCT], NDArray[intp], NDArray[intp]]: ... @@ -262,7 +262,7 @@ def unique( return_index: L[True] = ..., return_inverse: L[False] = ..., return_counts: L[True] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[Any], NDArray[intp], NDArray[intp]]: ... @@ -272,7 +272,7 @@ def unique( return_index: L[False] = ..., return_inverse: L[True] = ..., return_counts: L[True] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[_SCT], NDArray[intp], NDArray[intp]]: ... @@ -282,7 +282,7 @@ def unique( return_index: L[False] = ..., return_inverse: L[True] = ..., return_counts: L[True] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[Any], NDArray[intp], NDArray[intp]]: ... @@ -292,7 +292,7 @@ def unique( return_index: L[True] = ..., return_inverse: L[True] = ..., return_counts: L[True] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[_SCT], NDArray[intp], NDArray[intp], NDArray[intp]]: ... @@ -302,7 +302,7 @@ def unique( return_index: L[True] = ..., return_inverse: L[True] = ..., return_counts: L[True] = ..., - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, equal_nan: bool = ..., ) -> tuple[NDArray[Any], NDArray[intp], NDArray[intp], NDArray[intp]]: ... @@ -368,7 +368,7 @@ def isin( assume_unique: bool = ..., invert: bool = ..., *, - kind: None | str = ..., + kind: str | None = ..., ) -> NDArray[np.bool]: ... @deprecated("Use 'isin' instead") def in1d( @@ -377,7 +377,7 @@ def in1d( assume_unique: bool = ..., invert: bool = ..., *, - kind: None | str = ..., + kind: str | None = ..., ) -> NDArray[np.bool]: ... @overload def union1d( diff --git a/src/numpy-stubs/lib/_arrayterator_impl.pyi b/src/numpy-stubs/lib/_arrayterator_impl.pyi index aefc54fd..80b074a5 100644 --- a/src/numpy-stubs/lib/_arrayterator_impl.pyi +++ b/src/numpy-stubs/lib/_arrayterator_impl.pyi @@ -25,7 +25,7 @@ _Index: TypeAlias = EllipsisType | int | slice | tuple[EllipsisType | int | slic class Arrayterator(ndarray[_Shape, _DType]): var: ndarray[_Shape, _DType] # type: ignore[assignment] - buf_size: None | int + buf_size: int | None start: list[int] stop: list[int] step: list[int] @@ -34,10 +34,10 @@ class Arrayterator(ndarray[_Shape, _DType]): def shape(self) -> tuple[int, ...]: ... @property def flat(self: NDArray[_ScalarType]) -> Generator[_ScalarType, None, None]: ... - def __init__(self, var: ndarray[_Shape, _DType], buf_size: None | int = ...) -> None: ... + def __init__(self, var: ndarray[_Shape, _DType], buf_size: int | None = ...) -> None: ... @overload - def __array__(self, dtype: None = ..., copy: None | bool = ...) -> ndarray[_AnyShape, _DType]: ... + def __array__(self, dtype: None = ..., copy: bool | None = ...) -> ndarray[_AnyShape, _DType]: ... @overload - def __array__(self, dtype: DTypeLike, copy: None | bool = ...) -> NDArray[Any]: ... + def __array__(self, dtype: DTypeLike, copy: bool | None = ...) -> NDArray[Any]: ... def __getitem__(self, index: _Index) -> Arrayterator[_AnyShape, _DType]: ... def __iter__(self) -> Iterator[ndarray[_AnyShape, _DType]]: ... diff --git a/src/numpy-stubs/lib/_format_impl.pyi b/src/numpy-stubs/lib/_format_impl.pyi index 8baeeab3..6ccd2a91 100644 --- a/src/numpy-stubs/lib/_format_impl.pyi +++ b/src/numpy-stubs/lib/_format_impl.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from typing import Final, Literal __all__: list[str] = [] @@ -9,16 +10,29 @@ ARRAY_ALIGN: Literal[64] BUFFER_SIZE: Literal[262144] # 2**18 GROWTH_AXIS_MAX_DIGITS: Literal[21] -def magic(major, minor): ... -def read_magic(fp): ... -def dtype_to_descr(dtype): ... -def descr_to_dtype(descr): ... -def header_data_from_array_1_0(array): ... -def write_array_header_1_0(fp, d): ... -def write_array_header_2_0(fp, d): ... -def read_array_header_1_0(fp): ... -def read_array_header_2_0(fp): ... -def write_array(fp, array, version=..., allow_pickle=..., pickle_kwargs=...): ... -def read_array(fp, allow_pickle=..., pickle_kwargs=...): ... -def open_memmap(filename, mode=..., dtype=..., shape=..., fortran_order=..., version=...): ... -def isfileobj(f): ... +def magic(major: Incomplete, minor: Incomplete) -> Incomplete: ... +def read_magic(fp: Incomplete) -> Incomplete: ... +def dtype_to_descr(dtype: Incomplete) -> Incomplete: ... +def descr_to_dtype(descr: Incomplete) -> Incomplete: ... +def header_data_from_array_1_0(array: Incomplete) -> Incomplete: ... +def write_array_header_1_0(fp: Incomplete, d: Incomplete) -> Incomplete: ... +def write_array_header_2_0(fp: Incomplete, d: Incomplete) -> Incomplete: ... +def read_array_header_1_0(fp: Incomplete) -> Incomplete: ... +def read_array_header_2_0(fp: Incomplete) -> Incomplete: ... +def write_array( + fp: Incomplete, + array: Incomplete, + version: Incomplete = ..., + allow_pickle: Incomplete = ..., + pickle_kwargs: Incomplete = ..., +) -> Incomplete: ... +def read_array(fp: Incomplete, allow_pickle: Incomplete = ..., pickle_kwargs: Incomplete = ...) -> Incomplete: ... +def open_memmap( + filename: Incomplete, + mode: Incomplete = ..., + dtype: Incomplete = ..., + shape: Incomplete = ..., + fortran_order: Incomplete = ..., + version: Incomplete = ..., +) -> Incomplete: ... +def isfileobj(f: Incomplete) -> Incomplete: ... diff --git a/src/numpy-stubs/lib/_function_base_impl.pyi b/src/numpy-stubs/lib/_function_base_impl.pyi index cba332d2..ab8ae9a9 100644 --- a/src/numpy-stubs/lib/_function_base_impl.pyi +++ b/src/numpy-stubs/lib/_function_base_impl.pyi @@ -129,15 +129,15 @@ def flip(m: _SCT, axis: None = ...) -> _SCT: ... @overload def flip(m: _ScalarLike_co, axis: None = ...) -> Any: ... @overload -def flip(m: _ArrayLike[_SCT], axis: None | _ShapeLike = ...) -> NDArray[_SCT]: ... +def flip(m: _ArrayLike[_SCT], axis: _ShapeLike | None = ...) -> NDArray[_SCT]: ... @overload -def flip(m: ArrayLike, axis: None | _ShapeLike = ...) -> NDArray[Any]: ... +def flip(m: ArrayLike, axis: _ShapeLike | None = ...) -> NDArray[Any]: ... def iterable(y: object) -> TypeGuard[Iterable[Any]]: ... @overload def average( a: _ArrayLikeFloat_co, axis: None = ..., - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., returned: L[False] = ..., keepdims: L[False] = ..., ) -> floating[Any]: ... @@ -145,7 +145,7 @@ def average( def average( a: _ArrayLikeComplex_co, axis: None = ..., - weights: None | _ArrayLikeComplex_co = ..., + weights: _ArrayLikeComplex_co | None = ..., returned: L[False] = ..., keepdims: L[False] = ..., ) -> complexfloating[Any, Any]: ... @@ -153,7 +153,7 @@ def average( def average( a: _ArrayLikeObject_co, axis: None = ..., - weights: None | Any = ..., + weights: Any | None = ..., returned: L[False] = ..., keepdims: L[False] = ..., ) -> Any: ... @@ -161,7 +161,7 @@ def average( def average( a: _ArrayLikeFloat_co, axis: None = ..., - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., returned: L[True] = ..., keepdims: L[False] = ..., ) -> _2Tuple[floating[Any]]: ... @@ -169,7 +169,7 @@ def average( def average( a: _ArrayLikeComplex_co, axis: None = ..., - weights: None | _ArrayLikeComplex_co = ..., + weights: _ArrayLikeComplex_co | None = ..., returned: L[True] = ..., keepdims: L[False] = ..., ) -> _2Tuple[complexfloating[Any, Any]]: ... @@ -177,23 +177,23 @@ def average( def average( a: _ArrayLikeObject_co, axis: None = ..., - weights: None | Any = ..., + weights: Any | None = ..., returned: L[True] = ..., keepdims: L[False] = ..., ) -> _2Tuple[Any]: ... @overload def average( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., - weights: None | Any = ..., + axis: _ShapeLike | None = ..., + weights: Any | None = ..., returned: L[False] = ..., keepdims: bool = ..., ) -> Any: ... @overload def average( a: _ArrayLikeComplex_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., - weights: None | Any = ..., + axis: _ShapeLike | None = ..., + weights: Any | None = ..., returned: L[True] = ..., keepdims: bool = ..., ) -> _2Tuple[Any]: ... @@ -272,7 +272,7 @@ def copy( def gradient( f: ArrayLike, *varargs: ArrayLike, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., edge_order: L[1, 2] = ..., ) -> Any: ... @overload @@ -383,7 +383,7 @@ def angle(z: _ArrayLikeObject_co, deg: bool = ...) -> NDArray[object_]: ... @overload def unwrap( p: _ArrayLikeFloat_co, - discont: None | float = ..., + discont: float | None = ..., axis: int = ..., *, period: float = ..., @@ -391,7 +391,7 @@ def unwrap( @overload def unwrap( p: _ArrayLikeObject_co, - discont: None | float = ..., + discont: float | None = ..., axis: int = ..., *, period: float = ..., @@ -409,48 +409,48 @@ def place(arr: NDArray[Any], mask: ArrayLike, vals: Any) -> None: ... @overload def cov( m: _ArrayLikeFloat_co, - y: None | _ArrayLikeFloat_co = ..., + y: _ArrayLikeFloat_co | None = ..., rowvar: bool = ..., bias: bool = ..., - ddof: None | SupportsIndex | SupportsInt = ..., - fweights: None | ArrayLike = ..., - aweights: None | ArrayLike = ..., + ddof: SupportsIndex | SupportsInt | None = ..., + fweights: ArrayLike | None = ..., + aweights: ArrayLike | None = ..., *, dtype: None = ..., ) -> NDArray[floating[Any]]: ... @overload def cov( m: _ArrayLikeComplex_co, - y: None | _ArrayLikeComplex_co = ..., + y: _ArrayLikeComplex_co | None = ..., rowvar: bool = ..., bias: bool = ..., - ddof: None | SupportsIndex | SupportsInt = ..., - fweights: None | ArrayLike = ..., - aweights: None | ArrayLike = ..., + ddof: SupportsIndex | SupportsInt | None = ..., + fweights: ArrayLike | None = ..., + aweights: ArrayLike | None = ..., *, dtype: None = ..., ) -> NDArray[complexfloating[Any, Any]]: ... @overload def cov( m: _ArrayLikeComplex_co, - y: None | _ArrayLikeComplex_co = ..., + y: _ArrayLikeComplex_co | None = ..., rowvar: bool = ..., bias: bool = ..., - ddof: None | SupportsIndex | SupportsInt = ..., - fweights: None | ArrayLike = ..., - aweights: None | ArrayLike = ..., + ddof: SupportsIndex | SupportsInt | None = ..., + fweights: ArrayLike | None = ..., + aweights: ArrayLike | None = ..., *, dtype: _DTypeLike[_SCT], ) -> NDArray[_SCT]: ... @overload def cov( m: _ArrayLikeComplex_co, - y: None | _ArrayLikeComplex_co = ..., + y: _ArrayLikeComplex_co | None = ..., rowvar: bool = ..., bias: bool = ..., - ddof: None | SupportsIndex | SupportsInt = ..., - fweights: None | ArrayLike = ..., - aweights: None | ArrayLike = ..., + ddof: SupportsIndex | SupportsInt | None = ..., + fweights: ArrayLike | None = ..., + aweights: ArrayLike | None = ..., *, dtype: DTypeLike, ) -> NDArray[Any]: ... @@ -459,7 +459,7 @@ def cov( @overload def corrcoef( m: _ArrayLikeFloat_co, - y: None | _ArrayLikeFloat_co = ..., + y: _ArrayLikeFloat_co | None = ..., rowvar: bool = ..., *, dtype: None = ..., @@ -467,7 +467,7 @@ def corrcoef( @overload def corrcoef( m: _ArrayLikeComplex_co, - y: None | _ArrayLikeComplex_co = ..., + y: _ArrayLikeComplex_co | None = ..., rowvar: bool = ..., *, dtype: None = ..., @@ -475,7 +475,7 @@ def corrcoef( @overload def corrcoef( m: _ArrayLikeComplex_co, - y: None | _ArrayLikeComplex_co = ..., + y: _ArrayLikeComplex_co | None = ..., rowvar: bool = ..., *, dtype: _DTypeLike[_SCT], @@ -483,7 +483,7 @@ def corrcoef( @overload def corrcoef( m: _ArrayLikeComplex_co, - y: None | _ArrayLikeComplex_co = ..., + y: _ArrayLikeComplex_co | None = ..., rowvar: bool = ..., *, dtype: DTypeLike, @@ -540,7 +540,7 @@ def median( @overload def median( a: _ArrayLikeFloat_co | _ArrayLikeComplex_co | _ArrayLikeTD64_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., out: None = ..., overwrite_input: bool = ..., keepdims: bool = ..., @@ -548,7 +548,7 @@ def median( @overload def median( a: _ArrayLikeFloat_co | _ArrayLikeComplex_co | _ArrayLikeTD64_co | _ArrayLikeObject_co, - axis: None | _ShapeLike, + axis: _ShapeLike | None, out: _ArrayType, /, overwrite_input: bool = ..., @@ -557,7 +557,7 @@ def median( @overload def median( a: _ArrayLikeFloat_co | _ArrayLikeComplex_co | _ArrayLikeTD64_co | _ArrayLikeObject_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., *, out: _ArrayType, overwrite_input: bool = ..., @@ -590,7 +590,7 @@ def percentile( method: _MethodKind = ..., keepdims: L[False] = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> floating[Any]: ... @overload def percentile( @@ -602,7 +602,7 @@ def percentile( method: _MethodKind = ..., keepdims: L[False] = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> complexfloating[Any, Any]: ... @overload def percentile( @@ -614,7 +614,7 @@ def percentile( method: _MethodKind = ..., keepdims: L[False] = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> timedelta64: ... @overload def percentile( @@ -626,7 +626,7 @@ def percentile( method: _MethodKind = ..., keepdims: L[False] = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> datetime64: ... @overload def percentile( @@ -638,7 +638,7 @@ def percentile( method: _MethodKind = ..., keepdims: L[False] = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> Any: ... @overload def percentile( @@ -650,7 +650,7 @@ def percentile( method: _MethodKind = ..., keepdims: L[False] = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> NDArray[floating[Any]]: ... @overload def percentile( @@ -662,7 +662,7 @@ def percentile( method: _MethodKind = ..., keepdims: L[False] = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> NDArray[complexfloating[Any, Any]]: ... @overload def percentile( @@ -674,7 +674,7 @@ def percentile( method: _MethodKind = ..., keepdims: L[False] = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> NDArray[timedelta64]: ... @overload def percentile( @@ -686,7 +686,7 @@ def percentile( method: _MethodKind = ..., keepdims: L[False] = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> NDArray[datetime64]: ... @overload def percentile( @@ -698,44 +698,44 @@ def percentile( method: _MethodKind = ..., keepdims: L[False] = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> NDArray[object_]: ... @overload def percentile( a: _ArrayLikeComplex_co | _ArrayLikeTD64_co | _ArrayLikeDT64_co | _ArrayLikeObject_co, q: _ArrayLikeFloat_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., out: None = ..., overwrite_input: bool = ..., method: _MethodKind = ..., keepdims: bool = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> Any: ... @overload def percentile( a: _ArrayLikeComplex_co | _ArrayLikeTD64_co | _ArrayLikeDT64_co | _ArrayLikeObject_co, q: _ArrayLikeFloat_co, - axis: None | _ShapeLike, + axis: _ShapeLike | None, out: _ArrayType, /, overwrite_input: bool = ..., method: _MethodKind = ..., keepdims: bool = ..., *, - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> _ArrayType: ... @overload def percentile( a: _ArrayLikeComplex_co | _ArrayLikeTD64_co | _ArrayLikeDT64_co | _ArrayLikeObject_co, q: _ArrayLikeFloat_co, - axis: None | _ShapeLike = ..., + axis: _ShapeLike | None = ..., *, out: _ArrayType, overwrite_input: bool = ..., method: _MethodKind = ..., keepdims: bool = ..., - weights: None | _ArrayLikeFloat_co = ..., + weights: _ArrayLikeFloat_co | None = ..., ) -> _ArrayType: ... # NOTE: Not an alias, but they do have identical signatures @@ -816,32 +816,32 @@ def meshgrid( def delete( arr: _ArrayLike[_SCT], obj: slice | _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., ) -> NDArray[_SCT]: ... @overload def delete( arr: ArrayLike, obj: slice | _ArrayLikeInt_co, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., ) -> NDArray[Any]: ... @overload def insert( arr: _ArrayLike[_SCT], obj: slice | _ArrayLikeInt_co, values: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., ) -> NDArray[_SCT]: ... @overload def insert( arr: ArrayLike, obj: slice | _ArrayLikeInt_co, values: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., ) -> NDArray[Any]: ... def append( arr: ArrayLike, values: ArrayLike, - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., ) -> NDArray[Any]: ... @overload def digitize( diff --git a/src/numpy-stubs/lib/_histograms_impl.pyi b/src/numpy-stubs/lib/_histograms_impl.pyi index d0a8dfd9..a5cb40e4 100644 --- a/src/numpy-stubs/lib/_histograms_impl.pyi +++ b/src/numpy-stubs/lib/_histograms_impl.pyi @@ -27,20 +27,20 @@ _BinKind: TypeAlias = L[ def histogram_bin_edges( a: ArrayLike, bins: _BinKind | SupportsIndex | ArrayLike = ..., - range: None | tuple[float, float] = ..., - weights: None | ArrayLike = ..., + range: tuple[float, float] | None = ..., + weights: ArrayLike | None = ..., ) -> NDArray[Any]: ... def histogram( a: ArrayLike, bins: _BinKind | SupportsIndex | ArrayLike = ..., - range: None | tuple[float, float] = ..., + range: tuple[float, float] | None = ..., density: bool = ..., - weights: None | ArrayLike = ..., + weights: ArrayLike | None = ..., ) -> tuple[NDArray[Any], NDArray[Any]]: ... def histogramdd( sample: ArrayLike, bins: SupportsIndex | ArrayLike = ..., range: Sequence[tuple[float, float]] = ..., - density: None | bool = ..., - weights: None | ArrayLike = ..., + density: bool | None = ..., + weights: ArrayLike | None = ..., ) -> tuple[NDArray[Any], tuple[NDArray[Any], ...]]: ... diff --git a/src/numpy-stubs/lib/_npyio_impl.pyi b/src/numpy-stubs/lib/_npyio_impl.pyi index db5351e6..8f362514 100644 --- a/src/numpy-stubs/lib/_npyio_impl.pyi +++ b/src/numpy-stubs/lib/_npyio_impl.pyi @@ -63,10 +63,10 @@ class BagObj(Generic[_T_co]): class NpzFile(Mapping[str, NDArray[Any]]): zip: zipfile.ZipFile - fid: None | IO[str] + fid: IO[str] | None files: list[str] allow_pickle: bool - pickle_kwargs: None | Mapping[str, Any] + pickle_kwargs: Mapping[str, Any] | None _MAX_REPR_ARRAY_COUNT: int # Represent `f` as a mutable property so we can access the type of `self` @property @@ -78,14 +78,14 @@ class NpzFile(Mapping[str, NDArray[Any]]): fid: IO[str], own_fid: bool = ..., allow_pickle: bool = ..., - pickle_kwargs: None | Mapping[str, Any] = ..., + pickle_kwargs: Mapping[str, Any] | None = ..., ) -> None: ... def __enter__(self) -> Self: ... def __exit__( self, - exc_type: None | type[BaseException], - exc_value: None | BaseException, - traceback: None | types.TracebackType, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: types.TracebackType | None, /, ) -> None: ... def close(self) -> None: ... @@ -107,8 +107,8 @@ class DataSource: self, path: str, mode: str = ..., - encoding: None | str = ..., - newline: None | str = ..., + encoding: str | None = ..., + newline: str | None = ..., ) -> IO[Any]: ... # NOTE: Returns a `NpzFile` if file is a zip file; @@ -162,52 +162,52 @@ def savez_compressed( def loadtxt( fname: StrPath | Iterable[str] | Iterable[bytes], dtype: None = ..., - comments: None | str | Sequence[str] = ..., - delimiter: None | str = ..., - converters: None | Mapping[int | str, Callable[[str], Any]] | Callable[[str], Any] = ..., + comments: str | Sequence[str] | None = ..., + delimiter: str | None = ..., + converters: Mapping[int | str, Callable[[str], Any]] | Callable[[str], Any] | None = ..., skiprows: int = ..., usecols: int | Sequence[int] | None = ..., unpack: bool = ..., ndmin: L[0, 1, 2] = ..., - encoding: None | str = ..., - max_rows: None | int = ..., + encoding: str | None = ..., + max_rows: int | None = ..., *, - quotechar: None | str = ..., - like: None | _SupportsArrayFunc = ..., + quotechar: str | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[float64]: ... @overload def loadtxt( fname: StrPath | Iterable[str] | Iterable[bytes], dtype: _DTypeLike[_SCT], - comments: None | str | Sequence[str] = ..., - delimiter: None | str = ..., - converters: None | Mapping[int | str, Callable[[str], Any]] | Callable[[str], Any] = ..., + comments: str | Sequence[str] | None = ..., + delimiter: str | None = ..., + converters: Mapping[int | str, Callable[[str], Any]] | Callable[[str], Any] | None = ..., skiprows: int = ..., usecols: int | Sequence[int] | None = ..., unpack: bool = ..., ndmin: L[0, 1, 2] = ..., - encoding: None | str = ..., - max_rows: None | int = ..., + encoding: str | None = ..., + max_rows: int | None = ..., *, - quotechar: None | str = ..., - like: None | _SupportsArrayFunc = ..., + quotechar: str | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def loadtxt( fname: StrPath | Iterable[str] | Iterable[bytes], dtype: DTypeLike, - comments: None | str | Sequence[str] = ..., - delimiter: None | str = ..., - converters: None | Mapping[int | str, Callable[[str], Any]] | Callable[[str], Any] = ..., + comments: str | Sequence[str] | None = ..., + delimiter: str | None = ..., + converters: Mapping[int | str, Callable[[str], Any]] | Callable[[str], Any] | None = ..., skiprows: int = ..., usecols: int | Sequence[int] | None = ..., unpack: bool = ..., ndmin: L[0, 1, 2] = ..., - encoding: None | str = ..., - max_rows: None | int = ..., + encoding: str | None = ..., + max_rows: int | None = ..., *, - quotechar: None | str = ..., - like: None | _SupportsArrayFunc = ..., + quotechar: str | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... def savetxt( fname: StrPath | SupportsWrite[str] | SupportsWrite[bytes], @@ -218,108 +218,108 @@ def savetxt( header: str = ..., footer: str = ..., comments: str = ..., - encoding: None | str = ..., + encoding: str | None = ..., ) -> None: ... @overload def fromregex( file: StrPath | SupportsRead[str] | SupportsRead[bytes], regexp: str | bytes | Pattern[Any], dtype: _DTypeLike[_SCT], - encoding: None | str = ..., + encoding: str | None = ..., ) -> NDArray[_SCT]: ... @overload def fromregex( file: StrPath | SupportsRead[str] | SupportsRead[bytes], regexp: str | bytes | Pattern[Any], dtype: DTypeLike, - encoding: None | str = ..., + encoding: str | None = ..., ) -> NDArray[Any]: ... @overload def genfromtxt( fname: StrPath | Iterable[str] | Iterable[bytes], dtype: None = ..., comments: str = ..., - delimiter: None | str | int | Iterable[int] = ..., + delimiter: str | int | Iterable[int] | None = ..., skip_header: int = ..., skip_footer: int = ..., - converters: None | Mapping[int | str, Callable[[str], Any]] = ..., + converters: Mapping[int | str, Callable[[str], Any]] | None = ..., missing_values: Any = ..., filling_values: Any = ..., - usecols: None | Sequence[int] = ..., + usecols: Sequence[int] | None = ..., names: L[True] | str | Collection[str] | None = ..., - excludelist: None | Sequence[str] = ..., + excludelist: Sequence[str] | None = ..., deletechars: str = ..., replace_space: str = ..., autostrip: bool = ..., case_sensitive: bool | L["upper", "lower"] = ..., defaultfmt: str = ..., - unpack: None | bool = ..., + unpack: bool | None = ..., usemask: bool = ..., loose: bool = ..., invalid_raise: bool = ..., - max_rows: None | int = ..., + max_rows: int | None = ..., encoding: str = ..., *, ndmin: L[0, 1, 2] = ..., - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def genfromtxt( fname: StrPath | Iterable[str] | Iterable[bytes], dtype: _DTypeLike[_SCT], comments: str = ..., - delimiter: None | str | int | Iterable[int] = ..., + delimiter: str | int | Iterable[int] | None = ..., skip_header: int = ..., skip_footer: int = ..., - converters: None | Mapping[int | str, Callable[[str], Any]] = ..., + converters: Mapping[int | str, Callable[[str], Any]] | None = ..., missing_values: Any = ..., filling_values: Any = ..., - usecols: None | Sequence[int] = ..., + usecols: Sequence[int] | None = ..., names: L[True] | str | Collection[str] | None = ..., - excludelist: None | Sequence[str] = ..., + excludelist: Sequence[str] | None = ..., deletechars: str = ..., replace_space: str = ..., autostrip: bool = ..., case_sensitive: bool | L["upper", "lower"] = ..., defaultfmt: str = ..., - unpack: None | bool = ..., + unpack: bool | None = ..., usemask: bool = ..., loose: bool = ..., invalid_raise: bool = ..., - max_rows: None | int = ..., + max_rows: int | None = ..., encoding: str = ..., *, ndmin: L[0, 1, 2] = ..., - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def genfromtxt( fname: StrPath | Iterable[str] | Iterable[bytes], dtype: DTypeLike, comments: str = ..., - delimiter: None | str | int | Iterable[int] = ..., + delimiter: str | int | Iterable[int] | None = ..., skip_header: int = ..., skip_footer: int = ..., - converters: None | Mapping[int | str, Callable[[str], Any]] = ..., + converters: Mapping[int | str, Callable[[str], Any]] | None = ..., missing_values: Any = ..., filling_values: Any = ..., - usecols: None | Sequence[int] = ..., + usecols: Sequence[int] | None = ..., names: L[True] | str | Collection[str] | None = ..., - excludelist: None | Sequence[str] = ..., + excludelist: Sequence[str] | None = ..., deletechars: str = ..., replace_space: str = ..., autostrip: bool = ..., case_sensitive: bool | L["upper", "lower"] = ..., defaultfmt: str = ..., - unpack: None | bool = ..., + unpack: bool | None = ..., usemask: bool = ..., loose: bool = ..., invalid_raise: bool = ..., - max_rows: None | int = ..., + max_rows: int | None = ..., encoding: str = ..., *, ndmin: L[0, 1, 2] = ..., - like: None | _SupportsArrayFunc = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def recfromtxt( diff --git a/src/numpy-stubs/lib/_polynomial_impl.pyi b/src/numpy-stubs/lib/_polynomial_impl.pyi index f8de4181..d14f2298 100644 --- a/src/numpy-stubs/lib/_polynomial_impl.pyi +++ b/src/numpy-stubs/lib/_polynomial_impl.pyi @@ -67,25 +67,25 @@ def roots(p: ArrayLike) -> NDArray[complexfloating[Any, Any]] | NDArray[floating def polyint( p: poly1d, m: SupportsInt | SupportsIndex = ..., - k: None | _ArrayLikeComplex_co | _ArrayLikeObject_co = ..., + k: _ArrayLikeComplex_co | _ArrayLikeObject_co | None = ..., ) -> poly1d: ... @overload def polyint( p: _ArrayLikeFloat_co, m: SupportsInt | SupportsIndex = ..., - k: None | _ArrayLikeFloat_co = ..., + k: _ArrayLikeFloat_co | None = ..., ) -> NDArray[floating[Any]]: ... @overload def polyint( p: _ArrayLikeComplex_co, m: SupportsInt | SupportsIndex = ..., - k: None | _ArrayLikeComplex_co = ..., + k: _ArrayLikeComplex_co | None = ..., ) -> NDArray[complexfloating[Any, Any]]: ... @overload def polyint( p: _ArrayLikeObject_co, m: SupportsInt | SupportsIndex = ..., - k: None | _ArrayLikeObject_co = ..., + k: _ArrayLikeObject_co | None = ..., ) -> NDArray[object_]: ... @overload def polyder( @@ -112,9 +112,9 @@ def polyfit( x: _ArrayLikeFloat_co, y: _ArrayLikeFloat_co, deg: SupportsIndex | SupportsInt, - rcond: None | float = ..., + rcond: float | None = ..., full: L[False] = ..., - w: None | _ArrayLikeFloat_co = ..., + w: _ArrayLikeFloat_co | None = ..., cov: L[False] = ..., ) -> NDArray[float64]: ... @overload @@ -122,9 +122,9 @@ def polyfit( x: _ArrayLikeComplex_co, y: _ArrayLikeComplex_co, deg: SupportsIndex | SupportsInt, - rcond: None | float = ..., + rcond: float | None = ..., full: L[False] = ..., - w: None | _ArrayLikeFloat_co = ..., + w: _ArrayLikeFloat_co | None = ..., cov: L[False] = ..., ) -> NDArray[complex128]: ... @overload @@ -132,9 +132,9 @@ def polyfit( x: _ArrayLikeFloat_co, y: _ArrayLikeFloat_co, deg: SupportsIndex | SupportsInt, - rcond: None | float = ..., + rcond: float | None = ..., full: L[False] = ..., - w: None | _ArrayLikeFloat_co = ..., + w: _ArrayLikeFloat_co | None = ..., cov: L[True, "unscaled"] = ..., ) -> _2Tup[NDArray[float64]]: ... @overload @@ -142,9 +142,9 @@ def polyfit( x: _ArrayLikeComplex_co, y: _ArrayLikeComplex_co, deg: SupportsIndex | SupportsInt, - rcond: None | float = ..., + rcond: float | None = ..., full: L[False] = ..., - w: None | _ArrayLikeFloat_co = ..., + w: _ArrayLikeFloat_co | None = ..., cov: L[True, "unscaled"] = ..., ) -> _2Tup[NDArray[complex128]]: ... @overload @@ -152,9 +152,9 @@ def polyfit( x: _ArrayLikeFloat_co, y: _ArrayLikeFloat_co, deg: SupportsIndex | SupportsInt, - rcond: None | float = ..., + rcond: float | None = ..., full: L[True] = ..., - w: None | _ArrayLikeFloat_co = ..., + w: _ArrayLikeFloat_co | None = ..., cov: bool | L["unscaled"] = ..., ) -> _5Tup[NDArray[float64]]: ... @overload @@ -162,9 +162,9 @@ def polyfit( x: _ArrayLikeComplex_co, y: _ArrayLikeComplex_co, deg: SupportsIndex | SupportsInt, - rcond: None | float = ..., + rcond: float | None = ..., full: L[True] = ..., - w: None | _ArrayLikeFloat_co = ..., + w: _ArrayLikeFloat_co | None = ..., cov: bool | L["unscaled"] = ..., ) -> _5Tup[NDArray[complex128]]: ... @overload diff --git a/src/numpy-stubs/lib/_shape_base_impl.pyi b/src/numpy-stubs/lib/_shape_base_impl.pyi index ff63cdf7..133264b9 100644 --- a/src/numpy-stubs/lib/_shape_base_impl.pyi +++ b/src/numpy-stubs/lib/_shape_base_impl.pyi @@ -62,7 +62,7 @@ class _ArrayWrap(Protocol): def __call__( self, array: NDArray[Any], - context: None | tuple[ufunc, tuple[Any, ...], int] = ..., + context: tuple[ufunc, tuple[Any, ...], int] | None = ..., return_scalar: bool = ..., /, ) -> Any: ... @@ -75,13 +75,13 @@ class _SupportsArrayWrap(Protocol): def take_along_axis( arr: _SCT | NDArray[_SCT], indices: NDArray[integer[Any]], - axis: None | int, + axis: int | None, ) -> NDArray[_SCT]: ... def put_along_axis( arr: NDArray[_SCT], indices: NDArray[integer[Any]], values: ArrayLike, - axis: None | int, + axis: int | None, ) -> None: ... @overload def apply_along_axis( @@ -179,7 +179,7 @@ def dsplit( @overload def get_array_wrap(*args: _SupportsArrayWrap) -> _ArrayWrap: ... @overload -def get_array_wrap(*args: object) -> None | _ArrayWrap: ... +def get_array_wrap(*args: object) -> _ArrayWrap | None: ... @overload def kron(a: _ArrayLikeBool_co, b: _ArrayLikeBool_co) -> NDArray[np.bool]: ... # type: ignore[misc] @overload diff --git a/src/numpy-stubs/lib/_stride_tricks_impl.pyi b/src/numpy-stubs/lib/_stride_tricks_impl.pyi index 0aba601d..23922295 100644 --- a/src/numpy-stubs/lib/_stride_tricks_impl.pyi +++ b/src/numpy-stubs/lib/_stride_tricks_impl.pyi @@ -10,26 +10,26 @@ _SCT = TypeVar("_SCT", bound=generic) class DummyArray: __array_interface__: dict[str, Any] - base: None | NDArray[Any] + base: NDArray[Any] | None def __init__( self, interface: dict[str, Any], - base: None | NDArray[Any] = ..., + base: NDArray[Any] | None = ..., ) -> None: ... @overload def as_strided( x: _ArrayLike[_SCT], - shape: None | Iterable[int] = ..., - strides: None | Iterable[int] = ..., + shape: Iterable[int] | None = ..., + strides: Iterable[int] | None = ..., subok: bool = ..., writeable: bool = ..., ) -> NDArray[_SCT]: ... @overload def as_strided( x: ArrayLike, - shape: None | Iterable[int] = ..., - strides: None | Iterable[int] = ..., + shape: Iterable[int] | None = ..., + strides: Iterable[int] | None = ..., subok: bool = ..., writeable: bool = ..., ) -> NDArray[Any]: ... @@ -37,7 +37,7 @@ def as_strided( def sliding_window_view( x: _ArrayLike[_SCT], window_shape: int | Iterable[int], - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, subok: bool = ..., writeable: bool = ..., @@ -46,7 +46,7 @@ def sliding_window_view( def sliding_window_view( x: ArrayLike, window_shape: int | Iterable[int], - axis: None | SupportsIndex = ..., + axis: SupportsIndex | None = ..., *, subok: bool = ..., writeable: bool = ..., diff --git a/src/numpy-stubs/lib/_twodim_base_impl.pyi b/src/numpy-stubs/lib/_twodim_base_impl.pyi index 16ca3bfd..c00b002a 100644 --- a/src/numpy-stubs/lib/_twodim_base_impl.pyi +++ b/src/numpy-stubs/lib/_twodim_base_impl.pyi @@ -75,35 +75,35 @@ def flipud(m: ArrayLike) -> NDArray[Any]: ... @overload def eye( N: int, - M: None | int = ..., + M: int | None = ..., k: int = ..., dtype: None = ..., order: _OrderCF = ..., *, - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[float64]: ... @overload def eye( N: int, - M: None | int = ..., + M: int | None = ..., k: int = ..., dtype: _DTypeLike[_SCT] = ..., order: _OrderCF = ..., *, - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[_SCT]: ... @overload def eye( N: int, - M: None | int = ..., + M: int | None = ..., k: int = ..., dtype: DTypeLike = ..., order: _OrderCF = ..., *, - device: None | L["cpu"] = ..., - like: None | _SupportsArrayFunc = ..., + device: L["cpu"] | None = ..., + like: _SupportsArrayFunc | None = ..., ) -> NDArray[Any]: ... @overload def diag(v: _ArrayLike[_SCT], k: int = ...) -> NDArray[_SCT]: ... @@ -115,15 +115,15 @@ def diagflat(v: _ArrayLike[_SCT], k: int = ...) -> NDArray[_SCT]: ... def diagflat(v: ArrayLike, k: int = ...) -> NDArray[Any]: ... @overload def tri( - N: int, M: None | int = ..., k: int = ..., dtype: None = ..., *, like: None | _SupportsArrayFunc = ... + N: int, M: int | None = ..., k: int = ..., dtype: None = ..., *, like: _SupportsArrayFunc | None = ... ) -> NDArray[float64]: ... @overload def tri( - N: int, M: None | int = ..., k: int = ..., dtype: _DTypeLike[_SCT] = ..., *, like: None | _SupportsArrayFunc = ... + N: int, M: int | None = ..., k: int = ..., dtype: _DTypeLike[_SCT] = ..., *, like: _SupportsArrayFunc | None = ... ) -> NDArray[_SCT]: ... @overload def tri( - N: int, M: None | int = ..., k: int = ..., dtype: DTypeLike = ..., *, like: None | _SupportsArrayFunc = ... + N: int, M: int | None = ..., k: int = ..., dtype: DTypeLike = ..., *, like: _SupportsArrayFunc | None = ... ) -> NDArray[Any]: ... @overload def tril(v: _ArrayLike[_SCT], k: int = ...) -> NDArray[_SCT]: ... @@ -136,25 +136,25 @@ def triu(v: ArrayLike, k: int = ...) -> NDArray[Any]: ... @overload def vander( # type: ignore[misc] x: _ArrayLikeInt_co, - N: None | int = ..., + N: int | None = ..., increasing: bool = ..., ) -> NDArray[signedinteger[Any]]: ... @overload def vander( # type: ignore[misc] x: _ArrayLikeFloat_co, - N: None | int = ..., + N: int | None = ..., increasing: bool = ..., ) -> NDArray[floating[Any]]: ... @overload def vander( x: _ArrayLikeComplex_co, - N: None | int = ..., + N: int | None = ..., increasing: bool = ..., ) -> NDArray[complexfloating[Any, Any]]: ... @overload def vander( x: _ArrayLikeObject_co, - N: None | int = ..., + N: int | None = ..., increasing: bool = ..., ) -> NDArray[object_]: ... @@ -179,9 +179,9 @@ def histogram2d( x: _ArrayLike1D[_SCT_complex], y: _ArrayLike1D[_SCT_complex | _Float_co], bins: int | Sequence[int] = ..., - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[_SCT_complex], @@ -192,9 +192,9 @@ def histogram2d( x: _ArrayLike1D[_SCT_complex | _Float_co], y: _ArrayLike1D[_SCT_complex], bins: int | Sequence[int] = ..., - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[_SCT_complex], @@ -205,9 +205,9 @@ def histogram2d( x: _ArrayLike1D[_SCT_inexact], y: _ArrayLike1D[_SCT_inexact | _Int_co], bins: int | Sequence[int] = ..., - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[_SCT_inexact], @@ -218,9 +218,9 @@ def histogram2d( x: _ArrayLike1D[_SCT_inexact | _Int_co], y: _ArrayLike1D[_SCT_inexact], bins: int | Sequence[int] = ..., - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[_SCT_inexact], @@ -231,9 +231,9 @@ def histogram2d( x: _ArrayLike1DInt_co | Sequence[float | int], y: _ArrayLike1DInt_co | Sequence[float | int], bins: int | Sequence[int] = ..., - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[float64], @@ -244,9 +244,9 @@ def histogram2d( x: Sequence[complex | float | int], y: Sequence[complex | float | int], bins: int | Sequence[int] = ..., - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[complex128 | float64], @@ -257,9 +257,9 @@ def histogram2d( x: _ArrayLike1DNumber_co, y: _ArrayLike1DNumber_co, bins: _ArrayLike1D[_SCT_number_co] | Sequence[_ArrayLike1D[_SCT_number_co]], - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[_SCT_number_co], @@ -270,9 +270,9 @@ def histogram2d( x: _ArrayLike1D[_SCT_inexact], y: _ArrayLike1D[_SCT_inexact], bins: Sequence[_ArrayLike1D[_SCT_number_co] | int], - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[_SCT_number_co | _SCT_inexact], @@ -283,9 +283,9 @@ def histogram2d( x: _ArrayLike1DInt_co | Sequence[float | int], y: _ArrayLike1DInt_co | Sequence[float | int], bins: Sequence[_ArrayLike1D[_SCT_number_co] | int], - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[_SCT_number_co | float64], @@ -296,9 +296,9 @@ def histogram2d( x: Sequence[complex | float | int], y: Sequence[complex | float | int], bins: Sequence[_ArrayLike1D[_SCT_number_co] | int], - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[_SCT_number_co | complex128 | float64], @@ -309,9 +309,9 @@ def histogram2d( x: _ArrayLike1DNumber_co, y: _ArrayLike1DNumber_co, bins: Sequence[Sequence[bool]], - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[np.bool], @@ -322,9 +322,9 @@ def histogram2d( x: _ArrayLike1DNumber_co, y: _ArrayLike1DNumber_co, bins: Sequence[Sequence[int | bool]], - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[np.int_ | np.bool], @@ -335,9 +335,9 @@ def histogram2d( x: _ArrayLike1DNumber_co, y: _ArrayLike1DNumber_co, bins: Sequence[Sequence[float | int | bool]], - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[np.float64 | np.int_ | np.bool], @@ -348,9 +348,9 @@ def histogram2d( x: _ArrayLike1DNumber_co, y: _ArrayLike1DNumber_co, bins: Sequence[Sequence[complex | float | int | bool]], - range: None | _ArrayLike2DFloat_co = ..., - density: None | bool = ..., - weights: None | _ArrayLike1DFloat_co = ..., + range: _ArrayLike2DFloat_co | None = ..., + density: bool | None = ..., + weights: _ArrayLike1DFloat_co | None = ..., ) -> tuple[ NDArray[float64], NDArray[np.complex128 | np.float64 | np.int_ | np.bool], @@ -375,7 +375,7 @@ def mask_indices( def tril_indices( n: int, k: int = ..., - m: None | int = ..., + m: int | None = ..., ) -> tuple[NDArray[int_], NDArray[int_]]: ... def tril_indices_from( arr: NDArray[Any], @@ -384,7 +384,7 @@ def tril_indices_from( def triu_indices( n: int, k: int = ..., - m: None | int = ..., + m: int | None = ..., ) -> tuple[NDArray[int_], NDArray[int_]]: ... def triu_indices_from( arr: NDArray[Any], diff --git a/src/numpy-stubs/lib/_type_check_impl.pyi b/src/numpy-stubs/lib/_type_check_impl.pyi index 9d319f35..b59a44fb 100644 --- a/src/numpy-stubs/lib/_type_check_impl.pyi +++ b/src/numpy-stubs/lib/_type_check_impl.pyi @@ -68,32 +68,32 @@ def nan_to_num( # type: ignore[misc] x: _SCT, copy: bool = ..., nan: float = ..., - posinf: None | float = ..., - neginf: None | float = ..., + posinf: float | None = ..., + neginf: float | None = ..., ) -> _SCT: ... @overload def nan_to_num( x: _ScalarLike_co, copy: bool = ..., nan: float = ..., - posinf: None | float = ..., - neginf: None | float = ..., + posinf: float | None = ..., + neginf: float | None = ..., ) -> Any: ... @overload def nan_to_num( x: _ArrayLike[_SCT], copy: bool = ..., nan: float = ..., - posinf: None | float = ..., - neginf: None | float = ..., + posinf: float | None = ..., + neginf: float | None = ..., ) -> NDArray[_SCT]: ... @overload def nan_to_num( x: ArrayLike, copy: bool = ..., nan: float = ..., - posinf: None | float = ..., - neginf: None | float = ..., + posinf: float | None = ..., + neginf: float | None = ..., ) -> NDArray[Any]: ... # If one passes a complex array to `real_if_close`, then one is reasonably diff --git a/src/numpy-stubs/linalg/_linalg.pyi b/src/numpy-stubs/linalg/_linalg.pyi index 0de7e134..3a41cfee 100644 --- a/src/numpy-stubs/linalg/_linalg.pyi +++ b/src/numpy-stubs/linalg/_linalg.pyi @@ -112,19 +112,19 @@ class SVDResult(NamedTuple): def tensorsolve( a: _ArrayLikeInt_co, b: _ArrayLikeInt_co, - axes: None | Iterable[int] = ..., + axes: Iterable[int] | None = ..., ) -> NDArray[float64]: ... @overload def tensorsolve( a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, - axes: None | Iterable[int] = ..., + axes: Iterable[int] | None = ..., ) -> NDArray[floating[Any]]: ... @overload def tensorsolve( a: _ArrayLikeComplex_co, b: _ArrayLikeComplex_co, - axes: None | Iterable[int] = ..., + axes: Iterable[int] | None = ..., ) -> NDArray[complexfloating[Any, Any]]: ... @overload def solve( @@ -279,15 +279,15 @@ def svdvals(x: _ArrayLikeInt_co | _ArrayLikeFloat_co | _ArrayLikeComplex_co) -> # TODO: Returns a scalar for 2D arrays and # a `(x.ndim - 2)`` dimensionl array otherwise -def cond(x: _ArrayLikeComplex_co, p: None | float | L["fro", "nuc"] = ...) -> Any: ... +def cond(x: _ArrayLikeComplex_co, p: float | L["fro", "nuc"] | None = ...) -> Any: ... # TODO: Returns `int` for <2D arrays and `intp` otherwise def matrix_rank( A: _ArrayLikeComplex_co, - tol: None | _ArrayLikeFloat_co = ..., + tol: _ArrayLikeFloat_co | None = ..., hermitian: bool = ..., *, - rtol: None | _ArrayLikeFloat_co = ..., + rtol: _ArrayLikeFloat_co | None = ..., ) -> Any: ... @overload def pinv( @@ -317,7 +317,7 @@ def slogdet(a: _ArrayLikeComplex_co) -> SlogdetResult: ... def det(a: _ArrayLikeComplex_co) -> Any: ... @overload def lstsq( - a: _ArrayLikeInt_co, b: _ArrayLikeInt_co, rcond: None | float = ... + a: _ArrayLikeInt_co, b: _ArrayLikeInt_co, rcond: float | None = ... ) -> tuple[ NDArray[float64], NDArray[float64], @@ -326,7 +326,7 @@ def lstsq( ]: ... @overload def lstsq( - a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, rcond: None | float = ... + a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, rcond: float | None = ... ) -> tuple[ NDArray[floating[Any]], NDArray[floating[Any]], @@ -335,7 +335,7 @@ def lstsq( ]: ... @overload def lstsq( - a: _ArrayLikeComplex_co, b: _ArrayLikeComplex_co, rcond: None | float = ... + a: _ArrayLikeComplex_co, b: _ArrayLikeComplex_co, rcond: float | None = ... ) -> tuple[ NDArray[complexfloating[Any, Any]], NDArray[floating[Any]], @@ -345,41 +345,41 @@ def lstsq( @overload def norm( x: ArrayLike, - ord: None | float | L["fro", "nuc"] = ..., + ord: float | L["fro", "nuc"] | None = ..., axis: None = ..., keepdims: bool = ..., ) -> floating[Any]: ... @overload def norm( x: ArrayLike, - ord: None | float | L["fro", "nuc"] = ..., + ord: float | L["fro", "nuc"] | None = ..., axis: SupportsInt | SupportsIndex | tuple[int, ...] = ..., keepdims: bool = ..., ) -> Any: ... @overload def matrix_norm( x: ArrayLike, - ord: None | float | L["fro", "nuc"] = ..., + ord: float | L["fro", "nuc"] | None = ..., keepdims: bool = ..., ) -> floating[Any]: ... @overload def matrix_norm( x: ArrayLike, - ord: None | float | L["fro", "nuc"] = ..., + ord: float | L["fro", "nuc"] | None = ..., keepdims: bool = ..., ) -> Any: ... @overload def vector_norm( x: ArrayLike, axis: None = ..., - ord: None | float = ..., + ord: float | None = ..., keepdims: bool = ..., ) -> floating[Any]: ... @overload def vector_norm( x: ArrayLike, axis: SupportsInt | SupportsIndex | tuple[int, ...] = ..., - ord: None | float = ..., + ord: float | None = ..., keepdims: bool = ..., ) -> Any: ... @@ -387,7 +387,7 @@ def vector_norm( def multi_dot( arrays: Iterable[_ArrayLikeComplex_co | _ArrayLikeObject_co | _ArrayLikeTD64_co], *, - out: None | NDArray[Any] = ..., + out: NDArray[Any] | None = ..., ) -> Any: ... def diagonal( x: ArrayLike, # >= 2D array diff --git a/src/numpy-stubs/ma/core.pyi b/src/numpy-stubs/ma/core.pyi index d7f9cc39..b6e29919 100644 --- a/src/numpy-stubs/ma/core.pyi +++ b/src/numpy-stubs/ma/core.pyi @@ -1,5 +1,7 @@ +from _typeshed import Incomplete from collections.abc import Callable from typing import Any, TypeVar +from typing_extensions import Self from numpy import ( amax, @@ -206,45 +208,45 @@ class MaskedArrayFutureWarning(FutureWarning): ... class MAError(Exception): ... class MaskError(MAError): ... -def default_fill_value(obj): ... -def minimum_fill_value(obj): ... -def maximum_fill_value(obj): ... -def set_fill_value(a, fill_value): ... -def common_fill_value(a, b): ... -def filled(a, fill_value=...): ... -def getdata(a, subok=...): ... +def default_fill_value(obj: Incomplete) -> Incomplete: ... +def minimum_fill_value(obj: Incomplete) -> Incomplete: ... +def maximum_fill_value(obj: Incomplete) -> Incomplete: ... +def set_fill_value(a: Incomplete, fill_value: Incomplete) -> Incomplete: ... +def common_fill_value(a: Incomplete, b: Incomplete) -> Incomplete: ... +def filled(a: Incomplete, fill_value: Incomplete = ...) -> Incomplete: ... +def getdata(a: Incomplete, subok: Incomplete = ...) -> Incomplete: ... get_data = getdata -def fix_invalid(a, mask=..., copy=..., fill_value=...): ... +def fix_invalid(a: Incomplete, mask: Incomplete = ..., copy: Incomplete = ..., fill_value: Incomplete = ...) -> Incomplete: ... class _MaskedUFunc: f: Any __doc__: Any __name__: Any - def __init__(self, ufunc) -> None: ... + def __init__(self, ufunc: Incomplete) -> None: ... class _MaskedUnaryOperation(_MaskedUFunc): fill: Any domain: Any - def __init__(self, mufunc, fill=..., domain=...) -> None: ... - def __call__(self, a, *args, **kwargs): ... + def __init__(self, mufunc: Incomplete, fill: Incomplete = ..., domain: Incomplete = ...) -> None: ... + def __call__(self, a: Incomplete, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... class _MaskedBinaryOperation(_MaskedUFunc): fillx: Any filly: Any - def __init__(self, mbfunc, fillx=..., filly=...) -> None: ... - def __call__(self, a, b, *args, **kwargs): ... - def reduce(self, target, axis=..., dtype=...): ... - def outer(self, a, b): ... - def accumulate(self, target, axis=...): ... + def __init__(self, mbfunc: Incomplete, fillx: Incomplete = ..., filly: Incomplete = ...) -> None: ... + def __call__(self, a: Incomplete, b: Incomplete, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... + def reduce(self, target: Incomplete, axis: Incomplete = ..., dtype: Incomplete = ...) -> Incomplete: ... + def outer(self, a: Incomplete, b: Incomplete) -> Incomplete: ... + def accumulate(self, target: Incomplete, axis: Incomplete = ...) -> Incomplete: ... class _DomainedBinaryOperation(_MaskedUFunc): domain: Any fillx: Any filly: Any - def __init__(self, dbfunc, domain, fillx=..., filly=...) -> None: ... - def __call__(self, a, b, *args, **kwargs): ... + def __init__(self, dbfunc: Incomplete, domain: Incomplete, fillx: Incomplete = ..., filly: Incomplete = ...) -> None: ... + def __call__(self, a: Incomplete, b: Incomplete, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... exp: _MaskedUnaryOperation conjugate: _MaskedUnaryOperation @@ -299,181 +301,273 @@ remainder: _MaskedBinaryOperation fmod: _MaskedBinaryOperation mod: _MaskedBinaryOperation -def make_mask_descr(ndtype): ... -def getmask(a): ... +def make_mask_descr(ndtype: Incomplete) -> Incomplete: ... +def getmask(a: Incomplete) -> Incomplete: ... get_mask = getmask -def getmaskarray(arr): ... -def is_mask(m): ... -def make_mask(m, copy=..., shrink=..., dtype=...): ... -def make_mask_none(newshape, dtype=...): ... -def mask_or(m1, m2, copy=..., shrink=...): ... -def flatten_mask(mask): ... -def masked_where(condition, a, copy=...): ... -def masked_greater(x, value, copy=...): ... -def masked_greater_equal(x, value, copy=...): ... -def masked_less(x, value, copy=...): ... -def masked_less_equal(x, value, copy=...): ... -def masked_not_equal(x, value, copy=...): ... -def masked_equal(x, value, copy=...): ... -def masked_inside(x, v1, v2, copy=...): ... -def masked_outside(x, v1, v2, copy=...): ... -def masked_object(x, value, copy=..., shrink=...): ... -def masked_values(x, value, rtol=..., atol=..., copy=..., shrink=...): ... -def masked_invalid(a, copy=...): ... +def getmaskarray(arr: Incomplete) -> Incomplete: ... +def is_mask(m: Incomplete) -> Incomplete: ... +def make_mask(m: Incomplete, copy: Incomplete = ..., shrink: Incomplete = ..., dtype: Incomplete = ...) -> Incomplete: ... +def make_mask_none(newshape: Incomplete, dtype: Incomplete = ...) -> Incomplete: ... +def mask_or(m1: Incomplete, m2: Incomplete, copy: Incomplete = ..., shrink: Incomplete = ...) -> Incomplete: ... +def flatten_mask(mask: Incomplete) -> Incomplete: ... +def masked_where(condition: Incomplete, a: Incomplete, copy: Incomplete = ...) -> Incomplete: ... +def masked_greater(x: Incomplete, value: Incomplete, copy: Incomplete = ...) -> Incomplete: ... +def masked_greater_equal(x: Incomplete, value: Incomplete, copy: Incomplete = ...) -> Incomplete: ... +def masked_less(x: Incomplete, value: Incomplete, copy: Incomplete = ...) -> Incomplete: ... +def masked_less_equal(x: Incomplete, value: Incomplete, copy: Incomplete = ...) -> Incomplete: ... +def masked_not_equal(x: Incomplete, value: Incomplete, copy: Incomplete = ...) -> Incomplete: ... +def masked_equal(x: Incomplete, value: Incomplete, copy: Incomplete = ...) -> Incomplete: ... +def masked_inside(x: Incomplete, v1: Incomplete, v2: Incomplete, copy: Incomplete = ...) -> Incomplete: ... +def masked_outside(x: Incomplete, v1: Incomplete, v2: Incomplete, copy: Incomplete = ...) -> Incomplete: ... +def masked_object(x: Incomplete, value: Incomplete, copy: Incomplete = ..., shrink: Incomplete = ...) -> Incomplete: ... +def masked_values( + x: Incomplete, + value: Incomplete, + rtol: Incomplete = ..., + atol: Incomplete = ..., + copy: Incomplete = ..., + shrink: Incomplete = ..., +) -> Incomplete: ... +def masked_invalid(a: Incomplete, copy: Incomplete = ...) -> Incomplete: ... class _MaskedPrintOption: - def __init__(self, display) -> None: ... - def display(self): ... - def set_display(self, s): ... - def enabled(self): ... - def enable(self, shrink=...): ... + def __init__(self, display: Incomplete) -> None: ... + def display(self) -> Incomplete: ... + def set_display(self, s: Incomplete) -> Incomplete: ... + def enabled(self) -> Incomplete: ... + def enable(self, shrink: Incomplete = ...) -> Incomplete: ... masked_print_option: _MaskedPrintOption -def flatten_structured_array(a): ... +def flatten_structured_array(a: Incomplete) -> Incomplete: ... class MaskedIterator: ma: Any dataiter: Any maskiter: Any - def __init__(self, ma) -> None: ... - def __iter__(self): ... - def __getitem__(self, indx): ... - def __setitem__(self, index, value) -> None: ... - def __next__(self): ... + def __init__(self, ma: Incomplete) -> None: ... + def __iter__(self) -> Incomplete: ... + def __getitem__(self, indx: Incomplete) -> Incomplete: ... + def __setitem__(self, index: Incomplete, value: Incomplete) -> None: ... + def __next__(self) -> Incomplete: ... class MaskedArray(ndarray[_ShapeType_co, _DType_co]): __array_priority__: Any def __new__( cls, - data=..., - mask=..., - dtype=..., - copy=..., - subok=..., - ndmin=..., - fill_value=..., - keep_mask=..., - hard_mask=..., - shrink=..., - order=..., - ): ... - def __array_finalize__(self, obj): ... - def __array_wrap__(self, obj, context=..., return_scalar=...): ... - def view(self, dtype=..., type=..., fill_value=...): ... - def __getitem__(self, indx): ... - def __setitem__(self, indx, value) -> None: ... + data: Incomplete = ..., + mask: Incomplete = ..., + dtype: Incomplete = ..., + copy: Incomplete = ..., + subok: Incomplete = ..., + ndmin: Incomplete = ..., + fill_value: Incomplete = ..., + keep_mask: Incomplete = ..., + hard_mask: Incomplete = ..., + shrink: Incomplete = ..., + order: Incomplete = ..., + ) -> Incomplete: ... + def __array_finalize__(self, obj: Incomplete) -> Incomplete: ... + def __array_wrap__(self, obj: Incomplete, context: Incomplete = ..., return_scalar: Incomplete = ...) -> Incomplete: ... + def view(self, dtype: Incomplete = ..., type: Incomplete = ..., fill_value: Incomplete = ...) -> Incomplete: ... + def __getitem__(self, indx: Incomplete) -> Incomplete: ... + def __setitem__(self, indx: Incomplete, value: Incomplete) -> None: ... @property - def dtype(self): ... + def dtype(self) -> Incomplete: ... @dtype.setter - def dtype(self, dtype): ... + def dtype(self, dtype: Incomplete) -> Incomplete: ... @property - def shape(self): ... + def shape(self) -> Incomplete: ... @shape.setter - def shape(self, shape): ... - def __setmask__(self, mask, copy=...): ... + def shape(self, shape: Incomplete) -> Incomplete: ... + def __setmask__(self, mask: Incomplete, copy: Incomplete = ...) -> Incomplete: ... @property - def mask(self): ... + def mask(self) -> Incomplete: ... @mask.setter - def mask(self, value): ... + def mask(self, value: Incomplete) -> Incomplete: ... @property - def recordmask(self): ... + def recordmask(self) -> Incomplete: ... @recordmask.setter - def recordmask(self, mask): ... - def harden_mask(self): ... - def soften_mask(self): ... + def recordmask(self, mask: Incomplete) -> Incomplete: ... + def harden_mask(self) -> Incomplete: ... + def soften_mask(self) -> Incomplete: ... @property - def hardmask(self): ... - def unshare_mask(self): ... + def hardmask(self) -> Incomplete: ... + def unshare_mask(self) -> Incomplete: ... @property - def sharedmask(self): ... - def shrink_mask(self): ... + def sharedmask(self) -> Incomplete: ... + def shrink_mask(self) -> Incomplete: ... @property - def baseclass(self): ... + def baseclass(self) -> Incomplete: ... data: Any @property - def flat(self): ... + def flat(self) -> Incomplete: ... @flat.setter - def flat(self, value): ... + def flat(self, value: Incomplete) -> Incomplete: ... @property - def fill_value(self): ... + def fill_value(self) -> Incomplete: ... @fill_value.setter - def fill_value(self, value=...): ... + def fill_value(self, value: Incomplete = ...) -> Incomplete: ... get_fill_value: Any set_fill_value: Any - def filled(self, fill_value=...): ... - def compressed(self): ... - def compress(self, condition, axis=..., out=...): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __ge__(self, other): ... - def __gt__(self, other): ... - def __le__(self, other): ... - def __lt__(self, other): ... - def __add__(self, other): ... - def __radd__(self, other): ... - def __sub__(self, other): ... - def __rsub__(self, other): ... - def __mul__(self, other): ... - def __rmul__(self, other): ... - def __div__(self, other): ... - def __truediv__(self, other): ... - def __rtruediv__(self, other): ... - def __floordiv__(self, other): ... - def __rfloordiv__(self, other): ... - def __pow__(self, other): ... - def __rpow__(self, other): ... - def __iadd__(self, other): ... - def __isub__(self, other): ... - def __imul__(self, other): ... - def __idiv__(self, other): ... - def __ifloordiv__(self, other): ... - def __itruediv__(self, other): ... - def __ipow__(self, other): ... + def filled(self, fill_value: Incomplete = ...) -> Incomplete: ... + def compressed(self) -> Incomplete: ... + def compress(self, condition: Incomplete, axis: Incomplete = ..., out: Incomplete = ...) -> Incomplete: ... + def __eq__(self, other: Incomplete, /) -> Incomplete: ... + def __ne__(self, other: Incomplete, /) -> Incomplete: ... + def __ge__(self, other: Incomplete, /) -> Incomplete: ... + def __gt__(self, other: Incomplete, /) -> Incomplete: ... + def __le__(self, other: Incomplete, /) -> Incomplete: ... + def __lt__(self, other: Incomplete, /) -> Incomplete: ... + def __add__(self, other: Incomplete, /) -> Incomplete: ... + def __radd__(self, other: Incomplete, /) -> Incomplete: ... + def __sub__(self, other: Incomplete, /) -> Incomplete: ... + def __rsub__(self, other: Incomplete, /) -> Incomplete: ... + def __mul__(self, other: Incomplete, /) -> Incomplete: ... + def __rmul__(self, other: Incomplete, /) -> Incomplete: ... + def __div__(self, other: Incomplete, /) -> Incomplete: ... + def __truediv__(self, other: Incomplete, /) -> Incomplete: ... + def __rtruediv__(self, other: Incomplete, /) -> Incomplete: ... + def __floordiv__(self, other: Incomplete, /) -> Incomplete: ... + def __rfloordiv__(self, other: Incomplete, /) -> Incomplete: ... + def __pow__(self, other: Incomplete, /) -> Incomplete: ... + def __rpow__(self, other: Incomplete, /) -> Incomplete: ... + def __iadd__(self, other: Incomplete, /) -> Self: ... + def __isub__(self, other: Incomplete, /) -> Self: ... + def __imul__(self, other: Incomplete, /) -> Self: ... + def __idiv__(self, other: Incomplete, /) -> Self: ... + def __ifloordiv__(self, other: Incomplete, /) -> Self: ... + def __itruediv__(self, other: Incomplete, /) -> Self: ... + def __ipow__(self, other: Incomplete, /) -> Self: ... def __float__(self) -> float: ... def __int__(self) -> int: ... @property # type: ignore[misc] - def imag(self): ... + def imag(self) -> Incomplete: ... get_imag: Any @property # type: ignore[misc] - def real(self): ... + def real(self) -> Incomplete: ... get_real: Any - def count(self, axis=..., keepdims=...): ... - def ravel(self, order=...): ... - def reshape(self, *s, **kwargs): ... - def resize(self, newshape, refcheck=..., order=...): ... - def put(self, indices, values, mode=...): ... - def ids(self): ... - def iscontiguous(self): ... - def all(self, axis=..., out=..., keepdims=...): ... - def any(self, axis=..., out=..., keepdims=...): ... - def nonzero(self): ... - def trace(self, offset=..., axis1=..., axis2=..., dtype=..., out=...): ... - def dot(self, b, out=..., strict=...): ... - def sum(self, axis=..., dtype=..., out=..., keepdims=...): ... - def cumsum(self, axis=..., dtype=..., out=...): ... - def prod(self, axis=..., dtype=..., out=..., keepdims=...): ... + def count(self, axis: Incomplete = ..., keepdims: Incomplete = ...) -> Incomplete: ... + def ravel(self, order: Incomplete = ...) -> Incomplete: ... + def reshape(self, *s: Incomplete, **kwargs: Incomplete) -> Incomplete: ... + def resize(self, newshape: Incomplete, refcheck: Incomplete = ..., order: Incomplete = ...) -> Incomplete: ... + def put(self, indices: Incomplete, values: Incomplete, mode: Incomplete = ...) -> Incomplete: ... + def ids(self) -> Incomplete: ... + def iscontiguous(self) -> Incomplete: ... + def all(self, axis: Incomplete = ..., out: Incomplete = ..., keepdims: Incomplete = ...) -> Incomplete: ... + def any(self, axis: Incomplete = ..., out: Incomplete = ..., keepdims: Incomplete = ...) -> Incomplete: ... + def nonzero(self) -> Incomplete: ... + def trace( + self, + offset: Incomplete = ..., + axis1: Incomplete = ..., + axis2: Incomplete = ..., + dtype: Incomplete = ..., + out: Incomplete = ..., + ) -> Incomplete: ... + def dot(self, b: Incomplete, out: Incomplete = ..., strict: Incomplete = ...) -> Incomplete: ... + def sum( + self, + axis: Incomplete = ..., + dtype: Incomplete = ..., + out: Incomplete = ..., + keepdims: Incomplete = ..., + ) -> Incomplete: ... + def cumsum(self, axis: Incomplete = ..., dtype: Incomplete = ..., out: Incomplete = ...) -> Incomplete: ... + def prod( + self, + axis: Incomplete = ..., + dtype: Incomplete = ..., + out: Incomplete = ..., + keepdims: Incomplete = ..., + ) -> Incomplete: ... product: Any - def cumprod(self, axis=..., dtype=..., out=...): ... - def mean(self, axis=..., dtype=..., out=..., keepdims=...): ... - def anom(self, axis=..., dtype=...): ... - def var(self, axis=..., dtype=..., out=..., ddof=..., keepdims=...): ... - def std(self, axis=..., dtype=..., out=..., ddof=..., keepdims=...): ... - def round(self, decimals=..., out=...): ... - def argsort(self, axis=..., kind=..., order=..., endwith=..., fill_value=..., stable=...): ... - def argmin(self, axis=..., fill_value=..., out=..., *, keepdims=...): ... - def argmax(self, axis=..., fill_value=..., out=..., *, keepdims=...): ... - def sort(self, axis=..., kind=..., order=..., endwith=..., fill_value=..., stable=...): ... - def min(self, axis=..., out=..., fill_value=..., keepdims=...): ... - # NOTE: deprecated - # def tostring(self, fill_value=..., order=...): ... - def max(self, axis=..., out=..., fill_value=..., keepdims=...): ... - def ptp(self, axis=..., out=..., fill_value=..., keepdims=...): ... - def partition(self, *args, **kwargs): ... - def argpartition(self, *args, **kwargs): ... - def take(self, indices, axis=..., out=..., mode=...): ... + def cumprod(self, axis: Incomplete = ..., dtype: Incomplete = ..., out: Incomplete = ...) -> Incomplete: ... + def mean( + self, + axis: Incomplete = ..., + dtype: Incomplete = ..., + out: Incomplete = ..., + keepdims: Incomplete = ..., + ) -> Incomplete: ... + def anom(self, axis: Incomplete = ..., dtype: Incomplete = ...) -> Incomplete: ... + def var( + self, + axis: Incomplete = ..., + dtype: Incomplete = ..., + out: Incomplete = ..., + ddof: Incomplete = ..., + keepdims: Incomplete = ..., + ) -> Incomplete: ... + def std( + self, + axis: Incomplete = ..., + dtype: Incomplete = ..., + out: Incomplete = ..., + ddof: Incomplete = ..., + keepdims: Incomplete = ..., + ) -> Incomplete: ... + def round(self, decimals: Incomplete = ..., out: Incomplete = ...) -> Incomplete: ... + def argsort( + self, + axis: Incomplete = ..., + kind: Incomplete = ..., + order: Incomplete = ..., + endwith: Incomplete = ..., + fill_value: Incomplete = ..., + stable: Incomplete = ..., + ) -> Incomplete: ... + def argmin( + self, + axis: Incomplete = ..., + fill_value: Incomplete = ..., + out: Incomplete = ..., + *, + keepdims: Incomplete = ..., + ) -> Incomplete: ... + def argmax( + self, + axis: Incomplete = ..., + fill_value: Incomplete = ..., + out: Incomplete = ..., + *, + keepdims: Incomplete = ..., + ) -> Incomplete: ... + def sort( + self, + axis: Incomplete = ..., + kind: Incomplete = ..., + order: Incomplete = ..., + endwith: Incomplete = ..., + fill_value: Incomplete = ..., + stable: Incomplete = ..., + ) -> Incomplete: ... + def min( + self, + axis: Incomplete = ..., + out: Incomplete = ..., + fill_value: Incomplete = ..., + keepdims: Incomplete = ..., + ) -> Incomplete: ... + def max( + self, + axis: Incomplete = ..., + out: Incomplete = ..., + fill_value: Incomplete = ..., + keepdims: Incomplete = ..., + ) -> Incomplete: ... + def ptp( + self, + axis: Incomplete = ..., + out: Incomplete = ..., + fill_value: Incomplete = ..., + keepdims: Incomplete = ..., + ) -> Incomplete: ... + def partition(self, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... + def argpartition(self, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... + def take(self, indices: Incomplete, axis: Incomplete = ..., out: Incomplete = ..., mode: Incomplete = ...) -> Incomplete: ... copy: Any diagonal: Any flatten: Any @@ -483,98 +577,104 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]): T: Any transpose: Any @property # type: ignore[misc] - def mT(self): ... - def tolist(self, fill_value=...): ... - def tobytes(self, fill_value=..., order=...): ... - def tofile(self, fid, sep=..., format=...): ... - def toflex(self): ... + def mT(self) -> Incomplete: ... + def tolist(self, fill_value: Incomplete = ...) -> Incomplete: ... + def tobytes(self, fill_value: Incomplete = ..., order: Incomplete = ...) -> Incomplete: ... + def tofile(self, fid: Incomplete, sep: Incomplete = ..., format: Incomplete = ...) -> Incomplete: ... + def toflex(self) -> Incomplete: ... torecords: Any - def __reduce__(self): ... - def __deepcopy__(self, memo=...): ... + def __reduce__(self) -> Incomplete: ... + def __deepcopy__(self, memo: Incomplete = ...) -> Incomplete: ... class mvoid(MaskedArray[_ShapeType_co, _DType_co]): def __new__( self, - data, - mask=..., - dtype=..., - fill_value=..., - hardmask=..., - copy=..., - subok=..., - ): ... - def __getitem__(self, indx): ... - def __setitem__(self, indx, value) -> None: ... - def __iter__(self): ... + data: Incomplete, + mask: Incomplete = ..., + dtype: Incomplete = ..., + fill_value: Incomplete = ..., + hardmask: Incomplete = ..., + copy: Incomplete = ..., + subok: Incomplete = ..., + ) -> Incomplete: ... + def __getitem__(self, indx: Incomplete) -> Incomplete: ... + def __setitem__(self, indx: Incomplete, value: Incomplete) -> None: ... + def __iter__(self) -> Incomplete: ... def __len__(self) -> int: ... - def filled(self, fill_value=...): ... - def tolist(self): ... + def filled(self, fill_value: Incomplete = ...) -> Incomplete: ... + def tolist(self) -> Incomplete: ... -def isMaskedArray(x): ... +def isMaskedArray(x: Incomplete) -> Incomplete: ... isarray = isMaskedArray isMA = isMaskedArray # 0D float64 array class MaskedConstant(MaskedArray[Any, dtype[float64]]): - def __new__(cls): ... + def __new__(cls) -> Incomplete: ... __class__: Any - def __array_finalize__(self, obj): ... - def __array_wrap__(self, obj, context=..., return_scalar=...): ... - def __format__(self, format_spec) -> str: ... - def __reduce__(self): ... - def __iop__(self, other): ... + def __array_finalize__(self, obj: Incomplete) -> Incomplete: ... + def __array_wrap__(self, obj: Incomplete, context: Incomplete = ..., return_scalar: Incomplete = ...) -> Incomplete: ... + def __format__(self, format_spec: Incomplete) -> str: ... + def __reduce__(self) -> Incomplete: ... + def __iop__(self, other: Incomplete) -> Incomplete: ... __iadd__: Any __isub__: Any __imul__: Any __ifloordiv__: Any __itruediv__: Any __ipow__: Any - def copy(self, *args, **kwargs): ... - def __copy__(self): ... - def __deepcopy__(self, memo): ... - def __setattr__(self, attr, value) -> None: ... + def copy(self, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... + def __copy__(self) -> Incomplete: ... + def __deepcopy__(self, memo: Incomplete) -> Incomplete: ... + def __setattr__(self, attr: Incomplete, value: Incomplete) -> None: ... masked: MaskedConstant masked_singleton: MaskedConstant masked_array = MaskedArray def array( - data, - dtype=..., - copy=..., - order=..., - mask=..., - fill_value=..., - keep_mask=..., - hard_mask=..., - shrink=..., - subok=..., - ndmin=..., -): ... -def is_masked(x): ... + data: Incomplete, + dtype: Incomplete = ..., + copy: Incomplete = ..., + order: Incomplete = ..., + mask: Incomplete = ..., + fill_value: Incomplete = ..., + keep_mask: Incomplete = ..., + hard_mask: Incomplete = ..., + shrink: Incomplete = ..., + subok: Incomplete = ..., + ndmin: Incomplete = ..., +) -> Incomplete: ... +def is_masked(x: Incomplete) -> Incomplete: ... class _extrema_operation(_MaskedUFunc): compare: Any fill_value_func: Any - def __init__(self, ufunc, compare, fill_value) -> None: ... + def __init__(self, ufunc: Incomplete, compare: Incomplete, fill_value: Incomplete) -> None: ... # NOTE: in practice `b` has a default value, but users should # explicitly provide a value here as the default is deprecated - def __call__(self, a, b): ... - def reduce(self, target, axis=...): ... - def outer(self, a, b): ... - -def min(obj, axis=..., out=..., fill_value=..., keepdims=...): ... -def max(obj, axis=..., out=..., fill_value=..., keepdims=...): ... -def ptp(obj, axis=..., out=..., fill_value=..., keepdims=...): ... + def __call__(self, a: Incomplete, b: Incomplete) -> Incomplete: ... + def reduce(self, target: Incomplete, axis: Incomplete = ...) -> Incomplete: ... + def outer(self, a: Incomplete, b: Incomplete) -> Incomplete: ... + +def min( + obj: Incomplete, axis: Incomplete = ..., out: Incomplete = ..., fill_value: Incomplete = ..., keepdims: Incomplete = ... +) -> Incomplete: ... +def max( + obj: Incomplete, axis: Incomplete = ..., out: Incomplete = ..., fill_value: Incomplete = ..., keepdims: Incomplete = ... +) -> Incomplete: ... +def ptp( + obj: Incomplete, axis: Incomplete = ..., out: Incomplete = ..., fill_value: Incomplete = ..., keepdims: Incomplete = ... +) -> Incomplete: ... class _frommethod: __name__: Any __doc__: Any reversed: Any - def __init__(self, methodname, reversed=...) -> None: ... - def getdoc(self): ... - def __call__(self, a, *args, **params): ... + def __init__(self, methodname: Incomplete, reversed: Incomplete = ...) -> None: ... + def getdoc(self) -> Incomplete: ... + def __call__(self, a: Incomplete, *args: Incomplete, **params: Incomplete) -> Incomplete: ... all: _frommethod anomalies: _frommethod @@ -606,51 +706,73 @@ argmax: _frommethod minimum: _extrema_operation maximum: _extrema_operation -def take(a, indices, axis=..., out=..., mode=...): ... -def power(a, b, third=...): ... -def argsort(a, axis=..., kind=..., order=..., endwith=..., fill_value=..., stable=...): ... -def sort(a, axis=..., kind=..., order=..., endwith=..., fill_value=..., stable=...): ... -def compressed(x): ... -def concatenate(arrays, axis=...): ... -def diag(v, k=...): ... -def left_shift(a, n): ... -def right_shift(a, n): ... -def put(a, indices, values, mode=...): ... -def putmask(a, mask, values): ... -def transpose(a, axes=...): ... -def reshape(a, new_shape, order=...): ... -def resize(x, new_shape): ... -def ndim(obj): ... -def shape(obj): ... -def size(obj, axis=...): ... -def diff(a, /, n=..., axis=..., prepend=..., append=...): ... -def where(condition, x=..., y=...): ... -def choose(indices, choices, out=..., mode=...): ... -def round_(a, decimals=..., out=...): ... +def take( + a: Incomplete, indices: Incomplete, axis: Incomplete = ..., out: Incomplete = ..., mode: Incomplete = ... +) -> Incomplete: ... +def power(a: Incomplete, b: Incomplete, third: Incomplete = ...) -> Incomplete: ... +def argsort( + a: Incomplete, + axis: Incomplete = ..., + kind: Incomplete = ..., + order: Incomplete = ..., + endwith: Incomplete = ..., + fill_value: Incomplete = ..., + stable: Incomplete = ..., +) -> Incomplete: ... +def sort( + a: Incomplete, + axis: Incomplete = ..., + kind: Incomplete = ..., + order: Incomplete = ..., + endwith: Incomplete = ..., + fill_value: Incomplete = ..., + stable: Incomplete = ..., +) -> Incomplete: ... +def compressed(x: Incomplete) -> Incomplete: ... +def concatenate(arrays: Incomplete, axis: Incomplete = ...) -> Incomplete: ... +def diag(v: Incomplete, k: Incomplete = ...) -> Incomplete: ... +def left_shift(a: Incomplete, n: Incomplete) -> Incomplete: ... +def right_shift(a: Incomplete, n: Incomplete) -> Incomplete: ... +def put(a: Incomplete, indices: Incomplete, values: Incomplete, mode: Incomplete = ...) -> Incomplete: ... +def putmask(a: Incomplete, mask: Incomplete, values: Incomplete) -> Incomplete: ... +def transpose(a: Incomplete, axes: Incomplete = ...) -> Incomplete: ... +def reshape(a: Incomplete, new_shape: Incomplete, order: Incomplete = ...) -> Incomplete: ... +def resize(x: Incomplete, new_shape: Incomplete) -> Incomplete: ... +def ndim(obj: Incomplete) -> Incomplete: ... +def shape(obj: Incomplete) -> Incomplete: ... +def size(obj: Incomplete, axis: Incomplete = ...) -> Incomplete: ... +def diff( + a: Incomplete, /, n: Incomplete = ..., axis: Incomplete = ..., prepend: Incomplete = ..., append: Incomplete = ... +) -> Incomplete: ... +def where(condition: Incomplete, x: Incomplete = ..., y: Incomplete = ...) -> Incomplete: ... +def choose(indices: Incomplete, choices: Incomplete, out: Incomplete = ..., mode: Incomplete = ...) -> Incomplete: ... +def round_(a: Incomplete, decimals: Incomplete = ..., out: Incomplete = ...) -> Incomplete: ... round = round_ -def inner(a, b): ... +def inner(a: Incomplete, b: Incomplete) -> Incomplete: ... innerproduct = inner -def outer(a, b): ... +def outer(a: Incomplete, b: Incomplete) -> Incomplete: ... outerproduct = outer -def correlate(a, v, mode=..., propagate_mask=...): ... -def convolve(a, v, mode=..., propagate_mask=...): ... -def allequal(a, b, fill_value=...): ... -def allclose(a, b, masked_equal=..., rtol=..., atol=...): ... -def asarray(a, dtype=..., order=...): ... -def asanyarray(a, dtype=...): ... -def fromflex(fxarray): ... +def correlate(a: Incomplete, v: Incomplete, mode: Incomplete = ..., propagate_mask: Incomplete = ...) -> Incomplete: ... +def convolve(a: Incomplete, v: Incomplete, mode: Incomplete = ..., propagate_mask: Incomplete = ...) -> Incomplete: ... +def allequal(a: Incomplete, b: Incomplete, fill_value: Incomplete = ...) -> Incomplete: ... +def allclose( + a: Incomplete, b: Incomplete, masked_equal: Incomplete = ..., rtol: Incomplete = ..., atol: Incomplete = ... +) -> Incomplete: ... +def asarray(a: Incomplete, dtype: Incomplete = ..., order: Incomplete = ...) -> Incomplete: ... +def asanyarray(a: Incomplete, dtype: Incomplete = ...) -> Incomplete: ... +def fromflex(fxarray: Incomplete) -> Incomplete: ... class _convert2ma: __doc__: Any - def __init__(self, funcname, params=...) -> None: ... - def getdoc(self): ... - def __call__(self, *args, **params): ... + def __init__(self, funcname: Incomplete, params: Incomplete = ...) -> None: ... + def getdoc(self) -> Incomplete: ... + def __call__(self, *args: Incomplete, **params: Incomplete) -> Incomplete: ... arange: _convert2ma empty: _convert2ma @@ -663,6 +785,6 @@ ones_like: _convert2ma zeros: _convert2ma zeros_like: _convert2ma -def append(a, b, axis=...): ... -def dot(a, b, strict=..., out=...): ... -def mask_rowcols(a, axis=...): ... +def append(a: Incomplete, b: Incomplete, axis: Incomplete = ...) -> Incomplete: ... +def dot(a: Incomplete, b: Incomplete, strict: Incomplete = ..., out: Incomplete = ...) -> Incomplete: ... +def mask_rowcols(a: Incomplete, axis: Incomplete = ...) -> Incomplete: ... diff --git a/src/numpy-stubs/ma/extras.pyi b/src/numpy-stubs/ma/extras.pyi index e29a754f..f1ffeb5e 100644 --- a/src/numpy-stubs/ma/extras.pyi +++ b/src/numpy-stubs/ma/extras.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from typing import Any from numpy.lib._index_tricks_impl import AxisConcatenator @@ -53,25 +54,25 @@ __all__ = [ "vstack", ] -def count_masked(arr, axis=...): ... -def masked_all(shape, dtype=...): ... -def masked_all_like(arr): ... +def count_masked(arr: Incomplete, axis: Incomplete = ...) -> Incomplete: ... +def masked_all(shape: Incomplete, dtype: Incomplete = ...) -> Incomplete: ... +def masked_all_like(arr: Incomplete) -> Incomplete: ... class _fromnxfunction: __name__: Any __doc__: Any - def __init__(self, funcname) -> None: ... - def getdoc(self): ... - def __call__(self, *args, **params): ... + def __init__(self, funcname: Incomplete) -> None: ... + def getdoc(self) -> Incomplete: ... + def __call__(self, *args: Incomplete, **params: Incomplete) -> Incomplete: ... class _fromnxfunction_single(_fromnxfunction): - def __call__(self, x, *args, **params): ... + def __call__(self, x: Incomplete, *args: Incomplete, **params: Incomplete) -> Incomplete: ... class _fromnxfunction_seq(_fromnxfunction): - def __call__(self, x, *args, **params): ... + def __call__(self, x: Incomplete, *args: Incomplete, **params: Incomplete) -> Incomplete: ... class _fromnxfunction_allargs(_fromnxfunction): - def __call__(self, *args, **params): ... + def __call__(self, *args: Incomplete, **params: Incomplete) -> Incomplete: ... atleast_1d: _fromnxfunction_allargs atleast_2d: _fromnxfunction_allargs @@ -87,44 +88,74 @@ stack: _fromnxfunction_seq hsplit: _fromnxfunction_single diagflat: _fromnxfunction_single -def apply_along_axis(func1d, axis, arr, *args, **kwargs): ... -def apply_over_axes(func, a, axes): ... -def average(a, axis=..., weights=..., returned=..., keepdims=...): ... -def median(a, axis=..., out=..., overwrite_input=..., keepdims=...): ... -def compress_nd(x, axis=...): ... -def compress_rowcols(x, axis=...): ... -def compress_rows(a): ... -def compress_cols(a): ... -def mask_rows(a, axis=...): ... -def mask_cols(a, axis=...): ... -def ediff1d(arr, to_end=..., to_begin=...): ... -def unique(ar1, return_index=..., return_inverse=...): ... -def intersect1d(ar1, ar2, assume_unique=...): ... -def setxor1d(ar1, ar2, assume_unique=...): ... -def in1d(ar1, ar2, assume_unique=..., invert=...): ... -def isin(element, test_elements, assume_unique=..., invert=...): ... -def union1d(ar1, ar2): ... -def setdiff1d(ar1, ar2, assume_unique=...): ... -def cov(x, y=..., rowvar=..., bias=..., allow_masked=..., ddof=...): ... -def corrcoef(x, y=..., rowvar=..., bias=..., allow_masked=..., ddof=...): ... +def apply_along_axis( + func1d: Incomplete, axis: Incomplete, arr: Incomplete, *args: Incomplete, **kwargs: Incomplete +) -> Incomplete: ... +def apply_over_axes(func: Incomplete, a: Incomplete, axes: Incomplete) -> Incomplete: ... +def average( + a: Incomplete, axis: Incomplete = ..., weights: Incomplete = ..., returned: Incomplete = ..., keepdims: Incomplete = ... +) -> Incomplete: ... +def median( + a: Incomplete, axis: Incomplete = ..., out: Incomplete = ..., overwrite_input: Incomplete = ..., keepdims: Incomplete = ... +) -> Incomplete: ... +def compress_nd(x: Incomplete, axis: Incomplete = ...) -> Incomplete: ... +def compress_rowcols(x: Incomplete, axis: Incomplete = ...) -> Incomplete: ... +def compress_rows(a: Incomplete) -> Incomplete: ... +def compress_cols(a: Incomplete) -> Incomplete: ... +def mask_rows(a: Incomplete, axis: Incomplete = ...) -> Incomplete: ... +def mask_cols(a: Incomplete, axis: Incomplete = ...) -> Incomplete: ... +def ediff1d(arr: Incomplete, to_end: Incomplete = ..., to_begin: Incomplete = ...) -> Incomplete: ... +def unique(ar1: Incomplete, return_index: Incomplete = ..., return_inverse: Incomplete = ...) -> Incomplete: ... +def intersect1d(ar1: Incomplete, ar2: Incomplete, assume_unique: Incomplete = ...) -> Incomplete: ... +def setxor1d(ar1: Incomplete, ar2: Incomplete, assume_unique: Incomplete = ...) -> Incomplete: ... +def in1d(ar1: Incomplete, ar2: Incomplete, assume_unique: Incomplete = ..., invert: Incomplete = ...) -> Incomplete: ... +def isin( + element: Incomplete, test_elements: Incomplete, assume_unique: Incomplete = ..., invert: Incomplete = ... +) -> Incomplete: ... +def union1d(ar1: Incomplete, ar2: Incomplete) -> Incomplete: ... +def setdiff1d(ar1: Incomplete, ar2: Incomplete, assume_unique: Incomplete = ...) -> Incomplete: ... +def cov( + x: Incomplete, + y: Incomplete = ..., + rowvar: Incomplete = ..., + bias: Incomplete = ..., + allow_masked: Incomplete = ..., + ddof: Incomplete = ..., +) -> Incomplete: ... +def corrcoef( + x: Incomplete, + y: Incomplete = ..., + rowvar: Incomplete = ..., + bias: Incomplete = ..., + allow_masked: Incomplete = ..., + ddof: Incomplete = ..., +) -> Incomplete: ... class MAxisConcatenator(AxisConcatenator): concatenate: Any @classmethod - def makemat(cls, arr): ... - def __getitem__(self, key): ... + def makemat(cls, arr: Incomplete) -> Incomplete: ... + def __getitem__(self, key: Incomplete) -> Incomplete: ... class mr_class(MAxisConcatenator): def __init__(self) -> None: ... mr_: mr_class -def ndenumerate(a, compressed=...): ... -def flatnotmasked_edges(a): ... -def notmasked_edges(a, axis=...): ... -def flatnotmasked_contiguous(a): ... -def notmasked_contiguous(a, axis=...): ... -def clump_unmasked(a): ... -def clump_masked(a): ... -def vander(x, n=...): ... -def polyfit(x, y, deg, rcond=..., full=..., w=..., cov=...): ... +def ndenumerate(a: Incomplete, compressed: Incomplete = ...) -> Incomplete: ... +def flatnotmasked_edges(a: Incomplete) -> Incomplete: ... +def notmasked_edges(a: Incomplete, axis: Incomplete = ...) -> Incomplete: ... +def flatnotmasked_contiguous(a: Incomplete) -> Incomplete: ... +def notmasked_contiguous(a: Incomplete, axis: Incomplete = ...) -> Incomplete: ... +def clump_unmasked(a: Incomplete) -> Incomplete: ... +def clump_masked(a: Incomplete) -> Incomplete: ... +def vander(x: Incomplete, n: Incomplete = ...) -> Incomplete: ... +def polyfit( + x: Incomplete, + y: Incomplete, + deg: Incomplete, + rcond: Incomplete = ..., + full: Incomplete = ..., + w: Incomplete = ..., + cov: Incomplete = ..., +) -> Incomplete: ... diff --git a/src/numpy-stubs/ma/mrecords.pyi b/src/numpy-stubs/ma/mrecords.pyi index 5515cc85..61caad66 100644 --- a/src/numpy-stubs/ma/mrecords.pyi +++ b/src/numpy-stubs/ma/mrecords.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from typing import Any, TypeVar from numpy import dtype @@ -19,75 +20,73 @@ _DType_co = TypeVar("_DType_co", bound=dtype[Any], covariant=True) class MaskedRecords(MaskedArray[_ShapeType_co, _DType_co]): def __new__( cls, - shape, - dtype=..., - buf=..., - offset=..., - strides=..., - formats=..., - names=..., - titles=..., - byteorder=..., - aligned=..., - mask=..., - hard_mask=..., - fill_value=..., - keep_mask=..., - copy=..., - **options, - ): ... + shape: Incomplete, + dtype: Incomplete = ..., + buf: Incomplete = ..., + offset: Incomplete = ..., + strides: Incomplete = ..., + formats: Incomplete = ..., + names: Incomplete = ..., + titles: Incomplete = ..., + byteorder: Incomplete = ..., + aligned: Incomplete = ..., + mask: Incomplete = ..., + hard_mask: Incomplete = ..., + fill_value: Incomplete = ..., + keep_mask: Incomplete = ..., + copy: Incomplete = ..., + **options: Incomplete, + ) -> Incomplete: ... _mask: Any _fill_value: Any @property - def _data(self): ... + def _data(self) -> Incomplete: ... @property - def _fieldmask(self): ... - def __array_finalize__(self, obj): ... + def _fieldmask(self) -> Incomplete: ... + def __array_finalize__(self, obj: Incomplete) -> Incomplete: ... def __len__(self) -> int: ... - def __getattribute__(self, attr): ... - def __setattr__(self, attr, val) -> None: ... - def __getitem__(self, indx): ... - def __setitem__(self, indx, value) -> None: ... - def view(self, dtype=..., type=...): ... - def harden_mask(self): ... - def soften_mask(self): ... - def copy(self): ... - def tolist(self, fill_value=...): ... - def __reduce__(self): ... + def __getattribute__(self, attr: Incomplete) -> Incomplete: ... + def __setattr__(self, attr: Incomplete, val: Incomplete) -> None: ... + def __getitem__(self, indx: Incomplete) -> Incomplete: ... + def __setitem__(self, indx: Incomplete, value: Incomplete) -> None: ... + def view(self, dtype: Incomplete = ..., type: Incomplete = ...) -> Incomplete: ... + def harden_mask(self) -> Incomplete: ... + def soften_mask(self) -> Incomplete: ... + def copy(self) -> Incomplete: ... + def tolist(self, fill_value: Incomplete = ...) -> Incomplete: ... + def __reduce__(self) -> Incomplete: ... mrecarray = MaskedRecords def fromarrays( - arraylist, - dtype=..., - shape=..., - formats=..., - names=..., - titles=..., - aligned=..., - byteorder=..., - fill_value=..., -): ... + arraylist: Incomplete, + dtype: Incomplete = ..., + shape: Incomplete = ..., + formats: Incomplete = ..., + names: Incomplete = ..., + titles: Incomplete = ..., + aligned: Incomplete = ..., + byteorder: Incomplete = ..., + fill_value: Incomplete = ..., +) -> Incomplete: ... def fromrecords( - reclist, - dtype=..., - shape=..., - formats=..., - names=..., - titles=..., - aligned=..., - byteorder=..., - fill_value=..., - mask=..., -): ... + reclist: Incomplete, + dtype: Incomplete = ..., + shape: Incomplete = ..., + formats: Incomplete = ..., + names: Incomplete = ..., + titles: Incomplete = ..., + aligned: Incomplete = ..., + byteorder: Incomplete = ..., + fill_value: Incomplete = ..., + mask: Incomplete = ..., +) -> Incomplete: ... def fromtextfile( - fname, - delimiter=..., - commentchar=..., - missingchar=..., - varnames=..., - vartypes=..., - # NOTE: deprecated: NumPy 1.22.0, 2021-09-23 - # delimitor=..., -): ... -def addfield(mrecord, newfield, newfieldname=...): ... + fname: Incomplete, + delimiter: Incomplete = ..., + commentchar: Incomplete = ..., + missingchar: Incomplete = ..., + varnames: Incomplete = ..., + vartypes: Incomplete = ..., +) -> Incomplete: ... +def addfield(mrecord: Incomplete, newfield: Incomplete, newfieldname: Incomplete = ...) -> Incomplete: ... diff --git a/src/numpy-stubs/matrixlib/defmatrix.pyi b/src/numpy-stubs/matrixlib/defmatrix.pyi index 296d6ce5..b09c526c 100644 --- a/src/numpy-stubs/matrixlib/defmatrix.pyi +++ b/src/numpy-stubs/matrixlib/defmatrix.pyi @@ -8,8 +8,8 @@ __all__ = ["asmatrix", "bmat", "matrix"] def bmat( obj: str | Sequence[ArrayLike] | NDArray[Any], - ldict: None | Mapping[str, Any] = ..., - gdict: None | Mapping[str, Any] = ..., + ldict: Mapping[str, Any] | None = ..., + gdict: Mapping[str, Any] | None = ..., ) -> matrix[tuple[int, int], Any]: ... def asmatrix(data: ArrayLike, dtype: DTypeLike = ...) -> matrix[tuple[int, int], Any]: ... diff --git a/src/numpy-stubs/polynomial/_polybase.pyi b/src/numpy-stubs/polynomial/_polybase.pyi index 9191335e..f03df350 100644 --- a/src/numpy-stubs/polynomial/_polybase.pyi +++ b/src/numpy-stubs/polynomial/_polybase.pyi @@ -69,8 +69,8 @@ class ABCPolyBase(Generic[_NameCo], metaclass=abc.ABCMeta): self, /, coef: _SeriesLikeCoef_co, - domain: None | _SeriesLikeCoef_co = ..., - window: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., + window: _SeriesLikeCoef_co | None = ..., symbol: str = ..., ) -> None: ... @overload @@ -144,27 +144,27 @@ class ABCPolyBase(Generic[_NameCo], metaclass=abc.ABCMeta): @overload def convert( self, - domain: None | _SeriesLikeCoef_co, + domain: _SeriesLikeCoef_co | None, kind: type[_Other], /, - window: None | _SeriesLikeCoef_co = ..., + window: _SeriesLikeCoef_co | None = ..., ) -> _Other: ... @overload def convert( self, /, - domain: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., *, kind: type[_Other], - window: None | _SeriesLikeCoef_co = ..., + window: _SeriesLikeCoef_co | None = ..., ) -> _Other: ... @overload def convert( self: _Self, /, - domain: None | _SeriesLikeCoef_co = ..., - kind: None | type[_Self] = ..., - window: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., + kind: type[_Self] | None = ..., + window: _SeriesLikeCoef_co | None = ..., ) -> _Self: ... def mapparms(self, /) -> _Tuple2[Any]: ... def integ( @@ -172,7 +172,7 @@ class ABCPolyBase(Generic[_NameCo], metaclass=abc.ABCMeta): /, m: SupportsIndex = ..., k: _CoefLike_co | _SeriesLikeCoef_co = ..., - lbnd: None | _CoefLike_co = ..., + lbnd: _CoefLike_co | None = ..., ) -> _Self: ... def deriv(self: _Self, /, m: SupportsIndex = ...) -> _Self: ... def roots(self, /) -> _CoefSeries: ... @@ -180,7 +180,7 @@ class ABCPolyBase(Generic[_NameCo], metaclass=abc.ABCMeta): self, /, n: SupportsIndex = ..., - domain: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., ) -> _Tuple2[_Series[np.float64 | np.complex128]]: ... @overload @classmethod @@ -190,11 +190,11 @@ class ABCPolyBase(Generic[_NameCo], metaclass=abc.ABCMeta): x: _SeriesLikeCoef_co, y: _SeriesLikeCoef_co, deg: int | _SeriesLikeInt_co, - domain: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., rcond: _FloatLike_co = ..., full: Literal[False] = ..., - w: None | _SeriesLikeCoef_co = ..., - window: None | _SeriesLikeCoef_co = ..., + w: _SeriesLikeCoef_co | None = ..., + window: _SeriesLikeCoef_co | None = ..., symbol: str = ..., ) -> _Self: ... @overload @@ -205,12 +205,12 @@ class ABCPolyBase(Generic[_NameCo], metaclass=abc.ABCMeta): x: _SeriesLikeCoef_co, y: _SeriesLikeCoef_co, deg: int | _SeriesLikeInt_co, - domain: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., rcond: _FloatLike_co = ..., *, full: Literal[True], - w: None | _SeriesLikeCoef_co = ..., - window: None | _SeriesLikeCoef_co = ..., + w: _SeriesLikeCoef_co | None = ..., + window: _SeriesLikeCoef_co | None = ..., symbol: str = ..., ) -> tuple[_Self, Sequence[np.inexact[Any] | np.int32]]: ... @overload @@ -220,12 +220,12 @@ class ABCPolyBase(Generic[_NameCo], metaclass=abc.ABCMeta): x: _SeriesLikeCoef_co, y: _SeriesLikeCoef_co, deg: int | _SeriesLikeInt_co, - domain: None | _SeriesLikeCoef_co, + domain: _SeriesLikeCoef_co | None, rcond: _FloatLike_co, full: Literal[True], /, - w: None | _SeriesLikeCoef_co = ..., - window: None | _SeriesLikeCoef_co = ..., + w: _SeriesLikeCoef_co | None = ..., + window: _SeriesLikeCoef_co | None = ..., symbol: str = ..., ) -> tuple[_Self, Sequence[np.inexact[Any] | np.int32]]: ... @classmethod @@ -233,16 +233,16 @@ class ABCPolyBase(Generic[_NameCo], metaclass=abc.ABCMeta): cls: type[_Self], /, roots: _ArrayLikeCoef_co, - domain: None | _SeriesLikeCoef_co = ..., - window: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., + window: _SeriesLikeCoef_co | None = ..., symbol: str = ..., ) -> _Self: ... @classmethod def identity( cls: type[_Self], /, - domain: None | _SeriesLikeCoef_co = ..., - window: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., + window: _SeriesLikeCoef_co | None = ..., symbol: str = ..., ) -> _Self: ... @classmethod @@ -250,8 +250,8 @@ class ABCPolyBase(Generic[_NameCo], metaclass=abc.ABCMeta): cls: type[_Self], /, deg: _AnyInt, - domain: None | _SeriesLikeCoef_co = ..., - window: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., + window: _SeriesLikeCoef_co | None = ..., symbol: str = ..., ) -> _Self: ... @classmethod @@ -259,8 +259,8 @@ class ABCPolyBase(Generic[_NameCo], metaclass=abc.ABCMeta): cls: type[_Self], /, series: ABCPolyBase, - domain: None | _SeriesLikeCoef_co = ..., - window: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., + window: _SeriesLikeCoef_co | None = ..., ) -> _Self: ... @classmethod def _str_term_unicode(cls, /, i: str, arg_str: str) -> str: ... diff --git a/src/numpy-stubs/polynomial/_polytypes.pyi b/src/numpy-stubs/polynomial/_polytypes.pyi index 7879425d..4af9cbb7 100644 --- a/src/numpy-stubs/polynomial/_polytypes.pyi +++ b/src/numpy-stubs/polynomial/_polytypes.pyi @@ -183,7 +183,7 @@ class _FuncPow(_Named[_Name_co], Protocol[_Name_co]): /, c: _SeriesLikeFloat_co, pow: _IntLike_co, - maxpower: None | _IntLike_co = ..., + maxpower: _IntLike_co | None = ..., ) -> _FloatSeries: ... @overload def __call__( @@ -191,7 +191,7 @@ class _FuncPow(_Named[_Name_co], Protocol[_Name_co]): /, c: _SeriesLikeComplex_co, pow: _IntLike_co, - maxpower: None | _IntLike_co = ..., + maxpower: _IntLike_co | None = ..., ) -> _ComplexSeries: ... @overload def __call__( @@ -199,7 +199,7 @@ class _FuncPow(_Named[_Name_co], Protocol[_Name_co]): /, c: _SeriesLikeCoef_co, pow: _IntLike_co, - maxpower: None | _IntLike_co = ..., + maxpower: _IntLike_co | None = ..., ) -> _ObjectSeries: ... @type_check_only @@ -686,9 +686,9 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]): x: _SeriesLikeFloat_co, y: _ArrayLikeFloat_co, deg: int | _SeriesLikeInt_co, - rcond: None | float = ..., + rcond: float | None = ..., full: Literal[False] = ..., - w: None | _SeriesLikeFloat_co = ..., + w: _SeriesLikeFloat_co | None = ..., ) -> _FloatArray: ... @overload def __call__( @@ -696,10 +696,10 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]): x: _SeriesLikeFloat_co, y: _ArrayLikeFloat_co, deg: int | _SeriesLikeInt_co, - rcond: None | float, + rcond: float | None, full: Literal[True], /, - w: None | _SeriesLikeFloat_co = ..., + w: _SeriesLikeFloat_co | None = ..., ) -> tuple[_FloatArray, _FullFitResult]: ... @overload def __call__( @@ -708,10 +708,10 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]): x: _SeriesLikeFloat_co, y: _ArrayLikeFloat_co, deg: int | _SeriesLikeInt_co, - rcond: None | float = ..., + rcond: float | None = ..., *, full: Literal[True], - w: None | _SeriesLikeFloat_co = ..., + w: _SeriesLikeFloat_co | None = ..., ) -> tuple[_FloatArray, _FullFitResult]: ... @overload def __call__( @@ -720,9 +720,9 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]): x: _SeriesLikeComplex_co, y: _ArrayLikeComplex_co, deg: int | _SeriesLikeInt_co, - rcond: None | float = ..., + rcond: float | None = ..., full: Literal[False] = ..., - w: None | _SeriesLikeFloat_co = ..., + w: _SeriesLikeFloat_co | None = ..., ) -> _ComplexArray: ... @overload def __call__( @@ -730,10 +730,10 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]): x: _SeriesLikeComplex_co, y: _ArrayLikeComplex_co, deg: int | _SeriesLikeInt_co, - rcond: None | float, + rcond: float | None, full: Literal[True], /, - w: None | _SeriesLikeFloat_co = ..., + w: _SeriesLikeFloat_co | None = ..., ) -> tuple[_ComplexArray, _FullFitResult]: ... @overload def __call__( @@ -742,10 +742,10 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]): x: _SeriesLikeComplex_co, y: _ArrayLikeComplex_co, deg: int | _SeriesLikeInt_co, - rcond: None | float = ..., + rcond: float | None = ..., *, full: Literal[True], - w: None | _SeriesLikeFloat_co = ..., + w: _SeriesLikeFloat_co | None = ..., ) -> tuple[_ComplexArray, _FullFitResult]: ... @overload def __call__( @@ -754,9 +754,9 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]): x: _SeriesLikeComplex_co, y: _ArrayLikeCoef_co, deg: int | _SeriesLikeInt_co, - rcond: None | float = ..., + rcond: float | None = ..., full: Literal[False] = ..., - w: None | _SeriesLikeFloat_co = ..., + w: _SeriesLikeFloat_co | None = ..., ) -> _ObjectArray: ... @overload def __call__( @@ -764,10 +764,10 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]): x: _SeriesLikeComplex_co, y: _ArrayLikeCoef_co, deg: int | _SeriesLikeInt_co, - rcond: None | float, + rcond: float | None, full: Literal[True], /, - w: None | _SeriesLikeFloat_co = ..., + w: _SeriesLikeFloat_co | None = ..., ) -> tuple[_ObjectArray, _FullFitResult]: ... @overload def __call__( @@ -776,10 +776,10 @@ class _FuncFit(_Named[_Name_co], Protocol[_Name_co]): x: _SeriesLikeComplex_co, y: _ArrayLikeCoef_co, deg: int | _SeriesLikeInt_co, - rcond: None | float = ..., + rcond: float | None = ..., *, full: Literal[True], - w: None | _SeriesLikeFloat_co = ..., + w: _SeriesLikeFloat_co | None = ..., ) -> tuple[_ObjectArray, _FullFitResult]: ... @type_check_only diff --git a/src/numpy-stubs/polynomial/chebyshev.pyi b/src/numpy-stubs/polynomial/chebyshev.pyi index f26c1c9b..6a5a010f 100644 --- a/src/numpy-stubs/polynomial/chebyshev.pyi +++ b/src/numpy-stubs/polynomial/chebyshev.pyi @@ -162,7 +162,7 @@ class Chebyshev(ABCPolyBase[L["T"]]): /, func: Callable[[npt.NDArray[np.float64]], _CoefSeries], deg: _IntLike_co, - domain: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., args: tuple[()] = ..., ) -> _Self: ... @overload @@ -175,7 +175,7 @@ class Chebyshev(ABCPolyBase[L["T"]]): _CoefSeries, ], deg: _IntLike_co, - domain: None | _SeriesLikeCoef_co = ..., + domain: _SeriesLikeCoef_co | None = ..., *, args: Iterable[Any], ) -> _Self: ... @@ -188,7 +188,7 @@ class Chebyshev(ABCPolyBase[L["T"]]): _CoefSeries, ], deg: _IntLike_co, - domain: None | _SeriesLikeCoef_co, + domain: _SeriesLikeCoef_co | None, args: Iterable[Any], /, ) -> _Self: ... diff --git a/src/numpy-stubs/polynomial/polyutils.pyi b/src/numpy-stubs/polynomial/polyutils.pyi index 1c15a9f3..e36fe486 100644 --- a/src/numpy-stubs/polynomial/polyutils.pyi +++ b/src/numpy-stubs/polynomial/polyutils.pyi @@ -264,7 +264,7 @@ def mapdomain( def _nth_slice( i: SupportsIndex, ndim: SupportsIndex, -) -> tuple[None | slice, ...]: ... +) -> tuple[slice | None, ...]: ... _vander_nd: _FuncVanderND[Literal["_vander_nd"]] _vander_nd_flat: _FuncVanderND[Literal["_vander_nd_flat"]] @@ -333,28 +333,28 @@ def _pow( # type: ignore[overload-overlap] mul_f: _AnyMulF, c: _SeriesLikeFloat_co, pow: _AnyInt, - maxpower: None | _AnyInt = ..., + maxpower: _AnyInt | None = ..., ) -> _FloatSeries: ... @overload def _pow( mul_f: _AnyMulF, c: _SeriesLikeComplex_co, pow: _AnyInt, - maxpower: None | _AnyInt = ..., + maxpower: _AnyInt | None = ..., ) -> _ComplexSeries: ... @overload def _pow( mul_f: _AnyMulF, c: _SeriesLikeCoef_co, pow: _AnyInt, - maxpower: None | _AnyInt = ..., + maxpower: _AnyInt | None = ..., ) -> _ObjectSeries: ... @overload def _pow( mul_f: _AnyMulF, c: _SeriesLikeCoef_co, pow: _AnyInt, - maxpower: None | _AnyInt = ..., + maxpower: _AnyInt | None = ..., ) -> _CoefSeries: ... # keep in sync with `_polytypes._FuncFit` @@ -364,10 +364,10 @@ def _fit( # type: ignore[overload-overlap] x: _SeriesLikeFloat_co, y: _ArrayLikeFloat_co, deg: _SeriesLikeInt_co, - domain: None | _SeriesLikeFloat_co = ..., - rcond: None | _FloatLike_co = ..., + domain: _SeriesLikeFloat_co | None = ..., + rcond: _FloatLike_co | None = ..., full: Literal[False] = ..., - w: None | _SeriesLikeFloat_co = ..., + w: _SeriesLikeFloat_co | None = ..., ) -> _FloatArray: ... @overload def _fit( @@ -375,10 +375,10 @@ def _fit( x: _SeriesLikeComplex_co, y: _ArrayLikeComplex_co, deg: _SeriesLikeInt_co, - domain: None | _SeriesLikeComplex_co = ..., - rcond: None | _FloatLike_co = ..., + domain: _SeriesLikeComplex_co | None = ..., + rcond: _FloatLike_co | None = ..., full: Literal[False] = ..., - w: None | _SeriesLikeComplex_co = ..., + w: _SeriesLikeComplex_co | None = ..., ) -> _ComplexArray: ... @overload def _fit( @@ -386,10 +386,10 @@ def _fit( x: _SeriesLikeCoef_co, y: _ArrayLikeCoef_co, deg: _SeriesLikeInt_co, - domain: None | _SeriesLikeCoef_co = ..., - rcond: None | _FloatLike_co = ..., + domain: _SeriesLikeCoef_co | None = ..., + rcond: _FloatLike_co | None = ..., full: Literal[False] = ..., - w: None | _SeriesLikeCoef_co = ..., + w: _SeriesLikeCoef_co | None = ..., ) -> _CoefArray: ... @overload def _fit( @@ -397,11 +397,11 @@ def _fit( x: _SeriesLikeCoef_co, y: _SeriesLikeCoef_co, deg: _SeriesLikeInt_co, - domain: None | _SeriesLikeCoef_co, - rcond: None | _FloatLike_co, + domain: _SeriesLikeCoef_co | None, + rcond: _FloatLike_co | None, full: Literal[True], /, - w: None | _SeriesLikeCoef_co = ..., + w: _SeriesLikeCoef_co | None = ..., ) -> tuple[_CoefSeries, Sequence[np.inexact[Any] | np.int32]]: ... @overload def _fit( @@ -409,11 +409,11 @@ def _fit( x: _SeriesLikeCoef_co, y: _SeriesLikeCoef_co, deg: _SeriesLikeInt_co, - domain: None | _SeriesLikeCoef_co = ..., - rcond: None | _FloatLike_co = ..., + domain: _SeriesLikeCoef_co | None = ..., + rcond: _FloatLike_co | None = ..., *, full: Literal[True], - w: None | _SeriesLikeCoef_co = ..., + w: _SeriesLikeCoef_co | None = ..., ) -> tuple[_CoefSeries, Sequence[np.inexact[Any] | np.int32]]: ... def _as_int(x: SupportsIndex, desc: str) -> int: ... def format_float(x: _FloatLike_co, parens: bool = ...) -> str: ... diff --git a/src/numpy-stubs/random/_generator.pyi b/src/numpy-stubs/random/_generator.pyi index f2215c19..4a910d35 100644 --- a/src/numpy-stubs/random/_generator.pyi +++ b/src/numpy-stubs/random/_generator.pyi @@ -83,14 +83,14 @@ class Generator: self, size: _ShapeLike = ..., dtype: _DTypeLikeFloat32 = ..., - out: None | NDArray[float32] = ..., + out: NDArray[float32] | None = ..., ) -> NDArray[float32]: ... @overload def standard_normal( # type: ignore[misc] self, size: _ShapeLike = ..., dtype: _DTypeLikeFloat64 = ..., - out: None | NDArray[float64] = ..., + out: NDArray[float64] | None = ..., ) -> NDArray[float64]: ... @overload def permutation(self, x: int, axis: int = ...) -> NDArray[int64]: ... @@ -121,7 +121,7 @@ class Generator: size: _ShapeLike = ..., *, method: Literal["zig", "inv"] = ..., - out: None | NDArray[float64] = ..., + out: NDArray[float64] | None = ..., ) -> NDArray[float64]: ... @overload def standard_exponential( @@ -129,7 +129,7 @@ class Generator: size: _ShapeLike = ..., dtype: _DTypeLikeFloat32 = ..., method: Literal["zig", "inv"] = ..., - out: None | NDArray[float32] = ..., + out: NDArray[float32] | None = ..., ) -> NDArray[float32]: ... @overload def standard_exponential( @@ -137,7 +137,7 @@ class Generator: size: _ShapeLike = ..., dtype: _DTypeLikeFloat64 = ..., method: Literal["zig", "inv"] = ..., - out: None | NDArray[float64] = ..., + out: NDArray[float64] | None = ..., ) -> NDArray[float64]: ... @overload def random( # type: ignore[misc] @@ -157,21 +157,21 @@ class Generator: self, size: _ShapeLike = ..., *, - out: None | NDArray[float64] = ..., + out: NDArray[float64] | None = ..., ) -> NDArray[float64]: ... @overload def random( self, size: _ShapeLike = ..., dtype: _DTypeLikeFloat32 = ..., - out: None | NDArray[float32] = ..., + out: NDArray[float32] | None = ..., ) -> NDArray[float32]: ... @overload def random( self, size: _ShapeLike = ..., dtype: _DTypeLikeFloat64 = ..., - out: None | NDArray[float64] = ..., + out: NDArray[float64] | None = ..., ) -> NDArray[float64]: ... @overload def beta( @@ -181,16 +181,16 @@ class Generator: size: None = ..., ) -> float: ... # type: ignore[misc] @overload - def beta(self, a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def beta(self, a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def exponential(self, scale: _FloatLike_co = ..., size: None = ...) -> float: ... # type: ignore[misc] @overload - def exponential(self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def exponential(self, scale: _ArrayLikeFloat_co = ..., size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., *, endpoint: bool = ..., @@ -199,7 +199,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: type[bool] = ..., endpoint: bool = ..., @@ -208,7 +208,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: type[np.bool] = ..., endpoint: bool = ..., @@ -217,7 +217,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: type[int] = ..., endpoint: bool = ..., @@ -226,7 +226,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[uint8] | type[uint8] | _UInt8Codes | _SupportsDType[dtype[uint8]] = ..., endpoint: bool = ..., @@ -235,7 +235,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[uint16] | type[uint16] | _UInt16Codes | _SupportsDType[dtype[uint16]] = ..., endpoint: bool = ..., @@ -244,7 +244,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[uint32] | type[uint32] | _UInt32Codes | _SupportsDType[dtype[uint32]] = ..., endpoint: bool = ..., @@ -253,7 +253,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[uint] | type[uint] | _UIntCodes | _SupportsDType[dtype[uint]] = ..., endpoint: bool = ..., @@ -262,7 +262,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[uint64] | type[uint64] | _UInt64Codes | _SupportsDType[dtype[uint64]] = ..., endpoint: bool = ..., @@ -271,7 +271,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[int8] | type[int8] | _Int8Codes | _SupportsDType[dtype[int8]] = ..., endpoint: bool = ..., @@ -280,7 +280,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[int16] | type[int16] | _Int16Codes | _SupportsDType[dtype[int16]] = ..., endpoint: bool = ..., @@ -289,7 +289,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[int32] | type[int32] | _Int32Codes | _SupportsDType[dtype[int32]] = ..., endpoint: bool = ..., @@ -298,7 +298,7 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: type[int | int_] | dtype[int_] | _IntCodes | _SupportsDType[dtype[int_]] = ..., endpoint: bool = ..., @@ -307,21 +307,21 @@ class Generator: def integers( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] = ..., endpoint: bool = ..., ) -> int64: ... @overload def integers( # type: ignore[misc] - self, low: _ArrayLikeInt_co, high: None | _ArrayLikeInt_co = ..., size: None | _ShapeLike = ..., *, endpoint: bool = ... + self, low: _ArrayLikeInt_co, high: _ArrayLikeInt_co | None = ..., size: _ShapeLike | None = ..., *, endpoint: bool = ... ) -> NDArray[int64]: ... @overload def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: _DTypeLikeBool = ..., endpoint: bool = ..., ) -> NDArray[np.bool]: ... @@ -329,8 +329,8 @@ class Generator: def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[int8] | type[int8] | _Int8Codes | _SupportsDType[dtype[int8]] = ..., endpoint: bool = ..., ) -> NDArray[int8]: ... @@ -338,8 +338,8 @@ class Generator: def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[int16] | type[int16] | _Int16Codes | _SupportsDType[dtype[int16]] = ..., endpoint: bool = ..., ) -> NDArray[int16]: ... @@ -347,8 +347,8 @@ class Generator: def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[int32] | type[int32] | _Int32Codes | _SupportsDType[dtype[int32]] = ..., endpoint: bool = ..., ) -> NDArray[int32]: ... @@ -356,17 +356,17 @@ class Generator: def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., - dtype: None | dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., + dtype: dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] | None = ..., endpoint: bool = ..., ) -> NDArray[int64]: ... @overload def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[uint8] | type[uint8] | _UInt8Codes | _SupportsDType[dtype[uint8]] = ..., endpoint: bool = ..., ) -> NDArray[uint8]: ... @@ -374,8 +374,8 @@ class Generator: def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[uint16] | type[uint16] | _UInt16Codes | _SupportsDType[dtype[uint16]] = ..., endpoint: bool = ..., ) -> NDArray[uint16]: ... @@ -383,8 +383,8 @@ class Generator: def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[uint32] | type[uint32] | _UInt32Codes | _SupportsDType[dtype[uint32]] = ..., endpoint: bool = ..., ) -> NDArray[uint32]: ... @@ -392,8 +392,8 @@ class Generator: def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[uint64] | type[uint64] | _UInt64Codes | _SupportsDType[dtype[uint64]] = ..., endpoint: bool = ..., ) -> NDArray[uint64]: ... @@ -401,8 +401,8 @@ class Generator: def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: type[int | int_] | dtype[int_] | _IntCodes | _SupportsDType[dtype[int_]] = ..., endpoint: bool = ..., ) -> NDArray[int_]: ... @@ -410,8 +410,8 @@ class Generator: def integers( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[uint] | type[uint] | _UIntCodes | _SupportsDType[dtype[uint]] = ..., endpoint: bool = ..., ) -> NDArray[uint]: ... @@ -423,7 +423,7 @@ class Generator: a: int, size: None = ..., replace: bool = ..., - p: None | _ArrayLikeFloat_co = ..., + p: _ArrayLikeFloat_co | None = ..., axis: int = ..., shuffle: bool = ..., ) -> int: ... @@ -433,7 +433,7 @@ class Generator: a: int, size: _ShapeLike = ..., replace: bool = ..., - p: None | _ArrayLikeFloat_co = ..., + p: _ArrayLikeFloat_co | None = ..., axis: int = ..., shuffle: bool = ..., ) -> NDArray[int64]: ... @@ -443,7 +443,7 @@ class Generator: a: ArrayLike, size: None = ..., replace: bool = ..., - p: None | _ArrayLikeFloat_co = ..., + p: _ArrayLikeFloat_co | None = ..., axis: int = ..., shuffle: bool = ..., ) -> Any: ... @@ -453,7 +453,7 @@ class Generator: a: ArrayLike, size: _ShapeLike = ..., replace: bool = ..., - p: None | _ArrayLikeFloat_co = ..., + p: _ArrayLikeFloat_co | None = ..., axis: int = ..., shuffle: bool = ..., ) -> NDArray[Any]: ... @@ -469,7 +469,7 @@ class Generator: self, low: _ArrayLikeFloat_co = ..., high: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def normal( @@ -483,7 +483,7 @@ class Generator: self, loc: _ArrayLikeFloat_co = ..., scale: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def standard_gamma( # type: ignore[misc] @@ -497,7 +497,7 @@ class Generator: def standard_gamma( self, shape: _ArrayLikeFloat_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def standard_gamma( @@ -510,17 +510,17 @@ class Generator: def standard_gamma( self, shape: _ArrayLikeFloat_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., dtype: _DTypeLikeFloat32 = ..., - out: None | NDArray[float32] = ..., + out: NDArray[float32] | None = ..., ) -> NDArray[float32]: ... @overload def standard_gamma( self, shape: _ArrayLikeFloat_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., dtype: _DTypeLikeFloat64 = ..., - out: None | NDArray[float64] = ..., + out: NDArray[float64] | None = ..., ) -> NDArray[float64]: ... @overload def gamma(self, shape: _FloatLike_co, scale: _FloatLike_co = ..., size: None = ...) -> float: ... # type: ignore[misc] @@ -529,12 +529,12 @@ class Generator: self, shape: _ArrayLikeFloat_co, scale: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def f(self, dfnum: _FloatLike_co, dfden: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc] @overload - def f(self, dfnum: _ArrayLikeFloat_co, dfden: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def f(self, dfnum: _ArrayLikeFloat_co, dfden: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def noncentral_f(self, dfnum: _FloatLike_co, dfden: _FloatLike_co, nonc: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc] @overload @@ -543,17 +543,17 @@ class Generator: dfnum: _ArrayLikeFloat_co, dfden: _ArrayLikeFloat_co, nonc: _ArrayLikeFloat_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def chisquare(self, df: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc] @overload - def chisquare(self, df: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def chisquare(self, df: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def noncentral_chisquare(self, df: _FloatLike_co, nonc: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc] @overload def noncentral_chisquare( - self, df: _ArrayLikeFloat_co, nonc: _ArrayLikeFloat_co, size: None | _ShapeLike = ... + self, df: _ArrayLikeFloat_co, nonc: _ArrayLikeFloat_co, size: _ShapeLike | None = ... ) -> NDArray[float64]: ... @overload def standard_t(self, df: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc] @@ -564,19 +564,19 @@ class Generator: @overload def vonmises(self, mu: _FloatLike_co, kappa: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc] @overload - def vonmises(self, mu: _ArrayLikeFloat_co, kappa: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def vonmises(self, mu: _ArrayLikeFloat_co, kappa: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def pareto(self, a: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc] @overload - def pareto(self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def pareto(self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def weibull(self, a: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc] @overload - def weibull(self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def weibull(self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def power(self, a: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc] @overload - def power(self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def power(self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def standard_cauchy(self, size: None = ...) -> float: ... # type: ignore[misc] @overload @@ -593,7 +593,7 @@ class Generator: self, loc: _ArrayLikeFloat_co = ..., scale: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def gumbel( @@ -607,7 +607,7 @@ class Generator: self, loc: _ArrayLikeFloat_co = ..., scale: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def logistic( @@ -621,7 +621,7 @@ class Generator: self, loc: _ArrayLikeFloat_co = ..., scale: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def lognormal( @@ -635,16 +635,16 @@ class Generator: self, mean: _ArrayLikeFloat_co = ..., sigma: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def rayleigh(self, scale: _FloatLike_co = ..., size: None = ...) -> float: ... # type: ignore[misc] @overload - def rayleigh(self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def rayleigh(self, scale: _ArrayLikeFloat_co = ..., size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def wald(self, mean: _FloatLike_co, scale: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc] @overload - def wald(self, mean: _ArrayLikeFloat_co, scale: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def wald(self, mean: _ArrayLikeFloat_co, scale: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def triangular( self, @@ -659,30 +659,30 @@ class Generator: left: _ArrayLikeFloat_co, mode: _ArrayLikeFloat_co, right: _ArrayLikeFloat_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def binomial(self, n: int, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc] @overload - def binomial(self, n: _ArrayLikeInt_co, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[int64]: ... + def binomial(self, n: _ArrayLikeInt_co, p: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[int64]: ... @overload def negative_binomial(self, n: _FloatLike_co, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc] @overload def negative_binomial( - self, n: _ArrayLikeFloat_co, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ... + self, n: _ArrayLikeFloat_co, p: _ArrayLikeFloat_co, size: _ShapeLike | None = ... ) -> NDArray[int64]: ... @overload def poisson(self, lam: _FloatLike_co = ..., size: None = ...) -> int: ... # type: ignore[misc] @overload - def poisson(self, lam: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...) -> NDArray[int64]: ... + def poisson(self, lam: _ArrayLikeFloat_co = ..., size: _ShapeLike | None = ...) -> NDArray[int64]: ... @overload def zipf(self, a: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc] @overload - def zipf(self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[int64]: ... + def zipf(self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[int64]: ... @overload def geometric(self, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc] @overload - def geometric(self, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[int64]: ... + def geometric(self, p: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[int64]: ... @overload def hypergeometric(self, ngood: int, nbad: int, nsample: int, size: None = ...) -> int: ... # type: ignore[misc] @overload @@ -691,32 +691,32 @@ class Generator: ngood: _ArrayLikeInt_co, nbad: _ArrayLikeInt_co, nsample: _ArrayLikeInt_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[int64]: ... @overload def logseries(self, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc] @overload - def logseries(self, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[int64]: ... + def logseries(self, p: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[int64]: ... def multivariate_normal( self, mean: _ArrayLikeFloat_co, cov: _ArrayLikeFloat_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., check_valid: Literal["warn", "raise", "ignore"] = ..., tol: float = ..., *, method: Literal["svd", "eigh", "cholesky"] = ..., ) -> NDArray[float64]: ... - def multinomial(self, n: _ArrayLikeInt_co, pvals: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[int64]: ... + def multinomial(self, n: _ArrayLikeInt_co, pvals: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[int64]: ... def multivariate_hypergeometric( self, colors: _ArrayLikeInt_co, nsample: int, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., method: Literal["marginals", "count"] = ..., ) -> NDArray[int64]: ... - def dirichlet(self, alpha: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... - def permuted(self, x: ArrayLike, *, axis: None | int = ..., out: None | NDArray[Any] = ...) -> NDArray[Any]: ... + def dirichlet(self, alpha: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... + def permuted(self, x: ArrayLike, *, axis: int | None = ..., out: NDArray[Any] | None = ...) -> NDArray[Any]: ... def shuffle(self, x: ArrayLike, axis: int = ...) -> None: ... -def default_rng(seed: None | _ArrayLikeInt_co | SeedSequence | BitGenerator | Generator | RandomState = ...) -> Generator: ... +def default_rng(seed: _ArrayLikeInt_co | SeedSequence | BitGenerator | Generator | RandomState | None = ...) -> Generator: ... diff --git a/src/numpy-stubs/random/_mt19937.pyi b/src/numpy-stubs/random/_mt19937.pyi index 5c850ba3..70b2506d 100644 --- a/src/numpy-stubs/random/_mt19937.pyi +++ b/src/numpy-stubs/random/_mt19937.pyi @@ -16,7 +16,7 @@ class _MT19937State(TypedDict): state: _MT19937Internal class MT19937(BitGenerator): - def __init__(self, seed: None | _ArrayLikeInt_co | SeedSequence = ...) -> None: ... + def __init__(self, seed: _ArrayLikeInt_co | SeedSequence | None = ...) -> None: ... def _legacy_seeding(self, seed: _ArrayLikeInt_co) -> None: ... def jumped(self, jumps: int = ...) -> MT19937: ... @property diff --git a/src/numpy-stubs/random/_pcg64.pyi b/src/numpy-stubs/random/_pcg64.pyi index 7adfce9d..5dc7bb66 100644 --- a/src/numpy-stubs/random/_pcg64.pyi +++ b/src/numpy-stubs/random/_pcg64.pyi @@ -16,7 +16,7 @@ class _PCG64State(TypedDict): uinteger: int class PCG64(BitGenerator): - def __init__(self, seed: None | _ArrayLikeInt_co | SeedSequence = ...) -> None: ... + def __init__(self, seed: _ArrayLikeInt_co | SeedSequence | None = ...) -> None: ... def jumped(self, jumps: int = ...) -> PCG64: ... @property def state( @@ -30,7 +30,7 @@ class PCG64(BitGenerator): def advance(self, delta: int) -> PCG64: ... class PCG64DXSM(BitGenerator): - def __init__(self, seed: None | _ArrayLikeInt_co | SeedSequence = ...) -> None: ... + def __init__(self, seed: _ArrayLikeInt_co | SeedSequence | None = ...) -> None: ... def jumped(self, jumps: int = ...) -> PCG64DXSM: ... @property def state( diff --git a/src/numpy-stubs/random/_philox.pyi b/src/numpy-stubs/random/_philox.pyi index 197160a7..d8895bba 100644 --- a/src/numpy-stubs/random/_philox.pyi +++ b/src/numpy-stubs/random/_philox.pyi @@ -22,9 +22,9 @@ class _PhiloxState(TypedDict): class Philox(BitGenerator): def __init__( self, - seed: None | _ArrayLikeInt_co | SeedSequence = ..., - counter: None | _ArrayLikeInt_co = ..., - key: None | _ArrayLikeInt_co = ..., + seed: _ArrayLikeInt_co | SeedSequence | None = ..., + counter: _ArrayLikeInt_co | None = ..., + key: _ArrayLikeInt_co | None = ..., ) -> None: ... @property def state( diff --git a/src/numpy-stubs/random/_sfc64.pyi b/src/numpy-stubs/random/_sfc64.pyi index 7e4a25c1..a6f0d844 100644 --- a/src/numpy-stubs/random/_sfc64.pyi +++ b/src/numpy-stubs/random/_sfc64.pyi @@ -16,7 +16,7 @@ class _SFC64State(TypedDict): uinteger: int class SFC64(BitGenerator): - def __init__(self, seed: None | _ArrayLikeInt_co | SeedSequence = ...) -> None: ... + def __init__(self, seed: _ArrayLikeInt_co | SeedSequence | None = ...) -> None: ... @property def state( self, diff --git a/src/numpy-stubs/random/bit_generator.pyi b/src/numpy-stubs/random/bit_generator.pyi index ee019fb6..e49b0697 100644 --- a/src/numpy-stubs/random/bit_generator.pyi +++ b/src/numpy-stubs/random/bit_generator.pyi @@ -29,7 +29,7 @@ _DTypeLikeUint64: TypeAlias = dtype[uint64] | _SupportsDType[dtype[uint64]] | ty @type_check_only class _SeedSeqState(TypedDict): - entropy: None | int | Sequence[int] + entropy: int | Sequence[int] | None spawn_key: tuple[int, ...] pool_size: int n_children_spawned: int @@ -56,14 +56,14 @@ class SeedlessSeedSequence(ISpawnableSeedSequence): def spawn(self: _T, n_children: int) -> list[_T]: ... class SeedSequence(ISpawnableSeedSequence): - entropy: None | int | Sequence[int] + entropy: int | Sequence[int] | None spawn_key: tuple[int, ...] pool_size: int n_children_spawned: int pool: NDArray[uint32] def __init__( self, - entropy: None | int | Sequence[int] | _ArrayLikeInt_co = ..., + entropy: int | Sequence[int] | _ArrayLikeInt_co | None = ..., *, spawn_key: Sequence[int] = ..., pool_size: int = ..., @@ -78,7 +78,7 @@ class SeedSequence(ISpawnableSeedSequence): class BitGenerator(abc.ABC): lock: Lock - def __init__(self, seed: None | _ArrayLikeInt_co | SeedSequence = ...) -> None: ... + def __init__(self, seed: _ArrayLikeInt_co | SeedSequence | None = ...) -> None: ... def __getstate__(self) -> tuple[dict[str, Any], ISeedSequence]: ... def __setstate__(self, state_seed_seq: dict[str, Any] | tuple[dict[str, Any], ISeedSequence]) -> None: ... def __reduce__( @@ -97,7 +97,7 @@ class BitGenerator(abc.ABC): @overload def random_raw(self, size: _ShapeLike = ..., output: Literal[True] = ...) -> NDArray[uint64]: ... # type: ignore[misc] @overload - def random_raw(self, size: None | _ShapeLike = ..., output: Literal[False] = ...) -> None: ... # type: ignore[misc] + def random_raw(self, size: _ShapeLike | None = ..., output: Literal[False] = ...) -> None: ... # type: ignore[misc] def _benchmark(self, cnt: int, method: str = ...) -> None: ... @property def ctypes(self) -> _Interface: ... diff --git a/src/numpy-stubs/random/mtrand.pyi b/src/numpy-stubs/random/mtrand.pyi index 2fcf94f0..841bd6c6 100644 --- a/src/numpy-stubs/random/mtrand.pyi +++ b/src/numpy-stubs/random/mtrand.pyi @@ -44,11 +44,11 @@ from numpy.random.bit_generator import BitGenerator class RandomState: _bit_generator: BitGenerator - def __init__(self, seed: None | _ArrayLikeInt_co | BitGenerator = ...) -> None: ... + def __init__(self, seed: _ArrayLikeInt_co | BitGenerator | None = ...) -> None: ... def __getstate__(self) -> dict[str, Any]: ... def __setstate__(self, state: dict[str, Any]) -> None: ... def __reduce__(self) -> tuple[Callable[[BitGenerator], RandomState], tuple[BitGenerator], dict[str, Any]]: ... - def seed(self, seed: None | _ArrayLikeFloat_co = ...) -> None: ... + def seed(self, seed: _ArrayLikeFloat_co | None = ...) -> None: ... @overload def get_state(self, legacy: Literal[False] = ...) -> dict[str, Any]: ... @overload @@ -65,11 +65,11 @@ class RandomState: @overload def beta(self, a: float, b: float, size: None = ...) -> float: ... # type: ignore[misc] @overload - def beta(self, a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def beta(self, a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def exponential(self, scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] @overload - def exponential(self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def exponential(self, scale: _ArrayLikeFloat_co = ..., size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def standard_exponential(self, size: None = ...) -> float: ... # type: ignore[misc] @overload @@ -83,14 +83,14 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., ) -> int: ... @overload def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: type[bool] = ..., ) -> bool: ... @@ -98,7 +98,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: type[np.bool] = ..., ) -> np.bool: ... @@ -106,7 +106,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: type[int] = ..., ) -> int: ... @@ -114,7 +114,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[uint8] | type[uint8] | _UInt8Codes | _SupportsDType[dtype[uint8]] = ..., ) -> uint8: ... @@ -122,7 +122,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[uint16] | type[uint16] | _UInt16Codes | _SupportsDType[dtype[uint16]] = ..., ) -> uint16: ... @@ -130,7 +130,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[uint32] | type[uint32] | _UInt32Codes | _SupportsDType[dtype[uint32]] = ..., ) -> uint32: ... @@ -138,7 +138,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[uint] | type[uint] | _UIntCodes | _SupportsDType[dtype[uint]] = ..., ) -> uint: ... @@ -146,7 +146,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[ulong] | type[ulong] | _ULongCodes | _SupportsDType[dtype[ulong]] = ..., ) -> ulong: ... @@ -154,7 +154,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[uint64] | type[uint64] | _UInt64Codes | _SupportsDType[dtype[uint64]] = ..., ) -> uint64: ... @@ -162,7 +162,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[int8] | type[int8] | _Int8Codes | _SupportsDType[dtype[int8]] = ..., ) -> int8: ... @@ -170,7 +170,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[int16] | type[int16] | _Int16Codes | _SupportsDType[dtype[int16]] = ..., ) -> int16: ... @@ -178,7 +178,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[int32] | type[int32] | _Int32Codes | _SupportsDType[dtype[int32]] = ..., ) -> int32: ... @@ -186,7 +186,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[int_] | type[int_] | _IntCodes | _SupportsDType[dtype[int_]] = ..., ) -> int_: ... @@ -194,7 +194,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[long] | type[long] | _LongCodes | _SupportsDType[dtype[long]] = ..., ) -> long: ... @@ -202,7 +202,7 @@ class RandomState: def randint( # type: ignore[misc] self, low: int, - high: None | int = ..., + high: int | None = ..., size: None = ..., dtype: dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] = ..., ) -> int64: ... @@ -210,95 +210,95 @@ class RandomState: def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., ) -> NDArray[long]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: _DTypeLikeBool = ..., ) -> NDArray[np.bool]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[int8] | type[int8] | _Int8Codes | _SupportsDType[dtype[int8]] = ..., ) -> NDArray[int8]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[int16] | type[int16] | _Int16Codes | _SupportsDType[dtype[int16]] = ..., ) -> NDArray[int16]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[int32] | type[int32] | _Int32Codes | _SupportsDType[dtype[int32]] = ..., ) -> NDArray[int32]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., - dtype: None | dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., + dtype: dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] | None = ..., ) -> NDArray[int64]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[uint8] | type[uint8] | _UInt8Codes | _SupportsDType[dtype[uint8]] = ..., ) -> NDArray[uint8]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[uint16] | type[uint16] | _UInt16Codes | _SupportsDType[dtype[uint16]] = ..., ) -> NDArray[uint16]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[uint32] | type[uint32] | _UInt32Codes | _SupportsDType[dtype[uint32]] = ..., ) -> NDArray[uint32]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[uint64] | type[uint64] | _UInt64Codes | _SupportsDType[dtype[uint64]] = ..., ) -> NDArray[uint64]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: type[int | long] | dtype[long] | _LongCodes | _SupportsDType[dtype[long]] = ..., ) -> NDArray[long]: ... @overload def randint( # type: ignore[misc] self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., dtype: dtype[ulong] | type[ulong] | _ULongCodes | _SupportsDType[dtype[ulong]] = ..., ) -> NDArray[ulong]: ... def bytes(self, length: int) -> builtins.bytes: ... @@ -308,7 +308,7 @@ class RandomState: a: int, size: None = ..., replace: bool = ..., - p: None | _ArrayLikeFloat_co = ..., + p: _ArrayLikeFloat_co | None = ..., ) -> int: ... @overload def choice( @@ -316,7 +316,7 @@ class RandomState: a: int, size: _ShapeLike = ..., replace: bool = ..., - p: None | _ArrayLikeFloat_co = ..., + p: _ArrayLikeFloat_co | None = ..., ) -> NDArray[long]: ... @overload def choice( @@ -324,7 +324,7 @@ class RandomState: a: ArrayLike, size: None = ..., replace: bool = ..., - p: None | _ArrayLikeFloat_co = ..., + p: _ArrayLikeFloat_co | None = ..., ) -> Any: ... @overload def choice( @@ -332,7 +332,7 @@ class RandomState: a: ArrayLike, size: _ShapeLike = ..., replace: bool = ..., - p: None | _ArrayLikeFloat_co = ..., + p: _ArrayLikeFloat_co | None = ..., ) -> NDArray[Any]: ... @overload def uniform(self, low: float = ..., high: float = ..., size: None = ...) -> float: ... # type: ignore[misc] @@ -341,7 +341,7 @@ class RandomState: self, low: _ArrayLikeFloat_co = ..., high: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def rand(self) -> float: ... @@ -352,13 +352,13 @@ class RandomState: @overload def randn(self, *args: int) -> NDArray[float64]: ... @overload - def random_integers(self, low: int, high: None | int = ..., size: None = ...) -> int: ... # type: ignore[misc] + def random_integers(self, low: int, high: int | None = ..., size: None = ...) -> int: ... # type: ignore[misc] @overload def random_integers( self, low: _ArrayLikeInt_co, - high: None | _ArrayLikeInt_co = ..., - size: None | _ShapeLike = ..., + high: _ArrayLikeInt_co | None = ..., + size: _ShapeLike | None = ..., ) -> NDArray[long]: ... @overload def standard_normal(self, size: None = ...) -> float: ... # type: ignore[misc] @@ -373,7 +373,7 @@ class RandomState: self, loc: _ArrayLikeFloat_co = ..., scale: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def standard_gamma( # type: ignore[misc] @@ -385,7 +385,7 @@ class RandomState: def standard_gamma( self, shape: _ArrayLikeFloat_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def gamma(self, shape: float, scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] @@ -394,12 +394,12 @@ class RandomState: self, shape: _ArrayLikeFloat_co, scale: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def f(self, dfnum: float, dfden: float, size: None = ...) -> float: ... # type: ignore[misc] @overload - def f(self, dfnum: _ArrayLikeFloat_co, dfden: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def f(self, dfnum: _ArrayLikeFloat_co, dfden: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def noncentral_f(self, dfnum: float, dfden: float, nonc: float, size: None = ...) -> float: ... # type: ignore[misc] @overload @@ -408,17 +408,17 @@ class RandomState: dfnum: _ArrayLikeFloat_co, dfden: _ArrayLikeFloat_co, nonc: _ArrayLikeFloat_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def chisquare(self, df: float, size: None = ...) -> float: ... # type: ignore[misc] @overload - def chisquare(self, df: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def chisquare(self, df: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def noncentral_chisquare(self, df: float, nonc: float, size: None = ...) -> float: ... # type: ignore[misc] @overload def noncentral_chisquare( - self, df: _ArrayLikeFloat_co, nonc: _ArrayLikeFloat_co, size: None | _ShapeLike = ... + self, df: _ArrayLikeFloat_co, nonc: _ArrayLikeFloat_co, size: _ShapeLike | None = ... ) -> NDArray[float64]: ... @overload def standard_t(self, df: float, size: None = ...) -> float: ... # type: ignore[misc] @@ -429,19 +429,19 @@ class RandomState: @overload def vonmises(self, mu: float, kappa: float, size: None = ...) -> float: ... # type: ignore[misc] @overload - def vonmises(self, mu: _ArrayLikeFloat_co, kappa: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def vonmises(self, mu: _ArrayLikeFloat_co, kappa: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def pareto(self, a: float, size: None = ...) -> float: ... # type: ignore[misc] @overload - def pareto(self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def pareto(self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def weibull(self, a: float, size: None = ...) -> float: ... # type: ignore[misc] @overload - def weibull(self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def weibull(self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def power(self, a: float, size: None = ...) -> float: ... # type: ignore[misc] @overload - def power(self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def power(self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def standard_cauchy(self, size: None = ...) -> float: ... # type: ignore[misc] @overload @@ -453,7 +453,7 @@ class RandomState: self, loc: _ArrayLikeFloat_co = ..., scale: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def gumbel(self, loc: float = ..., scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] @@ -462,7 +462,7 @@ class RandomState: self, loc: _ArrayLikeFloat_co = ..., scale: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def logistic(self, loc: float = ..., scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] @@ -471,7 +471,7 @@ class RandomState: self, loc: _ArrayLikeFloat_co = ..., scale: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def lognormal(self, mean: float = ..., sigma: float = ..., size: None = ...) -> float: ... # type: ignore[misc] @@ -480,16 +480,16 @@ class RandomState: self, mean: _ArrayLikeFloat_co = ..., sigma: _ArrayLikeFloat_co = ..., - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def rayleigh(self, scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] @overload - def rayleigh(self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def rayleigh(self, scale: _ArrayLikeFloat_co = ..., size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def wald(self, mean: float, scale: float, size: None = ...) -> float: ... # type: ignore[misc] @overload - def wald(self, mean: _ArrayLikeFloat_co, scale: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def wald(self, mean: _ArrayLikeFloat_co, scale: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... @overload def triangular(self, left: float, mode: float, right: float, size: None = ...) -> float: ... # type: ignore[misc] @overload @@ -498,28 +498,28 @@ class RandomState: left: _ArrayLikeFloat_co, mode: _ArrayLikeFloat_co, right: _ArrayLikeFloat_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[float64]: ... @overload def binomial(self, n: int, p: float, size: None = ...) -> int: ... # type: ignore[misc] @overload - def binomial(self, n: _ArrayLikeInt_co, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[long]: ... + def binomial(self, n: _ArrayLikeInt_co, p: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[long]: ... @overload def negative_binomial(self, n: float, p: float, size: None = ...) -> int: ... # type: ignore[misc] @overload - def negative_binomial(self, n: _ArrayLikeFloat_co, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[long]: ... + def negative_binomial(self, n: _ArrayLikeFloat_co, p: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[long]: ... @overload def poisson(self, lam: float = ..., size: None = ...) -> int: ... # type: ignore[misc] @overload - def poisson(self, lam: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...) -> NDArray[long]: ... + def poisson(self, lam: _ArrayLikeFloat_co = ..., size: _ShapeLike | None = ...) -> NDArray[long]: ... @overload def zipf(self, a: float, size: None = ...) -> int: ... # type: ignore[misc] @overload - def zipf(self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[long]: ... + def zipf(self, a: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[long]: ... @overload def geometric(self, p: float, size: None = ...) -> int: ... # type: ignore[misc] @overload - def geometric(self, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[long]: ... + def geometric(self, p: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[long]: ... @overload def hypergeometric(self, ngood: int, nbad: int, nsample: int, size: None = ...) -> int: ... # type: ignore[misc] @overload @@ -528,22 +528,22 @@ class RandomState: ngood: _ArrayLikeInt_co, nbad: _ArrayLikeInt_co, nsample: _ArrayLikeInt_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., ) -> NDArray[long]: ... @overload def logseries(self, p: float, size: None = ...) -> int: ... # type: ignore[misc] @overload - def logseries(self, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[long]: ... + def logseries(self, p: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[long]: ... def multivariate_normal( self, mean: _ArrayLikeFloat_co, cov: _ArrayLikeFloat_co, - size: None | _ShapeLike = ..., + size: _ShapeLike | None = ..., check_valid: Literal["warn", "raise", "ignore"] = ..., tol: float = ..., ) -> NDArray[float64]: ... - def multinomial(self, n: _ArrayLikeInt_co, pvals: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[long]: ... - def dirichlet(self, alpha: _ArrayLikeFloat_co, size: None | _ShapeLike = ...) -> NDArray[float64]: ... + def multinomial(self, n: _ArrayLikeInt_co, pvals: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[long]: ... + def dirichlet(self, alpha: _ArrayLikeFloat_co, size: _ShapeLike | None = ...) -> NDArray[float64]: ... def shuffle(self, x: ArrayLike) -> None: ... @overload def permutation(self, x: int) -> NDArray[long]: ... diff --git a/src/numpy-stubs/testing/_private/utils.pyi b/src/numpy-stubs/testing/_private/utils.pyi index 382702c0..5b575f99 100644 --- a/src/numpy-stubs/testing/_private/utils.pyi +++ b/src/numpy-stubs/testing/_private/utils.pyi @@ -118,12 +118,12 @@ class clear_and_catch_warnings(warnings.catch_warnings[list[warnings.WarningMess record: bool, modules: Iterable[types.ModuleType] = ..., ) -> clear_and_catch_warnings: ... - def __enter__(self) -> None | list[warnings.WarningMessage]: ... + def __enter__(self) -> list[warnings.WarningMessage] | None: ... def __exit__( self, - __exc_type: None | type[BaseException] = ..., - __exc_val: None | BaseException = ..., - __exc_tb: None | types.TracebackType = ..., + __exc_type: type[BaseException] | None = ..., + __exc_val: BaseException | None = ..., + __exc_tb: types.TracebackType | None = ..., ) -> None: ... # Type-check only `clear_and_catch_warnings` subclasses for both values of the @@ -147,20 +147,20 @@ class suppress_warnings: self, category: type[Warning] = ..., message: str = ..., - module: None | types.ModuleType = ..., + module: types.ModuleType | None = ..., ) -> None: ... def record( self, category: type[Warning] = ..., message: str = ..., - module: None | types.ModuleType = ..., + module: types.ModuleType | None = ..., ) -> list[warnings.WarningMessage]: ... def __enter__(self) -> Self: ... def __exit__( self, - __exc_type: None | type[BaseException] = ..., - __exc_val: None | BaseException = ..., - __exc_tb: None | types.TracebackType = ..., + __exc_type: type[BaseException] | None = ..., + __exc_val: BaseException | None = ..., + __exc_tb: types.TracebackType | None = ..., ) -> None: ... def __call__(self, func: _FT) -> _FT: ... @@ -182,7 +182,7 @@ if sys.platform == "win32" or sys.platform == "cygwin": def memusage(processName: str = ..., instance: int = ...) -> int: ... elif sys.platform == "linux": - def memusage(_proc_pid_stat: StrOrBytesPath = ...) -> None | int: ... + def memusage(_proc_pid_stat: StrOrBytesPath = ...) -> int | None: ... else: def memusage() -> NoReturn: ... @@ -202,7 +202,7 @@ def build_err_msg( header: str = ..., verbose: bool = ..., names: Sequence[str] = ..., - precision: None | SupportsIndex = ..., + precision: SupportsIndex | None = ..., ) -> str: ... def assert_equal(actual: object, desired: object, err_msg: object = ..., verbose: bool = ..., *, strict: bool = ...) -> None: ... def print_assert_equal( @@ -269,7 +269,7 @@ def assert_array_less( ) -> None: ... def runstring( astr: str | bytes | types.CodeType, - dict: None | dict[str, Any], + dict: dict[str, Any] | None, ) -> Any: ... def assert_string_equal(actual: str, desired: str) -> None: ... def rundocs( @@ -290,7 +290,7 @@ def assert_raises( # type: ignore def assert_raises( expected_exception: type[_ET] | tuple[type[_ET], ...], *, - msg: None | str = ..., + msg: str | None = ..., ) -> unittest.case._AssertRaisesContext[_ET]: ... @overload def assert_raises_regex( @@ -306,17 +306,17 @@ def assert_raises_regex( expected_exception: type[_ET] | tuple[type[_ET], ...], expected_regex: str | bytes | Pattern[Any], *, - msg: None | str = ..., + msg: str | None = ..., ) -> unittest.case._AssertRaisesContext[_ET]: ... def decorate_methods( cls: type[Any], decorator: Callable[[Callable[..., Any]], Any], - testmatch: None | str | bytes | Pattern[Any] = ..., + testmatch: str | bytes | Pattern[Any] | None = ..., ) -> None: ... def measure( code_str: str | bytes | ast.mod | ast.AST, times: int = ..., - label: None | str = ..., + label: str | None = ..., ) -> float: ... @overload def assert_allclose( diff --git a/tests/data/reveal/arrayterator.pyi b/tests/data/reveal/arrayterator.pyi index b8fe1ea5..d7761940 100644 --- a/tests/data/reveal/arrayterator.pyi +++ b/tests/data/reveal/arrayterator.pyi @@ -8,7 +8,7 @@ AR_i8: npt.NDArray[np.int64] ar_iter = np.lib.Arrayterator(AR_i8) assert_type(ar_iter.var, npt.NDArray[np.int64]) -assert_type(ar_iter.buf_size, None | int) +assert_type(ar_iter.buf_size, int | None) assert_type(ar_iter.start, list[int]) assert_type(ar_iter.stop, list[int]) assert_type(ar_iter.step, list[int]) diff --git a/tests/data/reveal/dtype.pyi b/tests/data/reveal/dtype.pyi index f74cddf5..247ff697 100644 --- a/tests/data/reveal/dtype.pyi +++ b/tests/data/reveal/dtype.pyi @@ -106,11 +106,11 @@ assert_type(np.dtype("|T"), StringDType) # Methods and attributes assert_type(dtype_U.base, np.dtype[Any]) -assert_type(dtype_U.subdtype, None | tuple[np.dtype[Any], tuple[int, ...]]) +assert_type(dtype_U.subdtype, tuple[np.dtype[Any], tuple[int, ...]] | None) assert_type(dtype_U.newbyteorder(), np.dtype[np.str_]) assert_type(dtype_U.type, type[np.str_]) assert_type(dtype_U.name, str) -assert_type(dtype_U.names, None | tuple[str, ...]) +assert_type(dtype_U.names, tuple[str, ...] | None) assert_type(dtype_U * 0, np.dtype[np.str_]) assert_type(dtype_U * 1, np.dtype[np.str_]) diff --git a/tests/data/reveal/lib_function_base.pyi b/tests/data/reveal/lib_function_base.pyi index faaa92c6..df15906e 100644 --- a/tests/data/reveal/lib_function_base.pyi +++ b/tests/data/reveal/lib_function_base.pyi @@ -35,10 +35,10 @@ def func( assert_type(vectorized_func.pyfunc, Callable[..., Any]) assert_type(vectorized_func.cache, bool) -assert_type(vectorized_func.signature, None | str) -assert_type(vectorized_func.otypes, None | str) +assert_type(vectorized_func.signature, str | None) +assert_type(vectorized_func.otypes, str | None) assert_type(vectorized_func.excluded, set[int | str]) -assert_type(vectorized_func.__doc__, None | str) +assert_type(vectorized_func.__doc__, str | None) assert_type(vectorized_func([1]), Any) assert_type(np.vectorize(int), np.vectorize) assert_type( diff --git a/tests/data/reveal/npyio.pyi b/tests/data/reveal/npyio.pyi index 5755d03c..8b4d8999 100644 --- a/tests/data/reveal/npyio.pyi +++ b/tests/data/reveal/npyio.pyi @@ -29,10 +29,10 @@ bytes_writer: BytesWriter bytes_reader: BytesReader assert_type(npz_file.zip, zipfile.ZipFile) -assert_type(npz_file.fid, None | IO[str]) +assert_type(npz_file.fid, IO[str] | None) assert_type(npz_file.files, list[str]) assert_type(npz_file.allow_pickle, bool) -assert_type(npz_file.pickle_kwargs, None | Mapping[str, Any]) +assert_type(npz_file.pickle_kwargs, Mapping[str, Any] | None) assert_type(npz_file.f, BagObj[np.lib.npyio.NpzFile]) assert_type(npz_file["test"], npt.NDArray[Any]) assert_type(len(npz_file), int) diff --git a/tests/data/reveal/random.pyi b/tests/data/reveal/random.pyi index 84b2ffb2..2173480a 100644 --- a/tests/data/reveal/random.pyi +++ b/tests/data/reveal/random.pyi @@ -72,7 +72,7 @@ assert_type(sfc64_raw_arr, npt.NDArray[np.uint64]) assert_type(sfc64.lock, threading.Lock) assert_type(seed_seq.pool, npt.NDArray[np.uint32]) -assert_type(seed_seq.entropy, None | int | Sequence[int]) +assert_type(seed_seq.entropy, int | Sequence[int] | None) assert_type(seed_seq.spawn(1), list[np.random.SeedSequence]) assert_type(seed_seq.generate_state(8, "uint32"), npt.NDArray[np.uint32 | np.uint64]) assert_type(seed_seq.generate_state(8, "uint64"), npt.NDArray[np.uint32 | np.uint64]) diff --git a/tests/data/reveal/testing.pyi b/tests/data/reveal/testing.pyi index c64aad5d..eee3ebfb 100644 --- a/tests/data/reveal/testing.pyi +++ b/tests/data/reveal/testing.pyi @@ -75,7 +75,7 @@ assert_type(np.testing.assert_(2, msg=lambda: "test"), None) if sys.platform == "win32" or sys.platform == "cygwin": assert_type(np.testing.memusage(), int) elif sys.platform == "linux": - assert_type(np.testing.memusage(), None | int) + assert_type(np.testing.memusage(), int | None) assert_type(np.testing.jiffies(), int) diff --git a/tests/data/reveal/ufunc_config.pyi b/tests/data/reveal/ufunc_config.pyi index d470c1c4..6c829d47 100644 --- a/tests/data/reveal/ufunc_config.pyi +++ b/tests/data/reveal/ufunc_config.pyi @@ -19,9 +19,9 @@ assert_type(np.geterr(), np._core._ufunc_config._ErrDict) assert_type(np.setbufsize(4096), int) assert_type(np.getbufsize(), int) -assert_type(np.seterrcall(func), Callable[[str, int], Any] | None | SupportsWrite[str]) -assert_type(np.seterrcall(Write()), Callable[[str, int], Any] | None | SupportsWrite[str]) -assert_type(np.geterrcall(), Callable[[str, int], Any] | None | SupportsWrite[str]) +assert_type(np.seterrcall(func), Callable[[str, int], Any] | SupportsWrite[str] | None) +assert_type(np.seterrcall(Write()), Callable[[str, int], Any] | SupportsWrite[str] | None) +assert_type(np.geterrcall(), Callable[[str, int], Any] | SupportsWrite[str] | None) assert_type(np.errstate(call=func, all="call"), np.errstate) assert_type(np.errstate(call=Write(), divide="log", over="log"), np.errstate) diff --git a/tools/__init__.py b/tools/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tools/codemods.py b/tools/codemods.py new file mode 100644 index 00000000..e273eab5 --- /dev/null +++ b/tools/codemods.py @@ -0,0 +1,117 @@ +"""LibCST codemods.""" + +from collections.abc import Sequence +from typing_extensions import override + +import libcst as cst +from libcst.codemod import CodemodContext, VisitorBasedCodemodCommand +from libcst.codemod.visitors import AddImportsVisitor + +_DUNDER_RETURN = { + "__int__": "int", + "__float__": "float", + "__complex__": "complex", + "__str__": "str", + "__bytes__": "bytes", + "__buffer__": "memoryview", + "__index__": "int", + "__hash__": "int", + "__len__": "int", + "__length_hint__": "int", + "__repr__": "str", + "__format__": "str", + "__init__": "None", + "__init_subclass__": "None", + "__release_buffer__": "None", + "__set__": "None", + "__setattr__": "None", + "__setattribute__": "None", + "__delattr__": "None", + "__delattribute__": "None", + "__delete__": "None", +} + + +class AnnotateIncomplete(VisitorBasedCodemodCommand): + """ + Sets the the missing type annotations to `_typeshed.Incomplete`. + + To run this codemod, run the following command from the root directory: + + ```shell + uv run -m libcst.tool codemod -x --include-stubs tools.codemods.AnnotateIncomplete src/numpy-stubs + ``` + """ + + def __init__(self, /, context: CodemodContext) -> None: + super().__init__(context) + + @override + def leave_Param(self, /, original_node: cst.Param, updated_node: cst.Param) -> cst.Param: + if updated_node.annotation is not None or updated_node.name.value in {"self", "cls", "_cls"}: + return updated_node + + AddImportsVisitor.add_needed_import(self.context, "_typeshed", "Incomplete") + return updated_node.with_changes(annotation=cst.Annotation(cst.Name("Incomplete"))) + + @override + def leave_FunctionDef(self, /, original_node: cst.FunctionDef, updated_node: cst.FunctionDef) -> cst.FunctionDef: + if updated_node.returns is not None: + return updated_node + + if (name := updated_node.name.value) in _DUNDER_RETURN: + return updated_node.with_changes(returns=cst.Annotation(cst.Name(_DUNDER_RETURN[name]))) + + AddImportsVisitor.add_needed_import(self.context, "_typeshed", "Incomplete") + return updated_node.with_changes(returns=cst.Annotation(cst.Name("Incomplete"))) + + +class MoveNoneToEnd(VisitorBasedCodemodCommand): + """ + A codemod that moves `None` to the end of union types when using the `|` operator, fixing `RUF036`. + + To run this codemod, run the following command from the root directory: + + ```shell + uv run -m libcst.tool codemod -x --include-stubs tools.codemods.MoveNoneToEnd src/numpy-stubs + ``` + + Example: + - Before: None | str | int + - After: str | int | None + """ + + @override + def leave_BinaryOperation( + self, + original_node: cst.BinaryOperation, + updated_node: cst.BinaryOperation, + ) -> cst.BaseExpression: + # Only process union operations using | + if not isinstance(updated_node.operator, cst.BitOr): + return updated_node + + # Collect all types in the union + def collect_types(node: cst.BaseExpression) -> list[cst.BaseExpression]: + if isinstance(node, cst.BinaryOperation) and isinstance(node.operator, cst.BitOr): + return collect_types(node.left) + collect_types(node.right) + return [node] + + types = collect_types(updated_node) + + # Check if None exists and is not already at the end + none_types = [t for t in types if isinstance(t, cst.Name) and t.value == "None"] + if not none_types or (len(types) > 1 and types[-1] in none_types): + return updated_node + + # Remove None and add it to the ends + other_types = [t for t in types if not (isinstance(t, cst.Name) and t.value == "None")] + reordered_types = other_types + none_types + + # Rebuild the union expression + def build_union(exprs: Sequence[cst.BaseExpression]) -> cst.BaseExpression: + if len(exprs) == 1: + return exprs[0] + return cst.BinaryOperation(build_union(exprs[:-1]), cst.BitOr(), exprs[-1]) + + return build_union(reordered_types) diff --git a/uv.lock b/uv.lock index 3b99cf90..f60a109d 100644 --- a/uv.lock +++ b/uv.lock @@ -65,6 +65,45 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/db/4a/76fe7ddbb90aadaeb298dbb57e562a365f21a6fa17d3c69e73cb3c0c84e8/basedtyping-0.1.10-py3-none-any.whl", hash = "sha256:8952416f8fd196d25c1f6d6bb556223183e928c944bee4bd0c49af659677dea9", size = 15045 }, ] +[[package]] +name = "libcst" +version = "1.6.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pyyaml" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f4/ec/d24c0ad33838dfbfe20a760b301d529c63cef32f8b91dae380c97f8bf127/libcst-1.6.0.tar.gz", hash = "sha256:e80ecdbe3fa43b3793cae8fa0b07a985bd9a693edbe6e9d076f5422ecadbf0db", size = 776146 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/06/10/2d14576a0ddf14c08c4b92276abd04c0220c3b9fb006f6d5b6f91d403082/libcst-1.6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2f02d0da6dfbad44e6ec4d1e5791e17afe95d9fe89bce4374bf109fd9c103a50", size = 2049474 }, + { url = "https://files.pythonhosted.org/packages/39/39/04893c1555dd59e4c6e25cd7a6afa6162ccd088a669ed106d992c7b3baca/libcst-1.6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:48406225378ee9208edb1e5a10451bea810262473af1a2f2473737fd16d34e3a", size = 2206659 }, + { url = "https://files.pythonhosted.org/packages/87/f1/584a83f9b8b0ff18ec79b4daca6bb459abe63b854a67e11d17948b0b0d7f/libcst-1.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8bf59a21e9968dc4e7c301fac660bf54bc7d4dcadc0b1abf31b1cac34e800555", size = 2311551 }, + { url = "https://files.pythonhosted.org/packages/d8/8e/24772a6d7f94b68b1bfbfb767870558a4ecc7d2c728f9dba5c044bc6130b/libcst-1.6.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d65550ac686bff9395398afacbc88fe812363703a4161108e8a6db066d30b96e", size = 2394319 }, + { url = "https://files.pythonhosted.org/packages/d5/84/be29a71cd2c5f4079fa05675b140ec2a83f7b425ee8f75f17232f6223cc7/libcst-1.6.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5ac6d68364031f0b554d8920a69b33f25ec6ef351fa31b4e8f3676abb729ce36", size = 2254468 }, + { url = "https://files.pythonhosted.org/packages/a7/16/85d97cd594ca9d38d4f7ea71e13eb43a362374de8b436119f09c95999477/libcst-1.6.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:0c0fb2f7b74605832cc38d79e9d104f92a8aaeec7bf8f2759b20c5ba3786a321", size = 2372379 }, + { url = "https://files.pythonhosted.org/packages/de/87/53bea5e4e783ddf2b785c4706fdfc5fd74561a47f99995cc1d9f300d20f1/libcst-1.6.0-cp310-cp310-win_amd64.whl", hash = "sha256:1bd11863889b630fe41543b4eb5e2dd445447a7f89e6b58229e83c9e52a74942", size = 2076554 }, + { url = "https://files.pythonhosted.org/packages/9e/d6/d6b2b6a997cdec90f2492954a1868de7df90d2d7a0b9267e14ded5713c91/libcst-1.6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a9e71a046b4a91950125967f5ee67389f25a2511103e5595508f0591a5f50bc0", size = 2049175 }, + { url = "https://files.pythonhosted.org/packages/18/26/cc5852f725042dff5df2ca98d362f0c633bd70ee14e252665293c7f9b67d/libcst-1.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df3f452e074893dfad7746a041caeb3cde75bd9fbca4ea7b223012e112d1da8c", size = 2206182 }, + { url = "https://files.pythonhosted.org/packages/a2/fe/4227e6c34a96b1fe36bbe0f48ebe09cbed267a89ab4827bed58a794776ee/libcst-1.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:31e45f88d4a9a8e5b690ed14a564fcbace14b10f5e7b6797d6d97f4226b395da", size = 2311286 }, + { url = "https://files.pythonhosted.org/packages/22/c1/db676774b3e3e6d7e604d4b520df609c8c9e7990c39c3c2a2216687c1d6c/libcst-1.6.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1bd00399d20bf93590b6f02647f8be08e2b730e050e6b7360f669254e69c98f5", size = 2393885 }, + { url = "https://files.pythonhosted.org/packages/6b/8a/5cb362e992d3ad822ea93233175e0f26da16bf852532969918da439a85a5/libcst-1.6.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d25132f24edc24895082589645dbb8972c0eff6c9716ff71932fa72643d7c74f", size = 2254001 }, + { url = "https://files.pythonhosted.org/packages/a9/65/81bd981ca6e1712b16ec1c43b90e886cacb36bd6e12f50c27550ade4dc1a/libcst-1.6.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:38f3f25d4f5d8713cdb6a7bd41d75299de3c2416b9890a34d9b05417b8e64c1d", size = 2371855 }, + { url = "https://files.pythonhosted.org/packages/d4/87/f1613e0ec216f29fd45e720eef1e440adfefc809d4e1bb3fc466a1db49bc/libcst-1.6.0-cp311-cp311-win_amd64.whl", hash = "sha256:91242ccbae6e7a070b33ebe03d3677c54bf678653538fbaa89597a59e4a13b2d", size = 2076392 }, + { url = "https://files.pythonhosted.org/packages/89/ca/4b92261d0cecfab5e22ccd7582f5b2d6fec9ec19884d28d66f1bc1dc9b79/libcst-1.6.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:cd2b28688dabf0f7a166b47ab1c7d5c0b6ef8c9a05ad932618471a33fe591a4a", size = 2044342 }, + { url = "https://files.pythonhosted.org/packages/39/cb/3764a5eb00e3e31f3ce28e8abd1aa99934bc63006798799593d3525d2677/libcst-1.6.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6a12a4766ce5874ccb31a1cc095cff47e2fb35755954965fe77458d9e5b361a8", size = 2202123 }, + { url = "https://files.pythonhosted.org/packages/6e/0d/ec24969e39a6d9afee6080366de7303d59b43611882a29b30fc28dba0488/libcst-1.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bfcd78a5e775f155054ed50d047a260cd23f0f6a89ef2a57e10bdb9c697680b8", size = 2303775 }, + { url = "https://files.pythonhosted.org/packages/36/a3/c40304fe76c3add626dc19ab2c1ecbcfd1df7714414d7b4e3a0d130a8389/libcst-1.6.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5786240358b122ad901bb0b7e6b7467085b2317333233d7c7d7cac46388fbd77", size = 2388341 }, + { url = "https://files.pythonhosted.org/packages/c3/f1/e820b8f9e19769ca7a57a719980abacf805609777a58df68ed1cb8cd328d/libcst-1.6.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:c527472093b5b64ffa65d33c472da38952827abbca18c786d559d6d6122bc891", size = 2248883 }, + { url = "https://files.pythonhosted.org/packages/6c/d4/bc4c91f61dbb892db53148f39d6d8a45a5cbb4c19953ededb39bbcf60d3d/libcst-1.6.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:63a8893dfc344b9b08bfaf4e433b16a7e2e9361f8362fa73eaecc4d379c328ba", size = 2365027 }, + { url = "https://files.pythonhosted.org/packages/e1/b5/d84b56528f88e7f3fe792b91bd21beb406159b3283bd7c891737982f7b07/libcst-1.6.0-cp312-cp312-win_amd64.whl", hash = "sha256:4cd011fcd79b76be216440ec296057780223674bc2566662c4bc50d3c5ecd58e", size = 2070680 }, + { url = "https://files.pythonhosted.org/packages/04/3e/80f5bbcc06a8d101d1a35ff1c7c0866e6b41ae07843a47e5c6c84f5bbf10/libcst-1.6.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:96506807dc01c9efcea8ab57d9ea18fdc87b85514cc8ee2f8568fab6df861f02", size = 2044340 }, + { url = "https://files.pythonhosted.org/packages/2c/b3/1f36c271a91eef880740a7826d7a953dbcec434adcbee070a2e75cfb94d0/libcst-1.6.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dac722aade8796a1e78662c3ed424f0ab9f1dc0e8fdf3088610354cdd709e53f", size = 2202286 }, + { url = "https://files.pythonhosted.org/packages/c4/23/dbb2bbe21c1943dcd52be7423ddb9e9b7ab1cf4c44e25cceee30fa2136db/libcst-1.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1b8370d0f7092a17b7fcda0e1539d0162cf35a0c19af94842b09c9dddc382acd", size = 2303867 }, + { url = "https://files.pythonhosted.org/packages/e6/49/61bb0baa61745dc7b91fdb97fbed16149b22d88f254696d54645fea9df25/libcst-1.6.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8e4fcd791cab0fe8287b6edd0d78512b6475b87d906562a5d2d0999cb6d23b8d", size = 2389158 }, + { url = "https://files.pythonhosted.org/packages/3c/39/dcfe6c02e087e3241e8e799b2ddb92e32a65076eec846205e96e3a928139/libcst-1.6.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:3fb953fc0155532f366ff40f6a23f191250134d6928e02074ae4eb3531fa6c30", size = 2248820 }, + { url = "https://files.pythonhosted.org/packages/20/5b/db239fcf1417bdff283ed76b027b4039e1c377d38aa3b979f32bcf34fa94/libcst-1.6.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:2f3c85602e5a6d3aec0a8fc74230363f943004d7c2b2a6a1c09b320b61692241", size = 2365139 }, + { url = "https://files.pythonhosted.org/packages/38/7f/ed56f5724305c08235d1edc580275aa13c8303e93d374d4fe73162907e88/libcst-1.6.0-cp313-cp313-win_amd64.whl", hash = "sha256:c4486921bebd33d67bbbd605aff8bfaefd2d13dc73c20c1fde2fb245880b7fd6", size = 2070695 }, +] + [[package]] name = "mypy-extensions" version = "1.0.0" @@ -166,6 +205,7 @@ numpy = [ dev = [ { name = "basedmypy", extra = ["faster-cache"] }, { name = "basedpyright" }, + { name = "libcst" }, { name = "numtype", extra = ["numpy"] }, { name = "ruff" }, ] @@ -180,6 +220,7 @@ requires-dist = [{ name = "numpy", marker = "extra == 'numpy'", specifier = ">=2 dev = [ { name = "basedmypy", extras = ["faster-cache"], specifier = ">=2.9.1" }, { name = "basedpyright", specifier = ">=1.24.0" }, + { name = "libcst", specifier = ">=1.6.0" }, { name = "numtype", extras = ["numpy"] }, { name = "ruff", specifier = ">=0.9.3" }, ] @@ -245,6 +286,50 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/27/f1/1d7ec15b20f8ce9300bc850de1e059132b88990e46cd0ccac29cbf11e4f9/orjson-3.10.15-cp313-cp313-win_amd64.whl", hash = "sha256:fd56a26a04f6ba5fb2045b0acc487a63162a958ed837648c5781e1fe3316cfbf", size = 133444 }, ] +[[package]] +name = "pyyaml" +version = "6.0.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/54/ed/79a089b6be93607fa5cdaedf301d7dfb23af5f25c398d5ead2525b063e17/pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e", size = 130631 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9b/95/a3fac87cb7158e231b5a6012e438c647e1a87f09f8e0d123acec8ab8bf71/PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086", size = 184199 }, + { url = "https://files.pythonhosted.org/packages/c7/7a/68bd47624dab8fd4afbfd3c48e3b79efe09098ae941de5b58abcbadff5cb/PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:29717114e51c84ddfba879543fb232a6ed60086602313ca38cce623c1d62cfbf", size = 171758 }, + { url = "https://files.pythonhosted.org/packages/49/ee/14c54df452143b9ee9f0f29074d7ca5516a36edb0b4cc40c3f280131656f/PyYAML-6.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8824b5a04a04a047e72eea5cec3bc266db09e35de6bdfe34c9436ac5ee27d237", size = 718463 }, + { url = "https://files.pythonhosted.org/packages/4d/61/de363a97476e766574650d742205be468921a7b532aa2499fcd886b62530/PyYAML-6.0.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7c36280e6fb8385e520936c3cb3b8042851904eba0e58d277dca80a5cfed590b", size = 719280 }, + { url = "https://files.pythonhosted.org/packages/6b/4e/1523cb902fd98355e2e9ea5e5eb237cbc5f3ad5f3075fa65087aa0ecb669/PyYAML-6.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ec031d5d2feb36d1d1a24380e4db6d43695f3748343d99434e6f5f9156aaa2ed", size = 751239 }, + { url = "https://files.pythonhosted.org/packages/b7/33/5504b3a9a4464893c32f118a9cc045190a91637b119a9c881da1cf6b7a72/PyYAML-6.0.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:936d68689298c36b53b29f23c6dbb74de12b4ac12ca6cfe0e047bedceea56180", size = 695802 }, + { url = "https://files.pythonhosted.org/packages/5c/20/8347dcabd41ef3a3cdc4f7b7a2aff3d06598c8779faa189cdbf878b626a4/PyYAML-6.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:23502f431948090f597378482b4812b0caae32c22213aecf3b55325e049a6c68", size = 720527 }, + { url = "https://files.pythonhosted.org/packages/be/aa/5afe99233fb360d0ff37377145a949ae258aaab831bde4792b32650a4378/PyYAML-6.0.2-cp310-cp310-win32.whl", hash = "sha256:2e99c6826ffa974fe6e27cdb5ed0021786b03fc98e5ee3c5bfe1fd5015f42b99", size = 144052 }, + { url = "https://files.pythonhosted.org/packages/b5/84/0fa4b06f6d6c958d207620fc60005e241ecedceee58931bb20138e1e5776/PyYAML-6.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:a4d3091415f010369ae4ed1fc6b79def9416358877534caf6a0fdd2146c87a3e", size = 161774 }, + { url = "https://files.pythonhosted.org/packages/f8/aa/7af4e81f7acba21a4c6be026da38fd2b872ca46226673c89a758ebdc4fd2/PyYAML-6.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cc1c1159b3d456576af7a3e4d1ba7e6924cb39de8f67111c735f6fc832082774", size = 184612 }, + { url = "https://files.pythonhosted.org/packages/8b/62/b9faa998fd185f65c1371643678e4d58254add437edb764a08c5a98fb986/PyYAML-6.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1e2120ef853f59c7419231f3bf4e7021f1b936f6ebd222406c3b60212205d2ee", size = 172040 }, + { url = "https://files.pythonhosted.org/packages/ad/0c/c804f5f922a9a6563bab712d8dcc70251e8af811fce4524d57c2c0fd49a4/PyYAML-6.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d225db5a45f21e78dd9358e58a98702a0302f2659a3c6cd320564b75b86f47c", size = 736829 }, + { url = "https://files.pythonhosted.org/packages/51/16/6af8d6a6b210c8e54f1406a6b9481febf9c64a3109c541567e35a49aa2e7/PyYAML-6.0.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5ac9328ec4831237bec75defaf839f7d4564be1e6b25ac710bd1a96321cc8317", size = 764167 }, + { url = "https://files.pythonhosted.org/packages/75/e4/2c27590dfc9992f73aabbeb9241ae20220bd9452df27483b6e56d3975cc5/PyYAML-6.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ad2a3decf9aaba3d29c8f537ac4b243e36bef957511b4766cb0057d32b0be85", size = 762952 }, + { url = "https://files.pythonhosted.org/packages/9b/97/ecc1abf4a823f5ac61941a9c00fe501b02ac3ab0e373c3857f7d4b83e2b6/PyYAML-6.0.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4", size = 735301 }, + { url = "https://files.pythonhosted.org/packages/45/73/0f49dacd6e82c9430e46f4a027baa4ca205e8b0a9dce1397f44edc23559d/PyYAML-6.0.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:797b4f722ffa07cc8d62053e4cff1486fa6dc094105d13fea7b1de7d8bf71c9e", size = 756638 }, + { url = "https://files.pythonhosted.org/packages/22/5f/956f0f9fc65223a58fbc14459bf34b4cc48dec52e00535c79b8db361aabd/PyYAML-6.0.2-cp311-cp311-win32.whl", hash = "sha256:11d8f3dd2b9c1207dcaf2ee0bbbfd5991f571186ec9cc78427ba5bd32afae4b5", size = 143850 }, + { url = "https://files.pythonhosted.org/packages/ed/23/8da0bbe2ab9dcdd11f4f4557ccaf95c10b9811b13ecced089d43ce59c3c8/PyYAML-6.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:e10ce637b18caea04431ce14fabcf5c64a1c61ec9c56b071a4b7ca131ca52d44", size = 161980 }, + { url = "https://files.pythonhosted.org/packages/86/0c/c581167fc46d6d6d7ddcfb8c843a4de25bdd27e4466938109ca68492292c/PyYAML-6.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:c70c95198c015b85feafc136515252a261a84561b7b1d51e3384e0655ddf25ab", size = 183873 }, + { url = "https://files.pythonhosted.org/packages/a8/0c/38374f5bb272c051e2a69281d71cba6fdb983413e6758b84482905e29a5d/PyYAML-6.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ce826d6ef20b1bc864f0a68340c8b3287705cae2f8b4b1d932177dcc76721725", size = 173302 }, + { url = "https://files.pythonhosted.org/packages/c3/93/9916574aa8c00aa06bbac729972eb1071d002b8e158bd0e83a3b9a20a1f7/PyYAML-6.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f71ea527786de97d1a0cc0eacd1defc0985dcf6b3f17bb77dcfc8c34bec4dc5", size = 739154 }, + { url = "https://files.pythonhosted.org/packages/95/0f/b8938f1cbd09739c6da569d172531567dbcc9789e0029aa070856f123984/PyYAML-6.0.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b22676e8097e9e22e36d6b7bda33190d0d400f345f23d4065d48f4ca7ae0425", size = 766223 }, + { url = "https://files.pythonhosted.org/packages/b9/2b/614b4752f2e127db5cc206abc23a8c19678e92b23c3db30fc86ab731d3bd/PyYAML-6.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:80bab7bfc629882493af4aa31a4cfa43a4c57c83813253626916b8c7ada83476", size = 767542 }, + { url = "https://files.pythonhosted.org/packages/d4/00/dd137d5bcc7efea1836d6264f049359861cf548469d18da90cd8216cf05f/PyYAML-6.0.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:0833f8694549e586547b576dcfaba4a6b55b9e96098b36cdc7ebefe667dfed48", size = 731164 }, + { url = "https://files.pythonhosted.org/packages/c9/1f/4f998c900485e5c0ef43838363ba4a9723ac0ad73a9dc42068b12aaba4e4/PyYAML-6.0.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8b9c7197f7cb2738065c481a0461e50ad02f18c78cd75775628afb4d7137fb3b", size = 756611 }, + { url = "https://files.pythonhosted.org/packages/df/d1/f5a275fdb252768b7a11ec63585bc38d0e87c9e05668a139fea92b80634c/PyYAML-6.0.2-cp312-cp312-win32.whl", hash = "sha256:ef6107725bd54b262d6dedcc2af448a266975032bc85ef0172c5f059da6325b4", size = 140591 }, + { url = "https://files.pythonhosted.org/packages/0c/e8/4f648c598b17c3d06e8753d7d13d57542b30d56e6c2dedf9c331ae56312e/PyYAML-6.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:7e7401d0de89a9a855c839bc697c079a4af81cf878373abd7dc625847d25cbd8", size = 156338 }, + { url = "https://files.pythonhosted.org/packages/ef/e3/3af305b830494fa85d95f6d95ef7fa73f2ee1cc8ef5b495c7c3269fb835f/PyYAML-6.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:efdca5630322a10774e8e98e1af481aad470dd62c3170801852d752aa7a783ba", size = 181309 }, + { url = "https://files.pythonhosted.org/packages/45/9f/3b1c20a0b7a3200524eb0076cc027a970d320bd3a6592873c85c92a08731/PyYAML-6.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:50187695423ffe49e2deacb8cd10510bc361faac997de9efef88badc3bb9e2d1", size = 171679 }, + { url = "https://files.pythonhosted.org/packages/7c/9a/337322f27005c33bcb656c655fa78325b730324c78620e8328ae28b64d0c/PyYAML-6.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0ffe8360bab4910ef1b9e87fb812d8bc0a308b0d0eef8c8f44e0254ab3b07133", size = 733428 }, + { url = "https://files.pythonhosted.org/packages/a3/69/864fbe19e6c18ea3cc196cbe5d392175b4cf3d5d0ac1403ec3f2d237ebb5/PyYAML-6.0.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:17e311b6c678207928d649faa7cb0d7b4c26a0ba73d41e99c4fff6b6c3276484", size = 763361 }, + { url = "https://files.pythonhosted.org/packages/04/24/b7721e4845c2f162d26f50521b825fb061bc0a5afcf9a386840f23ea19fa/PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70b189594dbe54f75ab3a1acec5f1e3faa7e8cf2f1e08d9b561cb41b845f69d5", size = 759523 }, + { url = "https://files.pythonhosted.org/packages/2b/b2/e3234f59ba06559c6ff63c4e10baea10e5e7df868092bf9ab40e5b9c56b6/PyYAML-6.0.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:41e4e3953a79407c794916fa277a82531dd93aad34e29c2a514c2c0c5fe971cc", size = 726660 }, + { url = "https://files.pythonhosted.org/packages/fe/0f/25911a9f080464c59fab9027482f822b86bf0608957a5fcc6eaac85aa515/PyYAML-6.0.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:68ccc6023a3400877818152ad9a1033e3db8625d899c72eacb5a668902e4d652", size = 751597 }, + { url = "https://files.pythonhosted.org/packages/14/0d/e2c3b43bbce3cf6bd97c840b46088a3031085179e596d4929729d8d68270/PyYAML-6.0.2-cp313-cp313-win32.whl", hash = "sha256:bc2fa7c6b47d6bc618dd7fb02ef6fdedb1090ec036abab80d4681424b84c1183", size = 140527 }, + { url = "https://files.pythonhosted.org/packages/fa/de/02b54f42487e3d3c6efb3f89428677074ca7bf43aae402517bc7cca949f3/PyYAML-6.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:8388ee1976c416731879ac16da0aff3f63b286ffdd57cdeb95f3f2e085687563", size = 156446 }, +] + [[package]] name = "ruff" version = "0.9.3"