From 219bde30eaaaadb345b267e3724242e27536cf5d Mon Sep 17 00:00:00 2001 From: jorenham Date: Sun, 28 Dec 2025 15:22:22 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`=5Fcore.function?= =?UTF-8?q?=5Fbase`=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/function_base.pyi | 284 +++++++++++++++++------- 1 file changed, 204 insertions(+), 80 deletions(-) diff --git a/src/numpy-stubs/_core/function_base.pyi b/src/numpy-stubs/_core/function_base.pyi index c4670369..4843f26e 100644 --- a/src/numpy-stubs/_core/function_base.pyi +++ b/src/numpy-stubs/_core/function_base.pyi @@ -1,232 +1,356 @@ from _typeshed import Incomplete -from typing import Literal as L, SupportsIndex, TypeAlias, overload -from typing_extensions import TypeVar +from typing import Any, Literal as L, SupportsIndex, TypeVar, overload import _numtype as _nt import numpy as np -from numpy._typing import DTypeLike, _ArrayLikeFloat_co, _ArrayLikeNumber_co, _DTypeLike +from numpy._typing import DTypeLike, NDArray, _DTypeLike __all__ = ["geomspace", "linspace", "logspace"] -### - _ScalarT = TypeVar("_ScalarT", bound=np.generic) -_Device: TypeAlias = L["cpu"] - ### @overload def linspace( - start: _ArrayLikeFloat_co, - stop: _ArrayLikeFloat_co, + start: _nt.CoFloat64_nd, + stop: _nt.CoFloat64_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + retstep: L[False] = False, + dtype: None = None, + axis: SupportsIndex = 0, + *, + device: L["cpu"] | None = None, +) -> NDArray[np.float64]: ... +@overload +def linspace( + start: _nt.CoFloating_nd, + stop: _nt.CoFloating_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + retstep: L[False] = False, + dtype: None = None, + axis: SupportsIndex = 0, + *, + device: L["cpu"] | None = None, +) -> NDArray[np.float64 | Any]: ... +@overload +def linspace( + start: _nt.ToComplex128_nd, + stop: _nt.CoComplex128_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + retstep: L[False] = False, + dtype: None = None, + axis: SupportsIndex = 0, + *, + device: L["cpu"] | None = None, +) -> NDArray[np.complex128]: ... +@overload +def linspace( + start: _nt.CoComplex128_nd, + stop: _nt.ToComplex128_nd, num: SupportsIndex = 50, endpoint: bool = True, retstep: L[False] = False, dtype: None = None, axis: SupportsIndex = 0, *, - device: _Device | None = None, -) -> _nt.Array[np.floating]: ... + device: L["cpu"] | None = None, +) -> NDArray[np.complex128]: ... @overload def linspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, retstep: L[False] = False, dtype: None = None, axis: SupportsIndex = 0, *, - device: _Device | None = None, -) -> _nt.Array[np.inexact]: ... + device: L["cpu"] | None = None, +) -> NDArray[np.complex128 | Any]: ... @overload def linspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex, endpoint: bool, retstep: L[False], dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, *, - device: _Device | None = None, -) -> _nt.Array[_ScalarT]: ... + device: L["cpu"] | None = None, +) -> NDArray[_ScalarT]: ... @overload def linspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, retstep: L[False] = False, *, dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, - device: _Device | None = None, -) -> _nt.Array[_ScalarT]: ... + device: L["cpu"] | None = None, +) -> NDArray[_ScalarT]: ... @overload def linspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, retstep: L[False] = False, dtype: DTypeLike | None = None, axis: SupportsIndex = 0, *, - device: _Device | None = None, -) -> _nt.Array[Incomplete]: ... + device: L["cpu"] | None = None, +) -> NDArray[Incomplete]: ... +@overload +def linspace( + start: _nt.CoFloat64_nd, + stop: _nt.CoFloat64_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + *, + retstep: L[True], + dtype: None = None, + axis: SupportsIndex = 0, + device: L["cpu"] | None = None, +) -> tuple[NDArray[np.float64], np.float64]: ... +@overload +def linspace( + start: _nt.CoFloating_nd, + stop: _nt.CoFloating_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + *, + retstep: L[True], + dtype: None = None, + axis: SupportsIndex = 0, + device: L["cpu"] | None = None, +) -> tuple[NDArray[np.floating], np.floating]: ... @overload def linspace( - start: _ArrayLikeFloat_co, - stop: _ArrayLikeFloat_co, + start: _nt.ToComplex128_nd, + stop: _nt.CoComplex128_nd, num: SupportsIndex = 50, endpoint: bool = True, *, retstep: L[True], dtype: None = None, axis: SupportsIndex = 0, - device: _Device | None = None, -) -> tuple[_nt.Array[np.floating], np.floating]: ... + device: L["cpu"] | None = None, +) -> tuple[NDArray[np.complex128], np.complex128]: ... @overload def linspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex128_nd, + stop: _nt.ToComplex128_nd, num: SupportsIndex = 50, endpoint: bool = True, *, retstep: L[True], dtype: None = None, axis: SupportsIndex = 0, - device: _Device | None = None, -) -> tuple[_nt.Array[np.inexact], np.inexact]: ... + device: L["cpu"] | None = None, +) -> tuple[NDArray[np.complex128], np.complex128]: ... @overload def linspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + *, + retstep: L[True], + dtype: None = None, + axis: SupportsIndex = 0, + device: L["cpu"] | None = None, +) -> tuple[NDArray[np.complex128 | Any], np.complex128 | Any]: ... +@overload +def linspace( + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, *, retstep: L[True], dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, - device: _Device | None = None, -) -> tuple[_nt.Array[_ScalarT], _ScalarT]: ... + device: L["cpu"] | None = None, +) -> tuple[NDArray[_ScalarT], _ScalarT]: ... @overload def linspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, *, retstep: L[True], dtype: DTypeLike | None = None, axis: SupportsIndex = 0, - device: _Device | None = None, -) -> tuple[_nt.Array[Incomplete], Incomplete]: ... + device: L["cpu"] | None = None, +) -> tuple[NDArray[Incomplete], Incomplete]: ... # @overload def logspace( - start: _ArrayLikeFloat_co, - stop: _ArrayLikeFloat_co, + start: _nt.CoFloat64_nd, + stop: _nt.CoFloat64_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + base: _nt.CoFloat64_nd = 10.0, + dtype: None = None, + axis: SupportsIndex = 0, +) -> NDArray[np.float64]: ... +@overload +def logspace( + start: _nt.CoFloating_nd, + stop: _nt.CoFloating_nd, num: SupportsIndex = 50, endpoint: bool = True, - base: _ArrayLikeFloat_co = 10.0, + base: _nt.CoFloating_nd = 10.0, dtype: None = None, axis: SupportsIndex = 0, -) -> _nt.Array[np.floating]: ... +) -> NDArray[np.float64 | Any]: ... @overload def logspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.ToComplex128_nd, + stop: _nt.CoComplex128_nd, num: SupportsIndex = 50, endpoint: bool = True, - base: _ArrayLikeNumber_co = 10.0, + base: _nt.CoComplex_nd = 10.0, dtype: None = None, axis: SupportsIndex = 0, -) -> _nt.Array[np.inexact]: ... +) -> NDArray[np.complex128]: ... @overload def logspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex128_nd, + stop: _nt.ToComplex128_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + base: _nt.CoComplex_nd = 10.0, + dtype: None = None, + axis: SupportsIndex = 0, +) -> NDArray[np.complex128]: ... +@overload +def logspace( + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + base: _nt.CoComplex_nd = 10.0, + dtype: None = None, + axis: SupportsIndex = 0, +) -> NDArray[np.complex128 | Any]: ... +@overload +def logspace( + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex, endpoint: bool, - base: _ArrayLikeNumber_co, + base: _nt.CoComplex_nd, dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, -) -> _nt.Array[_ScalarT]: ... +) -> NDArray[_ScalarT]: ... @overload def logspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, - base: _ArrayLikeNumber_co = 10.0, + base: _nt.CoFloating_nd = 10.0, *, dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, -) -> _nt.Array[_ScalarT]: ... +) -> NDArray[_ScalarT]: ... @overload def logspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, - base: _ArrayLikeNumber_co = 10.0, + base: _nt.CoComplex_nd = 10.0, dtype: DTypeLike | None = None, axis: SupportsIndex = 0, -) -> _nt.Array[Incomplete]: ... +) -> NDArray[Incomplete]: ... # @overload def geomspace( - start: _ArrayLikeFloat_co, - stop: _ArrayLikeFloat_co, + start: _nt.CoFloat64_nd, + stop: _nt.CoFloat64_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + dtype: None = None, + axis: SupportsIndex = 0, +) -> NDArray[np.float64]: ... +@overload +def geomspace( + start: _nt.CoFloating_nd, + stop: _nt.CoFloating_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + dtype: None = None, + axis: SupportsIndex = 0, +) -> NDArray[np.float64 | Any]: ... +@overload +def geomspace( + start: _nt.ToComplex128_nd, + stop: _nt.CoComplex128_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + dtype: None = None, + axis: SupportsIndex = 0, +) -> NDArray[np.complex128]: ... +@overload +def geomspace( + start: _nt.CoComplex128_nd, + stop: _nt.ToComplex128_nd, num: SupportsIndex = 50, endpoint: bool = True, dtype: None = None, axis: SupportsIndex = 0, -) -> _nt.Array[np.floating]: ... +) -> NDArray[np.complex128]: ... @overload def geomspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.ToComplex_nd, + stop: _nt.ToComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, dtype: None = None, axis: SupportsIndex = 0, -) -> _nt.Array[np.inexact]: ... +) -> NDArray[np.complex128 | Any]: ... @overload def geomspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex, endpoint: bool, dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, -) -> _nt.Array[_ScalarT]: ... +) -> NDArray[_ScalarT]: ... @overload def geomspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, *, dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, -) -> _nt.Array[_ScalarT]: ... +) -> NDArray[_ScalarT]: ... @overload def geomspace( - start: _ArrayLikeNumber_co, - stop: _ArrayLikeNumber_co, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, dtype: DTypeLike | None = None, axis: SupportsIndex = 0, -) -> _nt.Array[Incomplete]: ... +) -> NDArray[Incomplete]: ... # def add_newdoc( - place: str, obj: str | None, doc: str | tuple[str, str] | list[tuple[str, str]], warn_on_python: bool = True -) -> None: ... # undocumented + place: str, obj: str, doc: str | tuple[str, str] | list[tuple[str, str]], warn_on_python: bool = True +) -> None: ... From 9505579923752ee546eece18174dffda63f1908d Mon Sep 17 00:00:00 2001 From: jorenham Date: Sun, 28 Dec 2025 16:05:02 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=85=20update=20`=5Fcore.function=5Fba?= =?UTF-8?q?se`=20type-tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../@test/static/accept/array_constructors.pyi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/numpy-stubs/@test/static/accept/array_constructors.pyi b/src/numpy-stubs/@test/static/accept/array_constructors.pyi index e8556bce..d2061aa0 100644 --- a/src/numpy-stubs/@test/static/accept/array_constructors.pyi +++ b/src/numpy-stubs/@test/static/accept/array_constructors.pyi @@ -125,22 +125,22 @@ assert_type(np.require(B, requirements="W"), MyArray[np.float64]) assert_type(np.require(B, requirements="A"), MyArray[np.float64]) assert_type(np.require(C), _nt.Array[np.intp]) -assert_type(np.linspace(0, 10), _nt.Array[np.floating]) -assert_type(np.linspace(0, 10j), _nt.Array[np.inexact]) +assert_type(np.linspace(0, 10), _nt.Array[np.float64]) +assert_type(np.linspace(0, 10j), _nt.Array[np.complex128]) assert_type(np.linspace(0, 10, dtype=np.int64), _nt.Array[np.int64]) assert_type(np.linspace(0, 10, dtype=int), _nt.Array) -assert_type(np.linspace(0, 10, retstep=True), tuple[_nt.Array[np.floating], np.floating]) -assert_type(np.linspace(0j, 10, retstep=True), tuple[_nt.Array[np.inexact], np.inexact]) +assert_type(np.linspace(0, 10, retstep=True), tuple[_nt.Array[np.float64], np.float64]) +assert_type(np.linspace(0j, 10, retstep=True), tuple[_nt.Array[np.complex128], np.complex128]) assert_type(np.linspace(0, 10, retstep=True, dtype=np.int64), tuple[_nt.Array[np.int64], np.int64]) assert_type(np.linspace(0j, 10, retstep=True, dtype=int), tuple[_nt.Array, Any]) -assert_type(np.logspace(0, 10), _nt.Array[np.floating]) -assert_type(np.logspace(0, 10j), _nt.Array[np.inexact]) +assert_type(np.logspace(0, 10), _nt.Array[np.float64]) +assert_type(np.logspace(0, 10j), _nt.Array[np.complex128]) assert_type(np.logspace(0, 10, dtype=np.int64), _nt.Array[np.int64]) assert_type(np.logspace(0, 10, dtype=int), _nt.Array) -assert_type(np.geomspace(0, 10), _nt.Array[np.floating]) -assert_type(np.geomspace(0, 10j), _nt.Array[np.inexact]) +assert_type(np.geomspace(0, 10), _nt.Array[np.float64]) +assert_type(np.geomspace(0, 10j), _nt.Array[np.complex128]) assert_type(np.geomspace(0, 10, dtype=np.int64), _nt.Array[np.int64]) assert_type(np.geomspace(0, 10, dtype=int), _nt.Array) From 9a9519cd8195db0bede3e8f77065e6cfcd178524 Mon Sep 17 00:00:00 2001 From: jorenham Date: Sun, 28 Dec 2025 17:26:33 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`=5Fcore.function?= =?UTF-8?q?=5Fbase`=20sync=20with=20upstream=20(again)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/accept/array_constructors.pyi | 24 +- src/numpy-stubs/_core/function_base.pyi | 249 +++++++++++++----- 2 files changed, 190 insertions(+), 83 deletions(-) diff --git a/src/numpy-stubs/@test/static/accept/array_constructors.pyi b/src/numpy-stubs/@test/static/accept/array_constructors.pyi index d2061aa0..e003c2f9 100644 --- a/src/numpy-stubs/@test/static/accept/array_constructors.pyi +++ b/src/numpy-stubs/@test/static/accept/array_constructors.pyi @@ -125,23 +125,23 @@ assert_type(np.require(B, requirements="W"), MyArray[np.float64]) assert_type(np.require(B, requirements="A"), MyArray[np.float64]) assert_type(np.require(C), _nt.Array[np.intp]) -assert_type(np.linspace(0, 10), _nt.Array[np.float64]) -assert_type(np.linspace(0, 10j), _nt.Array[np.complex128]) -assert_type(np.linspace(0, 10, dtype=np.int64), _nt.Array[np.int64]) +assert_type(np.linspace(0, 10), _nt.Array1D[np.float64]) +assert_type(np.linspace(0, 10j), _nt.Array1D[np.complex128 | Any]) +assert_type(np.linspace(0, 10, dtype=np.int64), _nt.Array1D[np.int64]) assert_type(np.linspace(0, 10, dtype=int), _nt.Array) -assert_type(np.linspace(0, 10, retstep=True), tuple[_nt.Array[np.float64], np.float64]) -assert_type(np.linspace(0j, 10, retstep=True), tuple[_nt.Array[np.complex128], np.complex128]) -assert_type(np.linspace(0, 10, retstep=True, dtype=np.int64), tuple[_nt.Array[np.int64], np.int64]) +assert_type(np.linspace(0, 10, retstep=True), tuple[_nt.Array1D[np.float64], np.float64]) +assert_type(np.linspace(0j, 10, retstep=True), tuple[_nt.Array1D[np.complex128 | Any], np.complex128 | Any]) +assert_type(np.linspace(0, 10, retstep=True, dtype=np.int64), tuple[_nt.Array1D[np.int64], np.int64]) assert_type(np.linspace(0j, 10, retstep=True, dtype=int), tuple[_nt.Array, Any]) -assert_type(np.logspace(0, 10), _nt.Array[np.float64]) -assert_type(np.logspace(0, 10j), _nt.Array[np.complex128]) -assert_type(np.logspace(0, 10, dtype=np.int64), _nt.Array[np.int64]) +assert_type(np.logspace(0, 10), _nt.Array1D[np.float64]) +assert_type(np.logspace(0, 10j), _nt.Array1D[np.complex128 | Any]) +assert_type(np.logspace(0, 10, dtype=np.int64), _nt.Array1D[np.int64]) assert_type(np.logspace(0, 10, dtype=int), _nt.Array) -assert_type(np.geomspace(0, 10), _nt.Array[np.float64]) -assert_type(np.geomspace(0, 10j), _nt.Array[np.complex128]) -assert_type(np.geomspace(0, 10, dtype=np.int64), _nt.Array[np.int64]) +assert_type(np.geomspace(0, 10), _nt.Array1D[np.float64]) +assert_type(np.geomspace(0, 10j), _nt.Array1D[np.complex128 | Any]) +assert_type(np.geomspace(0, 10, dtype=np.int64), _nt.Array1D[np.int64]) assert_type(np.geomspace(0, 10, dtype=int), _nt.Array) assert_type(np.empty_like(A), _nt.Array[np.float64]) diff --git a/src/numpy-stubs/_core/function_base.pyi b/src/numpy-stubs/_core/function_base.pyi index 4843f26e..dc974268 100644 --- a/src/numpy-stubs/_core/function_base.pyi +++ b/src/numpy-stubs/_core/function_base.pyi @@ -3,7 +3,7 @@ from typing import Any, Literal as L, SupportsIndex, TypeVar, overload import _numtype as _nt import numpy as np -from numpy._typing import DTypeLike, NDArray, _DTypeLike +from numpy._typing import DTypeLike, _DTypeLike __all__ = ["geomspace", "linspace", "logspace"] @@ -13,8 +13,8 @@ _ScalarT = TypeVar("_ScalarT", bound=np.generic) @overload def linspace( - start: _nt.CoFloat64_nd, - stop: _nt.CoFloat64_nd, + start: _nt.CoFloat64_0d, + stop: _nt.CoFloat64_0d, num: SupportsIndex = 50, endpoint: bool = True, retstep: L[False] = False, @@ -22,11 +22,11 @@ def linspace( axis: SupportsIndex = 0, *, device: L["cpu"] | None = None, -) -> NDArray[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload def linspace( - start: _nt.CoFloating_nd, - stop: _nt.CoFloating_nd, + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, num: SupportsIndex = 50, endpoint: bool = True, retstep: L[False] = False, @@ -34,11 +34,35 @@ def linspace( axis: SupportsIndex = 0, *, device: L["cpu"] | None = None, -) -> NDArray[np.float64 | Any]: ... +) -> _nt.Array1D[np.complex128 | Any]: ... @overload def linspace( - start: _nt.ToComplex128_nd, - stop: _nt.CoComplex128_nd, + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, + num: SupportsIndex, + endpoint: bool, + retstep: L[False], + dtype: _DTypeLike[_ScalarT], + axis: SupportsIndex = 0, + *, + device: L["cpu"] | None = None, +) -> _nt.Array1D[_ScalarT]: ... +@overload +def linspace( + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, + num: SupportsIndex = 50, + endpoint: bool = True, + retstep: L[False] = False, + *, + dtype: _DTypeLike[_ScalarT], + axis: SupportsIndex = 0, + device: L["cpu"] | None = None, +) -> _nt.Array1D[_ScalarT]: ... +@overload +def linspace( + start: _nt.CoFloat64_nd, + stop: _nt.CoFloat64_nd, num: SupportsIndex = 50, endpoint: bool = True, retstep: L[False] = False, @@ -46,11 +70,11 @@ def linspace( axis: SupportsIndex = 0, *, device: L["cpu"] | None = None, -) -> NDArray[np.complex128]: ... +) -> _nt.Array[np.float64]: ... @overload def linspace( - start: _nt.CoComplex128_nd, - stop: _nt.ToComplex128_nd, + start: _nt.CoFloating_nd, + stop: _nt.CoFloating_nd, num: SupportsIndex = 50, endpoint: bool = True, retstep: L[False] = False, @@ -58,7 +82,7 @@ def linspace( axis: SupportsIndex = 0, *, device: L["cpu"] | None = None, -) -> NDArray[np.complex128]: ... +) -> _nt.Array[np.float64 | Any]: ... @overload def linspace( start: _nt.CoComplex_nd, @@ -70,7 +94,7 @@ def linspace( axis: SupportsIndex = 0, *, device: L["cpu"] | None = None, -) -> NDArray[np.complex128 | Any]: ... +) -> _nt.Array[np.complex128 | Any]: ... @overload def linspace( start: _nt.CoComplex_nd, @@ -82,7 +106,7 @@ def linspace( axis: SupportsIndex = 0, *, device: L["cpu"] | None = None, -) -> NDArray[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def linspace( start: _nt.CoComplex_nd, @@ -94,7 +118,7 @@ def linspace( dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, device: L["cpu"] | None = None, -) -> NDArray[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def linspace( start: _nt.CoComplex_nd, @@ -106,11 +130,11 @@ def linspace( axis: SupportsIndex = 0, *, device: L["cpu"] | None = None, -) -> NDArray[Incomplete]: ... +) -> _nt.Array[Incomplete]: ... @overload def linspace( - start: _nt.CoFloat64_nd, - stop: _nt.CoFloat64_nd, + start: _nt.CoFloat64_0d, + stop: _nt.CoFloat64_0d, num: SupportsIndex = 50, endpoint: bool = True, *, @@ -118,11 +142,11 @@ def linspace( dtype: None = None, axis: SupportsIndex = 0, device: L["cpu"] | None = None, -) -> tuple[NDArray[np.float64], np.float64]: ... +) -> tuple[_nt.Array1D[np.float64], np.float64]: ... @overload def linspace( - start: _nt.CoFloating_nd, - stop: _nt.CoFloating_nd, + start: _nt.CoFloating_0d, + stop: _nt.CoFloating_0d, num: SupportsIndex = 50, endpoint: bool = True, *, @@ -130,11 +154,11 @@ def linspace( dtype: None = None, axis: SupportsIndex = 0, device: L["cpu"] | None = None, -) -> tuple[NDArray[np.floating], np.floating]: ... +) -> tuple[_nt.Array1D[np.float64 | Any], np.float64 | Any]: ... @overload def linspace( - start: _nt.ToComplex128_nd, - stop: _nt.CoComplex128_nd, + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, num: SupportsIndex = 50, endpoint: bool = True, *, @@ -142,11 +166,23 @@ def linspace( dtype: None = None, axis: SupportsIndex = 0, device: L["cpu"] | None = None, -) -> tuple[NDArray[np.complex128], np.complex128]: ... +) -> tuple[_nt.Array1D[np.complex128 | Any], np.complex128 | Any]: ... @overload def linspace( - start: _nt.CoComplex128_nd, - stop: _nt.ToComplex128_nd, + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, + num: SupportsIndex = 50, + endpoint: bool = True, + *, + retstep: L[True], + dtype: _DTypeLike[_ScalarT], + axis: SupportsIndex = 0, + device: L["cpu"] | None = None, +) -> tuple[_nt.Array1D[_ScalarT], _ScalarT]: ... +@overload +def linspace( + start: _nt.CoFloat64_nd, + stop: _nt.CoFloat64_nd, num: SupportsIndex = 50, endpoint: bool = True, *, @@ -154,7 +190,19 @@ def linspace( dtype: None = None, axis: SupportsIndex = 0, device: L["cpu"] | None = None, -) -> tuple[NDArray[np.complex128], np.complex128]: ... +) -> tuple[_nt.Array[np.float64], np.float64]: ... +@overload +def linspace( + start: _nt.CoFloating_nd, + stop: _nt.CoFloating_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + *, + retstep: L[True], + dtype: None = None, + axis: SupportsIndex = 0, + device: L["cpu"] | None = None, +) -> tuple[_nt.Array[np.float64 | Any], np.float64 | Any]: ... @overload def linspace( start: _nt.CoComplex_nd, @@ -166,7 +214,7 @@ def linspace( dtype: None = None, axis: SupportsIndex = 0, device: L["cpu"] | None = None, -) -> tuple[NDArray[np.complex128 | Any], np.complex128 | Any]: ... +) -> tuple[_nt.Array[np.complex128 | Any], np.complex128 | Any]: ... @overload def linspace( start: _nt.CoComplex_nd, @@ -178,7 +226,7 @@ def linspace( dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, device: L["cpu"] | None = None, -) -> tuple[NDArray[_ScalarT], _ScalarT]: ... +) -> tuple[_nt.Array[_ScalarT], _ScalarT]: ... @overload def linspace( start: _nt.CoComplex_nd, @@ -190,49 +238,80 @@ def linspace( dtype: DTypeLike | None = None, axis: SupportsIndex = 0, device: L["cpu"] | None = None, -) -> tuple[NDArray[Incomplete], Incomplete]: ... +) -> tuple[_nt.Array[Incomplete], Incomplete]: ... # @overload def logspace( - start: _nt.CoFloat64_nd, - stop: _nt.CoFloat64_nd, + start: _nt.CoFloat64_0d, + stop: _nt.CoFloat64_0d, num: SupportsIndex = 50, endpoint: bool = True, - base: _nt.CoFloat64_nd = 10.0, + base: _nt.CoFloat64_0d = 10.0, dtype: None = None, axis: SupportsIndex = 0, -) -> NDArray[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload def logspace( - start: _nt.CoFloating_nd, - stop: _nt.CoFloating_nd, + start: _nt.CoFloating_0d, + stop: _nt.CoFloating_0d, num: SupportsIndex = 50, endpoint: bool = True, - base: _nt.CoFloating_nd = 10.0, + base: _nt.CoFloating_0d = 10.0, dtype: None = None, axis: SupportsIndex = 0, -) -> NDArray[np.float64 | Any]: ... +) -> _nt.Array1D[np.float64 | Any]: ... @overload def logspace( - start: _nt.ToComplex128_nd, - stop: _nt.CoComplex128_nd, + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, num: SupportsIndex = 50, endpoint: bool = True, - base: _nt.CoComplex_nd = 10.0, + base: _nt.CoComplex_0d = 10.0, dtype: None = None, axis: SupportsIndex = 0, -) -> NDArray[np.complex128]: ... +) -> _nt.Array1D[np.complex128 | Any]: ... +@overload +def logspace( + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, + num: SupportsIndex, + endpoint: bool, + base: _nt.CoComplex_0d, + dtype: _DTypeLike[_ScalarT], + axis: SupportsIndex = 0, +) -> _nt.Array1D[_ScalarT]: ... @overload def logspace( - start: _nt.CoComplex128_nd, - stop: _nt.ToComplex128_nd, + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, num: SupportsIndex = 50, endpoint: bool = True, - base: _nt.CoComplex_nd = 10.0, + base: _nt.CoComplex_0d = 10.0, + *, + dtype: _DTypeLike[_ScalarT], + axis: SupportsIndex = 0, +) -> _nt.Array1D[_ScalarT]: ... +@overload +def logspace( + start: _nt.CoFloat64_nd, + stop: _nt.CoFloat64_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + base: _nt.CoFloat64_nd = 10.0, + dtype: None = None, + axis: SupportsIndex = 0, +) -> _nt.Array[np.float64]: ... +@overload +def logspace( + start: _nt.CoFloating_nd, + stop: _nt.CoFloating_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + base: _nt.CoFloating_nd = 10.0, dtype: None = None, axis: SupportsIndex = 0, -) -> NDArray[np.complex128]: ... +) -> _nt.Array[np.float64 | Any]: ... @overload def logspace( start: _nt.CoComplex_nd, @@ -242,7 +321,7 @@ def logspace( base: _nt.CoComplex_nd = 10.0, dtype: None = None, axis: SupportsIndex = 0, -) -> NDArray[np.complex128 | Any]: ... +) -> _nt.Array[np.complex128 | Any]: ... @overload def logspace( start: _nt.CoComplex_nd, @@ -252,18 +331,18 @@ def logspace( base: _nt.CoComplex_nd, dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, -) -> NDArray[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def logspace( start: _nt.CoComplex_nd, stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, - base: _nt.CoFloating_nd = 10.0, + base: _nt.CoComplex_nd = 10.0, *, dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, -) -> NDArray[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def logspace( start: _nt.CoComplex_nd, @@ -273,54 +352,82 @@ def logspace( base: _nt.CoComplex_nd = 10.0, dtype: DTypeLike | None = None, axis: SupportsIndex = 0, -) -> NDArray[Incomplete]: ... +) -> _nt.Array[Incomplete]: ... # @overload def geomspace( - start: _nt.CoFloat64_nd, - stop: _nt.CoFloat64_nd, + start: _nt.CoFloat64_0d, + stop: _nt.CoFloat64_0d, num: SupportsIndex = 50, endpoint: bool = True, dtype: None = None, axis: SupportsIndex = 0, -) -> NDArray[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload def geomspace( - start: _nt.CoFloating_nd, - stop: _nt.CoFloating_nd, + start: _nt.CoFloating_0d, + stop: _nt.CoFloating_0d, num: SupportsIndex = 50, endpoint: bool = True, dtype: None = None, axis: SupportsIndex = 0, -) -> NDArray[np.float64 | Any]: ... +) -> _nt.Array1D[np.float64 | Any]: ... @overload def geomspace( - start: _nt.ToComplex128_nd, - stop: _nt.CoComplex128_nd, + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, num: SupportsIndex = 50, endpoint: bool = True, dtype: None = None, axis: SupportsIndex = 0, -) -> NDArray[np.complex128]: ... +) -> _nt.Array1D[np.complex128 | Any]: ... @overload def geomspace( - start: _nt.CoComplex128_nd, - stop: _nt.ToComplex128_nd, + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, + num: SupportsIndex, + endpoint: bool, + dtype: _DTypeLike[_ScalarT], + axis: SupportsIndex = 0, +) -> _nt.Array1D[_ScalarT]: ... +@overload +def geomspace( + start: _nt.CoComplex_0d, + stop: _nt.CoComplex_0d, + num: SupportsIndex = 50, + endpoint: bool = True, + *, + dtype: _DTypeLike[_ScalarT], + axis: SupportsIndex = 0, +) -> _nt.Array1D[_ScalarT]: ... +@overload +def geomspace( + start: _nt.CoFloat64_nd, + stop: _nt.CoFloat64_nd, + num: SupportsIndex = 50, + endpoint: bool = True, + dtype: None = None, + axis: SupportsIndex = 0, +) -> _nt.Array[np.float64]: ... +@overload +def geomspace( + start: _nt.CoFloating_nd, + stop: _nt.CoFloating_nd, num: SupportsIndex = 50, endpoint: bool = True, dtype: None = None, axis: SupportsIndex = 0, -) -> NDArray[np.complex128]: ... +) -> _nt.Array[np.float64 | Any]: ... @overload def geomspace( - start: _nt.ToComplex_nd, - stop: _nt.ToComplex_nd, + start: _nt.CoComplex_nd, + stop: _nt.CoComplex_nd, num: SupportsIndex = 50, endpoint: bool = True, dtype: None = None, axis: SupportsIndex = 0, -) -> NDArray[np.complex128 | Any]: ... +) -> _nt.Array[np.complex128 | Any]: ... @overload def geomspace( start: _nt.CoComplex_nd, @@ -329,7 +436,7 @@ def geomspace( endpoint: bool, dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, -) -> NDArray[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def geomspace( start: _nt.CoComplex_nd, @@ -339,7 +446,7 @@ def geomspace( *, dtype: _DTypeLike[_ScalarT], axis: SupportsIndex = 0, -) -> NDArray[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def geomspace( start: _nt.CoComplex_nd, @@ -348,7 +455,7 @@ def geomspace( endpoint: bool = True, dtype: DTypeLike | None = None, axis: SupportsIndex = 0, -) -> NDArray[Incomplete]: ... +) -> _nt.Array[Incomplete]: ... # def add_newdoc(