Update stubtest for async and dunder pos only checking (#7333)

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2022-02-21 15:54:16 -08:00
committed by GitHub
parent 3afc0b1ade
commit 075b8e02eb
9 changed files with 127 additions and 7 deletions

View File

@@ -39,7 +39,7 @@ jobs:
# - get_mypy_req in tests/stubtest_third_party.py
# - stubtest-stdlib in .github/workflows/stubtest.yml
# - stubtest-stdlib in .github/workflows/tests.yml
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@080bb0e04e9d5c4d2513621d1fb62f1d61a573e9
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@85fc99c99e7e2afc5896de1842d52e6e6cd55197
- name: Run stubtest
run: python tests/stubtest_stdlib.py

View File

@@ -114,7 +114,7 @@ jobs:
# - get_mypy_req in tests/stubtest_third_party.py
# - stubtest-stdlib in .github/workflows/stubtest.yml
# - stubtest-stdlib in .github/workflows/tests.yml
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@080bb0e04e9d5c4d2513621d1fb62f1d61a573e9
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@85fc99c99e7e2afc5896de1842d52e6e6cd55197
- name: Run stubtest
run: python tests/stubtest_stdlib.py

View File

@@ -236,15 +236,15 @@ class AsyncGeneratorType(AsyncGenerator[_T_co, _T_contra]):
__name__: str
__qualname__: str
def __aiter__(self) -> AsyncGeneratorType[_T_co, _T_contra]: ...
async def __anext__(self) -> _T_co: ...
async def asend(self, __val: _T_contra) -> _T_co: ...
def __anext__(self) -> Coroutine[Any, Any, _T_co]: ...
def asend(self, __val: _T_contra) -> Coroutine[Any, Any, _T_co]: ...
@overload
async def athrow(
self, __typ: type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
) -> _T_co: ...
@overload
async def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ...
async def aclose(self) -> None: ...
def aclose(self) -> Coroutine[Any, Any, None]: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...

View File

@@ -9,5 +9,16 @@ ntpath.splitunc
posix.stat_float_times
ssl.OP_ENABLE_MIDDLEBOX_COMPAT
ssl.Options.OP_ENABLE_MIDDLEBOX_COMPAT
uuid.lib
# Not "async defs" at runtime
asyncio.SelectorEventLoop.create_unix_connection
asyncio.SelectorEventLoop.create_unix_server
asyncio.open_unix_connection
asyncio.start_unix_server
asyncio.streams.open_unix_connection
asyncio.streams.start_unix_server
asyncio.unix_events.SelectorEventLoop.create_unix_connection
asyncio.unix_events.SelectorEventLoop.create_unix_server
asyncio.unix_events._UnixSelectorEventLoop.create_unix_connection
asyncio.unix_events._UnixSelectorEventLoop.create_unix_server

View File

@@ -10,3 +10,15 @@ posix.stat_float_times
ssl.OP_ENABLE_MIDDLEBOX_COMPAT
ssl.Options.OP_ENABLE_MIDDLEBOX_COMPAT
uuid.lib
# Not "async defs" at runtime
asyncio.SelectorEventLoop.create_unix_connection
asyncio.SelectorEventLoop.create_unix_server
asyncio.open_unix_connection
asyncio.start_unix_server
asyncio.streams.open_unix_connection
asyncio.streams.start_unix_server
asyncio.unix_events.SelectorEventLoop.create_unix_connection
asyncio.unix_events.SelectorEventLoop.create_unix_server
asyncio.unix_events._UnixSelectorEventLoop.create_unix_connection
asyncio.unix_events._UnixSelectorEventLoop.create_unix_server

View File

@@ -103,6 +103,93 @@ collections.Generator.gi_yieldfrom
collections.Mapping.get # Adding None to the Union messed up mypy
collections.Sequence.index # Supporting None in end is not mandatory
# Not "async def"s at runtime
asyncio.AbstractEventLoop.connect_read_pipe
asyncio.AbstractEventLoop.connect_write_pipe
asyncio.AbstractEventLoop.create_datagram_endpoint
asyncio.AbstractEventLoop.create_unix_connection
asyncio.AbstractEventLoop.create_unix_server
asyncio.AbstractEventLoop.getaddrinfo
asyncio.AbstractEventLoop.getnameinfo
asyncio.AbstractEventLoop.shutdown_asyncgens
asyncio.AbstractEventLoop.subprocess_exec
asyncio.AbstractEventLoop.subprocess_shell
asyncio.AbstractServer.wait_closed
asyncio.BaseEventLoop.connect_accepted_socket
asyncio.BaseEventLoop.connect_read_pipe
asyncio.BaseEventLoop.connect_write_pipe
asyncio.BaseEventLoop.create_datagram_endpoint
asyncio.BaseEventLoop.getaddrinfo
asyncio.BaseEventLoop.getnameinfo
asyncio.BaseEventLoop.shutdown_asyncgens
asyncio.BaseEventLoop.subprocess_shell
asyncio.Condition.wait
asyncio.Condition.wait_for
asyncio.Event.wait
asyncio.Lock.acquire
asyncio.Queue.get
asyncio.Queue.join
asyncio.Queue.put
asyncio.Semaphore.acquire
asyncio.StreamReader.__anext__
asyncio.StreamReader.read
asyncio.StreamReader.readexactly
asyncio.StreamReader.readline
asyncio.StreamReader.readuntil
asyncio.StreamWriter.drain
asyncio.create_subprocess_exec
asyncio.create_subprocess_shell
asyncio.open_connection
asyncio.sleep
asyncio.start_server
asyncio.wait_for
asyncio.base_events.BaseEventLoop.connect_accepted_socket
asyncio.base_events.BaseEventLoop.connect_read_pipe
asyncio.base_events.BaseEventLoop.connect_write_pipe
asyncio.base_events.BaseEventLoop.create_datagram_endpoint
asyncio.base_events.BaseEventLoop.getaddrinfo
asyncio.base_events.BaseEventLoop.getnameinfo
asyncio.base_events.BaseEventLoop.shutdown_asyncgens
asyncio.base_events.BaseEventLoop.subprocess_shell
asyncio.base_events.Server.wait_closed
asyncio.base_subprocess.BaseSubprocessTransport._connect_pipes
asyncio.base_subprocess.BaseSubprocessTransport._wait
asyncio.events.AbstractEventLoop.connect_read_pipe
asyncio.events.AbstractEventLoop.connect_write_pipe
asyncio.events.AbstractEventLoop.create_datagram_endpoint
asyncio.events.AbstractEventLoop.create_unix_connection
asyncio.events.AbstractEventLoop.create_unix_server
asyncio.events.AbstractEventLoop.getaddrinfo
asyncio.events.AbstractEventLoop.getnameinfo
asyncio.events.AbstractEventLoop.shutdown_asyncgens
asyncio.events.AbstractEventLoop.subprocess_exec
asyncio.events.AbstractEventLoop.subprocess_shell
asyncio.events.AbstractServer.wait_closed
asyncio.locks.Condition.wait
asyncio.locks.Condition.wait_for
asyncio.locks.Event.wait
asyncio.locks.Lock.acquire
asyncio.locks.Semaphore.acquire
asyncio.locks._ContextManagerMixin.__aenter__
asyncio.locks._ContextManagerMixin.__aexit__
asyncio.queues.Queue.get
asyncio.queues.Queue.join
asyncio.queues.Queue.put
asyncio.streams.StreamReader.__anext__
asyncio.streams.StreamReader.read
asyncio.streams.StreamReader.readexactly
asyncio.streams.StreamReader.readline
asyncio.streams.StreamReader.readuntil
asyncio.streams.StreamWriter.drain
asyncio.streams.open_connection
asyncio.streams.start_server
asyncio.subprocess.Process.communicate
asyncio.subprocess.Process.wait
asyncio.subprocess.create_subprocess_exec
asyncio.subprocess.create_subprocess_shell
asyncio.tasks.sleep
asyncio.tasks.wait_for
# Exists at runtime, but missing from stubs
_bisect.bisect
_bisect.insort

View File

@@ -3,6 +3,8 @@ _collections_abc.AsyncGenerator.ag_code
_collections_abc.AsyncGenerator.ag_frame
_collections_abc.AsyncGenerator.ag_running
_dummy_threading
asyncio.AbstractEventLoop.run_in_executor # allowed to return a Future, changed in 3.8
asyncio.events.AbstractEventLoop.run_in_executor
asyncio.Future.__init__ # Usually initialized from c object
asyncio.Future._callbacks # Usually initialized from c object
asyncio.futures.Future.__init__ # Usually initialized from c object

View File

@@ -18,3 +18,11 @@ os.startfile
# Exists at runtime, but missing from stubs
asyncio.windows_utils.socketpair
venv.EnvBuilder.include_binary
# Not "async defs" at runtime
asyncio.IocpProactor.connect_pipe
asyncio.ProactorEventLoop.create_pipe_connection
asyncio.ProactorEventLoop.start_serving_pipe
asyncio.windows_events.IocpProactor.connect_pipe
asyncio.windows_events.ProactorEventLoop.create_pipe_connection
asyncio.windows_events.ProactorEventLoop.start_serving_pipe

View File

@@ -22,7 +22,7 @@ def get_mypy_req():
# - get_mypy_req in tests/stubtest_third_party.py
# - stubtest-stdlib in .github/workflows/stubtest.yml
# - stubtest-stdlib in .github/workflows/tests.yml
return "git+git://github.com/python/mypy@080bb0e04e9d5c4d2513621d1fb62f1d61a573e9"
return "git+git://github.com/python/mypy@85fc99c99e7e2afc5896de1842d52e6e6cd55197"
with open("requirements-tests.txt") as f:
return next(line.strip() for line in f if "mypy" in line)