Skip to content

Commit b3f29b6

Browse files
authored
Remove unnecessary _Collection alias (#6188)
This was a remnant of Python 3.5 compatibility, where Collection did not exists and _Collection was aliased to a dummy class.
1 parent 4e592ad commit b3f29b6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

stdlib/typing.pyi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]):
304304
@abstractmethod
305305
def __len__(self) -> int: ...
306306

307-
_Collection = Collection[_T_co]
308-
309-
class Sequence(_Collection[_T_co], Reversible[_T_co], Generic[_T_co]):
307+
class Sequence(Collection[_T_co], Reversible[_T_co], Generic[_T_co]):
310308
@overload
311309
@abstractmethod
312310
def __getitem__(self, i: int) -> _T_co: ...
@@ -350,7 +348,7 @@ class MutableSequence(Sequence[_T], Generic[_T]):
350348
def remove(self, value: _T) -> None: ...
351349
def __iadd__(self, x: Iterable[_T]) -> MutableSequence[_T]: ...
352350

353-
class AbstractSet(_Collection[_T_co], Generic[_T_co]):
351+
class AbstractSet(Collection[_T_co], Generic[_T_co]):
354352
@abstractmethod
355353
def __contains__(self, x: object) -> bool: ...
356354
# Mixin methods
@@ -433,7 +431,7 @@ class AsyncContextManager(Protocol[_T_co]):
433431
self, __exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None
434432
) -> Awaitable[bool | None]: ...
435433

436-
class Mapping(_Collection[_KT], Generic[_KT, _VT_co]):
434+
class Mapping(Collection[_KT], Generic[_KT, _VT_co]):
437435
# TODO: We wish the key type could also be covariant, but that doesn't work,
438436
# see discussion in https://github.com/python/typing/pull/273.
439437
@abstractmethod

0 commit comments

Comments
 (0)