From 2b9a74c49ae426899f5f2e56db7bf7d4d7331685 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Thu, 31 Mar 2022 23:33:43 +0100 Subject: [PATCH 01/23] Update contextlib.pyi --- stdlib/contextlib.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index c1b8b6b64434..a60f8811e0ac 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -217,9 +217,9 @@ if sys.version_info >= (3, 10): @overload def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... def __enter__(self) -> _T: ... - def __exit__(self, *exctype: Any) -> None: ... + def __exit__(self, *exctype: object) -> None: ... async def __aenter__(self) -> _T: ... - async def __aexit__(self, *exctype: Any) -> None: ... + async def __aexit__(self, *exctype: object) -> None: ... elif sys.version_info >= (3, 7): class nullcontext(AbstractContextManager[_T]): @@ -229,7 +229,7 @@ elif sys.version_info >= (3, 7): @overload def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... def __enter__(self) -> _T: ... - def __exit__(self, *exctype: Any) -> None: ... + def __exit__(self, *exctype: object) -> None: ... if sys.version_info >= (3, 11): _T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=int | StrOrBytesPath) From 9166452bbb5f3c3a97e52760649b47764c5af0f1 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Thu, 31 Mar 2022 23:35:23 +0100 Subject: [PATCH 02/23] Update runpy.pyi --- stdlib/runpy.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/runpy.pyi b/stdlib/runpy.pyi index 05e0ec65dc49..256f8dab14e9 100644 --- a/stdlib/runpy.pyi +++ b/stdlib/runpy.pyi @@ -9,13 +9,13 @@ class _TempModule: module: ModuleType def __init__(self, mod_name: str) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... class _ModifiedArgv0: value: Any def __init__(self, value: Any) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def run_module( mod_name: str, init_globals: dict[str, Any] | None = ..., run_name: str | None = ..., alter_sys: bool = ... From 5c508892a9205bc7ffdc3ac9ee0353cfb3e1202c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Thu, 31 Mar 2022 23:41:43 +0100 Subject: [PATCH 03/23] Update _dummy_thread.pyi --- stdlib/_dummy_thread.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/_dummy_thread.pyi b/stdlib/_dummy_thread.pyi index 6e936726a48f..97ba17ae497d 100644 --- a/stdlib/_dummy_thread.pyi +++ b/stdlib/_dummy_thread.pyi @@ -1,3 +1,4 @@ +from types import TracebackType from typing import Any, Callable, NoReturn TIMEOUT_MAX: int @@ -14,7 +15,7 @@ class LockType: def __init__(self) -> None: ... def acquire(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ... def __enter__(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ... - def __exit__(self, typ: Any, val: Any, tb: Any) -> None: ... + def __exit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ... def release(self) -> bool: ... def locked(self) -> bool: ... From f775f594d7d03866d309a029c252209f4d868aba Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Thu, 31 Mar 2022 23:45:27 +0100 Subject: [PATCH 04/23] Update nntplib.pyi --- stdlib/nntplib.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/nntplib.pyi b/stdlib/nntplib.pyi index 1b129b7ec609..cc48cb83ae4c 100644 --- a/stdlib/nntplib.pyi +++ b/stdlib/nntplib.pyi @@ -73,7 +73,7 @@ class NNTP: timeout: float = ..., ) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def getwelcome(self) -> str: ... def getcapabilities(self) -> dict[str, _list[str]]: ... def set_debuglevel(self, level: int) -> None: ... From 80c7d48eaf90e09bf65cd15abc396ef05652fe48 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:01:05 +0100 Subject: [PATCH 05/23] Update cProfile.pyi --- stdlib/cProfile.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/cProfile.pyi b/stdlib/cProfile.pyi index edaa67109952..6f15e461e007 100644 --- a/stdlib/cProfile.pyi +++ b/stdlib/cProfile.pyi @@ -31,6 +31,6 @@ class Profile: def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... if sys.version_info >= (3, 8): def __enter__(self: Self) -> Self: ... - def __exit__(self, *exc_info: Any) -> None: ... + def __exit__(self, *exc_info: object) -> None: ... def label(code: str | CodeType) -> _Label: ... # undocumented From 1f709efbcb6510c663efa29393f9725109187ef6 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:02:15 +0100 Subject: [PATCH 06/23] Update selectors.pyi --- stdlib/selectors.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/selectors.pyi b/stdlib/selectors.pyi index c3fe7ec47ace..23a94a29a74d 100644 --- a/stdlib/selectors.pyi +++ b/stdlib/selectors.pyi @@ -27,7 +27,7 @@ class BaseSelector(metaclass=ABCMeta): @abstractmethod def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... class SelectSelector(BaseSelector): def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... From cccfecec59ed82cabab32ac474beeb870c49392c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:03:37 +0100 Subject: [PATCH 07/23] Update wave.pyi --- stdlib/wave.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/wave.pyi b/stdlib/wave.pyi index 8c2edb5b19e2..de20c6c4f5d4 100644 --- a/stdlib/wave.pyi +++ b/stdlib/wave.pyi @@ -25,7 +25,7 @@ class _wave_params(NamedTuple): class Wave_read: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def getfp(self) -> BinaryIO | None: ... def rewind(self) -> None: ... def close(self) -> None: ... @@ -45,7 +45,7 @@ class Wave_read: class Wave_write: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def setnchannels(self, nchannels: int) -> None: ... def getnchannels(self) -> int: ... def setsampwidth(self, sampwidth: int) -> None: ... From 2100e76ec18036f66b4257449330667003ba811c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:05:03 +0100 Subject: [PATCH 08/23] Update calendar.pyi --- stdlib/calendar.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/calendar.pyi b/stdlib/calendar.pyi index 7582258b4a70..05ceca4a3ae0 100644 --- a/stdlib/calendar.pyi +++ b/stdlib/calendar.pyi @@ -1,7 +1,7 @@ import datetime import sys +from collections.abc import Iterable, Sequence from time import struct_time -from typing import Any, Iterable, Sequence from typing_extensions import Literal __all__ = [ @@ -106,7 +106,7 @@ class HTMLCalendar(Calendar): class different_locale: def __init__(self, locale: _LocaleType) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... class LocaleTextCalendar(TextCalendar): def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ... From f2685033b9901fc53f9c759a9c502a1f39e2ae2c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:06:56 +0100 Subject: [PATCH 09/23] Update telnetlib.pyi --- stdlib/telnetlib.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/telnetlib.pyi b/stdlib/telnetlib.pyi index f522d206550d..87b5418da942 100644 --- a/stdlib/telnetlib.pyi +++ b/stdlib/telnetlib.pyi @@ -1,5 +1,6 @@ import socket from _typeshed import Self +from types import TracebackType from typing import Any, Callable, Match, Pattern, Sequence __all__ = ["Telnet"] @@ -113,4 +114,4 @@ class Telnet: self, list: Sequence[Pattern[bytes] | bytes], timeout: float | None = ... ) -> tuple[int, Match[bytes] | None, bytes]: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ... + def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None) -> None: ... From 24ef87ccebd961831de863a6a53f9b30b54b6f66 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:08:01 +0100 Subject: [PATCH 10/23] Update sunau.pyi --- stdlib/sunau.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/sunau.pyi b/stdlib/sunau.pyi index b5a16f5e282b..73aa8999caa1 100644 --- a/stdlib/sunau.pyi +++ b/stdlib/sunau.pyi @@ -33,7 +33,7 @@ class _sunau_params(NamedTuple): class Au_read: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def getfp(self) -> IO[bytes] | None: ... def rewind(self) -> None: ... def close(self) -> None: ... @@ -53,7 +53,7 @@ class Au_read: class Au_write: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def setnchannels(self, nchannels: int) -> None: ... def getnchannels(self) -> int: ... def setsampwidth(self, sampwidth: int) -> None: ... From d70b0d9d91df2b59dba253cf9d1f9932097dbcd5 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:08:48 +0100 Subject: [PATCH 11/23] Update cgi.pyi --- stdlib/cgi.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/cgi.pyi b/stdlib/cgi.pyi index 1c11beec0c35..0bd4e515ce51 100644 --- a/stdlib/cgi.pyi +++ b/stdlib/cgi.pyi @@ -127,7 +127,7 @@ class FieldStorage: separator: str = ..., ) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def __iter__(self) -> Iterator[str]: ... def __getitem__(self, key: str) -> Any: ... def getvalue(self, key: str, default: Any = ...) -> Any: ... From 23a44fc1480a15ad1b4ffd869c41df534a726fa7 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:10:14 +0100 Subject: [PATCH 12/23] Update fileinput.pyi --- stdlib/fileinput.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/fileinput.pyi b/stdlib/fileinput.pyi index 787f75b8950a..9dc6f494c2fc 100644 --- a/stdlib/fileinput.pyi +++ b/stdlib/fileinput.pyi @@ -1,5 +1,6 @@ import sys from _typeshed import Self, StrOrBytesPath +from types import TracebackType from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator __all__ = [ @@ -98,7 +99,7 @@ class FileInput(Iterator[AnyStr], Generic[AnyStr]): def __del__(self) -> None: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ... + def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None) -> None: ... def __iter__(self: Self) -> Self: ... def __next__(self) -> AnyStr: ... if sys.version_info < (3, 11): From c0c1af8459d9dc8c2337ed7bd5fc018045020ed2 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:11:51 +0100 Subject: [PATCH 13/23] Update dbapi2.pyi --- stdlib/sqlite3/dbapi2.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index 456c94362a8e..fdfa5d672e30 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -1,6 +1,7 @@ import sys from _typeshed import Self, StrOrBytesPath from datetime import date, datetime, time +from types import TracebackType from typing import Any, Callable, Generator, Iterable, Iterator, Protocol, TypeVar from typing_extensions import Literal, final @@ -183,7 +184,7 @@ class Connection: def __call__(self, *args: Any, **kwargs: Any) -> Any: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, __type: type | None, __value: BaseException | None, __traceback: Any | None) -> Literal[False]: ... + def __exit__(self, __type: type[BaseException] | None, __value: BaseException | None, __traceback: TracebackType | None) -> Literal[False]: ... class Cursor(Iterator[Any]): arraysize: Any From 2cfd2ed3cb43f448bc81861e348b8bb6b9fcc8d6 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:14:40 +0100 Subject: [PATCH 14/23] Update sharedctypes.pyi --- stdlib/multiprocessing/sharedctypes.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/multiprocessing/sharedctypes.pyi b/stdlib/multiprocessing/sharedctypes.pyi index 50d5a3d71973..8b1b1c1cee6e 100644 --- a/stdlib/multiprocessing/sharedctypes.pyi +++ b/stdlib/multiprocessing/sharedctypes.pyi @@ -3,6 +3,7 @@ from collections.abc import Callable, Iterable, Sequence from ctypes import _CData, _SimpleCData, c_char from multiprocessing.context import BaseContext from multiprocessing.synchronize import _LockLike +from types import TracebackType from typing import Any, Generic, Protocol, TypeVar, overload from typing_extensions import Literal @@ -82,7 +83,9 @@ class SynchronizedBase(Generic[_CT]): def get_obj(self) -> _CT: ... def get_lock(self) -> _LockLike: ... def __enter__(self) -> bool: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__( + self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None + ) -> None: ... class Synchronized(SynchronizedBase[_SimpleCData[_T]], Generic[_T]): value: _T From 4bab9586e5fe335533eab55d49b21b8b813b0d2c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:16:13 +0100 Subject: [PATCH 15/23] Update __init__.pyi --- stdlib/os/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index fe92649756a5..f88f3a87e2d0 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -1021,7 +1021,7 @@ if sys.version_info >= (3, 8): def __init__(self, path: str | None, cookie: _T, remove_dll_directory: Callable[[_T], Any]) -> None: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def add_dll_directory(path: str) -> _AddedDllDirectory: ... if sys.platform == "linux": From 4cab34c900117d2758f7c74b0dff89f291e50ffd Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:18:02 +0100 Subject: [PATCH 16/23] Update locks.pyi --- stdlib/asyncio/locks.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/asyncio/locks.pyi b/stdlib/asyncio/locks.pyi index d0edcbdcaeda..01b1c5b4591d 100644 --- a/stdlib/asyncio/locks.pyi +++ b/stdlib/asyncio/locks.pyi @@ -25,7 +25,7 @@ else: class _ContextManager: def __init__(self, lock: Lock | Semaphore) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... class _ContextManagerMixin: # Apparently this exists to *prohibit* use as a context manager. From 978c54a53ca93a8e9b33b2c839539e30ee4ce385 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:19:15 +0100 Subject: [PATCH 17/23] Update events.pyi --- stdlib/asyncio/events.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index 6674702dd2d4..cc0391f92bc4 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -123,7 +123,7 @@ class AbstractServer: def close(self) -> None: ... if sys.version_info >= (3, 7): async def __aenter__(self: Self) -> Self: ... - async def __aexit__(self, *exc: Any) -> None: ... + async def __aexit__(self, *exc: object) -> None: ... @abstractmethod def get_loop(self) -> AbstractEventLoop: ... @abstractmethod From 74e3f0eef44ef16519d337cc39718fa25ac8030d Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:20:01 +0100 Subject: [PATCH 18/23] Update windows_utils.pyi --- stdlib/asyncio/windows_utils.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/asyncio/windows_utils.pyi b/stdlib/asyncio/windows_utils.pyi index 35a44be509af..1156f905659e 100644 --- a/stdlib/asyncio/windows_utils.pyi +++ b/stdlib/asyncio/windows_utils.pyi @@ -31,7 +31,7 @@ if sys.platform == "win32": def __del__(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, t: type | None, v: BaseException | None, tb: TracebackType | None) -> None: ... + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... @property def handle(self) -> int: ... def fileno(self) -> int: ... From 19c4b4866ddb49f974b690aa9a3c415ec416dceb Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:21:08 +0100 Subject: [PATCH 19/23] Update _base.pyi --- stdlib/concurrent/futures/_base.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index ce2a92eef5ab..572697c2d256 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -4,6 +4,7 @@ from _typeshed import Self from abc import abstractmethod from collections.abc import Container, Iterable, Iterator, Sequence from logging import Logger +from types import TracebackType from typing import Any, Callable, Generic, Protocol, TypeVar, overload from typing_extensions import Literal, ParamSpec, SupportsIndex @@ -73,7 +74,7 @@ class Executor: def shutdown(self, wait: bool = ...) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool | None: ... + def __exit__(self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None) -> bool | None: ... def as_completed(fs: Iterable[Future[_T]], timeout: float | None = ...) -> Iterator[Future[_T]]: ... From 6848ff3d063f61fc9abb37737006ee5d6d47a515 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:22:02 +0100 Subject: [PATCH 20/23] Update _base.pyi --- stdlib/concurrent/futures/_base.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index 572697c2d256..9d21c6fe96fb 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -128,4 +128,4 @@ class _AcquireFutures: futures: Iterable[Future[Any]] def __init__(self, futures: Iterable[Future[Any]]) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... From 0ed6185537753d35edf3b5356fa4a06db4403d4f Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:30:09 +0100 Subject: [PATCH 21/23] Update mock.pyi --- stdlib/unittest/mock.pyi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 63c912f15b6f..ce2b1ed2920d 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -1,6 +1,7 @@ import sys from _typeshed import Self from contextlib import _GeneratorContextManager +from types import TracebackType from typing import Any, Awaitable, Callable, Generic, Iterable, Mapping, Sequence, TypeVar, overload from typing_extensions import Literal @@ -263,7 +264,9 @@ class _patch(Generic[_T]): temp_original: Any is_local: bool def __enter__(self) -> _T: ... - def __exit__(self, *exc_info: Any) -> None: ... + def __exit__( + self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None + ) -> bool: ... def start(self) -> _T: ... def stop(self) -> None: ... @@ -275,7 +278,7 @@ class _patch_dict: def __call__(self, f: Any) -> Any: ... def decorate_class(self, klass: Any) -> Any: ... def __enter__(self) -> Any: ... - def __exit__(self, *args: Any) -> Any: ... + def __exit__(self, *args: object) -> Literal[False]: ... start: Any stop: Any From b89103e5609f74b63ece40d940c50c3a3349e600 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 31 Mar 2022 23:33:42 +0000 Subject: [PATCH 22/23] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/concurrent/futures/_base.pyi | 4 +++- stdlib/fileinput.pyi | 4 +++- stdlib/sqlite3/dbapi2.pyi | 4 +++- stdlib/telnetlib.pyi | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index 9d21c6fe96fb..4967d01f90dc 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -74,7 +74,9 @@ class Executor: def shutdown(self, wait: bool = ...) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None) -> bool | None: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> bool | None: ... def as_completed(fs: Iterable[Future[_T]], timeout: float | None = ...) -> Iterator[Future[_T]]: ... diff --git a/stdlib/fileinput.pyi b/stdlib/fileinput.pyi index 9dc6f494c2fc..a3b62948ca20 100644 --- a/stdlib/fileinput.pyi +++ b/stdlib/fileinput.pyi @@ -99,7 +99,9 @@ class FileInput(Iterator[AnyStr], Generic[AnyStr]): def __del__(self) -> None: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None) -> None: ... + def __exit__( + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... def __iter__(self: Self) -> Self: ... def __next__(self) -> AnyStr: ... if sys.version_info < (3, 11): diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index fdfa5d672e30..05e5a176d8ff 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -184,7 +184,9 @@ class Connection: def __call__(self, *args: Any, **kwargs: Any) -> Any: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, __type: type[BaseException] | None, __value: BaseException | None, __traceback: TracebackType | None) -> Literal[False]: ... + def __exit__( + self, __type: type[BaseException] | None, __value: BaseException | None, __traceback: TracebackType | None + ) -> Literal[False]: ... class Cursor(Iterator[Any]): arraysize: Any diff --git a/stdlib/telnetlib.pyi b/stdlib/telnetlib.pyi index 87b5418da942..359be6e49781 100644 --- a/stdlib/telnetlib.pyi +++ b/stdlib/telnetlib.pyi @@ -114,4 +114,6 @@ class Telnet: self, list: Sequence[Pattern[bytes] | bytes], timeout: float | None = ... ) -> tuple[int, Match[bytes] | None, bytes]: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None) -> None: ... + def __exit__( + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... From 2c6b23117c43f801b19cab31bf25308c278e3fd7 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 1 Apr 2022 00:44:57 +0100 Subject: [PATCH 23/23] Partially revert changes to `unittest.mock` --- stdlib/unittest/mock.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index ce2b1ed2920d..f5cd4218cea0 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -266,7 +266,7 @@ class _patch(Generic[_T]): def __enter__(self) -> _T: ... def __exit__( self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None - ) -> bool: ... + ) -> None: ... def start(self) -> _T: ... def stop(self) -> None: ... @@ -278,7 +278,7 @@ class _patch_dict: def __call__(self, f: Any) -> Any: ... def decorate_class(self, klass: Any) -> Any: ... def __enter__(self) -> Any: ... - def __exit__(self, *args: object) -> Literal[False]: ... + def __exit__(self, *args: object) -> Any: ... start: Any stop: Any