Skip to content

Commit f2d57e8

Browse files
Fixed constructor stubs for positional and keyword dtypes (other than np.float64)
1 parent b3d1ee0 commit f2d57e8

File tree

7 files changed

+430
-100
lines changed

7 files changed

+430
-100
lines changed

scipy-stubs/sparse/_bsr.pyi

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,37 +109,67 @@ class bsr_array(_bsr_base[_ScalarT_co], sparray[_ScalarT_co, tuple[int, int]], G
109109
*,
110110
maxprint: int | None = None,
111111
) -> None: ...
112-
@overload # 2-d shape-like, dtype: type[bool] | None
112+
@overload # 2-d shape-like, dtype: type[bool] (positional)
113113
def __init__(
114114
self: bsr_array[np.bool_],
115115
/,
116116
arg1: ToShape2D,
117-
shape: ToShape2D | None = None,
118-
dtype: onp.AnyBoolDType | None = None,
117+
shape: ToShape2D | None,
118+
dtype: onp.AnyBoolDType,
119119
copy: bool = False,
120+
maxprint: int | None = None,
121+
) -> None: ...
122+
@overload # 2-d shape-like, dtype: type[bool] (keyword)
123+
def __init__(
124+
self: bsr_array[np.bool_],
125+
/,
126+
arg1: ToShape2D,
127+
shape: ToShape2D | None = None,
120128
*,
129+
dtype: onp.AnyBoolDType,
130+
copy: bool = False,
121131
maxprint: int | None = None,
122132
) -> None: ...
123-
@overload # 2-d shape-like, dtype: type[int]
133+
@overload # 2-d shape-like, dtype: type[int] (positional)
124134
def __init__(
125135
self: bsr_array[np.int64],
126136
/,
127137
arg1: ToShape2D,
128-
shape: ToShape2D | None = None,
129-
dtype: onp.AnyIntDType | None = None,
138+
shape: ToShape2D | None,
139+
dtype: onp.AnyIntDType,
130140
copy: bool = False,
141+
maxprint: int | None = None,
142+
) -> None: ...
143+
@overload # 2-d shape-like, dtype: type[int] (keyword)
144+
def __init__(
145+
self: bsr_array[np.int64],
146+
/,
147+
arg1: ToShape2D,
148+
shape: ToShape2D | None = None,
131149
*,
150+
dtype: onp.AnyIntDType,
151+
copy: bool = False,
132152
maxprint: int | None = None,
133153
) -> None: ...
134-
@overload # 2-d shape-like, dtype: type[complex]
154+
@overload # 2-d shape-like, dtype: type[complex] (positional)
135155
def __init__(
136156
self: bsr_array[np.complex128],
137157
/,
138158
arg1: ToShape2D,
139-
shape: ToShape2D | None = None,
140-
dtype: onp.AnyComplex128DType | None = None,
159+
shape: ToShape2D | None,
160+
dtype: onp.AnyComplex128DType,
141161
copy: bool = False,
162+
maxprint: int | None = None,
163+
) -> None: ...
164+
@overload # 2-d shape-like, dtype: type[complex] (keyword)
165+
def __init__(
166+
self: bsr_array[np.complex128],
167+
/,
168+
arg1: ToShape2D,
169+
shape: ToShape2D | None = None,
142170
*,
171+
dtype: onp.AnyComplex128DType,
172+
copy: bool = False,
143173
maxprint: int | None = None,
144174
) -> None: ...
145175
@overload # matrix-like builtins.bool, dtype: type[bool] | None

scipy-stubs/sparse/_coo.pyi

