Skip to content

Commit ca406e3

Browse files
committed
rename ShapeLike to ToShape in _numtype and update all references
1 parent 4746310 commit ca406e3

21 files changed

Lines changed: 607 additions & 608 deletions

src/_numtype/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ from ._shape import (
154154
Shape3N as Shape3N,
155155
Shape4 as Shape4,
156156
Shape4N as Shape4N,
157-
ShapeLike as ShapeLike,
157+
ToShape as ToShape,
158158
)
159159

160160
###

src/_numtype/_shape.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ __all__ = [
1616
"Shape3N",
1717
"Shape4",
1818
"Shape4N",
19-
"ShapeLike",
19+
"ToShape",
2020
"ShapeN",
2121
]
2222

@@ -38,4 +38,4 @@ Shape2N = TypeAliasType("Shape2N", tuple[int, int, *tuple[int, ...]])
3838
Shape3N = TypeAliasType("Shape3N", tuple[int, int, int, *tuple[int, ...]])
3939
Shape4N = TypeAliasType("Shape4N", tuple[int, int, int, int, *tuple[int, ...]])
4040

41-
ShapeLike: TypeAlias = SupportsIndex | Sequence[SupportsIndex]
41+
ToShape: TypeAlias = SupportsIndex | Sequence[SupportsIndex]

src/numpy-stubs/__init__.pyi

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ class _ArrayOrScalarCommon:
13211321
def copy(self, order: _OrderKACF = ...) -> Self: ...
13221322
def __copy__(self) -> Self: ...
13231323
def __deepcopy__(self, memo: dict[int, Any] | None, /) -> Self: ...
1324-
def __setstate__(self, state: tuple[CanIndex, _nt.ShapeLike, _DTypeT_co, bool_, bytes | list[Any]], /) -> None: ...
1324+
def __setstate__(self, state: tuple[CanIndex, _nt.ToShape, _DTypeT_co, bool_, bytes | list[Any]], /) -> None: ...
13251325
def __array_namespace__(self, /, *, api_version: _ArrayAPIVersion | None = None) -> ModuleType: ...
13261326

