diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-03-11 02:51:58 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-03-11 02:51:58 -0700 |
| commit | a5123bfab06f7fd8884b9b4f12f579dceec43aa1 (patch) | |
| tree | 5120729cadf48ce97caeb90c34b850308c9a9f21 /Pb_Api/Param/Options.py | |
| parent | d9651ca5fb6c655afbe88a014c8bb8a8f000a70d (diff) | |
finished OOP rewriteOOP
Diffstat (limited to 'Pb_Api/Param/Options.py')
| -rw-r--r-- | Pb_Api/Param/Options.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Pb_Api/Param/Options.py b/Pb_Api/Param/Options.py index d19f42a..ebc6fc9 100644 --- a/Pb_Api/Param/Options.py +++ b/Pb_Api/Param/Options.py @@ -1,8 +1,12 @@ +from Pb_Api.Param.Option import Pb_Api_Param_Option +import sys class Pb_Api_Param_Options: - def __init__(self, arr): - self._values = arr + def __init__(self, *args): + self._values = args def __iter__(self): return iter(self._values) + def __len__(self): + return len(self._values) def __str__(self): return str(self._values) def __getitem__(self, i): @@ -11,3 +15,7 @@ class Pb_Api_Param_Options: for i in self: if str(s) in i.value: return i + @classmethod + def from_dict(cls, *args): + options = map(lambda x: Pb_Api_Param_Option(**x), args); + return cls(*options); |
