@@ -9,6 +9,7 @@ from _typeshed import (
99 ConvertibleToFloat ,
1010 ConvertibleToInt ,
1111 FileDescriptorOrPath ,
12+ MaybeNone ,
1213 OpenBinaryMode ,
1314 OpenBinaryModeReading ,
1415 OpenBinaryModeUpdating ,
@@ -93,6 +94,9 @@ _SupportsAnextT = TypeVar("_SupportsAnextT", bound=SupportsAnext[Any], covariant
9394_AwaitableT = TypeVar ("_AwaitableT" , bound = Awaitable [Any ])
9495_AwaitableT_co = TypeVar ("_AwaitableT_co" , bound = Awaitable [Any ], covariant = True )
9596_P = ParamSpec ("_P" )
97+ _StartT = TypeVar ("_StartT" , covariant = True , default = Any )
98+ _StopT = TypeVar ("_StopT" , covariant = True , default = Any )
99+ _StepT = TypeVar ("_StepT" , covariant = True , default = Any )
96100
97101class object :
98102 __doc__ : str | None
@@ -786,7 +790,7 @@ class memoryview(Sequence[_I]):
786790 @overload
787791 def __setitem__ (self , key : slice , value : ReadableBuffer , / ) -> None : ...
788792 @overload
789- def __setitem__ (self , key : SupportsIndex | tuple [SupportsIndex , ...], value : SupportsIndex , / ) -> None : ...
793+ def __setitem__ (self , key : SupportsIndex | tuple [SupportsIndex , ...], value : _I , / ) -> None : ...
790794 if sys .version_info >= (3 , 10 ):
791795 def tobytes (self , order : Literal ["C" , "F" , "A" ] | None = "C" ) -> bytes : ...
792796 else :
@@ -838,22 +842,31 @@ class bool(int):
838842 def __invert__ (self ) -> int : ...
839843
840844@final
841- class slice :
845+ class slice ( Generic [ _StartT , _StopT , _StepT ]) :
842846 @property
843- def start (self ) -> Any : ...
847+ def start (self ) -> _StartT : ...
844848 @property
845- def step (self ) -> Any : ...
849+ def step (self ) -> _StepT : ...
846850 @property
847- def stop (self ) -> Any : ...
851+ def stop (self ) -> _StopT : ...
848852 @overload
849- def __new__ (cls , stop : Any , / ) -> Self : ...
853+ def __new__ (cls , stop : int | None , / ) -> slice [ int | MaybeNone , int | MaybeNone , int | MaybeNone ] : ...
850854 @overload
851- def __new__ (cls , start : Any , stop : Any , step : Any = ..., / ) -> Self : ...
855+ def __new__ (
856+ cls , start : int | None , stop : int | None , step : int | None = None , /
857+ ) -> slice [int | MaybeNone , int | MaybeNone , int | MaybeNone ]: ...
858+ @overload
859+ def __new__ (cls , stop : _T2 , / ) -> slice [Any , _T2 , Any ]: ...
860+ @overload
861+ def __new__ (cls , start : _T1 , stop : _T2 , / ) -> slice [_T1 , _T2 , Any ]: ...
862+ @overload
863+ def __new__ (cls , start : _T1 , stop : _T2 , step : _T3 , / ) -> slice [_T1 , _T2 , _T3 ]: ...
852864 def __eq__ (self , value : object , / ) -> bool : ...
853865 if sys .version_info >= (3 , 12 ):
854866 def __hash__ (self ) -> int : ...
855867 else :
856868 __hash__ : ClassVar [None ] # type: ignore[assignment]
869+
857870 def indices (self , len : SupportsIndex , / ) -> tuple [int , int , int ]: ...
858871
859872class tuple (Sequence [_T_co ]):
@@ -1117,7 +1130,7 @@ class frozenset(AbstractSet[_T_co]):
11171130 if sys .version_info >= (3 , 9 ):
11181131 def __class_getitem__ (cls , item : Any , / ) -> GenericAlias : ...
11191132
1120- class enumerate (Iterator [ tuple [ int , _T ] ]):
1133+ class enumerate (Generic [ _T ]):
11211134 def __new__ (cls , iterable : Iterable [_T ], start : int = 0 ) -> Self : ...
11221135 def __iter__ (self ) -> Self : ...
11231136 def __next__ (self ) -> tuple [int , _T ]: ...
@@ -1311,7 +1324,7 @@ else:
13111324
13121325def exit (code : sys ._ExitCode = None ) -> NoReturn : ...
13131326
1314- class filter (Iterator [_T ]):
1327+ class filter (Generic [_T ]):
13151328 @overload
13161329 def __new__ (cls , function : None , iterable : Iterable [_T | None ], / ) -> Self : ...
13171330 @overload
@@ -1372,7 +1385,7 @@ def len(obj: Sized, /) -> int: ...
13721385def license () -> None : ...
13731386def locals () -> dict [str , Any ]: ...
13741387
1375- class map (Iterator [_S ]):
1388+ class map (Generic [_S ]):
13761389 @overload
13771390 def __new__ (cls , func : Callable [[_T1 ], _S ], iter1 : Iterable [_T1 ], / ) -> Self : ...
13781391 @overload
@@ -1614,7 +1627,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ...
16141627def pow (base : _SupportsSomeKindOfPow , exp : complex , mod : None = None ) -> complex : ...
16151628def quit (code : sys ._ExitCode = None ) -> NoReturn : ...
16161629
1617- class reversed (Iterator [_T ]):
1630+ class reversed (Generic [_T ]):
16181631 @overload
16191632 def __new__ (cls , sequence : Reversible [_T ], / ) -> Iterator [_T ]: ... # type: ignore[misc]
16201633 @overload
@@ -1675,7 +1688,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
16751688@overload
16761689def vars (object : Any = ..., / ) -> dict [str , Any ]: ...
16771690
1678- class zip (Iterator [_T_co ]):
1691+ class zip (Generic [_T_co ]):
16791692 if sys .version_info >= (3 , 10 ):
16801693 @overload
16811694 def __new__ (cls , * , strict : bool = ...) -> zip [Any ]: ...
0 commit comments