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,
|
||||
Set,
|
||||
Sequence,
|
||||
SupportsIndex,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
@ -227,7 +228,15 @@ class SequenceProxy(Sequence[T_co]):
|
||||
def __repr__(self) -> str:
|
||||
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]
|
||||
|
||||
def __len__(self) -> int:
|
||||
|
Loading…
x
Reference in New Issue
Block a user