summaryrefslogtreecommitdiff
path: root/leapsecond.py
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-10-08 20:01:50 -0700
committerGary E. Miller <gem@rellim.com>2018-10-08 20:01:50 -0700
commitcfa1cdf4267ae26a424f8280b201c49959569914 (patch)
tree8b9499bb1fc10d521e8cdfbbddf5d122a1a99e49 /leapsecond.py
parentb09e717cfefdb3844ab2e7126d4a4b8a7e97fb99 (diff)
downloadgpsd-cfa1cdf4267ae26a424f8280b201c49959569914.tar.gz
leapsecondpy: pylint remove redundant elses.
Diffstat (limited to 'leapsecond.py')
-rwxr-xr-xleapsecond.py43
1 files changed, 22 insertions, 21 deletions
diff --git a/leapsecond.py b/leapsecond.py
index b3793790..aa5a80cf 100755
--- a/leapsecond.py
+++ b/leapsecond.py
@@ -202,8 +202,8 @@ def last_insertion_time():
now = time.time()
if now > jul:
return jul
- else:
- return jan
+
+ return jan
def save_leapseconds(outfile):
@@ -294,25 +294,26 @@ def conditional_leapsecond_fetch(outfile, timeout):
stale = last_insertion_time() > os.path.getmtime(outfile)
if not stale:
return True
- else:
- def handler(_signum, _frame):
- raise IOError
- try:
- signal.signal(signal.SIGALRM, handler)
- except ValueError:
- # Parallel builds trigger this - signal only works in main thread
- sys.stdout.write("Signal set failed; ")
- return False
- signal.alarm(timeout)
- sys.stdout.write("Attempting leap-second fetch...")
- try:
- save_leapseconds(outfile)
- sys.stdout.write("succeeded.\n")
- except IOError:
- sys.stdout.write("failed; ")
- return False
- signal.alarm(0)
- return True
+
+ def handler(_signum, _frame):
+ raise IOError
+
+ try:
+ signal.signal(signal.SIGALRM, handler)
+ except ValueError:
+ # Parallel builds trigger this - signal only works in main thread
+ sys.stdout.write("Signal set failed; ")
+ return False
+ signal.alarm(timeout)
+ sys.stdout.write("Attempting leap-second fetch...")
+ try:
+ save_leapseconds(outfile)
+ sys.stdout.write("succeeded.\n")
+ except IOError:
+ sys.stdout.write("failed; ")
+ return False
+ signal.alarm(0)
+ return True
def leastsquares(tuples):