v2.0 started
diff --git a/wally/sensors/sensors/pscpu_sensors.py b/wally/sensors/sensors/pscpu_sensors.py
index cffdb71..ccbcefc 100644
--- a/wally/sensors/sensors/pscpu_sensors.py
+++ b/wally/sensors/sensors/pscpu_sensors.py
@@ -24,7 +24,7 @@
def pid_stat(pid):
- """ Return total cpu usage time from process"""
+ """Return total cpu usage time from process"""
# read /proc/pid/stat
with open(os.path.join('/proc/', pid, 'stat'), 'r') as pidfile:
proctimes = pidfile.readline().split()
diff --git a/wally/sensors/sensors/psram_sensors.py b/wally/sensors/sensors/psram_sensors.py
index faac87d..34f729a 100644
--- a/wally/sensors/sensors/psram_sensors.py
+++ b/wally/sensors/sensors/psram_sensors.py
@@ -11,7 +11,7 @@
# Note shared is always a subset of rss (trs is not always)
def get_mem_stats(pid):
- """ Return memory data of pid in format (private, shared) """
+ """Return memory data of pid in format (private, shared)"""
fname = '/proc/{0}/{1}'.format(pid, "smaps")
lines = open(fname).readlines()
@@ -69,7 +69,7 @@
def get_ram_size():
- """ Return RAM size in Kb"""
+ """Return RAM size in Kb"""
with open("/proc/meminfo") as proc:
mem_total = proc.readline().split()
return mem_total[1]
diff --git a/wally/sensors/sensors/utils.py b/wally/sensors/sensors/utils.py
index ad08676..cff3201 100644
--- a/wally/sensors/sensors/utils.py
+++ b/wally/sensors/sensors/utils.py
@@ -20,7 +20,7 @@
def get_pid_list(disallowed_prefixes, allowed_prefixes):
- """ Return pid list from list of pids and names """
+ """Return pid list from list of pids and names"""
# exceptions
but = disallowed_prefixes if disallowed_prefixes is not None else []
if allowed_prefixes is None:
@@ -42,7 +42,7 @@
def get_pid_name(pid):
- """ Return name by pid """
+ """Return name by pid"""
try:
with open(os.path.join('/proc/', pid, 'cmdline'), 'r') as pidfile:
try:
diff --git a/wally/statistic.py b/wally/statistic.py
index 06d525e..e2021e1 100644
--- a/wally/statistic.py
+++ b/wally/statistic.py
@@ -16,8 +16,11 @@
def med_dev(vals):
+ if len(vals) == 1:
+ return vals[0], 0.0
+
med = sum(vals) / len(vals)
- dev = ((sum(abs(med - i) ** 2.0 for i in vals) / len(vals)) ** 0.5)
+ dev = ((sum(abs(med - i) ** 2.0 for i in vals) / (len(vals) - 1)) ** 0.5)
return med, dev