Python3: Add support for iter.next
Replaced iter.next() with next(iter) This patch is generated by the following tool using 'next' option. https://github.com/haypo/sixer Command: python sixer.py -w 'next' trove/ Partially implements: blueprint trove-python3 Change-Id: Ifbe25ddaa20f60b8af245f4745a9851c9b262bf3
This commit is contained in:
parent
a8e2583786
commit
34f71a8035
@ -206,9 +206,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
|
||||
@ -216,7 +216,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:
|
||||
@ -227,7 +227,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
|
||||
@ -347,9 +347,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
|
||||
@ -357,7 +357,7 @@ class DB2Admin(object):
|
||||
pass
|
||||
|
||||
try:
|
||||
item = result.next()
|
||||
item = next(result)
|
||||
db2db = models.MySQLDatabase()
|
||||
db2db.name = db2_db.name
|
||||
|
||||
@ -369,7 +369,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
|
||||
@ -382,7 +382,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
|
||||
|
@ -103,9 +103,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
|
||||
|
||||
@ -119,7 +119,7 @@ class PgSqlDatabase(object):
|
||||
next_marker = None
|
||||
if remainder is not None:
|
||||
try:
|
||||
next_marker = remainder.next()
|
||||
next_marker = next(remainder)
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
|
@ -131,9 +131,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
|
||||
|
||||
@ -147,7 +147,7 @@ class PgSqlUsers(PgSqlAccess):
|
||||
next_marker = None
|
||||
if remainder is not None:
|
||||
try:
|
||||
next_marker = remainder.next()
|
||||
next_marker = next(remainder)
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
|
@ -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])
|
||||
|
@ -678,7 +678,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
|
||||
|
Loading…
Reference in New Issue
Block a user