@@ -143,8 +143,7 @@ class Container(Protocol[_T_co]):
143
143
@abstractmethod
144
144
def __contains__ (self , x : object ) -> bool : ...
145
145
146
- @runtime
147
- class Sequence (Iterable [_T_co ], Container [_T_co ], Sized , Reversible [_T_co ], Protocol [_T_co ]):
146
+ class Sequence (Iterable [_T_co ], Container [_T_co ], Sized , Reversible [_T_co ], Generic [_T_co ]):
148
147
@overload
149
148
@abstractmethod
150
149
def __getitem__ (self , i : int ) -> _T_co : ...
@@ -158,8 +157,7 @@ class Sequence(Iterable[_T_co], Container[_T_co], Sized, Reversible[_T_co], Prot
158
157
def __iter__ (self ) -> Iterator [_T_co ]: ...
159
158
def __reversed__ (self ) -> Iterator [_T_co ]: ...
160
159
161
- @runtime
162
- class MutableSequence (Sequence [_T ], Protocol [_T ]):
160
+ class MutableSequence (Sequence [_T ], Generic [_T ]):
163
161
@abstractmethod
164
162
def insert (self , index : int , object : _T ) -> None : ...
165
163
@overload
@@ -233,8 +231,7 @@ class ContextManager(Protocol[_T_co]):
233
231
exc_value : Optional [BaseException ],
234
232
traceback : Optional [TracebackType ]) -> Optional [bool ]: ...
235
233
236
- @runtime # type: ignore
237
- class Mapping (Iterable [_KT ], Container [_KT ], Sized , Protocol [_KT , _VT_co ]):
234
+ class Mapping (Iterable [_KT ], Container [_KT ], Sized , Generic [_KT , _VT_co ]):
238
235
# TODO: We wish the key type could also be covariant, but that doesn't work,
239
236
# see discussion in https: //github.com/python/typing/pull/273.
240
237
@abstractmethod
@@ -253,8 +250,7 @@ class Mapping(Iterable[_KT], Container[_KT], Sized, Protocol[_KT, _VT_co]):
253
250
def iteritems (self ) -> Iterator [Tuple [_KT , _VT_co ]]: ...
254
251
def __contains__ (self , o : object ) -> bool : ...
255
252
256
- @runtime
257
- class MutableMapping (Mapping [_KT , _VT ], Protocol [_KT , _VT ]):
253
+ class MutableMapping (Mapping [_KT , _VT ], Generic [_KT , _VT ]):
258
254
@abstractmethod
259
255
def __setitem__ (self , k : _KT , v : _VT ) -> None : ...
260
256
@abstractmethod
0 commit comments