From 5db8e8b989d6d201c4ac164ca45ebe9ce277d998 Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Fri, 15 May 2020 22:04:02 -0400 Subject: [PATCH 01/18] Add _collections_abc module --- stdlib/3/_collections_abc.pyi | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 stdlib/3/_collections_abc.pyi diff --git a/stdlib/3/_collections_abc.pyi b/stdlib/3/_collections_abc.pyi new file mode 100644 index 000000000000..668b8426c7e0 --- /dev/null +++ b/stdlib/3/_collections_abc.pyi @@ -0,0 +1,2 @@ + +from collections.abc import * From c759b7c6deef3b55aa6018a37c3315e32e7e1b1a Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Fri, 15 May 2020 22:53:46 -0400 Subject: [PATCH 02/18] Rearrange collections.abc and collections to re-export from _collections_abc --- stdlib/3/_collections_abc.pyi | 37 +++++++++++++++++++++++- stdlib/3/collections/__init__.pyi | 8 ++--- stdlib/3/collections/abc.pyi | 37 ++---------------------- tests/stubtest_whitelists/py3_common.txt | 22 ++++++++++++++ 4 files changed, 64 insertions(+), 40 deletions(-) diff --git a/stdlib/3/_collections_abc.pyi b/stdlib/3/_collections_abc.pyi index 668b8426c7e0..f6bf1782a195 100644 --- a/stdlib/3/_collections_abc.pyi +++ b/stdlib/3/_collections_abc.pyi @@ -1,2 +1,37 @@ -from collections.abc import * +from typing import List +import sys + +__all__: List[str] + +from typing import ( + AsyncIterable as AsyncIterable, + AsyncIterator as AsyncIterator, + Awaitable as Awaitable, + ByteString as ByteString, + Container as Container, + Coroutine as Coroutine, + Generator as Generator, + Hashable as Hashable, + Iterable as Iterable, + Iterator as Iterator, + Sized as Sized, + Callable as Callable, + Mapping as Mapping, + MutableMapping as MutableMapping, + Sequence as Sequence, + MutableSequence as MutableSequence, + Set as Set, + MutableSet as MutableSet, + MappingView as MappingView, + ItemsView as ItemsView, + KeysView as KeysView, + ValuesView as ValuesView, +) + +if sys.version_info >= (3, 6): + from typing import ( + Collection as Collection, + Reversible as Reversible, + AsyncGenerator as AsyncGenerator, + ) diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index 0771620daad0..9d837eebd397 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -8,7 +8,7 @@ from typing import ( # These are exported. from . import abc -from typing import ( +from _collections_abc import ( AsyncIterable as AsyncIterable, AsyncIterator as AsyncIterator, Awaitable as Awaitable, @@ -21,7 +21,6 @@ from typing import ( Sized as Sized, Generator as Generator, ByteString as ByteString, - Reversible as Reversible, Mapping as Mapping, MappingView as MappingView, ItemsView as ItemsView, @@ -31,11 +30,12 @@ from typing import ( Sequence as Sequence, MutableSequence as MutableSequence, MutableSet as MutableSet, - AbstractSet as Set, + Set as Set, ) if sys.version_info >= (3, 6): - from typing import ( + from _collections_abc import ( Collection as Collection, + Reversible as Reversible, AsyncGenerator as AsyncGenerator, ) diff --git a/stdlib/3/collections/abc.pyi b/stdlib/3/collections/abc.pyi index 11718438832b..84b2ca18a66e 100644 --- a/stdlib/3/collections/abc.pyi +++ b/stdlib/3/collections/abc.pyi @@ -1,36 +1,3 @@ -# Stubs for collections.abc (introduced from Python 3.3) -# -# https://docs.python.org/3.3/whatsnew/3.3.html#collections -import sys -from . import ( - AsyncIterable as AsyncIterable, - AsyncIterator as AsyncIterator, - Awaitable as Awaitable, - ByteString as ByteString, - Container as Container, - Coroutine as Coroutine, - Generator as Generator, - Hashable as Hashable, - Iterable as Iterable, - Iterator as Iterator, - Sized as Sized, - Callable as Callable, - Mapping as Mapping, - MutableMapping as MutableMapping, - Sequence as Sequence, - MutableSequence as MutableSequence, - Set as Set, - MutableSet as MutableSet, - MappingView as MappingView, - ItemsView as ItemsView, - KeysView as KeysView, - ValuesView as ValuesView, -) - -if sys.version_info >= (3, 6): - from . import ( - Collection as Collection, - Reversible as Reversible, - AsyncGenerator as AsyncGenerator, - ) +from _collections_abc import * +from _collections_abc import __all__ as __all__ diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index 10365662cc9e..fe58cd71ff4f 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -1,3 +1,25 @@ +_collections_abc.Callable +_collections_abc.Coroutine.cr_await +_collections_abc.Coroutine.cr_code +_collections_abc.Coroutine.cr_frame +_collections_abc.Coroutine.cr_running +_collections_abc.Generator.gi_code +_collections_abc.Generator.gi_frame +_collections_abc.Generator.gi_running +_collections_abc.Generator.gi_yieldfrom +_collections_abc.Mapping.get +_collections_abc.MutableMapping.pop +_collections_abc.MutableMapping.setdefault +_collections_abc.MutableSequence.append +_collections_abc.MutableSequence.extend +_collections_abc.MutableSequence.insert +_collections_abc.MutableSequence.remove +_collections_abc.MutableSet.add +_collections_abc.MutableSet.discard +_collections_abc.MutableSet.remove +_collections_abc.Sequence.count +_collections_abc.Sequence.index +_collections_abc.Set.isdisjoint _csv.Dialect.__init__ _dummy_threading _importlib_modulespec From ce3fc756b08d91e8ae9d12a9031a43a11a339efb Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Fri, 15 May 2020 22:59:15 -0400 Subject: [PATCH 03/18] Expand stubtest whitelists --- tests/stubtest_whitelists/py36.txt | 4 ++++ tests/stubtest_whitelists/py37.txt | 4 ++++ tests/stubtest_whitelists/py38.txt | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/tests/stubtest_whitelists/py36.txt b/tests/stubtest_whitelists/py36.txt index 2b2f8f5e9040..c27cbe6d7b14 100644 --- a/tests/stubtest_whitelists/py36.txt +++ b/tests/stubtest_whitelists/py36.txt @@ -1,3 +1,7 @@ +_collections_abc.AsyncGenerator.ag_await +_collections_abc.AsyncGenerator.ag_code +_collections_abc.AsyncGenerator.ag_frame +_collections_abc.AsyncGenerator.ag_running asyncio.Future.__init__ asyncio.exceptions asyncio.futures.Future.__init__ diff --git a/tests/stubtest_whitelists/py37.txt b/tests/stubtest_whitelists/py37.txt index 3da982868a7b..1498b0be1f6b 100644 --- a/tests/stubtest_whitelists/py37.txt +++ b/tests/stubtest_whitelists/py37.txt @@ -1,5 +1,9 @@ _bisect.bisect _bisect.insort +_collections_abc.AsyncGenerator.ag_await +_collections_abc.AsyncGenerator.ag_code +_collections_abc.AsyncGenerator.ag_frame +_collections_abc.AsyncGenerator.ag_running _tracemalloc._get_object_traceback _tracemalloc.start asyncio.AbstractEventLoop.sock_sendfile diff --git a/tests/stubtest_whitelists/py38.txt b/tests/stubtest_whitelists/py38.txt index 7dd11a8e50cb..2b30cf56e9d2 100644 --- a/tests/stubtest_whitelists/py38.txt +++ b/tests/stubtest_whitelists/py38.txt @@ -1,5 +1,13 @@ _bisect.bisect _bisect.insort +_collections_abc.AsyncGenerator.ag_await +_collections_abc.AsyncGenerator.ag_code +_collections_abc.AsyncGenerator.ag_frame +_collections_abc.AsyncGenerator.ag_running +_collections_abc.Container.__contains__ +_collections_abc.ItemsView.__reversed__ +_collections_abc.KeysView.__reversed__ +_collections_abc.ValuesView.__reversed__ _thread.ExceptHookArgs _thread._ExceptHookArgs _tracemalloc._get_object_traceback From 96c99dfa48af18690dabcd865330bc7b6c88a2dd Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Fri, 15 May 2020 23:00:06 -0400 Subject: [PATCH 04/18] Fix __all__ location --- stdlib/3/_collections_abc.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3/_collections_abc.pyi b/stdlib/3/_collections_abc.pyi index f6bf1782a195..0c4e20e21560 100644 --- a/stdlib/3/_collections_abc.pyi +++ b/stdlib/3/_collections_abc.pyi @@ -2,8 +2,6 @@ from typing import List import sys -__all__: List[str] - from typing import ( AsyncIterable as AsyncIterable, AsyncIterator as AsyncIterator, @@ -35,3 +33,5 @@ if sys.version_info >= (3, 6): Reversible as Reversible, AsyncGenerator as AsyncGenerator, ) + +__all__: List[str] From d2b048e748d10fb6df041c085606556bb910990f Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Fri, 15 May 2020 23:04:49 -0400 Subject: [PATCH 05/18] Remove collections.abc methods, stubtest no longer tests them --- tests/stubtest_whitelists/py36.txt | 4 ---- tests/stubtest_whitelists/py37.txt | 4 ---- tests/stubtest_whitelists/py38.txt | 8 -------- tests/stubtest_whitelists/py3_common.txt | 23 ----------------------- 4 files changed, 39 deletions(-) diff --git a/tests/stubtest_whitelists/py36.txt b/tests/stubtest_whitelists/py36.txt index c27cbe6d7b14..c07c97e7c4dc 100644 --- a/tests/stubtest_whitelists/py36.txt +++ b/tests/stubtest_whitelists/py36.txt @@ -17,10 +17,6 @@ collections.AsyncGenerator.ag_code collections.AsyncGenerator.ag_frame collections.AsyncGenerator.ag_running collections.UserString.maketrans -collections.abc.AsyncGenerator.ag_await -collections.abc.AsyncGenerator.ag_code -collections.abc.AsyncGenerator.ag_frame -collections.abc.AsyncGenerator.ag_running copy.PyStringMap ctypes.CDLL.__init__ email.message.MIMEPart.as_string diff --git a/tests/stubtest_whitelists/py37.txt b/tests/stubtest_whitelists/py37.txt index 1498b0be1f6b..90339859392f 100644 --- a/tests/stubtest_whitelists/py37.txt +++ b/tests/stubtest_whitelists/py37.txt @@ -26,10 +26,6 @@ collections.AsyncGenerator.ag_code collections.AsyncGenerator.ag_frame collections.AsyncGenerator.ag_running collections.UserString.maketrans -collections.abc.AsyncGenerator.ag_await -collections.abc.AsyncGenerator.ag_code -collections.abc.AsyncGenerator.ag_frame -collections.abc.AsyncGenerator.ag_running concurrent.futures.BrokenThreadPool contextvars.Context.__init__ contextvars.Context.get diff --git a/tests/stubtest_whitelists/py38.txt b/tests/stubtest_whitelists/py38.txt index 2b30cf56e9d2..8e3561cdf63e 100644 --- a/tests/stubtest_whitelists/py38.txt +++ b/tests/stubtest_whitelists/py38.txt @@ -49,14 +49,6 @@ collections.KeysView.__reversed__ collections.OrderedDict.fromkeys collections.OrderedDict.setdefault collections.ValuesView.__reversed__ -collections.abc.AsyncGenerator.ag_await -collections.abc.AsyncGenerator.ag_code -collections.abc.AsyncGenerator.ag_frame -collections.abc.AsyncGenerator.ag_running -collections.abc.Container.__contains__ -collections.abc.ItemsView.__reversed__ -collections.abc.KeysView.__reversed__ -collections.abc.ValuesView.__reversed__ concurrent.futures.BrokenThreadPool concurrent.futures.Executor.submit concurrent.futures.ProcessPoolExecutor.submit diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index fe58cd71ff4f..7ca51bf56aaf 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -130,29 +130,6 @@ collections.MutableSet.discard collections.MutableSet.remove collections.Sequence.count collections.Sequence.index -collections.Set.isdisjoint -collections.abc.Callable -collections.abc.Coroutine.cr_await -collections.abc.Coroutine.cr_code -collections.abc.Coroutine.cr_frame -collections.abc.Coroutine.cr_running -collections.abc.Generator.gi_code -collections.abc.Generator.gi_frame -collections.abc.Generator.gi_running -collections.abc.Generator.gi_yieldfrom -collections.abc.Mapping.get -collections.abc.MutableMapping.pop -collections.abc.MutableMapping.setdefault -collections.abc.MutableSequence.append -collections.abc.MutableSequence.extend -collections.abc.MutableSequence.insert -collections.abc.MutableSequence.remove -collections.abc.MutableSet.add -collections.abc.MutableSet.discard -collections.abc.MutableSet.remove -collections.abc.Sequence.count -collections.abc.Sequence.index -collections.abc.Set.isdisjoint collections.deque.__hash__ concurrent.futures.BrokenProcessPool concurrent.futures.CANCELLED From 01cec54e412ec361b859c8bdbdca57640a08a325 Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Fri, 15 May 2020 23:08:33 -0400 Subject: [PATCH 06/18] Remove final remaining unused whitelists --- tests/stubtest_whitelists/py35.txt | 1 - tests/stubtest_whitelists/py3_common.txt | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/stubtest_whitelists/py35.txt b/tests/stubtest_whitelists/py35.txt index 0d7e78ee95e9..6e244ad52ebb 100644 --- a/tests/stubtest_whitelists/py35.txt +++ b/tests/stubtest_whitelists/py35.txt @@ -19,7 +19,6 @@ bdb.GENERATOR_AND_COROUTINE_FLAGS builtins.str.maketrans cmath.log codecs.StreamRecoder.seek -collections.Reversible collections.UserString.maketrans ctypes.CDLL.__init__ decimal.Decimal.as_integer_ratio diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index 7ca51bf56aaf..16c4da4d0320 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -19,7 +19,6 @@ _collections_abc.MutableSet.discard _collections_abc.MutableSet.remove _collections_abc.Sequence.count _collections_abc.Sequence.index -_collections_abc.Set.isdisjoint _csv.Dialect.__init__ _dummy_threading _importlib_modulespec From 9a9ff71a94b4fbbe31981e55ffec52971c15bcf2 Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Fri, 15 May 2020 23:23:30 -0400 Subject: [PATCH 07/18] Fix Set name, change import to import all --- stdlib/3/_collections_abc.pyi | 2 +- stdlib/3/collections/__init__.pyi | 32 ++----------------------------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/stdlib/3/_collections_abc.pyi b/stdlib/3/_collections_abc.pyi index 0c4e20e21560..82711fdc9296 100644 --- a/stdlib/3/_collections_abc.pyi +++ b/stdlib/3/_collections_abc.pyi @@ -19,7 +19,7 @@ from typing import ( MutableMapping as MutableMapping, Sequence as Sequence, MutableSequence as MutableSequence, - Set as Set, + AbstractSet as Set, MutableSet as MutableSet, MappingView as MappingView, ItemsView as ItemsView, diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index 9d837eebd397..e612b89deba9 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -8,36 +8,8 @@ from typing import ( # These are exported. from . import abc -from _collections_abc import ( - AsyncIterable as AsyncIterable, - AsyncIterator as AsyncIterator, - Awaitable as Awaitable, - Callable as Callable, - Container as Container, - Coroutine as Coroutine, - Hashable as Hashable, - Iterable as Iterable, - Iterator as Iterator, - Sized as Sized, - Generator as Generator, - ByteString as ByteString, - Mapping as Mapping, - MappingView as MappingView, - ItemsView as ItemsView, - KeysView as KeysView, - ValuesView as ValuesView, - MutableMapping as MutableMapping, - Sequence as Sequence, - MutableSequence as MutableSequence, - MutableSet as MutableSet, - Set as Set, -) -if sys.version_info >= (3, 6): - from _collections_abc import ( - Collection as Collection, - Reversible as Reversible, - AsyncGenerator as AsyncGenerator, - ) +if sys.version_info < (3, 10): + from _collections_abc import * _S = TypeVar('_S') _T = TypeVar('_T') From e4a9488b1ba44b7e239d340cadc36cad63299efb Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Tue, 26 May 2020 21:00:40 -0400 Subject: [PATCH 08/18] Fix collections.abc ignores broken by merge --- tests/stubtest_whitelists/py37.txt | 8 ++++---- tests/stubtest_whitelists/py38.txt | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/stubtest_whitelists/py37.txt b/tests/stubtest_whitelists/py37.txt index c45840648bd6..a8369aaadfdf 100644 --- a/tests/stubtest_whitelists/py37.txt +++ b/tests/stubtest_whitelists/py37.txt @@ -1,3 +1,7 @@ +_collections_abc.AsyncGenerator.ag_await +_collections_abc.AsyncGenerator.ag_code +_collections_abc.AsyncGenerator.ag_frame +_collections_abc.AsyncGenerator.ag_running _tracemalloc._get_object_traceback _tracemalloc.start asyncio.AbstractEventLoop.sock_sendfile @@ -20,10 +24,6 @@ collections.AsyncGenerator.ag_code collections.AsyncGenerator.ag_frame collections.AsyncGenerator.ag_running collections.UserString.maketrans -collections.abc.AsyncGenerator.ag_await -collections.abc.AsyncGenerator.ag_code -collections.abc.AsyncGenerator.ag_frame -collections.abc.AsyncGenerator.ag_running concurrent.futures.ProcessPoolExecutor.map contextvars.Context.__init__ contextvars.Context.get diff --git a/tests/stubtest_whitelists/py38.txt b/tests/stubtest_whitelists/py38.txt index eb6912e2e679..ca5aef67f178 100644 --- a/tests/stubtest_whitelists/py38.txt +++ b/tests/stubtest_whitelists/py38.txt @@ -1,3 +1,11 @@ +_collections_abc.AsyncGenerator.ag_await +_collections_abc.AsyncGenerator.ag_code +_collections_abc.AsyncGenerator.ag_frame +_collections_abc.AsyncGenerator.ag_running +_collections_abc.Container.__contains__ +_collections_abc.ItemsView.__reversed__ +_collections_abc.KeysView.__reversed__ +_collections_abc.ValuesView.__reversed__ _thread.ExceptHookArgs _thread._ExceptHookArgs _tracemalloc._get_object_traceback @@ -39,14 +47,6 @@ collections.KeysView.__reversed__ collections.OrderedDict.fromkeys collections.OrderedDict.setdefault collections.ValuesView.__reversed__ -collections.abc.AsyncGenerator.ag_await -collections.abc.AsyncGenerator.ag_code -collections.abc.AsyncGenerator.ag_frame -collections.abc.AsyncGenerator.ag_running -collections.abc.Container.__contains__ -collections.abc.ItemsView.__reversed__ -collections.abc.KeysView.__reversed__ -collections.abc.ValuesView.__reversed__ concurrent.futures.Executor.submit concurrent.futures.ProcessPoolExecutor.map concurrent.futures.ProcessPoolExecutor.submit From 1f1038b4dab4bc3f99964c31bfdde212a105a130 Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Tue, 26 May 2020 21:25:05 -0400 Subject: [PATCH 09/18] Fix mypy and pytype errors by including __all__. See #3923 --- stdlib/3/_collections_abc.pyi | 29 ++++++++++++++++++++++++++++- stdlib/3/collections/__init__.pyi | 3 --- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/stdlib/3/_collections_abc.pyi b/stdlib/3/_collections_abc.pyi index 82711fdc9296..89843cecc128 100644 --- a/stdlib/3/_collections_abc.pyi +++ b/stdlib/3/_collections_abc.pyi @@ -34,4 +34,31 @@ if sys.version_info >= (3, 6): AsyncGenerator as AsyncGenerator, ) -__all__: List[str] +# Without the real definition, mypy and pytest both think that __all__ is empty, so re-exports nothing +__all__ = [ + "Awaitable", + "Coroutine", + "AsyncIterable", + "AsyncIterator", + "AsyncGenerator", + "Hashable", + "Iterable", + "Iterator", + "Generator", + "Reversible", + "Sized", + "Container", + "Callable", + "Collection", + "Set", + "MutableSet", + "Mapping", + "MutableMapping", + "MappingView", + "KeysView", + "ItemsView", + "ValuesView", + "Sequence", + "MutableSequence", + "ByteString", +] diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index e612b89deba9..c82f64bfe7a9 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -1,12 +1,9 @@ -# These are not exported. import sys import typing from typing import ( TypeVar, Generic, Dict, overload, List, Tuple, Any, Type, Optional, Union ) -# These are exported. -from . import abc if sys.version_info < (3, 10): from _collections_abc import * From 5a7247e464545a34131e58f8ff94db50052c42e8 Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Tue, 26 May 2020 22:47:50 -0400 Subject: [PATCH 10/18] Add stubtest whitelist for collections.abc --- stdlib/3/_collections_abc.pyi | 1 - tests/stubtest_whitelists/py3_common.txt | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/3/_collections_abc.pyi b/stdlib/3/_collections_abc.pyi index 89843cecc128..5a1cf937663b 100644 --- a/stdlib/3/_collections_abc.pyi +++ b/stdlib/3/_collections_abc.pyi @@ -1,5 +1,4 @@ -from typing import List import sys from typing import ( diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index fa7905751e93..54ab5daef508 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -532,6 +532,7 @@ builtins.quit # Builtins that mypy pretends exist builtins.reveal_locals builtins.reveal_type +collections.abc.* # Types are re-exported from _collections_abc, so errors should be fixed there # Various classes in typing aren't types at runtime. In addition, mypy thinks some special forms are tautologically defined. typing.[A-Z]\w+ # We can't distinguish not having a default value from having a default value of inspect.Parameter.empty From 71636905fbe2e0be6bf02ef278a2dbd873e830d1 Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Tue, 26 May 2020 22:53:30 -0400 Subject: [PATCH 11/18] Add Set ignores --- tests/stubtest_whitelists/py3_common.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index 54ab5daef508..08e4211a4d7b 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -19,6 +19,7 @@ _collections_abc.MutableSet.discard _collections_abc.MutableSet.remove _collections_abc.Sequence.count _collections_abc.Sequence.index +_collections_abc.Set.isdisjoint _csv.Dialect.__init__ _dummy_threading _importlib_modulespec @@ -120,6 +121,7 @@ collections.MutableSet.discard collections.MutableSet.remove collections.Sequence.count collections.Sequence.index +collections.Set.isdisjoint collections.deque.__hash__ concurrent.futures.Executor.map concurrent.futures._base.Executor.map From 3a8992b10e5f8514c50e589c966db93942afd08d Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 28 May 2020 14:44:10 +0200 Subject: [PATCH 12/18] Update stubtest --- tests/stubtest_whitelists/py37.txt | 7 +++++++ tests/stubtest_whitelists/py38.txt | 1 - tests/stubtest_whitelists/py39.txt | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/stubtest_whitelists/py37.txt b/tests/stubtest_whitelists/py37.txt index b4d9813d627a..684c1ce17c29 100644 --- a/tests/stubtest_whitelists/py37.txt +++ b/tests/stubtest_whitelists/py37.txt @@ -16,6 +16,13 @@ asyncio.futures.Future._callbacks builtins.dict.get builtins.reversed builtins.str.maketrans +collections.AsyncGenerator.ag_await +collections.AsyncGenerator.ag_code +collections.AsyncGenerator.ag_frame +collections.AsyncGenerator.ag_running +collections.ItemsView.__reversed__ +collections.KeysView.__reversed__ +collections.ValuesView.__reversed__ cmath.log collections.UserString.maketrans concurrent.futures.ProcessPoolExecutor.map diff --git a/tests/stubtest_whitelists/py38.txt b/tests/stubtest_whitelists/py38.txt index c8291fc05115..197811e8311a 100644 --- a/tests/stubtest_whitelists/py38.txt +++ b/tests/stubtest_whitelists/py38.txt @@ -2,7 +2,6 @@ _collections_abc.AsyncGenerator.ag_await _collections_abc.AsyncGenerator.ag_code _collections_abc.AsyncGenerator.ag_frame _collections_abc.AsyncGenerator.ag_running -_collections_abc.Container.__contains__ _collections_abc.ItemsView.__reversed__ _collections_abc.KeysView.__reversed__ _collections_abc.ValuesView.__reversed__ diff --git a/tests/stubtest_whitelists/py39.txt b/tests/stubtest_whitelists/py39.txt index 41ad9ada2c8b..d6de31b2a9b6 100644 --- a/tests/stubtest_whitelists/py39.txt +++ b/tests/stubtest_whitelists/py39.txt @@ -1,4 +1,12 @@ _ast.ImportFrom.level +_collections_abc.AsyncGenerator.ag_await +_collections_abc.AsyncGenerator.ag_code +_collections_abc.AsyncGenerator.ag_frame +_collections_abc.AsyncGenerator.ag_running +_collections_abc.Container.__contains__ +_collections_abc.ItemsView.__reversed__ +_collections_abc.KeysView.__reversed__ +_collections_abc.ValuesView.__reversed__ _dummy_thread _thread.ExceptHookArgs _thread._ExceptHookArgs From 718e1a49fb8c73a3fd272fb3092e9b1a94222b15 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 28 May 2020 15:01:36 +0200 Subject: [PATCH 13/18] Remove unused stubtest whitelist entries --- tests/stubtest_whitelists/py37.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/stubtest_whitelists/py37.txt b/tests/stubtest_whitelists/py37.txt index 684c1ce17c29..68e1e69f1ea2 100644 --- a/tests/stubtest_whitelists/py37.txt +++ b/tests/stubtest_whitelists/py37.txt @@ -20,9 +20,6 @@ collections.AsyncGenerator.ag_await collections.AsyncGenerator.ag_code collections.AsyncGenerator.ag_frame collections.AsyncGenerator.ag_running -collections.ItemsView.__reversed__ -collections.KeysView.__reversed__ -collections.ValuesView.__reversed__ cmath.log collections.UserString.maketrans concurrent.futures.ProcessPoolExecutor.map From 3c5f1d8a32b8b7557be65166103663d53199384c Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Sat, 23 Jan 2021 15:31:24 +0100 Subject: [PATCH 14/18] Remove Python 3.5 compatibility --- stdlib/3/_collections_abc.pyi | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/stdlib/3/_collections_abc.pyi b/stdlib/3/_collections_abc.pyi index 5a1cf937663b..357c1f91a735 100644 --- a/stdlib/3/_collections_abc.pyi +++ b/stdlib/3/_collections_abc.pyi @@ -1,38 +1,31 @@ - -import sys - from typing import ( + AbstractSet as Set, + AsyncGenerator as AsyncGenerator, AsyncIterable as AsyncIterable, AsyncIterator as AsyncIterator, Awaitable as Awaitable, ByteString as ByteString, + Callable as Callable, + Collection as Collection, Container as Container, Coroutine as Coroutine, Generator as Generator, Hashable as Hashable, + ItemsView as ItemsView, Iterable as Iterable, Iterator as Iterator, - Sized as Sized, - Callable as Callable, + KeysView as KeysView, Mapping as Mapping, + MappingView as MappingView, MutableMapping as MutableMapping, - Sequence as Sequence, MutableSequence as MutableSequence, - AbstractSet as Set, MutableSet as MutableSet, - MappingView as MappingView, - ItemsView as ItemsView, - KeysView as KeysView, + Reversible as Reversible, + Sequence as Sequence, + Sized as Sized, ValuesView as ValuesView, ) -if sys.version_info >= (3, 6): - from typing import ( - Collection as Collection, - Reversible as Reversible, - AsyncGenerator as AsyncGenerator, - ) - # Without the real definition, mypy and pytest both think that __all__ is empty, so re-exports nothing __all__ = [ "Awaitable", From 8a5d9f80e025ed799207d0ab87a2d301ebefafed Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Sat, 23 Jan 2021 15:41:18 +0100 Subject: [PATCH 15/18] Remove alias already imported from _collections_abc --- stdlib/3/collections/__init__.pyi | 2 -- 1 file changed, 2 deletions(-) diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index ffb20c139bd4..a667955db27b 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -5,8 +5,6 @@ from typing import Any, Dict, Generic, List, Optional, Tuple, Type, TypeVar, Uni if sys.version_info < (3, 10): from _collections_abc import * -Set = AbstractSet - _S = TypeVar("_S") _T = TypeVar("_T") _KT = TypeVar("_KT") From b22ad9bc78d563b41e9263a21f413ae3d6c6e533 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Sat, 23 Jan 2021 15:44:45 +0100 Subject: [PATCH 16/18] Add one file to the stubtest whitelist --- tests/stubtest_whitelists/py39.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/stubtest_whitelists/py39.txt b/tests/stubtest_whitelists/py39.txt index c654f544a3a5..33efd347aca1 100644 --- a/tests/stubtest_whitelists/py39.txt +++ b/tests/stubtest_whitelists/py39.txt @@ -4,6 +4,7 @@ _collections_abc.AsyncGenerator.ag_code _collections_abc.AsyncGenerator.ag_frame _collections_abc.AsyncGenerator.ag_running _collections_abc.Container.__contains__ +_collections_abc.Generator.throw _collections_abc.ItemsView.__reversed__ _collections_abc.KeysView.__reversed__ _collections_abc.ValuesView.__reversed__ From b5a07b68ae0c0988cca5eb6cda7604fb9c771bfc Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Sat, 23 Jan 2021 15:47:33 +0100 Subject: [PATCH 17/18] Add more methods to stubgen whitelist --- tests/stubtest_whitelists/py39.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/stubtest_whitelists/py39.txt b/tests/stubtest_whitelists/py39.txt index 33efd347aca1..ae7aab3c82d8 100644 --- a/tests/stubtest_whitelists/py39.txt +++ b/tests/stubtest_whitelists/py39.txt @@ -3,7 +3,10 @@ _collections_abc.AsyncGenerator.ag_await _collections_abc.AsyncGenerator.ag_code _collections_abc.AsyncGenerator.ag_frame _collections_abc.AsyncGenerator.ag_running +_collections_abc.AsyncGenerator.athrow _collections_abc.Container.__contains__ +_collections_abc.Coroutine.throw +_collections_abc.Generator.send _collections_abc.Generator.throw _collections_abc.ItemsView.__reversed__ _collections_abc.KeysView.__reversed__ From c83cf0f76a564d34044ae6a378f6ac7ef4aa01d8 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Sat, 23 Jan 2021 15:49:35 +0100 Subject: [PATCH 18/18] Add more methods to stubgen whitelist --- tests/stubtest_whitelists/py39.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/stubtest_whitelists/py39.txt b/tests/stubtest_whitelists/py39.txt index ae7aab3c82d8..9f4afe54d248 100644 --- a/tests/stubtest_whitelists/py39.txt +++ b/tests/stubtest_whitelists/py39.txt @@ -3,8 +3,10 @@ _collections_abc.AsyncGenerator.ag_await _collections_abc.AsyncGenerator.ag_code _collections_abc.AsyncGenerator.ag_frame _collections_abc.AsyncGenerator.ag_running +_collections_abc.AsyncGenerator.asend _collections_abc.AsyncGenerator.athrow _collections_abc.Container.__contains__ +_collections_abc.Coroutine.send _collections_abc.Coroutine.throw _collections_abc.Generator.send _collections_abc.Generator.throw