Update xrange and lambda for python3

partial blueprint heat-python34-support

Change-Id: I0b4ebf640083e63d6d1d461bf0c97778d19d770e
changes/62/176762/1
Sirushti Murugesan 8 years ago
parent 19ce39d101
commit 63ef40f1be
  1. 2
      heat/api/cfn/v1/stacks.py
  2. 4
      heat/engine/resources/openstack/heat/random_string.py
  3. 2
      heat/engine/scheduler.py
  4. 2
      heat/tests/test_heatclient.py
  5. 2
      heat/tests/test_swiftsignal.py

@ -165,7 +165,7 @@ class StackController(object):
}
def replacecolon(d):
return dict(map(lambda (k, v): (k.replace(':', '.'), v),
return dict(map(lambda k_v: (k_v[0].replace(':', '.'), k_v[1]),
d.items()))
def transform(attrs):

@ -181,7 +181,7 @@ class RandomString(resource.Resource):
for char_seq in char_sequences:
seq = char_seq[self.CHARACTER_SEQUENCES_SEQUENCE]
seq_min = char_seq[self.CHARACTER_SEQUENCES_MIN]
for i in xrange(seq_min):
for i in six.moves.xrange(seq_min):
random_string += random.choice(seq)
if char_classes:
@ -189,7 +189,7 @@ class RandomString(resource.Resource):
cclass_class = char_class[self.CHARACTER_CLASSES_CLASS]
cclass_seq = self._sequences[cclass_class]
cclass_min = char_class[self.CHARACTER_CLASSES_MIN]
for i in xrange(cclass_min):
for i in six.moves.xrange(cclass_min):
random_string += random.choice(cclass_seq)
def random_class_char():

@ -428,7 +428,7 @@ class DependencyTaskGroup(object):
Iterate over all subtasks that are currently running - i.e. they have
been started but have not yet completed.
"""
running = lambda (k, r): k in self._graph and r.started()
running = lambda k_r: k_r[0] in self._graph and k_r[1].started()
return itertools.ifilter(running, six.iteritems(self._runners))

@ -143,7 +143,7 @@ class KeystoneClientTest(common.HeatTestCase):
auth=mock_ks_auth)
c.AndReturn(self.mock_ks_v3_client)
for x in xrange(0, times):
for x in six.moves.xrange(0, times):
m = mock_ks_auth.get_access(mox.IsA(ks_session.Session))
m.AndReturn(mock_auth_ref)

@ -381,7 +381,7 @@ class SwiftSignalTest(common.HeatTestCase):
time_now = timeutils.utcnow()
time_series = [datetime.timedelta(0, t) + time_now
for t in xrange(1, 100)]
for t in six.moves.xrange(1, 100)]
timeutils.set_time_override(time_series)
self.addCleanup(timeutils.clear_time_override)

Loading…
Cancel
Save