diff options
| author | pepperpepperpepper <pepper@scannerjammer.com> | 2015-12-06 17:31:00 -0800 |
|---|---|---|
| committer | pepperpepperpepper <pepper@scannerjammer.com> | 2015-12-06 17:31:00 -0800 |
| commit | f72d7dc6a5a926f56790151e3dde36eaf7978ba0 (patch) | |
| tree | 1620560f424ffc558ac30ae1b6246d4b7df2eeac /ricky/param/probabilities.py | |
| parent | 8ebd9d7eb7b3289a722cdae6a4bdcdd4cd21ff86 (diff) | |
cleaned up names
Diffstat (limited to 'ricky/param/probabilities.py')
| -rw-r--r-- | ricky/param/probabilities.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ricky/param/probabilities.py b/ricky/param/probabilities.py new file mode 100644 index 0000000..d109b18 --- /dev/null +++ b/ricky/param/probabilities.py @@ -0,0 +1,21 @@ +from ricky.param.probability import Probability +import sys +class Probabilities: + 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): + probabilities = map(lambda x: Probability(**x), args); + return cls(*probabilities); |
