1- from typing_extensions import Self , override
1+ from typing import Final
2+ from typing_extensions import Self , TypeIs , override
23
34from scipy ._typing import Untyped
45from ._matrix import spmatrix as spmatrix
@@ -9,21 +10,21 @@ class SparseWarning(Warning): ...
910class SparseFormatWarning (SparseWarning ): ...
1011class SparseEfficiencyWarning (SparseWarning ): ...
1112
12- MAXPRINT : int
13+ MAXPRINT : Final = 50
1314
1415class _spbase :
1516 __array_priority__ : float
16- maxprint : Untyped
17+ maxprint : Final = 50
1718 @property
1819 def ndim (self ) -> int : ...
19- def __init__ (self , arg1 : Untyped , * , maxprint : Untyped | None = None ) -> None : ...
20+ def __init__ (self , arg1 : Untyped , maxprint : int | None = 50 ) -> None : ...
2021 @property
2122 def shape (self ) -> tuple [int , ...]: ...
2223 def reshape (self , * args : Untyped , ** kwargs : Untyped ) -> Untyped : ...
2324 def resize (self , shape : tuple [int , int ]) -> None : ...
2425 def astype (self , dtype : Untyped , casting : str = "unsafe" , copy : bool = True ) -> Untyped : ...
2526 def __iter__ (self ) -> Untyped : ...
26- def count_nonzero (self , axis : Untyped | None = None ) -> int : ...
27+ def count_nonzero (self ) -> int : ...
2728 @property
2829 def nnz (self ) -> int : ...
2930 @property
@@ -37,17 +38,16 @@ class _spbase:
3738 @property
3839 def imag (self ) -> Self : ...
3940 def __bool__ (self , / ) -> bool : ...
40- def __len__ (self , / ) -> int : ...
4141 def asformat (self , format : Untyped , copy : bool = False ) -> Untyped : ...
4242 def multiply (self , other : Untyped ) -> Untyped : ...
4343 def maximum (self , other : Untyped ) -> Untyped : ...
4444 def minimum (self , other : Untyped ) -> Untyped : ...
4545 def dot (self , other : Untyped ) -> Untyped : ...
4646 def power (self , n : Untyped , dtype : Untyped | None = None ) -> Self : ...
4747 @override
48- def __eq__ (self , other : Untyped , / ) -> Untyped : ... # type: ignore[override]
48+ def __eq__ (self , other : Untyped , / ) -> Untyped : ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
4949 @override
50- def __ne__ (self , other : Untyped , / ) -> Untyped : ... # type: ignore[override]
50+ def __ne__ (self , other : Untyped , / ) -> Untyped : ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
5151 def __lt__ (self , other : Untyped , / ) -> Untyped : ...
5252 def __gt__ (self , other : Untyped , / ) -> Untyped : ...
5353 def __le__ (self , other : Untyped , / ) -> Untyped : ...
@@ -64,15 +64,7 @@ class _spbase:
6464 def __rmatmul__ (self , other : Untyped , / ) -> Untyped : ...
6565 def __truediv__ (self , other : Untyped , / ) -> Untyped : ...
6666 def __div__ (self , other : Untyped , / ) -> Untyped : ...
67- def __rtruediv__ (self , other : Untyped , / ) -> Untyped : ...
68- def __rdiv__ (self , other : Untyped , / ) -> Untyped : ...
6967 def __neg__ (self , / ) -> Self : ...
70- def __iadd__ (self , other : Untyped , / ) -> Self : ...
71- def __isub__ (self , other : Untyped , / ) -> Self : ...
72- def __imul__ (self , other : Untyped , / ) -> Self : ...
73- def __idiv__ (self , other : Untyped , / ) -> Self : ...
74- def __itruediv__ (self , other : Untyped , / ) -> Self : ...
75- # NOTE: The modulo was left out for simplicitiy, but might need to be put back in
7668 def __pow__ (self , other : Untyped , / ) -> Untyped : ...
7769 def transpose (self , axes : Untyped | None = None , copy : bool = False ) -> Self : ...
7870 def conjugate (self , copy : bool = True ) -> Self : ...
@@ -85,7 +77,7 @@ class _spbase:
8577 def tocoo (self , copy : bool = False ) -> Untyped : ...
8678 def tolil (self , copy : bool = False ) -> Untyped : ...
8779 def todia (self , copy : bool = False ) -> Untyped : ...
88- def tobsr (self , blocksize : Untyped | None = None , copy : bool = False ) -> Untyped : ...
80+ def tobsr (self , blocksize : tuple [ int , int ] | None = None , copy : bool = False ) -> Untyped : ...
8981 def tocsc (self , copy : bool = False ) -> Untyped : ...
9082 def copy (self ) -> Self : ...
9183 def sum (self , axis : Untyped | None = None , dtype : Untyped | None = None , out : Untyped | None = None ) -> Untyped : ...
@@ -96,5 +88,5 @@ class _spbase:
9688
9789class sparray : ...
9890
99- def issparse (x : Untyped ) -> bool : ...
100- def isspmatrix (x : Untyped ) -> bool : ...
91+ def issparse (x : object ) -> TypeIs [ _spbase ] : ...
92+ def isspmatrix (x : object ) -> TypeIs [ spmatrix ] : ...
0 commit comments