diff --git a/stdlib/2and3/ftplib.pyi b/stdlib/2and3/ftplib.pyi index 128b91da9..010961313 100644 --- a/stdlib/2and3/ftplib.pyi +++ b/stdlib/2and3/ftplib.pyi @@ -1,6 +1,6 @@ # Stubs for ftplib (Python 2.7/3) import sys -from typing import Optional, BinaryIO, Tuple, TextIO, Iterable, Callable, List, Union, Iterator, Dict, Text, TypeVar, Generic, Any +from typing import Optional, BinaryIO, Tuple, TextIO, Iterable, Callable, List, Union, Iterator, Dict, Text, Type, TypeVar, Generic, Any from types import TracebackType from socket import socket from ssl import SSLContext @@ -43,7 +43,7 @@ class FTP: file = ... # type: Optional[TextIO] encoding = ... # type: str def __enter__(self: _T) -> _T: ... - def __exit__(self, exc_type: Optional[type], exc_val: Optional[Exception], + def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ... else: file = ... # type: Optional[BinaryIO] diff --git a/stdlib/2and3/zipfile.pyi b/stdlib/2and3/zipfile.pyi index 2785b380a..28e0f902b 100644 --- a/stdlib/2and3/zipfile.pyi +++ b/stdlib/2and3/zipfile.pyi @@ -26,7 +26,7 @@ class ZipFile: allowZip64: bool = ...) -> None: ... def __enter__(self) -> ZipFile: ... def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[Exception], + exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ... def close(self) -> None: ... def getinfo(self, name: Text) -> ZipInfo: ... diff --git a/stdlib/3/http/client.pyi b/stdlib/3/http/client.pyi index 6bf90c9a2..5bcb00c4c 100644 --- a/stdlib/3/http/client.pyi +++ b/stdlib/3/http/client.pyi @@ -1,5 +1,5 @@ from typing import ( - Any, Dict, IO, Iterable, List, Iterator, Mapping, Optional, Tuple, TypeVar, + Any, Dict, IO, Iterable, List, Iterator, Mapping, Optional, Tuple, Type, TypeVar, Union, overload, ) @@ -98,8 +98,8 @@ if sys.version_info >= (3, 5): def isclosed(self) -> bool: ... def __iter__(self) -> Iterator[bytes]: ... def __enter__(self) -> 'HTTPResponse': ... - def __exit__(self, exc_type: Optional[type], - exc_val: Optional[Exception], + def __exit__(self, exc_type: Optional[Type[BaseException]], + exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType]) -> bool: ... else: class HTTPResponse: diff --git a/stdlib/3/io.pyi b/stdlib/3/io.pyi index f7d0df343..f43e76d7d 100644 --- a/stdlib/3/io.pyi +++ b/stdlib/3/io.pyi @@ -1,5 +1,5 @@ from typing import ( - List, BinaryIO, TextIO, Iterator, Union, Optional, Callable, Tuple, Any, IO, Iterable + List, BinaryIO, TextIO, Iterator, Union, Optional, Callable, Tuple, Type, Any, IO, Iterable ) import builtins import codecs @@ -32,7 +32,7 @@ class IOBase: def __iter__(self) -> Iterator[bytes]: ... def __next__(self) -> bytes: ... def __enter__(self: _T) -> _T: ... - def __exit__(self, exc_type: Optional[type], exc_val: Optional[Exception], + def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ... def close(self) -> None: ... def fileno(self) -> int: ... @@ -109,8 +109,8 @@ class BytesIO(BinaryIO): def __iter__(self) -> Iterator[bytes]: ... def __next__(self) -> bytes: ... def __enter__(self) -> 'BytesIO': ... - def __exit__(self, t: Optional[type] = ..., value: Optional[BaseException] = ..., - traceback: Optional[Any] = ...) -> bool: ... + def __exit__(self, t: Optional[Type[BaseException]] = ..., value: Optional[BaseException] = ..., + traceback: Optional[TracebackType] = ...) -> bool: ... def close(self) -> None: ... def fileno(self) -> int: ... def flush(self) -> None: ... @@ -212,8 +212,8 @@ class TextIOWrapper(TextIO): write_through: bool = ... ) -> None: ... # copied from IOBase - def __exit__(self, t: Optional[type] = ..., value: Optional[BaseException] = ..., - traceback: Optional[Any] = ...) -> bool: ... + def __exit__(self, t: Optional[Type[BaseException]] = ..., value: Optional[BaseException] = ..., + traceback: Optional[TracebackType] = ...) -> bool: ... def close(self) -> None: ... def fileno(self) -> int: ... def flush(self) -> None: ... diff --git a/stdlib/3/socketserver.pyi b/stdlib/3/socketserver.pyi index 91f781ddb..ba23e0a03 100644 --- a/stdlib/3/socketserver.pyi +++ b/stdlib/3/socketserver.pyi @@ -1,6 +1,6 @@ # Stubs for socketserver -from typing import Any, BinaryIO, Optional, Tuple +from typing import Any, BinaryIO, Optional, Tuple, Type from socket import SocketType import sys import types @@ -35,8 +35,8 @@ class BaseServer: client_address: Tuple[str, int]) -> bool: ... if sys.version_info >= (3, 6): def __enter__(self) -> 'BaseServer': ... - def __exit__(self, exc_type: Optional[type], - exc_val: Optional[Exception], + def __exit__(self, exc_type: Optional[Type[BaseException]], + exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType]) -> bool: ... if sys.version_info >= (3, 3): def service_actions(self) -> None: ... diff --git a/stdlib/3/unittest/__init__.pyi b/stdlib/3/unittest/__init__.pyi index 81af43281..febc71883 100644 --- a/stdlib/3/unittest/__init__.pyi +++ b/stdlib/3/unittest/__init__.pyi @@ -191,7 +191,7 @@ class FunctionTestCase(TestCase): class _AssertRaisesContext(Generic[_E]): exception = ... # type: _E def __enter__(self) -> _AssertRaisesContext[_E]: ... - def __exit__(self, exc_type: Optional[type], exc_val: Optional[Exception], + def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ... class _AssertWarnsContext: @@ -199,14 +199,14 @@ class _AssertWarnsContext: filename = ... # type: str lineno = ... # type: int def __enter__(self) -> _AssertWarnsContext: ... - def __exit__(self, exc_type: Optional[type], exc_val: Optional[Exception], + def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ... class _AssertLogsContext: records = ... # type: List[logging.LogRecord] output = ... # type: List[str] def __enter__(self) -> _AssertLogsContext: ... - def __exit__(self, exc_type: Optional[type], exc_val: Optional[Exception], + def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ...