blob: 2a21cce1ad5b2c5355de6c5d6ef10aad7dfb190f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
from ricky.param.option import Option
import sys
class Options:
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):
return self._values[i]
def search(self, s):
for i in self:
if str(s) in i.value:
return i
@classmethod
def from_dict(cls, *args):
options = map(lambda x: Option(**x), args);
return cls(*options);
|