Merge "Python3: Add support for iter.next"
This commit is contained in:
commit
9f877e5ba7
@ -219,9 +219,9 @@ class DB2Admin(object):
|
|||||||
|
|
||||||
if marker is not None:
|
if marker is not None:
|
||||||
try:
|
try:
|
||||||
item = result.next()
|
item = next(result)
|
||||||
while item != marker:
|
while item != marker:
|
||||||
item = result.next()
|
item = next(result)
|
||||||
|
|
||||||
if item == marker:
|
if item == marker:
|
||||||
marker = None
|
marker = None
|
||||||
@ -229,7 +229,7 @@ class DB2Admin(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
item = result.next()
|
item = next(result)
|
||||||
while item:
|
while item:
|
||||||
count = count + 1
|
count = count + 1
|
||||||
if (limit and count <= limit) or limit is None:
|
if (limit and count <= limit) or limit is None:
|
||||||
@ -240,7 +240,7 @@ class DB2Admin(object):
|
|||||||
db2_db.collate = None
|
db2_db.collate = None
|
||||||
next_marker = db2_db.name
|
next_marker = db2_db.name
|
||||||
databases.append(db2_db.serialize())
|
databases.append(db2_db.serialize())
|
||||||
item = result.next()
|
item = next(result)
|
||||||
else:
|
else:
|
||||||
next_marker = None
|
next_marker = None
|
||||||
break
|
break
|
||||||
@ -360,9 +360,9 @@ class DB2Admin(object):
|
|||||||
|
|
||||||
if marker is not None:
|
if marker is not None:
|
||||||
try:
|
try:
|
||||||
item = result.next()
|
item = next(result)
|
||||||
while item != marker:
|
while item != marker:
|
||||||
item = result.next()
|
item = next(result)
|
||||||
|
|
||||||
if item == marker:
|
if item == marker:
|
||||||
marker = None
|
marker = None
|
||||||
@ -370,7 +370,7 @@ class DB2Admin(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
item = result.next()
|
item = next(result)
|
||||||
db2db = models.MySQLDatabase()
|
db2db = models.MySQLDatabase()
|
||||||
db2db.name = db2_db.name
|
db2db.name = db2_db.name
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ class DB2Admin(object):
|
|||||||
if item in user_map:
|
if item in user_map:
|
||||||
db2user = user_map.get(item)
|
db2user = user_map.get(item)
|
||||||
db2user.databases.append(db2db.serialize())
|
db2user.databases.append(db2db.serialize())
|
||||||
item = result.next()
|
item = next(result)
|
||||||
continue
|
continue
|
||||||
'''
|
'''
|
||||||
If this user was not previously discovered, then add
|
If this user was not previously discovered, then add
|
||||||
@ -395,7 +395,7 @@ class DB2Admin(object):
|
|||||||
db2_user.databases.append(db2db.serialize())
|
db2_user.databases.append(db2db.serialize())
|
||||||
users.append(db2_user.serialize())
|
users.append(db2_user.serialize())
|
||||||
user_map.update({item: db2_user})
|
user_map.update({item: db2_user})
|
||||||
item = result.next()
|
item = next(result)
|
||||||
else:
|
else:
|
||||||
next_marker = None
|
next_marker = None
|
||||||
break
|
break
|
||||||
|
@ -106,9 +106,9 @@ class PgSqlDatabase(object):
|
|||||||
# Force __iter__ of generator until marker found.
|
# Force __iter__ of generator until marker found.
|
||||||
if marker is not None:
|
if marker is not None:
|
||||||
try:
|
try:
|
||||||
item = results.next()
|
item = next(results)
|
||||||
while item['_name'] != marker:
|
while item['_name'] != marker:
|
||||||
item = results.next()
|
item = next(results)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ class PgSqlDatabase(object):
|
|||||||
next_marker = None
|
next_marker = None
|
||||||
if remainder is not None:
|
if remainder is not None:
|
||||||
try:
|
try:
|
||||||
next_marker = remainder.next()
|
next_marker = next(remainder)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -133,9 +133,9 @@ class PgSqlUsers(PgSqlAccess):
|
|||||||
# Force __iter__ of generator until marker found.
|
# Force __iter__ of generator until marker found.
|
||||||
if marker is not None:
|
if marker is not None:
|
||||||
try:
|
try:
|
||||||
item = results.next()
|
item = next(results)
|
||||||
while item['_name'] != marker:
|
while item['_name'] != marker:
|
||||||
item = results.next()
|
item = next(results)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ class PgSqlUsers(PgSqlAccess):
|
|||||||
next_marker = None
|
next_marker = None
|
||||||
if remainder is not None:
|
if remainder is not None:
|
||||||
try:
|
try:
|
||||||
next_marker = remainder.next()
|
next_marker = next(remainder)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ class MysqlBinlogReplication(mysql_base.MysqlReplicationBase):
|
|||||||
LOG.info(_("Reading log position from %s") % INFO_FILE)
|
LOG.info(_("Reading log position from %s") % INFO_FILE)
|
||||||
try:
|
try:
|
||||||
with open(INFO_FILE, 'rb') as f:
|
with open(INFO_FILE, 'rb') as f:
|
||||||
row = csv.reader(f, delimiter='\t',
|
row = next(csv.reader(f, delimiter='\t',
|
||||||
skipinitialspace=True).next()
|
skipinitialspace=True))
|
||||||
return {
|
return {
|
||||||
'log_file': row[0],
|
'log_file': row[0],
|
||||||
'log_position': int(row[1])
|
'log_position': int(row[1])
|
||||||
|
@ -682,7 +682,7 @@ class BuiltInstanceTasksTest(trove_testtools.TestCase):
|
|||||||
|
|
||||||
def side_effect_func(*args, **kwargs):
|
def side_effect_func(*args, **kwargs):
|
||||||
if 'instance_id' in kwargs:
|
if 'instance_id' in kwargs:
|
||||||
return answers.next()
|
return next(answers)
|
||||||
elif ('id' in kwargs and 'deleted' in kwargs
|
elif ('id' in kwargs and 'deleted' in kwargs
|
||||||
and not kwargs['deleted']):
|
and not kwargs['deleted']):
|
||||||
return db_instance
|
return db_instance
|
||||||
|
Loading…
Reference in New Issue
Block a user