summaryrefslogtreecommitdiff
path: root/leapsecond.py
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-12-02 18:23:47 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-12-02 18:23:47 -0500
commit86b76a9473c270927c8ab1af7d3c9458de2a26e3 (patch)
treed73cb22a4482b225033895ae5027e8b8ff8c61f5 /leapsecond.py
parent4478675a451bf52f18134df82fb5bb8cfc6fd414 (diff)
downloadgpsd-86b76a9473c270927c8ab1af7d3c9458de2a26e3.tar.gz
pylint cleanup.
Diffstat (limited to 'leapsecond.py')
-rwxr-xr-xleapsecond.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/leapsecond.py b/leapsecond.py
index 81b0fabf..750ef8ea 100755
--- a/leapsecond.py
+++ b/leapsecond.py
@@ -188,24 +188,26 @@ def fetch_leapsecs(filename):
def make_leapsecond_include(infile):
"Get the current leap second count and century from the local cache usable as C preprocessor #define"
+ # Underscore prefixes avoids warning W0612 from pylint,
+ # which doesn't count substitution through locals() as use.
leapjumps = fetch_leapsecs(infile)
now = int(time.time())
- year = time.strftime("%Y", time.gmtime(now))
- gps_week_now = gps_week(now)
- isodate = isotime(now - now % SECS_PER_WEEK)
- leapsecs = -1
+ _year = time.strftime("%Y", time.gmtime(now))
+ _gps_week_now = gps_week(now)
+ _isodate = isotime(now - now % SECS_PER_WEEK)
+ _leapsecs = -1
for leapjump in leapjumps:
if leapjump < time.time():
- leapsecs += 1
+ _leapsecs += 1
return """\
/*
* Constants used for GPS time detection and rollover correction.
*
- * Correct for week beginning %(isodate)s
+ * Correct for week beginning %(_isodate)s
*/
-#define CENTURY_BASE\t%(year)s00
-#define LEAPSECOND_NOW\t%(leapsecs)d
-#define GPS_WEEK_NOW\t%(gps_week_now)d
+#define CENTURY_BASE\t%(_year)s00
+#define LEAPSECOND_NOW\t%(_leapsecs)d
+#define GPS_WEEK_NOW\t%(_gps_week_now)d
""" % locals()
def conditional_leapsecond_fetch(outfile, timeout):
@@ -220,7 +222,7 @@ def conditional_leapsecond_fetch(outfile, timeout):
if not stale:
return True
else:
- def handler(signum, frame):
+ def handler(_signum, _frame):
raise IOError
try:
signal.signal(signal.SIGALRM, handler)