From 5e039c0e08d66c7e767cbafcbfcf3cdb8fc937f2 Mon Sep 17 00:00:00 2001 From: Denis Laxalde Date: Mon, 12 Apr 2021 14:08:35 +0200 Subject: [PATCH] Adjust return type of ServerCursorHelper._fetch_gen() This method returns cur._tx.load_rows() which return type is List[Row]. We now need 'type: ignore[no-any-return]' in fetchone() methods or server cursor classes, similarly as in client cursor classes. --- psycopg3/psycopg3/server_cursor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/psycopg3/psycopg3/server_cursor.py b/psycopg3/psycopg3/server_cursor.py index 9cf4d3253..09f4541e1 100644 --- a/psycopg3/psycopg3/server_cursor.py +++ b/psycopg3/psycopg3/server_cursor.py @@ -6,8 +6,8 @@ psycopg3 server-side cursor objects. import warnings from types import TracebackType -from typing import Any, AsyncIterator, Generic, List, Iterator, Optional -from typing import Sequence, Type, Tuple, TYPE_CHECKING +from typing import AsyncIterator, Generic, List, Iterator, Optional +from typing import Sequence, Type, TYPE_CHECKING from . import pq from . import sql @@ -102,7 +102,7 @@ class ServerCursorHelper(Generic[ConnectionType]): def _fetch_gen( self, cur: BaseCursor[ConnectionType], num: Optional[int] - ) -> PQGen[List[Tuple[Any, ...]]]: + ) -> PQGen[List[Row]]: # If we are stealing the cursor, make sure we know its shape if not self.described: yield from cur._start_query() @@ -245,7 +245,7 @@ class ServerCursor(BaseCursor["Connection"]): recs = self._conn.wait(self._helper._fetch_gen(self, 1)) if recs: self._pos += 1 - return recs[0] + return recs[0] # type: ignore[no-any-return] else: return None @@ -362,7 +362,7 @@ class AsyncServerCursor(BaseCursor["AsyncConnection"]): recs = await self._conn.wait(self._helper._fetch_gen(self, 1)) if recs: self._pos += 1 - return recs[0] + return recs[0] # type: ignore[no-any-return] else: return None -- 2.47.2