Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
Make NestedList admit sequences.
Browse files Browse the repository at this point in the history
numpy will actually accept not just lists, but also tuples as array-like.
  • Loading branch information
rpgoldman committed Mar 13, 2020
1 parent 3e37ef2 commit 378db00
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion numpy-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ _FloatObj = TypeVar("_FloatObj", bound=Union[floating, float])
_Int = TypeVar("_Int", bool_, int8, int16, int32, int64)
_IntObj = TypeVar("_IntObj", bound=Union[integer, int])

_NestedList = Union[List[_T], List[List[_T]], List[List[List[_T]]], List[List[List[List[_T]]]]]
_NLT = TypeVar("_NLT", covariant=True)
_NestedList = Union[
Sequence[_NLT],
Sequence[Sequence[_NLT]],
Sequence[Sequence[Sequence[_NLT]]],
Sequence[Sequence[Sequence[Sequence[_NLT]]]],
]

class ndarray(Generic[_DType]):
"""
Expand Down

0 comments on commit 378db00

Please sign in to comment.