mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 12:18:59 +00:00
Type hint support for slices and __index__ in SequenceProxy
This commit is contained in:
parent
c6decedf7b
commit
d2c6a32543
@ -46,6 +46,7 @@ from typing import (
|
|||||||
Protocol,
|
Protocol,
|
||||||
Set,
|
Set,
|
||||||
Sequence,
|
Sequence,
|
||||||
|
SupportsIndex,
|
||||||
Tuple,
|
Tuple,
|
||||||
Type,
|
Type,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
@ -227,7 +228,15 @@ class SequenceProxy(Sequence[T_co]):
|
|||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f"SequenceProxy({self.__proxied!r})"
|
return f"SequenceProxy({self.__proxied!r})"
|
||||||
|
|
||||||
def __getitem__(self, idx: int) -> T_co:
|
@overload
|
||||||
|
def __getitem__(self, idx: SupportsIndex) -> T_co:
|
||||||
|
...
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def __getitem__(self, idx: slice) -> List[T_co]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def __getitem__(self, idx: Union[SupportsIndex, slice]) -> Union[T_co, List[T_co]]:
|
||||||
return self.__copied[idx]
|
return self.__copied[idx]
|
||||||
|
|
||||||
def __len__(self) -> int:
|
def __len__(self) -> int:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user