From 0d611c2e7e592fed73e5679803f7bcd45dfa74e0 Mon Sep 17 00:00:00 2001 From: jorenham Date: Sun, 15 Dec 2024 18:19:49 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20`sparse`:=20complete=20`=5Fspfuncs.?= =?UTF-8?q?*`=20(private)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scipy-stubs/sparse/_spfuncs.pyi | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scipy-stubs/sparse/_spfuncs.pyi b/scipy-stubs/sparse/_spfuncs.pyi index 878d1141..17563cbd 100644 --- a/scipy-stubs/sparse/_spfuncs.pyi +++ b/scipy-stubs/sparse/_spfuncs.pyi @@ -1,6 +1,18 @@ -from scipy._typing import Untyped +from typing import Literal as L, TypeAlias, TypeVar + +import optype.numpy as onp +from ._base import _spbase +from ._typing import Float __all__ = ["count_blocks", "estimate_blocksize"] -def estimate_blocksize(A: Untyped, efficiency: float = 0.7) -> Untyped: ... -def count_blocks(A: Untyped, blocksize: tuple[int, int]) -> Untyped: ... +_SizeT = TypeVar("_SizeT", bound=int) +_BlockSize: TypeAlias = tuple[_SizeT, _SizeT] + +def estimate_blocksize( + A: _spbase | onp.ToComplex2D, + efficiency: float | Float = 0.7, +) -> _BlockSize[L[1]] | _BlockSize[L[2]] | _BlockSize[L[3]] | _BlockSize[L[4]] | _BlockSize[L[6]]: ... + +# +def count_blocks(A: _spbase | onp.ToComplex2D, blocksize: tuple[onp.ToJustInt, onp.ToJustInt]) -> int: ...