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,10 +1,10 @@
import io
import sys
from _typeshed import BytesPath, GenericPath, Self, StrPath, WriteableBuffer
from _typeshed import BytesPath, GenericPath, StrPath, WriteableBuffer
from collections.abc import Iterable, Iterator
from types import TracebackType
from typing import IO, Any, AnyStr, Generic, overload
from typing_extensions import Literal, TypeAlias
from typing_extensions import Literal, Self, TypeAlias
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -186,7 +186,7 @@ class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]):
name: str
delete: bool
def __init__(self, file: IO[AnyStr], name: str, delete: bool = True) -> None: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def close(self) -> None: ...
@@ -369,7 +369,7 @@ class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase):
) -> None: ...
def rollover(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ...
# These methods are copied from the abstract methods of IO, because
# SpooledTemporaryFile implements IO.