Use typing_extensions.Self in the stdlib (#9694)

This commit is contained in:
Alex Waygood
2023-02-09 09:12:13 +00:00
committed by GitHub
parent 10086c06a1
commit 9ed39d8796
98 changed files with 627 additions and 654 deletions

View File

@@ -1,11 +1,11 @@
import io
import sys
from _typeshed import Self, StrOrBytesPath, StrPath, _BufferWithLen
from _typeshed import StrOrBytesPath, StrPath, _BufferWithLen
from collections.abc import Callable, Iterable, Iterator
from os import PathLike
from types import TracebackType
from typing import IO, Any, Protocol, overload
from typing_extensions import Literal, TypeAlias
from typing_extensions import Literal, Self, TypeAlias
__all__ = [
"BadZipFile",
@@ -150,7 +150,7 @@ class ZipFile:
compresslevel: int | None = None,
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
@@ -214,12 +214,10 @@ class ZipInfo:
def __init__(self, filename: str = "NoName", date_time: _DateTuple = ...) -> None: ...
if sys.version_info >= (3, 8):
@classmethod
def from_file(
cls: type[Self], filename: StrPath, arcname: StrPath | None = None, *, strict_timestamps: bool = True
) -> Self: ...
def from_file(cls, filename: StrPath, arcname: StrPath | None = None, *, strict_timestamps: bool = True) -> Self: ...
else:
@classmethod
def from_file(cls: type[Self], filename: StrPath, arcname: StrPath | None = None) -> Self: ...
def from_file(cls, filename: StrPath, arcname: StrPath | None = None) -> Self: ...
def is_dir(self) -> bool: ...
def FileHeader(self, zip64: bool | None = None) -> bytes: ...