From: Denis Laxalde Date: Sun, 15 May 2022 12:28:36 +0000 (+0200) Subject: fix: use a more generic connection type in {Client,Server}Cursor X-Git-Tag: 3.1~81^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fe058c7bfabce6fd26fb6534afe8a30d42ba242;p=thirdparty%2Fpsycopg.git fix: use a more generic connection type in {Client,Server}Cursor This makes them similar to plain Cursor class, i.e. being parametrized on sync or async connection type, not the row type (which is handled through the second type variable). --- diff --git a/psycopg/psycopg/client_cursor.py b/psycopg/psycopg/client_cursor.py index ee0e46c81..bdaa4e127 100644 --- a/psycopg/psycopg/client_cursor.py +++ b/psycopg/psycopg/client_cursor.py @@ -19,6 +19,7 @@ from ._preparing import Prepare from .cursor_async import AsyncCursor if TYPE_CHECKING: + from typing import Any # noqa: F401 from .connection import Connection # noqa: F401 from .connection_async import AsyncConnection # noqa: F401 @@ -87,11 +88,11 @@ class ClientCursorMixin(BaseCursor[ConnectionType, Row]): return (Prepare.NO, b"") -class ClientCursor(ClientCursorMixin["Connection[Row]", Row], Cursor[Row]): +class ClientCursor(ClientCursorMixin["Connection[Any]", Row], Cursor[Row]): __module__ = "psycopg" class AsyncClientCursor( - ClientCursorMixin["AsyncConnection[Row]", Row], AsyncCursor[Row] + ClientCursorMixin["AsyncConnection[Any]", Row], AsyncCursor[Row] ): __module__ = "psycopg" diff --git a/psycopg/psycopg/server_cursor.py b/psycopg/psycopg/server_cursor.py index 76e1cb19f..65db17212 100644 --- a/psycopg/psycopg/server_cursor.py +++ b/psycopg/psycopg/server_cursor.py @@ -198,7 +198,7 @@ _C = TypeVar("_C", bound="ServerCursor[Any]") _AC = TypeVar("_AC", bound="AsyncServerCursor[Any]") -class ServerCursor(ServerCursorMixin["Connection[Row]", Row], Cursor[Row]): +class ServerCursor(ServerCursorMixin["Connection[Any]", Row], Cursor[Row]): __module__ = "psycopg" __slots__ = () @@ -338,7 +338,7 @@ class ServerCursor(ServerCursorMixin["Connection[Row]", Row], Cursor[Row]): class AsyncServerCursor( - ServerCursorMixin["AsyncConnection[Row]", Row], AsyncCursor[Row] + ServerCursorMixin["AsyncConnection[Any]", Row], AsyncCursor[Row] ): __module__ = "psycopg" __slots__ = ()