From: Michael Tremer Date: Sun, 20 Sep 2020 14:05:27 +0000 (+0000) Subject: Drop unused Timer class X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9990ad3dcfbcb30ffdee27843e9a4ca20e5b825c;p=collecty.git Drop unused Timer class Signed-off-by: Michael Tremer --- diff --git a/src/collecty/plugins/__init__.py b/src/collecty/plugins/__init__.py index 031a6d9..147a1b6 100644 --- a/src/collecty/plugins/__init__.py +++ b/src/collecty/plugins/__init__.py @@ -19,7 +19,7 @@ # # ############################################################################### -from .base import Timer, get +from .base import get from . import base from . import contextswitches diff --git a/src/collecty/plugins/base.py b/src/collecty/plugins/base.py index 249f395..c85e315 100644 --- a/src/collecty/plugins/base.py +++ b/src/collecty/plugins/base.py @@ -37,38 +37,6 @@ from ..i18n import _ DEF_MATCH = re.compile(r"C?DEF:([A-Za-z0-9_]+)=") -class Timer(object): - def __init__(self, timeout, heartbeat=1): - self.timeout = timeout - self.heartbeat = heartbeat - - self.delay = 0 - - self.reset() - - def reset(self, delay=0): - # Save start time. - self.start = time.time() - - self.delay = delay - - # Has this timer been killed? - self.killed = False - - @property - def elapsed(self): - return time.time() - self.start - self.delay - - def cancel(self): - self.killed = True - - def wait(self): - while self.elapsed < self.timeout and not self.killed: - time.sleep(self.heartbeat) - - return self.elapsed > self.timeout - - class Environment(object): """ Sets the correct environment for rrdtool to create