fix using ZipFile as a ContextManager (#2043)

This commit is contained in:
Jelle Zijlstra
2018-04-12 12:29:22 -07:00
committed by Łukasz Langa
parent b8b78886e3
commit 37aba00fe8
6 changed files with 18 additions and 18 deletions

View File

@@ -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:

View File

@@ -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: ...

View File

@@ -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: ...

View File

@@ -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: ...