Index: lnt/external/stats/stats.py =================================================================== --- lnt/external/stats/stats.py +++ lnt/external/stats/stats.py @@ -911,7 +911,7 @@ if len(categories) != 2: raise ValueError("Exactly 2 categories required for pointbiserialr().") else: # there are 2 categories, continue - codemap = pstat.abut(categories, range(2)) + codemap = pstat.abut(categories, list(range(2))) recoded = pstat.recode(data, codemap, 0) x = pstat.linexand(data, 0, categories[0]) y = pstat.linexand(data, 0, categories[1]) @@ -1746,7 +1746,7 @@ """ n = len(inlist) svec = copy.deepcopy(inlist) - ivec = range(n) + ivec = list(range(n)) gap = n // 2 # integer division needed while gap >0: for i in range(gap, n): @@ -4259,7 +4259,7 @@ """ n = len(inarray) svec = inarray *1.0 - ivec = range(n) + ivec = list(range(n)) gap = n // 2 # integer division needed while gap >0: for i in range(gap, n): Index: lnt/testing/profile/profilev2impl.py =================================================================== --- lnt/testing/profile/profilev2impl.py +++ lnt/testing/profile/profilev2impl.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +from builtins import range from .profile import ProfileImpl import StringIO import bz2 @@ -252,12 +253,12 @@ def serialize(self, fobj): n_names = len(self.idx_to_name) writeNum(fobj, n_names) - for i in xrange(n_names): + for i in range(n_names): writeString(fobj, self.idx_to_name[i]) def deserialize(self, fobj): self.idx_to_name = {} - for i in xrange(readNum(fobj)): + for i in range(readNum(fobj)): self.idx_to_name[i] = readString(fobj) self.name_to_idx = {v: k for k, v @@ -287,7 +288,7 @@ def deserialize(self, fobj): self.counters = {} - for i in xrange(readNum(fobj)): + for i in range(readNum(fobj)): k = readNum(fobj) v = readNum(fobj) self.counters[self.counter_name_pool.idx_to_name[k]] = v @@ -514,7 +515,7 @@ def deserialize(self, fobj): self.functions = {} - for i in xrange(readNum(fobj)): + for i in range(readNum(fobj)): f = {} name = readString(fobj) f['length'] = readNum(fobj) @@ -523,7 +524,7 @@ self.line_text.setOffsetFor(name, readNum(fobj)) f['counters'] = {} - for j in xrange(readNum(fobj)): + for j in range(readNum(fobj)): k = self.counter_name_pool.idx_to_name[readNum(fobj)] v = readFloat(fobj) f['counters'][k] = v @@ -540,7 +541,7 @@ .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']): + for n in range(f['length']): yield (next(counter_gen), next(address_gen), next(text_gen)) def copy(self, counter_name_pool, line_counters, Index: lnt/tests/nt.py =================================================================== --- lnt/tests/nt.py +++ lnt/tests/nt.py @@ -1211,7 +1211,7 @@ results = [] no_errors = True - for _ in xrange(0, num_times): + for _ in range(0, num_times): test_results, t_no_errors = _execute_test_again( config, test_name, test_full_path, relative_test_path, logfile) no_errors &= t_no_errors Index: tests/utils/blast.py =================================================================== --- tests/utils/blast.py +++ tests/utils/blast.py @@ -8,6 +8,7 @@ ## Just to make sure there are no syntax errors in this. This does not ## actually run a blast. # RUN: python %{src_root}/tests/utils/blast.py +from builtins import range import time import subprocess import os @@ -45,7 +46,7 @@ """Make a random sized list of random samples.""" r = random.randint(1, 20) samples = [] - for i in xrange(r): + for i in range(r): samples.append(random.random() * 100) return samples @@ -65,7 +66,7 @@ print("Usage: python blast.py [optional url]") sys.exit(0) -for i in xrange(int(sys.argv[1])): +for i in range(int(sys.argv[1])): machine = lnt.testing.Machine(MACH, DEFAULT_MACHINE_INFO) run = lnt.testing.Run(start_time, end_time, run_info) report = lnt.testing.Report(machine=machine, run=run, tests=[])