diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2016-03-22 03:08:21 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2016-03-22 03:08:21 -0400 |
commit | 8200880a4949fd112674551374868f292b8a6524 (patch) | |
tree | 5332fe0413615a729c4953d43cba7a7ea7a1a17f /gpsprof | |
parent | 254022f6c77e55280c6da59a01ee5225abdf7bcb (diff) | |
download | gpsd-8200880a4949fd112674551374868f292b8a6524.tar.gz |
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.
Diffstat (limited to 'gpsprof')
-rwxr-xr-x | gpsprof | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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) |