From c557bfbd418c903a6c70fc0cbffddab1a363cea9 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 27 Oct 2013 16:51:16 +0100 Subject: [PATCH 1/1] Re-implement ToBeWoken as class instead of namedtuple (it must be modifiable) --- waker.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/waker.py b/waker.py index 9c2cf06..681de1b 100644 --- a/waker.py +++ b/waker.py @@ -1,10 +1,15 @@ from libtuer import ThreadRepeater -from collections import namedtuple from threading import Lock SLEEP_TIME = 0.5 -ToBeWoken = namedtuple('ToBeWoken','f period time_since_call one_shot') +class ToBeWoken: + '''a simple struct storing information about a to-be-woken function''' + def __init__(self, f, period, one_shot): + self.f = f + self.period = period + self.time_since_call = 0 + self.one_shot = one_shot class Waker(): def __init__(self, sm): -- 2.30.2