diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2021-02-16 14:51:49 +0100 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2021-02-25 14:06:37 +0100 |
commit | f345d732a97b647de1fb26aeae533ca48e8229e9 (patch) | |
tree | 8fa40fd5427def493badf6495789b4b671db2d6b /numpy/lib/index_tricks.pyi | |
parent | 8a18515f6b5eb97a184b92858741eb4a5aab613a (diff) | |
download | numpy-f345d732a97b647de1fb26aeae533ca48e8229e9.tar.gz |
MAINT: Relax the type-constraints of `IndexExpression.__getitem__`
Diffstat (limited to 'numpy/lib/index_tricks.pyi')
-rw-r--r-- | numpy/lib/index_tricks.pyi | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/lib/index_tricks.pyi b/numpy/lib/index_tricks.pyi index e602f9907..3e5bc1adb 100644 --- a/numpy/lib/index_tricks.pyi +++ b/numpy/lib/index_tricks.pyi @@ -52,7 +52,7 @@ else: _T = TypeVar("_T") _DType = TypeVar("_DType", bound=dtype[Any]) _BoolType = TypeVar("_BoolType", Literal[True], Literal[False]) -_SliceOrTuple = TypeVar("_SliceOrTuple", bound=Union[slice, Tuple[slice, ...]]) +_TupType = TypeVar("_TupType", bound=Tuple[Any, ...]) _ArrayType = TypeVar("_ArrayType", bound=ndarray[Any, Any]) __all__: List[str] @@ -163,11 +163,11 @@ class IndexExpression(Generic[_BoolType]): maketuple: _BoolType def __init__(self, maketuple: _BoolType) -> None: ... @overload - def __getitem__( # type: ignore[misc] - self: IndexExpression[Literal[True]], item: slice - ) -> Tuple[slice]: ... + def __getitem__(self, item: _TupType) -> _TupType: ... # type: ignore[misc] @overload - def __getitem__(self, item: _SliceOrTuple) -> _SliceOrTuple: ... + def __getitem__(self: IndexExpression[Literal[True]], item: _T) -> Tuple[_T]: ... + @overload + def __getitem__(self: IndexExpression[Literal[False]], item: _T) -> _T: ... index_exp: IndexExpression[Literal[True]] s_: IndexExpression[Literal[False]] |