Skip to content

[CodeStyle][py2] remove the next method for python2 compatibility (PEP 3114) #47728

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

Merged
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
8 changes: 0 additions & 8 deletions python/paddle/fluid/dataloader/dataloader_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,6 @@ def _shutdown_thread(self):

self._thread = None

# python2 compatibility
def next(self):
return self.__next__()

def _try_shutdown_all(self):
if not self._shutdown:
try:
Expand Down Expand Up @@ -854,10 +850,6 @@ def __next__(self):
if in_profiler_mode():
trace_event.end()

# python2 compatibility
def next(self):
return self.__next__()

def _on_output_batch(self):
for _ in range(len(self._places)):
self._batches_outstanding -= 1
Expand Down
9 changes: 0 additions & 9 deletions python/paddle/fluid/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,6 @@ def __init__(self):
def __call__(self):
return self

def next(self):
'''
Get the next item in the DataLoader object. This method
should not be called by users directly. It is used for
implementing iterator protocol of Python 2.x inside
PaddlePaddle framework.
'''
return self.__next__()
Copy link
Member Author

@SigureMo SigureMo Nov 7, 2022

Choose a reason for hiding this comment

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

image

This method should not be called by users directly.

这并不是一个供用户调用的 API,因此这里删除它应该没有问题


def __iter__(self):
raise NotImplementedError()

Expand Down