Python3: define a __next__() method for VerboseIteratorWrapper
In Python 3, __next__() has replaced next(). Also, call the next() function rather than the next() method. Closes-Bug: #1281866 Change-Id: I92b44508c9c875f16ad89ef8410d2c38092ab23d
This commit is contained in:
parent
b8a850c5b3
commit
23ad1d6db7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue