From 497adf6689bdbe6183c6343062572b84a26892b2 Mon Sep 17 00:00:00 2001 From: yo mama Date: Fri, 6 Mar 2015 00:47:16 -0800 Subject: ok rewriting parts --- Pb_Api/Params.py | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'Pb_Api/Params.py') 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 -- cgit v1.2.3-70-g09d2