pyrefly-numpy-stubs 1.4.0.dev1__py3-none-any.whl → 1.4.0.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- numpy-stubs/__init__.pyi +81 -162
- numpy-stubs/_shapes.pyi +19 -0
- numpy-stubs/random/__init__.pyi +3 -5
- {pyrefly_numpy_stubs-1.4.0.dev1.dist-info → pyrefly_numpy_stubs-1.4.0.dev2.dist-info}/METADATA +2 -2
- pyrefly_numpy_stubs-1.4.0.dev2.dist-info/RECORD +9 -0
- {pyrefly_numpy_stubs-1.4.0.dev1.dist-info → pyrefly_numpy_stubs-1.4.0.dev2.dist-info}/WHEEL +1 -1
- pyrefly_numpy_stubs-1.4.0.dev1.dist-info/RECORD +0 -9
- {pyrefly_numpy_stubs-1.4.0.dev1.dist-info → pyrefly_numpy_stubs-1.4.0.dev2.dist-info}/licenses/LICENSE +0 -0
numpy-stubs/__init__.pyi
CHANGED
|
@@ -183,6 +183,7 @@ from numpy._core.shape_base import (
|
|
|
183
183
|
from numpy._pytesttester import PytestTester
|
|
184
184
|
from numpy._shapes import (
|
|
185
185
|
diag_extent,
|
|
186
|
+
expand_dims_shape,
|
|
186
187
|
matmul_shape,
|
|
187
188
|
matvec_shape,
|
|
188
189
|
reduce_shape,
|
|
@@ -410,9 +411,12 @@ from . import (
|
|
|
410
411
|
|
|
411
412
|
type _Shape = IntTuple
|
|
412
413
|
type _Axis = int | tuple[int, ...] | None
|
|
414
|
+
type _SingleAxis = int | None
|
|
413
415
|
type _BasicIndex = int | slice | list[int] | None | EllipsisType
|
|
414
416
|
|
|
415
|
-
class generic:
|
|
417
|
+
class generic:
|
|
418
|
+
def astype(self, dtype: Any, **kwargs: Any) -> Any: ...
|
|
419
|
+
|
|
416
420
|
class bool_(generic): ...
|
|
417
421
|
class float32(generic): ...
|
|
418
422
|
class float64(generic): ...
|
|
@@ -456,6 +460,7 @@ _dtype = dtype
|
|
|
456
460
|
|
|
457
461
|
class _Flags:
|
|
458
462
|
f_contiguous: py_bool
|
|
463
|
+
def __getitem__(self, key: str) -> py_bool: ...
|
|
459
464
|
|
|
460
465
|
class ndarray[Shape: _Shape = _Shape, DType = Any]:
|
|
461
466
|
shape: Shape
|
|
@@ -490,10 +495,9 @@ class ndarray[Shape: _Shape = _Shape, DType = Any]:
|
|
|
490
495
|
def real(self) -> ndarray[Shape]: ...
|
|
491
496
|
@real.setter
|
|
492
497
|
def real(self, value: Any) -> None: ...
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
def __len__[N: IntVar, M: IntVar](self: ndarray[[N, M]]) -> Int[N]: ...
|
|
498
|
+
def __len__[N: IntVar, Rest: _Shape = []](
|
|
499
|
+
self: ndarray[[N, *Elements[Rest]]],
|
|
500
|
+
) -> Int[N]: ...
|
|
497
501
|
@overload
|
|
498
502
|
def __getitem__[
|
|
499
503
|
N: IntVar,
|
|
@@ -522,12 +526,12 @@ class ndarray[Shape: _Shape = _Shape, DType = Any]:
|
|
|
522
526
|
# Assignment preserves the receiver's shape; value broadcasting is gradual.
|
|
523
527
|
def __setitem__(self, key: _ArrayIndex, value: ArrayLike, /) -> None: ...
|
|
524
528
|
@overload
|
|
525
|
-
def __iter__[N: IntVar, M: IntVar](
|
|
526
|
-
self: ndarray[[N, M], DType], /
|
|
527
|
-
) -> Iterator[ndarray[[M], DType]]: ...
|
|
528
|
-
#
|
|
529
|
+
def __iter__[N: IntVar, M: IntVar, Rest: _Shape = []](
|
|
530
|
+
self: ndarray[[N, M, *Elements[Rest]], DType], /
|
|
531
|
+
) -> Iterator[ndarray[[M, *Elements[Rest]], DType]]: ...
|
|
532
|
+
# Iteration over one-dimensional arrays yields NumPy scalars.
|
|
529
533
|
@overload
|
|
530
|
-
def __iter__(self, /) -> Iterator[Any]: ...
|
|
534
|
+
def __iter__[N: IntVar](self: ndarray[[N], DType], /) -> Iterator[Any]: ...
|
|
531
535
|
def __int__(self: ndarray[[]], /) -> int: ...
|
|
532
536
|
def __float__(self: ndarray[[]], /) -> float: ...
|
|
533
537
|
def __complex__(self: ndarray[[]], /) -> complex: ...
|
|
@@ -740,14 +744,14 @@ class ndarray[Shape: _Shape = _Shape, DType = Any]:
|
|
|
740
744
|
*,
|
|
741
745
|
where: Any = True,
|
|
742
746
|
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), _dtype[bool_]]: ...
|
|
743
|
-
def argmax[Axis: Flag[
|
|
747
|
+
def argmax[Axis: Flag[_SingleAxis], KeepDims: Flag[py_bool]](
|
|
744
748
|
self,
|
|
745
749
|
axis: Axis = None,
|
|
746
750
|
out: Any = None,
|
|
747
751
|
*,
|
|
748
752
|
keepdims: KeepDims = False,
|
|
749
753
|
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), _dtype[intp]]: ...
|
|
750
|
-
def argmin[Axis: Flag[
|
|
754
|
+
def argmin[Axis: Flag[_SingleAxis], KeepDims: Flag[py_bool]](
|
|
751
755
|
self,
|
|
752
756
|
axis: Axis = None,
|
|
753
757
|
out: Any = None,
|
|
@@ -1373,21 +1377,9 @@ def diag[S: _Shape, DType](
|
|
|
1373
1377
|
v: ndarray[S, DType], k: int = 0
|
|
1374
1378
|
) -> ndarray[IntTuple, DType]: ...
|
|
1375
1379
|
def arange[N: IntVar](stop: Int[N], /) -> ndarray[[N], dtype[intp]]: ...
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
axis: Literal[0, -3],
|
|
1380
|
-
) -> ndarray[[1, N, M], DType]: ...
|
|
1381
|
-
@overload
|
|
1382
|
-
def expand_dims[N: IntVar, M: IntVar, DType](
|
|
1383
|
-
a: ndarray[[N, M], DType],
|
|
1384
|
-
axis: Literal[1, -2],
|
|
1385
|
-
) -> ndarray[[N, 1, M], DType]: ...
|
|
1386
|
-
@overload
|
|
1387
|
-
def expand_dims[N: IntVar, M: IntVar, DType](
|
|
1388
|
-
a: ndarray[[N, M], DType],
|
|
1389
|
-
axis: Literal[2, -1],
|
|
1390
|
-
) -> ndarray[[N, M, 1], DType]: ...
|
|
1380
|
+
def expand_dims[Shape: _Shape, DType, Axis: Flag[int]](
|
|
1381
|
+
a: ndarray[Shape, DType], axis: Axis
|
|
1382
|
+
) -> ndarray[expand_dims_shape(Shape, Axis), DType]: ...
|
|
1391
1383
|
|
|
1392
1384
|
# These stubs track reduction shapes but leave reduction dtype gradual.
|
|
1393
1385
|
def sum[
|
|
@@ -1433,115 +1425,78 @@ def max(
|
|
|
1433
1425
|
a: Sequence[ArrayLike], axis: _Axis = None, *, keepdims: py_bool = False
|
|
1434
1426
|
) -> Any: ...
|
|
1435
1427
|
@overload
|
|
1436
|
-
def argmin[
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1428
|
+
def argmin[
|
|
1429
|
+
Shape: _Shape,
|
|
1430
|
+
DType,
|
|
1431
|
+
Axis: Flag[_SingleAxis],
|
|
1432
|
+
KeepDims: Flag[py_bool],
|
|
1433
|
+
](
|
|
1434
|
+
a: ndarray[Shape, DType], axis: Axis = None, *, keepdims: KeepDims = False
|
|
1435
|
+
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), dtype[intp]]: ...
|
|
1442
1436
|
@overload
|
|
1443
|
-
def argmin
|
|
1444
|
-
a:
|
|
1445
|
-
|
|
1446
|
-
*,
|
|
1447
|
-
keepdims: Literal[False] = False,
|
|
1448
|
-
) -> ndarray[[N], dtype[intp]]: ...
|
|
1449
|
-
|
|
1450
|
-
# TODO(stroxler): Replace these finite tuple-shape constructor overloads with a
|
|
1451
|
-
# generic `Shape: tuple[int, ...]` overload once whole-shape parameters flow
|
|
1452
|
-
# through downstream array operations without degrading to unknown.
|
|
1437
|
+
def argmin(
|
|
1438
|
+
a: Sequence[ArrayLike], axis: _SingleAxis = None, *, keepdims: py_bool = False
|
|
1439
|
+
) -> Any: ...
|
|
1453
1440
|
@overload
|
|
1454
1441
|
def zeros[N: IntVar, ScalarT: generic](
|
|
1455
1442
|
shape: Int[N], dtype: type[ScalarT], order: str = ...
|
|
1456
1443
|
) -> ndarray[[N], dtype[ScalarT]]: ...
|
|
1457
1444
|
@overload
|
|
1458
|
-
def zeros[
|
|
1459
|
-
shape:
|
|
1460
|
-
) -> ndarray[
|
|
1461
|
-
@overload
|
|
1462
|
-
def zeros[N: IntVar, M: IntVar, ScalarT: generic](
|
|
1463
|
-
shape: IntTuple[N, M], dtype: type[ScalarT], order: str = ...
|
|
1464
|
-
) -> ndarray[[N, M], dtype[ScalarT]]: ...
|
|
1445
|
+
def zeros[Shape: IntTuple, ScalarT: generic](
|
|
1446
|
+
shape: Shape, dtype: type[ScalarT], order: str = ...
|
|
1447
|
+
) -> ndarray[Shape, dtype[ScalarT]]: ...
|
|
1465
1448
|
@overload
|
|
1466
1449
|
def zeros[N: IntVar, ScalarT: generic](
|
|
1467
1450
|
shape: Int[N], dtype: dtype[ScalarT], order: str = ...
|
|
1468
1451
|
) -> ndarray[[N], dtype[ScalarT]]: ...
|
|
1469
1452
|
@overload
|
|
1470
|
-
def zeros[
|
|
1471
|
-
shape:
|
|
1472
|
-
) -> ndarray[
|
|
1473
|
-
@overload
|
|
1474
|
-
def zeros[N: IntVar, M: IntVar, ScalarT: generic](
|
|
1475
|
-
shape: IntTuple[N, M], dtype: dtype[ScalarT], order: str = ...
|
|
1476
|
-
) -> ndarray[[N, M], dtype[ScalarT]]: ...
|
|
1453
|
+
def zeros[Shape: IntTuple, ScalarT: generic](
|
|
1454
|
+
shape: Shape, dtype: dtype[ScalarT], order: str = ...
|
|
1455
|
+
) -> ndarray[Shape, dtype[ScalarT]]: ...
|
|
1477
1456
|
@overload
|
|
1478
1457
|
def zeros[N: IntVar](
|
|
1479
1458
|
shape: Int[N], dtype: None = ..., order: str = ...
|
|
1480
1459
|
) -> ndarray[[N], dtype[float64]]: ...
|
|
1481
1460
|
@overload
|
|
1482
|
-
def zeros[
|
|
1483
|
-
shape:
|
|
1484
|
-
) -> ndarray[
|
|
1485
|
-
@overload
|
|
1486
|
-
def zeros[N: IntVar, M: IntVar](
|
|
1487
|
-
shape: IntTuple[N, M], dtype: None = ..., order: str = ...
|
|
1488
|
-
) -> ndarray[[N, M], dtype[float64]]: ...
|
|
1461
|
+
def zeros[Shape: IntTuple](
|
|
1462
|
+
shape: Shape, dtype: None = ..., order: str = ...
|
|
1463
|
+
) -> ndarray[Shape, dtype[float64]]: ...
|
|
1489
1464
|
@overload
|
|
1490
1465
|
def zeros[N: IntVar](shape: Int[N], dtype: Any, order: str = ...) -> ndarray[[N]]: ...
|
|
1491
1466
|
@overload
|
|
1492
|
-
def zeros[
|
|
1493
|
-
shape:
|
|
1494
|
-
) -> ndarray[
|
|
1495
|
-
@overload
|
|
1496
|
-
def zeros[N: IntVar, M: IntVar](
|
|
1497
|
-
shape: IntTuple[N, M], dtype: Any, order: str = ...
|
|
1498
|
-
) -> ndarray[[N, M]]: ...
|
|
1467
|
+
def zeros[Shape: IntTuple](
|
|
1468
|
+
shape: Shape, dtype: Any, order: str = ...
|
|
1469
|
+
) -> ndarray[Shape]: ...
|
|
1499
1470
|
@overload
|
|
1500
1471
|
def ones[N: IntVar, ScalarT: generic](
|
|
1501
1472
|
shape: Int[N], dtype: type[ScalarT], order: str = ...
|
|
1502
1473
|
) -> ndarray[[N], dtype[ScalarT]]: ...
|
|
1503
1474
|
@overload
|
|
1504
|
-
def ones[
|
|
1505
|
-
shape:
|
|
1506
|
-
) -> ndarray[
|
|
1507
|
-
@overload
|
|
1508
|
-
def ones[N: IntVar, M: IntVar, ScalarT: generic](
|
|
1509
|
-
shape: IntTuple[N, M], dtype: type[ScalarT], order: str = ...
|
|
1510
|
-
) -> ndarray[[N, M], dtype[ScalarT]]: ...
|
|
1475
|
+
def ones[Shape: IntTuple, ScalarT: generic](
|
|
1476
|
+
shape: Shape, dtype: type[ScalarT], order: str = ...
|
|
1477
|
+
) -> ndarray[Shape, dtype[ScalarT]]: ...
|
|
1511
1478
|
@overload
|
|
1512
1479
|
def ones[N: IntVar, ScalarT: generic](
|
|
1513
1480
|
shape: Int[N], dtype: dtype[ScalarT], order: str = ...
|
|
1514
1481
|
) -> ndarray[[N], dtype[ScalarT]]: ...
|
|
1515
1482
|
@overload
|
|
1516
|
-
def ones[
|
|
1517
|
-
shape:
|
|
1518
|
-
) -> ndarray[
|
|
1519
|
-
@overload
|
|
1520
|
-
def ones[N: IntVar, M: IntVar, ScalarT: generic](
|
|
1521
|
-
shape: IntTuple[N, M], dtype: dtype[ScalarT], order: str = ...
|
|
1522
|
-
) -> ndarray[[N, M], dtype[ScalarT]]: ...
|
|
1483
|
+
def ones[Shape: IntTuple, ScalarT: generic](
|
|
1484
|
+
shape: Shape, dtype: dtype[ScalarT], order: str = ...
|
|
1485
|
+
) -> ndarray[Shape, dtype[ScalarT]]: ...
|
|
1523
1486
|
@overload
|
|
1524
1487
|
def ones[N: IntVar](
|
|
1525
1488
|
shape: Int[N], dtype: None = ..., order: str = ...
|
|
1526
1489
|
) -> ndarray[[N], dtype[float64]]: ...
|
|
1527
1490
|
@overload
|
|
1528
|
-
def ones[
|
|
1529
|
-
shape:
|
|
1530
|
-
) -> ndarray[
|
|
1531
|
-
@overload
|
|
1532
|
-
def ones[N: IntVar, M: IntVar](
|
|
1533
|
-
shape: IntTuple[N, M], dtype: None = ..., order: str = ...
|
|
1534
|
-
) -> ndarray[[N, M], dtype[float64]]: ...
|
|
1491
|
+
def ones[Shape: IntTuple](
|
|
1492
|
+
shape: Shape, dtype: None = ..., order: str = ...
|
|
1493
|
+
) -> ndarray[Shape, dtype[float64]]: ...
|
|
1535
1494
|
@overload
|
|
1536
1495
|
def ones[N: IntVar](shape: Int[N], dtype: Any, order: str = ...) -> ndarray[[N]]: ...
|
|
1537
1496
|
@overload
|
|
1538
|
-
def ones[
|
|
1539
|
-
shape:
|
|
1540
|
-
) -> ndarray[
|
|
1541
|
-
@overload
|
|
1542
|
-
def ones[N: IntVar, M: IntVar](
|
|
1543
|
-
shape: IntTuple[N, M], dtype: Any, order: str = ...
|
|
1544
|
-
) -> ndarray[[N, M]]: ...
|
|
1497
|
+
def ones[Shape: IntTuple](
|
|
1498
|
+
shape: Shape, dtype: Any, order: str = ...
|
|
1499
|
+
) -> ndarray[Shape]: ...
|
|
1545
1500
|
@overload
|
|
1546
1501
|
def full[N: IntVar, ScalarT: generic](
|
|
1547
1502
|
shape: Int[N],
|
|
@@ -1550,19 +1505,12 @@ def full[N: IntVar, ScalarT: generic](
|
|
|
1550
1505
|
order: str = ...,
|
|
1551
1506
|
) -> ndarray[[N], dtype[ScalarT]]: ...
|
|
1552
1507
|
@overload
|
|
1553
|
-
def full[
|
|
1554
|
-
shape:
|
|
1555
|
-
fill_value: Any,
|
|
1556
|
-
dtype: type[ScalarT],
|
|
1557
|
-
order: str = ...,
|
|
1558
|
-
) -> ndarray[[N], dtype[ScalarT]]: ...
|
|
1559
|
-
@overload
|
|
1560
|
-
def full[N: IntVar, M: IntVar, ScalarT: generic](
|
|
1561
|
-
shape: IntTuple[N, M],
|
|
1508
|
+
def full[Shape: IntTuple, ScalarT: generic](
|
|
1509
|
+
shape: Shape,
|
|
1562
1510
|
fill_value: Any,
|
|
1563
1511
|
dtype: type[ScalarT],
|
|
1564
1512
|
order: str = ...,
|
|
1565
|
-
) -> ndarray[
|
|
1513
|
+
) -> ndarray[Shape, dtype[ScalarT]]: ...
|
|
1566
1514
|
@overload
|
|
1567
1515
|
def full[N: IntVar, ScalarT: generic](
|
|
1568
1516
|
shape: Int[N],
|
|
@@ -1571,80 +1519,50 @@ def full[N: IntVar, ScalarT: generic](
|
|
|
1571
1519
|
order: str = ...,
|
|
1572
1520
|
) -> ndarray[[N], dtype[ScalarT]]: ...
|
|
1573
1521
|
@overload
|
|
1574
|
-
def full[
|
|
1575
|
-
shape:
|
|
1522
|
+
def full[Shape: IntTuple, ScalarT: generic](
|
|
1523
|
+
shape: Shape,
|
|
1576
1524
|
fill_value: Any,
|
|
1577
1525
|
dtype: dtype[ScalarT],
|
|
1578
1526
|
order: str = ...,
|
|
1579
|
-
) -> ndarray[
|
|
1580
|
-
@overload
|
|
1581
|
-
def full[N: IntVar, M: IntVar, ScalarT: generic](
|
|
1582
|
-
shape: IntTuple[N, M],
|
|
1583
|
-
fill_value: Any,
|
|
1584
|
-
dtype: dtype[ScalarT],
|
|
1585
|
-
order: str = ...,
|
|
1586
|
-
) -> ndarray[[N, M], dtype[ScalarT]]: ...
|
|
1527
|
+
) -> ndarray[Shape, dtype[ScalarT]]: ...
|
|
1587
1528
|
@overload
|
|
1588
1529
|
def full[N: IntVar](
|
|
1589
1530
|
shape: Int[N], fill_value: Any, dtype: Any = ..., order: str = ...
|
|
1590
1531
|
) -> ndarray[[N]]: ...
|
|
1591
1532
|
@overload
|
|
1592
|
-
def full[
|
|
1593
|
-
shape:
|
|
1594
|
-
) -> ndarray[
|
|
1595
|
-
@overload
|
|
1596
|
-
def full[N: IntVar, M: IntVar](
|
|
1597
|
-
shape: IntTuple[N, M],
|
|
1598
|
-
fill_value: Any,
|
|
1599
|
-
dtype: Any = ...,
|
|
1600
|
-
order: str = ...,
|
|
1601
|
-
) -> ndarray[[N, M]]: ...
|
|
1533
|
+
def full[Shape: IntTuple](
|
|
1534
|
+
shape: Shape, fill_value: Any, dtype: Any = ..., order: str = ...
|
|
1535
|
+
) -> ndarray[Shape]: ...
|
|
1602
1536
|
@overload
|
|
1603
1537
|
def empty[N: IntVar, ScalarT: generic](
|
|
1604
1538
|
shape: Int[N], dtype: type[ScalarT], order: str = ...
|
|
1605
1539
|
) -> ndarray[[N], dtype[ScalarT]]: ...
|
|
1606
1540
|
@overload
|
|
1607
|
-
def empty[
|
|
1608
|
-
shape:
|
|
1609
|
-
) -> ndarray[
|
|
1610
|
-
@overload
|
|
1611
|
-
def empty[N: IntVar, M: IntVar, ScalarT: generic](
|
|
1612
|
-
shape: IntTuple[N, M], dtype: type[ScalarT], order: str = ...
|
|
1613
|
-
) -> ndarray[[N, M], dtype[ScalarT]]: ...
|
|
1541
|
+
def empty[Shape: IntTuple, ScalarT: generic](
|
|
1542
|
+
shape: Shape, dtype: type[ScalarT], order: str = ...
|
|
1543
|
+
) -> ndarray[Shape, dtype[ScalarT]]: ...
|
|
1614
1544
|
@overload
|
|
1615
1545
|
def empty[N: IntVar, ScalarT: generic](
|
|
1616
1546
|
shape: Int[N], dtype: dtype[ScalarT], order: str = ...
|
|
1617
1547
|
) -> ndarray[[N], dtype[ScalarT]]: ...
|
|
1618
1548
|
@overload
|
|
1619
|
-
def empty[
|
|
1620
|
-
shape:
|
|
1621
|
-
) -> ndarray[
|
|
1622
|
-
@overload
|
|
1623
|
-
def empty[N: IntVar, M: IntVar, ScalarT: generic](
|
|
1624
|
-
shape: IntTuple[N, M], dtype: dtype[ScalarT], order: str = ...
|
|
1625
|
-
) -> ndarray[[N, M], dtype[ScalarT]]: ...
|
|
1549
|
+
def empty[Shape: IntTuple, ScalarT: generic](
|
|
1550
|
+
shape: Shape, dtype: dtype[ScalarT], order: str = ...
|
|
1551
|
+
) -> ndarray[Shape, dtype[ScalarT]]: ...
|
|
1626
1552
|
@overload
|
|
1627
1553
|
def empty[N: IntVar](
|
|
1628
1554
|
shape: Int[N], dtype: None = ..., order: str = ...
|
|
1629
1555
|
) -> ndarray[[N], dtype[float64]]: ...
|
|
1630
1556
|
@overload
|
|
1631
|
-
def empty[
|
|
1632
|
-
shape:
|
|
1633
|
-
) -> ndarray[
|
|
1634
|
-
@overload
|
|
1635
|
-
def empty[N: IntVar, M: IntVar](
|
|
1636
|
-
shape: IntTuple[N, M], dtype: None = ..., order: str = ...
|
|
1637
|
-
) -> ndarray[[N, M], dtype[float64]]: ...
|
|
1557
|
+
def empty[Shape: IntTuple](
|
|
1558
|
+
shape: Shape, dtype: None = ..., order: str = ...
|
|
1559
|
+
) -> ndarray[Shape, dtype[float64]]: ...
|
|
1638
1560
|
@overload
|
|
1639
1561
|
def empty[N: IntVar](shape: Int[N], dtype: Any, order: str = ...) -> ndarray[[N]]: ...
|
|
1640
1562
|
@overload
|
|
1641
|
-
def empty[
|
|
1642
|
-
shape:
|
|
1643
|
-
) -> ndarray[
|
|
1644
|
-
@overload
|
|
1645
|
-
def empty[N: IntVar, M: IntVar](
|
|
1646
|
-
shape: IntTuple[N, M], dtype: Any, order: str = ...
|
|
1647
|
-
) -> ndarray[[N, M]]: ...
|
|
1563
|
+
def empty[Shape: IntTuple](
|
|
1564
|
+
shape: Shape, dtype: Any, order: str = ...
|
|
1565
|
+
) -> ndarray[Shape]: ...
|
|
1648
1566
|
@overload
|
|
1649
1567
|
def eye[N: IntVar, ScalarT: generic](
|
|
1650
1568
|
N: Int[N], M: None = ..., k: int = ..., *, dtype: type[ScalarT], order: str = ...
|
|
@@ -1691,7 +1609,12 @@ def identity[N: IntVar](
|
|
|
1691
1609
|
n: Int[N], dtype: Any, *, like: Any = ...
|
|
1692
1610
|
) -> ndarray[[N, N]]: ...
|
|
1693
1611
|
|
|
1694
|
-
# TODO(stroxler): Replace
|
|
1612
|
+
# TODO(stroxler): Replace the remaining placeholders with NumPy's scalar hierarchy.
|
|
1613
|
+
class number(generic): ...
|
|
1614
|
+
class inexact(number): ...
|
|
1615
|
+
class floating(inexact): ...
|
|
1616
|
+
class integer(number): ...
|
|
1617
|
+
|
|
1695
1618
|
bool: Any
|
|
1696
1619
|
broadcast: Any
|
|
1697
1620
|
byte: Any
|
|
@@ -1707,18 +1630,14 @@ datetime64: Any
|
|
|
1707
1630
|
double: Any
|
|
1708
1631
|
flexible: Any
|
|
1709
1632
|
float16: Any
|
|
1710
|
-
floating: Any
|
|
1711
1633
|
half: Any
|
|
1712
|
-
inexact: Any
|
|
1713
1634
|
int16: Any
|
|
1714
1635
|
int8: Any
|
|
1715
1636
|
int_: Any
|
|
1716
1637
|
intc: Any
|
|
1717
|
-
integer: Any
|
|
1718
1638
|
long: Any
|
|
1719
1639
|
longdouble: Any
|
|
1720
1640
|
longlong: Any
|
|
1721
|
-
number: Any
|
|
1722
1641
|
object_: Any
|
|
1723
1642
|
short: Any
|
|
1724
1643
|
signedinteger: Any
|
numpy-stubs/_shapes.pyi
CHANGED
|
@@ -123,3 +123,22 @@ def stack_shape(shapes: IntTuples, axis: int) -> IntTuple:
|
|
|
123
123
|
for index in range(output_rank)
|
|
124
124
|
)
|
|
125
125
|
)
|
|
126
|
+
|
|
127
|
+
@type_shape_dsl_function
|
|
128
|
+
def expand_dims_shape(shape: IntTuple, axis: int) -> IntTuple:
|
|
129
|
+
output_rank = len(shape) + 1
|
|
130
|
+
# Unary minus is not supported by the type-level DSL.
|
|
131
|
+
if axis < 0 - output_rank or axis >= output_rank:
|
|
132
|
+
return dsl.Invalid("expand_dims axis out of bounds")
|
|
133
|
+
if axis < 0:
|
|
134
|
+
norm_axis = axis + output_rank
|
|
135
|
+
else:
|
|
136
|
+
norm_axis = axis + 0
|
|
137
|
+
return dsl.IntTuple(
|
|
138
|
+
(
|
|
139
|
+
1
|
|
140
|
+
if index == norm_axis
|
|
141
|
+
else shape[index if index < norm_axis else index - 1]
|
|
142
|
+
for index in range(output_rank)
|
|
143
|
+
)
|
|
144
|
+
)
|
numpy-stubs/random/__init__.pyi
CHANGED
|
@@ -79,13 +79,11 @@ from numpy.random.mtrand import (
|
|
|
79
79
|
weibull as weibull,
|
|
80
80
|
zipf as zipf,
|
|
81
81
|
)
|
|
82
|
-
from shape_extensions import
|
|
82
|
+
from shape_extensions import IntTuple
|
|
83
83
|
|
|
84
84
|
from .. import dtype, float64, ndarray
|
|
85
85
|
|
|
86
86
|
@overload
|
|
87
|
-
def randn
|
|
87
|
+
def randn() -> float: ...
|
|
88
88
|
@overload
|
|
89
|
-
def randn[
|
|
90
|
-
d0: Int[N], d1: Int[M], /
|
|
91
|
-
) -> ndarray[[N, M], dtype[float64]]: ...
|
|
89
|
+
def randn[Shape: IntTuple](*dims: *Shape) -> ndarray[Shape, dtype[float64]]: ...
|
{pyrefly_numpy_stubs-1.4.0.dev1.dist-info → pyrefly_numpy_stubs-1.4.0.dev2.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pyrefly-numpy-stubs
|
|
3
|
-
Version: 1.4.0.
|
|
3
|
+
Version: 1.4.0.dev2
|
|
4
4
|
Summary: NumPy type stubs with array-shape tracking, maintained by Pyrefly
|
|
5
5
|
Project-URL: homepage, https://pyrefly.org
|
|
6
6
|
Project-URL: documentation, https://pyrefly.org/en/docs/
|
|
@@ -33,7 +33,7 @@ Classifier: Programming Language :: Python
|
|
|
33
33
|
Classifier: Programming Language :: Python :: 3
|
|
34
34
|
Classifier: Typing :: Stubs Only
|
|
35
35
|
Requires-Python: >=3.12
|
|
36
|
-
Requires-Dist: pyrefly-shape-extensions==1.4.0.
|
|
36
|
+
Requires-Dist: pyrefly-shape-extensions==1.4.0.dev2
|
|
37
37
|
Description-Content-Type: text/markdown
|
|
38
38
|
|
|
39
39
|
# pyrefly-numpy-stubs
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
numpy-stubs/__init__.pyi,sha256=hQWmGEAgvHTVwqs_-YIoSFyB6wGhvHWUoJWe07YE-tA,48601
|
|
2
|
+
numpy-stubs/_shapes.pyi,sha256=kvbytJygme4DluXr_v2iO_kAnWrZaRTUCb0MNgi-6Oo,4802
|
|
3
|
+
numpy-stubs/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
4
|
+
numpy-stubs/linalg/__init__.pyi,sha256=HqAg4mSr0csSnsIRougqxHP7dzUww7wa6USyN51PPAQ,2734
|
|
5
|
+
numpy-stubs/random/__init__.pyi,sha256=rZT47dwZw1ev6xXQsngIZQL8SnkI2vEUBbK2p-vSi7w,2404
|
|
6
|
+
pyrefly_numpy_stubs-1.4.0.dev2.dist-info/METADATA,sha256=12Q53aX_k9HEN2PsBsHq1tXxHSTuzQtbF_p908sVC9U,2662
|
|
7
|
+
pyrefly_numpy_stubs-1.4.0.dev2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
8
|
+
pyrefly_numpy_stubs-1.4.0.dev2.dist-info/licenses/LICENSE,sha256=2m03A-0Ry-Qr0hLHJZV8mNojy_8ZmMBfpLPZdtGljpM,1088
|
|
9
|
+
pyrefly_numpy_stubs-1.4.0.dev2.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
numpy-stubs/__init__.pyi,sha256=t57N4li3sxqfy87EI3QN5BLw2zdc1Z0qOROl0H-gUlE,51183
|
|
2
|
-
numpy-stubs/_shapes.pyi,sha256=6SWZvOMJ3L2GzcglV5b1Df4hut3XabWziTnfZZV-O0Q,4203
|
|
3
|
-
numpy-stubs/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
4
|
-
numpy-stubs/linalg/__init__.pyi,sha256=HqAg4mSr0csSnsIRougqxHP7dzUww7wa6USyN51PPAQ,2734
|
|
5
|
-
numpy-stubs/random/__init__.pyi,sha256=vRqvYq0cOhRWx86DXEgGZ1fxPO4kTCl_CCx92Ud-Z14,2478
|
|
6
|
-
pyrefly_numpy_stubs-1.4.0.dev1.dist-info/METADATA,sha256=90ytQrkkZ3OlOX63AhGU4xhjc3jZOA5MLkLcJvZo5KE,2662
|
|
7
|
-
pyrefly_numpy_stubs-1.4.0.dev1.dist-info/WHEEL,sha256=THafob7ofN-NsuMN7Mg4qZyHaQI7KkD-QlcQatYhXPo,87
|
|
8
|
-
pyrefly_numpy_stubs-1.4.0.dev1.dist-info/licenses/LICENSE,sha256=2m03A-0Ry-Qr0hLHJZV8mNojy_8ZmMBfpLPZdtGljpM,1088
|
|
9
|
-
pyrefly_numpy_stubs-1.4.0.dev1.dist-info/RECORD,,
|
|
File without changes
|