From: Ondrej Lichtner <olichtne(a)redhat.com>
Standard deviation for an empty list is not defined, but to avoid
exceptions we'll return 0 instead.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Common/Utils.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lnst/Common/Utils.py b/lnst/Common/Utils.py
index fd86a8e..c283b99 100644
--- a/lnst/Common/Utils.py
+++ b/lnst/Common/Utils.py
@@ -255,6 +255,8 @@ def dict_to_dot(original_dict, prefix=""):
return return_list
def std_deviation(values):
+ if len(values) <= 0:
+ return 0.0
s1 = 0.0
s2 = 0.0
for val in values:
--
2.1.0