Skip to content

Commit

Permalink
ENH: Add annotations for generic.repeat and ndarray.repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas van Beek committed May 12, 2021
1 parent 9f86a84 commit 5f59e77
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions numpy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1563,12 +1563,6 @@ class _ArrayOrScalarCommon:
keepdims: bool = ...,
) -> _NdArraySubClass: ...

def repeat(
self,
repeats: _ArrayLikeInt_co,
axis: Optional[SupportsIndex] = ...,
) -> ndarray: ...

@overload
def round(
self: _ArraySelf,
Expand Down Expand Up @@ -1829,6 +1823,12 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
mode: _ModeKind = ...,
) -> _NdArraySubClass: ...

def repeat(
self,
repeats: _ArrayLikeInt_co,
axis: Optional[SupportsIndex] = ...,
) -> ndarray[Any, _DType_co]: ...

# Many of these special methods are irrelevant currently, since protocols
# aren't supported yet. That said, I'm adding them for completeness.
# https://docs.python.org/3/reference/datamodel.html
Expand Down Expand Up @@ -2821,6 +2821,12 @@ class generic(_ArrayOrScalarCommon):
mode: _ModeKind = ...,
) -> _NdArraySubClass: ...

def repeat(
self: _ScalarType,
repeats: _ArrayLikeInt_co,
axis: Optional[SupportsIndex] = ...,
) -> ndarray[Any, dtype[_ScalarType]]: ...

def squeeze(
self: _ScalarType, axis: Union[Literal[0], Tuple[()]] = ...
) -> _ScalarType: ...
Expand Down

0 comments on commit 5f59e77

Please sign in to comment.