8000 Leave out Mapping and Sequence for now · python/typeshed@b3bcce4 · GitHub
[go: up one dir, main page]

Skip to content

Commit b3bcce4

Browse files
author
Ivan Levkivskyi
committed
Leave out Mapping and Sequence for now
1 parent 3585916 commit b3bcce4

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

stdlib/2/typing.pyi

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ class Container(Protocol[_T_co]):
143143
@abstractmethod
144144
def __contains__(self, x: object) -> bool: ...
145145

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]):
148147
@overload
149148
@abstractmethod
150149
def __getitem__(self, i: int) -> _T_co: ...
@@ -158,8 +157,7 @@ class Sequence(Iterable[_T_co], Container[_T_co], Sized, Reversible[_T_co], Prot
158157
def __iter__(self) -> Iterator[_T_co]: ...
159158
def __reversed__(self) -> Iterator[_T_co]: ...
160159

161-
@runtime
162-
class MutableSequence(Sequence[_T], Protocol[_T]):
160+
class MutableSequence(Sequence[_T], Generic[_T]):
163161
@abstractmethod
164162
def insert(self, index: int, object: _T) -> None: ...
165163
@overload
@@ -233,8 +231,7 @@ class ContextManager(Protocol[_T_co]):
233231
exc_value: Optional[BaseException],
234232
traceback: Optional[TracebackType]) -> Optional[bool]: ...
235233

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]):
238235
# TODO: We wish the key type could also be covariant, but that doesn't work,
239236
# see discussion in https: //github.com/python/typing/pull/273.
240237
@abstractmethod
@@ -253,8 +250,7 @@ class Mapping(Iterable[_KT], Container[_KT], Sized, Protocol[_KT, _VT_co]):
253250
def iteritems(self) -> Iterator[Tuple[_KT, _VT_co]]: ...
254251
def __contains__(self, o: object) -> bool: ...
255252

256-
@runtime
257-
class MutableMapping(Mapping[_KT, _VT], Protocol[_KT, _VT]):
253+
class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):
258254
@abstractmethod
259255
def __setitem__(self, k: _KT, v: _VT) -> None: ...
260256
@abstractmethod

stdlib/3/typing.pyi

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ else:
226226
@runtime
227227
class _Collection(Sized, Iterable[_T_co], Container[_T_co], Protocol[_T_co]): ...
228228

229-
@runtime
230-
class Sequence(_Collection[_T_co], Reversible[_T_co], Protocol[_T_co]):
229+
class Sequence(_Collection[_T_co], Reversible[_T_co], Generic[_T_co]):
231230
@overload
232231
@abstractmethod
233232
def __getitem__(self, i: int) -> _T_co: ...
@@ -244,8 +243,7 @@ class Sequence(_Collection[_T_co], Reversible[_T_co], Protocol[_T_co]):
244243
def __iter__(self) -> Iterator[_T_co]: ...
245244
def __reversed__(self) -> Iterator[_T_co]: ...
246245

247-
@runtime
248-
class MutableSequence(Sequence[_T], Protocol[_T]):
246+
class MutableSequence(Sequence[_T], Generic[_T]):
249247
@abstractmethod
250248
def insert(self, index: int, object: _T) -> None: ...
251249
@overload
@@ -327,8 +325,7 @@ if sys.version_info >= (3, 5):
327325
exc_value: Optional[BaseException],
328326
traceback: Optional[TracebackType]) -> Awaitable[Optional[bool]]: ...
329327

330-
@runtime # type: ignore
331-
class Mapping(_Collection[_KT], Protocol[_KT, _VT_co]):
328+
class Mapping(_Collection[_KT], Generic[_KT, _VT_co]):
332329
# TODO: We wish the key type could also be covariant, but that doesn't work,
333330
# see discussion in https: //github.com/python/typing/pull/273.
334331
@abstractmethod
@@ -344,8 +341,7 @@ class Mapping(_Collection[_KT], Protocol[_KT, _VT_co]):
344341
def values(self) -> ValuesView[_VT_co]: ...
345342
def __contains__(self, o: object) -> bool: ...
346343

347-
@runtime
348-
class MutableMapping(Mapping[_KT, _VT], Protocol[_KT, _VT]):
344+
class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):
349345
@abstractmethod
350346
def __setitem__(self, k: _KT, v: _VT) -> None: ...
351347
@abstractmethod

0 commit comments

Comments
 (0)
0