mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-25 04:16:44 +08:00
Add @final to many unsubclassable stdlib classes (#6299)
This commit is contained in:
@@ -11,6 +11,7 @@ from typing import (
|
||||
TypeVar,
|
||||
overload,
|
||||
)
|
||||
from typing_extensions import final
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
@@ -115,7 +116,7 @@ def __setitem__(a: MutableSequence[_T], b: slice, c: Sequence[_T]) -> None: ...
|
||||
@overload
|
||||
def __setitem__(a: MutableMapping[_K, _V], b: _K, c: _V) -> None: ...
|
||||
def length_hint(__obj: Any, __default: int = ...) -> int: ...
|
||||
|
||||
@final
|
||||
class attrgetter(Generic[_T_co]):
|
||||
@overload
|
||||
def __new__(cls, attr: str) -> attrgetter[Any]: ...
|
||||
@@ -129,6 +130,7 @@ class attrgetter(Generic[_T_co]):
|
||||
def __new__(cls, attr: str, *attrs: str) -> attrgetter[Tuple[Any, ...]]: ...
|
||||
def __call__(self, obj: Any) -> _T_co: ...
|
||||
|
||||
@final
|
||||
class itemgetter(Generic[_T_co]):
|
||||
@overload
|
||||
def __new__(cls, item: Any) -> itemgetter[Any]: ...
|
||||
@@ -142,6 +144,7 @@ class itemgetter(Generic[_T_co]):
|
||||
def __new__(cls, item: Any, *items: Any) -> itemgetter[Tuple[Any, ...]]: ...
|
||||
def __call__(self, obj: Any) -> _T_co: ...
|
||||
|
||||
@final
|
||||
class methodcaller:
|
||||
def __init__(self, __name: str, *args: Any, **kwargs: Any) -> None: ...
|
||||
def __call__(self, obj: Any) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user