diff --git a/numpy/_core/fromnumeric.pyi b/numpy/_core/fromnumeric.pyi index 138fe8809110..b16994085308 100644 --- a/numpy/_core/fromnumeric.pyi +++ b/numpy/_core/fromnumeric.pyi @@ -122,7 +122,7 @@ class _SupportsShape(Protocol[_ShapeT_co]): _T = TypeVar("_T") _PyArray: TypeAlias = list[_T] | tuple[_T, ...] # `int` also covers `bool` -_PyScalar: TypeAlias = float | complex | bytes | str +_PyScalar: TypeAlias = complex | bytes | str @overload def take( diff --git a/numpy/_core/numeric.pyi b/numpy/_core/numeric.pyi index 0a0c70d80a50..b9fddcef5b6c 100644 --- a/numpy/_core/numeric.pyi +++ b/numpy/_core/numeric.pyi @@ -784,9 +784,7 @@ def fromfunction( **kwargs: Any, ) -> _T: ... -def isscalar(element: object) -> TypeGuard[ - generic | bool | int | float | complex | str | bytes | memoryview -]: ... +def isscalar(element: object) -> TypeGuard[generic | complex | str | bytes | memoryview]: ... def binary_repr(num: SupportsIndex, width: int | None = ...) -> str: ... diff --git a/numpy/lib/_twodim_base_impl.pyi b/numpy/lib/_twodim_base_impl.pyi index 9867f59f9409..b9a199c76616 100644 --- a/numpy/lib/_twodim_base_impl.pyi +++ b/numpy/lib/_twodim_base_impl.pyi @@ -269,8 +269,8 @@ def histogram2d( ]: ... @overload def histogram2d( - x: _ArrayLike1DInt_co | Sequence[float | int], - y: _ArrayLike1DInt_co | Sequence[float | int], + x: _ArrayLike1DInt_co | Sequence[float], + y: _ArrayLike1DInt_co | Sequence[float], bins: int | Sequence[int] = ..., range: _ArrayLike2DFloat_co | None = ..., density: bool | None = ..., @@ -282,8 +282,8 @@ def histogram2d( ]: ... @overload def histogram2d( - x: Sequence[complex | float | int], - y: Sequence[complex | float | int], + x: Sequence[complex], + y: Sequence[complex], bins: int | Sequence[int] = ..., range: _ArrayLike2DFloat_co | None = ..., density: bool | None = ..., @@ -321,8 +321,8 @@ def histogram2d( ]: ... @overload def histogram2d( - x: _ArrayLike1DInt_co | Sequence[float | int], - y: _ArrayLike1DInt_co | Sequence[float | int], + x: _ArrayLike1DInt_co | Sequence[float], + y: _ArrayLike1DInt_co | Sequence[float], bins: Sequence[_ArrayLike1D[_NumberCoT] | int], range: _ArrayLike2DFloat_co | None = ..., density: bool | None = ..., @@ -334,8 +334,8 @@ def histogram2d( ]: ... @overload def histogram2d( - x: Sequence[complex | float | int], - y: Sequence[complex | float | int], + x: Sequence[complex], + y: Sequence[complex], bins: Sequence[_ArrayLike1D[_NumberCoT] | int], range: _ArrayLike2DFloat_co | None = ..., density: bool | None = ..., @@ -362,7 +362,7 @@ def histogram2d( def histogram2d( x: _ArrayLike1DNumber_co, y: _ArrayLike1DNumber_co, - bins: Sequence[Sequence[int | bool]], + bins: Sequence[Sequence[int]], range: _ArrayLike2DFloat_co | None = ..., density: bool | None = ..., weights: _ArrayLike1DFloat_co | None = ..., @@ -375,7 +375,7 @@ def histogram2d( def histogram2d( x: _ArrayLike1DNumber_co, y: _ArrayLike1DNumber_co, - bins: Sequence[Sequence[float | int | bool]], + bins: Sequence[Sequence[float]], range: _ArrayLike2DFloat_co | None = ..., density: bool | None = ..., weights: _ArrayLike1DFloat_co | None = ..., @@ -388,7 +388,7 @@ def histogram2d( def histogram2d( x: _ArrayLike1DNumber_co, y: _ArrayLike1DNumber_co, - bins: Sequence[Sequence[complex | float | int | bool]], + bins: Sequence[Sequence[complex]], range: _ArrayLike2DFloat_co | None = ..., density: bool | None = ..., weights: _ArrayLike1DFloat_co | None = ..., diff --git a/numpy/typing/tests/data/reveal/dtype.pyi b/numpy/typing/tests/data/reveal/dtype.pyi index f7581a305503..50a7be4b2547 100644 --- a/numpy/typing/tests/data/reveal/dtype.pyi +++ b/numpy/typing/tests/data/reveal/dtype.pyi @@ -14,9 +14,9 @@ dtype_U: np.dtype[np.str_] dtype_V: np.dtype[np.void] dtype_i8: np.dtype[np.int64] -py_int_co: type[int | bool] -py_float_co: type[float | int | bool] -py_complex_co: type[complex | float | int | bool] +py_int_co: type[int] +py_float_co: type[float] +py_complex_co: type[complex] py_object: type[_PyObjectLike] py_character: type[str | bytes] py_flexible: type[str | bytes | memoryview]