From 9ef2937b6d2a8814fdde3700299913957f087c17 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Fri, 23 Sep 2022 01:22:55 -0700 Subject: [PATCH 1/3] Fix intransitive subtyping issue with SupportsGetItem See https://github.com/python/mypy/issues/13713 for details --- stdlib/_typeshed/__init__.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/_typeshed/__init__.pyi b/stdlib/_typeshed/__init__.pyi index c50fe4861db7..ba40fd9961cd 100644 --- a/stdlib/_typeshed/__init__.pyi +++ b/stdlib/_typeshed/__init__.pyi @@ -118,7 +118,8 @@ class SupportsKeysAndGetItem(Protocol[_KT, _VT_co]): def __getitem__(self, __key: _KT) -> _VT_co: ... # stable -class SupportsGetItem(Container[_KT_contra], Protocol[_KT_contra, _VT_co]): +class SupportsGetItem(Protocol[_KT_contra, _VT_co]): + def __contains__(self, __x: object) -> bool: ... def __getitem__(self, __key: _KT_contra) -> _VT_co: ... # stable From 1accc4fb88ef04989003d75e60942da1a0faef3e Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Fri, 23 Sep 2022 11:36:46 -0700 Subject: [PATCH 2/3] lint --- stdlib/_typeshed/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/_typeshed/__init__.pyi b/stdlib/_typeshed/__init__.pyi index ba40fd9961cd..b0ee1f4ad48a 100644 --- a/stdlib/_typeshed/__init__.pyi +++ b/stdlib/_typeshed/__init__.pyi @@ -7,7 +7,7 @@ import ctypes import mmap import pickle import sys -from collections.abc import Awaitable, Callable, Container, Iterable, Set as AbstractSet +from collections.abc import Awaitable, Callable, Iterable, Set as AbstractSet from os import PathLike from types import FrameType, TracebackType from typing import Any, AnyStr, Generic, Protocol, TypeVar, Union From 5ea9339eaf6cd12b5c52893d2df2effba037480e Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Fri, 23 Sep 2022 12:07:44 -0700 Subject: [PATCH 3/3] add comment --- stdlib/typing.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 81ba341044d5..954f47d14502 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -447,6 +447,7 @@ class AsyncGenerator(AsyncIterator[_T_co], Generic[_T_co, _T_contra]): @runtime_checkable class Container(Protocol[_T_co]): + # This is generic more on vibes than anything else @abstractmethod def __contains__(self, __x: object) -> bool: ...