aboutsummaryrefslogtreecommitdiff
path: root/operationscore/SmootCoreObject.py
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2011-01-27 16:50:59 -0500
committerGravatar rcoh <rcoh@mit.edu>2011-01-27 16:50:59 -0500
commit5fb3ea060025241105dc8e9a174513c112f9a133 (patch)
treee98b1b3eab0b05b0e518b08cbab086d224fd9250 /operationscore/SmootCoreObject.py
parent5d29906fff79bc6e4ba83be7028e1380a0014d21 (diff)
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.
Diffstat (limited to 'operationscore/SmootCoreObject.py')
-rw-r--r--operationscore/SmootCoreObject.py9
1 files changed, 6 insertions, 3 deletions
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__()