13271327
#
@@ -1350,7 +1350,7 @@ class _ArrayOrScalarCommon:
13501350
def max(
13511351
self,
13521352
/,
1353-
axis: _nt.ShapeLike | None = None,
1353+
axis: _nt.ToShape | None = None,
13541354
out: None = None,
13551355
*,
13561356
keepdims: py_bool | _NoValueType = ...,
@@ -1361,7 +1361,7 @@ class _ArrayOrScalarCommon:
13611361
def max(
13621362
self,
13631363
/,
1364-
axis: _nt.ShapeLike | None,
1364+
axis: _nt.ToShape | None,
13651365
out: _ArrayT,
13661366
*,
13671367
keepdims: py_bool | _NoValueType = ...,
@@ -1372,7 +1372,7 @@ class _ArrayOrScalarCommon:
13721372
def max(
13731373
self,
13741374
/,
1375-
axis: _nt.ShapeLike | None = None,
1375+
axis: _nt.ToShape | None = None,
13761376
*,
13771377
out: _ArrayT,
13781378
keepdims: py_bool | _NoValueType = ...,
@@ -1395,7 +1395,7 @@ class _ArrayOrScalarCommon:
13951395
def min(
13961396
self,
13971397
/,
1398-
axis: _nt.ShapeLike | None = None,
1398+
axis: _nt.ToShape | None = None,
13991399
out: None = None,
14001400
*,
14011401
keepdims: py_bool | _NoValueType = ...,
@@ -1406,7 +1406,7 @@ class _ArrayOrScalarCommon:
14061406
def min(
14071407
self,
14081408
/,
1409-
axis: _nt.ShapeLike | None,
1409+
axis: _nt.ToShape | None,
14101410
out: _ArrayT,
14111411
*,
14121412
keepdims: py_bool | _NoValueType = ...,
@@ -1417,7 +1417,7 @@ class _ArrayOrScalarCommon:
14171417
def min(
14181418
self,
14191419
/,
1420-
axis: _nt.ShapeLike | None = None,
1420+
axis: _nt.ToShape | None = None,
14211421
*,
14221422
out: _ArrayT,
14231423
keepdims: py_bool | _NoValueType = ...,
@@ -1491,7 +1491,7 @@ class _ArrayOrScalarCommon:
14911491
def sum(
14921492
self,
14931493
/,
1494-
axis: _nt.ShapeLike | None = None,
1494+
axis: _nt.ToShape | None = None,
14951495
dtype: DTypeLike | None = None,
14961496
out: None = None,
14971497
*,
@@ -1503,7 +1503,7 @@ class _ArrayOrScalarCommon:
15031503
def sum(
15041504
self,
15051505
/,
1506-
axis: _nt.ShapeLike | None,
1506+
axis: _nt.ToShape | None,
15071507
dtype: DTypeLike | None,
15081508
out: _ArrayT,
15091509
*,
@@ -1515,7 +1515,7 @@ class _ArrayOrScalarCommon:
15151515
def sum(
15161516
self,
15171517
/,
1518-
axis: _nt.ShapeLike | None = None,
1518+
axis: _nt.ToShape | None = None,
15191519
dtype: DTypeLike | None = None,
15201520
*,
15211521
out: _ArrayT,
@@ -1539,7 +1539,7 @@ class _ArrayOrScalarCommon:
15391539
def prod(
15401540
self,
15411541
/,
1542-
axis: _nt.ShapeLike | None = None,
1542+
axis: _nt.ToShape | None = None,
15431543
dtype: DTypeLike | None = None,
15441544
out: None = None,
15451545
*,
@@ -1551,7 +1551,7 @@ class _ArrayOrScalarCommon:
15511551
def prod(
15521552
self,
15531553
/,
1554-
axis: _nt.ShapeLike | None,
1554+
axis: _nt.ToShape | None,
15551555
dtype: DTypeLike | None,
15561556
out: _ArrayT,
15571557
*,
@@ -1563,7 +1563,7 @@ class _ArrayOrScalarCommon:
15631563
def prod(
15641564
self,
15651565
/,
1566-
axis: _nt.ShapeLike | None = None,
1566+
axis: _nt.ToShape | None = None,
15671567
dtype: DTypeLike | None = None,
15681568
*,
15691569
out: _ArrayT,
@@ -1576,7 +1576,7 @@ class _ArrayOrScalarCommon:
15761576
@overload
15771577
def mean(
15781578
self,
1579-
axis: _nt.ShapeLike | None = None,
1579+
axis: _nt.ToShape | None = None,
15801580
dtype: DTypeLike | None = None,
15811581
out: None = None,
15821582
*,
@@ -1587,7 +1587,7 @@ class _ArrayOrScalarCommon:
15871587
def mean(
15881588
self,
15891589
/,
1590-
axis: _nt.ShapeLike | None,
1590+
axis: _nt.ToShape | None,
15911591
dtype: DTypeLike | None,
15921592
out: _ArrayT,
15931593
*,
@@ -1598,7 +1598,7 @@ class _ArrayOrScalarCommon:
15981598
def mean(
15991599
self,
16001600
/,
1601-
axis: _nt.ShapeLike | None = None,
1601+
axis: _nt.ToShape | None = None,
16021602
dtype: DTypeLike | None = None,
16031603
*,
16041604
out: _ArrayT,
@@ -1610,7 +1610,7 @@ class _ArrayOrScalarCommon:
16101610
@overload
16111611
def std(
16121612
self,
1613-
axis: _nt.ShapeLike | None = None,
1613+
axis: _nt.ToShape | None = None,
16141614
dtype: DTypeLike | None = None,
16151615
out: None = None,
16161616
ddof: float = 0,
@@ -1623,7 +1623,7 @@ class _ArrayOrScalarCommon:
16231623
@overload
16241624
def std(
16251625
self,
1626-
axis: _nt.ShapeLike | None,
1626+
axis: _nt.ToShape | None,
16271627
dtype: DTypeLike | None,
16281628
out: _ArrayT,
16291629
ddof: float = 0,
@@ -1636,7 +1636,7 @@ class _ArrayOrScalarCommon:
16361636
@overload
16371637
def std(
16381638
self,
1639-
axis: _nt.ShapeLike | None = None,
1639+
axis: _nt.ToShape | None = None,
16401640
dtype: DTypeLike | None = None,
16411641
*,
16421642
out: _ArrayT,
@@ -1651,7 +1651,7 @@ class _ArrayOrScalarCommon:
16511651
@overload
16521652
def var(
16531653
self,
1654-
axis: _nt.ShapeLike | None = None,
1654+
axis: _nt.ToShape | None = None,
16551655
dtype: DTypeLike | None = None,
16561656
out: None = None,
16571657
ddof: float = 0,
@@ -1664,7 +1664,7 @@ class _ArrayOrScalarCommon:
16641664
@overload
16651665
def var(
16661666
self,
1667-
axis: _nt.ShapeLike | None,
1667+
axis: _nt.ToShape | None,
16681668
dtype: DTypeLike | None,
16691669
out: _ArrayT,
16701670
ddof: float = 0,
@@ -1677,7 +1677,7 @@ class _ArrayOrScalarCommon:
16771677
@overload
16781678
def var(
16791679
self,
1680-
axis: _nt.ShapeLike | None = None,
1680+
axis: _nt.ToShape | None = None,
16811681
dtype: DTypeLike | None = None,
16821682
*,
16831683
out: _ArrayT,
@@ -1750,11 +1750,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
17501750
#
17511751
def __new__(
17521752
cls,
1753-
shape: _nt.ShapeLike,
1753+
shape: _nt.ToShape,
17541754
dtype: DTypeLike | None = float, # noqa: PYI011
17551755
buffer: Buffer | None = None,
17561756
offset: CanIndex = 0,
1757-
strides: _nt.ShapeLike | None = None,
1757+
strides: _nt.ToShape | None = None,
17581758
order: _OrderKACF | None = None,
17591759
) -> Self: ...
17601760

@@ -2774,7 +2774,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
27742774

27752775
#
27762776
@overload
2777-
def transpose(self, axes: _nt.ShapeLike | None, /) -> Self: ...
2777+
def transpose(self, axes: _nt.ToShape | None, /) -> Self: ...
27782778
@overload
27792779
def transpose(self, /, *axes: CanIndex) -> Self: ...
27802780

0 commit comments

Comments
 (0)