Merge "Python3: define a __next__() method for VerboseIteratorWrapper"
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
import sys
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class _ProgressBarBase(object):
|
||||
"""
|
||||
@@ -78,7 +80,7 @@ class VerboseIteratorWrapper(_ProgressBarBase):
|
||||
|
||||
def next(self):
|
||||
try:
|
||||
data = self._wrapped.next()
|
||||
data = six.next(self._wrapped)
|
||||
# NOTE(mouad): Assuming that data is a string b/c otherwise calling
|
||||
# len function will not make any sense.
|
||||
self._display_progress_bar(len(data))
|
||||
@@ -89,3 +91,6 @@ class VerboseIteratorWrapper(_ProgressBarBase):
|
||||
# output.
|
||||
sys.stdout.write('\n')
|
||||
raise
|
||||
|
||||
# In Python 3, __next__() has replaced next().
|
||||
__next__ = next
|
||||
|
Reference in New Issue
Block a user