summaryrefslogtreecommitdiff
path: root/Pb_Api/Params.py
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-03-06 00:47:16 -0800
committeryo mama <pepper@scannerjammer.com>2015-03-06 00:47:16 -0800
commit497adf6689bdbe6183c6343062572b84a26892b2 (patch)
treee0d29532db25fbb67ef47c2e3266745be98e3390 /Pb_Api/Params.py
parente6dcac83910b1d022b05ca68fc8b0d4b2d32c619 (diff)
ok rewriting parts
Diffstat (limited to 'Pb_Api/Params.py')
-rw-r--r--Pb_Api/Params.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/Pb_Api/Params.py b/Pb_Api/Params.py
index fff0696..9ab90a9 100644
--- a/Pb_Api/Params.py
+++ b/Pb_Api/Params.py
@@ -1,34 +1,34 @@
import pprint
class Pb_Api_Params(object):
- #so how do we need to change these?
- def param(self, name):
- for p in self.params:
- if p.name == name:
- return p
- return None
+ def param(self, name):
+ for p in self.params:
+ if p.name == name:
+ return p
+ return None
+# def __iter__(self):
+# return iter(self.params)
- def __str__(self):
- return pprint.pformat({ "params": map(lambda x: vars(x), self.params) })
+ def __str__(self):
+ return pprint.pformat({ "params": map(lambda x: vars(x), self.params) })
-#do we need to add a simple __iter__ attribute to that class so that map will work, or is it already
-#iterating? it is already
+ def randomize(self):
+ for el in self.params:
+ if el.set_by_user:
+ continue
+ el.randomize()
+
+ def __dict__(self):
+ return dict(self)
+
-
- def randomize(self):
- for el in self.params:
- if el.set_by_user:
- continue
- el.randomize()
-
-
- def is_ready(self):
- for p in self.params:
- if not p.is_ready():
- return 0
- return 1
- def as_hash(self):
- result = {}
- for p in self.params:
- result[p.name] = p.value
- return result
+ def is_ready(self):
+ for p in self.params:
+ if not p.is_ready():
+ return 0
+ return 1
+ def as_hash(self):
+ result = {}
+ for p in self.params:
+ result[p.name] = p.value
+ return result