MCPcopy
hub / github.com/MagicStack/asyncpg / __anext__

Method __anext__

asyncpg/cursor.py:223–247  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

221
222 @connresource.guarded
223 async def __anext__(self):
224 if self._state is None:
225 self._state = await self._connection._get_statement(
226 self._query,
227 self._timeout,
228 named=True,
229 record_class=self._record_class,
230 )
231 self._state.attach()
232
233 if not self._portal_name and not self._exhausted:
234 buffer = await self._bind_exec(self._prefetch, self._timeout)
235 self._buffer.extend(buffer)
236
237 if not self._buffer and not self._exhausted:
238 buffer = await self._exec(self._prefetch, self._timeout)
239 self._buffer.extend(buffer)
240
241 if self._portal_name and self._exhausted:
242 await self._close_portal(self._timeout)
243
244 if self._buffer:
245 return self._buffer.popleft()
246
247 raise StopAsyncIteration
248
249
250class Cursor(BaseCursor):

Callers

nothing calls this directly

Calls 4

_bind_execMethod · 0.80
_execMethod · 0.80
_close_portalMethod · 0.80
_get_statementMethod · 0.45

Tested by

no test coverage detected