From: Denis Laxalde Date: Sun, 15 May 2022 09:13:38 +0000 (+0200) Subject: refactor: streamline 'type: ignore' in *Cursor.stream() X-Git-Tag: 3.1~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de690b5518157b4049b94e7b6f9ef7c36b3aedee;p=thirdparty%2Fpsycopg.git refactor: streamline 'type: ignore' in *Cursor.stream() Make AsyncCursor code similar to Cursor one. --- diff --git a/psycopg/psycopg/cursor_async.py b/psycopg/psycopg/cursor_async.py index 7f7f9443b..fe2927b0d 100644 --- a/psycopg/psycopg/cursor_async.py +++ b/psycopg/psycopg/cursor_async.py @@ -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