Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Generic from sqlite3.Row #8036

Merged
merged 6 commits into from
Jun 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions stdlib/sqlite3/dbapi2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ from _typeshed import ReadableBuffer, Self, StrOrBytesPath, SupportsLenAndGetIte
from collections.abc import Callable, Generator, Iterable, Iterator, Mapping
from datetime import date, datetime, time
from types import TracebackType
from typing import Any, Generic, Protocol, TypeVar, overload
from typing import Any, Protocol, TypeVar, overload
from typing_extensions import Literal, SupportsIndex, TypeAlias, final

_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_CursorT = TypeVar("_CursorT", bound=Cursor)
_SqliteData: TypeAlias = str | ReadableBuffer | int | float | None
# Data that is passed through adapters can be of any type accepted by an adapter.
Expand Down Expand Up @@ -379,7 +378,7 @@ class Cursor(Iterator[Any]):
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | Any: ...
@property
def lastrowid(self) -> int | None: ...
row_factory: Callable[[Cursor, Row[Any]], object] | None
row_factory: Callable[[Cursor, Row], object] | None
@property
def rowcount(self) -> int: ...
def __init__(self, __cursor: Connection) -> None: ...
Expand Down Expand Up @@ -420,15 +419,15 @@ class PrepareProtocol:

class ProgrammingError(DatabaseError): ...

class Row(Generic[_T_co]):
def __init__(self, __cursor: Cursor, __data: tuple[_T_co, ...]) -> None: ...
class Row:
def __init__(self, __cursor: Cursor, __data: tuple[Any, ...]) -> None: ...
def keys(self) -> list[str]: ...
@overload
def __getitem__(self, __index: int | str) -> _T_co: ...
def __getitem__(self, __index: int | str) -> Any: ...
@overload
def __getitem__(self, __index: slice) -> tuple[_T_co, ...]: ...
def __getitem__(self, __index: slice) -> tuple[Any, ...]: ...
def __hash__(self) -> int: ...
def __iter__(self) -> Iterator[_T_co]: ...
def __iter__(self) -> Iterator[Any]: ...
def __len__(self) -> int: ...
# These return NotImplemented for anything that is not a Row.
def __eq__(self, __other: object) -> bool: ...
Expand Down