summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2016-10-20 16:48:10 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-10-25 16:22:01 +0900
commit513bf4c48c8f04014c9f32c330378ddc93fcbb1c (patch)
treeab4ff2ed2d83c4b1c619a237485615a0b6673cb1
parent895ddfca263a2544ac27d906988c401974d99167 (diff)
ovs/vsctl: Avoid applying next() to non-iterator object
In Python 2, the builtin function next() can not be applied to non-iterator object. This patch fixes to use the list comprehensions and avoid applying next() to a list type object. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/lib/ovs/vsctl.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/ryu/lib/ovs/vsctl.py b/ryu/lib/ovs/vsctl.py
index f1454985..66c2d628 100644
--- a/ryu/lib/ovs/vsctl.py
+++ b/ryu/lib/ovs/vsctl.py
@@ -126,8 +126,8 @@ def datum_from_string(type_, value_string, symtab=None):
def ifind(pred, seq):
try:
- return next(filter(pred, seq))
- except StopIteration:
+ return [i for i in seq if pred(i)][0]
+ except IndexError:
return None