aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/GeneralObject.py
diff options
context:
space:
mode:
authorzsloan2020-07-24 20:16:17 -0500
committerGitHub2020-07-24 20:16:17 -0500
commitf66da35a09cbb8da13cfb142cbe3ff208404970b (patch)
treeb05021c6e7b9f83c63257fec63414ecefa36668e /wqflask/base/GeneralObject.py
parent60d8968c4fc2ca15fc9cf2f63c0b34a25f6fb053 (diff)
parent5eb26c5a209f3a3c54cf6fe623e5372188bdd1bc (diff)
downloadgenenetwork2-f66da35a09cbb8da13cfb142cbe3ff208404970b.tar.gz
Merge pull request #409 from BonfaceKilz/Build/add-tests
Build/add tests
Diffstat (limited to 'wqflask/base/GeneralObject.py')
-rw-r--r--wqflask/base/GeneralObject.py77
1 files changed, 37 insertions, 40 deletions
diff --git a/wqflask/base/GeneralObject.py b/wqflask/base/GeneralObject.py
index 02a1ef06..0fccaab3 100644
--- a/wqflask/base/GeneralObject.py
+++ b/wqflask/base/GeneralObject.py
@@ -25,44 +25,41 @@
# Last updated by GeneNetwork Core Team 2010/10/20
class GeneralObject:
- """
- Base class to define an Object.
- a = [Spam(1, 4), Spam(9, 3), Spam(4,6)]
- a.sort(lambda x, y: cmp(x.eggs, y.eggs))
- """
+ """
+ Base class to define an Object.
+ a = [Spam(1, 4), Spam(9, 3), Spam(4,6)]
+ a.sort(lambda x, y: cmp(x.eggs, y.eggs))
+ """
- def __init__(self, *args, **kw):
- self.contents = list(args)
- for name, value in kw.items():
- setattr(self, name, value)
-
- def __setitem__(self, key, value):
- setattr(self, key, value)
-
- def __getitem__(self, key):
- return getattr(self, key)
-
- def __getattr__(self, key):
- if key in self.__dict__.keys():
- return self.__dict__[key]
- else:
- return eval("self.__dict__.%s" % key)
-
- def __len__(self):
- return len(self.__dict__) - 1
-
- def __str__(self):
- s = ''
- for key in self.__dict__.keys():
- if key != 'contents':
- s += '%s = %s\n' % (key,self.__dict__[key])
- return s
-
- def __repr__(self):
- s = ''
- for key in self.__dict__.keys():
- s += '%s = %s\n' % (key,self.__dict__[key])
- return s
-
- def __cmp__(self,other):
- return len(self.__dict__.keys()).__cmp__(len(other.__dict__.keys())) \ No newline at end of file
+ def __init__(self, *args, **kw):
+ self.contents = list(args)
+ for name, value in kw.items():
+ setattr(self, name, value)
+
+ def __setitem__(self, key, value):
+ setattr(self, key, value)
+
+ def __getitem__(self, key):
+ return getattr(self, key)
+
+ def __getattr__(self, key):
+ return eval("self.__dict__.%s" % key)
+
+ def __len__(self):
+ return len(self.__dict__) - 1
+
+ def __str__(self):
+ s = ''
+ for key in self.__dict__.keys():
+ if key != 'contents':
+ s += '%s = %s\n' % (key, self.__dict__[key])
+ return s
+
+ def __repr__(self):
+ s = ''
+ for key in self.__dict__.keys():
+ s += '%s = %s\n' % (key, self.__dict__[key])
+ return s
+
+ def __cmp__(self, other):
+ return len(self.__dict__.keys()).__cmp__(len(other.__dict__.keys()))