mirror of
https://github.com/openvswitch/ovs
synced 2025-10-17 14:28:02 +00:00
python: Convert dict iterators.
In Python 2, dict.items(), dict.keys(), and dict.values() returned a list. dict.iteritems(), dict.iterkeys(), and dict.itervalues() returned an iterator. As of Python 3, dict.iteritems(), dict.itervalues(), and dict.iterkeys() are gone. items(), keys(), and values() now return an iterator. In the case where we want an iterator, we now use the six.iter*() helpers. If we want a list, we explicitly create a list from the iterator. Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -16,6 +16,8 @@ import errno
|
||||
import os
|
||||
import socket
|
||||
|
||||
import six
|
||||
|
||||
import ovs.poller
|
||||
import ovs.socket_util
|
||||
import ovs.vlog
|
||||
@@ -58,7 +60,7 @@ class Stream(object):
|
||||
|
||||
@staticmethod
|
||||
def _find_method(name):
|
||||
for method, cls in Stream._SOCKET_METHODS.items():
|
||||
for method, cls in six.iteritems(Stream._SOCKET_METHODS):
|
||||
if name.startswith(method):
|
||||
return cls
|
||||
return None
|
||||
|
Reference in New Issue
Block a user