[tor-commits] [metrics-tasks/master] Hide totals if there's only 1 list element (#6329).

karsten at torproject.org karsten at torproject.org
Fri Jul 20 14:00:01 UTC 2012


commit 694d75f8a436f7dbca1e6bb53f5a1b48a139c20f
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Fri Jul 20 15:37:08 2012 +0200

    Hide totals if there's only 1 list element (#6329).
---
 task-6329/tor-relays-stats.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/task-6329/tor-relays-stats.py b/task-6329/tor-relays-stats.py
index a2086f4..4fedf92 100755
--- a/task-6329/tor-relays-stats.py
+++ b/task-6329/tor-relays-stats.py
@@ -123,7 +123,7 @@ class RelayStats(object):
         selection_weights = (0, 0, 0, 0, 0)
         for _, weights in sorted_groups:
             selection_weights = tuple(sum(x) for x in zip(selection_weights, weights))
-        if selection_weights[0] < 0.999:
+        if len(sorted_groups) > 1 and selection_weights[0] < 0.999:
             print "%8.4f%% %8.4f%% %8.4f%% %8.4f%% %8.4f%% (total in selection)" % (
                   selection_weights[0] * 100.0, selection_weights[1] * 100.0,
                   selection_weights[2] * 100.0, selection_weights[3] * 100.0,





More information about the tor-commits mailing list