Merge "Python 3: dict.iteritems() and dict.itervalues()"
This commit is contained in:
commit
8938d07843
@ -31,6 +31,7 @@ import eventlet.debug
|
||||
from eventlet import greenio, GreenPool, sleep, wsgi, listen, Timeout
|
||||
from paste.deploy import loadwsgi
|
||||
from eventlet.green import socket, ssl, os as green_os
|
||||
import six
|
||||
from six import BytesIO
|
||||
from six import StringIO
|
||||
from six.moves.urllib.parse import unquote
|
||||
@ -643,7 +644,10 @@ class PortPidState(object):
|
||||
Yield all current listen sockets.
|
||||
"""
|
||||
|
||||
for orphan_data in self.sock_data_by_port.itervalues():
|
||||
# Use six.itervalues() instead of calling directly the .values() method
|
||||
# on Python 2 to avoid a temporary list, because sock_data_by_port
|
||||
# comes from users and can be large.
|
||||
for orphan_data in six.itervalues(self.sock_data_by_port):
|
||||
yield orphan_data['sock']
|
||||
|
||||
def forget_port(self, port):
|
||||
|
@ -861,7 +861,7 @@ class ContainerBroker(DatabaseBroker):
|
||||
'DELETE FROM object WHERE ' + query_mod +
|
||||
'name=? AND storage_policy_index=?',
|
||||
((rec['name'], rec['storage_policy_index'])
|
||||
for rec in to_delete.itervalues()))
|
||||
for rec in to_delete.values()))
|
||||
if to_add:
|
||||
curs.executemany(
|
||||
'INSERT INTO object (name, created_at, size, content_type,'
|
||||
@ -870,7 +870,7 @@ class ContainerBroker(DatabaseBroker):
|
||||
((rec['name'], rec['created_at'], rec['size'],
|
||||
rec['content_type'], rec['etag'], rec['deleted'],
|
||||
rec['storage_policy_index'])
|
||||
for rec in to_add.itervalues()))
|
||||
for rec in to_add.values()))
|
||||
if source:
|
||||
# for replication we rely on the remote end sending merges in
|
||||
# order with no gaps to increment sync_points
|
||||
|
@ -300,7 +300,7 @@ class TestReconSuccess(TestCase):
|
||||
array.array('H', [4, 2, 4, 3])]
|
||||
}
|
||||
|
||||
for ringfn, replica_map in rings.iteritems():
|
||||
for ringfn, replica_map in rings.items():
|
||||
ringpath = os.path.join(self.tempdir, ringfn)
|
||||
self._create_ring(ringpath, replica_map, self.ring_devs,
|
||||
self.ring_part_shift)
|
||||
|
@ -691,9 +691,9 @@ class TestDatabaseBroker(unittest.TestCase):
|
||||
self.assertTrue(stub_called[0])
|
||||
# ensure that metadata was cleared
|
||||
m2 = broker.metadata
|
||||
self.assertTrue(not any(v[0] for v in m2.itervalues()))
|
||||
self.assertTrue(not any(v[0] for v in m2.values()))
|
||||
self.assertTrue(all(v[1] == normalize_timestamp('2')
|
||||
for v in m2.itervalues()))
|
||||
for v in m2.values()))
|
||||
|
||||
def test_get(self):
|
||||
broker = DatabaseBroker(':memory:')
|
||||
|
Loading…
x
Reference in New Issue
Block a user