Use _typeshed.Self with __enter__ (#5719)

This commit is contained in:
Anton Grübel
2021-07-01 23:15:13 +02:00
committed by GitHub
parent 96e0660fba
commit 8a107464a8
11 changed files with 30 additions and 45 deletions

View File

@@ -1,26 +1,10 @@
import io
import sys
from _typeshed import StrPath
from _typeshed import Self, StrPath
from types import TracebackType
from typing import (
IO,
Callable,
Dict,
Iterable,
Iterator,
List,
Optional,
Protocol,
Sequence,
Tuple,
Type,
TypeVar,
Union,
overload,
)
from typing import IO, Callable, Dict, Iterable, Iterator, List, Optional, Protocol, Sequence, Tuple, Type, Union, overload
from typing_extensions import Literal
_T = TypeVar("_T")
_DateTuple = Tuple[int, int, int, int, int, int]
class BadZipFile(Exception): ...
@@ -144,7 +128,7 @@ class ZipFile:
def __init__(
self, file: Union[StrPath, IO[bytes]], mode: str = ..., compression: int = ..., allowZip64: bool = ...
) -> None: ...
def __enter__(self: _T) -> _T: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...