From 5fb3ea060025241105dc8e9a174513c112f9a133 Mon Sep 17 00:00:00 2001 From: rcoh Date: Thu, 27 Jan 2011 16:50:59 -0500 Subject: A metric $#%$-ton of changes. Added doc-strings to EVERYTHING. Phew. Fixed a massive bug that increases performance in by up to a factor of 60. A bunch of new behaviors for the class. --- operationscore/SmootCoreObject.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'operationscore/SmootCoreObject.py') diff --git a/operationscore/SmootCoreObject.py b/operationscore/SmootCoreObject.py index 8b36f4d..0d32773 100644 --- a/operationscore/SmootCoreObject.py +++ b/operationscore/SmootCoreObject.py @@ -4,6 +4,10 @@ import thread import util.Config as configGetter class SmootCoreObject(object): + """SmootCoreObject is essentially a super-object class which grants us some niceties. It allows + us to use objects as if they are dictionaries -- we use this to store their arguments + convienently -- note that querying for a parameter that does not exist will return None. It + also offers some basic ThreadSafety.""" def __init__(self, argDict, skipValidation = False): self.dieListeners = [] self.argDict = argDict @@ -13,8 +17,6 @@ class SmootCoreObject(object): for key in argDict: setattr(self, key, argDict[key]) self.init() #call init of inheriting class - # self.__setitem__ = self.argDict.__setitem__ - # self.__getitem__ = self.argDict.__getitem__ def init(self): pass @@ -37,7 +39,8 @@ class SmootCoreObject(object): return self.argDict[item] else: return None - + def __contains__(self, item): + return item in self.argDict def __getiter__(self): return self.argDict.__getiter__() -- cgit v1.2.3