Lines changed: 118 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class coo_array(_coo_base[_ScalarT_co, _ShapeT_co], sparray[_ScalarT_co, _ShapeT
171171
*,
172172
maxprint: int | None = None,
173173
) -> None: ...
174-
@overload # >2-d shape-like, dtype: type[float]
174+
@overload # >2-d shape-like, dtype: type[float] | None
175175
def __init__(
176176
self: coo_array[np.float64, onp.AtLeast3D],
177177
/,
@@ -182,103 +182,193 @@ class coo_array(_coo_base[_ScalarT_co, _ShapeT_co], sparray[_ScalarT_co, _ShapeT
182182
*,
183183
maxprint: int | None = None,
184184
) -> None: ...
185-
@overload # 1-d shape-like, dtype: type[bool]
185+
@overload # 1-d shape-like, dtype: type[bool] (positional)
186186
def __init__(
187187
self: coo_array[np.bool_, tuple[int]],
188188
/,
189189
arg1: ToShape1D,
190-
shape: ToShape1D | None = None,
191-
dtype: onp.AnyBoolDType | None = None,
190+
shape: ToShape1D | None,
191+
dtype: onp.AnyBoolDType,
192192
copy: bool = False,
193+
maxprint: int | None = None,
194+
) -> None: ...
195+
@overload # 1-d shape-like, dtype: type[bool] (keyword)
196+
def __init__(
197+
self: coo_array[np.bool_, tuple[int]],
198+
/,
199+
arg1: ToShape1D,
200+
shape: ToShape1D | None = None,
193201
*,
202+
dtype: onp.AnyBoolDType,
203+
copy: bool = False,
194204
maxprint: int | None = None,
195205
) -> None: ...
196-
@overload # 2-d shape-like, dtype: type[bool]
206+
@overload # 2-d shape-like, dtype: type[bool] (positional)
197207
def __init__(
198208
self: coo_array[np.bool_, tuple[int, int]],
199209
/,
200210
arg1: ToShape2D,
201-
shape: ToShape2D | None = None,
202-
dtype: onp.AnyBoolDType | None = None,
211+
shape: ToShape2D | None,
212+
dtype: onp.AnyBoolDType,
203213
copy: bool = False,
214+
maxprint: int | None = None,
215+
) -> None: ...
216+
@overload # 2-d shape-like, dtype: type[bool] (keyword)
217+
def __init__(
218+
self: coo_array[np.bool_, tuple[int, int]],
219+
/,
220+
arg1: ToShape2D,
221+
shape: ToShape2D | None = None,
204222
*,
223+
dtype: onp.AnyBoolDType,
224+
copy: bool = False,
205225
maxprint: int | None = None,
206226
) -> None: ...
207-
@overload # >2-d shape-like, dtype: type[bool]
227+
@overload # >2-d shape-like, dtype: type[bool] (positional)
208228
def __init__(
209229
self: coo_array[np.bool_, onp.AtLeast3D],
210230
/,
211231
arg1: ToShapeMin3D,
212-
shape: ToShapeMin3D | None = None,
213-
dtype: onp.AnyBoolDType | None = None,
232+
shape: ToShapeMin3D | None,
233+
dtype: onp.AnyBoolDType,
214234
copy: bool = False,
235+
maxprint: int | None = None,
236+
) -> None: ...
237+
@overload # >2-d shape-like, dtype: type[bool] (keyword)
238+
def __init__(
239+
self: coo_array[np.bool_, onp.AtLeast3D],
240+
/,
241+
arg1: ToShapeMin3D,
242+
shape: ToShapeMin3D | None = None,
215243
*,
244+
dtype: onp.AnyBoolDType,
245+
copy: bool = False,
216246
maxprint: int | None = None,
217247
) -> None: ...
218-
@overload # 1-d shape-like, dtype: type[int]
248+
@overload # 1-d shape-like, dtype: type[int] (positional)
219249
def __init__(
220250
self: coo_array[np.int64, tuple[int]],
221251
/,
222252
arg1: ToShape1D,
223-
shape: ToShape1D | None = None,
224-
dtype: onp.AnyIntDType | None = None,
253+
shape: ToShape1D | None,
254+
dtype: onp.AnyIntDType,
225255
copy: bool = False,
256+
maxprint: int | None = None,
257+
) -> None: ...
258+
@overload # 1-d shape-like, dtype: type[int] (keyword)
259+
def __init__(
260+
self: coo_array[np.int64, tuple[int]],
261+
/,
262+
arg1: ToShape1D,
263+
shape: ToShape1D | None = None,
226264
*,
265+
dtype: onp.AnyIntDType,
266+
copy: bool = False,
227267
maxprint: int | None = None,
228268
) -> None: ...
229-
@overload # 2-d shape-like, dtype: type[int]
269+
@overload # 2-d shape-like, dtype: type[int] (positional)
230270
def __init__(
231271
self: coo_array[np.int64, tuple[int, int]],
232272
/,
233273
arg1: ToShape2D,
234-
shape: ToShape2D | None = None,
235-
dtype: onp.AnyIntDType | None = None,
274+
shape: ToShape2D | None,
275+
dtype: onp.AnyIntDType,
236276
copy: bool = False,
277+
maxprint: int | None = None,
278+
) -> None: ...
279+
@overload # 2-d shape-like, dtype: type[int] (keyword)
280+
def __init__(
281+
self: coo_array[np.int64, tuple[int, int]],
282+
/,
283+
arg1: ToShape2D,
284+
shape: ToShape2D | None = None,
237285
*,
286+
dtype: onp.AnyIntDType,
287+
copy: bool = False,
238288
maxprint: int | None = None,
239289
) -> None: ...
240-
@overload # >2-d shape-like, dtype: type[int]
290+
@overload # >2-d shape-like, dtype: type[int] (positional)
241291
def __init__(
242292
self: coo_array[np.int64, onp.AtLeast3D],
243293
/,
244294
arg1: ToShapeMin3D,
245-
shape: ToShapeMin3D | None = None,
246-
dtype: onp.AnyIntDType | None = None,
295+
shape: ToShapeMin3D | None,
296+
dtype: onp.AnyIntDType,
247297
copy: bool = False,
298+
maxprint: int | None = None,
299+
) -> None: ...
300+
@overload # >2-d shape-like, dtype: type[int] (keyword)
301+
def __init__(
302+
self: coo_array[np.int64, onp.AtLeast3D],
303+
/,
304+
arg1: ToShapeMin3D,
305+
shape: ToShapeMin3D | None = None,
248306
*,
307+
dtype: onp.AnyIntDType,
308+
copy: bool = False,
249309
maxprint: int | None = None,
250310
) -> None: ...
251-
@overload # 1-d shape-like, dtype: type[complex]
311+
@overload # 1-d shape-like, dtype: type[complex] (positional)
252312
def __init__(
253313
self: coo_array[np.complex128, tuple[int]],
254314
/,
255315
arg1: ToShape1D,
256-
shape: ToShape1D | None = None,
257-
dtype: onp.AnyComplex128DType | None = None,
316+
shape: ToShape1D | None,
317+
dtype: onp.AnyComplex128DType,
258318
copy: bool = False,
319+
maxprint: int | None = None,
320+
) -> None: ...
321+
@overload # 1-d shape-like, dtype: type[complex] (keyword)
322+
def __init__(
323+
self: coo_array[np.complex128, tuple[int]],
324+
/,
325+
arg1: ToShape1D,
326+
shape: ToShape1D | None = None,
259327
*,
328+
dtype: onp.AnyComplex128DType,
329+
copy: bool = False,
260330
maxprint: int | None = None,
261331
) -> None: ...
262-
@overload # 2-d shape-like, dtype: type[complex]
332+
@overload # 2-d shape-like, dtype: type[complex] (positional)
263333
def __init__(
264334
self: coo_array[np.complex128, tuple[int, int]],
265335
/,
266336
arg1: ToShape2D,
267-
shape: ToShape2D | None = None,
268-
dtype: onp.AnyComplex128DType | None = None,
337+
shape: ToShape2D | None,
338+
dtype: onp.AnyComplex128DType,
269339
copy: bool = False,
340+
maxprint: int | None = None,
341+
) -> None: ...
342+
@overload # 2-d shape-like, dtype: type[complex] (keyword)
343+
def __init__(
344+
self: coo_array[np.complex128, tuple[int, int]],
345+
/,
346+
arg1: ToShape2D,
347+
shape: ToShape2D | None = None,
270348
*,
349+
dtype: onp.AnyComplex128DType,
350+
copy: bool = False,
271351
maxprint: int | None = None,
272352
) -> None: ...
273-
@overload # >2-d shape-like, dtype: type[complex]
353+
@overload # >2-d shape-like, dtype: type[complex] (positional)
274354
def __init__(
275355
self: coo_array[np.complex128, onp.AtLeast3D],
276356
/,
277357
arg1: ToShapeMin3D,
278-
shape: ToShapeMin3D | None = None,
279-
dtype: onp.AnyComplex64DType | None = None,
358+
shape: ToShapeMin3D | None,
359+
dtype: onp.AnyComplex64DType,
280360
copy: bool = False,
361+
maxprint: int | None = None,
362+
) -> None: ...
363+
@overload # >2-d shape-like, dtype: type[complex] (keyword)
364+
def __init__(
365+
self: coo_array[np.complex128, onp.AtLeast3D],
366+
/,
367+
arg1: ToShapeMin3D,
368+
shape: ToShapeMin3D | None = None,
281369
*,
370+
dtype: onp.AnyComplex64DType,
371+
copy: bool = False,
282372
maxprint: int | None = None,
283373
) -> None: ...
284374
@overload # vector-like builtins.bool, dtype: type[bool] | None

scipy-stubs/sparse/_csc.pyi

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,37 +88,67 @@ class csc_array(_csc_base[_ScalarT_co], sparray[_ScalarT_co, tuple[int, int]], G
8888
*,
8989
maxprint: int | None = None,
9090
) -> None: ...
91-
@overload # 2-d shape-like, dtype: type[bool]
91+
@overload # 2-d shape-like, dtype: type[bool] (positional)
9292
def __init__(
9393
self: csc_array[np.bool_],
9494
/,
9595
arg1: ToShape2D,
96-
shape: ToShape2D | None = None,
97-
dtype: onp.AnyBoolDType | None = None,
96+
shape: ToShape2D | None,
97+
dtype: onp.AnyBoolDType,
9898
copy: bool = False,
99+
maxprint: int | None = None,
100+
) -> None: ...
101+
@overload # 2-d shape-like, dtype: type[bool] (keyword)
102+
def __init__(
103+
self: csc_array[np.bool_],
104+
/,
105+
arg1: ToShape2D,
106+
shape: ToShape2D | None = None,
99107
*,
108+
dtype: onp.AnyBoolDType,
109+
copy: bool = False,
100110
maxprint: int | None = None,
101111
) -> None: ...
102-
@overload # 2-d shape-like, dtype: type[int]
112+
@overload # 2-d shape-like, dtype: type[int] (positional)
103113
def __init__(
104114
self: csc_array[np.int64],
105115
/,
106116
arg1: ToShape2D,
107-
shape: ToShape2D | None = None,
108-
dtype: onp.AnyIntDType | None = None,
117+
shape: ToShape2D | None,
118+
dtype: onp.AnyIntDType,
109119
copy: bool = False,
120+
maxprint: int | None = None,
121+
) -> None: ...
122+
@overload # 2-d shape-like, dtype: type[int] (keyword)
123+
def __init__(
124+
self: csc_array[np.int64],
125+
/,
126+
arg1: ToShape2D,
127+
shape: ToShape2D | None = None,
110128
*,
129+
dtype: onp.AnyIntDType,
130+
copy: bool = False,
111131
maxprint: int | None = None,
112132
) -> None: ...
113-
@overload # 2-d shape-like, dtype: type[complex]
133+
@overload # 2-d shape-like, dtype: type[complex] (positional)
114134
def __init__(
115135
self: csc_array[np.complex128],
116136
/,
117137
arg1: ToShape2D,
118-
shape: ToShape2D | None = None,
119-
dtype: onp.AnyComplex128DType | None = None,
138+
shape: ToShape2D | None,
139+
dtype: onp.AnyComplex128DType,
120140
copy: bool = False,
141+
maxprint: int | None = None,
142+
) -> None: ...
143+
@overload # 2-d shape-like, dtype: type[complex] (keyword)
144+
def __init__(
145+
self: csc_array[np.complex128],
146+
/,
147+
arg1: ToShape2D,
148+
shape: ToShape2D | None = None,
121149
*,
150+
dtype: onp.AnyComplex128DType,
151+
copy: bool = False,
122152
maxprint: int | None = None,
123153
) -> None: ...
124154
@overload # 2-d array-like bool, dtype: type[bool] | None

0 commit comments

Comments
 (0)