mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-07-29 15:55:47 -05:00
Use next() function on iterators
In Python 3, next() for iterators is a function rather than method. Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
committed by
Jan Cholasta
parent
ace63f4ea5
commit
fb7943dab4
+5
-5
@@ -107,17 +107,17 @@ class ACI:
|
|||||||
for token in lexer:
|
for token in lexer:
|
||||||
# We should have the form (a = b)(a = b)...
|
# We should have the form (a = b)(a = b)...
|
||||||
if token == "(":
|
if token == "(":
|
||||||
var = lexer.next().strip()
|
var = next(lexer).strip()
|
||||||
operator = lexer.next()
|
operator = next(lexer)
|
||||||
if operator != "=" and operator != "!=":
|
if operator != "=" and operator != "!=":
|
||||||
# Peek at the next char before giving up
|
# Peek at the next char before giving up
|
||||||
operator = operator + lexer.next()
|
operator = operator + next(lexer)
|
||||||
if operator != "=" and operator != "!=":
|
if operator != "=" and operator != "!=":
|
||||||
raise SyntaxError("No operator in target, got '%s'" % operator)
|
raise SyntaxError("No operator in target, got '%s'" % operator)
|
||||||
op = operator
|
op = operator
|
||||||
val = lexer.next().strip()
|
val = next(lexer).strip()
|
||||||
val = self._remove_quotes(val)
|
val = self._remove_quotes(val)
|
||||||
end = lexer.next()
|
end = next(lexer)
|
||||||
if end != ")":
|
if end != ")":
|
||||||
raise SyntaxError('No end parenthesis in target, got %s' % end)
|
raise SyntaxError('No end parenthesis in target, got %s' % end)
|
||||||
|
|
||||||
|
|||||||
@@ -319,14 +319,14 @@ class Configurable(object):
|
|||||||
def run_until_executing(self, gen):
|
def run_until_executing(self, gen):
|
||||||
while self.__state != _EXECUTE_RUNNING:
|
while self.__state != _EXECUTE_RUNNING:
|
||||||
try:
|
try:
|
||||||
yield gen.next()
|
yield next(gen)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
break
|
break
|
||||||
|
|
||||||
def __runner(self, pending_state, running_state):
|
def __runner(self, pending_state, running_state):
|
||||||
self.__transition(pending_state, running_state)
|
self.__transition(pending_state, running_state)
|
||||||
|
|
||||||
step = self.__gen.next
|
step = lambda: next(self.__gen)
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
step()
|
step()
|
||||||
@@ -356,7 +356,7 @@ class Configurable(object):
|
|||||||
exc_info = sys.exc_info()
|
exc_info = sys.exc_info()
|
||||||
step = lambda: self.__gen.throw(*exc_info)
|
step = lambda: self.__gen.throw(*exc_info)
|
||||||
else:
|
else:
|
||||||
step = self.__gen.next
|
step = lambda: next(self.__gen)
|
||||||
|
|
||||||
def _handle_exception(self, exc_info):
|
def _handle_exception(self, exc_info):
|
||||||
assert not hasattr(super(Configurable, self), '_handle_exception')
|
assert not hasattr(super(Configurable, self), '_handle_exception')
|
||||||
@@ -498,7 +498,7 @@ class Composite(Configurable):
|
|||||||
new_validate = []
|
new_validate = []
|
||||||
for child, validator in validate:
|
for child, validator in validate:
|
||||||
try:
|
try:
|
||||||
validator.next()
|
next(validator)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
if child.done():
|
if child.done():
|
||||||
self.__components.remove(child)
|
self.__components.remove(child)
|
||||||
@@ -520,7 +520,7 @@ class Composite(Configurable):
|
|||||||
new_execute = []
|
new_execute = []
|
||||||
for child, executor in execute:
|
for child, executor in execute:
|
||||||
try:
|
try:
|
||||||
executor.next()
|
next(executor)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user