summaryrefslogtreecommitdiff
path: root/gpsprof
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2016-03-22 03:08:21 -0400
committerEric S. Raymond <esr@thyrsus.com>2016-03-22 03:08:21 -0400
commit8200880a4949fd112674551374868f292b8a6524 (patch)
tree5332fe0413615a729c4953d43cba7a7ea7a1a17f /gpsprof
parent254022f6c77e55280c6da59a01ee5225abdf7bcb (diff)
downloadgpsd-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-xgpsprof6
1 files changed, 3 insertions, 3 deletions
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)