[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [nyx/master] Use items() rather than iteritems()



commit fd9c4549cf97e9476a4a7262f9be61e01170f76e
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Aug 28 10:15:14 2016 -0700

    Use items() rather than iteritems()
    
    Python 3.x dropped the iteritems() method since items() now provides an
    iterator...
    
      AttributeError: 'dict' object has no attribute 'iteritems'
---
 nyx/popups.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nyx/popups.py b/nyx/popups.py
index e9fa1db..ecea237 100644
--- a/nyx/popups.py
+++ b/nyx/popups.py
@@ -147,13 +147,13 @@ def show_counts(title, counts, fill_char = ' '):
     subwindow.addstr(0, 0, title, HIGHLIGHT)
 
     graph_width = subwindow.width - key_width - val_width - 11  # border, extra spaces, and percentage column
-    sorted_counts = sorted(counts.iteritems(), key = operator.itemgetter(1), reverse = True)
+    sorted_counts = sorted(counts.items(), key = operator.itemgetter(1), reverse = True)
 
     for y, (k, v) in enumerate(sorted_counts):
       label = '%s %s (%-2i%%)' % (k.ljust(key_width), str(v).rjust(val_width), v * 100 / value_total)
       x = subwindow.addstr(2, y + 1, label, GREEN, BOLD)
 
-      for j in range(graph_width * v / value_total):
+      for j in range(graph_width * v // value_total):
         subwindow.addstr(x + j + 1, y + 1, fill_char, RED, HIGHLIGHT)
 
     subwindow.addstr(2, subwindow.height - 2, 'Press any key...')



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits