mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-30 16:14:24 +08:00
Add SupportsIndex to list indexing. (#4804)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
from _typeshed import SupportsWrite
|
||||
from typing import (
|
||||
IO,
|
||||
@@ -21,6 +22,11 @@ from typing import (
|
||||
overload,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import SupportsIndex
|
||||
else:
|
||||
from typing_extensions import SupportsIndex
|
||||
|
||||
_K = TypeVar("_K")
|
||||
_V = TypeVar("_V")
|
||||
_R = TypeVar("_R")
|
||||
@@ -264,7 +270,7 @@ class Accept(ImmutableList[Tuple[str, float]]):
|
||||
provided: bool
|
||||
def __init__(self, values: Union[None, Accept, Iterable[Tuple[str, float]]] = ...) -> None: ...
|
||||
@overload
|
||||
def __getitem__(self, key: int) -> Tuple[str, float]: ...
|
||||
def __getitem__(self, key: SupportsIndex) -> Tuple[str, float]: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> List[Tuple[str, float]]: ...
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user