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