summaryrefslogtreecommitdiff
path: root/gpssim.py
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2016-04-10 19:29:06 -0700
committerEric S. Raymond <esr@thyrsus.com>2016-04-11 03:24:19 -0400
commit6005fde964ba8abfe48160c36b224dadd2bdc741 (patch)
tree2a6704d1fdb39e45d677112a13da2cbf1f694fc5 /gpssim.py
parentdaf3a92073b296559fdba732b29ab8d1a2f3c07c (diff)
downloadgpsd-6005fde964ba8abfe48160c36b224dadd2bdc741.tar.gz
Fixes Python programs to use new-style classes.
Although this isn't strictly a Python 3 requirement, using the new-style class definition syntax improves consistency between Python 2 and Python 3. Old-style classes have been deprecated since Python 2.2, but many such definitions linger on. Python 3 eliminates old-style classes, but instead of complaining about old-style definitions, it simply unconditionally and silently makes all classes new-style. The only incompatible differences are quite subtle and rarely matter in practice, but things are more consistent across versions if the new-style definitions are used. Also, the preferred method for subclasses to invoke parent init methods is via the super() construct, which is only available with new-style classes. Using super() is especially useful with multiple inheritance, which it handles automatically (provided that the init methods have compatible signatures). TESTED: Using an SConstruct patched to run the build helpers with the target Python, ran "scons build-all check ", as well as gpsprof and xgps, with all six supported Python versions (except 2.6 for xgps).
Diffstat (limited to 'gpssim.py')
-rw-r--r--gpssim.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/gpssim.py b/gpssim.py
index fb686e67..69c3da17 100644
--- a/gpssim.py
+++ b/gpssim.py
@@ -12,7 +12,7 @@ import gps, gpslib
# and a satellite with specified orbital elements in the sky.
-class ksv:
+class ksv(object):
"Kinematic state vector."
def __init__(self, time=0, lat=0, lon=0, alt=0, course=0,
@@ -61,7 +61,7 @@ class ksv:
# <http://www.wolffdata.se/gps/gpshtml/anomalies.html>
-class satellite:
+class satellite(object):
"Orbital elements of one satellite. PRESENTLY A STUB"
def __init__(self, prn):
@@ -88,7 +88,7 @@ class gpssimException(BaseException):
return '"%s", %d:' % (self.filename, self.lineno)
-class gpssim:
+class gpssim(object):
"Simulate a moving sensor, with skyview."
active_PRNs = list(range(1, 24 + 1)) + [134, ]
@@ -186,7 +186,7 @@ class gpssim:
MPS_TO_KNOTS = 1.9438445 # Meters per second to knots
-class NMEA:
+class NMEA(object):
"NMEA output generator."
def __init__(self):