From f72d7dc6a5a926f56790151e3dde36eaf7978ba0 Mon Sep 17 00:00:00 2001 From: pepperpepperpepper Date: Sun, 6 Dec 2015 17:31:00 -0800 Subject: cleaned up names --- ricky/param/probabilities.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ricky/param/probabilities.py (limited to 'ricky/param/probabilities.py') 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); -- cgit v1.2.3-70-g09d2