From 4061b1b88f72b3dc5c767d2f026a94515cf0c814 Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Tue, 8 Nov 2022 14:56:34 +0800 Subject: [PATCH] [CodeStyle][py2] remove the `next` method for python2 compatibility (PEP 3114) (#47728) --- python/paddle/fluid/dataloader/dataloader_iter.py | 8 -------- python/paddle/fluid/reader.py | 9 --------- 2 files changed, 17 deletions(-) diff --git a/python/paddle/fluid/dataloader/dataloader_iter.py b/python/paddle/fluid/dataloader/dataloader_iter.py index c89c3e079f..f248a1188b 100644 --- a/python/paddle/fluid/dataloader/dataloader_iter.py +++ b/python/paddle/fluid/dataloader/dataloader_iter.py @@ -354,10 +354,6 @@ class _DataLoaderIterSingleProcess(_DataLoaderIterBase): self._thread = None - # python2 compatibility - def next(self): - return self.__next__() - def _try_shutdown_all(self): if not self._shutdown: try: @@ -854,10 +850,6 @@ class _DataLoaderIterMultiProcess(_DataLoaderIterBase): 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 diff --git a/python/paddle/fluid/reader.py b/python/paddle/fluid/reader.py index 2ad3e5903a..b6b774d5ba 100644 --- a/python/paddle/fluid/reader.py +++ b/python/paddle/fluid/reader.py @@ -152,15 +152,6 @@ class DataLoaderBase: 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__() - def __iter__(self): raise NotImplementedError() -- GitLab