]> 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)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 19 May 2022 21:20:26 +0000 (23:20 +0200)
Make AsyncCursor code similar to Cursor one.

psycopg/psycopg/cursor_async.py

index 66e1bdc22dbdbc216b9bc1adf05bc0bb3ee9824b..4474e0c15615eca3e8bd76ddd1ea8e6556d8f4a4 100644 (file)
@@ -97,8 +97,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