Commit 1d9fc9a7 authored by Charles Ferguson's avatar Charles Ferguson
Browse files

Fix lint problems with unused variables.

There werea number of lint issues with variables which were unused in
the timer and test code. These have been replaced by '_' placeholders
where possible. Test code had lots of 'no-self-use' which is common
in the test functions.
parent e12fbf2a
......@@ -94,7 +94,7 @@ class AlarmManager(object):
(remaining_time, repeating_time) = signal.getitimer(signal.ITIMER_REAL)
if remaining_time > 0:
def call_old_handler(alarm, frame, old_handler=old_handler, repeating_time=repeating_time):
def call_old_handler(_, frame, old_handler=old_handler, repeating_time=repeating_time):
if old_handler == signal.SIG_DFL:
# Raise the signal through the default handler (which appears to be untrappable)
signal.signal(signal.SIGALRM, signal.SIG_DFL)
......@@ -120,9 +120,12 @@ class AlarmManager(object):
print("Next alarm will be in %s seconds: %s" % (next_time, next_alarm))
signal.setitimer(signal.ITIMER_REAL, next_time)
def _alarm_handler(self, sig, frame):
def _alarm_handler(self, _, frame):
Raw signal handler, so that we can dispatch to the registered handlers.
@param _: signal number, which we can ignore
@param frame: stack frame
# Alarms will be suspended for the duration of the handler, as this makes it significantly
......@@ -209,7 +212,7 @@ class Timer(object):
with timer:
except timer.exception as exc:
print "Trapped the timeout exception"
print("Trapped the timeout exception")
Providing a handler to do something else, such as terminating at a convenient point::
......@@ -230,7 +233,7 @@ class Timer(object):
with Timer() as timer:
print "Took %s seconds" % (timer.elapsed,)
print("Took %s seconds" % (timer.elapsed,))
def __init__(self, timeout_in_seconds=None, handler=None, name=None):
self.timeout_in_seconds = timeout_in_seconds
......@@ -273,11 +276,11 @@ class Timer(object):
self.alarm = None
def _alarm_handler(self, alarm, frame):
def _alarm_handler(self, _, frame):
def default_handler(self, frame):
def default_handler(self, _):
raise self.exception('Timeout of %s seconds reached' % (self.timeout_in_seconds,), self)
def reset(self, timeout):
......@@ -8,6 +8,8 @@ Class: Functional
Type: Unit test
# pylint: disable=no-self-use
from __future__ import print_function
import os
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment