Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API docs: improve result stream #1010

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1347,9 +1347,9 @@ A :class:`neo4j.Result` is attached to an active connection, through a :class:`n

.. autoclass:: neo4j.Result()

.. describe:: iter(result)
.. automethod:: __iter__

.. describe:: next(result)
.. automethod:: __next__

.. automethod:: keys

Expand Down
6 changes: 2 additions & 4 deletions docs/source/async_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -865,11 +865,9 @@ A :class:`neo4j.AsyncResult` is attached to an active connection, through a :cla

.. autoclass:: neo4j.AsyncResult()

.. method:: __aiter__()
:async:
.. automethod:: __aiter__()

.. method:: __anext__()
:async:
.. automethod:: __anext__()

.. automethod:: keys

Expand Down
5 changes: 4 additions & 1 deletion src/neo4j/_async/work/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ async def __aiter__(self) -> t.AsyncIterator[Record]:

@AsyncNonConcurrentMethodChecker.non_concurrent_method
async def __anext__(self) -> Record:
"""Advance the result stream and return the record."""
"""Advance the result stream and return the record.

:raises StopAsyncIteration: if no more records are available.
"""
return await self.__aiter__().__anext__()

async def _attach(self):
Expand Down
5 changes: 4 additions & 1 deletion src/neo4j/_sync/work/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ def __iter__(self) -> t.Iterator[Record]:

@NonConcurrentMethodChecker.non_concurrent_method
def __next__(self) -> Record:
"""Advance the result stream and return the record."""
"""Advance the result stream and return the record.

:raises StopIteration: if no more records are available.
"""
return self.__iter__().__next__()

def _attach(self):
Expand Down