Whitespace normalization.

This commit is contained in:
Tim Peters 2001-09-18 02:26:39 +00:00
parent a86f0c17a1
commit b64bec3ec0
8 changed files with 18 additions and 21 deletions

View file

@ -489,12 +489,12 @@ def Timer(*args, **kwargs):
class _Timer(Thread):
"""Call a function after a specified number of seconds:
t = Timer(30.0, f, args=[], kwargs={})
t.start()
t.cancel() # stop the timer's action if it's still waiting
"""
def __init__(self, interval, function, args=[], kwargs={}):
Thread.__init__(self)
self.interval = interval
@ -502,11 +502,11 @@ class _Timer(Thread):
self.args = args
self.kwargs = kwargs
self.finished = Event()
def cancel(self):
"""Stop the timer if it hasn't finished yet"""
self.finished.set()
def run(self):
self.finished.wait(self.interval)
if not self.finished.isSet():