Merge "Python3: Add support for iter.next"

This commit is contained in:
Jenkins 2016-04-19 00:26:51 +00:00 committed by Gerrit Code Review
commit 9f877e5ba7
5 changed files with 18 additions and 18 deletions

View File

@ -219,9 +219,9 @@ class DB2Admin(object):
if marker is not None:
try:
item = result.next()
item = next(result)
while item != marker:
item = result.next()
item = next(result)
if item == marker:
marker = None
@ -229,7 +229,7 @@ class DB2Admin(object):
pass
try:
item = result.next()
item = next(result)
while item:
count = count + 1
if (limit and count <= limit) or limit is None:
@ -240,7 +240,7 @@ class DB2Admin(object):
db2_db.collate = None
next_marker = db2_db.name
databases.append(db2_db.serialize())
item = result.next()
item = next(result)
else:
next_marker = None
break
@ -360,9 +360,9 @@ class DB2Admin(object):
if marker is not None:
try:
item = result.next()
item = next(result)
while item != marker:
item = result.next()
item = next(result)
if item == marker:
marker = None
@ -370,7 +370,7 @@ class DB2Admin(object):
pass
try:
item = result.next()
item = next(result)
db2db = models.MySQLDatabase()
db2db.name = db2_db.name
@ -382,7 +382,7 @@ class DB2Admin(object):
if item in user_map:
db2user = user_map.get(item)
db2user.databases.append(db2db.serialize())
item = result.next()
item = next(result)
continue
'''
If this user was not previously discovered, then add
@ -395,7 +395,7 @@ class DB2Admin(object):
db2_user.databases.append(db2db.serialize())
users.append(db2_user.serialize())
user_map.update({item: db2_user})
item = result.next()
item = next(result)
else:
next_marker = None
break

View File

@ -106,9 +106,9 @@ class PgSqlDatabase(object):
# Force __iter__ of generator until marker found.
if marker is not None:
try:
item = results.next()
item = next(results)
while item['_name'] != marker:
item = results.next()
item = next(results)
except StopIteration:
pass
@ -122,7 +122,7 @@ class PgSqlDatabase(object):
next_marker = None
if remainder is not None:
try:
next_marker = remainder.next()
next_marker = next(remainder)
except StopIteration:
pass

View File

@ -133,9 +133,9 @@ class PgSqlUsers(PgSqlAccess):
# Force __iter__ of generator until marker found.
if marker is not None:
try:
item = results.next()
item = next(results)
while item['_name'] != marker:
item = results.next()
item = next(results)
except StopIteration:
pass
@ -149,7 +149,7 @@ class PgSqlUsers(PgSqlAccess):
next_marker = None
if remainder is not None:
try:
next_marker = remainder.next()
next_marker = next(remainder)
except StopIteration:
pass

View File

@ -69,8 +69,8 @@ class MysqlBinlogReplication(mysql_base.MysqlReplicationBase):
LOG.info(_("Reading log position from %s") % INFO_FILE)
try:
with open(INFO_FILE, 'rb') as f:
row = csv.reader(f, delimiter='\t',
skipinitialspace=True).next()
row = next(csv.reader(f, delimiter='\t',
skipinitialspace=True))
return {
'log_file': row[0],
'log_position': int(row[1])

View File

@ -682,7 +682,7 @@ class BuiltInstanceTasksTest(trove_testtools.TestCase):
def side_effect_func(*args, **kwargs):
if 'instance_id' in kwargs:
return answers.next()
return next(answers)
elif ('id' in kwargs and 'deleted' in kwargs
and not kwargs['deleted']):
return db_instance