commit cba240accc983d885737daaef15774ed515fb6ca Author: Sathyanarayanan Gunasekaran gsathya.ceg@gmail.com Date: Mon Aug 20 17:05:40 2012 +0530
Add load() method to BaseFilter
This can be used as a basic init method for all the filters that inherit BaseFilter to do some initial preprocessing. --- compass.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/compass.py b/compass.py index 544306e..9d727c8 100755 --- a/compass.py +++ b/compass.py @@ -20,6 +20,9 @@ class BaseFilter(object): def accept(self, relay): pass
+ def load(self, relays): + pass + class RunningFilter(BaseFilter): def accept(self, relay): return relay['running'] @@ -132,6 +135,7 @@ class RelayStats(object): self._relays = {} relays = self.data['relays'] for f in self._filters: + f.load(relays) relays = filter(f.accept, relays)
for relay in relays: