From a750a42c65b77963ff097b6cbb6d36cef5912eb7 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 11 Jun 2022 09:53:22 -0400 Subject: [PATCH] Remove Generic from sqlite3.Row (#8036) Introduced in https://github.com/python/typeshed/pull/7641. Removal discussed at https://github.com/python/typeshed/issues/8027. --- stdlib/sqlite3/dbapi2.pyi | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index fa7d29c38..6db4a9294 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -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. @@ -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: ... @@ -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: ...