summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Pb_Api/Param/Option.py9
-rw-r--r--Pb_Api/Param/Options.py13
2 files changed, 22 insertions, 0 deletions
diff --git a/Pb_Api/Param/Option.py b/Pb_Api/Param/Option.py
new file mode 100644
index 0000000..2a345e7
--- /dev/null
+++ b/Pb_Api/Param/Option.py
@@ -0,0 +1,9 @@
+class Pb_Api_Param_Option(dict):
+ def __init__(self, **kwargs):
+ super(Pb_Api_Param_Option, self).__init__(**kwargs)
+ self.value = kwargs["value"]
+ self.weight = kwargs["weight"]
+ def __getattr__(self, attr):
+ return self.get(attr)
+ __setattr__= dict.__setitem__
+ __delattr__= dict.__delitem__
diff --git a/Pb_Api/Param/Options.py b/Pb_Api/Param/Options.py
new file mode 100644
index 0000000..d19f42a
--- /dev/null
+++ b/Pb_Api/Param/Options.py
@@ -0,0 +1,13 @@
+class Pb_Api_Param_Options:
+ def __init__(self, arr):
+ self._values = arr
+ def __iter__(self):
+ return iter(self._values)
+ def __str__(self):
+ return str(self._values)
+ def __getitem__(self, i):
+ return self._values[i]
+ def search(self, s):
+ for i in self:
+ if str(s) in i.value:
+ return i