summaryrefslogtreecommitdiffstats
path: root/munin.py
diff options
context:
space:
mode:
Diffstat (limited to 'munin.py')
-rw-r--r--munin.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/munin.py b/munin.py
index 5fe1d1b..e50fc2b 100644
--- a/munin.py
+++ b/munin.py
@@ -1,21 +1,20 @@
import sys
+from itertools import chain
from app import fit
-def select_entries(module_list):
- return map(lambda x: x[1], module_list)
-
-
if __name__ == "__main__":
entries = {}
- for name, instance in fit.items():
- entries[name] = map(lambda x: select_entries(instance.get_module(x)), instance.get_modules())
if len(sys.argv) > 1 and sys.argv[1] == 'config':
print 'graph_title Klausuren'
print 'graph_vlabel Amount'
for label in fit.keys():
print '%s.label %s' % (label, label.capitalize())
+
else:
- for label, value in entries.items():
- print '%s.value %s' %(label, sum(map(lambda x: len(x), value)))
+ for label, value in fit.items():
+ # fetch all file entries and chain them as a list of tuples
+ module_list = chain(*map(value.get_module, value.get_modules()))
+ amount = sum([len(x[1]) for x in module_list])
+ print '%s.value %d' % (label, amount)