]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
refactor: streamline 'type: ignore' in *Cursor.stream()
authorDenis Laxalde <denis@laxalde.org>
Sun, 15 May 2022 09:13:38 +0000 (11:13 +0200)
committerDenis Laxalde <denis@laxalde.org>
Thu, 19 May 2022 17:40:10 +0000 (19:40 +0200)
Make AsyncCursor code similar to Cursor one.

psycopg/psycopg/cursor_async.py

index 7f7f9443be56166b0ef7038382c2633e2d5d8f59..fe2927b0dfe1e72fe6ab67fda58caa5476480a15 100644 (file)
@@ -136,8 +136,8 @@ class AsyncCursor(BaseCursor["AsyncConnection[Any]", Row]):
             await self._conn.wait(self._stream_send_gen(query, params, binary=binary))
             first = True
             while await self._conn.wait(self._stream_fetchone_gen(first)):
-                rec = self._tx.load_row(0, self._make_row)
-                assert rec is not None
+                # We know that, if we got a result, it has a single row.
+                rec: Row = self._tx.load_row(0, self._make_row)  # type: ignore
                 yield rec
                 first = False