From de690b5518157b4049b94e7b6f9ef7c36b3aedee Mon Sep 17 00:00:00 2001 From: Denis Laxalde Date: Sun, 15 May 2022 11:13:38 +0200 Subject: [PATCH] refactor: streamline 'type: ignore' in *Cursor.stream() Make AsyncCursor code similar to Cursor one. --- psycopg/psycopg/cursor_async.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.47.2