8000 ENH: Add annotations for `generic.repeat` and `ndarray.repeat` · constanzafierro/numpy@5f59e77 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5f59e77

Browse files
author
Bas van Beek
committed
ENH: Add annotations for generic.repeat and ndarray.repeat
1 parent 9f86a84 commit 5f59e77

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

numpy/__init__.pyi

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,12 +1563,6 @@ class _ArrayOrScalarCommon:
15631563
keepdims: bool = ...,
15641564
) -> _NdArraySubClass: ...
15651565

1566-
def repeat(
1567-
self,
1568-
repeats: _ArrayLikeInt_co,
1569-
axis: Optional[SupportsIndex] = ...,
1570-
) -> ndarray: ...
1571-
15721566
@overload
15731567
def round(
15741568
self: _ArraySelf,
@@ -1829,6 +1823,12 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
18291823
mode: _ModeKind = ...,
18301824
) -> _NdArraySubClass: ...
18311825

1826+
def repeat(
1827+
self,
1828+
repeats: _ArrayLikeInt_co,
1829+
axis: Optional[SupportsIndex] = ...,
1830+
) -> ndarray[Any, _DType_co]: ...
1831+
18321832
# Many of these special methods are irrelevant currently, since protocols
18331833
# aren't supported yet. That said, I'm adding them for completeness.
18341834
# https://docs.python.org/3/reference/datamodel.html
@@ -2821,6 +2821,12 @@ class generic(_ArrayOrScalarCommon):
28212821
mode: _ModeKind = ...,
28222822
) -> _NdArraySubClass: ...
28232823

2824+
def repeat(
2825+
self: _ScalarType,
2826+
repeats: _ArrayLikeInt_co,
2827+
axis: Optional[SupportsIndex] = ...,
2828+
) -> ndarray[Any, dtype[_ScalarType]]: ...
2829+
28242830
def squeeze(
28252831
self: _ScalarType, axis: Union[Literal[0], Tuple[()]] = ...
28262832
) -> _ScalarType: ...

0 commit comments

Comments
 (0)
0