summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-23 12:23:56 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-23 12:23:56 -0400
commit2b8056df097bd0bddfc74ab5ed731616ec639f2e (patch)
tree955a06f0f118054188ea57d15132df64628f26eb
parent678312ffab6001e1e7e2226046e3365771ecc9e9 (diff)
downloadgpsd-2b8056df097bd0bddfc74ab5ed731616ec639f2e.tar.gz
pylint validation pass. All regresio tests pass, xgps runs live.
-rw-r--r--SConstruct2
-rw-r--r--gps/client.py2
-rw-r--r--gps/fake.py15
-rwxr-xr-xgps/gps.py10
-rw-r--r--gps/misc.py2
-rw-r--r--jsongen.py.in4
-rwxr-xr-xleapsecond.py23
-rw-r--r--maskaudit.py.in14
-rwxr-xr-xxgps25
9 files changed, 48 insertions, 49 deletions
diff --git a/SConstruct b/SConstruct
index 5fee6cab..5be9f4dc 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1466,7 +1466,7 @@ Utility("scan-build", ["gpsd.h", "packet_names.h"],
# Sanity-check Python code.
pylint = Utility("pylint", ["jsongen.py", "maskaudit.py", python_built_extensions],
- ['''pylint --output-format=parseable --reports=n --include-ids=y --disable=F0001,C0103,C0111,C0301,C0302,C0322,C0324,C0323,C0321,R0201,R0801,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0924,W0201,W0232,W0401,W0403,W0141,W0142,W0603,W0614,W0621,E1101,E1102,F0401 jsongen.py leapsecond.py maskaudit.py gpsprof.py gpscat.py gpsfake.py gegps.py gps/*.py xgps'''])
+ ['''pylint --rcfile=/dev/null --dummy-variables-rgx='^_' --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" --reports=n --disable=F0001,C0103,C0111,C1001,C0301,C0302,C0322,C0324,C0323,C0321,R0201,R0801,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,W0110,W0201,W0121,W0232,W0234,W0401,W0403,W0141,W0142,W0603,W0614,W0621,E1101,E1102,F0401 jsongen.py leapsecond.py maskaudit.py gpsprof.py gpscat.py gpsfake.py gegps.py gps/*.py xgps'''])
# Check the documentation for bogons, too
Utility("xmllint", glob.glob("*.xml"),
diff --git a/gps/client.py b/gps/client.py
index eb21ea9e..8935b7df 100644
--- a/gps/client.py
+++ b/gps/client.py
@@ -127,7 +127,7 @@ WATCH_JSON = 0x000010 # JSON output
WATCH_NMEA = 0x000020 # output in NMEA
WATCH_RARE = 0x000040 # output of packets in hex
WATCH_RAW = 0x000080 # output of raw packets
-WATCH_SCALED = 0x000100 # scale output to floats
+WATCH_SCALED = 0x000100 # scale output to floats
WATCH_TIMING = 0x000200 # timing information
WATCH_SPLIT24 = 0x001000 # split AIS Type 24s
WATCH_PPS = 0x002000 # enable PPS in raw/NMEA
diff --git a/gps/fake.py b/gps/fake.py
index 74226ae7..2b51f5ad 100644
--- a/gps/fake.py
+++ b/gps/fake.py
@@ -132,7 +132,7 @@ class TestLoad:
def __init__(self, logfp, predump=False):
self.sentences = [] # This is the interesting part
if type(logfp) == type(""):
- logfp = open(logfp, "r")
+ logfp = open(logfp, "r")
self.name = logfp.name
self.logfp = logfp
self.predump = predump
@@ -176,7 +176,7 @@ class TestLoad:
raise ValueError
except (ValueError, IndexError):
raise TestLoadError("bad serial-parameter spec in %s"%\
- self.name)
+ self.name)
self.serial = (baud, databits, parity, stopbits)
elif "Transport: UDP" in packet:
self.sourcetype = "UDP"
@@ -199,7 +199,7 @@ class TestLoad:
print repr(packet)
if not packet:
raise TestLoadError("zero-length packet from %s"%\
- self.name)
+ self.name)
self.sentences.append(packet)
# Look at the first packet to grok the GPS type
self.textual = (type_latch == sniffer.NMEA_PACKET)
@@ -559,7 +559,7 @@ class TestSession:
progress=self.progress)
self.baseport += 1
else:
- newgps = FakePTY(testload, speed=speed,
+ newgps = FakePTY(testload, speed=speed,
progress=self.progress)
if pred:
newgps.go_predicate = pred
@@ -582,11 +582,11 @@ class TestSession:
self.progress("gpsfake: client_add()\n")
newclient = gps.gps(port=self.port, verbose=self.verbose)
self.append(newclient)
- newclient.id = self.client_id + 1
+ newclient.id = self.client_id + 1
self.client_id += 1
self.progress("gpsfake: client %d has %s\n" % (self.client_id,newclient.device))
if commands:
- self.initialize(newclient, commands)
+ self.initialize(newclient, commands)
return self.client_id
def client_remove(self, cid):
"Terminate a client session."
@@ -595,8 +595,7 @@ class TestSession:
if isinstance(obj, gps.gps) and obj.id == cid:
self.remove(obj)
return True
- else:
- return False
+ return False
def wait(self, seconds):
"Wait, doing nothing."
self.progress("gpsfake: wait(%d)\n" % seconds)
diff --git a/gps/gps.py b/gps/gps.py
index 286326ff..d14d1da6 100755
--- a/gps/gps.py
+++ b/gps/gps.py
@@ -112,7 +112,7 @@ class gpsdata:
)
def __init__(self):
- # Initialize all data members
+ # Initialize all data members
self.online = 0 # NZ if GPS on, zero if not
self.valid = 0
@@ -261,8 +261,8 @@ class gps(gpscommon, gpsdata, gpsjson):
self.valid = ONLINE_SET | DEVICE_SET
self.path = self.data["path"]
self.activated = default("activated", None)
- driver = default("driver", None, DEVICEID_SET)
- subtype = default("subtype", None, DEVICEID_SET)
+ driver = default("driver", None, DEVICEID_SET)
+ subtype = default("subtype", None, DEVICEID_SET)
self.gps_id = driver
if subtype:
self.gps_id += " " + subtype
@@ -298,7 +298,7 @@ class gps(gpscommon, gpsdata, gpsjson):
for attrp in ("x", "y", "v", "h", "p", "g"):
setattr(self, attrp+"dop", default(attrp+"dop", NaN, DOP_SET))
if "satellites" in self.data.keys():
- self.satellites = []
+ self.satellites = []
for sat in self.data['satellites']:
self.satellites.append(gps.satellite(PRN=sat['PRN'], elevation=sat['el'], azimuth=sat['az'], ss=sat['ss'], used=sat['used']))
self.satellites_used = 0
@@ -345,7 +345,7 @@ class gps(gpscommon, gpsdata, gpsjson):
else: # flags & WATCH_ENABLE:
if flags & WATCH_OLDSTYLE:
arg = 'w+'
- if (flags & WATCH_NMEA):
+ if flags & WATCH_NMEA:
arg += 'r+'
return self.send(arg)
else:
diff --git a/gps/misc.py b/gps/misc.py
index 42ef840f..240a9465 100644
--- a/gps/misc.py
+++ b/gps/misc.py
@@ -93,7 +93,7 @@ def isotime(s):
else:
date = s
msec = "0"
- # Note: no leap-second correction!
+ # Note: no leap-second correction!
return calendar.timegm(time.strptime(date, "%Y-%m-%dT%H:%M:%S")) + float("0." + msec)
else:
raise TypeError
diff --git a/jsongen.py.in b/jsongen.py.in
index 9a500dd4..c7efb297 100644
--- a/jsongen.py.in
+++ b/jsongen.py.in
@@ -660,7 +660,7 @@ ais_specs = (
('text', 'string', None),
),
},
- # Message type 13 duplicates 7
+ # Message type 13 duplicates 7
{
"initname" : "json_ais14",
"headers": ("AIS_HEADER",),
@@ -939,7 +939,7 @@ def generate(spec):
elif attr not in outboard:
report += " char %s[JSON_VAL_MAX+1];\n" % attr
outboard.append(attr)
-
+
structname = spec["structname"]
# If there are structarrays describing array subobjects, we need
# to make a separate parse control initializer for each one. The
diff --git a/leapsecond.py b/leapsecond.py
index 750ef8ea..5f6d57dc 100755
--- a/leapsecond.py
+++ b/leapsecond.py
@@ -121,8 +121,7 @@ def retrieve():
except IOError:
if verbose:
print >>sys.stderr, "IOError: %s" % url
- else:
- return None
+ return None
def last_insertion_time():
"Give last potential insertion time for a leap second."
@@ -352,32 +351,32 @@ if __name__ == '__main__':
import getopt
(options, arguments) = getopt.getopt(sys.argv[1:], "hvf:g:H:i:n:o:I:O:")
for (switch, val) in options:
- if (switch == '-h'): # help, get usage only
+ if switch == '-h': # help, get usage only
usage()
- if (switch == '-v'): # be verbose
+ elif switch == '-v': # be verbose
verbose=1
- if (switch == '-f'): # Fetch USNO data to cache locally
+ elif switch == '-f': # Fetch USNO data to cache locally
save_leapseconds(val)
raise SystemExit, 0
- elif (switch == '-g'): # Graph the leap_second history
+ elif switch == '-g': # Graph the leap_second history
graph_history(val)
raise SystemExit, 0
- elif (switch == '-H'): # make leapsecond include
+ elif switch == '-H': # make leapsecond include
sys.stdout.write(make_leapsecond_include(val))
raise SystemExit, 0
- elif (switch == '-i'): # Compute Unix time from RFC822 date
+ elif switch == '-i': # Compute Unix time from RFC822 date
print rfc822_to_unix(val)
raise SystemExit, 0
- elif (switch == '-n'): # Compute possible next leapsecond
+ elif switch == '-n': # Compute possible next leapsecond
printnext(val)
raise SystemExit, 0
- elif (switch == '-o'): # Compute RFC822 date from Unix time
+ elif switch == '-o': # Compute RFC822 date from Unix time
print unix_to_rfc822(float(val))
raise SystemExit, 0
- elif (switch == '-I'): # Compute Unix time from ISO8601 date
+ elif switch == '-I': # Compute Unix time from ISO8601 date
print isotime(val)
raise SystemExit, 0
- elif (switch == '-O'): # Compute ISO8601 date from Unix time
+ elif switch == '-O': # Compute ISO8601 date from Unix time
print isotime(float(val))
raise SystemExit, 0
diff --git a/maskaudit.py.in b/maskaudit.py.in
index 2dc3826b..0c8fb955 100644
--- a/maskaudit.py.in
+++ b/maskaudit.py.in
@@ -26,7 +26,7 @@ class SourceExtractor:
self.masks.append((fields[1], fields[2]))
if fields[2].startswith("(1llu<<") or fields[2].startswith("INTERNAL_SET"):
self.primitive_masks.append((fields[1], fields[2]))
-
+
def in_library(self, flag):
(status, _output) = commands.getstatusoutput("grep %s libgps_core.c libgps_json.c gpsctl.c" % flag)
return status == 0
@@ -40,20 +40,20 @@ class SourceExtractor:
return self.in_library(flag)
else:
return self.in_daemon(flag)
-
+
if __name__ == '__main__':
try:
(options, arguments) = getopt.getopt(sys.argv[1:], "cdpt")
pythonize = tabulate = False
clientgen = daemongen = False
for (switch, val) in options:
- if (switch == '-p'):
+ if switch == '-p':
pythonize = True
- if (switch == '-c'):
+ if switch == '-c':
clientgen = True
- if (switch == '-d'):
+ if switch == '-d':
daemongen = True
- if (switch == '-t'):
+ if switch == '-t':
tabulate = True
if not arguments:
@@ -108,7 +108,7 @@ const char *gps_maskdump(gps_mask_t set)
gps_mask_t mask;
const char *name;
} *sp, names[] = {""" % (maxout + 3,)
- for (flag, value) in (clientside.primitive_masks + daemonside.primitive_masks):
+ for (flag, value) in clientside.primitive_masks + daemonside.primitive_masks:
stem = flag
if stem.endswith("_SET"):
stem = stem[:-4]
diff --git a/xgps b/xgps
index cda28b71..864a2b2a 100755
--- a/xgps
+++ b/xgps
@@ -249,7 +249,7 @@ class SkyView(gtk.DrawingArea):
self.queue_draw()
class NoiseView:
- "Encapsulate view object for watching noise statistics."
+ "Encapsulate view object for watching noise statistics."
COLUMNS = 2
ROWS = 4
noisefields = (
@@ -270,7 +270,7 @@ class NoiseView:
for i in range(len(NoiseView.noisefields)):
colbase = (i / NoiseView.ROWS) * 2
label = gtk.Label(NoiseView.noisefields[i][0] + ": ")
- # Wacky way to force right alignment
+ # Wacky way to force right alignment
label.set_alignment(xalign=1, yalign=0.5)
self.widget.attach(label, colbase, colbase+1,
i % NoiseView.ROWS, i % NoiseView.ROWS + 1)
@@ -291,7 +291,7 @@ class NoiseView:
widget.set_text("n/a")
class MaidenheadView:
- "Encapsulate view object for watching Maidenhead grid location."
+ "Encapsulate view object for watching Maidenhead grid location."
def __init__(self):
self.widget = gtk.Entry()
self.widget.set_editable(False)
@@ -302,7 +302,7 @@ class MaidenheadView:
return self.widget.set_text("n/a")
class AISView:
- "Encapsulate store and view objects for watching AIS data."
+ "Encapsulate store and view objects for watching AIS data."
AIS_ENTRIES = 10
DWELLTIME = 360
def __init__(self, deg_type):
@@ -412,7 +412,7 @@ class AISView:
where = self.latlon(ais.lat, ais.lon)
self.store.prepend(
(ais.type, ais.name, "(%s navaid)" % ais.epfd_text, "", where, ais.aid_type_text))
-
+
class Base:
COLUMNS = 3
ROWS = 7
@@ -440,7 +440,7 @@ class Base:
self.saved_mode = -1
self.ais_latch = False
self.noise_latch = False
-
+
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
if not self.window.get_display():
raise Exception("Can't open display")
@@ -567,7 +567,7 @@ class Base:
for i in range(len(Base.gpsfields)):
colbase = (i / Base.ROWS) * 2
label = gtk.Label(Base.gpsfields[i][0] + ": ")
- # Wacky way to force right alignment
+ # Wacky way to force right alignment
label.set_alignment(xalign=1, yalign=0.5)
datatable.attach(label, colbase, colbase+1,
i % Base.ROWS, i % Base.ROWS + 1)
@@ -746,7 +746,7 @@ class Base:
"Update the GPS data fields."
# the first 14 fields are updated using TPV data
for (hook, widget) in Base.gpsfields[:14]:
- if hook: # Remove this guard when we have all hooks
+ if hook: # Remove this guard when we have all hooks
widget.set_text(hook(self, tpv))
self.gsview.update(tpv)
@@ -756,12 +756,13 @@ class Base:
satellites = data.satellites
for fld in reversed(SKY_VIEW_SORT_FIELDS):
rev = (fld[0] == '-')
- if (rev): fld = fld[1:]
+ if rev:
+ fld = fld[1:]
satellites = sorted(satellites[:],
- cmp=lambda x,y: cmp(x[fld],
+ cmp=lambda x,y: cmp(x[fld],
y[fld]),
reverse = rev)
- for (i, satellite) in enumerate(satellites):
+ for (i, satellite) in enumerate(satellites):
self.set_satlist_field(i, 0, satellite.PRN)
self.set_satlist_field(i, 1, satellite.el)
self.set_satlist_field(i, 2, satellite.az)
@@ -819,7 +820,7 @@ class Base:
self.ais_latch = True
self.uimanager.get_widget('/MenuBar/View/AIS').set_active(True)
self.aisbox.show()
-
+
return True
def handle_hangup(self, _source, _condition):