From 8200880a4949fd112674551374868f292b8a6524 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 22 Mar 2016 03:08:21 -0400 Subject: Forward-port Python utilities to run polyglot under either Python 2 or 3. For the moment most shebang lines still say 'python2' rather than just 'python'. This is because the client code in gps/ hasn't been touched yet; the internal imports break under Python 3 and that needs to be fixed. --- gpsprof | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gpsprof') diff --git a/gpsprof b/gpsprof index 2c124769..15374de4 100755 --- a/gpsprof +++ b/gpsprof @@ -181,11 +181,11 @@ class spaceplot(plotter): def postprocess(self): if not self.recentered: # centroid is just arithmetic avg of lat,lon - self.centroid = (sum(map(lambda x: x[0], self.fixes)) / len(self.fixes), sum(map(lambda x: x[1], self.fixes)) / len(self.fixes)) + self.centroid = (sum([x[0] for x in self.fixes]) / len(self.fixes), sum([x[1] for x in self.fixes]) / len(self.fixes)) # Sort fixes by distance from centroid self.fixes.sort(lambda x, y: cmp(self.d(self.centroid, x), self.d(self.centroid, y))) # Convert fixes to offsets from centroid in meters - self.recentered = map(lambda fix: gps.MeterOffset(self.centroid, fix[:2]), self.fixes) + self.recentered = [gps.MeterOffset(self.centroid, fix[:2]) for fix in self.fixes] def data(self): res = "" @@ -446,7 +446,7 @@ if __name__ == '__main__': elif switch == '-h': sys.stderr.write( "usage: gpsprof [-h] [-D debuglevel] [-m threshold] [-n samplecount] [-d]\n" - + "\t[-f {" + "|".join(map(lambda x: x.name, formatters)) + "}] [-s speed] [-t title] [-T terminal] [server[:port[:device]]]\n") + + "\t[-f {" + "|".join([x.name for x in formatters]) + "}] [-s speed] [-t title] [-T terminal] [server[:port[:device]]]\n") sys.exit(0) (host, port, device) = ("localhost", "2947", None) -- cgit v1.2.1