Skip to content
Prev Previous commit
Next Next commit
Cleanup
  • Loading branch information
NoahStapp committed Aug 29, 2024
commit 397ea6b5b448f3c9cd45d9f151d757cf0329ca2a
9 changes: 5 additions & 4 deletions gridfs/asynchronous/grid_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -1489,10 +1489,11 @@ def __init__(
async def __anext__(self) -> bytes:
return super().__next__()

def __next__(self) -> bytes: # noqa: F811, RUF100
if _IS_SYNC:
return super().__next__()
else:
# This is a duplicate definition of __next__ for the synchronous API
# due to the limitations of our synchro process
if not _IS_SYNC:

def __next__(self) -> bytes: # noqa: F811, RUF100
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just remove __next__ altogether.

raise TypeError(
"AsyncGridOut does not support synchronous iteration. Use `async for` instead"
)
Expand Down
9 changes: 5 additions & 4 deletions gridfs/synchronous/grid_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,10 +1477,11 @@ def __init__(
def __next__(self) -> bytes:
return super().__next__()

def __next__(self) -> bytes: # noqa: F811, RUF100
if _IS_SYNC:
return super().__next__()
else:
# This is a duplicate definition of __next__ for the synchronous API
# due to the limitations of our synchro process
if not _IS_SYNC:

def __next__(self) -> bytes: # noqa: F811, RUF100
raise TypeError("GridOut does not support synchronous iteration. Use `for` instead")

def open(self) -> None:
Expand Down