mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Annotate UserList.sort() .index() arguments (#6472)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from _collections_abc import dict_items, dict_keys, dict_values
|
||||
from _typeshed import Self
|
||||
from _typeshed import Self, SupportsLessThan, SupportsLessThanT
|
||||
from typing import Any, Dict, Generic, NoReturn, Tuple, Type, TypeVar, overload
|
||||
from typing_extensions import SupportsIndex, final
|
||||
|
||||
@@ -77,9 +77,12 @@ class UserList(MutableSequence[_T]):
|
||||
def clear(self) -> None: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
def count(self, item: _T) -> int: ...
|
||||
def index(self, item: _T, *args: Any) -> int: ...
|
||||
def index(self, item: _T, __start: SupportsIndex = ..., __stop: SupportsIndex = ...) -> int: ...
|
||||
def reverse(self) -> None: ...
|
||||
def sort(self, *args: Any, **kwds: Any) -> None: ...
|
||||
@overload
|
||||
def sort(self: UserList[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> None: ...
|
||||
@overload
|
||||
def sort(self, *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> None: ...
|
||||
def extend(self, other: Iterable[_T]) -> None: ...
|
||||
|
||||
_UserStringT = TypeVar("_UserStringT", bound=UserString)
|
||||
|
||||
@@ -50,6 +50,7 @@ codecs.CodecInfo.streamreader
|
||||
codecs.CodecInfo.streamwriter
|
||||
collections.ChainMap.get # Adding None to the underlying Mapping Union messed up mypy
|
||||
collections.ChainMap.fromkeys # Runtime has *args which can really only be one argument
|
||||
collections.UserList.sort # Runtime has *args but will error if any are supplied
|
||||
# Coroutine and Generator properties are added programmatically
|
||||
collections.abc.Coroutine.cr_await
|
||||
collections.abc.Coroutine.cr_code
|
||||
|
||||
Reference in New Issue
Block a user