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 sqlite3
import sys
from _typeshed import Incomplete, ReadableBuffer, Self, StrOrBytesPath, SupportsLenAndGetItem, Unused
from _typeshed import Incomplete, ReadableBuffer, StrOrBytesPath, SupportsLenAndGetItem, Unused
from collections.abc import Callable, Generator, Iterable, Iterator, Mapping
from datetime import date, datetime, time
from types import TracebackType
from typing import Any, Protocol, TypeVar, overload
from typing_extensions import Literal, SupportsIndex, TypeAlias, final
from typing_extensions import Literal, Self, SupportsIndex, TypeAlias, final
_T = TypeVar("_T")
_CursorT = TypeVar("_CursorT", bound=Cursor)
@@ -358,7 +358,7 @@ class Connection:
def deserialize(self, __data: ReadableBuffer, *, name: str = "main") -> None: ...
def __call__(self, __sql: str) -> _Statement: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(
self, __type: type[BaseException] | None, __value: BaseException | None, __traceback: TracebackType | None
) -> Literal[False]: ...
@@ -377,8 +377,8 @@ class Cursor(Iterator[Any]):
def rowcount(self) -> int: ...
def __init__(self, __cursor: Connection) -> None: ...
def close(self) -> None: ...
def execute(self: Self, __sql: str, __parameters: _Parameters = ...) -> Self: ...
def executemany(self: Self, __sql: str, __seq_of_parameters: Iterable[_Parameters]) -> Self: ...
def execute(self, __sql: str, __parameters: _Parameters = ...) -> Self: ...
def executemany(self, __sql: str, __seq_of_parameters: Iterable[_Parameters]) -> Self: ...
def executescript(self, __sql_script: str) -> Cursor: ...
def fetchall(self) -> list[Any]: ...
def fetchmany(self, size: int | None = 1) -> list[Any]: ...
@@ -387,7 +387,7 @@ class Cursor(Iterator[Any]):
def fetchone(self) -> Any: ...
def setinputsizes(self, __sizes: Unused) -> None: ... # does nothing
def setoutputsize(self, __size: Unused, __column: Unused = None) -> None: ... # does nothing
def __iter__(self: Self) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> Any: ...
class DataError(DatabaseError): ...
@@ -452,7 +452,7 @@ if sys.version_info >= (3, 11):
# whence must be one of os.SEEK_SET, os.SEEK_CUR, os.SEEK_END
def seek(self, __offset: int, __origin: int = 0) -> None: ...
def __len__(self) -> int: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(self, __typ: object, __val: object, __tb: object) -> Literal[False]: ...
def __getitem__(self, __item: SupportsIndex | slice) -> int: ...
def __setitem__(self, __item: SupportsIndex | slice, __value: int) -> None: ...