1
1
import collections # Needed by aliases like DefaultDict, see mypy issue 2986
2
2
import sys
3
- from _typeshed import Self , SupportsKeysAndGetItem
3
+ from _typeshed import Self as TypeshedSelf , SupportsKeysAndGetItem
4
4
from abc import ABCMeta , abstractmethod
5
5
from types import BuiltinFunctionType , CodeType , FrameType , FunctionType , MethodType , ModuleType , TracebackType
6
6
from typing_extensions import Literal as _Literal , ParamSpec as _ParamSpec , final as _final
@@ -372,7 +372,7 @@ class MutableSequence(Sequence[_T], Generic[_T]):
372
372
def reverse (self ) -> None : ...
373
373
def pop (self , index : int = ...) -> _T : ...
374
374
def remove (self , value : _T ) -> None : ...
375
- def __iadd__ (self : Self , x : Iterable [_T ]) -> Self : ...
375
+ def __iadd__ (self : TypeshedSelf , x : Iterable [_T ]) -> TypeshedSelf : ...
376
376
377
377
class AbstractSet (Collection [_T_co ], Generic [_T_co ]):
378
378
@abstractmethod
@@ -398,10 +398,10 @@ class MutableSet(AbstractSet[_T], Generic[_T]):
398
398
def clear (self ) -> None : ...
399
399
def pop (self ) -> _T : ...
400
400
def remove (self , value : _T ) -> None : ...
401
- def __ior__ (self : Self , s : AbstractSet [_T ]) -> Self : ... # type: ignore[override,misc]
402
- def __iand__ (self : Self , s : AbstractSet [Any ]) -> Self : ...
403
- def __ixor__ (self : Self , s : AbstractSet [_T ]) -> Self : ... # type: ignore[override,misc]
404
- def __isub__ (self : Self , s : AbstractSet [Any ]) -> Self : ...
401
+ def __ior__ (self : TypeshedSelf , s : AbstractSet [_T ]) -> TypeshedSelf : ... # type: ignore[override,misc]
402
+ def __iand__ (self : TypeshedSelf , s : AbstractSet [Any ]) -> TypeshedSelf : ...
403
+ def __ixor__ (self : TypeshedSelf , s : AbstractSet [_T ]) -> TypeshedSelf : ... # type: ignore[override,misc]
404
+ def __isub__ (self : TypeshedSelf , s : AbstractSet [Any ]) -> TypeshedSelf : ...
405
405
406
406
class MappingView (Sized ):
407
407
def __init__ (self , mapping : Mapping [Any , Any ]) -> None : ... # undocumented
@@ -733,11 +733,11 @@ class NamedTuple(tuple[Any, ...]):
733
733
else :
734
734
def _asdict (self ) -> collections .OrderedDict [str , Any ]: ...
735
735
736
- def _replace (self : Self , ** kwargs : Any ) -> Self : ...
736
+ def _replace (self : TypeshedSelf , ** kwargs : Any ) -> TypeshedSelf : ...
737
737
738
738
# Internal mypy fallback type for all typed dicts (does not exist at runtime)
739
739
class _TypedDict (Mapping [str , object ], metaclass = ABCMeta ):
740
- def copy (self : Self ) -> Self : ...
740
+ def copy (self : TypeshedSelf ) -> TypeshedSelf : ...
741
741
# Using NoReturn so that only calls using mypy plugin hook that specialize the signature
742
742
# can go through.
743
743
def setdefault (self , k : NoReturn , default : object ) -> object : ...
@@ -748,8 +748,8 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
748
748
def items (self ) -> ItemsView [str , object ]: ...
749
749
def keys (self ) -> KeysView [str ]: ...
750
750
def values (self ) -> ValuesView [object ]: ...
751
- def __or__ (self : Self , __value : Self ) -> Self : ...
752
- def __ior__ (self : Self , __value : Self ) -> Self : ...
751
+ def __or__ (self : TypeshedSelf , __value : TypeshedSelf ) -> TypeshedSelf : ...
752
+ def __ior__ (self : TypeshedSelf , __value : TypeshedSelf ) -> TypeshedSelf : ...
753
753
754
754
# This itself is only available during type checking
755
755
def type_check_only (func_or_cls : _F ) -> _F : ...
0 commit comments