summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2020-03-28 13:33:00 +0100
committerLars-Dominik Braun <lars@6xq.net>2020-03-28 13:33:00 +0100
commitd56e5367e76ac700612593db9454d68235786f1a (patch)
treea43013764c539f91e253f0403235a8fc46e645de
parent40cbd7e39aea4416fe8b73f10b4f5b93a6d55a52 (diff)
downloadlulua-d56e5367e76ac700612593db9454d68235786f1a.tar.gz
lulua-d56e5367e76ac700612593db9454d68235786f1a.tar.bz2
lulua-d56e5367e76ac700612593db9454d68235786f1a.zip
stats: Enumerate combinations
-rw-r--r--lulua/stats.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lulua/stats.py b/lulua/stats.py
index 13d878b..550f85a 100644
--- a/lulua/stats.py
+++ b/lulua/stats.py
@@ -263,10 +263,12 @@ def pretty (args):
print (f'{k} {v:10d} {v/buttonPresses*100:5.1f}%')
combinationTotal = sum (stats['simple'].combinations.values ())
+ items = stats['simple'].combinations.items ()
+ n = len (items)
print ('combinations', combinationTotal)
- for k, v in sorted (stats['simple'].combinations.items (), key=itemgetter (1)):
+ for i, (k, v) in enumerate (sorted (items, key=itemgetter (1))):
t = displayText (layout.getText (k))
- print (f'{t:4s} {k} {v:10d} {v/combinationTotal*100:5.1f}%')
+ print (f'{n-i: 3d}. {t:4s} {k} {v:10d} {v/combinationTotal*100:7.3f}%')
print ('unknown')
for k, v in sorted (stats['simple'].unknown.items (), key=itemgetter (1)):