Index: lnt/trunk/lnt/external/stats/pstat.py =================================================================== --- lnt/trunk/lnt/external/stats/pstat.py +++ lnt/trunk/lnt/external/stats/pstat.py @@ -216,16 +216,16 @@ column = 0 if isinstance(cnums, (list, tuple)): # if multiple columns to get index = cnums[0] - column = map(lambda x: x[index], listoflists) + column = [x[index] for x in listoflists] for col in cnums[1:]: index = col - column = abut(column,map(lambda x: x[index], listoflists)) + column = abut(column, [x[index] for x in listoflists]) elif isinstance(cnums, str): # if an 'x[3:]' type expr. - evalstring = 'map(lambda x: x'+cnums+', listoflists)' + evalstring = 'list(map(lambda x: x'+cnums+', listoflists))' column = eval(evalstring) else: # else it's just 1 col to get index = cnums - column = map(lambda x: x[index], listoflists) + column = [x[index] for x in listoflists] return column @@ -463,8 +463,8 @@ Usage: list2string (inlist,delimit=' ') Returns: the string created from inlist """ - stringlist = map(makestr,inlist) - return string.join(stringlist,delimit) + stringlist = map(makestr, inlist) + return delimit.join(stringlist) def makelol(inlist): @@ -510,8 +510,7 @@ maxsize = [0]*len(list2print[0]) for col in range(len(list2print[0])): items = colex(list2print,col) - items = map(makestr,items) - maxsize[col] = max(map(len,items)) + extra + maxsize[col] = max(map(lambda item: len(makestr(item)), items)) + extra for row in lst: if row == ['\n'] or row == '\n' or row == '' or row == ['']: print() @@ -614,7 +613,7 @@ Usage: remap(listoflists,criterion) criterion=string Returns: remapped version of listoflists """ - function = 'map(lambda x: '+criterion+',listoflists)' + function = 'list(map(lambda x: '+criterion+',listoflists))' lines = eval(function) return lines @@ -963,7 +962,7 @@ """ return if row1.dtype.char=='O' or row2.dtype=='O': - cmpvect = N.logical_not(abs(N.array(map(cmp,row1,row2)))) # cmp fcn gives -1,0,1 + cmpvect = N.logical_not(abs(N.array(list(map(cmp, row1, row2))))) # cmp fcn gives -1,0,1 else: cmpvect = N.equal(row1,row2) return cmpvect @@ -1023,7 +1022,7 @@ for item in inarray[1:]: newflag = 1 for unq in uniques: # NOTE: cmp --> 0=same, -1=<, 1=> - test = N.sum(abs(N.array(map(cmp,item,unq)))) + test = N.sum(abs(N.array(list(map(cmp, item, unq))))) if test == 0: # if item identical to any 1 row in uniques newflag = 0 # then not a novel item to add break Index: lnt/trunk/lnt/external/stats/stats.py =================================================================== --- lnt/trunk/lnt/external/stats/stats.py +++ lnt/trunk/lnt/external/stats/stats.py @@ -842,8 +842,8 @@ if len(x) != len(y): raise ValueError('Input values not paired in pearsonr. Aborting.') n = len(x) - x = map(float,x) - y = map(float,y) + x = list(map(float, x)) + y = list(map(float, y)) xmean = mean(x) ymean = mean(y) r_num = n*(summult(x,y)) - sum(x)*sum(y) @@ -971,8 +971,8 @@ if len(x) != len(y): raise ValueError('Input values not paired in linregress. Aborting.') n = len(x) - x = map(float,x) - y = map(float,y) + x = list(map(float, x)) + y = list(map(float, y)) xmean = mean(x) ymean = mean(y) r_num = float(n*(summult(x,y)) - sum(x)*sum(y)) @@ -1235,7 +1235,7 @@ if diff != 0: d.append(diff) count = len(d) - absd = map(abs,d) + absd = list(map(abs, d)) absranked = rankdata(absd) r_plus = 0.0 r_minus = 0.0 @@ -1265,7 +1265,7 @@ args = list(args) n = [0]*len(args) all = [] - n = map(len,args) + n = list(map(len, args)) for i in range(len(args)): all = all + args[i] ranked = rankdata(all) @@ -1562,14 +1562,7 @@ Returns: F value, one-tailed p-value """ a = len(lists) # ANOVA on 'a' groups, each in it's own list - means = [0]*a - vars = [0]*a - ns = [0]*a alldata = [] - tmp = map(N.array,lists) - means = map(amean,tmp) - vars = map(avar,tmp) - ns = map(len,lists) for i in range(len(lists)): alldata = alldata + lists[i] alldata = N.array(alldata) @@ -1629,8 +1622,8 @@ maxsize = [0]*len(list2print[0]) for col in range(len(list2print[0])): items = pstat.colex(list2print,col) - items = map(pstat.makestr,items) - maxsize[col] = max(map(len,items)) + extra + maxsize[col] = (max(map(lambda item: len(pstat.makestr(item)), items)) + + extra) for row in listoflists: if row == ['\n'] or row == '\n': outfile.write('\n') @@ -3640,7 +3633,7 @@ assert len(args) == 3, "Need at least 3 groups in stats.akruskalwallish()" args = list(args) n = [0]*len(args) - n = map(len,args) + n = list(map(len, args)) all = [] for i in range(len(args)): all = all + args[i].tolist() @@ -4045,14 +4038,7 @@ Returns: f-value, probability """ na = len(args) # ANOVA on 'na' groups, each in it's own array - means = [0]*na - vars = [0]*na - ns = [0]*na alldata = [] - tmp = map(N.array,args) - means = map(amean,tmp) - vars = map(avar,tmp) - ns = map(len,args) alldata = N.concatenate(args) bign = len(alldata) sstot = ass(alldata)-(asquare_of_sums(alldata)/float(bign)) Index: lnt/trunk/lnt/server/ui/views.py =================================================================== --- lnt/trunk/lnt/server/ui/views.py +++ lnt/trunk/lnt/server/ui/views.py @@ -1330,7 +1330,7 @@ def get_machine_keys(m): m.css_name = m.name.replace('.', '-') return m - recent_machines = map(get_machine_keys, recent_machines) + recent_machines = list(map(get_machine_keys, recent_machines)) # For each machine, build a table of the machine, the baseline run, and the # most recent run. We also computed a list of all the runs we are reporting Index: lnt/trunk/lnt/testing/__init__.py =================================================================== --- lnt/trunk/lnt/testing/__init__.py +++ lnt/trunk/lnt/testing/__init__.py @@ -380,7 +380,7 @@ """Add samples for this metric, converted to float by calling function conv_f. """ - self.data.extend(list(map(conv_f, new_samples))) + self.data.extend(map(conv_f, new_samples)) def render(self): """Return info from this instance in a dictionary that respects Index: lnt/trunk/lnt/testing/util/valgrind.py =================================================================== --- lnt/trunk/lnt/testing/util/valgrind.py +++ lnt/trunk/lnt/testing/util/valgrind.py @@ -74,7 +74,7 @@ # Check if this is the closing summary line. if ln.startswith('summary'): key, value = ln.split(':', 1) - summary_samples = map(int, value.split()) + summary_samples = list(map(int, value.split())) break # Check if this is an update to the current file or function. @@ -84,7 +84,7 @@ current_function = ln[3:-1] else: # Otherwise, this is a data record. - samples = map(int, ln.split()) + samples = list(map(int, ln.split())) if len(samples) != num_samples: raise CalltreeParseError( "invalid record line, unexpected sample count") Index: lnt/trunk/lnt/tests/nt.py =================================================================== --- lnt/trunk/lnt/tests/nt.py +++ lnt/trunk/lnt/tests/nt.py @@ -1305,7 +1305,7 @@ def _unix_quote_args(s): - return map(pipes.quote, shlex.split(s)) + return list(map(pipes.quote, shlex.split(s))) # When set to true, all benchmarks will be rerun.