Index: lnt/trunk/examples/run_to_csv.py =================================================================== --- lnt/trunk/examples/run_to_csv.py +++ lnt/trunk/examples/run_to_csv.py @@ -7,7 +7,7 @@ data = json.load(sys.stdin) -titles = data['tests'].itervalues().next().keys() +titles = list(next(iter(data['tests'].values())).keys()) titles.insert(0, titles.pop(titles.index("name"))) print(", ".join(titles)) Index: lnt/trunk/lnt/server/config.py =================================================================== --- lnt/trunk/lnt/server/config.py +++ lnt/trunk/lnt/server/config.py @@ -191,4 +191,4 @@ db_entry.baseline_revision) def get_database_names(self): - return self.databases.keys() + return list(self.databases.keys()) Index: lnt/trunk/lnt/server/reporting/summaryreport.py =================================================================== --- lnt/trunk/lnt/server/reporting/summaryreport.py +++ lnt/trunk/lnt/server/reporting/summaryreport.py @@ -342,7 +342,7 @@ columns = [ts.Sample.run_id, ts.Sample.test_id] columns.extend(f.column for f in ts.sample_fields) samples = session.query(*columns).filter( - ts.Sample.run_id.in_(run_id_map.keys())) + ts.Sample.run_id.in_(list(run_id_map.keys()))) for sample in samples: run = run_id_map[sample[0]] datapoints = list() Index: lnt/trunk/lnt/server/ui/regression_views.py =================================================================== --- lnt/trunk/lnt/server/ui/regression_views.py +++ lnt/trunk/lnt/server/ui/regression_views.py @@ -256,7 +256,7 @@ title = StringField(u'Title', validators=[DataRequired()]) bug = StringField(u'Bug', validators=[DataRequired()]) field_changes = MultiCheckboxField("Changes", coerce=int) - choices = RegressionState.names.items() + choices = list(RegressionState.names.items()) state = SelectField(u'State', choices=choices) edit_state = HiddenField(u'EditState', validators=[DataRequired()]) Index: lnt/trunk/lnt/server/ui/views.py =================================================================== --- lnt/trunk/lnt/server/ui/views.py +++ lnt/trunk/lnt/server/ui/views.py @@ -951,8 +951,9 @@ (field.status_field.column.is_(None))) # Aggregate by revision. - data = multidict.multidict((rev, (val, date, run_id)) - for val, rev, date, run_id in q).items() + data = list(multidict.multidict((rev, (val, date, run_id)) + for val, rev, date, run_id in q) + .items()) data.sort(key=lambda sample: convert_revision(sample[0], cache=revision_cache)) Index: lnt/trunk/lnt/testing/__init__.py =================================================================== --- lnt/trunk/lnt/testing/__init__.py +++ lnt/trunk/lnt/testing/__init__.py @@ -257,7 +257,7 @@ self.samples = samples self.info = dict() # Convert keys/values that are not json encodable to strings. - for key, value in list(info.items()): + for key, value in info.items(): key = str(key) value = str(value) self.info[key] = value Index: lnt/trunk/lnt/testing/profile/profilev2impl.py =================================================================== --- lnt/trunk/lnt/testing/profile/profilev2impl.py +++ lnt/trunk/lnt/testing/profile/profilev2impl.py @@ -266,9 +266,9 @@ def upgrade(self, impl): self.idx_to_name = {} - keys = impl.getTopLevelCounters().keys() + keys = list(impl.getTopLevelCounters().keys()) for f in impl.getFunctions().values(): - keys += f['counters'].keys() + keys.extend(f['counters'].keys()) keys = sorted(set(keys)) self.idx_to_name = {k: v for k, v in enumerate(keys)} @@ -313,9 +313,9 @@ start = fobj.tell() for fname, f in sorted(self.impl.getFunctions().items()): self.function_offsets[fname] = fobj.tell() - start - all_counters = f['counters'].keys() + all_counters = sorted(f['counters'].keys()) for counters, address, text in self.impl.getCodeForFunction(fname): - for k in sorted(all_counters): + for k in all_counters: writeFloat(fobj, counters.get(k, 0)) def deserialize(self, fobj): @@ -537,7 +537,7 @@ def getCodeForFunction(self, fname): f = self.functions[fname] counter_gen = self.line_counters \ - .extractForFunction(fname, f['counters'].keys()) + .extractForFunction(fname, list(f['counters'].keys())) address_gen = self.line_addresses.extractForFunction(fname) text_gen = self.line_text.extractForFunction(fname) for n in xrange(f['length']): Index: lnt/trunk/lnt/tests/nt.py =================================================================== --- lnt/trunk/lnt/tests/nt.py +++ lnt/trunk/lnt/tests/nt.py @@ -1479,14 +1479,14 @@ for test in collated_results.values(): test.check() - rerunable_benches = [x for x in collated_results.values() - if x.is_rerunable()] + rerunable_benches = list(filter(lambda bench: bench.is_rerunable(), + collated_results.values())) rerunable_benches.sort(key=lambda x: x.name) # Now lets do the reruns. rerun_results = [] summary = "Rerunning {} of {} benchmarks." logger.info(summary.format(len(rerunable_benches), - len(collated_results.values()))) + len(collated_results))) for i, bench in enumerate(rerunable_benches): logger.info("Rerunning: {} [{}/{}]".format(bench.name, Index: lnt/trunk/tests/server/ui/V4Pages.py =================================================================== --- lnt/trunk/tests/server/ui/V4Pages.py +++ lnt/trunk/tests/server/ui/V4Pages.py @@ -111,7 +111,7 @@ try: parser = ET.XMLParser() parser.parser.UseForeignDTD(True) - parser.entity.update((x, unichr(i)) for x, i in name2codepoint.iteritems()) + parser.entity.update((x, unichr(i)) for x, i in name2codepoint.items()) tree = ET.fromstring(html_string, parser=parser) except: # noqa FIXME: figure out what we expect this to throw. dump_html(html_string) Index: lnt/trunk/tests/server/ui/test_roundtrip.py =================================================================== --- lnt/trunk/tests/server/ui/test_roundtrip.py +++ lnt/trunk/tests/server/ui/test_roundtrip.py @@ -89,7 +89,7 @@ before_submit_run['run']['order_id'] = an_id after_submit_run['run']['order_id'] = an_id - self.assertEqual(before_submit_run.keys(), after_submit_run.keys()) + self.assertEqual(list(before_submit_run.keys()), list(after_submit_run.keys())) # Machine and run will be dicts, compare them directly. for k in ['machine', 'run']: self.assertEqual(before_submit_run[k], after_submit_run[k])